mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-21 03:55:32 +00:00
d3d12: Add front/back face culling setting
This commit is contained in:
parent
b465992178
commit
acb8f82f84
2 changed files with 46 additions and 21 deletions
|
@ -802,12 +802,50 @@ bool D3D12GSRender::LoadProgram()
|
|||
}
|
||||
else
|
||||
{
|
||||
prop.DepthStencil.BackFace.StencilFunc = D3D12_COMPARISON_FUNC_NEVER;
|
||||
prop.DepthStencil.BackFace.StencilFailOp = D3D12_STENCIL_OP_KEEP;
|
||||
prop.DepthStencil.BackFace.StencilPassOp = D3D12_STENCIL_OP_KEEP;
|
||||
prop.DepthStencil.BackFace.StencilDepthFailOp = D3D12_STENCIL_OP_KEEP;
|
||||
prop.DepthStencil.BackFace.StencilPassOp = getStencilOp(m_stencil_zpass);
|
||||
prop.DepthStencil.BackFace.StencilDepthFailOp = getStencilOp(m_stencil_zfail);
|
||||
prop.DepthStencil.BackFace.StencilFailOp = getStencilOp(m_stencil_fail);
|
||||
prop.DepthStencil.BackFace.StencilFunc = getStencilFunc(m_stencil_func);
|
||||
}
|
||||
|
||||
// Sensible default value
|
||||
static D3D12_RASTERIZER_DESC CD3D12_RASTERIZER_DESC =
|
||||
{
|
||||
D3D12_FILL_MODE_SOLID,
|
||||
D3D12_CULL_MODE_NONE,
|
||||
FALSE,
|
||||
D3D12_DEFAULT_DEPTH_BIAS,
|
||||
D3D12_DEFAULT_DEPTH_BIAS_CLAMP,
|
||||
D3D12_DEFAULT_SLOPE_SCALED_DEPTH_BIAS,
|
||||
TRUE,
|
||||
FALSE,
|
||||
FALSE,
|
||||
0,
|
||||
D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF,
|
||||
};
|
||||
prop.Rasterization = CD3D12_RASTERIZER_DESC;
|
||||
switch (m_set_cull_face)
|
||||
{
|
||||
case GL_FRONT:
|
||||
prop.Rasterization.CullMode = D3D12_CULL_MODE_FRONT;
|
||||
break;
|
||||
case GL_BACK:
|
||||
prop.Rasterization.CullMode = D3D12_CULL_MODE_BACK;
|
||||
break;
|
||||
default:
|
||||
prop.Rasterization.CullMode = D3D12_CULL_MODE_NONE;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (m_front_face)
|
||||
{
|
||||
case GL_CW:
|
||||
prop.Rasterization.FrontCounterClockwise = FALSE;
|
||||
break;
|
||||
case GL_CCW:
|
||||
prop.Rasterization.FrontCounterClockwise = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
prop.IASet = m_IASet;
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ struct D3D12PipelineProperties
|
|||
D3D12_BLEND_DESC Blend;
|
||||
unsigned numMRT : 3;
|
||||
D3D12_DEPTH_STENCIL_DESC DepthStencil;
|
||||
D3D12_RASTERIZER_DESC Rasterization;
|
||||
|
||||
bool operator==(const D3D12PipelineProperties &in) const
|
||||
{
|
||||
|
@ -42,6 +43,8 @@ struct D3D12PipelineProperties
|
|||
return false;
|
||||
if (memcmp(&Blend, &in.Blend, sizeof(D3D12_BLEND_DESC)))
|
||||
return false;
|
||||
if (memcmp(&Rasterization, &in.Rasterization, sizeof(D3D12_RASTERIZER_DESC)))
|
||||
return false;
|
||||
return Topology == in.Topology && DepthStencilFormat == in.DepthStencilFormat && numMRT == in.numMRT;
|
||||
}
|
||||
};
|
||||
|
@ -144,25 +147,9 @@ struct D3D12Traits
|
|||
graphicPipelineStateDesc.pRootSignature = extraData.second[fragmentProgramData.m_textureCount];
|
||||
result->second = fragmentProgramData.m_textureCount;
|
||||
|
||||
// Sensible default value
|
||||
static D3D12_RASTERIZER_DESC CD3D12_RASTERIZER_DESC =
|
||||
{
|
||||
D3D12_FILL_MODE_SOLID,
|
||||
D3D12_CULL_MODE_NONE,
|
||||
FALSE,
|
||||
D3D12_DEFAULT_DEPTH_BIAS,
|
||||
D3D12_DEFAULT_DEPTH_BIAS_CLAMP,
|
||||
D3D12_DEFAULT_SLOPE_SCALED_DEPTH_BIAS,
|
||||
TRUE,
|
||||
FALSE,
|
||||
FALSE,
|
||||
0,
|
||||
D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF,
|
||||
};
|
||||
|
||||
graphicPipelineStateDesc.BlendState = pipelineProperties.Blend;
|
||||
graphicPipelineStateDesc.DepthStencilState = pipelineProperties.DepthStencil;
|
||||
graphicPipelineStateDesc.RasterizerState = CD3D12_RASTERIZER_DESC;
|
||||
graphicPipelineStateDesc.RasterizerState = pipelineProperties.Rasterization;
|
||||
graphicPipelineStateDesc.PrimitiveTopologyType = pipelineProperties.Topology;
|
||||
|
||||
graphicPipelineStateDesc.NumRenderTargets = pipelineProperties.numMRT;
|
||||
|
|
Loading…
Add table
Reference in a new issue