Implement operator-based implicit type conversions.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@20724 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
ef8ae2e345
commit
4b67103b02
6 changed files with 182 additions and 44 deletions
|
|
@ -1326,11 +1326,12 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType* type, TOperator op, T
|
|||
//
|
||||
TIntermTyped* TParseContext::constructStruct(TIntermNode* node, TType* type, int paramCount, TSourceLoc line, bool subset)
|
||||
{
|
||||
if (*type == node->getAsTyped()->getType()) {
|
||||
TIntermNode* converted = intermediate.addConversion(EOpConstructStruct, *type, node->getAsTyped());
|
||||
if (converted->getAsTyped()->getType() == *type) {
|
||||
if (subset)
|
||||
return node->getAsTyped();
|
||||
return converted->getAsTyped();
|
||||
else
|
||||
return intermediate.setAggregateOperator(node->getAsTyped(), EOpConstructStruct, line);
|
||||
return intermediate.setAggregateOperator(converted->getAsTyped(), EOpConstructStruct, line);
|
||||
} else {
|
||||
error(line, "", "constructor", "cannot convert parameter %d from '%s' to '%s'", paramCount,
|
||||
node->getAsTyped()->getType().getCompleteTypeString().c_str(), type->getCompleteTypeString().c_str());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue