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();) {