From 6b6480fafb628614429ebd28614f757a413b3e08 Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 3 Mar 2026 18:05:57 +0000 Subject: [PATCH] Fix detection of semantic arrays to not falsely merge separated elements * It's impossible to distinguish a separate TEXCOORD0 and TEXCOORD1 from an array at TEXCOORD0. However making this an array by that same logic is fine. We can't make an array though if there is another element in between they must be contiguous. --- renderdoc/driver/shaders/dxbc/dx_debug.cpp | 5 ++++- util/test/demos/d3d11/d3d11_shader_linkage_zoo.cpp | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/renderdoc/driver/shaders/dxbc/dx_debug.cpp b/renderdoc/driver/shaders/dxbc/dx_debug.cpp index 8aeb41903..d9cd245cd 100644 --- a/renderdoc/driver/shaders/dxbc/dx_debug.cpp +++ b/renderdoc/driver/shaders/dxbc/dx_debug.cpp @@ -221,13 +221,15 @@ void GatherInputDataForInitialValues(const DXBC::DXBCContainer *dxbc, InputFetch if(included && numCols <= 3 && (sig.regChannelMask & 0x1)) { uint32_t nextIdx = sig.semanticIndex + 1; + uint32_t nextReg = sig.regIndex + 1; for(size_t j = i + 1; j < numInputs; j++) { const SigParameter &jSig = stageInputSig[j]; // if we've found the 'next' semantic - if(sig.semanticName == jSig.semanticName && nextIdx == jSig.semanticIndex) + if(sig.semanticName == jSig.semanticName && nextIdx == jSig.semanticIndex && + nextReg == jSig.regIndex) { int jNumCols = (jSig.regChannelMask & 0x1 ? 1 : 0) + (jSig.regChannelMask & 0x2 ? 1 : 0) + (jSig.regChannelMask & 0x4 ? 1 : 0) + (jSig.regChannelMask & 0x8 ? 1 : 0); @@ -247,6 +249,7 @@ void GatherInputDataForInitialValues(const DXBC::DXBCContainer *dxbc, InputFetch // continue searching now nextIdx++; + nextReg++; j = i + 1; continue; } diff --git a/util/test/demos/d3d11/d3d11_shader_linkage_zoo.cpp b/util/test/demos/d3d11/d3d11_shader_linkage_zoo.cpp index 6d858121d..ddb3f53b8 100644 --- a/util/test/demos/d3d11/d3d11_shader_linkage_zoo.cpp +++ b/util/test/demos/d3d11/d3d11_shader_linkage_zoo.cpp @@ -258,6 +258,13 @@ float4 main(v2f IN) : SV_Target0 tests.push_back(BuildTestCase({{false, VarType::UInt, 3, 1, "TEXCOORD0", true}})); tests.push_back(BuildTestCase({{false, VarType::UInt, 4, 1, "TEXCOORD0", true}})); + // something that looks like an array but isn't + tests.push_back(BuildTestCase({ + {false, VarType::Float, 2, 1, "TEXCOORD0", true}, + {false, VarType::Float, 2, 1, "OTHER", true}, + {false, VarType::Float, 2, 1, "TEXCOORD1", true}, + })); + // float2 array with an extra float2 tests.push_back(BuildTestCase({{false, VarType::Float, 2, 5, "TEXCOORD0", true}, {false, VarType::Float, 2, 0, "OTHER", true}}));