From cfa392e279fc35bb841b676047d59e267d6d2b91 Mon Sep 17 00:00:00 2001 From: Jake Turner Date: Wed, 11 Dec 2024 08:57:57 +0000 Subject: [PATCH] DXIL Debugger handle Half types in GatherPSInputDataForInitialValues() --- renderdoc/driver/shaders/dxbc/dx_debug.cpp | 26 +++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/renderdoc/driver/shaders/dxbc/dx_debug.cpp b/renderdoc/driver/shaders/dxbc/dx_debug.cpp index 7b53e44b3..84cde373d 100644 --- a/renderdoc/driver/shaders/dxbc/dx_debug.cpp +++ b/renderdoc/driver/shaders/dxbc/dx_debug.cpp @@ -123,12 +123,16 @@ void GatherPSInputDataForInitialValues(const rdcarray &stageInputS if(prevStageOutputSig[os].regIndex == nextreg + dummy) { filled = true; + VarType varType = prevStageOutputSig[os].varType; + uint32_t bytesPerColumn = (varType != VarType::Half) ? 4 : 2; - if(prevStageOutputSig[os].varType == VarType::Float) + if(varType == VarType::Float) psInputDefinition += "float"; - else if(prevStageOutputSig[os].varType == VarType::SInt) + else if(varType == VarType::Half) + psInputDefinition += "half"; + else if(varType == VarType::SInt) psInputDefinition += "int"; - else if(prevStageOutputSig[os].varType == VarType::UInt) + else if(varType == VarType::UInt) psInputDefinition += "uint"; else RDCERR("Unexpected input signature type: %s", @@ -139,13 +143,13 @@ void GatherPSInputDataForInitialValues(const rdcarray &stageInputS (prevStageOutputSig[os].regChannelMask & 0x4 ? 1 : 0) + (prevStageOutputSig[os].regChannelMask & 0x8 ? 1 : 0); - structureStride += 4 * numCols; - - initialValues.push_back(PSInputElement(-1, 0, numCols, ShaderBuiltin::Undefined, true)); - rdcstr name = prevStageOutputSig[os].semanticIdxName; - psInputDefinition += ToStr((uint32_t)numCols) + " input_" + name + " : " + name + ";\n"; + + uint32_t byteSize = AlignUp4(numCols * bytesPerColumn); + structureStride += byteSize; + + initialValues.push_back(PSInputElement(-1, 0, byteSize / 4, ShaderBuiltin::Undefined, true)); } } @@ -310,6 +314,8 @@ void GatherPSInputDataForInitialValues(const rdcarray &stageInputS : sig.regChannelMask & 0x4 ? 2 : sig.regChannelMask & 0x8 ? 3 : -1; + uint32_t bytesPerColumn = (sig.varType != VarType::Half) ? 4 : 2; + uint32_t byteSize = AlignUp4(numCols * bytesPerColumn); // arrays get added all at once (because in the struct data, they are contiguous even if // in the input signature they're not). @@ -318,14 +324,14 @@ void GatherPSInputDataForInitialValues(const rdcarray &stageInputS if(arrayLength == 0) { initialValues.push_back( - PSInputElement(sig.regIndex, firstElem, numCols, sig.systemValue, included)); + PSInputElement(sig.regIndex, firstElem, byteSize / 4, sig.systemValue, included)); } else { for(int a = 0; a < arrayLength; a++) { initialValues.push_back( - PSInputElement(sig.regIndex + a, firstElem, numCols, sig.systemValue, included)); + PSInputElement(sig.regIndex + a, firstElem, byteSize / 4, sig.systemValue, included)); } } }