d3d12: src and dst were inverted, fix it

now depth buffer is properly read, but it is too little
This commit is contained in:
vlj 2015-05-23 20:27:15 +02:00 committed by Vincent Lejeune
parent 2031944792
commit c08ac779f4
1 changed files with 12 additions and 12 deletions

View File

@ -1394,16 +1394,16 @@ void D3D12GSRender::WriteDepthBuffer()
rowPitch = (rowPitch + 255) & ~255; rowPitch = (rowPitch + 255) & ~255;
D3D12_TEXTURE_COPY_LOCATION dst = {}, src = {}; D3D12_TEXTURE_COPY_LOCATION dst = {}, src = {};
dst.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX; src.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX;
dst.pResource = m_fbo->getDepthStencilTexture(); src.pResource = m_fbo->getDepthStencilTexture();
src.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT; dst.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT;
src.pResource = writeDest; dst.pResource = writeDest;
src.PlacedFootprint.Offset = 0; dst.PlacedFootprint.Offset = 0;
src.PlacedFootprint.Footprint.Depth = 1; dst.PlacedFootprint.Footprint.Depth = 1;
src.PlacedFootprint.Footprint.Format = DXGI_FORMAT_R32_FLOAT; dst.PlacedFootprint.Footprint.Format = DXGI_FORMAT_R32_FLOAT;
src.PlacedFootprint.Footprint.Height = RSXThread::m_height; dst.PlacedFootprint.Footprint.Height = RSXThread::m_height;
src.PlacedFootprint.Footprint.Width = RSXThread::m_width; dst.PlacedFootprint.Footprint.Width = RSXThread::m_width;
src.PlacedFootprint.Footprint.RowPitch = (UINT)rowPitch; dst.PlacedFootprint.Footprint.RowPitch = (UINT)rowPitch;
downloadCommandList->CopyTextureRegion(&dst, 0, 0, 0, &src, nullptr); downloadCommandList->CopyTextureRegion(&dst, 0, 0, 0, &src, nullptr);
barrier.Transition.StateBefore = D3D12_RESOURCE_STATE_COPY_SOURCE; barrier.Transition.StateBefore = D3D12_RESOURCE_STATE_COPY_SOURCE;
@ -1431,8 +1431,8 @@ void D3D12GSRender::WriteDepthBuffer()
{ {
for (unsigned i = 0; i < RSXThread::m_width; i++) for (unsigned i = 0; i < RSXThread::m_width; i++)
{ {
unsigned char c = (unsigned char) writeDestPtr[row * rowPitch / 4 + i] * 255.; unsigned char c = (unsigned char) (writeDestPtr[row * rowPitch / 4 + i] * 255.);
ptrAsChar[row * RSXThread::m_width + i] = c; ptrAsChar[(row * RSXThread::m_width + i)] = c;
} }
} }