HLSL: Handle "fake" entry points, by undoing their built-in variable declarations.
This commit is contained in:
parent
9e079535a0
commit
07350f3382
6 changed files with 138 additions and 1 deletions
|
|
@ -755,6 +755,8 @@ TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& l
|
|||
inEntrypoint = (function.getName() == intermediate.getEntryPoint().c_str());
|
||||
if (inEntrypoint)
|
||||
remapEntrypointIO(function);
|
||||
else
|
||||
remapNonEntrypointIO(function);
|
||||
|
||||
//
|
||||
// New symbol table scope for body of function plus its arguments
|
||||
|
|
@ -864,6 +866,21 @@ void HlslParseContext::remapEntrypointIO(TFunction& function)
|
|||
}
|
||||
}
|
||||
|
||||
// An HLSL function that looks like an entry point, but is not,
|
||||
// declares entry point IO built-ins, but these have to be undone.
|
||||
void HlslParseContext::remapNonEntrypointIO(TFunction& function)
|
||||
{
|
||||
const auto remapBuiltInType = [&](TType& type) { type.getQualifier().builtIn = EbvNone; };
|
||||
|
||||
// return value
|
||||
if (function.getType().getBasicType() != EbtVoid)
|
||||
remapBuiltInType(function.getWritableType());
|
||||
|
||||
// parameters
|
||||
for (int i = 0; i < function.getParamCount(); i++)
|
||||
remapBuiltInType(*function[i].type);
|
||||
}
|
||||
|
||||
// Handle function returns, including type conversions to the function return type
|
||||
// if necessary.
|
||||
TIntermNode* HlslParseContext::handleReturnValue(const TSourceLoc& loc, TIntermTyped* value)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue