Implement relaxed rule for opaque struct members
This commit is contained in:
parent
a3069e1df4
commit
c59b876ca0
9 changed files with 2787 additions and 2187 deletions
|
|
@ -492,18 +492,41 @@ function_call_header_no_parameters
|
|||
|
||||
function_call_header_with_parameters
|
||||
: function_call_header assignment_expression {
|
||||
TParameter param = { 0, new TType };
|
||||
param.type->shallowCopy($2->getType());
|
||||
$1.function->addParameter(param);
|
||||
$$.function = $1.function;
|
||||
$$.intermNode = $2;
|
||||
if (parseContext.spvVersion.vulkan > 0
|
||||
&& parseContext.spvVersion.vulkanRelaxed
|
||||
&& $2->getType().containsOpaque())
|
||||
{
|
||||
$$.intermNode = parseContext.vkRelaxedRemapFunctionArgument($$.loc, $1.function, $2);
|
||||
$$.function = $1.function;
|
||||
}
|
||||
else
|
||||
{
|
||||
TParameter param = { 0, new TType };
|
||||
param.type->shallowCopy($2->getType());
|
||||
|
||||
$1.function->addParameter(param);
|
||||
$$.function = $1.function;
|
||||
$$.intermNode = $2;
|
||||
}
|
||||
}
|
||||
| function_call_header_with_parameters COMMA assignment_expression {
|
||||
TParameter param = { 0, new TType };
|
||||
param.type->shallowCopy($3->getType());
|
||||
$1.function->addParameter(param);
|
||||
$$.function = $1.function;
|
||||
$$.intermNode = parseContext.intermediate.growAggregate($1.intermNode, $3, $2.loc);
|
||||
if (parseContext.spvVersion.vulkan > 0
|
||||
&& parseContext.spvVersion.vulkanRelaxed
|
||||
&& $3->getType().containsOpaque())
|
||||
{
|
||||
TIntermNode* remappedNode = parseContext.vkRelaxedRemapFunctionArgument($2.loc, $1.function, $3);
|
||||
$$.intermNode = parseContext.intermediate.mergeAggregate($1.intermNode, remappedNode, $2.loc);
|
||||
$$.function = $1.function;
|
||||
}
|
||||
else
|
||||
{
|
||||
TParameter param = { 0, new TType };
|
||||
param.type->shallowCopy($3->getType());
|
||||
|
||||
$1.function->addParameter(param);
|
||||
$$.function = $1.function;
|
||||
$$.intermNode = parseContext.intermediate.growAggregate($1.intermNode, $3, $2.loc);
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
|
|
@ -980,7 +1003,12 @@ function_header_with_parameters
|
|||
// Add the parameter
|
||||
$$ = $1;
|
||||
if ($2.param.type->getBasicType() != EbtVoid)
|
||||
$1->addParameter($2.param);
|
||||
{
|
||||
if (!(parseContext.spvVersion.vulkan > 0 && parseContext.spvVersion.vulkanRelaxed))
|
||||
$1->addParameter($2.param);
|
||||
else
|
||||
parseContext.vkRelaxedRemapFunctionParameter($2.loc, $1, $2.param);
|
||||
}
|
||||
else
|
||||
delete $2.param.type;
|
||||
}
|
||||
|
|
@ -998,7 +1026,10 @@ function_header_with_parameters
|
|||
} else {
|
||||
// Add the parameter
|
||||
$$ = $1;
|
||||
$1->addParameter($3.param);
|
||||
if (!(parseContext.spvVersion.vulkan > 0 && parseContext.spvVersion.vulkanRelaxed))
|
||||
$1->addParameter($3.param);
|
||||
else
|
||||
parseContext.vkRelaxedRemapFunctionParameter($3.loc, $1, $3.param);
|
||||
}
|
||||
}
|
||||
;
|
||||
|
|
@ -3549,11 +3580,17 @@ precision_qualifier
|
|||
|
||||
struct_specifier
|
||||
: STRUCT IDENTIFIER LEFT_BRACE { parseContext.nestedStructCheck($1.loc); } struct_declaration_list RIGHT_BRACE {
|
||||
|
||||
TType* structure = new TType($5, *$2.string);
|
||||
parseContext.structArrayCheck($2.loc, *structure);
|
||||
|
||||
TVariable* userTypeDef = new TVariable($2.string, *structure, true);
|
||||
if (! parseContext.symbolTable.insert(*userTypeDef))
|
||||
parseContext.error($2.loc, "redefinition", $2.string->c_str(), "struct");
|
||||
else if (parseContext.spvVersion.vulkanRelaxed
|
||||
&& structure->containsOpaque())
|
||||
parseContext.relaxedSymbols.push_back(structure->getTypeName());
|
||||
|
||||
$$.init($1.loc);
|
||||
$$.basicType = EbtStruct;
|
||||
$$.userDef = structure;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue