mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-12 21:10:42 +00:00
DXIL D3D12APIWrapper added GetShaderDirectAccess()
Creates ShaderDirectAccess structure from a DescriptorCategory and DXDebug::BindingSlot
This commit is contained in:
@@ -1138,4 +1138,46 @@ ResourceReferenceInfo D3D12APIWrapper::GetResourceReferenceInfo(const DXDebug::B
|
||||
}
|
||||
return resRefInfo;
|
||||
}
|
||||
|
||||
ShaderDirectAccess D3D12APIWrapper::GetShaderDirectAccess(DescriptorCategory category,
|
||||
const DXDebug::BindingSlot &slot)
|
||||
{
|
||||
const HeapDescriptorType heapType = slot.heapType;
|
||||
RDCASSERT(heapType != HeapDescriptorType::NoHeap);
|
||||
uint32_t descriptorIndex = slot.descriptorIndex;
|
||||
|
||||
const D3D12RenderState &rs = m_Device->GetQueue()->GetCommandData()->m_RenderState;
|
||||
D3D12ResourceManager *rm = m_Device->GetResourceManager();
|
||||
|
||||
ShaderDirectAccess access;
|
||||
uint32_t byteSize = DXILDebug::D3D12_DESCRIPTOR_BYTESIZE;
|
||||
uint32_t byteOffset = descriptorIndex * byteSize;
|
||||
|
||||
// Fetch the correct heap sampler and resource descriptor heap
|
||||
rdcarray<ResourceId> descHeaps = rs.heaps;
|
||||
for(ResourceId heapId : descHeaps)
|
||||
{
|
||||
WrappedID3D12DescriptorHeap *pD3D12Heap = rm->GetCurrentAs<WrappedID3D12DescriptorHeap>(heapId);
|
||||
D3D12_DESCRIPTOR_HEAP_DESC heapDesc = pD3D12Heap->GetDesc();
|
||||
if(heapDesc.Type == D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER)
|
||||
{
|
||||
if(heapType == HeapDescriptorType::Sampler)
|
||||
{
|
||||
RDCASSERTEQUAL(category, DescriptorCategory::Sampler);
|
||||
return ShaderDirectAccess(category, rm->GetOriginalID(heapId), byteOffset, byteSize);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RDCASSERT(heapDesc.Type == D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
|
||||
if(heapType == HeapDescriptorType::CBV_SRV_UAV)
|
||||
{
|
||||
RDCASSERTNOTEQUAL(category, DescriptorCategory::Sampler);
|
||||
return ShaderDirectAccess(category, rm->GetOriginalID(heapId), byteOffset, byteSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
RDCERR("Failed to find descriptor %u %u", (uint32_t)heapType, descriptorIndex);
|
||||
return ShaderDirectAccess();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -61,6 +61,8 @@ public:
|
||||
const DXBC::ShaderType shaderType, const char *opString);
|
||||
ShaderVariable GetRenderTargetSampleInfo(const DXBC::ShaderType shaderType, const char *opString);
|
||||
ResourceReferenceInfo GetResourceReferenceInfo(const DXDebug::BindingSlot &slot);
|
||||
ShaderDirectAccess GetShaderDirectAccess(DescriptorCategory category,
|
||||
const DXDebug::BindingSlot &slot);
|
||||
|
||||
private:
|
||||
WrappedID3D12Device *m_Device;
|
||||
|
||||
@@ -46,6 +46,9 @@ typedef DXBC::InterpolationMode InterpolationMode;
|
||||
class Debugger;
|
||||
struct GlobalState;
|
||||
|
||||
// D3D12 descriptors are equal sized and treated as effectively one byte in size
|
||||
const uint32_t D3D12_DESCRIPTOR_BYTESIZE = 1;
|
||||
|
||||
struct InstructionRange
|
||||
{
|
||||
uint32_t min;
|
||||
@@ -162,6 +165,8 @@ public:
|
||||
virtual ShaderVariable GetRenderTargetSampleInfo(const DXBC::ShaderType shaderType,
|
||||
const char *opString) = 0;
|
||||
virtual ResourceReferenceInfo GetResourceReferenceInfo(const DXDebug::BindingSlot &slot) = 0;
|
||||
virtual ShaderDirectAccess GetShaderDirectAccess(DescriptorCategory category,
|
||||
const DXDebug::BindingSlot &slot) = 0;
|
||||
};
|
||||
|
||||
struct MemoryTracking
|
||||
|
||||
Reference in New Issue
Block a user