d3d12: Fix depth format mismatch

This commit is contained in:
vlj 2015-05-23 01:22:16 +02:00 committed by Vincent Lejeune
parent e6146e4ecb
commit 740354d2c9
2 changed files with 19 additions and 2 deletions

View File

@ -758,6 +758,22 @@ bool D3D12GSRender::LoadProgram()
// checkForGlError("glBlendColor");
}
switch (m_surface_depth_format)
{
case 0:
break;
case CELL_GCM_SURFACE_Z16:
prop.DepthStencilFormat = DXGI_FORMAT_D16_UNORM;
break;
case CELL_GCM_SURFACE_Z24S8:
prop.DepthStencilFormat = DXGI_FORMAT_D24_UNORM_S8_UINT;
break;
default:
LOG_ERROR(RSX, "Bad depth format! (%d)", m_surface_depth_format);
assert(0);
}
;
prop.IASet = m_IASet;

View File

@ -13,13 +13,14 @@
struct D3D12PipelineProperties
{
D3D12_PRIMITIVE_TOPOLOGY_TYPE Topology;
DXGI_FORMAT DepthStencilFormat;
std::vector<D3D12_INPUT_ELEMENT_DESC> IASet;
D3D12_BLEND_DESC Blend;
bool operator==(const D3D12PipelineProperties &in) const
{
// TODO: blend and IASet equality
return Topology == in.Topology;
return Topology == in.Topology && DepthStencilFormat == in.DepthStencilFormat;
}
};
@ -145,7 +146,7 @@ struct D3D12Traits
graphicPipelineStateDesc.NumRenderTargets = 1;
graphicPipelineStateDesc.RTVFormats[0] = DXGI_FORMAT_R8G8B8A8_UNORM;
graphicPipelineStateDesc.DSVFormat = DXGI_FORMAT_D16_UNORM;
graphicPipelineStateDesc.DSVFormat = pipelineProperties.DepthStencilFormat;
graphicPipelineStateDesc.InputLayout.pInputElementDescs = pipelineProperties.IASet.data();
graphicPipelineStateDesc.InputLayout.NumElements = (UINT)pipelineProperties.IASet.size();