|
@@ -2,7 +2,7 @@
|
|
|
// Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
|
|
// Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
|
|
|
// Copyright (C) 2012-2015 LunarG, Inc.
|
|
// Copyright (C) 2012-2015 LunarG, Inc.
|
|
|
// Copyright (C) 2015-2018 Google, Inc.
|
|
// Copyright (C) 2015-2018 Google, Inc.
|
|
|
-// Copyright (C) 2017 ARM Limited.
|
|
|
|
|
|
|
+// Copyright (C) 2017, 2019 ARM Limited.
|
|
|
//
|
|
//
|
|
|
// All rights reserved.
|
|
// All rights reserved.
|
|
|
//
|
|
//
|
|
@@ -2669,14 +2669,14 @@ void TParseContext::reservedErrorCheck(const TSourceLoc& loc, const TString& ide
|
|
|
if (builtInName(identifier))
|
|
if (builtInName(identifier))
|
|
|
error(loc, "identifiers starting with \"gl_\" are reserved", identifier.c_str(), "");
|
|
error(loc, "identifiers starting with \"gl_\" are reserved", identifier.c_str(), "");
|
|
|
|
|
|
|
|
- // "__" are not supposed to be an error. ES 310 (and desktop) added the clarification:
|
|
|
|
|
|
|
+ // "__" are not supposed to be an error. ES 300 (and desktop) added the clarification:
|
|
|
// "In addition, all identifiers containing two consecutive underscores (__) are
|
|
// "In addition, all identifiers containing two consecutive underscores (__) are
|
|
|
// reserved; using such a name does not itself result in an error, but may result
|
|
// reserved; using such a name does not itself result in an error, but may result
|
|
|
// in undefined behavior."
|
|
// in undefined behavior."
|
|
|
// however, before that, ES tests required an error.
|
|
// however, before that, ES tests required an error.
|
|
|
if (identifier.find("__") != TString::npos) {
|
|
if (identifier.find("__") != TString::npos) {
|
|
|
- if (isEsProfile() && version <= 300)
|
|
|
|
|
- error(loc, "identifiers containing consecutive underscores (\"__\") are reserved, and an error if version <= 300", identifier.c_str(), "");
|
|
|
|
|
|
|
+ if (isEsProfile() && version < 300)
|
|
|
|
|
+ error(loc, "identifiers containing consecutive underscores (\"__\") are reserved, and an error if version < 300", identifier.c_str(), "");
|
|
|
else
|
|
else
|
|
|
warn(loc, "identifiers containing consecutive underscores (\"__\") are reserved", identifier.c_str(), "");
|
|
warn(loc, "identifiers containing consecutive underscores (\"__\") are reserved", identifier.c_str(), "");
|
|
|
}
|
|
}
|
|
@@ -2688,7 +2688,7 @@ void TParseContext::reservedErrorCheck(const TSourceLoc& loc, const TString& ide
|
|
|
//
|
|
//
|
|
|
void TParseContext::reservedPpErrorCheck(const TSourceLoc& loc, const char* identifier, const char* op)
|
|
void TParseContext::reservedPpErrorCheck(const TSourceLoc& loc, const char* identifier, const char* op)
|
|
|
{
|
|
{
|
|
|
- // "__" are not supposed to be an error. ES 310 (and desktop) added the clarification:
|
|
|
|
|
|
|
+ // "__" are not supposed to be an error. ES 300 (and desktop) added the clarification:
|
|
|
// "All macro names containing two consecutive underscores ( __ ) are reserved;
|
|
// "All macro names containing two consecutive underscores ( __ ) are reserved;
|
|
|
// defining such a name does not itself result in an error, but may result in
|
|
// defining such a name does not itself result in an error, but may result in
|
|
|
// undefined behavior. All macro names prefixed with "GL_" ("GL" followed by a
|
|
// undefined behavior. All macro names prefixed with "GL_" ("GL" followed by a
|
|
@@ -2706,8 +2706,8 @@ void TParseContext::reservedPpErrorCheck(const TSourceLoc& loc, const char* iden
|
|
|
strcmp(identifier, "__VERSION__") == 0))
|
|
strcmp(identifier, "__VERSION__") == 0))
|
|
|
ppError(loc, "predefined names can't be (un)defined:", op, identifier);
|
|
ppError(loc, "predefined names can't be (un)defined:", op, identifier);
|
|
|
else {
|
|
else {
|
|
|
- if (isEsProfile() && version <= 300)
|
|
|
|
|
- ppError(loc, "names containing consecutive underscores are reserved, and an error if version <= 300:", op, identifier);
|
|
|
|
|
|
|
+ if (isEsProfile() && version < 300)
|
|
|
|
|
+ ppError(loc, "names containing consecutive underscores are reserved, and an error if version < 300:", op, identifier);
|
|
|
else
|
|
else
|
|
|
ppWarn(loc, "names containing consecutive underscores are reserved:", op, identifier);
|
|
ppWarn(loc, "names containing consecutive underscores are reserved:", op, identifier);
|
|
|
}
|
|
}
|
|
@@ -6922,7 +6922,7 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
|
|
|
// This avoids requesting a matrix of a new type that is going to be discarded anyway.
|
|
// This avoids requesting a matrix of a new type that is going to be discarded anyway.
|
|
|
// TODO: This could be generalized to more type combinations, but that would require
|
|
// TODO: This could be generalized to more type combinations, but that would require
|
|
|
// more extensive testing and full algorithm rework. For now, the need to do two changes makes
|
|
// more extensive testing and full algorithm rework. For now, the need to do two changes makes
|
|
|
- // the recursive call work, and avoids the most aggregious case of creating integer matrices.
|
|
|
|
|
|
|
+ // the recursive call work, and avoids the most egregious case of creating integer matrices.
|
|
|
if (node->getType().isMatrix() && (type.isScalar() || type.isVector()) &&
|
|
if (node->getType().isMatrix() && (type.isScalar() || type.isVector()) &&
|
|
|
type.isFloatingDomain() != node->getType().isFloatingDomain()) {
|
|
type.isFloatingDomain() != node->getType().isFloatingDomain()) {
|
|
|
TType transitionType(node->getBasicType(), glslang::EvqTemporary, type.getVectorSize(), 0, 0, node->isVector());
|
|
TType transitionType(node->getBasicType(), glslang::EvqTemporary, type.getVectorSize(), 0, 0, node->isVector());
|
|
@@ -7017,8 +7017,14 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
|
|
|
if (!intermediate.getArithemeticFloat16Enabled()) {
|
|
if (!intermediate.getArithemeticFloat16Enabled()) {
|
|
|
TType tempType(EbtFloat, EvqTemporary, type.getVectorSize());
|
|
TType tempType(EbtFloat, EvqTemporary, type.getVectorSize());
|
|
|
newNode = node;
|
|
newNode = node;
|
|
|
- if (tempType != newNode->getType())
|
|
|
|
|
- newNode = intermediate.setAggregateOperator(newNode, (TOperator)(EOpConstructVec2 + op - EOpConstructF16Vec2), tempType, node->getLoc());
|
|
|
|
|
|
|
+ if (tempType != newNode->getType()) {
|
|
|
|
|
+ TOperator aggregateOp;
|
|
|
|
|
+ if (op == EOpConstructFloat16)
|
|
|
|
|
+ aggregateOp = EOpConstructFloat;
|
|
|
|
|
+ else
|
|
|
|
|
+ aggregateOp = (TOperator)(EOpConstructVec2 + op - EOpConstructF16Vec2);
|
|
|
|
|
+ newNode = intermediate.setAggregateOperator(newNode, aggregateOp, tempType, node->getLoc());
|
|
|
|
|
+ }
|
|
|
newNode = intermediate.addConversion(EbtFloat16, newNode);
|
|
newNode = intermediate.addConversion(EbtFloat16, newNode);
|
|
|
return newNode;
|
|
return newNode;
|
|
|
}
|
|
}
|
|
@@ -7034,8 +7040,14 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
|
|
|
if (!intermediate.getArithemeticInt8Enabled()) {
|
|
if (!intermediate.getArithemeticInt8Enabled()) {
|
|
|
TType tempType(EbtInt, EvqTemporary, type.getVectorSize());
|
|
TType tempType(EbtInt, EvqTemporary, type.getVectorSize());
|
|
|
newNode = node;
|
|
newNode = node;
|
|
|
- if (tempType != newNode->getType())
|
|
|
|
|
- newNode = intermediate.setAggregateOperator(newNode, (TOperator)(EOpConstructIVec2 + op - EOpConstructI8Vec2), tempType, node->getLoc());
|
|
|
|
|
|
|
+ if (tempType != newNode->getType()) {
|
|
|
|
|
+ TOperator aggregateOp;
|
|
|
|
|
+ if (op == EOpConstructInt8)
|
|
|
|
|
+ aggregateOp = EOpConstructInt;
|
|
|
|
|
+ else
|
|
|
|
|
+ aggregateOp = (TOperator)(EOpConstructIVec2 + op - EOpConstructI8Vec2);
|
|
|
|
|
+ newNode = intermediate.setAggregateOperator(newNode, aggregateOp, tempType, node->getLoc());
|
|
|
|
|
+ }
|
|
|
newNode = intermediate.addConversion(EbtInt8, newNode);
|
|
newNode = intermediate.addConversion(EbtInt8, newNode);
|
|
|
return newNode;
|
|
return newNode;
|
|
|
}
|
|
}
|
|
@@ -7051,8 +7063,14 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
|
|
|
if (!intermediate.getArithemeticInt8Enabled()) {
|
|
if (!intermediate.getArithemeticInt8Enabled()) {
|
|
|
TType tempType(EbtUint, EvqTemporary, type.getVectorSize());
|
|
TType tempType(EbtUint, EvqTemporary, type.getVectorSize());
|
|
|
newNode = node;
|
|
newNode = node;
|
|
|
- if (tempType != newNode->getType())
|
|
|
|
|
- newNode = intermediate.setAggregateOperator(newNode, (TOperator)(EOpConstructUVec2 + op - EOpConstructU8Vec2), tempType, node->getLoc());
|
|
|
|
|
|
|
+ if (tempType != newNode->getType()) {
|
|
|
|
|
+ TOperator aggregateOp;
|
|
|
|
|
+ if (op == EOpConstructUint8)
|
|
|
|
|
+ aggregateOp = EOpConstructUint;
|
|
|
|
|
+ else
|
|
|
|
|
+ aggregateOp = (TOperator)(EOpConstructUVec2 + op - EOpConstructU8Vec2);
|
|
|
|
|
+ newNode = intermediate.setAggregateOperator(newNode, aggregateOp, tempType, node->getLoc());
|
|
|
|
|
+ }
|
|
|
newNode = intermediate.addConversion(EbtUint8, newNode);
|
|
newNode = intermediate.addConversion(EbtUint8, newNode);
|
|
|
return newNode;
|
|
return newNode;
|
|
|
}
|
|
}
|
|
@@ -7068,8 +7086,14 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
|
|
|
if (!intermediate.getArithemeticInt16Enabled()) {
|
|
if (!intermediate.getArithemeticInt16Enabled()) {
|
|
|
TType tempType(EbtInt, EvqTemporary, type.getVectorSize());
|
|
TType tempType(EbtInt, EvqTemporary, type.getVectorSize());
|
|
|
newNode = node;
|
|
newNode = node;
|
|
|
- if (tempType != newNode->getType())
|
|
|
|
|
- newNode = intermediate.setAggregateOperator(newNode, (TOperator)(EOpConstructIVec2 + op - EOpConstructI16Vec2), tempType, node->getLoc());
|
|
|
|
|
|
|
+ if (tempType != newNode->getType()) {
|
|
|
|
|
+ TOperator aggregateOp;
|
|
|
|
|
+ if (op == EOpConstructInt16)
|
|
|
|
|
+ aggregateOp = EOpConstructInt;
|
|
|
|
|
+ else
|
|
|
|
|
+ aggregateOp = (TOperator)(EOpConstructIVec2 + op - EOpConstructI16Vec2);
|
|
|
|
|
+ newNode = intermediate.setAggregateOperator(newNode, aggregateOp, tempType, node->getLoc());
|
|
|
|
|
+ }
|
|
|
newNode = intermediate.addConversion(EbtInt16, newNode);
|
|
newNode = intermediate.addConversion(EbtInt16, newNode);
|
|
|
return newNode;
|
|
return newNode;
|
|
|
}
|
|
}
|
|
@@ -7085,8 +7109,14 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
|
|
|
if (!intermediate.getArithemeticInt16Enabled()) {
|
|
if (!intermediate.getArithemeticInt16Enabled()) {
|
|
|
TType tempType(EbtUint, EvqTemporary, type.getVectorSize());
|
|
TType tempType(EbtUint, EvqTemporary, type.getVectorSize());
|
|
|
newNode = node;
|
|
newNode = node;
|
|
|
- if (tempType != newNode->getType())
|
|
|
|
|
- newNode = intermediate.setAggregateOperator(newNode, (TOperator)(EOpConstructUVec2 + op - EOpConstructU16Vec2), tempType, node->getLoc());
|
|
|
|
|
|
|
+ if (tempType != newNode->getType()) {
|
|
|
|
|
+ TOperator aggregateOp;
|
|
|
|
|
+ if (op == EOpConstructUint16)
|
|
|
|
|
+ aggregateOp = EOpConstructUint;
|
|
|
|
|
+ else
|
|
|
|
|
+ aggregateOp = (TOperator)(EOpConstructUVec2 + op - EOpConstructU16Vec2);
|
|
|
|
|
+ newNode = intermediate.setAggregateOperator(newNode, aggregateOp, tempType, node->getLoc());
|
|
|
|
|
+ }
|
|
|
newNode = intermediate.addConversion(EbtUint16, newNode);
|
|
newNode = intermediate.addConversion(EbtUint16, newNode);
|
|
|
return newNode;
|
|
return newNode;
|
|
|
}
|
|
}
|