Structures

CgsGraphics::MaterialState

Offset Length Type Name Description Comments
0x0 0x4 BlendState* mpBlendState
0x4 0x4 DepthStencilState* mpDepthStencilState
0x8 0x4 RasterizerState* mpRasterizerState

renderengine::BlendState

Offset Length Type Name Description Comments
0x0 0x4 D3DBLENDSTATE ? Blend state
0x4 0x10 DWORD[4] ? Color Write Enable See flags
0x14 0x10 float[4] ? Color
0x24 0x4 BOOL ? Alpha Blend Enable
0x28 0x4 BOOL ? Separate Alpha Blend Enable
0x2C 0x4 BOOL ? Alpha Test Enable
0x30 0x4 D3DCMPFUNC ? Alpha Function
0x34 0x4 uint32_t ? Alpha Reference
0x38 0x4 ? ?
0x3C 0x4 BOOL ?
0x40 0x4 ? ? Game doesn't access these members
0x44 0x4 ? ?

D3DBLENDSTATE

From the Microsoft Xbox 360 SDK.

Offset (bits) Length (bits) Name Description Comments
0 5 SrcBlend The blend mode for the source color values. See D3DBLEND
5 3 BlendOp The arithmetic operation applied against the source and destination color values. See D3DBLENDOP
8 8 DestBlend The blend mode for the destination color values. See D3DBLEND
16 5 SrcBlendAlpha The blend mode for the source alpha values. See D3DBLEND
21 3 BlendOpAlpha The arithmetic operation applied against the source and destination alpha values. See D3DBLENDOP
24 8 DestBlendAlpha The blend mode for the destination alpha values. See D3DBLEND

renderengine::DepthStencilState

Offset Length Type Name Description Comments
0x0 0x4 D3DCMPFUNC ? Z function
0x4 0x4 D3DSTENCILOP ? Stencil fail
0x8 0x4 D3DSTENCILOP ? Stencil Z fail
0xC 0x4 D3DSTENCILOP ? Stencil pass
0x10 0x4 D3DCMPFUNC ? Stencil function
0x14 0x4 D3DSTENCILOP ? CCW stencil fail
0x18 0x4 D3DSTENCILOP ? CCW stencil Z fail
0x1C 0x4 D3DSTENCILOP ? CCW stencil pass
0x20 0x4 D3DCMPFUNC ? CCW stencil function
0x24 0x4 uint32_t ? Stencil reference
0x28 0x4 DWORD ? Stencil mask
0x2C 0x4 DWORD ? Stencil write mask
0x30 0x4 D3DZBUFFERTYPE ? Z enable
0x34 0x4 BOOL ? Z write enable
0x38 0x4 BOOL ? Stencil enable
0x3C 0x4 BOOL ? Two sided stencil mode enable
0x40 0x4 ? ? Game doesn't access these members
0x44 0x4 ? ?

renderengine::RasterizerState

Offset Length Type Name Description Comments
0x0 0x4 D3DFILLMODE ? Fill mode
0x4 0x4 D3DCULL ? Cull mode
0x8 0x4 float ? Depth bias
0xC 0x4 float ? Slope scale depth bias
0x10 0x4 DWORD ? Multisample mask
0x14 0x4 BOOL ? Scissor test enable
0x18 0x4 BOOL ? Multisample antialias enable
0x1C 0x4 BOOL ? sRGB write enable
0x20 0x4 BOOL ? Antialiased line enable
0x24 0x4 ? ? Game doesn't access these members
0x28 0x4 ? ?
0x2C 0x4 ? ?
0x30 0x4 ? ?
0x34 0x4 ? ?
0x38 0x4 ? ?
0x3C 0x4 ? ?
0x40 0x4 ? ?
0x44 0x4 ? ?
0x48 0x4 ? ?
0x4C 0x4 ? ?
0x50 0x4 ? ?

Enumerations

D3DBLEND

From the Microsoft Learn page.

