From b6a105d6955a381936c515eb90f667cb86e2aeef Mon Sep 17 00:00:00 2001 From: Jake Turner Date: Mon, 29 Jan 2024 07:57:13 +0000 Subject: [PATCH] D3D12 Pixel History fix for typeCast of CompType::Typeless For instance history on swapchains --- renderdoc/driver/d3d12/d3d12_pixelhistory.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/renderdoc/driver/d3d12/d3d12_pixelhistory.cpp b/renderdoc/driver/d3d12/d3d12_pixelhistory.cpp index 1515cc174..18a68a967 100644 --- a/renderdoc/driver/d3d12/d3d12_pixelhistory.cpp +++ b/renderdoc/driver/d3d12/d3d12_pixelhistory.cpp @@ -2763,6 +2763,10 @@ rdcarray D3D12Replay::PixelHistory(rdcarray event return history; } + // If the resource desc format is typeless, replace it with a typed format + if(IsTypelessFormat(resDesc.Format)) + resDesc.Format = GetTypedFormat(resDesc.Format, typeCast); + // TODO: perhaps should allocate most resources after D3D12OcclusionCallback, since we will // get a smaller subset of events that passed the occlusion query. D3D12PixelHistoryResources resources = {}; @@ -2790,14 +2794,6 @@ rdcarray D3D12Replay::PixelHistory(rdcarray event callbackInfo.dsImage = resources.dsImage; callbackInfo.dsDescriptor = resources.dsDescriptor; - // If the resource desc format is typeless, replace it with a typed format - if(IsTypelessFormat(callbackInfo.targetDesc.Format)) - { - ResourceFormat fmt = MakeResourceFormat(callbackInfo.targetDesc.Format); - fmt.compType = typeCast; - callbackInfo.targetDesc.Format = MakeDXGIFormat(fmt); - } - callbackInfo.dstBuffer = resources.dstBuffer; D3D12OcclusionCallback occlCb(m_pDevice, shaderCache, callbackInfo, pOcclusionQueryHeap, events); @@ -2911,7 +2907,8 @@ rdcarray D3D12Replay::PixelHistory(rdcarray event std::map eventsWithFrags; std::map eventPremods; ResourceFormat fmt = MakeResourceFormat(callbackInfo.targetDesc.Format); - fmt.compType = typeCast; + if(typeCast != CompType::Typeless) + fmt.compType = typeCast; for(size_t h = 0; h < history.size();) {