HLSL: Flatten more I/O: non-arrayed user-only structures.
The goal is to flatten all I/O, but there are multiple categories and
steps to complete, likely including a final unification of splitting
and flattening.
diff --git a/hlsl/hlslParseHelper.cpp b/hlsl/hlslParseHelper.cpp
index e684fd1..a1e783b 100755
--- a/hlsl/hlslParseHelper.cpp
+++ b/hlsl/hlslParseHelper.cpp
@@ -1904,6 +1904,10 @@
// Structs containing built-ins must be split
else if (variable.getType().containsBuiltIn())
split(variable);
+ else if (!variable.getType().getQualifier().isArrayedIo(language))
+ flatten(variable);
+ //else
+ // TODO: unify split and flatten, so all paths can create flattened I/O
}
// For clip and cull distance, multiple output variables potentially get merged
@@ -1915,7 +1919,7 @@
if (entryPointOutput != nullptr)
makeVariableInOut(*entryPointOutput);
for (auto it = inputs.begin(); it != inputs.end(); ++it)
- if (!isDsPcfInput((*it)->getType())) // skip domain shader PCF input (see comment below)
+ if (!isDsPcfInput((*it)->getType())) // wait until the end for PCF input (see comment below)
makeVariableInOut(*(*it));
for (auto it = outputs.begin(); it != outputs.end(); ++it)
makeVariableInOut(*(*it));
@@ -1927,7 +1931,7 @@
// however, so this ensures the linkage is built in the correct order regardless of argument order.
if (language == EShLangTessEvaluation) {
for (auto it = inputs.begin(); it != inputs.end(); ++it)
- if (isDsPcfInput((*it)->getType())) // skip domain shader PCF input (see comment below)
+ if (isDsPcfInput((*it)->getType()))
makeVariableInOut(*(*it));
}