Name Value Comments
D3DBLEND_ZERO 1 Blend factor is (0, 0, 0, 0).
D3DBLEND_ONE 2 Blend factor is (1, 1, 1, 1).
D3DBLEND_SRCCOLOR 3 Blend factor is (Rₛ, Gₛ, Bₛ, Aₛ).
D3DBLEND_INVSRCCOLOR 4 Blend factor is (1 - Rₛ, 1 - Gₛ, 1 - Bₛ, 1 - Aₛ).
D3DBLEND_SRCALPHA 5 Blend factor is (Aₛ, Aₛ, Aₛ, Aₛ).
D3DBLEND_INVSRCALPHA 6 Blend factor is ( 1 - Aₛ, 1 - Aₛ, 1 - Aₛ, 1 - Aₛ).
D3DBLEND_DESTALPHA 7 Blend factor is (Ad Ad Ad Ad).
D3DBLEND_INVDESTALPHA 8 Blend factor is (1 - Ad 1 - Ad 1 - Ad 1 - Ad).
D3DBLEND_DESTCOLOR 9 Blend factor is (Rd, Gd, Bd, Ad).
D3DBLEND_INVDESTCOLOR 10 Blend factor is (1 - Rd, 1 - Gd, 1 - Bd, 1 - Ad).
D3DBLEND_SRCALPHASAT 11 Blend factor is (f, f, f, 1); where f = min(Aₛ, 1 - Ad).
D3DBLEND_BOTHSRCALPHA 12 Obsolete. Starting with DirectX 6, you can achieve the same effect by setting the source and destination blend factors to D3DBLEND_SRCALPHA and D3DBLEND_INVSRCALPHA in separate calls.
D3DBLEND_BOTHINVSRCALPHA 13 Obsolete. Source blend factor is (1 - Aₛ, 1 - Aₛ, 1 - Aₛ, 1 - Aₛ), and destination blend factor is (Aₛ, Aₛ, Aₛ, Aₛ); the destination blend selection is overridden. This blend mode is supported only for the D3DRS_SRCBLEND render state.
D3DBLEND_BLENDFACTOR 14 Constant color blending factor used by the frame-buffer blender. This blend mode is supported only if D3DPBLENDCAPS_BLENDFACTOR is set in the SrcBlendCaps or DestBlendCaps members of D3DCAPS9.
D3DBLEND_INVBLENDFACTOR 15 Inverted constant color-blending factor used by the frame-buffer blender. This blend mode is supported only if the D3DPBLENDCAPS_BLENDFACTOR bit is set in the SrcBlendCaps or DestBlendCaps members of D3DCAPS9.
D3DBLEND_SRCCOLOR2 16 Blend factor is (PSOutColor[1]r, PSOutColor[1]g, PSOutColor[1]b, not used). See Render Target Blending. This flag is available in Direct3D 9Ex only.
D3DBLEND_INVSRCCOLOR2 17 Blend factor is (1 - PSOutColor[1]r, 1 - PSOutColor[1]g, 1 - PSOutColor[1]b, not used)). See Render Target Blending. This flag is available in Direct3D 9Ex only.
D3DBLEND_FORCE_DWORD 0x7FFFFFFF Forces this enumeration to compile to 32 bits in size. Without this value, some compilers would allow this enumeration to compile to a size other than 32 bits. This value is not used.

D3DBLENDOP

From the Microsoft Learn page.

Name Value Comments
D3DBLENDOP_ADD 1 The result is the destination added to the source. Result = Source + Destination
D3DBLENDOP_SUBTRACT 2 The result is the destination subtracted from to the source. Result = Source - Destination
D3DBLENDOP_REVSUBTRACT 3 The result is the source subtracted from the destination. Result = Destination - Source
D3DBLENDOP_MIN 4 The result is the minimum of the source and destination. Result = MIN(Source, Destination)
D3DBLENDOP_MAX 5 The result is the maximum of the source and destination. Result = MAX(Source, Destination)
D3DBLENDOP_FORCE_DWORD 0x7FFFFFFF Forces this enumeration to compile to 32 bits in size. Without this value, some compilers would allow this enumeration to compile to a size other than 32 bits. This value is not used.

