d3d12: Disable depth test if not required

This commit is contained in:
vlj 2015-05-28 18:49:50 +02:00 committed by Vincent Lejeune
parent f77e2acfbe
commit 79420e52a2
2 changed files with 6 additions and 1 deletions

View file

@ -579,6 +579,8 @@ bool D3D12GSRender::LoadProgram()
LOG_ERROR(RSX, "Bad surface color target: %d", m_surface_color_target);
}
prop.depthEnabled = m_set_depth_test;
prop.IASet = m_IASet;
m_PSO = m_cachePSO.getGraphicPipelineState(m_cur_vertex_prog, m_cur_fragment_prog, prop, std::make_pair(m_device, m_rootSignature));

View file

@ -17,11 +17,12 @@ struct D3D12PipelineProperties
std::vector<D3D12_INPUT_ELEMENT_DESC> IASet;
D3D12_BLEND_DESC Blend;
unsigned numMRT : 3;
bool depthEnabled : 1;
bool operator==(const D3D12PipelineProperties &in) const
{
// TODO: blend and IASet equality
return Topology == in.Topology && DepthStencilFormat == in.DepthStencilFormat && numMRT == in.numMRT;
return Topology == in.Topology && DepthStencilFormat == in.DepthStencilFormat && numMRT == in.numMRT && depthEnabled == in.depthEnabled;
}
};
@ -145,6 +146,8 @@ struct D3D12Traits
graphicPipelineStateDesc.RasterizerState = CD3D12_RASTERIZER_DESC;
graphicPipelineStateDesc.PrimitiveTopologyType = pipelineProperties.Topology;
graphicPipelineStateDesc.DepthStencilState.DepthEnable = pipelineProperties.depthEnabled;
graphicPipelineStateDesc.NumRenderTargets = pipelineProperties.numMRT;
for (unsigned i = 0; i < pipelineProperties.numMRT; i++)
graphicPipelineStateDesc.RTVFormats[i] = DXGI_FORMAT_R8G8B8A8_UNORM;