From c08ac779f4c0e482df0a03c0aa2f923772b175cf Mon Sep 17 00:00:00 2001 From: vlj Date: Sat, 23 May 2015 20:27:15 +0200 Subject: [PATCH] d3d12: src and dst were inverted, fix it now depth buffer is properly read, but it is too little --- rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp b/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp index 83582a32ce..d2085fc9e2 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp @@ -1394,16 +1394,16 @@ void D3D12GSRender::WriteDepthBuffer() rowPitch = (rowPitch + 255) & ~255; D3D12_TEXTURE_COPY_LOCATION dst = {}, src = {}; - dst.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX; - dst.pResource = m_fbo->getDepthStencilTexture(); - src.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT; - src.pResource = writeDest; - src.PlacedFootprint.Offset = 0; - src.PlacedFootprint.Footprint.Depth = 1; - src.PlacedFootprint.Footprint.Format = DXGI_FORMAT_R32_FLOAT; - src.PlacedFootprint.Footprint.Height = RSXThread::m_height; - src.PlacedFootprint.Footprint.Width = RSXThread::m_width; - src.PlacedFootprint.Footprint.RowPitch = (UINT)rowPitch; + src.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX; + src.pResource = m_fbo->getDepthStencilTexture(); + dst.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT; + dst.pResource = writeDest; + dst.PlacedFootprint.Offset = 0; + dst.PlacedFootprint.Footprint.Depth = 1; + dst.PlacedFootprint.Footprint.Format = DXGI_FORMAT_R32_FLOAT; + dst.PlacedFootprint.Footprint.Height = RSXThread::m_height; + dst.PlacedFootprint.Footprint.Width = RSXThread::m_width; + dst.PlacedFootprint.Footprint.RowPitch = (UINT)rowPitch; downloadCommandList->CopyTextureRegion(&dst, 0, 0, 0, &src, nullptr); barrier.Transition.StateBefore = D3D12_RESOURCE_STATE_COPY_SOURCE; @@ -1431,8 +1431,8 @@ void D3D12GSRender::WriteDepthBuffer() { for (unsigned i = 0; i < RSXThread::m_width; i++) { - unsigned char c = (unsigned char) writeDestPtr[row * rowPitch / 4 + i] * 255.; - ptrAsChar[row * RSXThread::m_width + i] = c; + unsigned char c = (unsigned char) (writeDestPtr[row * rowPitch / 4 + i] * 255.); + ptrAsChar[(row * RSXThread::m_width + i)] = c; } }