Implement the extension GL_ARB_gpu_shader_int64
- Add new keyword int64_t/uint64_t/i64vec/u64vec. - Support 64-bit integer literals (dec/hex/oct). - Support built-in operators for 64-bit integer type. - Add implicit and explicit type conversion for 64-bit integer type. - Add new built-in functions defined in this extension.
This commit is contained in:
parent
010e93fe62
commit
8ff43de891
33 changed files with 5047 additions and 3009 deletions
|
|
@ -194,6 +194,22 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right
|
|||
} else
|
||||
newConstArray[i].setUConst(leftUnionArray[i].getUConst() / rightUnionArray[i].getUConst());
|
||||
break;
|
||||
|
||||
case EbtInt64:
|
||||
if (rightUnionArray[i] == 0)
|
||||
newConstArray[i].setI64Const(0x7FFFFFFFFFFFFFFFll);
|
||||
else if (rightUnionArray[i].getI64Const() == -1 && leftUnionArray[i].getI64Const() == (long long)0x8000000000000000)
|
||||
newConstArray[i].setI64Const(0x8000000000000000);
|
||||
else
|
||||
newConstArray[i].setI64Const(leftUnionArray[i].getI64Const() / rightUnionArray[i].getI64Const());
|
||||
break;
|
||||
|
||||
case EbtUint64:
|
||||
if (rightUnionArray[i] == 0) {
|
||||
newConstArray[i].setU64Const(0xFFFFFFFFFFFFFFFFull);
|
||||
} else
|
||||
newConstArray[i].setU64Const(leftUnionArray[i].getU64Const() / rightUnionArray[i].getU64Const());
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -419,6 +435,8 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
|
|||
case EbtFloat: newConstArray[i].setDConst(-unionArray[i].getDConst()); break;
|
||||
case EbtInt: newConstArray[i].setIConst(-unionArray[i].getIConst()); break;
|
||||
case EbtUint: newConstArray[i].setUConst(static_cast<unsigned int>(-static_cast<int>(unionArray[i].getUConst()))); break;
|
||||
case EbtInt64: newConstArray[i].setI64Const(-unionArray[i].getI64Const()); break;
|
||||
case EbtUint64: newConstArray[i].setU64Const(static_cast<unsigned int>(-static_cast<int>(unionArray[i].getU64Const()))); break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -566,6 +584,8 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
|
|||
case EOpFloatBitsToUint:
|
||||
case EOpIntBitsToFloat:
|
||||
case EOpUintBitsToFloat:
|
||||
case EOpDoubleBitsToInt64:
|
||||
case EOpDoubleBitsToUint64:
|
||||
|
||||
default:
|
||||
return 0;
|
||||
|
|
@ -651,7 +671,10 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
|
|||
|
||||
bool isFloatingPoint = children[0]->getAsTyped()->getBasicType() == EbtFloat ||
|
||||
children[0]->getAsTyped()->getBasicType() == EbtDouble;
|
||||
bool isSigned = children[0]->getAsTyped()->getBasicType() == EbtInt;
|
||||
bool isSigned = children[0]->getAsTyped()->getBasicType() == EbtInt ||
|
||||
children[0]->getAsTyped()->getBasicType() == EbtInt64;
|
||||
bool isInt64 = children[0]->getAsTyped()->getBasicType() == EbtInt64 ||
|
||||
children[0]->getAsTyped()->getBasicType() == EbtUint64;
|
||||
if (componentwise) {
|
||||
for (int comp = 0; comp < objectSize; comp++) {
|
||||
|
||||
|
|
@ -674,29 +697,52 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
|
|||
case EOpMin:
|
||||
if (isFloatingPoint)
|
||||
newConstArray[comp].setDConst(std::min(childConstUnions[0][arg0comp].getDConst(), childConstUnions[1][arg1comp].getDConst()));
|
||||
else if (isSigned)
|
||||
newConstArray[comp].setIConst(std::min(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst()));
|
||||
else
|
||||
newConstArray[comp].setUConst(std::min(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst()));
|
||||
else if (isSigned) {
|
||||
if (isInt64)
|
||||
newConstArray[comp].setI64Const(std::min(childConstUnions[0][arg0comp].getI64Const(), childConstUnions[1][arg1comp].getI64Const()));
|
||||
else
|
||||
newConstArray[comp].setIConst(std::min(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst()));
|
||||
} else {
|
||||
if (isInt64)
|
||||
newConstArray[comp].setU64Const(std::min(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const()));
|
||||
else
|
||||
newConstArray[comp].setUConst(std::min(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst()));
|
||||
}
|
||||
break;
|
||||
case EOpMax:
|
||||
if (isFloatingPoint)
|
||||
newConstArray[comp].setDConst(std::max(childConstUnions[0][arg0comp].getDConst(), childConstUnions[1][arg1comp].getDConst()));
|
||||
else if (isSigned)
|
||||
newConstArray[comp].setIConst(std::max(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst()));
|
||||
else
|
||||
newConstArray[comp].setUConst(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst()));
|
||||
else if (isSigned) {
|
||||
if (isInt64)
|
||||
newConstArray[comp].setI64Const(std::max(childConstUnions[0][arg0comp].getI64Const(), childConstUnions[1][arg1comp].getI64Const()));
|
||||
else
|
||||
newConstArray[comp].setIConst(std::max(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst()));
|
||||
} else {
|
||||
if (isInt64)
|
||||
newConstArray[comp].setU64Const(std::max(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const()));
|
||||
else
|
||||
newConstArray[comp].setUConst(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst()));
|
||||
}
|
||||
break;
|
||||
case EOpClamp:
|
||||
if (isFloatingPoint)
|
||||
newConstArray[comp].setDConst(std::min(std::max(childConstUnions[0][arg0comp].getDConst(), childConstUnions[1][arg1comp].getDConst()),
|
||||
newConstArray[comp].setDConst(std::min(std::max(childConstUnions[0][arg0comp].getDConst(), childConstUnions[1][arg1comp].getDConst()),
|
||||
childConstUnions[2][arg2comp].getDConst()));
|
||||
else if (isSigned)
|
||||
newConstArray[comp].setIConst(std::min(std::max(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst()),
|
||||
childConstUnions[2][arg2comp].getIConst()));
|
||||
else
|
||||
newConstArray[comp].setUConst(std::min(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst()),
|
||||
childConstUnions[2][arg2comp].getUConst()));
|
||||
else if (isSigned) {
|
||||
if (isInt64)
|
||||
newConstArray[comp].setI64Const(std::min(std::max(childConstUnions[0][arg0comp].getI64Const(), childConstUnions[1][arg1comp].getI64Const()),
|
||||
childConstUnions[2][arg2comp].getI64Const()));
|
||||
else
|
||||
newConstArray[comp].setIConst(std::min(std::max(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst()),
|
||||
childConstUnions[2][arg2comp].getIConst()));
|
||||
} else {
|
||||
if (isInt64)
|
||||
newConstArray[comp].setU64Const(std::min(std::max(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const()),
|
||||
childConstUnions[2][arg2comp].getU64Const()));
|
||||
else
|
||||
newConstArray[comp].setUConst(std::min(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst()),
|
||||
childConstUnions[2][arg2comp].getUConst()));
|
||||
}
|
||||
break;
|
||||
case EOpLessThan:
|
||||
newConstArray[comp].setBConst(childConstUnions[0][arg0comp] < childConstUnions[1][arg1comp]);
|
||||
|
|
|
|||
|
|
@ -75,6 +75,8 @@ TBuiltIns::TBuiltIns()
|
|||
prefixes[EbtFloat] = "";
|
||||
prefixes[EbtInt] = "i";
|
||||
prefixes[EbtUint] = "u";
|
||||
prefixes[EbtInt64] = "i64";
|
||||
prefixes[EbtUint64] = "u64";
|
||||
postfixes[2] = "2";
|
||||
postfixes[3] = "3";
|
||||
postfixes[4] = "4";
|
||||
|
|
@ -626,6 +628,145 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
|
|||
"dmat2 inverse(dmat2);"
|
||||
"dmat3 inverse(dmat3);"
|
||||
"dmat4 inverse(dmat4);"
|
||||
|
||||
"\n");
|
||||
}
|
||||
|
||||
if (profile != EEsProfile && version >= 450) {
|
||||
commonBuiltins.append(
|
||||
|
||||
"int64_t abs(int64_t);"
|
||||
"i64vec2 abs(i64vec2);"
|
||||
"i64vec3 abs(i64vec3);"
|
||||
"i64vec4 abs(i64vec4);"
|
||||
|
||||
"int64_t sign(int64_t);"
|
||||
"i64vec2 sign(i64vec2);"
|
||||
"i64vec3 sign(i64vec3);"
|
||||
"i64vec4 sign(i64vec4);"
|
||||
|
||||
"int64_t min(int64_t, int64_t);"
|
||||
"i64vec2 min(i64vec2, int64_t);"
|
||||
"i64vec3 min(i64vec3, int64_t);"
|
||||
"i64vec4 min(i64vec4, int64_t);"
|
||||
"i64vec2 min(i64vec2, i64vec2);"
|
||||
"i64vec3 min(i64vec3, i64vec3);"
|
||||
"i64vec4 min(i64vec4, i64vec4);"
|
||||
"uint64_t min(uint64_t, uint64_t);"
|
||||
"u64vec2 min(u64vec2, uint64_t);"
|
||||
"u64vec3 min(u64vec3, uint64_t);"
|
||||
"u64vec4 min(u64vec4, uint64_t);"
|
||||
"u64vec2 min(u64vec2, u64vec2);"
|
||||
"u64vec3 min(u64vec3, u64vec3);"
|
||||
"u64vec4 min(u64vec4, u64vec4);"
|
||||
|
||||
"int64_t max(int64_t, int64_t);"
|
||||
"i64vec2 max(i64vec2, int64_t);"
|
||||
"i64vec3 max(i64vec3, int64_t);"
|
||||
"i64vec4 max(i64vec4, int64_t);"
|
||||
"i64vec2 max(i64vec2, i64vec2);"
|
||||
"i64vec3 max(i64vec3, i64vec3);"
|
||||
"i64vec4 max(i64vec4, i64vec4);"
|
||||
"uint64_t max(uint64_t, uint64_t);"
|
||||
"u64vec2 max(u64vec2, uint64_t);"
|
||||
"u64vec3 max(u64vec3, uint64_t);"
|
||||
"u64vec4 max(u64vec4, uint64_t);"
|
||||
"u64vec2 max(u64vec2, u64vec2);"
|
||||
"u64vec3 max(u64vec3, u64vec3);"
|
||||
"u64vec4 max(u64vec4, u64vec4);"
|
||||
|
||||
"int64_t clamp(int64_t, int64_t, int64_t);"
|
||||
"i64vec2 clamp(i64vec2, int64_t, int64_t);"
|
||||
"i64vec3 clamp(i64vec3, int64_t, int64_t);"
|
||||
"i64vec4 clamp(i64vec4, int64_t, int64_t);"
|
||||
"i64vec2 clamp(i64vec2, i64vec2, i64vec2);"
|
||||
"i64vec3 clamp(i64vec3, i64vec3, i64vec3);"
|
||||
"i64vec4 clamp(i64vec4, i64vec4, i64vec4);"
|
||||
"uint64_t clamp(uint64_t, uint64_t, uint64_t);"
|
||||
"u64vec2 clamp(u64vec2, uint64_t, uint64_t);"
|
||||
"u64vec3 clamp(u64vec3, uint64_t, uint64_t);"
|
||||
"u64vec4 clamp(u64vec4, uint64_t, uint64_t);"
|
||||
"u64vec2 clamp(u64vec2, u64vec2, u64vec2);"
|
||||
"u64vec3 clamp(u64vec3, u64vec3, u64vec3);"
|
||||
"u64vec4 clamp(u64vec4, u64vec4, u64vec4);"
|
||||
|
||||
"int64_t mix(int64_t, int64_t, bool);"
|
||||
"i64vec2 mix(i64vec2, i64vec2, bvec2);"
|
||||
"i64vec3 mix(i64vec3, i64vec3, bvec3);"
|
||||
"i64vec4 mix(i64vec4, i64vec4, bvec4);"
|
||||
"uint64_t mix(uint64_t, uint64_t, bool);"
|
||||
"u64vec2 mix(u64vec2, u64vec2, bvec2);"
|
||||
"u64vec3 mix(u64vec3, u64vec3, bvec3);"
|
||||
"u64vec4 mix(u64vec4, u64vec4, bvec4);"
|
||||
|
||||
"int64_t doubleBitsToInt64(double);"
|
||||
"i64vec2 doubleBitsToInt64(dvec2);"
|
||||
"i64vec3 doubleBitsToInt64(dvec3);"
|
||||
"i64vec4 doubleBitsToInt64(dvec4);"
|
||||
|
||||
"uint64_t doubleBitsToUint64(double);"
|
||||
"u64vec2 doubleBitsToUint64(dvec2);"
|
||||
"u64vec3 doubleBitsToUint64(dvec3);"
|
||||
"u64vec4 doubleBitsToUint64(dvec4);"
|
||||
|
||||
"double int64BitsToDouble(int64_t);"
|
||||
"dvec2 int64BitsToDouble(i64vec2);"
|
||||
"dvec3 int64BitsToDouble(i64vec3);"
|
||||
"dvec4 int64BitsToDouble(i64vec4);"
|
||||
|
||||
"double uint64BitsToDouble(uint64_t);"
|
||||
"dvec2 uint64BitsToDouble(u64vec2);"
|
||||
"dvec3 uint64BitsToDouble(u64vec3);"
|
||||
"dvec4 uint64BitsToDouble(u64vec4);"
|
||||
|
||||
"int64_t packInt2x32(ivec2);"
|
||||
"uint64_t packUint2x32(uvec2);"
|
||||
"ivec2 unpackInt2x32(int64_t);"
|
||||
"uvec2 unpackUint2x32(uint64_t);"
|
||||
|
||||
"bvec2 lessThan(i64vec2, i64vec2);"
|
||||
"bvec3 lessThan(i64vec3, i64vec3);"
|
||||
"bvec4 lessThan(i64vec4, i64vec4);"
|
||||
"bvec2 lessThan(u64vec2, u64vec2);"
|
||||
"bvec3 lessThan(u64vec3, u64vec3);"
|
||||
"bvec4 lessThan(u64vec4, u64vec4);"
|
||||
|
||||
"bvec2 lessThanEqual(i64vec2, i64vec2);"
|
||||
"bvec3 lessThanEqual(i64vec3, i64vec3);"
|
||||
"bvec4 lessThanEqual(i64vec4, i64vec4);"
|
||||
"bvec2 lessThanEqual(u64vec2, u64vec2);"
|
||||
"bvec3 lessThanEqual(u64vec3, u64vec3);"
|
||||
"bvec4 lessThanEqual(u64vec4, u64vec4);"
|
||||
|
||||
"bvec2 greaterThan(i64vec2, i64vec2);"
|
||||
"bvec3 greaterThan(i64vec3, i64vec3);"
|
||||
"bvec4 greaterThan(i64vec4, i64vec4);"
|
||||
"bvec2 greaterThan(u64vec2, u64vec2);"
|
||||
"bvec3 greaterThan(u64vec3, u64vec3);"
|
||||
"bvec4 greaterThan(u64vec4, u64vec4);"
|
||||
|
||||
"bvec2 greaterThanEqual(i64vec2, i64vec2);"
|
||||
"bvec3 greaterThanEqual(i64vec3, i64vec3);"
|
||||
"bvec4 greaterThanEqual(i64vec4, i64vec4);"
|
||||
"bvec2 greaterThanEqual(u64vec2, u64vec2);"
|
||||
"bvec3 greaterThanEqual(u64vec3, u64vec3);"
|
||||
"bvec4 greaterThanEqual(u64vec4, u64vec4);"
|
||||
|
||||
"bvec2 equal(i64vec2, i64vec2);"
|
||||
"bvec3 equal(i64vec3, i64vec3);"
|
||||
"bvec4 equal(i64vec4, i64vec4);"
|
||||
"bvec2 equal(u64vec2, u64vec2);"
|
||||
"bvec3 equal(u64vec3, u64vec3);"
|
||||
"bvec4 equal(u64vec4, u64vec4);"
|
||||
|
||||
"bvec2 notEqual(i64vec2, i64vec2);"
|
||||
"bvec3 notEqual(i64vec3, i64vec3);"
|
||||
"bvec4 notEqual(i64vec4, i64vec4);"
|
||||
"bvec2 notEqual(u64vec2, u64vec2);"
|
||||
"bvec3 notEqual(u64vec3, u64vec3);"
|
||||
"bvec4 notEqual(u64vec4, u64vec4);"
|
||||
|
||||
"\n"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -3650,6 +3791,10 @@ void IdentifyBuiltIns(int version, EProfile profile, int spv, int vulkan, EShLan
|
|||
symbolTable.relateToOperator("floatBitsToUint", EOpFloatBitsToUint);
|
||||
symbolTable.relateToOperator("intBitsToFloat", EOpIntBitsToFloat);
|
||||
symbolTable.relateToOperator("uintBitsToFloat", EOpUintBitsToFloat);
|
||||
symbolTable.relateToOperator("doubleBitsToInt64", EOpDoubleBitsToInt64);
|
||||
symbolTable.relateToOperator("doubleBitsToUint64", EOpDoubleBitsToUint64);
|
||||
symbolTable.relateToOperator("int64BitsToDouble", EOpInt64BitsToDouble);
|
||||
symbolTable.relateToOperator("uint64BitsToDouble", EOpUint64BitsToDouble);
|
||||
|
||||
symbolTable.relateToOperator("packSnorm2x16", EOpPackSnorm2x16);
|
||||
symbolTable.relateToOperator("unpackSnorm2x16", EOpUnpackSnorm2x16);
|
||||
|
|
@ -3667,6 +3812,11 @@ void IdentifyBuiltIns(int version, EProfile profile, int spv, int vulkan, EShLan
|
|||
symbolTable.relateToOperator("packHalf2x16", EOpPackHalf2x16);
|
||||
symbolTable.relateToOperator("unpackHalf2x16", EOpUnpackHalf2x16);
|
||||
|
||||
symbolTable.relateToOperator("packInt2x32", EOpPackInt2x32);
|
||||
symbolTable.relateToOperator("unpackInt2x32", EOpUnpackInt2x32);
|
||||
symbolTable.relateToOperator("packUint2x32", EOpPackUint2x32);
|
||||
symbolTable.relateToOperator("unpackUint2x32", EOpUnpackUint2x32);
|
||||
|
||||
symbolTable.relateToOperator("length", EOpLength);
|
||||
symbolTable.relateToOperator("distance", EOpDistance);
|
||||
symbolTable.relateToOperator("dot", EOpDot);
|
||||
|
|
|
|||
|
|
@ -247,6 +247,8 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo
|
|||
switch (op) {
|
||||
case EOpConstructInt: newType = EbtInt; break;
|
||||
case EOpConstructUint: newType = EbtUint; break;
|
||||
case EOpConstructInt64: newType = EbtInt64; break;
|
||||
case EOpConstructUint64: newType = EbtUint64; break;
|
||||
case EOpConstructBool: newType = EbtBool; break;
|
||||
case EOpConstructFloat: newType = EbtFloat; break;
|
||||
case EOpConstructDouble: newType = EbtDouble; break;
|
||||
|
|
@ -269,6 +271,8 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo
|
|||
switch (op) {
|
||||
case EOpConstructInt:
|
||||
case EOpConstructUint:
|
||||
case EOpConstructInt64:
|
||||
case EOpConstructUint64:
|
||||
case EOpConstructBool:
|
||||
case EOpConstructFloat:
|
||||
case EOpConstructDouble:
|
||||
|
|
@ -472,6 +476,12 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
|||
case EOpConstructUint:
|
||||
promoteTo = EbtUint;
|
||||
break;
|
||||
case EOpConstructInt64:
|
||||
promoteTo = EbtInt64;
|
||||
break;
|
||||
case EOpConstructUint64:
|
||||
promoteTo = EbtUint64;
|
||||
break;
|
||||
|
||||
//
|
||||
// List all the binary ops that can implicitly convert one operand to the other's type;
|
||||
|
|
@ -498,6 +508,9 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
|||
case EOpAnd:
|
||||
case EOpInclusiveOr:
|
||||
case EOpExclusiveOr:
|
||||
case EOpAndAssign:
|
||||
case EOpInclusiveOrAssign:
|
||||
case EOpExclusiveOrAssign:
|
||||
|
||||
case EOpFunctionCall:
|
||||
case EOpReturn:
|
||||
|
|
@ -531,9 +544,13 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
|||
case EOpLeftShiftAssign:
|
||||
case EOpRightShiftAssign:
|
||||
if ((type.getBasicType() == EbtInt ||
|
||||
type.getBasicType() == EbtUint) &&
|
||||
type.getBasicType() == EbtUint ||
|
||||
type.getBasicType() == EbtInt64 ||
|
||||
type.getBasicType() == EbtUint64) &&
|
||||
(node->getType().getBasicType() == EbtInt ||
|
||||
node->getType().getBasicType() == EbtUint))
|
||||
node->getType().getBasicType() == EbtUint ||
|
||||
node->getType().getBasicType() == EbtInt64 ||
|
||||
node->getType().getBasicType() == EbtUint64))
|
||||
|
||||
return node;
|
||||
else
|
||||
|
|
@ -567,6 +584,8 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
|||
case EbtUint: newOp = EOpConvUintToDouble; break;
|
||||
case EbtBool: newOp = EOpConvBoolToDouble; break;
|
||||
case EbtFloat: newOp = EOpConvFloatToDouble; break;
|
||||
case EbtInt64: newOp = EOpConvInt64ToDouble; break;
|
||||
case EbtUint64: newOp = EOpConvUint64ToDouble; break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -577,6 +596,8 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
|||
case EbtUint: newOp = EOpConvUintToFloat; break;
|
||||
case EbtBool: newOp = EOpConvBoolToFloat; break;
|
||||
case EbtDouble: newOp = EOpConvDoubleToFloat; break;
|
||||
case EbtInt64: newOp = EOpConvInt64ToFloat; break;
|
||||
case EbtUint64: newOp = EOpConvUint64ToFloat; break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -587,6 +608,8 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
|||
case EbtUint: newOp = EOpConvUintToBool; break;
|
||||
case EbtFloat: newOp = EOpConvFloatToBool; break;
|
||||
case EbtDouble: newOp = EOpConvDoubleToBool; break;
|
||||
case EbtInt64: newOp = EOpConvInt64ToBool; break;
|
||||
case EbtUint64: newOp = EOpConvUint64ToBool; break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -597,6 +620,8 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
|||
case EbtBool: newOp = EOpConvBoolToInt; break;
|
||||
case EbtFloat: newOp = EOpConvFloatToInt; break;
|
||||
case EbtDouble: newOp = EOpConvDoubleToInt; break;
|
||||
case EbtInt64: newOp = EOpConvInt64ToInt; break;
|
||||
case EbtUint64: newOp = EOpConvUint64ToInt; break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -607,6 +632,32 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
|||
case EbtBool: newOp = EOpConvBoolToUint; break;
|
||||
case EbtFloat: newOp = EOpConvFloatToUint; break;
|
||||
case EbtDouble: newOp = EOpConvDoubleToUint; break;
|
||||
case EbtInt64: newOp = EOpConvInt64ToUint; break;
|
||||
case EbtUint64: newOp = EOpConvUint64ToUint; break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case EbtInt64:
|
||||
switch (node->getBasicType()) {
|
||||
case EbtInt: newOp = EOpConvIntToInt64; break;
|
||||
case EbtUint: newOp = EOpConvUintToInt64; break;
|
||||
case EbtBool: newOp = EOpConvBoolToInt64; break;
|
||||
case EbtFloat: newOp = EOpConvFloatToInt64; break;
|
||||
case EbtDouble: newOp = EOpConvDoubleToInt64; break;
|
||||
case EbtUint64: newOp = EOpConvUint64ToInt64; break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case EbtUint64:
|
||||
switch (node->getBasicType()) {
|
||||
case EbtInt: newOp = EOpConvIntToUint64; break;
|
||||
case EbtUint: newOp = EOpConvUintToUint64; break;
|
||||
case EbtBool: newOp = EOpConvBoolToUint64; break;
|
||||
case EbtFloat: newOp = EOpConvFloatToUint64; break;
|
||||
case EbtDouble: newOp = EOpConvDoubleToUint64; break;
|
||||
case EbtInt64: newOp = EOpConvInt64ToUint64; break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -643,6 +694,8 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to) const
|
|||
switch (from) {
|
||||
case EbtInt:
|
||||
case EbtUint:
|
||||
case EbtInt64:
|
||||
case EbtUint64:
|
||||
case EbtFloat:
|
||||
case EbtDouble:
|
||||
return true;
|
||||
|
|
@ -674,6 +727,24 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to) const
|
|||
default:
|
||||
return false;
|
||||
}
|
||||
case EbtUint64:
|
||||
switch (from) {
|
||||
case EbtInt:
|
||||
case EbtUint:
|
||||
case EbtInt64:
|
||||
case EbtUint64:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
case EbtInt64:
|
||||
switch (from) {
|
||||
case EbtInt:
|
||||
case EbtInt64:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
@ -873,6 +944,22 @@ TIntermConstantUnion* TIntermediate::addConstantUnion(unsigned int u, const TSou
|
|||
return addConstantUnion(unionArray, TType(EbtUint, EvqConst), loc, literal);
|
||||
}
|
||||
|
||||
TIntermConstantUnion* TIntermediate::addConstantUnion(long long i64, const TSourceLoc& loc, bool literal) const
|
||||
{
|
||||
TConstUnionArray unionArray(1);
|
||||
unionArray[0].setI64Const(i64);
|
||||
|
||||
return addConstantUnion(unionArray, TType(EbtInt64, EvqConst), loc, literal);
|
||||
}
|
||||
|
||||
TIntermConstantUnion* TIntermediate::addConstantUnion(unsigned long long u64, const TSourceLoc& loc, bool literal) const
|
||||
{
|
||||
TConstUnionArray unionArray(1);
|
||||
unionArray[0].setU64Const(u64);
|
||||
|
||||
return addConstantUnion(unionArray, TType(EbtUint64, EvqConst), loc, literal);
|
||||
}
|
||||
|
||||
TIntermConstantUnion* TIntermediate::addConstantUnion(bool b, const TSourceLoc& loc, bool literal) const
|
||||
{
|
||||
TConstUnionArray unionArray(1);
|
||||
|
|
@ -1212,7 +1299,9 @@ bool TIntermUnary::promote()
|
|||
break;
|
||||
case EOpBitwiseNot:
|
||||
if (operand->getBasicType() != EbtInt &&
|
||||
operand->getBasicType() != EbtUint)
|
||||
operand->getBasicType() != EbtUint &&
|
||||
operand->getBasicType() != EbtInt64 &&
|
||||
operand->getBasicType() != EbtUint64)
|
||||
|
||||
return false;
|
||||
break;
|
||||
|
|
@ -1223,6 +1312,8 @@ bool TIntermUnary::promote()
|
|||
case EOpPreDecrement:
|
||||
if (operand->getBasicType() != EbtInt &&
|
||||
operand->getBasicType() != EbtUint &&
|
||||
operand->getBasicType() != EbtInt64 &&
|
||||
operand->getBasicType() != EbtUint64 &&
|
||||
operand->getBasicType() != EbtFloat &&
|
||||
operand->getBasicType() != EbtDouble)
|
||||
|
||||
|
|
@ -1340,8 +1431,10 @@ bool TIntermBinary::promote()
|
|||
case EOpInclusiveOrAssign:
|
||||
case EOpExclusiveOrAssign:
|
||||
// Check for integer-only operands.
|
||||
if (( left->getBasicType() != EbtInt && left->getBasicType() != EbtUint) ||
|
||||
(right->getBasicType() != EbtInt && right->getBasicType() != EbtUint))
|
||||
if ((left->getBasicType() != EbtInt && left->getBasicType() != EbtUint &&
|
||||
left->getBasicType() != EbtInt64 && left->getBasicType() != EbtUint64) ||
|
||||
(right->getBasicType() != EbtInt && right->getBasicType() != EbtUint &&
|
||||
right->getBasicType() != EbtInt64 && right->getBasicType() != EbtUint64))
|
||||
return false;
|
||||
if (left->isMatrix() || right->isMatrix())
|
||||
return false;
|
||||
|
|
@ -1643,6 +1736,12 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
|
|||
case EbtUint:
|
||||
leftUnionArray[i].setDConst(static_cast<double>(rightUnionArray[i].getUConst()));
|
||||
break;
|
||||
case EbtInt64:
|
||||
leftUnionArray[i].setDConst(static_cast<double>(rightUnionArray[i].getI64Const()));
|
||||
break;
|
||||
case EbtUint64:
|
||||
leftUnionArray[i].setDConst(static_cast<double>(rightUnionArray[i].getU64Const()));
|
||||
break;
|
||||
case EbtBool:
|
||||
leftUnionArray[i].setDConst(static_cast<double>(rightUnionArray[i].getBConst()));
|
||||
break;
|
||||
|
|
@ -1664,6 +1763,12 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
|
|||
case EbtUint:
|
||||
leftUnionArray[i].setDConst(static_cast<double>(rightUnionArray[i].getUConst()));
|
||||
break;
|
||||
case EbtInt64:
|
||||
leftUnionArray[i].setDConst(static_cast<double>(rightUnionArray[i].getI64Const()));
|
||||
break;
|
||||
case EbtUint64:
|
||||
leftUnionArray[i].setDConst(static_cast<double>(rightUnionArray[i].getU64Const()));
|
||||
break;
|
||||
case EbtBool:
|
||||
leftUnionArray[i].setDConst(static_cast<double>(rightUnionArray[i].getBConst()));
|
||||
break;
|
||||
|
|
@ -1683,6 +1788,12 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
|
|||
case EbtUint:
|
||||
leftUnionArray[i].setIConst(static_cast<int>(rightUnionArray[i].getUConst()));
|
||||
break;
|
||||
case EbtInt64:
|
||||
leftUnionArray[i].setIConst(static_cast<int>(rightUnionArray[i].getI64Const()));
|
||||
break;
|
||||
case EbtUint64:
|
||||
leftUnionArray[i].setIConst(static_cast<int>(rightUnionArray[i].getU64Const()));
|
||||
break;
|
||||
case EbtBool:
|
||||
leftUnionArray[i].setIConst(static_cast<int>(rightUnionArray[i].getBConst()));
|
||||
break;
|
||||
|
|
@ -1702,6 +1813,12 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
|
|||
case EbtUint:
|
||||
leftUnionArray[i] = rightUnionArray[i];
|
||||
break;
|
||||
case EbtInt64:
|
||||
leftUnionArray[i].setUConst(static_cast<unsigned int>(rightUnionArray[i].getI64Const()));
|
||||
break;
|
||||
case EbtUint64:
|
||||
leftUnionArray[i].setUConst(static_cast<unsigned int>(rightUnionArray[i].getU64Const()));
|
||||
break;
|
||||
case EbtBool:
|
||||
leftUnionArray[i].setUConst(static_cast<unsigned int>(rightUnionArray[i].getBConst()));
|
||||
break;
|
||||
|
|
@ -1721,6 +1838,12 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
|
|||
case EbtUint:
|
||||
leftUnionArray[i].setBConst(rightUnionArray[i].getUConst() != 0);
|
||||
break;
|
||||
case EbtInt64:
|
||||
leftUnionArray[i].setBConst(rightUnionArray[i].getI64Const() != 0);
|
||||
break;
|
||||
case EbtUint64:
|
||||
leftUnionArray[i].setBConst(rightUnionArray[i].getU64Const() != 0);
|
||||
break;
|
||||
case EbtBool:
|
||||
leftUnionArray[i] = rightUnionArray[i];
|
||||
break;
|
||||
|
|
@ -1732,6 +1855,56 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
|
|||
return node;
|
||||
}
|
||||
break;
|
||||
case EbtInt64:
|
||||
switch (node->getType().getBasicType()) {
|
||||
case EbtInt:
|
||||
leftUnionArray[i].setI64Const(static_cast<long long>(rightUnionArray[i].getIConst()));
|
||||
break;
|
||||
case EbtUint:
|
||||
leftUnionArray[i].setI64Const(static_cast<long long>(rightUnionArray[i].getUConst()));
|
||||
break;
|
||||
case EbtInt64:
|
||||
leftUnionArray[i] = rightUnionArray[i];
|
||||
break;
|
||||
case EbtUint64:
|
||||
leftUnionArray[i].setI64Const(static_cast<long long>(rightUnionArray[i].getU64Const()));
|
||||
break;
|
||||
case EbtBool:
|
||||
leftUnionArray[i].setI64Const(static_cast<long long>(rightUnionArray[i].getBConst()));
|
||||
break;
|
||||
case EbtFloat:
|
||||
case EbtDouble:
|
||||
leftUnionArray[i].setI64Const(static_cast<long long>(rightUnionArray[i].getDConst()));
|
||||
break;
|
||||
default:
|
||||
return node;
|
||||
}
|
||||
break;
|
||||
case EbtUint64:
|
||||
switch (node->getType().getBasicType()) {
|
||||
case EbtInt:
|
||||
leftUnionArray[i].setU64Const(static_cast<unsigned long long>(rightUnionArray[i].getIConst()));
|
||||
break;
|
||||
case EbtUint:
|
||||
leftUnionArray[i].setU64Const(static_cast<unsigned long long>(rightUnionArray[i].getUConst()));
|
||||
break;
|
||||
case EbtInt64:
|
||||
leftUnionArray[i].setU64Const(static_cast<unsigned long long>(rightUnionArray[i].getI64Const()));
|
||||
break;
|
||||
case EbtUint64:
|
||||
leftUnionArray[i] = rightUnionArray[i];
|
||||
break;
|
||||
case EbtBool:
|
||||
leftUnionArray[i].setU64Const(static_cast<unsigned long long>(rightUnionArray[i].getBConst()));
|
||||
break;
|
||||
case EbtFloat:
|
||||
case EbtDouble:
|
||||
leftUnionArray[i].setU64Const(static_cast<unsigned long long>(rightUnionArray[i].getDConst()));
|
||||
break;
|
||||
default:
|
||||
return node;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return node;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1812,6 +1812,24 @@ TOperator TParseContext::mapTypeToConstructorOp(const TType& type) const
|
|||
default: break; // some compilers want this
|
||||
}
|
||||
break;
|
||||
case EbtInt64:
|
||||
switch(type.getVectorSize()) {
|
||||
case 1: op = EOpConstructInt64; break;
|
||||
case 2: op = EOpConstructI64Vec2; break;
|
||||
case 3: op = EOpConstructI64Vec3; break;
|
||||
case 4: op = EOpConstructI64Vec4; break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
break;
|
||||
case EbtUint64:
|
||||
switch(type.getVectorSize()) {
|
||||
case 1: op = EOpConstructUint64; break;
|
||||
case 2: op = EOpConstructU64Vec2; break;
|
||||
case 3: op = EOpConstructU64Vec3; break;
|
||||
case 4: op = EOpConstructU64Vec4; break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
break;
|
||||
case EbtBool:
|
||||
switch(type.getVectorSize()) {
|
||||
case 1: op = EOpConstructBool; break;
|
||||
|
|
@ -2534,13 +2552,19 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali
|
|||
return;
|
||||
}
|
||||
|
||||
if (publicType.basicType == EbtInt || publicType.basicType == EbtUint || publicType.basicType == EbtDouble)
|
||||
if (publicType.basicType == EbtInt || publicType.basicType == EbtUint ||
|
||||
publicType.basicType == EbtInt64 || publicType.basicType == EbtUint64 ||
|
||||
publicType.basicType == EbtDouble)
|
||||
profileRequires(loc, EEsProfile, 300, nullptr, "shader input/output");
|
||||
|
||||
if (! qualifier.flat) {
|
||||
if (publicType.basicType == EbtInt || publicType.basicType == EbtUint || publicType.basicType == EbtDouble ||
|
||||
(publicType.userDef && (publicType.userDef->containsBasicType(EbtInt) ||
|
||||
publicType.userDef->containsBasicType(EbtUint) ||
|
||||
if (publicType.basicType == EbtInt || publicType.basicType == EbtUint ||
|
||||
publicType.basicType == EbtInt64 || publicType.basicType == EbtUint64 ||
|
||||
publicType.basicType == EbtDouble ||
|
||||
(publicType.userDef && (publicType.userDef->containsBasicType(EbtInt) ||
|
||||
publicType.userDef->containsBasicType(EbtUint) ||
|
||||
publicType.userDef->containsBasicType(EbtInt64) ||
|
||||
publicType.userDef->containsBasicType(EbtUint64) ||
|
||||
publicType.userDef->containsBasicType(EbtDouble)))) {
|
||||
if (qualifier.storage == EvqVaryingIn && language == EShLangFragment)
|
||||
error(loc, "must be qualified as flat", TType::getBasicString(publicType.basicType), GetStorageQualifierString(qualifier.storage));
|
||||
|
|
@ -4415,6 +4439,8 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
|
|||
{
|
||||
case EbtInt:
|
||||
case EbtUint:
|
||||
case EbtInt64:
|
||||
case EbtUint64:
|
||||
case EbtBool:
|
||||
case EbtFloat:
|
||||
case EbtDouble:
|
||||
|
|
@ -5226,6 +5252,20 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
|
|||
basicOp = EOpConstructUint;
|
||||
break;
|
||||
|
||||
case EOpConstructI64Vec2:
|
||||
case EOpConstructI64Vec3:
|
||||
case EOpConstructI64Vec4:
|
||||
case EOpConstructInt64:
|
||||
basicOp = EOpConstructInt64;
|
||||
break;
|
||||
|
||||
case EOpConstructU64Vec2:
|
||||
case EOpConstructU64Vec3:
|
||||
case EOpConstructU64Vec4:
|
||||
case EOpConstructUint64:
|
||||
basicOp = EOpConstructUint64;
|
||||
break;
|
||||
|
||||
case EOpConstructBVec2:
|
||||
case EOpConstructBVec3:
|
||||
case EOpConstructBVec4:
|
||||
|
|
|
|||
|
|
@ -454,6 +454,15 @@ void TScanContext::fillInKeywordMap()
|
|||
(*KeywordMap)["uvec3"] = UVEC3;
|
||||
(*KeywordMap)["uvec4"] = UVEC4;
|
||||
|
||||
(*KeywordMap)["int64_t"] = INT64_T;
|
||||
(*KeywordMap)["uint64_t"] = UINT64_T;
|
||||
(*KeywordMap)["i64vec2"] = I64VEC2;
|
||||
(*KeywordMap)["i64vec3"] = I64VEC3;
|
||||
(*KeywordMap)["i64vec4"] = I64VEC4;
|
||||
(*KeywordMap)["u64vec2"] = U64VEC2;
|
||||
(*KeywordMap)["u64vec3"] = U64VEC3;
|
||||
(*KeywordMap)["u64vec4"] = U64VEC4;
|
||||
|
||||
(*KeywordMap)["sampler2D"] = SAMPLER2D;
|
||||
(*KeywordMap)["samplerCube"] = SAMPLERCUBE;
|
||||
(*KeywordMap)["samplerCubeArray"] = SAMPLERCUBEARRAY;
|
||||
|
|
@ -667,10 +676,12 @@ int TScanContext::tokenize(TPpContext* pp, TParserToken& token)
|
|||
case PpAtomDecrement: return DEC_OP;
|
||||
case PpAtomIncrement: return INC_OP;
|
||||
|
||||
case PpAtomConstInt: parserToken->sType.lex.i = ppToken.ival; return INTCONSTANT;
|
||||
case PpAtomConstUint: parserToken->sType.lex.i = ppToken.ival; return UINTCONSTANT;
|
||||
case PpAtomConstFloat: parserToken->sType.lex.d = ppToken.dval; return FLOATCONSTANT;
|
||||
case PpAtomConstDouble: parserToken->sType.lex.d = ppToken.dval; return DOUBLECONSTANT;
|
||||
case PpAtomConstInt: parserToken->sType.lex.i = ppToken.ival; return INTCONSTANT;
|
||||
case PpAtomConstUint: parserToken->sType.lex.i = ppToken.ival; return UINTCONSTANT;
|
||||
case PpAtomConstInt64: parserToken->sType.lex.i64 = ppToken.i64val; return INT64CONSTANT;
|
||||
case PpAtomConstUint64: parserToken->sType.lex.i64 = ppToken.i64val; return UINT64CONSTANT;
|
||||
case PpAtomConstFloat: parserToken->sType.lex.d = ppToken.dval; return FLOATCONSTANT;
|
||||
case PpAtomConstDouble: parserToken->sType.lex.d = ppToken.dval; return DOUBLECONSTANT;
|
||||
case PpAtomIdentifier:
|
||||
{
|
||||
int token = tokenizeIdentifier();
|
||||
|
|
@ -914,6 +925,18 @@ int TScanContext::tokenizeIdentifier()
|
|||
reservedWord();
|
||||
return keyword;
|
||||
|
||||
case INT64_T:
|
||||
case UINT64_T:
|
||||
case I64VEC2:
|
||||
case I64VEC3:
|
||||
case I64VEC4:
|
||||
case U64VEC2:
|
||||
case U64VEC3:
|
||||
case U64VEC4:
|
||||
if (parseContext.profile != EEsProfile && parseContext.version >= 450)
|
||||
return keyword;
|
||||
return identifierOrType();
|
||||
|
||||
case SAMPLERCUBEARRAY:
|
||||
case SAMPLERCUBEARRAYSHADOW:
|
||||
case ISAMPLERCUBEARRAY:
|
||||
|
|
|
|||
|
|
@ -62,6 +62,8 @@ void TType::buildMangledName(TString& mangledName)
|
|||
case EbtDouble: mangledName += 'd'; break;
|
||||
case EbtInt: mangledName += 'i'; break;
|
||||
case EbtUint: mangledName += 'u'; break;
|
||||
case EbtInt64: mangledName += "i64"; break;
|
||||
case EbtUint64: mangledName += "u64"; break;
|
||||
case EbtBool: mangledName += 'b'; break;
|
||||
case EbtAtomicUint: mangledName += "au"; break;
|
||||
case EbtSampler:
|
||||
|
|
|
|||
|
|
@ -174,6 +174,7 @@ void TParseVersions::initializeExtensionBehavior()
|
|||
extensionBehavior[E_GL_ARB_derivative_control] = EBhDisable;
|
||||
extensionBehavior[E_GL_ARB_shader_texture_image_samples] = EBhDisable;
|
||||
extensionBehavior[E_GL_ARB_viewport_array] = EBhDisable;
|
||||
extensionBehavior[E_GL_ARB_gpu_shader_int64] = EBhDisable;
|
||||
extensionBehavior[E_GL_ARB_gl_spirv] = EBhDisable;
|
||||
extensionBehavior[E_GL_ARB_sparse_texture2] = EBhDisable;
|
||||
extensionBehavior[E_GL_ARB_sparse_texture_clamp] = EBhDisable;
|
||||
|
|
@ -278,6 +279,7 @@ const char* TParseVersions::getPreamble()
|
|||
"#define GL_ARB_derivative_control 1\n"
|
||||
"#define GL_ARB_shader_texture_image_samples 1\n"
|
||||
"#define GL_ARB_viewport_array 1\n"
|
||||
"#define GL_ARB_gpu_shader_int64 1\n"
|
||||
"#define GL_ARB_gl_spirv 1\n"
|
||||
"#define GL_ARB_sparse_texture2 1\n"
|
||||
"#define GL_ARB_sparse_texture_clamp 1\n"
|
||||
|
|
@ -627,6 +629,17 @@ void TParseVersions::doubleCheck(const TSourceLoc& loc, const char* op)
|
|||
profileRequires(loc, ECompatibilityProfile, 400, nullptr, op);
|
||||
}
|
||||
|
||||
// Call for any operation needing GLSL 64-bit integer data-type support.
|
||||
void TParseVersions::int64Check(const TSourceLoc& loc, const char* op, bool builtIn)
|
||||
{
|
||||
if (! builtIn) {
|
||||
requireExtensions(loc, 1, &E_GL_ARB_gpu_shader_int64, "shader int64");
|
||||
requireProfile(loc, ECoreProfile | ECompatibilityProfile, op);
|
||||
profileRequires(loc, ECoreProfile, 450, nullptr, op);
|
||||
profileRequires(loc, ECompatibilityProfile, 450, nullptr, op);
|
||||
}
|
||||
}
|
||||
|
||||
// Call for any operation removed because SPIR-V is in use.
|
||||
void TParseVersions::spvRemoved(const TSourceLoc& loc, const char* op)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -111,6 +111,7 @@ const char* const E_GL_ARB_shader_draw_parameters = "GL_ARB_shader_draw_pa
|
|||
const char* const E_GL_ARB_derivative_control = "GL_ARB_derivative_control";
|
||||
const char* const E_GL_ARB_shader_texture_image_samples = "GL_ARB_shader_texture_image_samples";
|
||||
const char* const E_GL_ARB_viewport_array = "GL_ARB_viewport_array";
|
||||
const char* const E_GL_ARB_gpu_shader_int64 = "GL_ARB_gpu_shader_int64";
|
||||
const char* const E_GL_ARB_gl_spirv = "GL_ARB_gl_spirv";
|
||||
const char* const E_GL_ARB_sparse_texture2 = "GL_ARB_sparse_texture2";
|
||||
const char* const E_GL_ARB_sparse_texture_clamp = "GL_ARB_sparse_texture_clamp";
|
||||
|
|
|
|||
|
|
@ -41,6 +41,16 @@
|
|||
#define GL_UNSIGNED_INT_VEC3 0x8DC7
|
||||
#define GL_UNSIGNED_INT_VEC4 0x8DC8
|
||||
|
||||
#define GL_INT64_ARB 0x140E
|
||||
#define GL_INT64_VEC2_ARB 0x8FE9
|
||||
#define GL_INT64_VEC3_ARB 0x8FEA
|
||||
#define GL_INT64_VEC4_ARB 0x8FEB
|
||||
|
||||
#define GL_UNSIGNED_INT64_ARB 0x140F
|
||||
#define GL_UNSIGNED_INT64_VEC2_ARB 0x8FE5
|
||||
#define GL_UNSIGNED_INT64_VEC3_ARB 0x8FE6
|
||||
#define GL_UNSIGNED_INT64_VEC4_ARB 0x8FE7
|
||||
|
||||
#define GL_BOOL 0x8B56
|
||||
#define GL_BOOL_VEC2 0x8B57
|
||||
#define GL_BOOL_VEC3 0x8B58
|
||||
|
|
|
|||
|
|
@ -70,6 +70,8 @@ using namespace glslang;
|
|||
glslang::TString *string;
|
||||
int i;
|
||||
unsigned int u;
|
||||
long long i64;
|
||||
unsigned long long u64;
|
||||
bool b;
|
||||
double d;
|
||||
};
|
||||
|
|
@ -117,9 +119,9 @@ extern int yylex(YYSTYPE*, TParseContext&);
|
|||
%expect 1 // One shift reduce conflict because of if | else
|
||||
|
||||
%token <lex> ATTRIBUTE VARYING
|
||||
%token <lex> CONST BOOL FLOAT DOUBLE INT UINT
|
||||
%token <lex> CONST BOOL FLOAT DOUBLE INT UINT INT64_T UINT64_T
|
||||
%token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT SUBROUTINE
|
||||
%token <lex> BVEC2 BVEC3 BVEC4 IVEC2 IVEC3 IVEC4 UVEC2 UVEC3 UVEC4 VEC2 VEC3 VEC4
|
||||
%token <lex> BVEC2 BVEC3 BVEC4 IVEC2 IVEC3 IVEC4 I64VEC2 I64VEC3 I64VEC4 UVEC2 UVEC3 UVEC4 U64VEC2 U64VEC3 U64VEC4 VEC2 VEC3 VEC4
|
||||
%token <lex> MAT2 MAT3 MAT4 CENTROID IN OUT INOUT
|
||||
%token <lex> UNIFORM PATCH SAMPLE BUFFER SHARED
|
||||
%token <lex> COHERENT VOLATILE RESTRICT READONLY WRITEONLY
|
||||
|
|
@ -180,7 +182,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
|
|||
%token <lex> STRUCT VOID WHILE
|
||||
|
||||
%token <lex> IDENTIFIER TYPE_NAME
|
||||
%token <lex> FLOATCONSTANT DOUBLECONSTANT INTCONSTANT UINTCONSTANT BOOLCONSTANT
|
||||
%token <lex> FLOATCONSTANT DOUBLECONSTANT INTCONSTANT UINTCONSTANT INT64CONSTANT UINT64CONSTANT BOOLCONSTANT
|
||||
%token <lex> LEFT_OP RIGHT_OP
|
||||
%token <lex> INC_OP DEC_OP LE_OP GE_OP EQ_OP NE_OP
|
||||
%token <lex> AND_OP OR_OP XOR_OP MUL_ASSIGN DIV_ASSIGN ADD_ASSIGN
|
||||
|
|
@ -257,6 +259,14 @@ primary_expression
|
|||
parseContext.fullIntegerCheck($1.loc, "unsigned literal");
|
||||
$$ = parseContext.intermediate.addConstantUnion($1.u, $1.loc, true);
|
||||
}
|
||||
| INT64CONSTANT {
|
||||
parseContext.int64Check($1.loc, "64-bit integer literal");
|
||||
$$ = parseContext.intermediate.addConstantUnion($1.i64, $1.loc, true);
|
||||
}
|
||||
| UINT64CONSTANT {
|
||||
parseContext.int64Check($1.loc, "64-bit unsigned integer literal");
|
||||
$$ = parseContext.intermediate.addConstantUnion($1.u64, $1.loc, true);
|
||||
}
|
||||
| FLOATCONSTANT {
|
||||
$$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat, $1.loc, true);
|
||||
}
|
||||
|
|
@ -1309,6 +1319,16 @@ type_specifier_nonarray
|
|||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtUint;
|
||||
}
|
||||
| INT64_T {
|
||||
parseContext.int64Check($1.loc, "64-bit integer", parseContext.symbolTable.atBuiltInLevel());
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtInt64;
|
||||
}
|
||||
| UINT64_T {
|
||||
parseContext.int64Check($1.loc, "64-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel());
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtUint64;
|
||||
}
|
||||
| BOOL {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtBool;
|
||||
|
|
@ -1376,6 +1396,24 @@ type_specifier_nonarray
|
|||
$$.basicType = EbtInt;
|
||||
$$.setVector(4);
|
||||
}
|
||||
| I64VEC2 {
|
||||
parseContext.int64Check($1.loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel());
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtInt64;
|
||||
$$.setVector(2);
|
||||
}
|
||||
| I64VEC3 {
|
||||
parseContext.int64Check($1.loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel());
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtInt64;
|
||||
$$.setVector(3);
|
||||
}
|
||||
| I64VEC4 {
|
||||
parseContext.int64Check($1.loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel());
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtInt64;
|
||||
$$.setVector(4);
|
||||
}
|
||||
| UVEC2 {
|
||||
parseContext.fullIntegerCheck($1.loc, "unsigned integer vector");
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
|
|
@ -1394,6 +1432,24 @@ type_specifier_nonarray
|
|||
$$.basicType = EbtUint;
|
||||
$$.setVector(4);
|
||||
}
|
||||
| U64VEC2 {
|
||||
parseContext.int64Check($1.loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtUint64;
|
||||
$$.setVector(2);
|
||||
}
|
||||
| U64VEC3 {
|
||||
parseContext.int64Check($1.loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtUint64;
|
||||
$$.setVector(3);
|
||||
}
|
||||
| U64VEC4 {
|
||||
parseContext.int64Check($1.loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtUint64;
|
||||
$$.setVector(4);
|
||||
}
|
||||
| MAT2 {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtFloat;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -30,8 +30,8 @@
|
|||
This special exception was added by the Free Software Foundation in
|
||||
version 2.2 of Bison. */
|
||||
|
||||
#ifndef YY_YY_C_PROJECTS_GLSLANG_GLSLANG_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED
|
||||
# define YY_YY_C_PROJECTS_GLSLANG_GLSLANG_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED
|
||||
#ifndef YY_YY_GLSLANG_TAB_CPP_H_INCLUDED
|
||||
# define YY_YY_GLSLANG_TAB_CPP_H_INCLUDED
|
||||
/* Enabling traces. */
|
||||
#ifndef YYDEBUG
|
||||
# define YYDEBUG 1
|
||||
|
|
@ -54,255 +54,265 @@ extern int yydebug;
|
|||
DOUBLE = 263,
|
||||
INT = 264,
|
||||
UINT = 265,
|
||||
BREAK = 266,
|
||||
CONTINUE = 267,
|
||||
DO = 268,
|
||||
ELSE = 269,
|
||||
FOR = 270,
|
||||
IF = 271,
|
||||
DISCARD = 272,
|
||||
RETURN = 273,
|
||||
SWITCH = 274,
|
||||
CASE = 275,
|
||||
DEFAULT = 276,
|
||||
SUBROUTINE = 277,
|
||||
BVEC2 = 278,
|
||||
BVEC3 = 279,
|
||||
BVEC4 = 280,
|
||||
IVEC2 = 281,
|
||||
IVEC3 = 282,
|
||||
IVEC4 = 283,
|
||||
UVEC2 = 284,
|
||||
UVEC3 = 285,
|
||||
UVEC4 = 286,
|
||||
VEC2 = 287,
|
||||
VEC3 = 288,
|
||||
VEC4 = 289,
|
||||
MAT2 = 290,
|
||||
MAT3 = 291,
|
||||
MAT4 = 292,
|
||||
CENTROID = 293,
|
||||
IN = 294,
|
||||
OUT = 295,
|
||||
INOUT = 296,
|
||||
UNIFORM = 297,
|
||||
PATCH = 298,
|
||||
SAMPLE = 299,
|
||||
BUFFER = 300,
|
||||
SHARED = 301,
|
||||
COHERENT = 302,
|
||||
VOLATILE = 303,
|
||||
RESTRICT = 304,
|
||||
READONLY = 305,
|
||||
WRITEONLY = 306,
|
||||
DVEC2 = 307,
|
||||
DVEC3 = 308,
|
||||
DVEC4 = 309,
|
||||
DMAT2 = 310,
|
||||
DMAT3 = 311,
|
||||
DMAT4 = 312,
|
||||
NOPERSPECTIVE = 313,
|
||||
FLAT = 314,
|
||||
SMOOTH = 315,
|
||||
LAYOUT = 316,
|
||||
MAT2X2 = 317,
|
||||
MAT2X3 = 318,
|
||||
MAT2X4 = 319,
|
||||
MAT3X2 = 320,
|
||||
MAT3X3 = 321,
|
||||
MAT3X4 = 322,
|
||||
MAT4X2 = 323,
|
||||
MAT4X3 = 324,
|
||||
MAT4X4 = 325,
|
||||
DMAT2X2 = 326,
|
||||
DMAT2X3 = 327,
|
||||
DMAT2X4 = 328,
|
||||
DMAT3X2 = 329,
|
||||
DMAT3X3 = 330,
|
||||
DMAT3X4 = 331,
|
||||
DMAT4X2 = 332,
|
||||
DMAT4X3 = 333,
|
||||
DMAT4X4 = 334,
|
||||
ATOMIC_UINT = 335,
|
||||
SAMPLER1D = 336,
|
||||
SAMPLER2D = 337,
|
||||
SAMPLER3D = 338,
|
||||
SAMPLERCUBE = 339,
|
||||
SAMPLER1DSHADOW = 340,
|
||||
SAMPLER2DSHADOW = 341,
|
||||
SAMPLERCUBESHADOW = 342,
|
||||
SAMPLER1DARRAY = 343,
|
||||
SAMPLER2DARRAY = 344,
|
||||
SAMPLER1DARRAYSHADOW = 345,
|
||||
SAMPLER2DARRAYSHADOW = 346,
|
||||
ISAMPLER1D = 347,
|
||||
ISAMPLER2D = 348,
|
||||
ISAMPLER3D = 349,
|
||||
ISAMPLERCUBE = 350,
|
||||
ISAMPLER1DARRAY = 351,
|
||||
ISAMPLER2DARRAY = 352,
|
||||
USAMPLER1D = 353,
|
||||
USAMPLER2D = 354,
|
||||
USAMPLER3D = 355,
|
||||
USAMPLERCUBE = 356,
|
||||
USAMPLER1DARRAY = 357,
|
||||
USAMPLER2DARRAY = 358,
|
||||
SAMPLER2DRECT = 359,
|
||||
SAMPLER2DRECTSHADOW = 360,
|
||||
ISAMPLER2DRECT = 361,
|
||||
USAMPLER2DRECT = 362,
|
||||
SAMPLERBUFFER = 363,
|
||||
ISAMPLERBUFFER = 364,
|
||||
USAMPLERBUFFER = 365,
|
||||
SAMPLERCUBEARRAY = 366,
|
||||
SAMPLERCUBEARRAYSHADOW = 367,
|
||||
ISAMPLERCUBEARRAY = 368,
|
||||
USAMPLERCUBEARRAY = 369,
|
||||
SAMPLER2DMS = 370,
|
||||
ISAMPLER2DMS = 371,
|
||||
USAMPLER2DMS = 372,
|
||||
SAMPLER2DMSARRAY = 373,
|
||||
ISAMPLER2DMSARRAY = 374,
|
||||
USAMPLER2DMSARRAY = 375,
|
||||
SAMPLEREXTERNALOES = 376,
|
||||
SAMPLER = 377,
|
||||
SAMPLERSHADOW = 378,
|
||||
TEXTURE1D = 379,
|
||||
TEXTURE2D = 380,
|
||||
TEXTURE3D = 381,
|
||||
TEXTURECUBE = 382,
|
||||
TEXTURE1DARRAY = 383,
|
||||
TEXTURE2DARRAY = 384,
|
||||
ITEXTURE1D = 385,
|
||||
ITEXTURE2D = 386,
|
||||
ITEXTURE3D = 387,
|
||||
ITEXTURECUBE = 388,
|
||||
ITEXTURE1DARRAY = 389,
|
||||
ITEXTURE2DARRAY = 390,
|
||||
UTEXTURE1D = 391,
|
||||
UTEXTURE2D = 392,
|
||||
UTEXTURE3D = 393,
|
||||
UTEXTURECUBE = 394,
|
||||
UTEXTURE1DARRAY = 395,
|
||||
UTEXTURE2DARRAY = 396,
|
||||
TEXTURE2DRECT = 397,
|
||||
ITEXTURE2DRECT = 398,
|
||||
UTEXTURE2DRECT = 399,
|
||||
TEXTUREBUFFER = 400,
|
||||
ITEXTUREBUFFER = 401,
|
||||
UTEXTUREBUFFER = 402,
|
||||
TEXTURECUBEARRAY = 403,
|
||||
ITEXTURECUBEARRAY = 404,
|
||||
UTEXTURECUBEARRAY = 405,
|
||||
TEXTURE2DMS = 406,
|
||||
ITEXTURE2DMS = 407,
|
||||
UTEXTURE2DMS = 408,
|
||||
TEXTURE2DMSARRAY = 409,
|
||||
ITEXTURE2DMSARRAY = 410,
|
||||
UTEXTURE2DMSARRAY = 411,
|
||||
SUBPASSINPUT = 412,
|
||||
SUBPASSINPUTMS = 413,
|
||||
ISUBPASSINPUT = 414,
|
||||
ISUBPASSINPUTMS = 415,
|
||||
USUBPASSINPUT = 416,
|
||||
USUBPASSINPUTMS = 417,
|
||||
IMAGE1D = 418,
|
||||
IIMAGE1D = 419,
|
||||
UIMAGE1D = 420,
|
||||
IMAGE2D = 421,
|
||||
IIMAGE2D = 422,
|
||||
UIMAGE2D = 423,
|
||||
IMAGE3D = 424,
|
||||
IIMAGE3D = 425,
|
||||
UIMAGE3D = 426,
|
||||
IMAGE2DRECT = 427,
|
||||
IIMAGE2DRECT = 428,
|
||||
UIMAGE2DRECT = 429,
|
||||
IMAGECUBE = 430,
|
||||
IIMAGECUBE = 431,
|
||||
UIMAGECUBE = 432,
|
||||
IMAGEBUFFER = 433,
|
||||
IIMAGEBUFFER = 434,
|
||||
UIMAGEBUFFER = 435,
|
||||
IMAGE1DARRAY = 436,
|
||||
IIMAGE1DARRAY = 437,
|
||||
UIMAGE1DARRAY = 438,
|
||||
IMAGE2DARRAY = 439,
|
||||
IIMAGE2DARRAY = 440,
|
||||
UIMAGE2DARRAY = 441,
|
||||
IMAGECUBEARRAY = 442,
|
||||
IIMAGECUBEARRAY = 443,
|
||||
UIMAGECUBEARRAY = 444,
|
||||
IMAGE2DMS = 445,
|
||||
IIMAGE2DMS = 446,
|
||||
UIMAGE2DMS = 447,
|
||||
IMAGE2DMSARRAY = 448,
|
||||
IIMAGE2DMSARRAY = 449,
|
||||
UIMAGE2DMSARRAY = 450,
|
||||
STRUCT = 451,
|
||||
VOID = 452,
|
||||
WHILE = 453,
|
||||
IDENTIFIER = 454,
|
||||
TYPE_NAME = 455,
|
||||
FLOATCONSTANT = 456,
|
||||
DOUBLECONSTANT = 457,
|
||||
INTCONSTANT = 458,
|
||||
UINTCONSTANT = 459,
|
||||
BOOLCONSTANT = 460,
|
||||
LEFT_OP = 461,
|
||||
RIGHT_OP = 462,
|
||||
INC_OP = 463,
|
||||
DEC_OP = 464,
|
||||
LE_OP = 465,
|
||||
GE_OP = 466,
|
||||
EQ_OP = 467,
|
||||
NE_OP = 468,
|
||||
AND_OP = 469,
|
||||
OR_OP = 470,
|
||||
XOR_OP = 471,
|
||||
MUL_ASSIGN = 472,
|
||||
DIV_ASSIGN = 473,
|
||||
ADD_ASSIGN = 474,
|
||||
MOD_ASSIGN = 475,
|
||||
LEFT_ASSIGN = 476,
|
||||
RIGHT_ASSIGN = 477,
|
||||
AND_ASSIGN = 478,
|
||||
XOR_ASSIGN = 479,
|
||||
OR_ASSIGN = 480,
|
||||
SUB_ASSIGN = 481,
|
||||
LEFT_PAREN = 482,
|
||||
RIGHT_PAREN = 483,
|
||||
LEFT_BRACKET = 484,
|
||||
RIGHT_BRACKET = 485,
|
||||
LEFT_BRACE = 486,
|
||||
RIGHT_BRACE = 487,
|
||||
DOT = 488,
|
||||
COMMA = 489,
|
||||
COLON = 490,
|
||||
EQUAL = 491,
|
||||
SEMICOLON = 492,
|
||||
BANG = 493,
|
||||
DASH = 494,
|
||||
TILDE = 495,
|
||||
PLUS = 496,
|
||||
STAR = 497,
|
||||
SLASH = 498,
|
||||
PERCENT = 499,
|
||||
LEFT_ANGLE = 500,
|
||||
RIGHT_ANGLE = 501,
|
||||
VERTICAL_BAR = 502,
|
||||
CARET = 503,
|
||||
AMPERSAND = 504,
|
||||
QUESTION = 505,
|
||||
INVARIANT = 506,
|
||||
PRECISE = 507,
|
||||
HIGH_PRECISION = 508,
|
||||
MEDIUM_PRECISION = 509,
|
||||
LOW_PRECISION = 510,
|
||||
PRECISION = 511,
|
||||
PACKED = 512,
|
||||
RESOURCE = 513,
|
||||
SUPERP = 514
|
||||
INT64_T = 266,
|
||||
UINT64_T = 267,
|
||||
BREAK = 268,
|
||||
CONTINUE = 269,
|
||||
DO = 270,
|
||||
ELSE = 271,
|
||||
FOR = 272,
|
||||
IF = 273,
|
||||
DISCARD = 274,
|
||||
RETURN = 275,
|
||||
SWITCH = 276,
|
||||
CASE = 277,
|
||||
DEFAULT = 278,
|
||||
SUBROUTINE = 279,
|
||||
BVEC2 = 280,
|
||||
BVEC3 = 281,
|
||||
BVEC4 = 282,
|
||||
IVEC2 = 283,
|
||||
IVEC3 = 284,
|
||||
IVEC4 = 285,
|
||||
I64VEC2 = 286,
|
||||
I64VEC3 = 287,
|
||||
I64VEC4 = 288,
|
||||
UVEC2 = 289,
|
||||
UVEC3 = 290,
|
||||
UVEC4 = 291,
|
||||
U64VEC2 = 292,
|
||||
U64VEC3 = 293,
|
||||
U64VEC4 = 294,
|
||||
VEC2 = 295,
|
||||
VEC3 = 296,
|
||||
VEC4 = 297,
|
||||
MAT2 = 298,
|
||||
MAT3 = 299,
|
||||
MAT4 = 300,
|
||||
CENTROID = 301,
|
||||
IN = 302,
|
||||
OUT = 303,
|
||||
INOUT = 304,
|
||||
UNIFORM = 305,
|
||||
PATCH = 306,
|
||||
SAMPLE = 307,
|
||||
BUFFER = 308,
|
||||
SHARED = 309,
|
||||
COHERENT = 310,
|
||||
VOLATILE = 311,
|
||||
RESTRICT = 312,
|
||||
READONLY = 313,
|
||||
WRITEONLY = 314,
|
||||
DVEC2 = 315,
|
||||
DVEC3 = 316,
|
||||
DVEC4 = 317,
|
||||
DMAT2 = 318,
|
||||
DMAT3 = 319,
|
||||
DMAT4 = 320,
|
||||
NOPERSPECTIVE = 321,
|
||||
FLAT = 322,
|
||||
SMOOTH = 323,
|
||||
LAYOUT = 324,
|
||||
MAT2X2 = 325,
|
||||
MAT2X3 = 326,
|
||||
MAT2X4 = 327,
|
||||
MAT3X2 = 328,
|
||||
MAT3X3 = 329,
|
||||
MAT3X4 = 330,
|
||||
MAT4X2 = 331,
|
||||
MAT4X3 = 332,
|
||||
MAT4X4 = 333,
|
||||
DMAT2X2 = 334,
|
||||
DMAT2X3 = 335,
|
||||
DMAT2X4 = 336,
|
||||
DMAT3X2 = 337,
|
||||
DMAT3X3 = 338,
|
||||
DMAT3X4 = 339,
|
||||
DMAT4X2 = 340,
|
||||
DMAT4X3 = 341,
|
||||
DMAT4X4 = 342,
|
||||
ATOMIC_UINT = 343,
|
||||
SAMPLER1D = 344,
|
||||
SAMPLER2D = 345,
|
||||
SAMPLER3D = 346,
|
||||
SAMPLERCUBE = 347,
|
||||
SAMPLER1DSHADOW = 348,
|
||||
SAMPLER2DSHADOW = 349,
|
||||
SAMPLERCUBESHADOW = 350,
|
||||
SAMPLER1DARRAY = 351,
|
||||
SAMPLER2DARRAY = 352,
|
||||
SAMPLER1DARRAYSHADOW = 353,
|
||||
SAMPLER2DARRAYSHADOW = 354,
|
||||
ISAMPLER1D = 355,
|
||||
ISAMPLER2D = 356,
|
||||
ISAMPLER3D = 357,
|
||||
ISAMPLERCUBE = 358,
|
||||
ISAMPLER1DARRAY = 359,
|
||||
ISAMPLER2DARRAY = 360,
|
||||
USAMPLER1D = 361,
|
||||
USAMPLER2D = 362,
|
||||
USAMPLER3D = 363,
|
||||
USAMPLERCUBE = 364,
|
||||
USAMPLER1DARRAY = 365,
|
||||
USAMPLER2DARRAY = 366,
|
||||
SAMPLER2DRECT = 367,
|
||||
SAMPLER2DRECTSHADOW = 368,
|
||||
ISAMPLER2DRECT = 369,
|
||||
USAMPLER2DRECT = 370,
|
||||
SAMPLERBUFFER = 371,
|
||||
ISAMPLERBUFFER = 372,
|
||||
USAMPLERBUFFER = 373,
|
||||
SAMPLERCUBEARRAY = 374,
|
||||
SAMPLERCUBEARRAYSHADOW = 375,
|
||||
ISAMPLERCUBEARRAY = 376,
|
||||
USAMPLERCUBEARRAY = 377,
|
||||
SAMPLER2DMS = 378,
|
||||
ISAMPLER2DMS = 379,
|
||||
USAMPLER2DMS = 380,
|
||||
SAMPLER2DMSARRAY = 381,
|
||||
ISAMPLER2DMSARRAY = 382,
|
||||
USAMPLER2DMSARRAY = 383,
|
||||
SAMPLEREXTERNALOES = 384,
|
||||
SAMPLER = 385,
|
||||
SAMPLERSHADOW = 386,
|
||||
TEXTURE1D = 387,
|
||||
TEXTURE2D = 388,
|
||||
TEXTURE3D = 389,
|
||||
TEXTURECUBE = 390,
|
||||
TEXTURE1DARRAY = 391,
|
||||
TEXTURE2DARRAY = 392,
|
||||
ITEXTURE1D = 393,
|
||||
ITEXTURE2D = 394,
|
||||
ITEXTURE3D = 395,
|
||||
ITEXTURECUBE = 396,
|
||||
ITEXTURE1DARRAY = 397,
|
||||
ITEXTURE2DARRAY = 398,
|
||||
UTEXTURE1D = 399,
|
||||
UTEXTURE2D = 400,
|
||||
UTEXTURE3D = 401,
|
||||
UTEXTURECUBE = 402,
|
||||
UTEXTURE1DARRAY = 403,
|
||||
UTEXTURE2DARRAY = 404,
|
||||
TEXTURE2DRECT = 405,
|
||||
ITEXTURE2DRECT = 406,
|
||||
UTEXTURE2DRECT = 407,
|
||||
TEXTUREBUFFER = 408,
|
||||
ITEXTUREBUFFER = 409,
|
||||
UTEXTUREBUFFER = 410,
|
||||
TEXTURECUBEARRAY = 411,
|
||||
ITEXTURECUBEARRAY = 412,
|
||||
UTEXTURECUBEARRAY = 413,
|
||||
TEXTURE2DMS = 414,
|
||||
ITEXTURE2DMS = 415,
|
||||
UTEXTURE2DMS = 416,
|
||||
TEXTURE2DMSARRAY = 417,
|
||||
ITEXTURE2DMSARRAY = 418,
|
||||
UTEXTURE2DMSARRAY = 419,
|
||||
SUBPASSINPUT = 420,
|
||||
SUBPASSINPUTMS = 421,
|
||||
ISUBPASSINPUT = 422,
|
||||
ISUBPASSINPUTMS = 423,
|
||||
USUBPASSINPUT = 424,
|
||||
USUBPASSINPUTMS = 425,
|
||||
IMAGE1D = 426,
|
||||
IIMAGE1D = 427,
|
||||
UIMAGE1D = 428,
|
||||
IMAGE2D = 429,
|
||||
IIMAGE2D = 430,
|
||||
UIMAGE2D = 431,
|
||||
IMAGE3D = 432,
|
||||
IIMAGE3D = 433,
|
||||
UIMAGE3D = 434,
|
||||
IMAGE2DRECT = 435,
|
||||
IIMAGE2DRECT = 436,
|
||||
UIMAGE2DRECT = 437,
|
||||
IMAGECUBE = 438,
|
||||
IIMAGECUBE = 439,
|
||||
UIMAGECUBE = 440,
|
||||
IMAGEBUFFER = 441,
|
||||
IIMAGEBUFFER = 442,
|
||||
UIMAGEBUFFER = 443,
|
||||
IMAGE1DARRAY = 444,
|
||||
IIMAGE1DARRAY = 445,
|
||||
UIMAGE1DARRAY = 446,
|
||||
IMAGE2DARRAY = 447,
|
||||
IIMAGE2DARRAY = 448,
|
||||
UIMAGE2DARRAY = 449,
|
||||
IMAGECUBEARRAY = 450,
|
||||
IIMAGECUBEARRAY = 451,
|
||||
UIMAGECUBEARRAY = 452,
|
||||
IMAGE2DMS = 453,
|
||||
IIMAGE2DMS = 454,
|
||||
UIMAGE2DMS = 455,
|
||||
IMAGE2DMSARRAY = 456,
|
||||
IIMAGE2DMSARRAY = 457,
|
||||
UIMAGE2DMSARRAY = 458,
|
||||
STRUCT = 459,
|
||||
VOID = 460,
|
||||
WHILE = 461,
|
||||
IDENTIFIER = 462,
|
||||
TYPE_NAME = 463,
|
||||
FLOATCONSTANT = 464,
|
||||
DOUBLECONSTANT = 465,
|
||||
INTCONSTANT = 466,
|
||||
UINTCONSTANT = 467,
|
||||
INT64CONSTANT = 468,
|
||||
UINT64CONSTANT = 469,
|
||||
BOOLCONSTANT = 470,
|
||||
LEFT_OP = 471,
|
||||
RIGHT_OP = 472,
|
||||
INC_OP = 473,
|
||||
DEC_OP = 474,
|
||||
LE_OP = 475,
|
||||
GE_OP = 476,
|
||||
EQ_OP = 477,
|
||||
NE_OP = 478,
|
||||
AND_OP = 479,
|
||||
OR_OP = 480,
|
||||
XOR_OP = 481,
|
||||
MUL_ASSIGN = 482,
|
||||
DIV_ASSIGN = 483,
|
||||
ADD_ASSIGN = 484,
|
||||
MOD_ASSIGN = 485,
|
||||
LEFT_ASSIGN = 486,
|
||||
RIGHT_ASSIGN = 487,
|
||||
AND_ASSIGN = 488,
|
||||
XOR_ASSIGN = 489,
|
||||
OR_ASSIGN = 490,
|
||||
SUB_ASSIGN = 491,
|
||||
LEFT_PAREN = 492,
|
||||
RIGHT_PAREN = 493,
|
||||
LEFT_BRACKET = 494,
|
||||
RIGHT_BRACKET = 495,
|
||||
LEFT_BRACE = 496,
|
||||
RIGHT_BRACE = 497,
|
||||
DOT = 498,
|
||||
COMMA = 499,
|
||||
COLON = 500,
|
||||
EQUAL = 501,
|
||||
SEMICOLON = 502,
|
||||
BANG = 503,
|
||||
DASH = 504,
|
||||
TILDE = 505,
|
||||
PLUS = 506,
|
||||
STAR = 507,
|
||||
SLASH = 508,
|
||||
PERCENT = 509,
|
||||
LEFT_ANGLE = 510,
|
||||
RIGHT_ANGLE = 511,
|
||||
VERTICAL_BAR = 512,
|
||||
CARET = 513,
|
||||
AMPERSAND = 514,
|
||||
QUESTION = 515,
|
||||
INVARIANT = 516,
|
||||
PRECISE = 517,
|
||||
HIGH_PRECISION = 518,
|
||||
MEDIUM_PRECISION = 519,
|
||||
LOW_PRECISION = 520,
|
||||
PRECISION = 521,
|
||||
PACKED = 522,
|
||||
RESOURCE = 523,
|
||||
SUPERP = 524
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
@ -311,7 +321,7 @@ extern int yydebug;
|
|||
typedef union YYSTYPE
|
||||
{
|
||||
/* Line 2058 of yacc.c */
|
||||
#line 66 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y"
|
||||
#line 66 "glslang.y"
|
||||
|
||||
struct {
|
||||
glslang::TSourceLoc loc;
|
||||
|
|
@ -319,6 +329,8 @@ typedef union YYSTYPE
|
|||
glslang::TString *string;
|
||||
int i;
|
||||
unsigned int u;
|
||||
long long i64;
|
||||
unsigned long long u64;
|
||||
bool b;
|
||||
double d;
|
||||
};
|
||||
|
|
@ -345,7 +357,7 @@ typedef union YYSTYPE
|
|||
|
||||
|
||||
/* Line 2058 of yacc.c */
|
||||
#line 349 "C:/Projects/glslang/glslang/MachineIndependent/glslang_tab.cpp.h"
|
||||
#line 361 "glslang_tab.cpp.h"
|
||||
} YYSTYPE;
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
|
|
@ -367,4 +379,4 @@ int yyparse ();
|
|||
#endif
|
||||
#endif /* ! YYPARSE_PARAM */
|
||||
|
||||
#endif /* !YY_YY_C_PROJECTS_GLSLANG_GLSLANG_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED */
|
||||
#endif /* !YY_YY_GLSLANG_TAB_CPP_H_INCLUDED */
|
||||
|
|
|
|||
|
|
@ -206,22 +206,44 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
|
|||
case EOpConvUintToBool: out.debug << "Convert uint to bool"; break;
|
||||
case EOpConvFloatToBool: out.debug << "Convert float to bool"; break;
|
||||
case EOpConvDoubleToBool: out.debug << "Convert double to bool"; break;
|
||||
case EOpConvInt64ToBool: out.debug << "Convert int64 to bool"; break;
|
||||
case EOpConvUint64ToBool: out.debug << "Convert uint64 to bool"; break;
|
||||
case EOpConvIntToFloat: out.debug << "Convert int to float"; break;
|
||||
case EOpConvUintToFloat: out.debug << "Convert uint to float"; break;
|
||||
case EOpConvDoubleToFloat: out.debug << "Convert double to float"; break;
|
||||
case EOpConvInt64ToFloat: out.debug << "Convert int64 to float"; break;
|
||||
case EOpConvUint64ToFloat: out.debug << "Convert uint64 to float"; break;
|
||||
case EOpConvBoolToFloat: out.debug << "Convert bool to float"; break;
|
||||
case EOpConvUintToInt: out.debug << "Convert uint to int"; break;
|
||||
case EOpConvFloatToInt: out.debug << "Convert float to int"; break;
|
||||
case EOpConvDoubleToInt: out.debug << "Convert double to int"; break;
|
||||
case EOpConvBoolToInt: out.debug << "Convert bool to int"; break;
|
||||
case EOpConvInt64ToInt: out.debug << "Convert int64 to int"; break;
|
||||
case EOpConvUint64ToInt: out.debug << "Convert uint64 to int"; break;
|
||||
case EOpConvIntToUint: out.debug << "Convert int to uint"; break;
|
||||
case EOpConvFloatToUint: out.debug << "Convert float to uint"; break;
|
||||
case EOpConvDoubleToUint: out.debug << "Convert double to uint"; break;
|
||||
case EOpConvBoolToUint: out.debug << "Convert bool to uint"; break;
|
||||
case EOpConvInt64ToUint: out.debug << "Convert int64 to uint"; break;
|
||||
case EOpConvUint64ToUint: out.debug << "Convert uint64 to uint"; break;
|
||||
case EOpConvIntToDouble: out.debug << "Convert int to double"; break;
|
||||
case EOpConvUintToDouble: out.debug << "Convert uint to double"; break;
|
||||
case EOpConvFloatToDouble: out.debug << "Convert float to double"; break;
|
||||
case EOpConvBoolToDouble: out.debug << "Convert bool to double"; break;
|
||||
case EOpConvInt64ToDouble: out.debug << "Convert int64 to double"; break;
|
||||
case EOpConvUint64ToDouble: out.debug << "Convert uint64 to double"; break;
|
||||
case EOpConvBoolToInt64: out.debug << "Convert bool to int64"; break;
|
||||
case EOpConvIntToInt64: out.debug << "Convert int to int64"; break;
|
||||
case EOpConvUintToInt64: out.debug << "Convert uint to int64"; break;
|
||||
case EOpConvFloatToInt64: out.debug << "Convert float to int64"; break;
|
||||
case EOpConvDoubleToInt64: out.debug << "Convert double to int64"; break;
|
||||
case EOpConvUint64ToInt64: out.debug << "Convert uint64 to int64"; break;
|
||||
case EOpConvBoolToUint64: out.debug << "Convert bool to uint64"; break;
|
||||
case EOpConvIntToUint64: out.debug << "Convert int to uint64"; break;
|
||||
case EOpConvUintToUint64: out.debug << "Convert uint to uint64"; break;
|
||||
case EOpConvFloatToUint64: out.debug << "Convert float to uint64"; break;
|
||||
case EOpConvDoubleToUint64: out.debug << "Convert double to uint64"; break;
|
||||
case EOpConvInt64ToUint64: out.debug << "Convert uint64 to uint64"; break;
|
||||
|
||||
case EOpRadians: out.debug << "radians"; break;
|
||||
case EOpDegrees: out.debug << "degrees"; break;
|
||||
|
|
@ -261,6 +283,10 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
|
|||
case EOpFloatBitsToUint:out.debug << "floatBitsToUint"; break;
|
||||
case EOpIntBitsToFloat: out.debug << "intBitsToFloat"; break;
|
||||
case EOpUintBitsToFloat:out.debug << "uintBitsToFloat"; break;
|
||||
case EOpDoubleBitsToInt64: out.debug << "doubleBitsToInt64"; break;
|
||||
case EOpDoubleBitsToUint64: out.debug << "doubleBitsToUint64"; break;
|
||||
case EOpInt64BitsToDouble: out.debug << "int64BitsToDouble"; break;
|
||||
case EOpUint64BitsToDouble: out.debug << "uint64BitsToDouble"; break;
|
||||
case EOpPackSnorm2x16: out.debug << "packSnorm2x16"; break;
|
||||
case EOpUnpackSnorm2x16:out.debug << "unpackSnorm2x16"; break;
|
||||
case EOpPackUnorm2x16: out.debug << "packUnorm2x16"; break;
|
||||
|
|
@ -275,6 +301,11 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
|
|||
case EOpPackDouble2x32: out.debug << "PackDouble2x32"; break;
|
||||
case EOpUnpackDouble2x32: out.debug << "UnpackDouble2x32"; break;
|
||||
|
||||
case EOpPackInt2x32: out.debug << "packInt2x32"; break;
|
||||
case EOpUnpackInt2x32: out.debug << "unpackInt2x32"; break;
|
||||
case EOpPackUint2x32: out.debug << "packUint2x32"; break;
|
||||
case EOpUnpackUint2x32: out.debug << "unpackUint2x32"; break;
|
||||
|
||||
case EOpLength: out.debug << "length"; break;
|
||||
case EOpNormalize: out.debug << "normalize"; break;
|
||||
case EOpDPdx: out.debug << "dPdx"; break;
|
||||
|
|
@ -366,6 +397,14 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
|
|||
case EOpConstructUVec2: out.debug << "Construct uvec2"; break;
|
||||
case EOpConstructUVec3: out.debug << "Construct uvec3"; break;
|
||||
case EOpConstructUVec4: out.debug << "Construct uvec4"; break;
|
||||
case EOpConstructInt64: out.debug << "Construct int64_t"; break;
|
||||
case EOpConstructI64Vec2: out.debug << "Construct i64vec2"; break;
|
||||
case EOpConstructI64Vec3: out.debug << "Construct i64vec3"; break;
|
||||
case EOpConstructI64Vec4: out.debug << "Construct i64vec4"; break;
|
||||
case EOpConstructUint64: out.debug << "Construct uint64_t"; break;
|
||||
case EOpConstructU64Vec2: out.debug << "Construct u64vec2"; break;
|
||||
case EOpConstructU64Vec3: out.debug << "Construct u64vec3"; break;
|
||||
case EOpConstructU64Vec4: out.debug << "Construct u64vec4"; break;
|
||||
case EOpConstructMat2x2: out.debug << "Construct mat2"; break;
|
||||
case EOpConstructMat2x3: out.debug << "Construct mat2x3"; break;
|
||||
case EOpConstructMat2x4: out.debug << "Construct mat2x4"; break;
|
||||
|
|
@ -582,6 +621,24 @@ static void OutputConstantUnion(TInfoSink& out, const TIntermTyped* node, const
|
|||
out.debug << buf << "\n";
|
||||
}
|
||||
break;
|
||||
case EbtInt64:
|
||||
{
|
||||
const int maxSize = 300;
|
||||
char buf[maxSize];
|
||||
snprintf(buf, maxSize, "%lld (%s)", constUnion[i].getI64Const(), "const int64_t");
|
||||
|
||||
out.debug << buf << "\n";
|
||||
}
|
||||
break;
|
||||
case EbtUint64:
|
||||
{
|
||||
const int maxSize = 300;
|
||||
char buf[maxSize];
|
||||
snprintf(buf, maxSize, "%llu (%s)", constUnion[i].getU64Const(), "const uint64_t");
|
||||
|
||||
out.debug << buf << "\n";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
out.info.message(EPrefixInternalError, "Unknown constant", node->getLoc());
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -880,6 +880,8 @@ const int baseAlignmentVec4Std140 = 16;
|
|||
int TIntermediate::getBaseAlignmentScalar(const TType& type, int& size)
|
||||
{
|
||||
switch (type.getBasicType()) {
|
||||
case EbtInt64:
|
||||
case EbtUint64:
|
||||
case EbtDouble: size = 8; return 8;
|
||||
default: size = 4; return 4;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -191,6 +191,8 @@ public:
|
|||
TIntermConstantUnion* addConstantUnion(const TConstUnionArray&, const TType&, const TSourceLoc&, bool literal = false) const;
|
||||
TIntermConstantUnion* addConstantUnion(int, const TSourceLoc&, bool literal = false) const;
|
||||
TIntermConstantUnion* addConstantUnion(unsigned int, const TSourceLoc&, bool literal = false) const;
|
||||
TIntermConstantUnion* addConstantUnion(long long, const TSourceLoc&, bool literal = false) const;
|
||||
TIntermConstantUnion* addConstantUnion(unsigned long long, const TSourceLoc&, bool literal = false) const;
|
||||
TIntermConstantUnion* addConstantUnion(bool, const TSourceLoc&, bool literal = false) const;
|
||||
TIntermConstantUnion* addConstantUnion(double, TBasicType, const TSourceLoc&, bool literal = false) const;
|
||||
TIntermTyped* promoteConstantUnion(TBasicType, TIntermConstantUnion*) const;
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ public:
|
|||
virtual void updateExtensionBehavior(int line, const char* const extension, const char* behavior);
|
||||
virtual void fullIntegerCheck(const TSourceLoc&, const char* op);
|
||||
virtual void doubleCheck(const TSourceLoc&, const char* op);
|
||||
virtual void int64Check(const TSourceLoc&, const char* op, bool builtIn = false);
|
||||
virtual void spvRemoved(const TSourceLoc&, const char* op);
|
||||
virtual void vulkanRemoved(const TSourceLoc&, const char* op);
|
||||
virtual void requireVulkan(const TSourceLoc&, const char* op);
|
||||
|
|
|
|||
|
|
@ -705,7 +705,8 @@ int TPpContext::CPPerror(TPpToken* ppToken)
|
|||
TSourceLoc loc = ppToken->loc;
|
||||
|
||||
while (token != '\n' && token != EndOfInput) {
|
||||
if (token == PpAtomConstInt || token == PpAtomConstUint ||
|
||||
if (token == PpAtomConstInt || token == PpAtomConstUint ||
|
||||
token == PpAtomConstInt64 || token == PpAtomConstUint64 ||
|
||||
token == PpAtomConstFloat || token == PpAtomConstDouble) {
|
||||
message.append(ppToken->name);
|
||||
} else if (token == PpAtomIdentifier || token == PpAtomConstString) {
|
||||
|
|
@ -736,6 +737,8 @@ int TPpContext::CPPpragma(TPpToken* ppToken)
|
|||
case PpAtomIdentifier:
|
||||
case PpAtomConstInt:
|
||||
case PpAtomConstUint:
|
||||
case PpAtomConstInt64:
|
||||
case PpAtomConstUint64:
|
||||
case PpAtomConstFloat:
|
||||
case PpAtomConstDouble:
|
||||
tokens.push_back(ppToken->name);
|
||||
|
|
|
|||
|
|
@ -111,6 +111,7 @@ public:
|
|||
bool space; // true if a space (for white space or a removed comment) should also be recognized, in front of the token returned
|
||||
int ival;
|
||||
double dval;
|
||||
long long i64val;
|
||||
int atom;
|
||||
char name[MaxTokenLength + 1];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -238,9 +238,11 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||
int len = 0;
|
||||
int ch = 0;
|
||||
int ii = 0;
|
||||
unsigned ival = 0;
|
||||
unsigned long long ival = 0;
|
||||
bool enableInt64 = pp->parseContext.version >= 450 && pp->parseContext.extensionTurnedOn(E_GL_ARB_gpu_shader_int64);
|
||||
|
||||
ppToken->ival = 0;
|
||||
ppToken->i64val = 0;
|
||||
ppToken->space = false;
|
||||
ch = getch();
|
||||
for (;;) {
|
||||
|
|
@ -299,6 +301,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||
// must be hexidecimal
|
||||
|
||||
bool isUnsigned = false;
|
||||
bool isInt64 = false;
|
||||
ppToken->name[len++] = (char)ch;
|
||||
ch = getch();
|
||||
if ((ch >= '0' && ch <= '9') ||
|
||||
|
|
@ -307,7 +310,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||
|
||||
ival = 0;
|
||||
do {
|
||||
if (ival <= 0x0fffffff) {
|
||||
if (ival <= 0x0fffffff || (enableInt64 && ival <= 0x0fffffffffffffffull)) {
|
||||
ppToken->name[len++] = (char)ch;
|
||||
if (ch >= '0' && ch <= '9') {
|
||||
ii = ch - '0';
|
||||
|
|
@ -323,7 +326,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||
pp->parseContext.ppError(ppToken->loc, "hexidecimal literal too big", "", "");
|
||||
AlreadyComplained = 1;
|
||||
}
|
||||
ival = 0xffffffff;
|
||||
ival = 0xffffffffffffffffull;
|
||||
}
|
||||
ch = getch();
|
||||
} while ((ch >= '0' && ch <= '9') ||
|
||||
|
|
@ -336,19 +339,37 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||
if (len < MaxTokenLength)
|
||||
ppToken->name[len++] = (char)ch;
|
||||
isUnsigned = true;
|
||||
|
||||
if (enableInt64) {
|
||||
int nextCh = getch();
|
||||
if ((ch == 'u' && nextCh == 'l') || (ch == 'U' && nextCh == 'L')) {
|
||||
if (len < MaxTokenLength)
|
||||
ppToken->name[len++] = (char)nextCh;
|
||||
isInt64 = true;
|
||||
} else
|
||||
ungetch();
|
||||
}
|
||||
}
|
||||
else if (enableInt64 && (ch == 'l' || ch == 'L')) {
|
||||
if (len < MaxTokenLength)
|
||||
ppToken->name[len++] = (char)ch;
|
||||
isInt64 = true;
|
||||
} else
|
||||
ungetch();
|
||||
ppToken->name[len] = '\0';
|
||||
ppToken->ival = (int)ival;
|
||||
|
||||
if (isUnsigned)
|
||||
return PpAtomConstUint;
|
||||
else
|
||||
return PpAtomConstInt;
|
||||
if (isInt64) {
|
||||
ppToken->i64val = ival;
|
||||
return isUnsigned ? PpAtomConstUint64 : PpAtomConstInt64;
|
||||
} else {
|
||||
ppToken->ival = (int)ival;
|
||||
return isUnsigned ? PpAtomConstUint : PpAtomConstInt;
|
||||
}
|
||||
} else {
|
||||
// could be octal integer or floating point, speculative pursue octal until it must be floating point
|
||||
|
||||
bool isUnsigned = false;
|
||||
bool isInt64 = false;
|
||||
bool octalOverflow = false;
|
||||
bool nonOctal = false;
|
||||
ival = 0;
|
||||
|
|
@ -361,7 +382,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||
pp->parseContext.ppError(ppToken->loc, "numeric literal too long", "", "");
|
||||
AlreadyComplained = 1;
|
||||
}
|
||||
if (ival <= 0x1fffffff) {
|
||||
if (ival <= 0x1fffffff || (enableInt64 && ival <= 0x1fffffffffffffffull)) {
|
||||
ii = ch - '0';
|
||||
ival = (ival << 3) | ii;
|
||||
} else
|
||||
|
|
@ -382,7 +403,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||
ch = getch();
|
||||
} while (ch >= '0' && ch <= '9');
|
||||
}
|
||||
if (ch == '.' || ch == 'e' || ch == 'f' || ch == 'E' || ch == 'F' || ch == 'l' || ch == 'L')
|
||||
if (ch == '.' || ch == 'e' || ch == 'f' || ch == 'E' || ch == 'F')
|
||||
return pp->lFloatConst(len, ch, ppToken);
|
||||
|
||||
// wasn't a float, so must be octal...
|
||||
|
|
@ -393,6 +414,21 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||
if (len < MaxTokenLength)
|
||||
ppToken->name[len++] = (char)ch;
|
||||
isUnsigned = true;
|
||||
|
||||
if (enableInt64) {
|
||||
int nextCh = getch();
|
||||
if ((ch == 'u' && nextCh == 'l') || (ch == 'U' && nextCh == 'L')) {
|
||||
if (len < MaxTokenLength)
|
||||
ppToken->name[len++] = (char)nextCh;
|
||||
isInt64 = true;
|
||||
} else
|
||||
ungetch();
|
||||
}
|
||||
}
|
||||
else if (enableInt64 && (ch == 'l' || ch == 'L')) {
|
||||
if (len < MaxTokenLength)
|
||||
ppToken->name[len++] = (char)ch;
|
||||
isInt64 = true;
|
||||
} else
|
||||
ungetch();
|
||||
ppToken->name[len] = '\0';
|
||||
|
|
@ -400,12 +436,13 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||
if (octalOverflow)
|
||||
pp->parseContext.ppError(ppToken->loc, "octal literal too big", "", "");
|
||||
|
||||
ppToken->ival = (int)ival;
|
||||
|
||||
if (isUnsigned)
|
||||
return PpAtomConstUint;
|
||||
else
|
||||
return PpAtomConstInt;
|
||||
if (isInt64) {
|
||||
ppToken->i64val = ival;
|
||||
return isUnsigned ? PpAtomConstUint64 : PpAtomConstInt64;
|
||||
} else {
|
||||
ppToken->ival = (int)ival;
|
||||
return isUnsigned ? PpAtomConstUint : PpAtomConstInt;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case '1': case '2': case '3': case '4':
|
||||
|
|
@ -421,16 +458,31 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||
}
|
||||
ch = getch();
|
||||
} while (ch >= '0' && ch <= '9');
|
||||
if (ch == '.' || ch == 'e' || ch == 'f' || ch == 'E' || ch == 'F' || ch == 'l' || ch == 'L') {
|
||||
if (ch == '.' || ch == 'e' || ch == 'f' || ch == 'E' || ch == 'F') {
|
||||
return pp->lFloatConst(len, ch, ppToken);
|
||||
} else {
|
||||
// Finish handling signed and unsigned integers
|
||||
int numericLen = len;
|
||||
bool uint = false;
|
||||
bool isUnsigned = false;
|
||||
bool isInt64 = false;
|
||||
if (ch == 'u' || ch == 'U') {
|
||||
if (len < MaxTokenLength)
|
||||
ppToken->name[len++] = (char)ch;
|
||||
uint = true;
|
||||
isUnsigned = true;
|
||||
|
||||
if (enableInt64) {
|
||||
int nextCh = getch();
|
||||
if ((ch == 'u' && nextCh == 'l') || (ch == 'U' && nextCh == 'L')) {
|
||||
if (len < MaxTokenLength)
|
||||
ppToken->name[len++] = (char)nextCh;
|
||||
isInt64 = true;
|
||||
} else
|
||||
ungetch();
|
||||
}
|
||||
} else if (enableInt64 && (ch == 'l' || ch == 'L')) {
|
||||
if (len < MaxTokenLength)
|
||||
ppToken->name[len++] = (char)ch;
|
||||
isInt64 = true;
|
||||
} else
|
||||
ungetch();
|
||||
|
||||
|
|
@ -438,21 +490,26 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||
ival = 0;
|
||||
const unsigned oneTenthMaxInt = 0xFFFFFFFFu / 10;
|
||||
const unsigned remainderMaxInt = 0xFFFFFFFFu - 10 * oneTenthMaxInt;
|
||||
const unsigned long long oneTenthMaxInt64 = 0xFFFFFFFFFFFFFFFFull / 10;
|
||||
const unsigned long long remainderMaxInt64 = 0xFFFFFFFFFFFFFFFFull - 10 * oneTenthMaxInt64;
|
||||
for (int i = 0; i < numericLen; i++) {
|
||||
ch = ppToken->name[i] - '0';
|
||||
if ((ival > oneTenthMaxInt) || (ival == oneTenthMaxInt && (unsigned)ch > remainderMaxInt)) {
|
||||
if ((enableInt64 == false && ((ival > oneTenthMaxInt) || (ival == oneTenthMaxInt && (unsigned)ch > remainderMaxInt))) ||
|
||||
(enableInt64 && ((ival > oneTenthMaxInt64) || (ival == oneTenthMaxInt64 && (unsigned long long)ch > remainderMaxInt64)))) {
|
||||
pp->parseContext.ppError(ppToken->loc, "numeric literal too big", "", "");
|
||||
ival = 0xFFFFFFFFu;
|
||||
ival = 0xFFFFFFFFFFFFFFFFull;
|
||||
break;
|
||||
} else
|
||||
ival = ival * 10 + ch;
|
||||
}
|
||||
ppToken->ival = (int)ival;
|
||||
|
||||
if (uint)
|
||||
return PpAtomConstUint;
|
||||
else
|
||||
return PpAtomConstInt;
|
||||
if (isInt64) {
|
||||
ppToken->i64val = ival;
|
||||
return isUnsigned ? PpAtomConstUint64 : PpAtomConstInt64;
|
||||
} else {
|
||||
ppToken->ival = (int)ival;
|
||||
return isUnsigned ? PpAtomConstUint : PpAtomConstInt;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case '-':
|
||||
|
|
@ -686,6 +743,8 @@ const char* TPpContext::tokenize(TPpToken* ppToken)
|
|||
case PpAtomConstInt:
|
||||
case PpAtomConstUint:
|
||||
case PpAtomConstFloat:
|
||||
case PpAtomConstInt64:
|
||||
case PpAtomConstUint64:
|
||||
case PpAtomConstDouble:
|
||||
tokenString = ppToken->name;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -141,6 +141,8 @@ void TPpContext::RecordToken(TokenStream *pTok, int token, TPpToken* ppToken)
|
|||
break;
|
||||
case PpAtomConstInt:
|
||||
case PpAtomConstUint:
|
||||
case PpAtomConstInt64:
|
||||
case PpAtomConstUint64:
|
||||
case PpAtomConstFloat:
|
||||
case PpAtomConstDouble:
|
||||
str = ppToken->name;
|
||||
|
|
@ -193,6 +195,8 @@ int TPpContext::ReadToken(TokenStream *pTok, TPpToken *ppToken)
|
|||
case PpAtomConstDouble:
|
||||
case PpAtomConstInt:
|
||||
case PpAtomConstUint:
|
||||
case PpAtomConstInt64:
|
||||
case PpAtomConstUint64:
|
||||
len = 0;
|
||||
ch = lReadByte(pTok);
|
||||
while (ch != 0 && ch != EndOfInput) {
|
||||
|
|
@ -227,6 +231,16 @@ int TPpContext::ReadToken(TokenStream *pTok, TPpToken *ppToken)
|
|||
} else
|
||||
ppToken->ival = atoi(ppToken->name);
|
||||
break;
|
||||
case PpAtomConstInt64:
|
||||
case PpAtomConstUint64:
|
||||
if (len > 0 && tokenText[0] == '0') {
|
||||
if (len > 1 && (tokenText[1] == 'x' || tokenText[1] == 'X'))
|
||||
ppToken->i64val = std::stoll(ppToken->name, 0, 16);
|
||||
else
|
||||
ppToken->i64val = std::stoll(ppToken->name, 0, 8);
|
||||
} else
|
||||
ppToken->i64val = std::stoll(ppToken->name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -119,6 +119,8 @@ enum EFixedAtoms {
|
|||
|
||||
PpAtomConstInt,
|
||||
PpAtomConstUint,
|
||||
PpAtomConstInt64,
|
||||
PpAtomConstUint64,
|
||||
PpAtomConstFloat,
|
||||
PpAtomConstDouble,
|
||||
PpAtomConstString,
|
||||
|
|
|
|||
|
|
@ -540,6 +540,8 @@ public:
|
|||
case EbtDouble: return GL_DOUBLE_VEC2 + offset;
|
||||
case EbtInt: return GL_INT_VEC2 + offset;
|
||||
case EbtUint: return GL_UNSIGNED_INT_VEC2 + offset;
|
||||
case EbtInt64: return GL_INT64_ARB + offset;
|
||||
case EbtUint64: return GL_UNSIGNED_INT64_ARB + offset;
|
||||
case EbtBool: return GL_BOOL_VEC2 + offset;
|
||||
case EbtAtomicUint: return GL_UNSIGNED_INT_ATOMIC_COUNTER + offset;
|
||||
default: return 0;
|
||||
|
|
@ -605,6 +607,8 @@ public:
|
|||
case EbtDouble: return GL_DOUBLE;
|
||||
case EbtInt: return GL_INT;
|
||||
case EbtUint: return GL_UNSIGNED_INT;
|
||||
case EbtInt64: return GL_INT64_ARB;
|
||||
case EbtUint64: return GL_UNSIGNED_INT64_ARB;
|
||||
case EbtBool: return GL_BOOL;
|
||||
case EbtAtomicUint: return GL_UNSIGNED_INT_ATOMIC_COUNTER;
|
||||
default: return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue