From 740354d2c9bdcdfca3ed136e8cc1761bfb996b86 Mon Sep 17 00:00:00 2001 From: vlj Date: Sat, 23 May 2015 01:22:16 +0200 Subject: [PATCH] d3d12: Fix depth format mismatch --- rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp | 16 ++++++++++++++++ rpcs3/Emu/RSX/D3D12/D3D12PipelineState.h | 5 +++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp b/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp index ea56f54f73..768f5d1ffa 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp @@ -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; diff --git a/rpcs3/Emu/RSX/D3D12/D3D12PipelineState.h b/rpcs3/Emu/RSX/D3D12/D3D12PipelineState.h index ea6b9925cf..77b14f114b 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12PipelineState.h +++ b/rpcs3/Emu/RSX/D3D12/D3D12PipelineState.h @@ -13,13 +13,14 @@ struct D3D12PipelineProperties { D3D12_PRIMITIVE_TOPOLOGY_TYPE Topology; + DXGI_FORMAT DepthStencilFormat; std::vector 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();