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:
Rex Xu 2016-04-22 16:51:45 +08:00
parent 010e93fe62
commit 8ff43de891
33 changed files with 5047 additions and 3009 deletions

View file

@ -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: