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.
This commit is contained in:
baldurk
2026-03-03 18:05:57 +00:00
parent c5df93bbfa
commit 6b6480fafb
2 changed files with 11 additions and 1 deletions
+4 -1
View File
@@ -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;
}
@@ -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}}));