Report original GPU VA to UI on D3D12

* In theory this was useful for interpreting execute indirect buffers previously
  but it will be more common.
This commit is contained in:
baldurk
2024-05-27 10:13:57 +01:00
parent 176a0909fa
commit b715cce04f
3 changed files with 8 additions and 2 deletions
@@ -248,7 +248,7 @@ bool WrappedID3D12Device::Serialise_CreateResource(
SetObjName(ret, StringFormat::Fmt("%s Resource %s %s", ResourceTypeName,
ToStr(desc.Dimension).c_str(), ToStr(pResource).c_str()));
ret = new WrappedID3D12Resource(ret, pHeap, HeapOffset, this);
ret = new WrappedID3D12Resource(ret, pHeap, HeapOffset, this, gpuAddress);
switch(chunkType)
{
+1
View File
@@ -414,6 +414,7 @@ BufferDescription D3D12Replay::GetBuffer(ResourceId id)
ret.length = desc.Width;
ret.creationFlags = BufferCategory::NoFlags;
ret.gpuAddress = it->second->GetOriginalVA();
const rdcarray<EventUsage> &usage = m_pDevice->GetQueue()->GetUsage(id);
+6 -1
View File
@@ -1170,6 +1170,8 @@ class WrappedID3D12Resource
rdcflatmap<D3D12BufferOffset, D3D12AccelerationStructure *> m_accelerationStructMap;
bool m_isAccelerationStructureResource = false;
UINT64 m_OrigAddress;
public:
ALLOCATE_WITH_WRAPPED_POOL(WrappedID3D12Resource, false);
@@ -1231,6 +1233,8 @@ public:
m_Addresses.GetResIDFromAddrAllowOutOfBounds(addr, id, offs);
}
UINT64 GetOriginalVA() const { return m_OrigAddress; }
// overload to just return the id in case the offset isn't needed
static ResourceId GetResIDFromAddr(D3D12_GPU_VIRTUAL_ADDRESS addr)
{
@@ -1248,9 +1252,10 @@ public:
};
WrappedID3D12Resource(ID3D12Resource *real, ID3D12Heap *heap, UINT64 HeapOffset,
WrappedID3D12Device *device)
WrappedID3D12Device *device, UINT64 origAddress = 0)
: WrappedDeviceChild12(real, device)
{
m_OrigAddress = origAddress;
if(IsReplayMode(device->GetState()))
device->AddReplayResource(GetResourceID(), this);