Add uint type (big change). For both int/uint, add the operators >>, <<, &, |, and ^. Also added unsigned literals and uint precision support. Also fixed how int/uint literal underflow/overflow is handled.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21054 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
@@ -285,10 +285,21 @@ public:
|
||||
constUnion operator>>(const constUnion& constant) const
|
||||
{
|
||||
constUnion returnValue;
|
||||
assert(type == constant.type);
|
||||
switch (type) {
|
||||
case EbtInt: returnValue.setIConst(iConst >> constant.iConst); break;
|
||||
case EbtUint: returnValue.setUConst(uConst >> constant.uConst); break;
|
||||
case EbtInt:
|
||||
switch (constant.type) {
|
||||
case EbtInt: returnValue.setIConst(iConst >> constant.iConst); break;
|
||||
case EbtUint: returnValue.setIConst(iConst >> constant.uConst); break;
|
||||
default: assert(false && "Default missing");
|
||||
}
|
||||
break;
|
||||
case EbtUint:
|
||||
switch (constant.type) {
|
||||
case EbtInt: returnValue.setUConst(uConst >> constant.iConst); break;
|
||||
case EbtUint: returnValue.setUConst(uConst >> constant.uConst); break;
|
||||
default: assert(false && "Default missing");
|
||||
}
|
||||
break;
|
||||
default: assert(false && "Default missing");
|
||||
}
|
||||
|
||||
@@ -298,10 +309,21 @@ public:
|
||||
constUnion operator<<(const constUnion& constant) const
|
||||
{
|
||||
constUnion returnValue;
|
||||
assert(type == constant.type);
|
||||
switch (type) {
|
||||
case EbtInt: returnValue.setIConst(iConst << constant.iConst); break;
|
||||
case EbtUint: returnValue.setUConst(uConst << constant.uConst); break;
|
||||
case EbtInt:
|
||||
switch (constant.type) {
|
||||
case EbtInt: returnValue.setIConst(iConst << constant.iConst); break;
|
||||
case EbtUint: returnValue.setIConst(iConst << constant.uConst); break;
|
||||
default: assert(false && "Default missing");
|
||||
}
|
||||
break;
|
||||
case EbtUint:
|
||||
switch (constant.type) {
|
||||
case EbtInt: returnValue.setUConst(uConst << constant.iConst); break;
|
||||
case EbtUint: returnValue.setUConst(uConst << constant.uConst); break;
|
||||
default: assert(false && "Default missing");
|
||||
}
|
||||
break;
|
||||
default: assert(false && "Default missing");
|
||||
}
|
||||
|
||||
|
||||
@@ -269,6 +269,11 @@ public:
|
||||
matrixCols = c;
|
||||
vectorSize = 0;
|
||||
}
|
||||
|
||||
bool isScalar()
|
||||
{
|
||||
return matrixCols == 0 && vectorSize == 1 && arraySizes == 0 && userDef == 0;
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::map<TTypeList*, TTypeList*> TStructureMap;
|
||||
|
||||
@@ -75,11 +75,25 @@ enum TOperator {
|
||||
EOpPreDecrement,
|
||||
|
||||
EOpConvIntToBool,
|
||||
EOpConvUintToBool,
|
||||
EOpConvFloatToBool,
|
||||
EOpConvDoubleToBool,
|
||||
EOpConvBoolToFloat,
|
||||
EOpConvIntToFloat,
|
||||
EOpConvUintToFloat,
|
||||
EOpConvDoubleToFloat,
|
||||
EOpConvUintToInt,
|
||||
EOpConvFloatToInt,
|
||||
EOpConvBoolToInt,
|
||||
EOpConvDoubleToInt,
|
||||
EOpConvIntToUint,
|
||||
EOpConvFloatToUint,
|
||||
EOpConvBoolToUint,
|
||||
EOpConvDoubleToUint,
|
||||
EOpConvIntToDouble,
|
||||
EOpConvUintToDouble,
|
||||
EOpConvFloatToDouble,
|
||||
EOpConvBoolToDouble,
|
||||
|
||||
//
|
||||
// binary operations
|
||||
@@ -192,6 +206,7 @@ enum TOperator {
|
||||
|
||||
EOpConstructGuardStart,
|
||||
EOpConstructInt,
|
||||
EOpConstructUint,
|
||||
EOpConstructBool,
|
||||
EOpConstructFloat,
|
||||
EOpConstructDouble,
|
||||
@@ -207,6 +222,9 @@ enum TOperator {
|
||||
EOpConstructIVec2,
|
||||
EOpConstructIVec3,
|
||||
EOpConstructIVec4,
|
||||
EOpConstructUVec2,
|
||||
EOpConstructUVec3,
|
||||
EOpConstructUVec4,
|
||||
EOpConstructMat2x2,
|
||||
EOpConstructMat2x3,
|
||||
EOpConstructMat2x4,
|
||||
|
||||
Reference in New Issue
Block a user