Material State/Remastered
Structures
CgsGraphics::MaterialState
32-bit
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0x4 | BlendState* | mpBlendState | ||
0x4 | 0x4 | DepthStencilState* | mpDepthStencilState | ||
0x8 | 0x4 | RasterizerState* | mpRasterizerState |
64-bit
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0x8 | BlendState* | mpBlendState | ||
0x8 | 0x8 | DepthStencilState* | mpDepthStencilState | ||
0x10 | 0x8 | RasterizerState* | mpRasterizerState |
renderengine::BlendState
In part from Microsoft Learn.
32-bit
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0x20 | RenderTargetBlendState[8] | RenderTarget | An array of D3D11_RENDER_TARGET_BLEND_DESC structures that describe the blend states for render targets; these correspond to the eight render targets that can be bound to the output-merger stage at one time. | |
0x20 | 0x4 | float | ? | ||
0x24 | 0x4 | float | ? | ||
0x28 | 0x4 | float | ? | ||
0x2C | 0x4 | float | ? | ||
0x30 | 0x1 | bool | AlphaToCoverageEnable | Specifies whether to use alpha-to-coverage as a multisampling technique when setting a pixel to a render target. | For more info about using alpha-to-coverage, see Alpha-To-Coverage. |
0x31 | 0x1 | bool | IndependentBlendEnable | Specifies whether to enable independent blending in simultaneous render targets. Set to TRUE to enable independent blending. If set to FALSE, only the RenderTarget[0] members are used; RenderTarget[1..7] are ignored. | |
0x32 | 0x2 | Padding | |||
0x34 | 0x4 | uint32_t | ? | Reference count | Initially set to 1. Decremented by each call to Release on the interface |
0x38 | 0x4 | ID3D11BlendState* | ? | Blend state interface | Set at runtime |
64-bit
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0x20 | RenderTargetBlendState[8] | RenderTarget | An array of D3D11_RENDER_TARGET_BLEND_DESC structures that describe the blend states for render targets; these correspond to the eight render targets that can be bound to the output-merger stage at one time. | |
0x20 | 0x4 | float | ? | ||
0x24 | 0x4 | float | ? | ||
0x28 | 0x4 | float | ? | ||
0x2C | 0x4 | float | ? | ||
0x30 | 0x1 | bool | AlphaToCoverageEnable | Specifies whether to use alpha-to-coverage as a multisampling technique when setting a pixel to a render target. | For more info about using alpha-to-coverage, see Alpha-To-Coverage. |
0x31 | 0x1 | bool | IndependentBlendEnable | Specifies whether to enable independent blending in simultaneous render targets. Set to TRUE to enable independent blending. If set to FALSE, only the RenderTarget[0] members are used; RenderTarget[1..7] are ignored. | |
0x32 | 0x2 | Padding | |||
0x34 | 0x4 | uint32_t | ? | Reference count | Initially set to 1. Decremented by each call to Release on the interface |
0x38 | 0x8 | ID3D11BlendState* | ? | Blend state interface | Set at runtime |
renderengine::RenderTargetBlendState
From the Microsoft Learn page.
Offset (bits) | Length (bits) | Name | Description | Comments |
---|---|---|---|---|
0 | 1 | BlendEnable | Enable (or disable) blending. | |
1 | 5 | SrcBlend | This blend option specifies the operation to perform on the RGB value that the pixel shader outputs. The BlendOp member defines how to combine the SrcBlend and DestBlend operations. | See D3DBLEND |
6 | 5 | DestBlend | This blend operation defines how to combine the SrcBlend and DestBlend operations. | See D3DBLEND |
11 | 3 | BlendOp | This blend operation defines how to combine the SrcBlend and DestBlend operations. | See D3DBLENDOP |
14 | 5 | SrcBlendAlpha | This blend option specifies the operation to perform on the alpha value that the pixel shader outputs. Blend options that end in _COLOR are not allowed. The BlendOpAlpha member defines how to combine the SrcBlendAlpha and DestBlendAlpha operations. | See D3DBLEND |
19 | 5 | DestBlendAlpha | This blend option specifies the operation to perform on the current alpha value in the render target. Blend options that end in _COLOR are not allowed. The BlendOpAlpha member defines how to combine the SrcBlendAlpha and DestBlendAlpha operations. | See D3DBLEND |
24 | 3 | BlendOpAlpha | This blend operation defines how to combine the SrcBlendAlpha and DestBlendAlpha operations. | See D3DBLENDOP |
27 | 4 | RenderTargetWriteMask | A write mask. | See D3D11_COLOR_WRITE_ENABLE |
31 | 1 | Padding |
renderengine::DepthStencilState
In part from Microsoft Learn.
32-bit
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0x4 | D3D11_COMPARISON_FUNC | DepthFunc | A function that compares depth data against existing depth data. | |
0x4 | 0x10 | D3D11_DEPTH_STENCILOP_DESC | FrontFace | Identify how to use the results of the depth test and the stencil test for pixels whose surface normal is facing towards the camera. | |
0x14 | 0x10 | D3D11_DEPTH_STENCILOP_DESC | BackFace | Identify how to use the results of the depth test and the stencil test for pixels whose surface normal is facing away from the camera. | |
0x24 | 0x4 | uint32_t | ? | Stencil reference | |
0x28 | 0x4 | uint32_t | StencilReadMask | Identify a portion of the depth-stencil buffer for reading stencil data. | Only the least significant byte is used |
0x2C | 0x4 | uint32_t | StencilWriteMask | Identify a portion of the depth-stencil buffer for writing stencil data. | Only the least significant byte is used |
0x30 | 0x1 | bool | DepthEnable | Enable depth testing. | |
0x31 | 0x1 | bool | ? | Depth write enable | |
0x32 | 0x1 | bool | StencilEnable | Enable stencil testing. | |
0x33 | 0x1 | Padding | |||
0x34 | 0x4 | uint32_t | ? | Reference count | Initially set to 1. Decremented by each call to Release on the interface |
0x38 | 0x4 | ID3D11DepthStencilState* | ? | Depth stencil state interface | Set at runtime |
0x3C | 0x4 | uint32_t | ? | Stencil reference | Copy of the value at offset 0x24 |
64-bit
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0x4 | D3D11_COMPARISON_FUNC | DepthFunc | A function that compares depth data against existing depth data. | |
0x4 | 0x10 | D3D11_DEPTH_STENCILOP_DESC | FrontFace | Identify how to use the results of the depth test and the stencil test for pixels whose surface normal is facing towards the camera. | |
0x14 | 0x10 | D3D11_DEPTH_STENCILOP_DESC | BackFace | Identify how to use the results of the depth test and the stencil test for pixels whose surface normal is facing away from the camera. | |
0x24 | 0x4 | uint32_t | ? | Stencil reference | |
0x28 | 0x4 | uint32_t | StencilReadMask | Identify a portion of the depth-stencil buffer for reading stencil data. | Only the least significant byte is used |
0x2C | 0x4 | uint32_t | StencilWriteMask | Identify a portion of the depth-stencil buffer for writing stencil data. | Only the least significant byte is used |
0x30 | 0x1 | bool | DepthEnable | Enable depth testing. | |
0x31 | 0x1 | bool | ? | Depth write enable | |
0x32 | 0x1 | bool | StencilEnable | Enable stencil testing. | |
0x33 | 0x1 | Padding | |||
0x34 | 0x4 | uint32_t | ? | Reference count | Initially set to 1 Decremented by each call to Release on the interface |
0x38 | 0x8 | ID3D11DepthStencilState* | ? | Depth stencil state interface | Set at runtime |
0x40 | 0x4 | uint32_t | ? | Stencil reference | Copy of the value at offset 0x24 |
D3D11_DEPTH_STENCILOP_DESC
From the Microsoft Learn page.
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0x4 | D3D11_STENCIL_OP | StencilFailOp | The stencil operation to perform when stencil testing fails. | |
0x4 | 0x4 | D3D11_STENCIL_OP | StencilDepthFailOp | The stencil operation to perform when stencil testing passes and depth testing fails. | |
0x8 | 0x4 | D3D11_STENCIL_OP | StencilPassOp | The stencil operation to perform when stencil testing and depth testing both pass. | |
0xC | 0x4 | D3D11_COMPARISON_FUNC | StencilFunc | A function that compares stencil data against existing stencil data. |
renderengine::RasterizerState
In part from the Microsoft Learn page.
32-bit
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0x4 | D3D11_FILL_MODE | FillMode | Determines the fill mode to use when rendering. | |
0x4 | 0x4 | D3D11_CULL_MODE | CullMode | Indicates triangles facing the specified direction are not drawn. | |
0x8 | 0x4 | int32_t | FrontCounterClockwise | Determines if a triangle is front- or back-facing. If this parameter is TRUE, a triangle will be considered front-facing if its vertices are counter-clockwise on the render target and considered back-facing if they are clockwise. If this parameter is FALSE, the opposite is true. | |
0xC | 0x4 | int32_t | DepthBias | Depth value added to a given pixel. | For info about depth bias, see Depth Bias. |
0x10 | 0x4 | float | DepthBiasClamp | Maximum depth bias of a pixel. | For info about depth bias, see Depth Bias. |
0x14 | 0x4 | float | SlopeScaledDepthBias | Scalar on a given pixel's slope. | For info about depth bias, see Depth Bias. |
0x18 | 0x1 | bool | DepthClipEnable | Enable clipping based on distance. | |
0x19 | 0x1 | bool | ScissorEnable | Enable scissor-rectangle culling. All pixels outside an active scissor rectangle are culled. | |
0x1A | 0x1 | bool | MultisampleEnable | Specifies whether to use the quadrilateral or alpha line anti-aliasing algorithm on multisample antialiasing (MSAA) render targets. Set to TRUE to use the quadrilateral line anti-aliasing algorithm and to FALSE to use the alpha line anti-aliasing algorithm. | |
0x1B | 0x1 | bool | AntialiasedLineEnable | Specifies whether to enable line antialiasing; only applies if doing line drawing and MultisampleEnable is FALSE. | |
0x1C | 0x4 | uint32_t | ? | Reference count | Initially set to 1. Decremented by each call to Release on the interface |
0x20 | 0x4 | ID3D11RasterizerState* | ? | Rasterizer state interface | Set at runtime |
64-bit
Offset | Length | Type | Name | Description | Comments |
---|---|---|---|---|---|
0x0 | 0x4 | D3D11_FILL_MODE | FillMode | Determines the fill mode to use when rendering. | |
0x4 | 0x4 | D3D11_CULL_MODE | CullMode | Indicates triangles facing the specified direction are not drawn. | |
0x8 | 0x4 | int32_t | FrontCounterClockwise | Determines if a triangle is front- or back-facing. If this parameter is TRUE, a triangle will be considered front-facing if its vertices are counter-clockwise on the render target and considered back-facing if they are clockwise. If this parameter is FALSE, the opposite is true. | |
0xC | 0x4 | int32_t | DepthBias | Depth value added to a given pixel. | For info about depth bias, see Depth Bias. |
0x10 | 0x4 | float | DepthBiasClamp | Maximum depth bias of a pixel. | For info about depth bias, see Depth Bias. |
0x14 | 0x4 | float | SlopeScaledDepthBias | Scalar on a given pixel's slope. | For info about depth bias, see Depth Bias. |
0x18 | 0x1 | bool | DepthClipEnable | Enable clipping based on distance. | |
0x19 | 0x1 | bool | ScissorEnable | Enable scissor-rectangle culling. All pixels outside an active scissor rectangle are culled. | |
0x1A | 0x1 | bool | MultisampleEnable | Specifies whether to use the quadrilateral or alpha line anti-aliasing algorithm on multisample antialiasing (MSAA) render targets. Set to TRUE to use the quadrilateral line anti-aliasing algorithm and to FALSE to use the alpha line anti-aliasing algorithm. | |
0x1B | 0x1 | bool | AntialiasedLineEnable | Specifies whether to enable line antialiasing; only applies if doing line drawing and MultisampleEnable is FALSE. | |
0x1C | 0x4 | uint32_t | ? | Reference count | Initially set to 1. Decremented by each call to Release on the interface |
0x20 | 0x8 | ID3D11RasterizerState* | ? | Rasterizer state interface | Set at runtime |
Enumerations
D3DBLEND
From the Microsoft Learn page.
Name | Value | Comments |
---|---|---|
D3D11_BLEND_ZERO | 1 | The blend factor is (0, 0, 0, 0). No pre-blend operation. |
D3D11_BLEND_ONE | 2 | The blend factor is (1, 1, 1, 1). No pre-blend operation. |
D3D11_BLEND_SRC_COLOR | 3 | The blend factor is (Rₛ, Gₛ, Bₛ, Aₛ), that is color data (RGB) from a pixel shader. No pre-blend operation. |
D3D11_BLEND_INV_SRC_COLOR | 4 | The blend factor is (1 - Rₛ, 1 - Gₛ, 1 - Bₛ, 1 - Aₛ), that is color data (RGB) from a pixel shader. The pre-blend operation inverts the data, generating 1 - RGB. |
D3D11_BLEND_SRC_ALPHA | 5 | The blend factor is (Aₛ, Aₛ, Aₛ, Aₛ), that is alpha data (A) from a pixel shader. No pre-blend operation. |
D3D11_BLEND_INV_SRC_ALPHA | 6 | The blend factor is ( 1 - Aₛ, 1 - Aₛ, 1 - Aₛ, 1 - Aₛ), that is alpha data (A) from a pixel shader. The pre-blend operation inverts the data, generating 1 - A. |
D3D11_BLEND_DEST_ALPHA | 7 | The blend factor is (Ad Ad Ad Ad), that is alpha data from a render target. No pre-blend operation. |
D3D11_BLEND_INV_DEST_ALPHA | 8 | The blend factor is (1 - Ad 1 - Ad 1 - Ad 1 - Ad), that is alpha data from a render target. The pre-blend operation inverts the data, generating 1 - A. |
D3D11_BLEND_DEST_COLOR | 9 | The blend factor is (Rd, Gd, Bd, Ad), that is color data from a render target. No pre-blend operation. |
D3D11_BLEND_INV_DEST_COLOR | 10 | The blend factor is (1 - Rd, 1 - Gd, 1 - Bd, 1 - Ad), that is color data from a render target. The pre-blend operation inverts the data, generating 1 - RGB. |
D3D11_BLEND_SRC_ALPHA_SAT | 11 | The blend factor is (f, f, f, 1); where f = min(Aₛ, 1 - Ad). The pre-blend operation clamps the data to 1 or less. |
D3D11_BLEND_BLEND_FACTOR | 14 | The blend factor is the blend factor set with ID3D11DeviceContext::OMSetBlendState. No pre-blend operation. |
D3D11_BLEND_INV_BLEND_FACTOR | 15 | The blend factor is the blend factor set with ID3D11DeviceContext::OMSetBlendState. The pre-blend operation inverts the blend factor, generating 1 - blend_factor. |
D3D11_BLEND_SRC1_COLOR | 16 | The blend factor is data sources both as color data output by a pixel shader. There is no pre-blend operation. This blend factor supports dual-source color blending. |
D3D11_BLEND_INV_SRC1_COLOR | 17 | The blend factor is data sources both as color data output by a pixel shader. The pre-blend operation inverts the data, generating 1 - RGB. This blend factor supports dual-source color blending. |
D3D11_BLEND_SRC1_ALPHA | 18 | The blend factor is data sources as alpha data output by a pixel shader. There is no pre-blend operation. This blend factor supports dual-source color blending. |
D3D11_BLEND_INV_SRC1_ALPHA | 19 | The blend factor is data sources as alpha data output by a pixel shader. The pre-blend operation inverts the data, generating 1 - A. This blend factor supports dual-source color blending. |
D3DBLENDOP
From the Microsoft Learn page.
Name | Value | Comments |
---|---|---|
D3D11_BLEND_OP_ADD | 1 | Add source 1 and source 2. |
D3D11_BLEND_OP_SUBTRACT | 2 | Subtract source 1 from source 2. |
D3D11_BLEND_OP_REV_SUBTRACT | 3 | Subtract source 2 from source 1. |
D3D11_BLEND_OP_MIN | 4 | Find the minimum of source 1 and source 2. |
D3D11_BLEND_OP_MAX | 5 | Find the maximum of source 1 and source 2. |
D3D11_COLOR_WRITE_ENABLE
From the Microsoft Learn page.
Name | Value | Comments |
---|---|---|
D3D11_COLOR_WRITE_ENABLE_RED | 0x1 | Allow data to be stored in the red component. |
D3D11_COLOR_WRITE_ENABLE_GREEN | 0x2 | Allow data to be stored in the green component. |
D3D11_COLOR_WRITE_ENABLE_BLUE | 0x4 | Allow data to be stored in the blue component. |
D3D11_COLOR_WRITE_ENABLE_ALPHA | 0x8 | Allow data to be stored in the alpha component. |
D3D11_COLOR_WRITE_ENABLE_ALL | Allow data to be stored in all components. |
D3D11_STENCIL_OP
From the Microsoft Learn page.
Name | Value | Comments |
---|---|---|
D3D11_STENCIL_OP_KEEP | 1 | Keep the existing stencil data. |
D3D11_STENCIL_OP_ZERO | 2 | Set the stencil data to 0. |
D3D11_STENCIL_OP_REPLACE | 3 | Set the stencil data to the reference value set by calling ID3D11DeviceContext::OMSetDepthStencilState. |
D3D11_STENCIL_OP_INCR_SAT | 4 | Increment the stencil value by 1, and clamp the result. |
D3D11_STENCIL_OP_DECR_SAT | 5 | Decrement the stencil value by 1, and clamp the result. |
D3D11_STENCIL_OP_INVERT | 6 | Invert the stencil data. |
D3D11_STENCIL_OP_INCR | 7 | Increment the stencil value by 1, and wrap the result if necessary. |
D3D11_STENCIL_OP_DECR | 8 | Decrement the stencil value by 1, and wrap the result if necessary. |
D3D11_COMPARISON_FUNC
From the Microsoft Learn page.
Name | Value | Comments |
---|---|---|
D3D11_COMPARISON_NEVER | 1 | Never pass the comparison. |
D3D11_COMPARISON_LESS | 2 | If the source data is less than the destination data, the comparison passes. |
D3D11_COMPARISON_EQUAL | 3 | If the source data is equal to the destination data, the comparison passes. |
D3D11_COMPARISON_LESS_EQUAL | 4 | If the source data is less than or equal to the destination data, the comparison passes. |
D3D11_COMPARISON_GREATER | 5 | If the source data is greater than the destination data, the comparison passes. |
D3D11_COMPARISON_NOT_EQUAL | 6 | If the source data is not equal to the destination data, the comparison passes. |
D3D11_COMPARISON_GREATER_EQUAL | 7 | If the source data is greater than or equal to the destination data, the comparison passes. |
D3D11_COMPARISON_ALWAYS | 8 | Always pass the comparison. |
D3D11_FILL_MODE
From the Microsoft Learn page.
Name | Value | Comments |
---|---|---|
D3D11_FILL_WIREFRAME | 2 | Draw lines connecting the vertices. Adjacent vertices are not drawn. |
D3D11_FILL_SOLID | 3 | Fill the triangles formed by the vertices. Adjacent vertices are not drawn. |
D3D11_CULL_MODE
From the Microsoft Learn page.
Name | Value | Comments |
---|---|---|
D3D11_CULL_NONE | 1 | Always draw all triangles. |
D3D11_CULL_FRONT | 2 | Do not draw triangles that are front-facing. |
D3D11_CULL_BACK | 3 | Do not draw triangles that are back-facing. |