Skip to content

Commit eb7093e

Browse files
authored
tweak(shadow): Double 3D shadow buffers in W3DBufferManager (#1691)
1 parent 9e4b82f commit eb7093e

File tree

2 files changed

+36
-18
lines changed

2 files changed

+36
-18
lines changed

Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DBufferManager.h

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,25 @@
3636
#include "dx8vertexbuffer.h"
3737
#include "dx8indexbuffer.h"
3838

39-
#define MAX_VB_SIZES 128 //number of different sized VB slots allowed.
40-
#define MIN_SLOT_SIZE 32 //minimum number of vertices allocated per slot (power of 2). See also MIN_SLOT_SIZE_SHIFT.
41-
#define MIN_SLOT_SIZE_SHIFT 5 //used for division by MIN_SLOT_SIZE
42-
#define MAX_VERTEX_BUFFERS_CREATED 32 //maximum number of D3D vertex buffers allowed to create per vertex type.
43-
#define DEFAULT_VERTEX_BUFFER_SIZE 8192 //this size ends up generating VB's of about 256Kbytes
44-
#define MAX_NUMBER_SLOTS 4096 //maximum number of slots that can be allocated.
45-
39+
// TheSuperHackers @info The max sizes correspond to a number of vertices and indices of a mesh casting shadows
40+
// in the scene. The more vertices the meshes are supposed to have, the higher these limits need to be.
41+
// Multiplying these numbers by MIN_SLOT_SIZE gives the max supported amount of vertices and indices.
42+
#define MAX_VB_SIZES 128 //number of different sized VB slots allowed.
4643
#define MAX_IB_SIZES 128 //number of different sized IB slots allowed (goes all the way up to 65536)
47-
#define MAX_INDEX_BUFFERS_CREATED 32
48-
#define DEFAULT_INDEX_BUFFER_SIZE 32768
44+
45+
#define MIN_SLOT_SIZE_SHIFT 5 //used for division by MIN_SLOT_SIZE
46+
#define MIN_SLOT_SIZE (1 << MIN_SLOT_SIZE_SHIFT) //minimum number of vertices allocated per slot (power of 2).
47+
48+
// TheSuperHackers @info The number of slots corresponds to number of meshes casting shadows in the scene.
49+
// The more meshes there are, the larger the slots needs to be.
50+
// TheSuperHackers @tweak Double the original sizes to allow for twice as many shadows to be created in the scene.
51+
#define SLOTS_MULTIPLIER 2
52+
#define MAX_NUMBER_SLOTS (4096 * SLOTS_MULTIPLIER) //maximum number of slots that can be allocated.
53+
#define MAX_VERTEX_BUFFERS_CREATED (32 * SLOTS_MULTIPLIER) //maximum number of D3D vertex buffers allowed to create per vertex type.
54+
#define MAX_INDEX_BUFFERS_CREATED (32 * SLOTS_MULTIPLIER)
55+
56+
#define DEFAULT_VERTEX_BUFFER_SIZE 8192 //this size ends up generating VB's of about 256Kbytes
57+
#define DEFAULT_INDEX_BUFFER_SIZE 32768
4958

5059
class W3DBufferManager
5160
{

GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DBufferManager.h

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,25 @@
3636
#include "dx8vertexbuffer.h"
3737
#include "dx8indexbuffer.h"
3838

39-
#define MAX_VB_SIZES 128 //number of different sized VB slots allowed.
40-
#define MIN_SLOT_SIZE 32 //minimum number of vertices allocated per slot (power of 2). See also MIN_SLOT_SIZE_SHIFT.
41-
#define MIN_SLOT_SIZE_SHIFT 5 //used for division by MIN_SLOT_SIZE
42-
#define MAX_VERTEX_BUFFERS_CREATED 32 //maximum number of D3D vertex buffers allowed to create per vertex type.
43-
#define DEFAULT_VERTEX_BUFFER_SIZE 8192 //this size ends up generating VB's of about 256Kbytes
44-
#define MAX_NUMBER_SLOTS 4096 //maximum number of slots that can be allocated.
45-
39+
// TheSuperHackers @info The max sizes correspond to a number of vertices and indices of a mesh casting shadows
40+
// in the scene. The more vertices the meshes are supposed to have, the higher these limits need to be.
41+
// Multiplying these numbers by MIN_SLOT_SIZE gives the max supported amount of vertices and indices.
42+
#define MAX_VB_SIZES 128 //number of different sized VB slots allowed.
4643
#define MAX_IB_SIZES 128 //number of different sized IB slots allowed (goes all the way up to 65536)
47-
#define MAX_INDEX_BUFFERS_CREATED 32
48-
#define DEFAULT_INDEX_BUFFER_SIZE 32768
44+
45+
#define MIN_SLOT_SIZE_SHIFT 5 //used for division by MIN_SLOT_SIZE
46+
#define MIN_SLOT_SIZE (1 << MIN_SLOT_SIZE_SHIFT) //minimum number of vertices allocated per slot (power of 2).
47+
48+
// TheSuperHackers @info The number of slots corresponds to number of meshes casting shadows in the scene.
49+
// The more meshes there are, the larger the slots needs to be.
50+
// TheSuperHackers @tweak Double the original sizes to allow for twice as many shadows to be created in the scene.
51+
#define SLOTS_MULTIPLIER 2
52+
#define MAX_NUMBER_SLOTS (4096 * SLOTS_MULTIPLIER) //maximum number of slots that can be allocated.
53+
#define MAX_VERTEX_BUFFERS_CREATED (32 * SLOTS_MULTIPLIER) //maximum number of D3D vertex buffers allowed to create per vertex type.
54+
#define MAX_INDEX_BUFFERS_CREATED (32 * SLOTS_MULTIPLIER)
55+
56+
#define DEFAULT_VERTEX_BUFFER_SIZE 8192 //this size ends up generating VB's of about 256Kbytes
57+
#define DEFAULT_INDEX_BUFFER_SIZE 32768
4958

5059
class W3DBufferManager
5160
{

0 commit comments

Comments
 (0)