From 9b97fa5ed0b999ec50f378ca1cd9002f04082917 Mon Sep 17 00:00:00 2001 From: Jake Turner Date: Wed, 1 May 2024 07:56:18 +0100 Subject: [PATCH] RD DXIL Disassembly: improve presentation of Inputs and Outputs Handle Inputs and Outputs which have multiple rows Prefix Inputs with "." Prefix Outputs with "." Inputs and Outputs can share the same names (semantic names) i.e. COLOR, INTERPOLATOR --- .../driver/shaders/dxil/dxil_disassemble.cpp | 42 ++++++++++++++----- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/renderdoc/driver/shaders/dxil/dxil_disassemble.cpp b/renderdoc/driver/shaders/dxil/dxil_disassemble.cpp index b8620b5a8..73212b3d6 100644 --- a/renderdoc/driver/shaders/dxil/dxil_disassemble.cpp +++ b/renderdoc/driver/shaders/dxil/dxil_disassemble.cpp @@ -2209,12 +2209,21 @@ void Program::MakeRDDisassemblyString(const DXBC::Reflection *reflection) VarType varType = VarTypeForComponentType(sig.type); m_Disassembly += " Input[" + ToStr(i) + "] " + ToStr(varType).c_str(); - if(sig.rows > 1) - m_Disassembly += ToStr(sig.rows) + "x"; if(sig.cols > 1) m_Disassembly += ToStr(sig.cols); - m_Disassembly += " " + sig.name + ";"; + if(reflection && sig.rows == 1) + { + const SigParameter &sigParam = reflection->InputSig[i]; + if(sigParam.semanticName == sig.name) + { + sig.name = sigParam.semanticIdxName; + } + } + m_Disassembly += " " + sig.name; + if(sig.rows > 1) + m_Disassembly += "[" + ToStr(sig.rows) + "]"; + m_Disassembly += ";"; DisassemblyAddNewLine(); } if(!entryPoint.outputs.empty()) @@ -2226,12 +2235,19 @@ void Program::MakeRDDisassemblyString(const DXBC::Reflection *reflection) VarType varType = VarTypeForComponentType(sig.type); m_Disassembly += " Output[" + ToStr(i) + "] " + ToStr(varType).c_str(); - if(sig.rows > 1) - m_Disassembly += ToStr(sig.rows) + "x"; if(sig.cols > 1) m_Disassembly += ToStr(sig.cols); - m_Disassembly += " " + sig.name + ";"; + if(reflection && sig.rows == 1) + { + const SigParameter &sigParam = reflection->OutputSig[i]; + if(sigParam.semanticName == sig.name) + sig.name = sigParam.semanticIdxName; + } + m_Disassembly += " " + sig.name; + if(sig.rows > 1) + m_Disassembly += "[" + ToStr(sig.rows) + "]"; + m_Disassembly += ";"; DisassemblyAddNewLine(); } @@ -2457,10 +2473,11 @@ void Program::MakeRDDisassemblyString(const DXBC::Reflection *reflection) uint32_t dxopCode = getival(inst.args[0]); RDCASSERTEQUAL(dxopCode, 4); uint32_t inputIdx = getival(inst.args[1]); + lineStr += "."; lineStr += entryPoint.inputs[inputIdx].name; - uint32_t colIdx = getival(inst.args[2]); + uint32_t rowIdx = getival(inst.args[2]); if(entryPoint.inputs[inputIdx].rows > 1) - lineStr += "[" + ToStr(colIdx) + "]"; + lineStr += "[" + ToStr(rowIdx) + "]"; lineStr += "."; uint32_t componentIdx = getival(inst.args[3]); lineStr += swizzle[componentIdx & 0x3]; @@ -2471,11 +2488,12 @@ void Program::MakeRDDisassemblyString(const DXBC::Reflection *reflection) uint32_t dxopCode = getival(inst.args[0]); RDCASSERTEQUAL(dxopCode, 5); uint32_t outputIdx = getival(inst.args[1]); + lineStr += "."; lineStr += entryPoint.outputs[outputIdx].name; lineStr += "."; - uint32_t colIdx = getival(inst.args[2]); + uint32_t rowIdx = getival(inst.args[2]); if(entryPoint.outputs[outputIdx].rows > 1) - lineStr += "[" + ToStr(colIdx) + "]"; + lineStr += "[" + ToStr(rowIdx) + "]"; uint32_t componentIdx = getival(inst.args[3]); lineStr += swizzle[componentIdx & 0x3]; lineStr += " = " + ArgToString(inst.args[4], false); @@ -2483,10 +2501,12 @@ void Program::MakeRDDisassemblyString(const DXBC::Reflection *reflection) else if(showDxFuncName && funcCallName.beginsWith("dx.op.createHandle")) { showDxFuncName = false; + uint32_t dxopCode = getival(inst.args[0]); + RDCASSERTEQUAL(dxopCode, 57); ResourceClass resClass = getival(inst.args[1]); uint32_t resIndex = getival(inst.args[2]); uint32_t resLowerBound = getival(inst.args[3]); - bool nonUniformIndex = (getival(inst.args[4]) == 1); + bool nonUniformIndex = (getival(inst.args[4]) != 0); rdcstr resName = ""; switch(resClass) {