Add **stencil buffer** support to GPUPipelineState

This commit is contained in:
Wojtek Figat
2023-06-19 13:46:37 +02:00
parent a6353c0bb9
commit f952a392de
5 changed files with 188 additions and 134 deletions

View File

@@ -90,96 +90,79 @@ GPUResourceType GPUPipelineState::GetResourceType() const
return GPUResourceType::PipelineState;
}
// @formatter:off
GPUPipelineState::Description GPUPipelineState::Description::Default =
{
// Enable/disable depth write
true,
// Enable/disable depth test
true,
// DepthClipEnable
true,
// DepthFunc
ComparisonFunc::Less,
// Vertex shader
nullptr,
// Hull shader
nullptr,
// Domain shader
nullptr,
// Geometry shader
nullptr,
// Pixel shader
nullptr,
// Primitives topology
PrimitiveTopologyType::Triangle,
// True if use wireframe rendering
false,
// Primitives culling mode
CullMode::Normal,
// Colors blending mode
BlendingMode::Opaque,
true, // DepthEnable
true, // DepthWriteEnable
true, // DepthClipEnable
ComparisonFunc::Less, // DepthFunc
false, // StencilEnable
0xff, // StencilReadMask
0xff, // StencilWriteMask
ComparisonFunc::Always, // StencilFunc
StencilOperation::Keep, // StencilFailOp
StencilOperation::Keep, // StencilDepthFailOp
StencilOperation::Keep, // StencilPassOp
nullptr, // VS
nullptr, // HS
nullptr, // DS
nullptr, // GS
nullptr, // PS
PrimitiveTopologyType::Triangle, // PrimitiveTopology
false, // Wireframe
CullMode::Normal, // CullMode
BlendingMode::Opaque, // BlendMode
};
GPUPipelineState::Description GPUPipelineState::Description::DefaultNoDepth =
{
// Enable/disable depth write
false,
// Enable/disable depth test
false,
// DepthClipEnable
false,
// DepthFunc
ComparisonFunc::Less,
// Vertex shader
nullptr,
// Hull shader
nullptr,
// Domain shader
nullptr,
// Geometry shader
nullptr,
// Pixel shader
nullptr,
// Primitives topology
PrimitiveTopologyType::Triangle,
// True if use wireframe rendering
false,
// Primitives culling mode
CullMode::Normal,
// Colors blending mode
BlendingMode::Opaque,
false, // DepthEnable
false, // DepthWriteEnable
false, // DepthClipEnable
ComparisonFunc::Less, // DepthFunc
false, // StencilEnable
0xff, // StencilReadMask
0xff, // StencilWriteMask
ComparisonFunc::Always, // StencilFunc
StencilOperation::Keep, // StencilFailOp
StencilOperation::Keep, // StencilDepthFailOp
StencilOperation::Keep, // StencilPassOp
nullptr, // VS
nullptr, // HS
nullptr, // DS
nullptr, // GS
nullptr, // PS
PrimitiveTopologyType::Triangle, // PrimitiveTopology
false, // Wireframe
CullMode::Normal, // CullMode
BlendingMode::Opaque, // BlendMode
};
GPUPipelineState::Description GPUPipelineState::Description::DefaultFullscreenTriangle =
{
// Enable/disable depth write
false,
// Enable/disable depth test
false,
// DepthClipEnable
false,
// DepthFunc
ComparisonFunc::Less,
// Vertex shader
nullptr,
// Set to default quad VS via GPUDevice
// Hull shader
nullptr,
// Domain shader
nullptr,
// Geometry shader
nullptr,
// Pixel shader
nullptr,
// Primitives topology
PrimitiveTopologyType::Triangle,
// True if use wireframe rendering
false,
// Primitives culling mode
CullMode::TwoSided,
// Colors blending mode
BlendingMode::Opaque,
false, // DepthEnable
false, // DepthWriteEnable
false, // DepthClipEnable
ComparisonFunc::Less, // DepthFunc
false, // StencilEnable
0xff, // StencilReadMask
0xff, // StencilWriteMask
ComparisonFunc::Always, // StencilFunc
StencilOperation::Keep, // StencilFailOp
StencilOperation::Keep, // StencilDepthFailOp
StencilOperation::Keep, // StencilPassOp
nullptr, // VS (Set to default quad VS via GPUDevice)
nullptr, // HS
nullptr, // DS
nullptr, // GS
nullptr, // PS
PrimitiveTopologyType::Triangle, // PrimitiveTopology
false, // Wireframe
CullMode::TwoSided, // CullMode
BlendingMode::Opaque, // BlendMode
};
// @formatter:on
GPUResource::GPUResource()
: ScriptingObject(SpawnParams(Guid::New(), TypeInitializer))