mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-26 20:01:17 +00:00
Improve fetching UAV texture data in the D3D12 shader debuggers
Use the resource format if the UAV format is unknown format (typeless)
This commit is contained in:
@@ -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 =
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user