From 8de9c1dcbbc38d3898086923dbabab190af1db60 Mon Sep 17 00:00:00 2001 From: Jake Turner Date: Wed, 11 Dec 2024 15:47:56 +0000 Subject: [PATCH] DXIL Debugger support for SV_ related ops DXOp::SampleIndex DXOp::Coverage DXOp::InnerCoverage DXOp::ViewID DXOp::PrimitiveID --- renderdoc/driver/shaders/dxil/dxil_debug.cpp | 45 ++++++++++++++++--- .../driver/shaders/dxil/dxil_reflect.cpp | 5 --- 2 files changed, 40 insertions(+), 10 deletions(-) diff --git a/renderdoc/driver/shaders/dxil/dxil_debug.cpp b/renderdoc/driver/shaders/dxil/dxil_debug.cpp index 1961100cd3..e88ca94296 100644 --- a/renderdoc/driver/shaders/dxil/dxil_debug.cpp +++ b/renderdoc/driver/shaders/dxil/dxil_debug.cpp @@ -3156,6 +3156,46 @@ bool ThreadState::ExecuteInstruction(DebugAPIWrapper *apiWrapper, result.value = a.value; break; } + case DXOp::SampleIndex: + { + // SV_SampleIndex + RDCASSERT(m_GlobalState.builtinInputs.count(ShaderBuiltin::MSAASampleIndex) != 0); + result.value.u32v[0] = + m_GlobalState.builtinInputs.at(ShaderBuiltin::MSAASampleIndex).value.u32v[0]; + break; + } + case DXOp::Coverage: + { + // SV_Coverage + RDCASSERT(m_GlobalState.builtinInputs.count(ShaderBuiltin::MSAACoverage) != 0); + result.value.u32v[0] = + m_GlobalState.builtinInputs.at(ShaderBuiltin::MSAACoverage).value.u32v[0]; + break; + } + case DXOp::InnerCoverage: + { + // SV_InnerCoverage + RDCASSERT(m_GlobalState.builtinInputs.count(ShaderBuiltin::IsFullyCovered) != 0); + result.value.u32v[0] = + m_GlobalState.builtinInputs.at(ShaderBuiltin::IsFullyCovered).value.u32v[0]; + break; + } + case DXOp::ViewID: + { + // SV_ViewportArrayIndex + RDCASSERT(m_GlobalState.builtinInputs.count(ShaderBuiltin::ViewportIndex) != 0); + result.value.u32v[0] = + m_GlobalState.builtinInputs.at(ShaderBuiltin::ViewportIndex).value.u32v[0]; + break; + } + case DXOp::PrimitiveID: + { + // SV_PrimitiveID + RDCASSERT(m_GlobalState.builtinInputs.count(ShaderBuiltin::PrimitiveIndex) != 0); + result.value.u32v[0] = + m_GlobalState.builtinInputs.at(ShaderBuiltin::PrimitiveIndex).value.u32v[0]; + break; + } case DXOp::IsHelperLane: { // Helper lanes don't have state @@ -3170,12 +3210,8 @@ bool ThreadState::ExecuteInstruction(DebugAPIWrapper *apiWrapper, case DXOp::Ibfe: case DXOp::Ubfe: case DXOp::Bfi: - case DXOp::SampleIndex: - case DXOp::Coverage: - case DXOp::InnerCoverage: case DXOp::MakeDouble: case DXOp::SplitDouble: - case DXOp::PrimitiveID: case DXOp::BitcastI16toF16: case DXOp::BitcastF16toI16: case DXOp::BitcastI32toF32: @@ -3186,7 +3222,6 @@ bool ThreadState::ExecuteInstruction(DebugAPIWrapper *apiWrapper, case DXOp::LegacyDoubleToSInt32: case DXOp::LegacyDoubleToUInt32: case DXOp::AttributeAtVertex: - case DXOp::ViewID: case DXOp::InstanceID: case DXOp::InstanceIndex: case DXOp::PrimitiveIndex: diff --git a/renderdoc/driver/shaders/dxil/dxil_reflect.cpp b/renderdoc/driver/shaders/dxil/dxil_reflect.cpp index a12b8f0d75..370941c423 100644 --- a/renderdoc/driver/shaders/dxil/dxil_reflect.cpp +++ b/renderdoc/driver/shaders/dxil/dxil_reflect.cpp @@ -1829,9 +1829,6 @@ rdcstr Program::GetDebugStatus() case DXOp::EvalSnapped: case DXOp::EvalSampleIndex: case DXOp::EvalCentroid: - case DXOp::SampleIndex: - case DXOp::Coverage: - case DXOp::InnerCoverage: case DXOp::EmitStream: case DXOp::CutStream: case DXOp::EmitThenCutStream: @@ -1843,7 +1840,6 @@ rdcstr Program::GetDebugStatus() case DXOp::DomainLocation: case DXOp::StorePatchConstant: case DXOp::OutputControlPointID: - case DXOp::PrimitiveID: case DXOp::CycleCounterLegacy: case DXOp::WaveIsFirstLane: case DXOp::WaveGetLaneIndex: @@ -1871,7 +1867,6 @@ rdcstr Program::GetDebugStatus() case DXOp::WaveAllBitCount: case DXOp::WavePrefixBitCount: case DXOp::AttributeAtVertex: - case DXOp::ViewID: case DXOp::InstanceID: case DXOp::InstanceIndex: case DXOp::HitKind: