Added helper D3D12ShaderDebug::GetRenderTargetSampleInfo()

Used by the DXIL debugger and the DXBC D3D12 version of GetSampleInfo()
This commit is contained in:
Jake Turner
2024-07-03 18:27:30 +01:00
parent fcc6ab5087
commit aa5538b2e9
2 changed files with 29 additions and 22 deletions
+26 -22
View File
@@ -881,6 +881,31 @@ ShaderVariable D3D12ShaderDebug::GetSampleInfo(WrappedID3D12Device *device,
return result;
}
ShaderVariable D3D12ShaderDebug::GetRenderTargetSampleInfo(WrappedID3D12Device *device,
const DXBC::ShaderType shaderType,
const char *opString)
{
ShaderVariable result("", 0U, 0U, 0U, 0U);
if(shaderType != DXBC::ShaderType::Compute)
{
D3D12ResourceManager *rm = device->GetResourceManager();
const D3D12RenderState &rs = device->GetQueue()->GetCommandData()->m_RenderState;
// try depth first - both should match sample count though to be valid
ResourceId res = rs.GetDSVID();
if(res == ResourceId() && !rs.rts.empty())
res = rs.rts[0].GetResResourceId();
ID3D12Resource *pResource = rm->GetCurrentAs<ID3D12Resource>(res);
D3D12_RESOURCE_DESC resDesc = pResource->GetDesc();
result.value.u32v[0] = resDesc.SampleDesc.Count;
result.value.u32v[1] = 0;
result.value.u32v[2] = 0;
result.value.u32v[3] = 0;
}
return result;
}
class D3D12DebugAPIWrapper : public DXBCDebug::DebugAPIWrapper
{
public:
@@ -1335,28 +1360,7 @@ ShaderVariable D3D12DebugAPIWrapper::GetSampleInfo(DXBCBytecode::OperandType typ
{
DXBC::ShaderType shaderType = GetShaderType();
if(type == DXBCBytecode::TYPE_RASTERIZER)
{
ShaderVariable result("", 0U, 0U, 0U, 0U);
if(shaderType != DXBC::ShaderType::Compute)
{
D3D12ResourceManager *rm = m_pDevice->GetResourceManager();
const D3D12RenderState &rs = m_pDevice->GetQueue()->GetCommandData()->m_RenderState;
// try depth first - both should match sample count though to be valid
ResourceId res = rs.GetDSVID();
if(res == ResourceId() && !rs.rts.empty())
res = rs.rts[0].GetResResourceId();
ID3D12Resource *pResource = rm->GetCurrentAs<ID3D12Resource>(res);
D3D12_RESOURCE_DESC resDesc = pResource->GetDesc();
result.value.u32v[0] = resDesc.SampleDesc.Count;
result.value.u32v[1] = 0;
result.value.u32v[2] = 0;
result.value.u32v[3] = 0;
}
return result;
}
return D3D12ShaderDebug::GetRenderTargetSampleInfo(m_pDevice, shaderType, opString);
D3D12_DESCRIPTOR_RANGE_TYPE descType = ConvertOperandTypeToDescriptorType(type);
return D3D12ShaderDebug::GetSampleInfo(m_pDevice, descType, slot, shaderType, opString);
@@ -62,4 +62,7 @@ ShaderVariable GetResourceInfo(WrappedID3D12Device *device, D3D12_DESCRIPTOR_RAN
ShaderVariable GetSampleInfo(WrappedID3D12Device *device, D3D12_DESCRIPTOR_RANGE_TYPE descType,
const DXBCDXILDebug::BindingSlot &slot,
const DXBC::ShaderType shaderType, const char *opString);
ShaderVariable GetRenderTargetSampleInfo(WrappedID3D12Device *device,
const DXBC::ShaderType shaderType, const char *opString);
};