diff --git a/renderdoc/driver/d3d12/d3d12_dxil_debug.cpp b/renderdoc/driver/d3d12/d3d12_dxil_debug.cpp index 32d954eb9..bad4f7c74 100644 --- a/renderdoc/driver/d3d12/d3d12_dxil_debug.cpp +++ b/renderdoc/driver/d3d12/d3d12_dxil_debug.cpp @@ -810,6 +810,8 @@ void D3D12APIWrapper::FetchUAV(const D3D12Descriptor *resDescriptor, const Bindi m_Device->GetReplay()->GetTextureData(uavId, Subresource(), GetTextureDataParams(), uavData.data); + uavDesc.Format = D3D12ShaderDebug::GetUAVResourceFormat(uavDesc, pResource); + DXILDebug::FillViewFmtFromResourceFormat(uavDesc.Format, uavData.resInfo.format); D3D12_RESOURCE_DESC resDesc = pResource->GetDesc(); uavData.rowPitch = GetByteSize((int)resDesc.Width, 1, 1, uavDesc.Format, 0); uavData.depthPitch = diff --git a/renderdoc/driver/d3d12/d3d12_shaderdebug.cpp b/renderdoc/driver/d3d12/d3d12_shaderdebug.cpp index 0db87da62..edca398a6 100644 --- a/renderdoc/driver/d3d12/d3d12_shaderdebug.cpp +++ b/renderdoc/driver/d3d12/d3d12_shaderdebug.cpp @@ -975,6 +975,18 @@ ShaderVariable D3D12ShaderDebug::GetRenderTargetSampleInfo(WrappedID3D12Device * return result; } +DXGI_FORMAT D3D12ShaderDebug::GetUAVResourceFormat(const D3D12_UNORDERED_ACCESS_VIEW_DESC &uavDesc, + ID3D12Resource *pResource) +{ + // Typed UAV (underlying resource is typeless) + if(uavDesc.Format != DXGI_FORMAT_UNKNOWN) + return uavDesc.Format; + + // Typeless UAV get format from the underlying resource + D3D12_RESOURCE_DESC resDesc = pResource->GetDesc(); + return resDesc.Format; +} + class D3D12DebugAPIWrapper : public DXBCDebug::DebugAPIWrapper { public: @@ -1371,6 +1383,8 @@ void D3D12DebugAPIWrapper::FetchUAV(const DXBCDebug::BindingSlot &slot) m_pDevice->GetReplay()->GetTextureData(uavId, Subresource(), GetTextureDataParams(), uavData.data); + uavDesc.Format = D3D12ShaderDebug::GetUAVResourceFormat(uavDesc, pResource); + DXBCDebug::FillViewFmt(uavDesc.Format, uavData.format); D3D12_RESOURCE_DESC resDesc = pResource->GetDesc(); uavData.rowPitch = GetByteSize((int)resDesc.Width, 1, 1, uavDesc.Format, 0); } diff --git a/renderdoc/driver/d3d12/d3d12_shaderdebug.h b/renderdoc/driver/d3d12/d3d12_shaderdebug.h index 550dc903b..8f738ce8b 100644 --- a/renderdoc/driver/d3d12/d3d12_shaderdebug.h +++ b/renderdoc/driver/d3d12/d3d12_shaderdebug.h @@ -68,4 +68,7 @@ ShaderVariable GetSampleInfo(WrappedID3D12Device *device, D3D12_DESCRIPTOR_RANGE ShaderVariable GetRenderTargetSampleInfo(WrappedID3D12Device *device, const DXBC::ShaderType shaderType, const char *opString); + +DXGI_FORMAT GetUAVResourceFormat(const D3D12_UNORDERED_ACCESS_VIEW_DESC &uavDesc, + ID3D12Resource *pResource); };