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.
This commit is contained in:
John Kessenich
2017-08-04 12:04:44 -06:00
parent cca42a8ea6
commit b6be80f44e
12 changed files with 693 additions and 374 deletions

View File

@@ -1904,6 +1904,10 @@ TIntermNode* HlslParseContext::transformEntryPoint(const TSourceLoc& loc, TFunct
// 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 @@ TIntermNode* HlslParseContext::transformEntryPoint(const TSourceLoc& loc, TFunct
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 @@ TIntermNode* HlslParseContext::transformEntryPoint(const TSourceLoc& loc, TFunct
// 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));
}