Add GPUContext::SetStencilRef to stencil reference value

This commit is contained in:
Wojtek Figat
2023-06-19 11:21:35 +02:00
parent 228ef4e130
commit 1c9d8aa470
9 changed files with 46 additions and 2 deletions

View File

@@ -103,6 +103,7 @@ void GPUContextDX11::FrameBegin()
CurrentPS = nullptr;
CurrentCS = nullptr;
CurrentPrimitiveTopology = D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED;
CurrentStencilRef = 0;
CurrentBlendFactor = Float4::One;
// Bind static samplers
@@ -275,6 +276,12 @@ void GPUContextDX11::SetBlendFactor(const Float4& value)
_context->OMSetBlendState(CurrentBlendState, CurrentBlendFactor.Raw, D3D11_DEFAULT_SAMPLE_MASK);
}
void GPUContextDX11::SetStencilRef(uint32 value)
{
if (CurrentStencilRef != value)
_context->OMSetDepthStencilState(CurrentDepthStencilState, CurrentStencilRef);
}
void GPUContextDX11::ResetSR()
{
_srDirtyFlag = false;
@@ -559,7 +566,7 @@ void GPUContextDX11::SetState(GPUPipelineState* state)
if (CurrentDepthStencilState != depthStencilState)
{
CurrentDepthStencilState = depthStencilState;
_context->OMSetDepthStencilState(depthStencilState, 0);
_context->OMSetDepthStencilState(depthStencilState, CurrentStencilRef);
}
if (CurrentRasterizerState != rasterizerState)
{