From f459440d0379ec0a0377c8ae06cddbb97fb996d5 Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 24 Oct 2025 11:16:42 +0100 Subject: [PATCH] Fix issues with mismatching float/uint bindings in D3D11 pixel history --- renderdoc/driver/d3d11/d3d11_pixelhistory.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/renderdoc/driver/d3d11/d3d11_pixelhistory.cpp b/renderdoc/driver/d3d11/d3d11_pixelhistory.cpp index a592aa540..116cb0989 100644 --- a/renderdoc/driver/d3d11/d3d11_pixelhistory.cpp +++ b/renderdoc/driver/d3d11/d3d11_pixelhistory.cpp @@ -259,8 +259,10 @@ void D3D11DebugManager::PixelHistoryCopyPixel(D3D11CopyPixelParams &p, size_t ev m_pImmediateContext->CSSetShaderResources(offs, 2, p.srv); - m_pImmediateContext->CSSetShader( - !p.depthcopy || p.depthbound ? PixelHistoryCopyCS : PixelHistoryUnusedCS, NULL, 0); + m_pImmediateContext->CSSetShader((!p.depthcopy || p.depthbound) && (p.srv[0] || p.srv[1]) + ? PixelHistoryCopyCS + : PixelHistoryUnusedCS, + NULL, 0); m_pImmediateContext->Dispatch(1, 1, 1); m_pImmediateContext->CSSetShader(curCS, curCSInst, curCSNumInst); @@ -452,13 +454,14 @@ rdcarray D3D11Replay::PixelHistory(rdcarray event ID3D11UnorderedAccessView *pixstoreUAV = NULL, *shadoutStoreUAV = NULL, *pixstoreDepthUAV = NULL; m_pDevice->CreateUnorderedAccessView(pixstore, &uavDesc, &pixstoreUAV); m_pDevice->CreateUnorderedAccessView(shadoutStore, &uavDesc, &shadoutStoreUAV); + uavDesc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; m_pDevice->CreateUnorderedAccessView(pixstoreDepth, &uavDesc, &pixstoreDepthUAV); // very wasteful, but we must leave the viewport as is to get correct rasterisation which means // same dimensions of render target. D3D11_TEXTURE2D_DESC shadoutDesc = { - details.texWidth, - details.texHeight, + RDCMAX(1U, details.texWidth >> mip), + RDCMAX(1U, details.texHeight >> mip), 1U, 1U, DXGI_FORMAT_R32G32B32A32_FLOAT, @@ -468,6 +471,10 @@ rdcarray D3D11Replay::PixelHistory(rdcarray event 0, 0, }; + if(IsUIntFormat(details.texFmt)) + shadoutDesc.Format = DXGI_FORMAT_R32G32B32A32_UINT; + else if(IsIntFormat(details.texFmt)) + shadoutDesc.Format = DXGI_FORMAT_R32G32B32A32_SINT; ID3D11Texture2D *shadOutput = NULL; m_pDevice->CreateTexture2D(&shadoutDesc, NULL, &shadOutput); @@ -649,6 +656,9 @@ rdcarray D3D11Replay::PixelHistory(rdcarray event colourCopyParams.srv[1] = NULL; colourCopyParams.uav = pixstoreUAV; + if(targetImageIsDepth) + colourCopyParams.srv[0] = NULL; + depthCopyParams.depthcopy = true; depthCopyParams.uav = pixstoreDepthUAV; depthCopyParams.tex3d = false;