Color write enable flags

From the Rust documentation.

Name Value Comments
D3DCOLORWRITEENABLE_RED 0x1
D3DCOLORWRITEENABLE_GREEN 0x2
D3DCOLORWRITEENABLE_BLUE 0x4
D3DCOLORWRITEENABLE_ALPHA 0x8

D3DCMPFUNC

From the Microsoft Learn page.

Name Value Comments
D3DCMP_NEVER 1 Always fail the test.
D3DCMP_LESS 2 Accept the new pixel if its value is less than the value of the current pixel.
D3DCMP_EQUAL 3 Accept the new pixel if its value equals the value of the current pixel.
D3DCMP_LESSEQUAL 4 Accept the new pixel if its value is less than or equal to the value of the current pixel.
D3DCMP_GREATER 5 Accept the new pixel if its value is greater than the value of the current pixel.
D3DCMP_NOTEQUAL 6 Accept the new pixel if its value does not equal the value of the current pixel.
D3DCMP_GREATEREQUAL 7 Accept the new pixel if its value is greater than or equal to the value of the current pixel.
D3DCMP_ALWAYS 8 Always pass the test.
D3DCMP_FORCE_DWORD 0x7FFFFFFF Forces this enumeration to compile to 32 bits in size. Without this value, some compilers would allow this enumeration to compile to a size other than 32 bits. This value is not used.

D3DSTENCILOP

From the Microsoft Learn page.

Name Value Comments
D3DSTENCILOP_KEEP 1 Do not update the entry in the stencil buffer. This is the default value.
D3DSTENCILOP_ZERO 2 Set the stencil-buffer entry to 0.
D3DSTENCILOP_REPLACE 3 Replace the stencil-buffer entry with a reference value.
D3DSTENCILOP_INCRSAT 4 Increment the stencil-buffer entry, clamping to the maximum value.
D3DSTENCILOP_DECRSAT 5 Decrement the stencil-buffer entry, clamping to zero.
D3DSTENCILOP_INVERT 6 Invert the bits in the stencil-buffer entry.
D3DSTENCILOP_INCR 7 Increment the stencil-buffer entry, wrapping to zero if the new value exceeds the maximum value.
D3DSTENCILOP_DECR 8 Decrement the stencil-buffer entry, wrapping to the maximum value if the new value is less than zero.
D3DSTENCILOP_FORCE_DWORD 0x7FFFFFFF Forces this enumeration to compile to 32 bits in size. Without this value, some compilers would allow this enumeration to compile to a size other than 32 bits. This value is not used.

D3DZBUFFERTYPE

From the Microsoft Learn page.

Name Value Comments
D3DZB_FALSE 0 Disable depth buffering.
D3DZB_TRUE 1 Enable z-buffering.
D3DZB_USEW 2 Enable w-buffering.
D3DZB_FORCE_DWORD 0x7FFFFFFF Forces this enumeration to compile to 32 bits in size. Without this value, some compilers would allow this enumeration to compile to a size other than 32 bits. This value is not used.

D3DFILLMODE

From the Microsoft Learn page.

Name Value Comments
D3DFILL_POINT 1 Fill points.
D3DFILL_WIREFRAME 2 Fill wireframes.
D3DFILL_SOLID 3 Fill solids.
D3DFILL_FORCE_DWORD 0x7FFFFFFF Forces this enumeration to compile to 32 bits in size. Without this value, some compilers would allow this enumeration to compile to a size other than 32 bits. This value is not used.

D3DCULL

From the Microsoft Learn page.

Name Value Comments
D3DCULL_NONE 1
D3DCULL_CW 2
D3DCULL_CCW 3
D3DCULL_FORCE_DWORD 0x7FFFFFFF