From b6bc8fe80f50d6361df3b81ae3468306d4b985ac Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 24 Jun 2024 11:34:51 +0100 Subject: [PATCH] Use same disambiguation selection for resources in all cases * We use a different function for serialising addresses via ID+offset compared to the normal lookup, since on serialise we need to allow out of bounds references as that's legal in D3D12 too. If we have a mismatch here we could mark one buffer referenced but serialise as another and be unable to translate the address. --- renderdoc/driver/d3d12/d3d12_manager.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/renderdoc/driver/d3d12/d3d12_manager.cpp b/renderdoc/driver/d3d12/d3d12_manager.cpp index 779ca76c2..d8f338bc9 100644 --- a/renderdoc/driver/d3d12/d3d12_manager.cpp +++ b/renderdoc/driver/d3d12/d3d12_manager.cpp @@ -2395,6 +2395,15 @@ void GPUAddressRangeTracker::GetResIDFromAddrAllowOutOfBounds(D3D12_GPU_VIRTUAL_ return; range = *it; + + // find the largest resource containing this address - not perfect but helps with trivially bad + // aliases where a tiny resource and a large resource are co-situated and the larger resource + // needs to be used for validity + while((it + 1)->start <= addr && (it + 1)->realEnd > range.realEnd) + { + it++; + range = *it; + } } if(addr < range.start)