Implement extension GL_AMD_gpu_shader_int16
- Add int16 types (int16_t, uint16_t, i16vec, u16vec). - Add int16 support to GLSL operators. - Add int16 type conversions (to int16, from int16). - Add int16 built-in functions.
This commit is contained in:
parent
4d5bcd3162
commit
cabbb788b4
@ -33,7 +33,7 @@ enum Decoration;
|
||||
enum Op;
|
||||
|
||||
static const int GLSLextAMDVersion = 100;
|
||||
static const int GLSLextAMDRevision = 3;
|
||||
static const int GLSLextAMDRevision = 4;
|
||||
|
||||
// SPV_AMD_shader_ballot
|
||||
static const char* const E_SPV_AMD_shader_ballot = "SPV_AMD_shader_ballot";
|
||||
@ -119,4 +119,7 @@ static const char* const E_SPV_AMD_texture_gather_bias_lod = "SPV_AMD_texture_ga
|
||||
|
||||
static const Capability OpCapabilityImageGatherBiasLodAMD = static_cast<Capability>(5009);
|
||||
|
||||
// SPV_AMD_gpu_shader_int16
|
||||
static const char* const E_SPV_AMD_gpu_shader_int16 = "SPV_AMD_gpu_shader_int16";
|
||||
|
||||
#endif // #ifndef GLSLextAMD_H
|
||||
|
@ -1369,6 +1369,10 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI
|
||||
#endif
|
||||
else if (node->getBasicType() == glslang::EbtInt64 || node->getBasicType() == glslang::EbtUint64)
|
||||
one = builder.makeInt64Constant(1);
|
||||
#ifdef AMD_EXTENSIONS
|
||||
else if (node->getBasicType() == glslang::EbtInt16 || node->getBasicType() == glslang::EbtUint16)
|
||||
one = builder.makeInt16Constant(1);
|
||||
#endif
|
||||
else
|
||||
one = builder.makeIntConstant(1);
|
||||
glslang::TOperator op;
|
||||
@ -1616,6 +1620,16 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
|
||||
case glslang::EOpConstructU64Vec2:
|
||||
case glslang::EOpConstructU64Vec3:
|
||||
case glslang::EOpConstructU64Vec4:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case glslang::EOpConstructInt16:
|
||||
case glslang::EOpConstructI16Vec2:
|
||||
case glslang::EOpConstructI16Vec3:
|
||||
case glslang::EOpConstructI16Vec4:
|
||||
case glslang::EOpConstructUint16:
|
||||
case glslang::EOpConstructU16Vec2:
|
||||
case glslang::EOpConstructU16Vec3:
|
||||
case glslang::EOpConstructU16Vec4:
|
||||
#endif
|
||||
case glslang::EOpConstructStruct:
|
||||
case glslang::EOpConstructTextureSampler:
|
||||
{
|
||||
@ -2149,7 +2163,9 @@ spv::Id TGlslangToSpvTraverser::createSpvVariable(const glslang::TIntermSymbol*
|
||||
spv::Id spvType = convertGlslangToSpvType(node->getType());
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
const bool contains16BitType = node->getType().containsBasicType(glslang::EbtFloat16);
|
||||
const bool contains16BitType = node->getType().containsBasicType(glslang::EbtFloat16) ||
|
||||
node->getType().containsBasicType(glslang::EbtInt16) ||
|
||||
node->getType().containsBasicType(glslang::EbtUint16);
|
||||
if (contains16BitType) {
|
||||
if (storageClass == spv::StorageClassInput || storageClass == spv::StorageClassOutput) {
|
||||
builder.addExtension(spv::E_SPV_KHR_16bit_storage);
|
||||
@ -2262,13 +2278,21 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty
|
||||
spvType = builder.makeUintType(32);
|
||||
break;
|
||||
case glslang::EbtInt64:
|
||||
builder.addCapability(spv::CapabilityInt64);
|
||||
spvType = builder.makeIntType(64);
|
||||
break;
|
||||
case glslang::EbtUint64:
|
||||
builder.addCapability(spv::CapabilityInt64);
|
||||
spvType = builder.makeUintType(64);
|
||||
break;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case glslang::EbtInt16:
|
||||
builder.addExtension(spv::E_SPV_AMD_gpu_shader_int16);
|
||||
spvType = builder.makeIntType(16);
|
||||
break;
|
||||
case glslang::EbtUint16:
|
||||
builder.addExtension(spv::E_SPV_AMD_gpu_shader_int16);
|
||||
spvType = builder.makeUintType(16);
|
||||
break;
|
||||
#endif
|
||||
case glslang::EbtAtomicUint:
|
||||
builder.addCapability(spv::CapabilityAtomicStorage);
|
||||
spvType = builder.makeUintType(32);
|
||||
@ -3485,10 +3509,11 @@ spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, spv
|
||||
spv::Id typeId, spv::Id left, spv::Id right,
|
||||
glslang::TBasicType typeProxy, bool reduceComparison)
|
||||
{
|
||||
bool isUnsigned = typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
bool isUnsigned = typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64 || typeProxy == glslang::EbtUint16;
|
||||
bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble || typeProxy == glslang::EbtFloat16;
|
||||
#else
|
||||
bool isUnsigned = typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64;
|
||||
bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble;
|
||||
#endif
|
||||
bool isBool = typeProxy == glslang::EbtBool;
|
||||
@ -3815,10 +3840,11 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv:
|
||||
spv::Op unaryOp = spv::OpNop;
|
||||
int extBuiltins = -1;
|
||||
int libCall = -1;
|
||||
bool isUnsigned = typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
bool isUnsigned = typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64 || typeProxy == glslang::EbtUint16;
|
||||
bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble || typeProxy == glslang::EbtFloat16;
|
||||
#else
|
||||
bool isUnsigned = typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64;
|
||||
bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble;
|
||||
#endif
|
||||
|
||||
@ -3957,6 +3983,12 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv:
|
||||
case glslang::EOpDoubleBitsToUint64:
|
||||
case glslang::EOpInt64BitsToDouble:
|
||||
case glslang::EOpUint64BitsToDouble:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case glslang::EOpFloat16BitsToInt16:
|
||||
case glslang::EOpFloat16BitsToUint16:
|
||||
case glslang::EOpInt16BitsToFloat16:
|
||||
case glslang::EOpUint16BitsToFloat16:
|
||||
#endif
|
||||
unaryOp = spv::OpBitcast;
|
||||
break;
|
||||
|
||||
@ -4005,6 +4037,14 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv:
|
||||
break;
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case glslang::EOpPackInt2x16:
|
||||
case glslang::EOpUnpackInt2x16:
|
||||
case glslang::EOpPackUint2x16:
|
||||
case glslang::EOpUnpackUint2x16:
|
||||
case glslang::EOpPackInt4x16:
|
||||
case glslang::EOpUnpackInt4x16:
|
||||
case glslang::EOpPackUint4x16:
|
||||
case glslang::EOpUnpackUint4x16:
|
||||
case glslang::EOpPackFloat2x16:
|
||||
case glslang::EOpUnpackFloat2x16:
|
||||
unaryOp = spv::OpBitcast;
|
||||
@ -4204,8 +4244,18 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Dec
|
||||
case glslang::EOpConvUintToBool:
|
||||
case glslang::EOpConvInt64ToBool:
|
||||
case glslang::EOpConvUint64ToBool:
|
||||
zero = (op == glslang::EOpConvInt64ToBool ||
|
||||
op == glslang::EOpConvUint64ToBool) ? builder.makeUint64Constant(0) : builder.makeUintConstant(0);
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case glslang::EOpConvInt16ToBool:
|
||||
case glslang::EOpConvUint16ToBool:
|
||||
#endif
|
||||
if (op == glslang::EOpConvInt64ToBool || op == glslang::EOpConvUint64ToBool)
|
||||
zero = builder.makeUint64Constant(0);
|
||||
#ifdef AMD_EXTENSIONS
|
||||
else if (op == glslang::EOpConvInt16ToBool || op == glslang::EOpConvUint16ToBool)
|
||||
zero = builder.makeUint16Constant(0);
|
||||
#endif
|
||||
else
|
||||
zero = builder.makeUintConstant(0);
|
||||
zero = makeSmearedConstant(zero, vectorSize);
|
||||
return builder.createBinOp(spv::OpINotEqual, destType, operand, zero);
|
||||
|
||||
@ -4248,15 +4298,53 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Dec
|
||||
|
||||
case glslang::EOpConvBoolToInt:
|
||||
case glslang::EOpConvBoolToInt64:
|
||||
zero = (op == glslang::EOpConvBoolToInt64) ? builder.makeInt64Constant(0) : builder.makeIntConstant(0);
|
||||
one = (op == glslang::EOpConvBoolToInt64) ? builder.makeInt64Constant(1) : builder.makeIntConstant(1);
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case glslang::EOpConvBoolToInt16:
|
||||
#endif
|
||||
if (op == glslang::EOpConvBoolToInt64)
|
||||
zero = builder.makeInt64Constant(0);
|
||||
#ifdef AMD_EXTENSIONS
|
||||
else if (op == glslang::EOpConvBoolToInt16)
|
||||
zero = builder.makeInt16Constant(0);
|
||||
#endif
|
||||
else
|
||||
zero = builder.makeIntConstant(0);
|
||||
|
||||
if (op == glslang::EOpConvBoolToInt64)
|
||||
one = builder.makeInt64Constant(1);
|
||||
#ifdef AMD_EXTENSIONS
|
||||
else if (op == glslang::EOpConvBoolToInt16)
|
||||
one = builder.makeInt16Constant(1);
|
||||
#endif
|
||||
else
|
||||
one = builder.makeIntConstant(1);
|
||||
|
||||
convOp = spv::OpSelect;
|
||||
break;
|
||||
|
||||
case glslang::EOpConvBoolToUint:
|
||||
case glslang::EOpConvBoolToUint64:
|
||||
zero = (op == glslang::EOpConvBoolToUint64) ? builder.makeUint64Constant(0) : builder.makeUintConstant(0);
|
||||
one = (op == glslang::EOpConvBoolToUint64) ? builder.makeUint64Constant(1) : builder.makeUintConstant(1);
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case glslang::EOpConvBoolToUint16:
|
||||
#endif
|
||||
if (op == glslang::EOpConvBoolToUint64)
|
||||
zero = builder.makeUint64Constant(0);
|
||||
#ifdef AMD_EXTENSIONS
|
||||
else if (op == glslang::EOpConvBoolToUint16)
|
||||
zero = builder.makeUint16Constant(0);
|
||||
#endif
|
||||
else
|
||||
zero = builder.makeUintConstant(0);
|
||||
|
||||
if (op == glslang::EOpConvBoolToUint64)
|
||||
one = builder.makeUint64Constant(1);
|
||||
#ifdef AMD_EXTENSIONS
|
||||
else if (op == glslang::EOpConvBoolToUint16)
|
||||
one = builder.makeUint16Constant(1);
|
||||
#endif
|
||||
else
|
||||
one = builder.makeUintConstant(1);
|
||||
|
||||
convOp = spv::OpSelect;
|
||||
break;
|
||||
|
||||
@ -4265,6 +4353,9 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Dec
|
||||
case glslang::EOpConvInt64ToFloat:
|
||||
case glslang::EOpConvInt64ToDouble:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case glslang::EOpConvInt16ToFloat:
|
||||
case glslang::EOpConvInt16ToDouble:
|
||||
case glslang::EOpConvInt16ToFloat16:
|
||||
case glslang::EOpConvIntToFloat16:
|
||||
case glslang::EOpConvInt64ToFloat16:
|
||||
#endif
|
||||
@ -4276,6 +4367,9 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Dec
|
||||
case glslang::EOpConvUint64ToFloat:
|
||||
case glslang::EOpConvUint64ToDouble:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case glslang::EOpConvUint16ToFloat:
|
||||
case glslang::EOpConvUint16ToDouble:
|
||||
case glslang::EOpConvUint16ToFloat16:
|
||||
case glslang::EOpConvUintToFloat16:
|
||||
case glslang::EOpConvUint64ToFloat16:
|
||||
#endif
|
||||
@ -4300,6 +4394,9 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Dec
|
||||
case glslang::EOpConvFloatToInt64:
|
||||
case glslang::EOpConvDoubleToInt64:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case glslang::EOpConvFloatToInt16:
|
||||
case glslang::EOpConvDoubleToInt16:
|
||||
case glslang::EOpConvFloat16ToInt16:
|
||||
case glslang::EOpConvFloat16ToInt:
|
||||
case glslang::EOpConvFloat16ToInt64:
|
||||
#endif
|
||||
@ -4310,10 +4407,21 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Dec
|
||||
case glslang::EOpConvIntToUint:
|
||||
case glslang::EOpConvUint64ToInt64:
|
||||
case glslang::EOpConvInt64ToUint64:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case glslang::EOpConvUint16ToInt16:
|
||||
case glslang::EOpConvInt16ToUint16:
|
||||
#endif
|
||||
if (builder.isInSpecConstCodeGenMode()) {
|
||||
// Build zero scalar or vector for OpIAdd.
|
||||
zero = (op == glslang::EOpConvUint64ToInt64 ||
|
||||
op == glslang::EOpConvInt64ToUint64) ? builder.makeUint64Constant(0) : builder.makeUintConstant(0);
|
||||
if (op == glslang::EOpConvUint64ToInt64 || op == glslang::EOpConvInt64ToUint64)
|
||||
zero = builder.makeUint64Constant(0);
|
||||
#ifdef AMD_EXTENSIONS
|
||||
else if (op == glslang::EOpConvUint16ToInt16 || op == glslang::EOpConvInt16ToUint16)
|
||||
zero = builder.makeUint16Constant(0);
|
||||
#endif
|
||||
else
|
||||
zero = builder.makeUintConstant(0);
|
||||
|
||||
zero = makeSmearedConstant(zero, vectorSize);
|
||||
// Use OpIAdd, instead of OpBitcast to do the conversion when
|
||||
// generating for OpSpecConstantOp instruction.
|
||||
@ -4328,6 +4436,9 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Dec
|
||||
case glslang::EOpConvFloatToUint64:
|
||||
case glslang::EOpConvDoubleToUint64:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case glslang::EOpConvFloatToUint16:
|
||||
case glslang::EOpConvDoubleToUint16:
|
||||
case glslang::EOpConvFloat16ToUint16:
|
||||
case glslang::EOpConvFloat16ToUint:
|
||||
case glslang::EOpConvFloat16ToUint64:
|
||||
#endif
|
||||
@ -4336,11 +4447,23 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Dec
|
||||
|
||||
case glslang::EOpConvIntToInt64:
|
||||
case glslang::EOpConvInt64ToInt:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case glslang::EOpConvIntToInt16:
|
||||
case glslang::EOpConvInt16ToInt:
|
||||
case glslang::EOpConvInt64ToInt16:
|
||||
case glslang::EOpConvInt16ToInt64:
|
||||
#endif
|
||||
convOp = spv::OpSConvert;
|
||||
break;
|
||||
|
||||
case glslang::EOpConvUintToUint64:
|
||||
case glslang::EOpConvUint64ToUint:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case glslang::EOpConvUintToUint16:
|
||||
case glslang::EOpConvUint16ToUint:
|
||||
case glslang::EOpConvUint64ToUint16:
|
||||
case glslang::EOpConvUint16ToUint64:
|
||||
#endif
|
||||
convOp = spv::OpUConvert;
|
||||
break;
|
||||
|
||||
@ -4348,24 +4471,58 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Dec
|
||||
case glslang::EOpConvInt64ToUint:
|
||||
case glslang::EOpConvUint64ToInt:
|
||||
case glslang::EOpConvUintToInt64:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case glslang::EOpConvInt16ToUint:
|
||||
case glslang::EOpConvUintToInt16:
|
||||
case glslang::EOpConvInt16ToUint64:
|
||||
case glslang::EOpConvUint64ToInt16:
|
||||
case glslang::EOpConvUint16ToInt:
|
||||
case glslang::EOpConvIntToUint16:
|
||||
case glslang::EOpConvUint16ToInt64:
|
||||
case glslang::EOpConvInt64ToUint16:
|
||||
#endif
|
||||
// OpSConvert/OpUConvert + OpBitCast
|
||||
switch (op) {
|
||||
case glslang::EOpConvIntToUint64:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case glslang::EOpConvInt16ToUint64:
|
||||
#endif
|
||||
convOp = spv::OpSConvert;
|
||||
type = builder.makeIntType(64);
|
||||
break;
|
||||
case glslang::EOpConvInt64ToUint:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case glslang::EOpConvInt16ToUint:
|
||||
#endif
|
||||
convOp = spv::OpSConvert;
|
||||
type = builder.makeIntType(32);
|
||||
break;
|
||||
case glslang::EOpConvUint64ToInt:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case glslang::EOpConvUint16ToInt:
|
||||
#endif
|
||||
convOp = spv::OpUConvert;
|
||||
type = builder.makeUintType(32);
|
||||
break;
|
||||
case glslang::EOpConvUintToInt64:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case glslang::EOpConvUint16ToInt64:
|
||||
#endif
|
||||
convOp = spv::OpUConvert;
|
||||
type = builder.makeUintType(64);
|
||||
break;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case glslang::EOpConvUintToInt16:
|
||||
case glslang::EOpConvUint64ToInt16:
|
||||
convOp = spv::OpUConvert;
|
||||
type = builder.makeUintType(16);
|
||||
break;
|
||||
case glslang::EOpConvIntToUint16:
|
||||
case glslang::EOpConvInt64ToUint16:
|
||||
convOp = spv::OpSConvert;
|
||||
type = builder.makeIntType(16);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
assert(0);
|
||||
break;
|
||||
@ -4378,8 +4535,22 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Dec
|
||||
|
||||
if (builder.isInSpecConstCodeGenMode()) {
|
||||
// Build zero scalar or vector for OpIAdd.
|
||||
zero = (op == glslang::EOpConvIntToUint64 ||
|
||||
op == glslang::EOpConvUintToInt64) ? builder.makeUint64Constant(0) : builder.makeUintConstant(0);
|
||||
#ifdef AMD_EXTENSIONS
|
||||
if (op == glslang::EOpConvIntToUint64 || op == glslang::EOpConvUintToInt64 ||
|
||||
op == glslang::EOpConvInt16ToUint64 || op == glslang::EOpConvUint16ToInt64)
|
||||
zero = builder.makeUint64Constant(0);
|
||||
else if (op == glslang::EOpConvIntToUint16 || op == glslang::EOpConvUintToInt16 ||
|
||||
op == glslang::EOpConvInt64ToUint16 || op == glslang::EOpConvUint64ToInt16)
|
||||
zero = builder.makeUint16Constant(0);
|
||||
else
|
||||
zero = builder.makeUintConstant(0);
|
||||
#else
|
||||
if (op == glslang::EOpConvIntToUint64 || op == glslang::EOpConvUintToInt64)
|
||||
zero = builder.makeUint64Constant(0);
|
||||
else
|
||||
zero = builder.makeUintConstant(0);
|
||||
#endif
|
||||
|
||||
zero = makeSmearedConstant(zero, vectorSize);
|
||||
// Use OpIAdd, instead of OpBitcast to do the conversion when
|
||||
// generating for OpSpecConstantOp instruction.
|
||||
@ -4765,10 +4936,11 @@ spv::Id TGlslangToSpvTraverser::CreateInvocationsVectorOperation(spv::Op op, spv
|
||||
|
||||
spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, std::vector<spv::Id>& operands, glslang::TBasicType typeProxy)
|
||||
{
|
||||
bool isUnsigned = typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
bool isUnsigned = typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64 || typeProxy == glslang::EbtUint16;
|
||||
bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble || typeProxy == glslang::EbtFloat16;
|
||||
#else
|
||||
bool isUnsigned = typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64;
|
||||
bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble;
|
||||
#endif
|
||||
|
||||
@ -5353,6 +5525,14 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstUnionArray(const glsla
|
||||
case glslang::EbtUint64:
|
||||
spvConsts.push_back(builder.makeUint64Constant(zero ? 0 : consts[nextConst].getU64Const()));
|
||||
break;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case glslang::EbtInt16:
|
||||
spvConsts.push_back(builder.makeInt16Constant(zero ? 0 : (short)consts[nextConst].getIConst()));
|
||||
break;
|
||||
case glslang::EbtUint16:
|
||||
spvConsts.push_back(builder.makeUint16Constant(zero ? 0 : (unsigned short)consts[nextConst].getUConst()));
|
||||
break;
|
||||
#endif
|
||||
case glslang::EbtFloat:
|
||||
spvConsts.push_back(builder.makeFloatConstant(zero ? 0.0F : (float)consts[nextConst].getDConst()));
|
||||
break;
|
||||
@ -5390,6 +5570,14 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstUnionArray(const glsla
|
||||
case glslang::EbtUint64:
|
||||
scalar = builder.makeUint64Constant(zero ? 0 : consts[nextConst].getU64Const(), specConstant);
|
||||
break;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case glslang::EbtInt16:
|
||||
scalar = builder.makeInt16Constant(zero ? 0 : (short)consts[nextConst].getIConst(), specConstant);
|
||||
break;
|
||||
case glslang::EbtUint16:
|
||||
scalar = builder.makeUint16Constant(zero ? 0 : (unsigned short)consts[nextConst].getUConst(), specConstant);
|
||||
break;
|
||||
#endif
|
||||
case glslang::EbtFloat:
|
||||
scalar = builder.makeFloatConstant(zero ? 0.0F : (float)consts[nextConst].getDConst(), specConstant);
|
||||
break;
|
||||
|
@ -214,6 +214,10 @@ public:
|
||||
Id makeUintConstant(unsigned u, bool specConstant = false) { return makeIntConstant(makeUintType(32), u, specConstant); }
|
||||
Id makeInt64Constant(long long i, bool specConstant = false) { return makeInt64Constant(makeIntType(64), (unsigned long long)i, specConstant); }
|
||||
Id makeUint64Constant(unsigned long long u, bool specConstant = false) { return makeInt64Constant(makeUintType(64), u, specConstant); }
|
||||
#ifdef AMD_EXTENSIONS
|
||||
Id makeInt16Constant(short i, bool specConstant = false) { return makeIntConstant(makeIntType(16), (unsigned)((unsigned short)i), specConstant); }
|
||||
Id makeUint16Constant(unsigned short u, bool specConstant = false) { return makeIntConstant(makeUintType(16), (unsigned)u, specConstant); }
|
||||
#endif
|
||||
Id makeFloatConstant(float f, bool specConstant = false);
|
||||
Id makeDoubleConstant(double d, bool specConstant = false);
|
||||
#ifdef AMD_EXTENSIONS
|
||||
|
779
Test/baseResults/spv.int16.frag.out
Normal file
779
Test/baseResults/spv.int16.frag.out
Normal file
@ -0,0 +1,779 @@
|
||||
spv.int16.frag
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80001
|
||||
// Id's are bound by 561
|
||||
|
||||
Capability Shader
|
||||
Capability Float16
|
||||
Capability Float64
|
||||
Capability Int64
|
||||
Capability Int16
|
||||
Capability StorageUniform16
|
||||
Capability StorageInputOutput16
|
||||
Extension "SPV_AMD_gpu_shader_half_float"
|
||||
Extension "SPV_AMD_gpu_shader_int16"
|
||||
Extension "SPV_KHR_16bit_storage"
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main" 520 522
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
Source GLSL 450
|
||||
SourceExtension "GL_AMD_gpu_shader_half_float"
|
||||
SourceExtension "GL_AMD_gpu_shader_int16"
|
||||
SourceExtension "GL_ARB_gpu_shader_int64"
|
||||
Name 4 "main"
|
||||
Name 6 "literal("
|
||||
Name 8 "operators("
|
||||
Name 10 "typeCast("
|
||||
Name 12 "builtinFuncs("
|
||||
Name 16 "u16"
|
||||
Name 25 "Uniforms"
|
||||
MemberName 25(Uniforms) 0 "i"
|
||||
Name 27 ""
|
||||
Name 34 "indexable"
|
||||
Name 45 "indexable"
|
||||
Name 51 "u16v"
|
||||
Name 57 "i16"
|
||||
Name 70 "u16"
|
||||
Name 108 "i"
|
||||
Name 130 "b"
|
||||
Name 151 "u"
|
||||
Name 190 "i16v"
|
||||
Name 193 "bv"
|
||||
Name 201 "u16v"
|
||||
Name 214 "iv"
|
||||
Name 227 "uv"
|
||||
Name 241 "fv"
|
||||
Name 253 "dv"
|
||||
Name 265 "f16v"
|
||||
Name 277 "i64v"
|
||||
Name 291 "u64v"
|
||||
Name 306 "i16v"
|
||||
Name 312 "i16"
|
||||
Name 320 "u16v"
|
||||
Name 322 "u16"
|
||||
Name 394 "f16v"
|
||||
Name 397 "exp"
|
||||
Name 398 "ResType"
|
||||
Name 419 "packi"
|
||||
Name 424 "packu"
|
||||
Name 433 "packi64"
|
||||
Name 442 "packu64"
|
||||
Name 451 "bv"
|
||||
Name 516 "Block"
|
||||
MemberName 516(Block) 0 "i16v"
|
||||
MemberName 516(Block) 1 "u16"
|
||||
Name 518 "block"
|
||||
Name 520 "iu16v"
|
||||
Name 522 "ii16"
|
||||
Name 523 "si64"
|
||||
Name 524 "su64"
|
||||
Name 525 "si"
|
||||
Name 526 "su"
|
||||
Name 527 "sb"
|
||||
Name 528 "si16"
|
||||
Name 529 "su16"
|
||||
MemberDecorate 25(Uniforms) 0 Offset 0
|
||||
Decorate 25(Uniforms) Block
|
||||
Decorate 27 DescriptorSet 0
|
||||
Decorate 27 Binding 0
|
||||
MemberDecorate 516(Block) 0 Offset 0
|
||||
MemberDecorate 516(Block) 1 Offset 6
|
||||
Decorate 516(Block) Block
|
||||
Decorate 518(block) DescriptorSet 0
|
||||
Decorate 518(block) Binding 1
|
||||
Decorate 520(iu16v) Flat
|
||||
Decorate 520(iu16v) Location 0
|
||||
Decorate 522(ii16) Flat
|
||||
Decorate 522(ii16) Location 1
|
||||
Decorate 523(si64) SpecId 100
|
||||
Decorate 524(su64) SpecId 101
|
||||
Decorate 525(si) SpecId 102
|
||||
Decorate 526(su) SpecId 103
|
||||
Decorate 527(sb) SpecId 104
|
||||
Decorate 528(si16) SpecId 105
|
||||
Decorate 529(su16) SpecId 106
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
14: TypeInt 16 0
|
||||
15: TypePointer Function 14(int)
|
||||
17: TypeInt 16 1
|
||||
18: TypeInt 32 0
|
||||
19: 18(int) Constant 3
|
||||
20: TypeArray 17(int) 19
|
||||
21: 17(int) Constant 273
|
||||
22: 17(int) Constant 65534
|
||||
23: 17(int) Constant 256
|
||||
24: 20 ConstantComposite 21 22 23
|
||||
25(Uniforms): TypeStruct 18(int)
|
||||
26: TypePointer Uniform 25(Uniforms)
|
||||
27: 26(ptr) Variable Uniform
|
||||
28: TypeInt 32 1
|
||||
29: 28(int) Constant 0
|
||||
30: TypePointer Uniform 18(int)
|
||||
33: TypePointer Function 20
|
||||
35: TypePointer Function 17(int)
|
||||
39: TypeArray 14(int) 19
|
||||
40: 14(int) Constant 65535
|
||||
41: 39 ConstantComposite 40 40 40
|
||||
44: TypePointer Function 39
|
||||
49: TypeVector 14(int) 3
|
||||
50: TypePointer Function 49(ivec3)
|
||||
53: 17(int) Constant 1
|
||||
54: TypeVector 17(int) 3
|
||||
107: TypePointer Function 28(int)
|
||||
111: TypeVector 28(int) 3
|
||||
114: 18(int) Constant 1
|
||||
120: 18(int) Constant 2
|
||||
128: TypeBool
|
||||
129: TypePointer Function 128(bool)
|
||||
131: 18(int) Constant 0
|
||||
150: TypePointer Function 18(int)
|
||||
188: TypeVector 17(int) 2
|
||||
189: TypePointer Function 188(ivec2)
|
||||
191: TypeVector 128(bool) 2
|
||||
192: TypePointer Function 191(bvec2)
|
||||
195: 17(int) Constant 0
|
||||
196: 188(ivec2) ConstantComposite 195 195
|
||||
197: 188(ivec2) ConstantComposite 53 53
|
||||
199: TypeVector 14(int) 2
|
||||
200: TypePointer Function 199(ivec2)
|
||||
203: 14(int) Constant 0
|
||||
204: 14(int) Constant 1
|
||||
205: 199(ivec2) ConstantComposite 203 203
|
||||
206: 199(ivec2) ConstantComposite 204 204
|
||||
212: TypeVector 28(int) 2
|
||||
213: TypePointer Function 212(ivec2)
|
||||
223: TypeVector 18(int) 2
|
||||
226: TypePointer Function 223(ivec2)
|
||||
238: TypeFloat 32
|
||||
239: TypeVector 238(float) 2
|
||||
240: TypePointer Function 239(fvec2)
|
||||
250: TypeFloat 64
|
||||
251: TypeVector 250(float) 2
|
||||
252: TypePointer Function 251(fvec2)
|
||||
262: TypeFloat 16
|
||||
263: TypeVector 262(float) 2
|
||||
264: TypePointer Function 263(fvec2)
|
||||
274: TypeInt 64 1
|
||||
275: TypeVector 274(int) 2
|
||||
276: TypePointer Function 275(ivec2)
|
||||
286: TypeInt 64 0
|
||||
287: TypeVector 286(int) 2
|
||||
290: TypePointer Function 287(ivec2)
|
||||
317: 17(int) Constant 65535
|
||||
318: 188(ivec2) ConstantComposite 317 317
|
||||
327: 49(ivec3) ConstantComposite 203 203 203
|
||||
369: 128(bool) ConstantTrue
|
||||
376: 128(bool) ConstantFalse
|
||||
377: 191(bvec2) ConstantComposite 376 376
|
||||
389: TypeVector 128(bool) 3
|
||||
390: 389(bvec3) ConstantComposite 376 376 376
|
||||
392: TypeVector 262(float) 3
|
||||
393: TypePointer Function 392(fvec3)
|
||||
396: TypePointer Function 54(ivec3)
|
||||
398(ResType): TypeStruct 392(fvec3) 54(ivec3)
|
||||
408: TypePointer Function 262(float)
|
||||
432: TypePointer Function 274(int)
|
||||
435: TypeVector 17(int) 4
|
||||
441: TypePointer Function 286(int)
|
||||
444: TypeVector 14(int) 4
|
||||
450: TypePointer Function 389(bvec3)
|
||||
516(Block): TypeStruct 54(ivec3) 14(int)
|
||||
517: TypePointer Uniform 516(Block)
|
||||
518(block): 517(ptr) Variable Uniform
|
||||
519: TypePointer Input 49(ivec3)
|
||||
520(iu16v): 519(ptr) Variable Input
|
||||
521: TypePointer Input 17(int)
|
||||
522(ii16): 521(ptr) Variable Input
|
||||
523(si64): 274(int) SpecConstant 4294967286 4294967295
|
||||
524(su64): 286(int) SpecConstant 20 0
|
||||
525(si): 28(int) SpecConstant 4294967291
|
||||
526(su): 18(int) SpecConstant 4
|
||||
527(sb): 128(bool) SpecConstantTrue
|
||||
528(si16): 17(int) SpecConstant 65531
|
||||
529(su16): 14(int) SpecConstant 4
|
||||
530: 128(bool) SpecConstantOp 171 528(si16) 203
|
||||
531: 128(bool) SpecConstantOp 171 529(su16) 203
|
||||
532: 17(int) SpecConstantOp 169 527(sb) 53 195
|
||||
533: 14(int) SpecConstantOp 169 527(sb) 204 203
|
||||
534: 28(int) SpecConstantOp 114 528(si16)
|
||||
535: 18(int) SpecConstantOp 113 529(su16)
|
||||
536: 28(int) SpecConstantOp 128 535 131
|
||||
537: 17(int) SpecConstantOp 114 525(si)
|
||||
538: 17(int) SpecConstantOp 114 525(si)
|
||||
539: 14(int) SpecConstantOp 128 538 203
|
||||
540: 28(int) SpecConstantOp 114 528(si16)
|
||||
541: 18(int) SpecConstantOp 128 540 131
|
||||
542: 18(int) SpecConstantOp 113 529(su16)
|
||||
543: 14(int) SpecConstantOp 113 526(su)
|
||||
544: 17(int) SpecConstantOp 128 543 203
|
||||
545: 14(int) SpecConstantOp 113 526(su)
|
||||
546: 274(int) SpecConstantOp 114 528(si16)
|
||||
547: 286(int) SpecConstantOp 113 529(su16)
|
||||
548: 286(int) Constant 0 0
|
||||
549: 274(int) SpecConstantOp 128 547 548
|
||||
550: 17(int) SpecConstantOp 114 523(si64)
|
||||
551: 17(int) SpecConstantOp 114 523(si64)
|
||||
552: 14(int) SpecConstantOp 128 551 203
|
||||
553: 274(int) SpecConstantOp 114 528(si16)
|
||||
554: 286(int) SpecConstantOp 128 553 548
|
||||
555: 286(int) SpecConstantOp 113 529(su16)
|
||||
556: 14(int) SpecConstantOp 113 524(su64)
|
||||
557: 17(int) SpecConstantOp 128 556 203
|
||||
558: 14(int) SpecConstantOp 113 524(su64)
|
||||
559: 14(int) SpecConstantOp 128 528(si16) 203
|
||||
560: 17(int) SpecConstantOp 128 529(su16) 203
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
512: 2 FunctionCall 6(literal()
|
||||
513: 2 FunctionCall 8(operators()
|
||||
514: 2 FunctionCall 10(typeCast()
|
||||
515: 2 FunctionCall 12(builtinFuncs()
|
||||
Return
|
||||
FunctionEnd
|
||||
6(literal(): 2 Function None 3
|
||||
7: Label
|
||||
16(u16): 15(ptr) Variable Function
|
||||
34(indexable): 33(ptr) Variable Function
|
||||
45(indexable): 44(ptr) Variable Function
|
||||
31: 30(ptr) AccessChain 27 29
|
||||
32: 18(int) Load 31
|
||||
Store 34(indexable) 24
|
||||
36: 35(ptr) AccessChain 34(indexable) 32
|
||||
37: 17(int) Load 36
|
||||
38: 14(int) Bitcast 37
|
||||
42: 30(ptr) AccessChain 27 29
|
||||
43: 18(int) Load 42
|
||||
Store 45(indexable) 41
|
||||
46: 15(ptr) AccessChain 45(indexable) 43
|
||||
47: 14(int) Load 46
|
||||
48: 14(int) IAdd 38 47
|
||||
Store 16(u16) 48
|
||||
Return
|
||||
FunctionEnd
|
||||
8(operators(): 2 Function None 3
|
||||
9: Label
|
||||
51(u16v): 50(ptr) Variable Function
|
||||
57(i16): 35(ptr) Variable Function
|
||||
70(u16): 15(ptr) Variable Function
|
||||
108(i): 107(ptr) Variable Function
|
||||
130(b): 129(ptr) Variable Function
|
||||
151(u): 150(ptr) Variable Function
|
||||
52: 49(ivec3) Load 51(u16v)
|
||||
55: 54(ivec3) CompositeConstruct 53 53 53
|
||||
56: 49(ivec3) IAdd 52 55
|
||||
Store 51(u16v) 56
|
||||
58: 17(int) Load 57(i16)
|
||||
59: 17(int) ISub 58 53
|
||||
Store 57(i16) 59
|
||||
60: 17(int) Load 57(i16)
|
||||
61: 17(int) IAdd 60 53
|
||||
Store 57(i16) 61
|
||||
62: 49(ivec3) Load 51(u16v)
|
||||
63: 54(ivec3) CompositeConstruct 53 53 53
|
||||
64: 49(ivec3) ISub 62 63
|
||||
Store 51(u16v) 64
|
||||
65: 49(ivec3) Load 51(u16v)
|
||||
66: 49(ivec3) Not 65
|
||||
Store 51(u16v) 66
|
||||
67: 17(int) Load 57(i16)
|
||||
Store 57(i16) 67
|
||||
68: 49(ivec3) Load 51(u16v)
|
||||
69: 49(ivec3) SNegate 68
|
||||
Store 51(u16v) 69
|
||||
71: 17(int) Load 57(i16)
|
||||
72: 14(int) Bitcast 71
|
||||
73: 14(int) Load 70(u16)
|
||||
74: 14(int) IAdd 73 72
|
||||
Store 70(u16) 74
|
||||
75: 49(ivec3) Load 51(u16v)
|
||||
76: 49(ivec3) Load 51(u16v)
|
||||
77: 49(ivec3) ISub 76 75
|
||||
Store 51(u16v) 77
|
||||
78: 17(int) Load 57(i16)
|
||||
79: 17(int) Load 57(i16)
|
||||
80: 17(int) IMul 79 78
|
||||
Store 57(i16) 80
|
||||
81: 49(ivec3) Load 51(u16v)
|
||||
82: 49(ivec3) Load 51(u16v)
|
||||
83: 49(ivec3) UDiv 82 81
|
||||
Store 51(u16v) 83
|
||||
84: 17(int) Load 57(i16)
|
||||
85: 14(int) Bitcast 84
|
||||
86: 49(ivec3) Load 51(u16v)
|
||||
87: 49(ivec3) CompositeConstruct 85 85 85
|
||||
88: 49(ivec3) UMod 86 87
|
||||
Store 51(u16v) 88
|
||||
89: 49(ivec3) Load 51(u16v)
|
||||
90: 49(ivec3) Load 51(u16v)
|
||||
91: 49(ivec3) IAdd 89 90
|
||||
Store 51(u16v) 91
|
||||
92: 17(int) Load 57(i16)
|
||||
93: 14(int) Bitcast 92
|
||||
94: 14(int) Load 70(u16)
|
||||
95: 14(int) ISub 93 94
|
||||
Store 70(u16) 95
|
||||
96: 49(ivec3) Load 51(u16v)
|
||||
97: 17(int) Load 57(i16)
|
||||
98: 14(int) Bitcast 97
|
||||
99: 49(ivec3) CompositeConstruct 98 98 98
|
||||
100: 49(ivec3) IMul 96 99
|
||||
Store 51(u16v) 100
|
||||
101: 17(int) Load 57(i16)
|
||||
102: 17(int) Load 57(i16)
|
||||
103: 17(int) IMul 101 102
|
||||
Store 57(i16) 103
|
||||
104: 17(int) Load 57(i16)
|
||||
105: 17(int) Load 57(i16)
|
||||
106: 17(int) SMod 104 105
|
||||
Store 57(i16) 106
|
||||
109: 28(int) Load 108(i)
|
||||
110: 49(ivec3) Load 51(u16v)
|
||||
112: 111(ivec3) CompositeConstruct 109 109 109
|
||||
113: 49(ivec3) ShiftLeftLogical 110 112
|
||||
Store 51(u16v) 113
|
||||
115: 15(ptr) AccessChain 51(u16v) 114
|
||||
116: 14(int) Load 115
|
||||
117: 17(int) Load 57(i16)
|
||||
118: 17(int) ShiftRightArithmetic 117 116
|
||||
Store 57(i16) 118
|
||||
119: 17(int) Load 57(i16)
|
||||
121: 15(ptr) AccessChain 51(u16v) 120
|
||||
122: 14(int) Load 121
|
||||
123: 17(int) ShiftLeftLogical 119 122
|
||||
Store 57(i16) 123
|
||||
124: 49(ivec3) Load 51(u16v)
|
||||
125: 17(int) Load 57(i16)
|
||||
126: 54(ivec3) CompositeConstruct 125 125 125
|
||||
127: 49(ivec3) ShiftLeftLogical 124 126
|
||||
Store 51(u16v) 127
|
||||
132: 15(ptr) AccessChain 51(u16v) 131
|
||||
133: 14(int) Load 132
|
||||
134: 17(int) Load 57(i16)
|
||||
135: 14(int) Bitcast 134
|
||||
136: 128(bool) INotEqual 133 135
|
||||
Store 130(b) 136
|
||||
137: 17(int) Load 57(i16)
|
||||
138: 14(int) Bitcast 137
|
||||
139: 15(ptr) AccessChain 51(u16v) 131
|
||||
140: 14(int) Load 139
|
||||
141: 128(bool) IEqual 138 140
|
||||
Store 130(b) 141
|
||||
142: 15(ptr) AccessChain 51(u16v) 131
|
||||
143: 14(int) Load 142
|
||||
144: 15(ptr) AccessChain 51(u16v) 114
|
||||
145: 14(int) Load 144
|
||||
146: 128(bool) UGreaterThan 143 145
|
||||
Store 130(b) 146
|
||||
147: 17(int) Load 57(i16)
|
||||
148: 28(int) SConvert 147
|
||||
149: 18(int) Bitcast 148
|
||||
152: 18(int) Load 151(u)
|
||||
153: 128(bool) ULessThan 149 152
|
||||
Store 130(b) 153
|
||||
154: 15(ptr) AccessChain 51(u16v) 114
|
||||
155: 14(int) Load 154
|
||||
156: 15(ptr) AccessChain 51(u16v) 131
|
||||
157: 14(int) Load 156
|
||||
158: 128(bool) UGreaterThanEqual 155 157
|
||||
Store 130(b) 158
|
||||
159: 17(int) Load 57(i16)
|
||||
160: 28(int) SConvert 159
|
||||
161: 28(int) Load 108(i)
|
||||
162: 128(bool) SLessThanEqual 160 161
|
||||
Store 130(b) 162
|
||||
163: 17(int) Load 57(i16)
|
||||
164: 14(int) Bitcast 163
|
||||
165: 49(ivec3) Load 51(u16v)
|
||||
166: 49(ivec3) CompositeConstruct 164 164 164
|
||||
167: 49(ivec3) BitwiseOr 165 166
|
||||
Store 51(u16v) 167
|
||||
168: 17(int) Load 57(i16)
|
||||
169: 14(int) Bitcast 168
|
||||
170: 14(int) Load 70(u16)
|
||||
171: 14(int) BitwiseOr 169 170
|
||||
Store 70(u16) 171
|
||||
172: 17(int) Load 57(i16)
|
||||
173: 17(int) Load 57(i16)
|
||||
174: 17(int) BitwiseAnd 173 172
|
||||
Store 57(i16) 174
|
||||
175: 49(ivec3) Load 51(u16v)
|
||||
176: 49(ivec3) Load 51(u16v)
|
||||
177: 49(ivec3) BitwiseAnd 175 176
|
||||
Store 51(u16v) 177
|
||||
178: 17(int) Load 57(i16)
|
||||
179: 14(int) Bitcast 178
|
||||
180: 49(ivec3) Load 51(u16v)
|
||||
181: 49(ivec3) CompositeConstruct 179 179 179
|
||||
182: 49(ivec3) BitwiseXor 180 181
|
||||
Store 51(u16v) 182
|
||||
183: 49(ivec3) Load 51(u16v)
|
||||
184: 17(int) Load 57(i16)
|
||||
185: 14(int) Bitcast 184
|
||||
186: 49(ivec3) CompositeConstruct 185 185 185
|
||||
187: 49(ivec3) BitwiseXor 183 186
|
||||
Store 51(u16v) 187
|
||||
Return
|
||||
FunctionEnd
|
||||
10(typeCast(): 2 Function None 3
|
||||
11: Label
|
||||
190(i16v): 189(ptr) Variable Function
|
||||
193(bv): 192(ptr) Variable Function
|
||||
201(u16v): 200(ptr) Variable Function
|
||||
214(iv): 213(ptr) Variable Function
|
||||
227(uv): 226(ptr) Variable Function
|
||||
241(fv): 240(ptr) Variable Function
|
||||
253(dv): 252(ptr) Variable Function
|
||||
265(f16v): 264(ptr) Variable Function
|
||||
277(i64v): 276(ptr) Variable Function
|
||||
291(u64v): 290(ptr) Variable Function
|
||||
194: 191(bvec2) Load 193(bv)
|
||||
198: 188(ivec2) Select 194 197 196
|
||||
Store 190(i16v) 198
|
||||
202: 191(bvec2) Load 193(bv)
|
||||
207: 199(ivec2) Select 202 206 205
|
||||
Store 201(u16v) 207
|
||||
208: 188(ivec2) Load 190(i16v)
|
||||
209: 191(bvec2) INotEqual 208 205
|
||||
Store 193(bv) 209
|
||||
210: 199(ivec2) Load 201(u16v)
|
||||
211: 191(bvec2) INotEqual 210 205
|
||||
Store 193(bv) 211
|
||||
215: 212(ivec2) Load 214(iv)
|
||||
216: 188(ivec2) SConvert 215
|
||||
Store 190(i16v) 216
|
||||
217: 212(ivec2) Load 214(iv)
|
||||
218: 188(ivec2) SConvert 217
|
||||
219: 199(ivec2) Bitcast 218
|
||||
Store 201(u16v) 219
|
||||
220: 188(ivec2) Load 190(i16v)
|
||||
221: 212(ivec2) SConvert 220
|
||||
Store 214(iv) 221
|
||||
222: 199(ivec2) Load 201(u16v)
|
||||
224: 223(ivec2) UConvert 222
|
||||
225: 212(ivec2) Bitcast 224
|
||||
Store 214(iv) 225
|
||||
228: 223(ivec2) Load 227(uv)
|
||||
229: 199(ivec2) UConvert 228
|
||||
230: 188(ivec2) Bitcast 229
|
||||
Store 190(i16v) 230
|
||||
231: 223(ivec2) Load 227(uv)
|
||||
232: 199(ivec2) UConvert 231
|
||||
Store 201(u16v) 232
|
||||
233: 188(ivec2) Load 190(i16v)
|
||||
234: 212(ivec2) SConvert 233
|
||||
235: 223(ivec2) Bitcast 234
|
||||
Store 227(uv) 235
|
||||
236: 199(ivec2) Load 201(u16v)
|
||||
237: 223(ivec2) UConvert 236
|
||||
Store 227(uv) 237
|
||||
242: 239(fvec2) Load 241(fv)
|
||||
243: 188(ivec2) ConvertFToS 242
|
||||
Store 190(i16v) 243
|
||||
244: 239(fvec2) Load 241(fv)
|
||||
245: 199(ivec2) ConvertFToU 244
|
||||
Store 201(u16v) 245
|
||||
246: 188(ivec2) Load 190(i16v)
|
||||
247: 239(fvec2) ConvertSToF 246
|
||||
Store 241(fv) 247
|
||||
248: 199(ivec2) Load 201(u16v)
|
||||
249: 239(fvec2) ConvertUToF 248
|
||||
Store 241(fv) 249
|
||||
254: 251(fvec2) Load 253(dv)
|
||||
255: 188(ivec2) ConvertFToS 254
|
||||
Store 190(i16v) 255
|
||||
256: 251(fvec2) Load 253(dv)
|
||||
257: 199(ivec2) ConvertFToU 256
|
||||
Store 201(u16v) 257
|
||||
258: 188(ivec2) Load 190(i16v)
|
||||
259: 251(fvec2) ConvertSToF 258
|
||||
Store 253(dv) 259
|
||||
260: 199(ivec2) Load 201(u16v)
|
||||
261: 251(fvec2) ConvertUToF 260
|
||||
Store 253(dv) 261
|
||||
266: 263(fvec2) Load 265(f16v)
|
||||
267: 188(ivec2) ConvertFToS 266
|
||||
Store 190(i16v) 267
|
||||
268: 263(fvec2) Load 265(f16v)
|
||||
269: 199(ivec2) ConvertFToU 268
|
||||
Store 201(u16v) 269
|
||||
270: 188(ivec2) Load 190(i16v)
|
||||
271: 263(fvec2) ConvertSToF 270
|
||||
Store 265(f16v) 271
|
||||
272: 199(ivec2) Load 201(u16v)
|
||||
273: 263(fvec2) ConvertUToF 272
|
||||
Store 265(f16v) 273
|
||||
278: 275(ivec2) Load 277(i64v)
|
||||
279: 188(ivec2) SConvert 278
|
||||
Store 190(i16v) 279
|
||||
280: 275(ivec2) Load 277(i64v)
|
||||
281: 188(ivec2) SConvert 280
|
||||
282: 199(ivec2) Bitcast 281
|
||||
Store 201(u16v) 282
|
||||
283: 188(ivec2) Load 190(i16v)
|
||||
284: 275(ivec2) SConvert 283
|
||||
Store 277(i64v) 284
|
||||
285: 199(ivec2) Load 201(u16v)
|
||||
288: 287(ivec2) UConvert 285
|
||||
289: 275(ivec2) Bitcast 288
|
||||
Store 277(i64v) 289
|
||||
292: 287(ivec2) Load 291(u64v)
|
||||
293: 199(ivec2) UConvert 292
|
||||
294: 188(ivec2) Bitcast 293
|
||||
Store 190(i16v) 294
|
||||
295: 287(ivec2) Load 291(u64v)
|
||||
296: 199(ivec2) UConvert 295
|
||||
Store 201(u16v) 296
|
||||
297: 188(ivec2) Load 190(i16v)
|
||||
298: 275(ivec2) SConvert 297
|
||||
299: 287(ivec2) Bitcast 298
|
||||
Store 291(u64v) 299
|
||||
300: 199(ivec2) Load 201(u16v)
|
||||
301: 287(ivec2) UConvert 300
|
||||
Store 291(u64v) 301
|
||||
302: 199(ivec2) Load 201(u16v)
|
||||
303: 188(ivec2) Bitcast 302
|
||||
Store 190(i16v) 303
|
||||
304: 188(ivec2) Load 190(i16v)
|
||||
305: 199(ivec2) Bitcast 304
|
||||
Store 201(u16v) 305
|
||||
Return
|
||||
FunctionEnd
|
||||
12(builtinFuncs(): 2 Function None 3
|
||||
13: Label
|
||||
306(i16v): 189(ptr) Variable Function
|
||||
312(i16): 35(ptr) Variable Function
|
||||
320(u16v): 50(ptr) Variable Function
|
||||
322(u16): 15(ptr) Variable Function
|
||||
394(f16v): 393(ptr) Variable Function
|
||||
397(exp): 396(ptr) Variable Function
|
||||
419(packi): 107(ptr) Variable Function
|
||||
424(packu): 150(ptr) Variable Function
|
||||
433(packi64): 432(ptr) Variable Function
|
||||
442(packu64): 441(ptr) Variable Function
|
||||
451(bv): 450(ptr) Variable Function
|
||||
307: 188(ivec2) Load 306(i16v)
|
||||
308: 188(ivec2) ExtInst 1(GLSL.std.450) 5(SAbs) 307
|
||||
Store 306(i16v) 308
|
||||
309: 188(ivec2) Load 306(i16v)
|
||||
310: 188(ivec2) ExtInst 1(GLSL.std.450) 7(SSign) 309
|
||||
Store 306(i16v) 310
|
||||
311: 188(ivec2) Load 306(i16v)
|
||||
313: 17(int) Load 312(i16)
|
||||
314: 188(ivec2) CompositeConstruct 313 313
|
||||
315: 188(ivec2) ExtInst 1(GLSL.std.450) 39(SMin) 311 314
|
||||
Store 306(i16v) 315
|
||||
316: 188(ivec2) Load 306(i16v)
|
||||
319: 188(ivec2) ExtInst 1(GLSL.std.450) 39(SMin) 316 318
|
||||
Store 306(i16v) 319
|
||||
321: 49(ivec3) Load 320(u16v)
|
||||
323: 14(int) Load 322(u16)
|
||||
324: 49(ivec3) CompositeConstruct 323 323 323
|
||||
325: 49(ivec3) ExtInst 1(GLSL.std.450) 38(UMin) 321 324
|
||||
Store 320(u16v) 325
|
||||
326: 49(ivec3) Load 320(u16v)
|
||||
328: 49(ivec3) ExtInst 1(GLSL.std.450) 38(UMin) 326 327
|
||||
Store 320(u16v) 328
|
||||
329: 188(ivec2) Load 306(i16v)
|
||||
330: 17(int) Load 312(i16)
|
||||
331: 188(ivec2) CompositeConstruct 330 330
|
||||
332: 188(ivec2) ExtInst 1(GLSL.std.450) 42(SMax) 329 331
|
||||
Store 306(i16v) 332
|
||||
333: 188(ivec2) Load 306(i16v)
|
||||
334: 188(ivec2) ExtInst 1(GLSL.std.450) 42(SMax) 333 318
|
||||
Store 306(i16v) 334
|
||||
335: 49(ivec3) Load 320(u16v)
|
||||
336: 14(int) Load 322(u16)
|
||||
337: 49(ivec3) CompositeConstruct 336 336 336
|
||||
338: 49(ivec3) ExtInst 1(GLSL.std.450) 41(UMax) 335 337
|
||||
Store 320(u16v) 338
|
||||
339: 49(ivec3) Load 320(u16v)
|
||||
340: 49(ivec3) ExtInst 1(GLSL.std.450) 41(UMax) 339 327
|
||||
Store 320(u16v) 340
|
||||
341: 188(ivec2) Load 306(i16v)
|
||||
342: 17(int) Load 312(i16)
|
||||
343: 17(int) SNegate 342
|
||||
344: 17(int) Load 312(i16)
|
||||
345: 188(ivec2) CompositeConstruct 343 343
|
||||
346: 188(ivec2) CompositeConstruct 344 344
|
||||
347: 188(ivec2) ExtInst 1(GLSL.std.450) 45(SClamp) 341 345 346
|
||||
Store 306(i16v) 347
|
||||
348: 188(ivec2) Load 306(i16v)
|
||||
349: 188(ivec2) Load 306(i16v)
|
||||
350: 188(ivec2) SNegate 349
|
||||
351: 188(ivec2) Load 306(i16v)
|
||||
352: 188(ivec2) ExtInst 1(GLSL.std.450) 45(SClamp) 348 350 351
|
||||
Store 306(i16v) 352
|
||||
353: 49(ivec3) Load 320(u16v)
|
||||
354: 14(int) Load 322(u16)
|
||||
355: 14(int) SNegate 354
|
||||
356: 14(int) Load 322(u16)
|
||||
357: 49(ivec3) CompositeConstruct 355 355 355
|
||||
358: 49(ivec3) CompositeConstruct 356 356 356
|
||||
359: 49(ivec3) ExtInst 1(GLSL.std.450) 44(UClamp) 353 357 358
|
||||
Store 320(u16v) 359
|
||||
360: 49(ivec3) Load 320(u16v)
|
||||
361: 49(ivec3) Load 320(u16v)
|
||||
362: 49(ivec3) SNegate 361
|
||||
363: 49(ivec3) Load 320(u16v)
|
||||
364: 49(ivec3) ExtInst 1(GLSL.std.450) 44(UClamp) 360 362 363
|
||||
Store 320(u16v) 364
|
||||
365: 35(ptr) AccessChain 306(i16v) 131
|
||||
366: 17(int) Load 365
|
||||
367: 35(ptr) AccessChain 306(i16v) 114
|
||||
368: 17(int) Load 367
|
||||
370: 17(int) Select 369 368 366
|
||||
Store 312(i16) 370
|
||||
371: 17(int) Load 312(i16)
|
||||
372: 188(ivec2) CompositeConstruct 371 371
|
||||
373: 17(int) Load 312(i16)
|
||||
374: 17(int) SNegate 373
|
||||
375: 188(ivec2) CompositeConstruct 374 374
|
||||
378: 188(ivec2) Select 377 375 372
|
||||
Store 306(i16v) 378
|
||||
379: 15(ptr) AccessChain 320(u16v) 131
|
||||
380: 14(int) Load 379
|
||||
381: 15(ptr) AccessChain 320(u16v) 114
|
||||
382: 14(int) Load 381
|
||||
383: 14(int) Select 369 382 380
|
||||
Store 322(u16) 383
|
||||
384: 14(int) Load 322(u16)
|
||||
385: 49(ivec3) CompositeConstruct 384 384 384
|
||||
386: 14(int) Load 322(u16)
|
||||
387: 14(int) SNegate 386
|
||||
388: 49(ivec3) CompositeConstruct 387 387 387
|
||||
391: 49(ivec3) Select 390 388 385
|
||||
Store 320(u16v) 391
|
||||
395: 392(fvec3) Load 394(f16v)
|
||||
399:398(ResType) ExtInst 1(GLSL.std.450) 52(FrexpStruct) 395
|
||||
400: 54(ivec3) CompositeExtract 399 1
|
||||
Store 397(exp) 400
|
||||
401: 392(fvec3) CompositeExtract 399 0
|
||||
Store 394(f16v) 401
|
||||
402: 392(fvec3) Load 394(f16v)
|
||||
403: 54(ivec3) Load 397(exp)
|
||||
404: 392(fvec3) ExtInst 1(GLSL.std.450) 53(Ldexp) 402 403
|
||||
Store 394(f16v) 404
|
||||
405: 392(fvec3) Load 394(f16v)
|
||||
406: 263(fvec2) VectorShuffle 405 405 0 1
|
||||
407: 188(ivec2) Bitcast 406
|
||||
Store 306(i16v) 407
|
||||
409: 408(ptr) AccessChain 394(f16v) 120
|
||||
410: 262(float) Load 409
|
||||
411: 14(int) Bitcast 410
|
||||
412: 15(ptr) AccessChain 320(u16v) 131
|
||||
Store 412 411
|
||||
413: 188(ivec2) Load 306(i16v)
|
||||
414: 263(fvec2) Bitcast 413
|
||||
415: 392(fvec3) Load 394(f16v)
|
||||
416: 392(fvec3) VectorShuffle 415 414 3 4 2
|
||||
Store 394(f16v) 416
|
||||
417: 49(ivec3) Load 320(u16v)
|
||||
418: 392(fvec3) Bitcast 417
|
||||
Store 394(f16v) 418
|
||||
420: 188(ivec2) Load 306(i16v)
|
||||
421: 28(int) Bitcast 420
|
||||
Store 419(packi) 421
|
||||
422: 28(int) Load 419(packi)
|
||||
423: 188(ivec2) Bitcast 422
|
||||
Store 306(i16v) 423
|
||||
425: 49(ivec3) Load 320(u16v)
|
||||
426: 199(ivec2) VectorShuffle 425 425 0 1
|
||||
427: 18(int) Bitcast 426
|
||||
Store 424(packu) 427
|
||||
428: 18(int) Load 424(packu)
|
||||
429: 199(ivec2) Bitcast 428
|
||||
430: 49(ivec3) Load 320(u16v)
|
||||
431: 49(ivec3) VectorShuffle 430 429 3 4 2
|
||||
Store 320(u16v) 431
|
||||
434: 17(int) Load 312(i16)
|
||||
436: 435(ivec4) CompositeConstruct 434 434 434 434
|
||||
437: 274(int) Bitcast 436
|
||||
Store 433(packi64) 437
|
||||
438: 274(int) Load 433(packi64)
|
||||
439: 435(ivec4) Bitcast 438
|
||||
440: 188(ivec2) VectorShuffle 439 439 0 1
|
||||
Store 306(i16v) 440
|
||||
443: 14(int) Load 322(u16)
|
||||
445: 444(ivec4) CompositeConstruct 443 443 443 443
|
||||
446: 286(int) Bitcast 445
|
||||
Store 442(packu64) 446
|
||||
447: 286(int) Load 442(packu64)
|
||||
448: 444(ivec4) Bitcast 447
|
||||
449: 49(ivec3) VectorShuffle 448 448 0 1 2
|
||||
Store 320(u16v) 449
|
||||
452: 49(ivec3) Load 320(u16v)
|
||||
453: 14(int) Load 322(u16)
|
||||
454: 49(ivec3) CompositeConstruct 453 453 453
|
||||
455: 389(bvec3) ULessThan 452 454
|
||||
Store 451(bv) 455
|
||||
456: 188(ivec2) Load 306(i16v)
|
||||
457: 17(int) Load 312(i16)
|
||||
458: 188(ivec2) CompositeConstruct 457 457
|
||||
459: 191(bvec2) SLessThan 456 458
|
||||
460: 389(bvec3) Load 451(bv)
|
||||
461: 389(bvec3) VectorShuffle 460 459 3 4 2
|
||||
Store 451(bv) 461
|
||||
462: 49(ivec3) Load 320(u16v)
|
||||
463: 14(int) Load 322(u16)
|
||||
464: 49(ivec3) CompositeConstruct 463 463 463
|
||||
465: 389(bvec3) ULessThanEqual 462 464
|
||||
Store 451(bv) 465
|
||||
466: 188(ivec2) Load 306(i16v)
|
||||
467: 17(int) Load 312(i16)
|
||||
468: 188(ivec2) CompositeConstruct 467 467
|
||||
469: 191(bvec2) SLessThanEqual 466 468
|
||||
470: 389(bvec3) Load 451(bv)
|
||||
471: 389(bvec3) VectorShuffle 470 469 3 4 2
|
||||
Store 451(bv) 471
|
||||
472: 49(ivec3) Load 320(u16v)
|
||||
473: 14(int) Load 322(u16)
|
||||
474: 49(ivec3) CompositeConstruct 473 473 473
|
||||
475: 389(bvec3) UGreaterThan 472 474
|
||||
Store 451(bv) 475
|
||||
476: 188(ivec2) Load 306(i16v)
|
||||
477: 17(int) Load 312(i16)
|
||||
478: 188(ivec2) CompositeConstruct 477 477
|
||||
479: 191(bvec2) SGreaterThan 476 478
|
||||
480: 389(bvec3) Load 451(bv)
|
||||
481: 389(bvec3) VectorShuffle 480 479 3 4 2
|
||||
Store 451(bv) 481
|
||||
482: 49(ivec3) Load 320(u16v)
|
||||
483: 14(int) Load 322(u16)
|
||||
484: 49(ivec3) CompositeConstruct 483 483 483
|
||||
485: 389(bvec3) UGreaterThanEqual 482 484
|
||||
Store 451(bv) 485
|
||||
486: 188(ivec2) Load 306(i16v)
|
||||
487: 17(int) Load 312(i16)
|
||||
488: 188(ivec2) CompositeConstruct 487 487
|
||||
489: 191(bvec2) SGreaterThanEqual 486 488
|
||||
490: 389(bvec3) Load 451(bv)
|
||||
491: 389(bvec3) VectorShuffle 490 489 3 4 2
|
||||
Store 451(bv) 491
|
||||
492: 49(ivec3) Load 320(u16v)
|
||||
493: 14(int) Load 322(u16)
|
||||
494: 49(ivec3) CompositeConstruct 493 493 493
|
||||
495: 389(bvec3) IEqual 492 494
|
||||
Store 451(bv) 495
|
||||
496: 188(ivec2) Load 306(i16v)
|
||||
497: 17(int) Load 312(i16)
|
||||
498: 188(ivec2) CompositeConstruct 497 497
|
||||
499: 191(bvec2) IEqual 496 498
|
||||
500: 389(bvec3) Load 451(bv)
|
||||
501: 389(bvec3) VectorShuffle 500 499 3 4 2
|
||||
Store 451(bv) 501
|
||||
502: 49(ivec3) Load 320(u16v)
|
||||
503: 14(int) Load 322(u16)
|
||||
504: 49(ivec3) CompositeConstruct 503 503 503
|
||||
505: 389(bvec3) INotEqual 502 504
|
||||
Store 451(bv) 505
|
||||
506: 188(ivec2) Load 306(i16v)
|
||||
507: 17(int) Load 312(i16)
|
||||
508: 188(ivec2) CompositeConstruct 507 507
|
||||
509: 191(bvec2) INotEqual 506 508
|
||||
510: 389(bvec3) Load 451(bv)
|
||||
511: 389(bvec3) VectorShuffle 510 509 3 4 2
|
||||
Store 451(bv) 511
|
||||
Return
|
||||
FunctionEnd
|
314
Test/spv.int16.frag
Normal file
314
Test/spv.int16.frag
Normal file
@ -0,0 +1,314 @@
|
||||
#version 450 core
|
||||
|
||||
#extension GL_ARB_gpu_shader_int64: enable
|
||||
#extension GL_AMD_gpu_shader_half_float: enable
|
||||
#extension GL_AMD_gpu_shader_int16: enable
|
||||
|
||||
layout(binding = 0) uniform Uniforms
|
||||
{
|
||||
uint i;
|
||||
};
|
||||
|
||||
// int16/uint16 in block
|
||||
layout(std140, binding = 1) uniform Block
|
||||
{
|
||||
i16vec3 i16v;
|
||||
uint16_t u16;
|
||||
} block;
|
||||
|
||||
// int16/uint16 for input
|
||||
layout(location = 0) in flat u16vec3 iu16v;
|
||||
layout(location = 1) in flat int16_t ii16;
|
||||
|
||||
void literal()
|
||||
{
|
||||
const int16_t i16c[3] =
|
||||
{
|
||||
0x111S, // Hex
|
||||
-2s, // Dec
|
||||
0400s, // Oct
|
||||
};
|
||||
|
||||
const uint16_t u16c[] =
|
||||
{
|
||||
0xFFFFus, // Hex
|
||||
65535US, // Dec
|
||||
0177777us, // Oct
|
||||
};
|
||||
|
||||
uint16_t u16 = i16c[i] + u16c[i];
|
||||
}
|
||||
|
||||
void operators()
|
||||
{
|
||||
u16vec3 u16v;
|
||||
int16_t i16;
|
||||
uint16_t u16;
|
||||
int i;
|
||||
uint u;
|
||||
bool b;
|
||||
|
||||
// Unary
|
||||
u16v++;
|
||||
i16--;
|
||||
++i16;
|
||||
--u16v;
|
||||
|
||||
u16v = ~u16v;
|
||||
|
||||
i16 = +i16;
|
||||
u16v = -u16v;
|
||||
|
||||
// Arithmetic
|
||||
u16 += i16;
|
||||
u16v -= u16v;
|
||||
i16 *= i16;
|
||||
u16v /= u16v;
|
||||
u16v %= i16;
|
||||
|
||||
u16v = u16v + u16v;
|
||||
u16 = i16 - u16;
|
||||
u16v = u16v * i16;
|
||||
i16 = i16 * i16;
|
||||
i16 = i16 % i16;
|
||||
|
||||
// Shift
|
||||
u16v <<= i;
|
||||
i16 >>= u16v.y;
|
||||
|
||||
i16 = i16 << u16v.z;
|
||||
u16v = u16v << i16;
|
||||
|
||||
// Relational
|
||||
b = (u16v.x != i16);
|
||||
b = (i16 == u16v.x);
|
||||
b = (u16v.x > u16v.y);
|
||||
b = (i16 < u);
|
||||
b = (u16v.y >= u16v.x);
|
||||
b = (i16 <= i);
|
||||
|
||||
// Bitwise
|
||||
u16v |= i16;
|
||||
u16 = i16 | u16;
|
||||
i16 &= i16;
|
||||
u16v = u16v & u16v;
|
||||
u16v ^= i16;
|
||||
u16v = u16v ^ i16;
|
||||
}
|
||||
|
||||
void typeCast()
|
||||
{
|
||||
bvec2 bv;
|
||||
ivec2 iv;
|
||||
uvec2 uv;
|
||||
vec2 fv;
|
||||
dvec2 dv;
|
||||
|
||||
f16vec2 f16v;
|
||||
i64vec2 i64v;
|
||||
u64vec2 u64v;
|
||||
i16vec2 i16v;
|
||||
u16vec2 u16v;
|
||||
|
||||
i16v = i16vec2(bv); // bool -> int16
|
||||
u16v = u16vec2(bv); // bool -> uint16
|
||||
bv = bvec2(i16v); // int16 -> bool
|
||||
bv = bvec2(u16v); // uint16 -> bool
|
||||
|
||||
i16v = i16vec2(iv); // int -> int16
|
||||
u16v = u16vec2(iv); // int -> uint16
|
||||
iv = i16v; // int16 -> int
|
||||
iv = ivec2(u16v); // uint16 -> int
|
||||
|
||||
i16v = i16vec2(uv); // uint -> int16
|
||||
u16v = u16vec2(uv); // uint -> uint16
|
||||
uv = i16v; // int16 -> uint
|
||||
uv = u16v; // uint16 -> uint
|
||||
|
||||
i16v = i16vec2(fv); // float -> int16
|
||||
u16v = u16vec2(fv); // float -> uint16
|
||||
fv = i16v; // int16 -> float
|
||||
fv = u16v; // uint16 -> float
|
||||
|
||||
i16v = i16vec2(dv); // double -> int16
|
||||
u16v = u16vec2(dv); // double -> uint16
|
||||
dv = i16v; // int16 -> double
|
||||
dv = u16v; // uint16 -> double
|
||||
|
||||
i16v = i16vec2(f16v); // float16 -> int16
|
||||
u16v = u16vec2(f16v); // float16 -> uint16
|
||||
f16v = i16v; // int16 -> float16
|
||||
f16v = u16v; // uint16 -> float16
|
||||
|
||||
i16v = i16vec2(i64v); // int64 -> int16
|
||||
u16v = u16vec2(i64v); // int64 -> uint16
|
||||
i64v = i16v; // int16 -> int64
|
||||
i64v = i64vec2(u16v); // uint16 -> int64
|
||||
|
||||
i16v = i16vec2(u64v); // uint64 -> int16
|
||||
u16v = u16vec2(u64v); // uint64 -> uint16
|
||||
u64v = i16v; // int16 -> uint64
|
||||
u64v = u16v; // uint16 -> uint64
|
||||
|
||||
i16v = i16vec2(u16v); // uint16 -> int16
|
||||
u16v = i16v; // int16 -> uint16
|
||||
}
|
||||
|
||||
void builtinFuncs()
|
||||
{
|
||||
i16vec2 i16v;
|
||||
u16vec3 u16v;
|
||||
f16vec3 f16v;
|
||||
bvec3 bv;
|
||||
|
||||
int16_t i16;
|
||||
uint16_t u16;
|
||||
|
||||
// abs()
|
||||
i16v = abs(i16v);
|
||||
|
||||
// sign()
|
||||
i16v = sign(i16v);
|
||||
|
||||
// min()
|
||||
i16v = min(i16v, i16);
|
||||
i16v = min(i16v, i16vec2(-1s));
|
||||
u16v = min(u16v, u16);
|
||||
u16v = min(u16v, u16vec3(0us));
|
||||
|
||||
// max()
|
||||
i16v = max(i16v, i16);
|
||||
i16v = max(i16v, i16vec2(-1s));
|
||||
u16v = max(u16v, u16);
|
||||
u16v = max(u16v, u16vec3(0us));
|
||||
|
||||
// clamp()
|
||||
i16v = clamp(i16v, -i16, i16);
|
||||
i16v = clamp(i16v, -i16v, i16v);
|
||||
u16v = clamp(u16v, -u16, u16);
|
||||
u16v = clamp(u16v, -u16v, u16v);
|
||||
|
||||
// mix()
|
||||
i16 = mix(i16v.x, i16v.y, true);
|
||||
i16v = mix(i16vec2(i16), i16vec2(-i16), bvec2(false));
|
||||
u16 = mix(u16v.x, u16v.y, true);
|
||||
u16v = mix(u16vec3(u16), u16vec3(-u16), bvec3(false));
|
||||
|
||||
// frexp()
|
||||
i16vec3 exp;
|
||||
f16v = frexp(f16v, exp);
|
||||
|
||||
// ldexp()
|
||||
f16v = ldexp(f16v, exp);
|
||||
|
||||
// float16BitsToInt16()
|
||||
i16v = float16BitsToInt16(f16v.xy);
|
||||
|
||||
// float16BitsToUint16()
|
||||
u16v.x = float16BitsToUint16(f16v.z);
|
||||
|
||||
// int16BitsToFloat16()
|
||||
f16v.xy = int16BitsToFloat16(i16v);
|
||||
|
||||
// uint16BitsToFloat16()
|
||||
f16v = uint16BitsToFloat16(u16v);
|
||||
|
||||
// packInt2x16()
|
||||
int packi = packInt2x16(i16v);
|
||||
|
||||
// unpackInt2x16()
|
||||
i16v = unpackInt2x16(packi);
|
||||
|
||||
// packUint2x16()
|
||||
uint packu = packUint2x16(u16v.xy);
|
||||
|
||||
// unpackUint2x16()
|
||||
u16v.xy = unpackUint2x16(packu);
|
||||
|
||||
// packInt4x16()
|
||||
int64_t packi64 = packInt4x16(i16vec4(i16));
|
||||
|
||||
// unpackInt4x16()
|
||||
i16v = unpackInt4x16(packi64).xy;
|
||||
|
||||
// packUint4x16()
|
||||
uint64_t packu64 = packUint4x16(u16vec4(u16));
|
||||
|
||||
// unpackUint4x16()
|
||||
u16v = unpackUint4x16(packu64).xyz;
|
||||
|
||||
// lessThan()
|
||||
bv = lessThan(u16v, u16vec3(u16));
|
||||
bv.xy = lessThan(i16v, i16vec2(i16));
|
||||
|
||||
// lessThanEqual()
|
||||
bv = lessThanEqual(u16v, u16vec3(u16));
|
||||
bv.xy = lessThanEqual(i16v, i16vec2(i16));
|
||||
|
||||
// greaterThan()
|
||||
bv = greaterThan(u16v, u16vec3(u16));
|
||||
bv.xy = greaterThan(i16v, i16vec2(i16));
|
||||
|
||||
// greaterThanEqual()
|
||||
bv = greaterThanEqual(u16v, u16vec3(u16));
|
||||
bv.xy = greaterThanEqual(i16v, i16vec2(i16));
|
||||
|
||||
// equal()
|
||||
bv = equal(u16v, u16vec3(u16));
|
||||
bv.xy = equal(i16v, i16vec2(i16));
|
||||
|
||||
// notEqual()
|
||||
bv = notEqual(u16v, u16vec3(u16));
|
||||
bv.xy = notEqual(i16v, i16vec2(i16));
|
||||
}
|
||||
|
||||
// Type conversion for specialization constant
|
||||
layout(constant_id = 100) const int64_t si64 = -10L;
|
||||
layout(constant_id = 101) const uint64_t su64 = 20UL;
|
||||
layout(constant_id = 102) const int si = -5;
|
||||
layout(constant_id = 103) const uint su = 4;
|
||||
layout(constant_id = 104) const bool sb = true;
|
||||
layout(constant_id = 105) const int16_t si16 = -5S;
|
||||
layout(constant_id = 106) const uint16_t su16 = 4US;
|
||||
|
||||
// bool <-> int16/uint16
|
||||
const bool i16_to_b = bool(si16);
|
||||
const bool u16_to_b = bool(su16);
|
||||
const int16_t b_to_i16 = int16_t(sb);
|
||||
const uint16_t b_to_u16 = uint16_t(sb);
|
||||
|
||||
// int <-> int16/uint16
|
||||
const int i16_to_i = int(si16);
|
||||
const int u16_to_i = int(su16);
|
||||
const int16_t i_to_i16 = int16_t(si);
|
||||
const uint16_t i_to_u16 = uint16_t(si);
|
||||
|
||||
// uint <-> int16/uint16
|
||||
const uint i16_to_u = uint(si16);
|
||||
const uint u16_to_u = uint(su16);
|
||||
const int16_t u_to_i16 = int16_t(su);
|
||||
const uint16_t u_to_u16 = uint16_t(su);
|
||||
|
||||
// int64 <-> int16/uint16
|
||||
const int64_t i16_to_i64 = int64_t(si16);
|
||||
const int64_t u16_to_i64 = int64_t(su16);
|
||||
const int16_t i64_to_i16 = int16_t(si64);
|
||||
const uint16_t i64_to_u16 = uint16_t(si64);
|
||||
|
||||
// uint64 <-> int16/uint16
|
||||
const uint64_t i16_to_u64 = uint64_t(si16);
|
||||
const uint64_t u16_to_u64 = uint64_t(su16);
|
||||
const int16_t u64_to_i16 = int16_t(su64);
|
||||
const uint16_t u64_to_u16 = uint16_t(su64);
|
||||
|
||||
// int16 <-> uint16
|
||||
const uint16_t i16_to_u16 = uint16_t(si16);
|
||||
const int16_t u16_to_i16 = int16_t(su16);
|
||||
|
||||
void main()
|
||||
{
|
||||
literal();
|
||||
operators();
|
||||
typeCast();
|
||||
builtinFuncs();
|
||||
}
|
@ -53,6 +53,10 @@ enum TBasicType {
|
||||
EbtUint,
|
||||
EbtInt64,
|
||||
EbtUint64,
|
||||
#ifdef AMD_EXTENSIONS
|
||||
EbtInt16,
|
||||
EbtUint16,
|
||||
#endif
|
||||
EbtBool,
|
||||
EbtAtomicUint,
|
||||
EbtSampler,
|
||||
|
@ -190,8 +190,6 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
|
||||
case EbtFloat: break;
|
||||
case EbtInt: s.append("i"); break;
|
||||
case EbtUint: s.append("u"); break;
|
||||
case EbtInt64: s.append("i64"); break;
|
||||
case EbtUint64: s.append("u64"); break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
if (image) {
|
||||
@ -1448,6 +1446,10 @@ public:
|
||||
case EbtUint:
|
||||
case EbtInt64:
|
||||
case EbtUint64:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtInt16:
|
||||
case EbtUint16:
|
||||
#endif
|
||||
case EbtBool:
|
||||
return true;
|
||||
default:
|
||||
@ -1531,6 +1533,10 @@ public:
|
||||
case EbtUint: return "uint";
|
||||
case EbtInt64: return "int64_t";
|
||||
case EbtUint64: return "uint64_t";
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtInt16: return "int16_t";
|
||||
case EbtUint16: return "uint16_t";
|
||||
#endif
|
||||
case EbtBool: return "bool";
|
||||
case EbtAtomicUint: return "atomic_uint";
|
||||
case EbtSampler: return "sampler/image";
|
||||
|
@ -141,6 +141,42 @@ enum TOperator {
|
||||
EOpConvFloat16ToDouble,
|
||||
EOpConvFloat16ToInt64,
|
||||
EOpConvFloat16ToUint64,
|
||||
|
||||
EOpConvBoolToInt16,
|
||||
EOpConvIntToInt16,
|
||||
EOpConvUintToInt16,
|
||||
EOpConvFloatToInt16,
|
||||
EOpConvDoubleToInt16,
|
||||
EOpConvFloat16ToInt16,
|
||||
EOpConvInt64ToInt16,
|
||||
EOpConvUint64ToInt16,
|
||||
EOpConvUint16ToInt16,
|
||||
EOpConvInt16ToBool,
|
||||
EOpConvInt16ToInt,
|
||||
EOpConvInt16ToUint,
|
||||
EOpConvInt16ToFloat,
|
||||
EOpConvInt16ToDouble,
|
||||
EOpConvInt16ToFloat16,
|
||||
EOpConvInt16ToInt64,
|
||||
EOpConvInt16ToUint64,
|
||||
|
||||
EOpConvBoolToUint16,
|
||||
EOpConvIntToUint16,
|
||||
EOpConvUintToUint16,
|
||||
EOpConvFloatToUint16,
|
||||
EOpConvDoubleToUint16,
|
||||
EOpConvFloat16ToUint16,
|
||||
EOpConvInt64ToUint16,
|
||||
EOpConvUint64ToUint16,
|
||||
EOpConvInt16ToUint16,
|
||||
EOpConvUint16ToBool,
|
||||
EOpConvUint16ToInt,
|
||||
EOpConvUint16ToUint,
|
||||
EOpConvUint16ToFloat,
|
||||
EOpConvUint16ToDouble,
|
||||
EOpConvUint16ToFloat16,
|
||||
EOpConvUint16ToInt64,
|
||||
EOpConvUint16ToUint64,
|
||||
#endif
|
||||
|
||||
//
|
||||
@ -244,6 +280,12 @@ enum TOperator {
|
||||
EOpDoubleBitsToUint64,
|
||||
EOpInt64BitsToDouble,
|
||||
EOpUint64BitsToDouble,
|
||||
#ifdef AMD_EXTENSIONS
|
||||
EOpFloat16BitsToInt16,
|
||||
EOpFloat16BitsToUint16,
|
||||
EOpInt16BitsToFloat16,
|
||||
EOpUint16BitsToFloat16,
|
||||
#endif
|
||||
EOpPackSnorm2x16,
|
||||
EOpUnpackSnorm2x16,
|
||||
EOpPackUnorm2x16,
|
||||
@ -263,6 +305,14 @@ enum TOperator {
|
||||
#ifdef AMD_EXTENSIONS
|
||||
EOpPackFloat2x16,
|
||||
EOpUnpackFloat2x16,
|
||||
EOpPackInt2x16,
|
||||
EOpUnpackInt2x16,
|
||||
EOpPackUint2x16,
|
||||
EOpUnpackUint2x16,
|
||||
EOpPackInt4x16,
|
||||
EOpUnpackInt4x16,
|
||||
EOpPackUint4x16,
|
||||
EOpUnpackUint4x16,
|
||||
#endif
|
||||
|
||||
EOpLength,
|
||||
@ -394,15 +444,27 @@ enum TOperator {
|
||||
EOpConstructUint,
|
||||
EOpConstructInt64,
|
||||
EOpConstructUint64,
|
||||
#ifdef AMD_EXTENSIONS
|
||||
EOpConstructInt16,
|
||||
EOpConstructUint16,
|
||||
#endif
|
||||
EOpConstructBool,
|
||||
EOpConstructFloat,
|
||||
EOpConstructDouble,
|
||||
#ifdef AMD_EXTENSIONS
|
||||
EOpConstructFloat16,
|
||||
#endif
|
||||
EOpConstructVec2,
|
||||
EOpConstructVec3,
|
||||
EOpConstructVec4,
|
||||
EOpConstructDVec2,
|
||||
EOpConstructDVec3,
|
||||
EOpConstructDVec4,
|
||||
#ifdef AMD_EXTENSIONS
|
||||
EOpConstructF16Vec2,
|
||||
EOpConstructF16Vec3,
|
||||
EOpConstructF16Vec4,
|
||||
#endif
|
||||
EOpConstructBVec2,
|
||||
EOpConstructBVec3,
|
||||
EOpConstructBVec4,
|
||||
@ -418,6 +480,14 @@ enum TOperator {
|
||||
EOpConstructU64Vec2,
|
||||
EOpConstructU64Vec3,
|
||||
EOpConstructU64Vec4,
|
||||
#ifdef AMD_EXTENSIONS
|
||||
EOpConstructI16Vec2,
|
||||
EOpConstructI16Vec3,
|
||||
EOpConstructI16Vec4,
|
||||
EOpConstructU16Vec2,
|
||||
EOpConstructU16Vec3,
|
||||
EOpConstructU16Vec4,
|
||||
#endif
|
||||
EOpConstructMat2x2,
|
||||
EOpConstructMat2x3,
|
||||
EOpConstructMat2x4,
|
||||
@ -464,10 +534,6 @@ enum TOperator {
|
||||
EOpConstructBMat4x3,
|
||||
EOpConstructBMat4x4,
|
||||
#ifdef AMD_EXTENSIONS
|
||||
EOpConstructFloat16,
|
||||
EOpConstructF16Vec2,
|
||||
EOpConstructF16Vec3,
|
||||
EOpConstructF16Vec4,
|
||||
EOpConstructF16Mat2x2,
|
||||
EOpConstructF16Mat2x3,
|
||||
EOpConstructF16Mat2x4,
|
||||
|
@ -193,7 +193,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right
|
||||
|
||||
case EbtUint:
|
||||
if (rightUnionArray[i] == 0) {
|
||||
newConstArray[i].setUConst(0xFFFFFFFF);
|
||||
newConstArray[i].setUConst(0xFFFFFFFFu);
|
||||
} else
|
||||
newConstArray[i].setUConst(leftUnionArray[i].getUConst() / rightUnionArray[i].getUConst());
|
||||
break;
|
||||
@ -213,6 +213,23 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right
|
||||
} else
|
||||
newConstArray[i].setU64Const(leftUnionArray[i].getU64Const() / rightUnionArray[i].getU64Const());
|
||||
break;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtInt16:
|
||||
if (rightUnionArray[i] == 0)
|
||||
newConstArray[i].setIConst(0x7FFF);
|
||||
else if (rightUnionArray[i].getIConst() == -1 && leftUnionArray[i].getIConst() == (int)0x8000)
|
||||
newConstArray[i].setIConst(0x8000);
|
||||
else
|
||||
newConstArray[i].setIConst(leftUnionArray[i].getIConst() / rightUnionArray[i].getIConst());
|
||||
break;
|
||||
|
||||
case EbtUint16:
|
||||
if (rightUnionArray[i] == 0) {
|
||||
newConstArray[i].setUConst(0xFFFFu);
|
||||
} else
|
||||
newConstArray[i].setUConst(leftUnionArray[i].getUConst() / rightUnionArray[i].getUConst());
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
@ -457,10 +474,16 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
|
||||
case EbtFloat16:
|
||||
#endif
|
||||
case EbtFloat: newConstArray[i].setDConst(-unionArray[i].getDConst()); break;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtInt16:
|
||||
#endif
|
||||
case EbtInt: newConstArray[i].setIConst(-unionArray[i].getIConst()); break;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtUint16:
|
||||
#endif
|
||||
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;
|
||||
case EbtUint64: newConstArray[i].setU64Const(static_cast<unsigned long long>(-static_cast<long long>(unionArray[i].getU64Const()))); break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
@ -610,6 +633,14 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
|
||||
case EOpUintBitsToFloat:
|
||||
case EOpDoubleBitsToInt64:
|
||||
case EOpDoubleBitsToUint64:
|
||||
case EOpInt64BitsToDouble:
|
||||
case EOpUint64BitsToDouble:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EOpFloat16BitsToInt16:
|
||||
case EOpFloat16BitsToUint16:
|
||||
case EOpInt16BitsToFloat16:
|
||||
case EOpUint16BitsToFloat16:
|
||||
#endif
|
||||
|
||||
default:
|
||||
return 0;
|
||||
@ -702,6 +733,9 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
|
||||
#endif
|
||||
children[0]->getAsTyped()->getBasicType() == EbtDouble;
|
||||
bool isSigned = children[0]->getAsTyped()->getBasicType() == EbtInt ||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
children[0]->getAsTyped()->getBasicType() == EbtInt16 ||
|
||||
#endif
|
||||
children[0]->getAsTyped()->getBasicType() == EbtInt64;
|
||||
bool isInt64 = children[0]->getAsTyped()->getBasicType() == EbtInt64 ||
|
||||
children[0]->getAsTyped()->getBasicType() == EbtUint64;
|
||||
|
@ -85,8 +85,6 @@ 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";
|
||||
@ -2612,6 +2610,157 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
||||
|
||||
"\n");
|
||||
}
|
||||
|
||||
// GL_AMD_gpu_shader_int16
|
||||
if (profile != EEsProfile && version >= 450) {
|
||||
commonBuiltins.append(
|
||||
"int16_t abs(int16_t);"
|
||||
"i16vec2 abs(i16vec2);"
|
||||
"i16vec3 abs(i16vec3);"
|
||||
"i16vec4 abs(i16vec4);"
|
||||
|
||||
"int16_t sign(int16_t);"
|
||||
"i16vec2 sign(i16vec2);"
|
||||
"i16vec3 sign(i16vec3);"
|
||||
"i16vec4 sign(i16vec4);"
|
||||
|
||||
"int16_t min(int16_t, int16_t);"
|
||||
"i16vec2 min(i16vec2, int16_t);"
|
||||
"i16vec3 min(i16vec3, int16_t);"
|
||||
"i16vec4 min(i16vec4, int16_t);"
|
||||
"i16vec2 min(i16vec2, i16vec2);"
|
||||
"i16vec3 min(i16vec3, i16vec3);"
|
||||
"i16vec4 min(i16vec4, i16vec4);"
|
||||
"uint16_t min(uint16_t, uint16_t);"
|
||||
"u16vec2 min(u16vec2, uint16_t);"
|
||||
"u16vec3 min(u16vec3, uint16_t);"
|
||||
"u16vec4 min(u16vec4, uint16_t);"
|
||||
"u16vec2 min(u16vec2, u16vec2);"
|
||||
"u16vec3 min(u16vec3, u16vec3);"
|
||||
"u16vec4 min(u16vec4, u16vec4);"
|
||||
|
||||
"int16_t max(int16_t, int16_t);"
|
||||
"i16vec2 max(i16vec2, int16_t);"
|
||||
"i16vec3 max(i16vec3, int16_t);"
|
||||
"i16vec4 max(i16vec4, int16_t);"
|
||||
"i16vec2 max(i16vec2, i16vec2);"
|
||||
"i16vec3 max(i16vec3, i16vec3);"
|
||||
"i16vec4 max(i16vec4, i16vec4);"
|
||||
"uint16_t max(uint16_t, uint16_t);"
|
||||
"u16vec2 max(u16vec2, uint16_t);"
|
||||
"u16vec3 max(u16vec3, uint16_t);"
|
||||
"u16vec4 max(u16vec4, uint16_t);"
|
||||
"u16vec2 max(u16vec2, u16vec2);"
|
||||
"u16vec3 max(u16vec3, u16vec3);"
|
||||
"u16vec4 max(u16vec4, u16vec4);"
|
||||
|
||||
"int16_t clamp(int16_t, int16_t, int16_t);"
|
||||
"i16vec2 clamp(i16vec2, int16_t, int16_t);"
|
||||
"i16vec3 clamp(i16vec3, int16_t, int16_t);"
|
||||
"i16vec4 clamp(i16vec4, int16_t, int16_t);"
|
||||
"i16vec2 clamp(i16vec2, i16vec2, i16vec2);"
|
||||
"i16vec3 clamp(i16vec3, i16vec3, i16vec3);"
|
||||
"i16vec4 clamp(i16vec4, i16vec4, i16vec4);"
|
||||
"uint16_t clamp(uint16_t, uint16_t, uint16_t);"
|
||||
"u16vec2 clamp(u16vec2, uint16_t, uint16_t);"
|
||||
"u16vec3 clamp(u16vec3, uint16_t, uint16_t);"
|
||||
"u16vec4 clamp(u16vec4, uint16_t, uint16_t);"
|
||||
"u16vec2 clamp(u16vec2, u16vec2, u16vec2);"
|
||||
"u16vec3 clamp(u16vec3, u16vec3, u16vec3);"
|
||||
"u16vec4 clamp(u16vec4, u16vec4, u16vec4);"
|
||||
|
||||
"int16_t mix(int16_t, int16_t, bool);"
|
||||
"i16vec2 mix(i16vec2, i16vec2, bvec2);"
|
||||
"i16vec3 mix(i16vec3, i16vec3, bvec3);"
|
||||
"i16vec4 mix(i16vec4, i16vec4, bvec4);"
|
||||
"uint16_t mix(uint16_t, uint16_t, bool);"
|
||||
"u16vec2 mix(u16vec2, u16vec2, bvec2);"
|
||||
"u16vec3 mix(u16vec3, u16vec3, bvec3);"
|
||||
"u16vec4 mix(u16vec4, u16vec4, bvec4);"
|
||||
|
||||
"float16_t frexp(float16_t, out int16_t);"
|
||||
"f16vec2 frexp(f16vec2, out i16vec2);"
|
||||
"f16vec3 frexp(f16vec3, out i16vec3);"
|
||||
"f16vec4 frexp(f16vec4, out i16vec4);"
|
||||
|
||||
"float16_t ldexp(float16_t, int16_t);"
|
||||
"f16vec2 ldexp(f16vec2, i16vec2);"
|
||||
"f16vec3 ldexp(f16vec3, i16vec3);"
|
||||
"f16vec4 ldexp(f16vec4, i16vec4);"
|
||||
|
||||
"int16_t float16BitsToInt16(float16_t);"
|
||||
"i16vec2 float16BitsToInt16(f16vec2);"
|
||||
"i16vec3 float16BitsToInt16(f16vec3);"
|
||||
"i16vec4 float16BitsToInt16(f16vec4);"
|
||||
|
||||
"uint16_t float16BitsToUint16(float16_t);"
|
||||
"u16vec2 float16BitsToUint16(f16vec2);"
|
||||
"u16vec3 float16BitsToUint16(f16vec3);"
|
||||
"u16vec4 float16BitsToUint16(f16vec4);"
|
||||
|
||||
"float16_t int16BitsToFloat16(int16_t);"
|
||||
"f16vec2 int16BitsToFloat16(i16vec2);"
|
||||
"f16vec3 int16BitsToFloat16(i16vec3);"
|
||||
"f16vec4 int16BitsToFloat16(i16vec4);"
|
||||
|
||||
"float16_t uint16BitsToFloat16(uint16_t);"
|
||||
"f16vec2 uint16BitsToFloat16(u16vec2);"
|
||||
"f16vec3 uint16BitsToFloat16(u16vec3);"
|
||||
"f16vec4 uint16BitsToFloat16(u16vec4);"
|
||||
|
||||
"int packInt2x16(i16vec2);"
|
||||
"uint packUint2x16(u16vec2);"
|
||||
"int64_t packInt4x16(i16vec4);"
|
||||
"uint64_t packUint4x16(u16vec4);"
|
||||
"i16vec2 unpackInt2x16(int);"
|
||||
"u16vec2 unpackUint2x16(uint);"
|
||||
"i16vec4 unpackInt4x16(int64_t);"
|
||||
"u16vec4 unpackUint4x16(uint64_t);"
|
||||
|
||||
"bvec2 lessThan(i16vec2, i16vec2);"
|
||||
"bvec3 lessThan(i16vec3, i16vec3);"
|
||||
"bvec4 lessThan(i16vec4, i16vec4);"
|
||||
"bvec2 lessThan(u16vec2, u16vec2);"
|
||||
"bvec3 lessThan(u16vec3, u16vec3);"
|
||||
"bvec4 lessThan(u16vec4, u16vec4);"
|
||||
|
||||
"bvec2 lessThanEqual(i16vec2, i16vec2);"
|
||||
"bvec3 lessThanEqual(i16vec3, i16vec3);"
|
||||
"bvec4 lessThanEqual(i16vec4, i16vec4);"
|
||||
"bvec2 lessThanEqual(u16vec2, u16vec2);"
|
||||
"bvec3 lessThanEqual(u16vec3, u16vec3);"
|
||||
"bvec4 lessThanEqual(u16vec4, u16vec4);"
|
||||
|
||||
"bvec2 greaterThan(i16vec2, i16vec2);"
|
||||
"bvec3 greaterThan(i16vec3, i16vec3);"
|
||||
"bvec4 greaterThan(i16vec4, i16vec4);"
|
||||
"bvec2 greaterThan(u16vec2, u16vec2);"
|
||||
"bvec3 greaterThan(u16vec3, u16vec3);"
|
||||
"bvec4 greaterThan(u16vec4, u16vec4);"
|
||||
|
||||
"bvec2 greaterThanEqual(i16vec2, i16vec2);"
|
||||
"bvec3 greaterThanEqual(i16vec3, i16vec3);"
|
||||
"bvec4 greaterThanEqual(i16vec4, i16vec4);"
|
||||
"bvec2 greaterThanEqual(u16vec2, u16vec2);"
|
||||
"bvec3 greaterThanEqual(u16vec3, u16vec3);"
|
||||
"bvec4 greaterThanEqual(u16vec4, u16vec4);"
|
||||
|
||||
"bvec2 equal(i16vec2, i16vec2);"
|
||||
"bvec3 equal(i16vec3, i16vec3);"
|
||||
"bvec4 equal(i16vec4, i16vec4);"
|
||||
"bvec2 equal(u16vec2, u16vec2);"
|
||||
"bvec3 equal(u16vec3, u16vec3);"
|
||||
"bvec4 equal(u16vec4, u16vec4);"
|
||||
|
||||
"bvec2 notEqual(i16vec2, i16vec2);"
|
||||
"bvec3 notEqual(i16vec3, i16vec3);"
|
||||
"bvec4 notEqual(i16vec4, i16vec4);"
|
||||
"bvec2 notEqual(u16vec2, u16vec2);"
|
||||
"bvec3 notEqual(u16vec3, u16vec3);"
|
||||
"bvec4 notEqual(u16vec4, u16vec4);"
|
||||
|
||||
"\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
//============================================================================
|
||||
@ -5639,6 +5788,12 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
||||
symbolTable.relateToOperator("doubleBitsToUint64", EOpDoubleBitsToUint64);
|
||||
symbolTable.relateToOperator("int64BitsToDouble", EOpInt64BitsToDouble);
|
||||
symbolTable.relateToOperator("uint64BitsToDouble", EOpUint64BitsToDouble);
|
||||
#ifdef AMD_EXTENSIONS
|
||||
symbolTable.relateToOperator("float16BitsToInt16", EOpFloat16BitsToInt16);
|
||||
symbolTable.relateToOperator("float16BitsToUint16", EOpFloat16BitsToUint16);
|
||||
symbolTable.relateToOperator("int16BitsToFloat16", EOpInt16BitsToFloat16);
|
||||
symbolTable.relateToOperator("uint16BitsToFloat16", EOpUint16BitsToFloat16);
|
||||
#endif
|
||||
|
||||
symbolTable.relateToOperator("packSnorm2x16", EOpPackSnorm2x16);
|
||||
symbolTable.relateToOperator("unpackSnorm2x16", EOpUnpackSnorm2x16);
|
||||
@ -5662,6 +5817,16 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
||||
symbolTable.relateToOperator("unpackUint2x32", EOpUnpackUint2x32);
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
symbolTable.relateToOperator("packInt2x16", EOpPackInt2x16);
|
||||
symbolTable.relateToOperator("unpackInt2x16", EOpUnpackInt2x16);
|
||||
symbolTable.relateToOperator("packUint2x16", EOpPackUint2x16);
|
||||
symbolTable.relateToOperator("unpackUint2x16", EOpUnpackUint2x16);
|
||||
|
||||
symbolTable.relateToOperator("packInt4x16", EOpPackInt4x16);
|
||||
symbolTable.relateToOperator("unpackInt4x16", EOpUnpackInt4x16);
|
||||
symbolTable.relateToOperator("packUint4x16", EOpPackUint4x16);
|
||||
symbolTable.relateToOperator("unpackUint4x16", EOpUnpackUint4x16);
|
||||
|
||||
symbolTable.relateToOperator("packFloat2x16", EOpPackFloat2x16);
|
||||
symbolTable.relateToOperator("unpackFloat2x16", EOpUnpackFloat2x16);
|
||||
#endif
|
||||
|
@ -308,6 +308,10 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo
|
||||
case EOpConstructUint: newType = EbtUint; break;
|
||||
case EOpConstructInt64: newType = EbtInt64; break;
|
||||
case EOpConstructUint64: newType = EbtUint64; break;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EOpConstructInt16: newType = EbtInt16; break;
|
||||
case EOpConstructUint16: newType = EbtUint16; break;
|
||||
#endif
|
||||
case EOpConstructBool: newType = EbtBool; break;
|
||||
case EOpConstructFloat: newType = EbtFloat; break;
|
||||
case EOpConstructDouble: newType = EbtDouble; break;
|
||||
@ -336,6 +340,10 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo
|
||||
case EOpConstructUint:
|
||||
case EOpConstructInt64:
|
||||
case EOpConstructUint64:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EOpConstructInt16:
|
||||
case EOpConstructUint16:
|
||||
#endif
|
||||
case EOpConstructBool:
|
||||
case EOpConstructFloat:
|
||||
case EOpConstructDouble:
|
||||
@ -528,6 +536,14 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
||||
case EOpConstructUint64:
|
||||
promoteTo = EbtUint64;
|
||||
break;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EOpConstructInt16:
|
||||
promoteTo = EbtInt16;
|
||||
break;
|
||||
case EOpConstructUint16:
|
||||
promoteTo = EbtUint16;
|
||||
break;
|
||||
#endif
|
||||
|
||||
//
|
||||
// List all the binary ops that can implicitly convert one operand to the other's type;
|
||||
@ -616,10 +632,18 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
||||
case EOpRightShiftAssign:
|
||||
if ((type.getBasicType() == EbtInt ||
|
||||
type.getBasicType() == EbtUint ||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
type.getBasicType() == EbtInt16 ||
|
||||
type.getBasicType() == EbtUint16 ||
|
||||
#endif
|
||||
type.getBasicType() == EbtInt64 ||
|
||||
type.getBasicType() == EbtUint64) &&
|
||||
(node->getType().getBasicType() == EbtInt ||
|
||||
node->getType().getBasicType() == EbtUint ||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
node->getType().getBasicType() == EbtInt16 ||
|
||||
node->getType().getBasicType() == EbtUint16 ||
|
||||
#endif
|
||||
node->getType().getBasicType() == EbtInt64 ||
|
||||
node->getType().getBasicType() == EbtUint64))
|
||||
|
||||
@ -663,6 +687,10 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
||||
#endif
|
||||
case EbtInt64: newOp = EOpConvInt64ToDouble; break;
|
||||
case EbtUint64: newOp = EOpConvUint64ToDouble; break;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtInt16: newOp = EOpConvInt16ToDouble; break;
|
||||
case EbtUint16: newOp = EOpConvUint16ToDouble; break;
|
||||
#endif
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
@ -678,6 +706,10 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
||||
#endif
|
||||
case EbtInt64: newOp = EOpConvInt64ToFloat; break;
|
||||
case EbtUint64: newOp = EOpConvUint64ToFloat; break;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtInt16: newOp = EOpConvInt16ToFloat; break;
|
||||
case EbtUint16: newOp = EOpConvUint16ToFloat; break;
|
||||
#endif
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
@ -692,6 +724,8 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
||||
case EbtDouble: newOp = EOpConvDoubleToFloat16; break;
|
||||
case EbtInt64: newOp = EOpConvInt64ToFloat16; break;
|
||||
case EbtUint64: newOp = EOpConvUint64ToFloat16; break;
|
||||
case EbtInt16: newOp = EOpConvInt16ToFloat16; break;
|
||||
case EbtUint16: newOp = EOpConvUint16ToFloat16; break;
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
@ -708,6 +742,10 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
||||
#endif
|
||||
case EbtInt64: newOp = EOpConvInt64ToBool; break;
|
||||
case EbtUint64: newOp = EOpConvUint64ToBool; break;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtInt16: newOp = EOpConvInt16ToBool; break;
|
||||
case EbtUint16: newOp = EOpConvUint16ToBool; break;
|
||||
#endif
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
@ -723,6 +761,10 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
||||
#endif
|
||||
case EbtInt64: newOp = EOpConvInt64ToInt; break;
|
||||
case EbtUint64: newOp = EOpConvUint64ToInt; break;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtInt16: newOp = EOpConvInt16ToInt; break;
|
||||
case EbtUint16: newOp = EOpConvUint16ToInt; break;
|
||||
#endif
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
@ -738,6 +780,10 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
||||
#endif
|
||||
case EbtInt64: newOp = EOpConvInt64ToUint; break;
|
||||
case EbtUint64: newOp = EOpConvUint64ToUint; break;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtInt16: newOp = EOpConvInt16ToUint; break;
|
||||
case EbtUint16: newOp = EOpConvUint16ToUint; break;
|
||||
#endif
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
@ -753,6 +799,10 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
||||
case EbtFloat16: newOp = EOpConvFloat16ToInt64; break;
|
||||
#endif
|
||||
case EbtUint64: newOp = EOpConvUint64ToInt64; break;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtInt16: newOp = EOpConvInt16ToInt64; break;
|
||||
case EbtUint16: newOp = EOpConvUint16ToInt64; break;
|
||||
#endif
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
@ -768,10 +818,46 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
||||
case EbtFloat16: newOp = EOpConvFloat16ToUint64; break;
|
||||
#endif
|
||||
case EbtInt64: newOp = EOpConvInt64ToUint64; break;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtInt16: newOp = EOpConvInt16ToUint64; break;
|
||||
case EbtUint16: newOp = EOpConvUint16ToUint64; break;
|
||||
#endif
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
break;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtInt16:
|
||||
switch (node->getBasicType()) {
|
||||
case EbtInt: newOp = EOpConvIntToInt16; break;
|
||||
case EbtUint: newOp = EOpConvUintToInt16; break;
|
||||
case EbtBool: newOp = EOpConvBoolToInt16; break;
|
||||
case EbtFloat: newOp = EOpConvFloatToInt16; break;
|
||||
case EbtDouble: newOp = EOpConvDoubleToInt16; break;
|
||||
case EbtFloat16: newOp = EOpConvFloat16ToInt16; break;
|
||||
case EbtInt64: newOp = EOpConvInt64ToInt16; break;
|
||||
case EbtUint64: newOp = EOpConvUint64ToInt16; break;
|
||||
case EbtUint16: newOp = EOpConvUint16ToInt16; break;
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
break;
|
||||
case EbtUint16:
|
||||
switch (node->getBasicType()) {
|
||||
case EbtInt: newOp = EOpConvIntToUint16; break;
|
||||
case EbtUint: newOp = EOpConvUintToUint16; break;
|
||||
case EbtBool: newOp = EOpConvBoolToUint16; break;
|
||||
case EbtFloat: newOp = EOpConvFloatToUint16; break;
|
||||
case EbtDouble: newOp = EOpConvDoubleToUint16; break;
|
||||
case EbtFloat16: newOp = EOpConvFloat16ToUint16; break;
|
||||
case EbtInt64: newOp = EOpConvInt64ToUint16; break;
|
||||
case EbtUint64: newOp = EOpConvUint64ToUint16; break;
|
||||
case EbtInt16: newOp = EOpConvInt16ToUint16; break;
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
@ -1020,6 +1106,10 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
||||
case EbtUint:
|
||||
case EbtInt64:
|
||||
case EbtUint64:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtInt16:
|
||||
case EbtUint16:
|
||||
#endif
|
||||
case EbtFloat:
|
||||
case EbtDouble:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
@ -1033,6 +1123,10 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
||||
switch (from) {
|
||||
case EbtInt:
|
||||
case EbtUint:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtInt16:
|
||||
case EbtUint16:
|
||||
#endif
|
||||
case EbtFloat:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtFloat16:
|
||||
@ -1048,6 +1142,10 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
||||
case EbtInt:
|
||||
return version >= 400 || (source == EShSourceHlsl);
|
||||
case EbtUint:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtInt16:
|
||||
case EbtUint16:
|
||||
#endif
|
||||
return true;
|
||||
case EbtBool:
|
||||
return (source == EShSourceHlsl);
|
||||
@ -1057,6 +1155,9 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
||||
case EbtInt:
|
||||
switch (from) {
|
||||
case EbtInt:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtInt16:
|
||||
#endif
|
||||
return true;
|
||||
case EbtBool:
|
||||
return (source == EShSourceHlsl);
|
||||
@ -1069,6 +1170,10 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
||||
case EbtUint:
|
||||
case EbtInt64:
|
||||
case EbtUint64:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtInt16:
|
||||
case EbtUint16:
|
||||
#endif
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@ -1077,10 +1182,32 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
||||
switch (from) {
|
||||
case EbtInt:
|
||||
case EbtInt64:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtInt16:
|
||||
#endif
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtFloat16:
|
||||
switch (from) {
|
||||
case EbtInt16:
|
||||
case EbtUint16:
|
||||
case EbtFloat16:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
case EbtUint16:
|
||||
switch (from) {
|
||||
case EbtInt16:
|
||||
case EbtUint16:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@ -1313,6 +1440,26 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
break;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtInt16:
|
||||
switch(type.getVectorSize()) {
|
||||
case 1: op = EOpConstructInt16; break;
|
||||
case 2: op = EOpConstructI16Vec2; break;
|
||||
case 3: op = EOpConstructI16Vec3; break;
|
||||
case 4: op = EOpConstructI16Vec4; break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
break;
|
||||
case EbtUint16:
|
||||
switch(type.getVectorSize()) {
|
||||
case 1: op = EOpConstructUint16; break;
|
||||
case 2: op = EOpConstructU16Vec2; break;
|
||||
case 3: op = EOpConstructU16Vec3; break;
|
||||
case 4: op = EOpConstructU16Vec4; break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case EbtBool:
|
||||
if (type.getMatrixCols()) {
|
||||
switch (type.getMatrixCols()) {
|
||||
@ -1620,6 +1767,24 @@ TIntermConstantUnion* TIntermediate::addConstantUnion(unsigned long long u64, co
|
||||
return addConstantUnion(unionArray, TType(EbtUint64, EvqConst), loc, literal);
|
||||
}
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
TIntermConstantUnion* TIntermediate::addConstantUnion(short i16, const TSourceLoc& loc, bool literal) const
|
||||
{
|
||||
TConstUnionArray unionArray(1);
|
||||
unionArray[0].setIConst(i16);
|
||||
|
||||
return addConstantUnion(unionArray, TType(EbtInt16, EvqConst), loc, literal);
|
||||
}
|
||||
|
||||
TIntermConstantUnion* TIntermediate::addConstantUnion(unsigned short u16, const TSourceLoc& loc, bool literal) const
|
||||
{
|
||||
TConstUnionArray unionArray(1);
|
||||
unionArray[0].setUConst(u16);
|
||||
|
||||
return addConstantUnion(unionArray, TType(EbtUint16, EvqConst), loc, literal);
|
||||
}
|
||||
#endif
|
||||
|
||||
TIntermConstantUnion* TIntermediate::addConstantUnion(bool b, const TSourceLoc& loc, bool literal) const
|
||||
{
|
||||
TConstUnionArray unionArray(1);
|
||||
@ -1979,6 +2144,30 @@ bool TIntermediate::isSpecializationOperation(const TIntermOperator& node) const
|
||||
case EOpConvUintToInt64:
|
||||
case EOpConvUint64ToInt:
|
||||
case EOpConvIntToUint64:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EOpConvInt16ToBool:
|
||||
case EOpConvBoolToInt16:
|
||||
case EOpConvInt16ToInt:
|
||||
case EOpConvIntToInt16:
|
||||
case EOpConvInt16ToUint:
|
||||
case EOpConvUintToInt16:
|
||||
case EOpConvInt16ToInt64:
|
||||
case EOpConvInt64ToInt16:
|
||||
case EOpConvInt16ToUint64:
|
||||
case EOpConvUint64ToInt16:
|
||||
case EOpConvUint16ToBool:
|
||||
case EOpConvBoolToUint16:
|
||||
case EOpConvUint16ToInt:
|
||||
case EOpConvIntToUint16:
|
||||
case EOpConvUint16ToUint:
|
||||
case EOpConvUintToUint16:
|
||||
case EOpConvUint16ToInt64:
|
||||
case EOpConvInt64ToUint16:
|
||||
case EOpConvUint16ToUint64:
|
||||
case EOpConvUint64ToUint16:
|
||||
case EOpConvInt16ToUint16:
|
||||
case EOpConvUint16ToInt16:
|
||||
#endif
|
||||
|
||||
// unary operations
|
||||
case EOpNegative:
|
||||
@ -2107,6 +2296,10 @@ bool TIntermediate::promoteUnary(TIntermUnary& node)
|
||||
case EOpBitwiseNot:
|
||||
if (operand->getBasicType() != EbtInt &&
|
||||
operand->getBasicType() != EbtUint &&
|
||||
#ifdef AMD_EXTENSIONS
|
||||
operand->getBasicType() != EbtInt16 &&
|
||||
operand->getBasicType() != EbtUint16 &&
|
||||
#endif
|
||||
operand->getBasicType() != EbtInt64 &&
|
||||
operand->getBasicType() != EbtUint64)
|
||||
|
||||
@ -2121,6 +2314,10 @@ bool TIntermediate::promoteUnary(TIntermUnary& node)
|
||||
operand->getBasicType() != EbtUint &&
|
||||
operand->getBasicType() != EbtInt64 &&
|
||||
operand->getBasicType() != EbtUint64 &&
|
||||
#ifdef AMD_EXTENSIONS
|
||||
operand->getBasicType() != EbtInt16 &&
|
||||
operand->getBasicType() != EbtUint16 &&
|
||||
#endif
|
||||
operand->getBasicType() != EbtFloat &&
|
||||
#ifdef AMD_EXTENSIONS
|
||||
operand->getBasicType() != EbtFloat16 &&
|
||||
@ -2327,8 +2524,14 @@ bool TIntermediate::promoteBinary(TIntermBinary& node)
|
||||
|
||||
// Check for integer-only operands.
|
||||
if ((left->getBasicType() != EbtInt && left->getBasicType() != EbtUint &&
|
||||
left->getBasicType() != EbtInt64 && left->getBasicType() != EbtUint64) ||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
left->getBasicType() != EbtInt16 && left->getBasicType() != EbtUint16 &&
|
||||
#endif
|
||||
left->getBasicType() != EbtInt64 && left->getBasicType() != EbtUint64) ||
|
||||
(right->getBasicType() != EbtInt && right->getBasicType() != EbtUint &&
|
||||
#ifdef AMD_EXTENSIONS
|
||||
right->getBasicType() != EbtInt16 && right->getBasicType() != EbtUint16 &&
|
||||
#endif
|
||||
right->getBasicType() != EbtInt64 && right->getBasicType() != EbtUint64))
|
||||
return false;
|
||||
if (left->isMatrix() || right->isMatrix())
|
||||
|
@ -2220,6 +2220,10 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T
|
||||
case EOpConstructUint:
|
||||
case EOpConstructInt64:
|
||||
case EOpConstructUint64:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EOpConstructInt16:
|
||||
case EOpConstructUint16:
|
||||
#endif
|
||||
case EOpConstructBool:
|
||||
case EOpConstructBVec2:
|
||||
case EOpConstructBVec3:
|
||||
@ -2236,6 +2240,14 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T
|
||||
case EOpConstructU64Vec2:
|
||||
case EOpConstructU64Vec3:
|
||||
case EOpConstructU64Vec4:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EOpConstructI16Vec2:
|
||||
case EOpConstructI16Vec3:
|
||||
case EOpConstructI16Vec4:
|
||||
case EOpConstructU16Vec2:
|
||||
case EOpConstructU16Vec3:
|
||||
case EOpConstructU16Vec4:
|
||||
#endif
|
||||
// This was the list of valid ones, if they aren't converting from float
|
||||
// and aren't making an array.
|
||||
makeSpecConst = ! floatArgument && ! type.isArray();
|
||||
@ -2528,6 +2540,9 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali
|
||||
}
|
||||
|
||||
if (publicType.basicType == EbtInt || publicType.basicType == EbtUint ||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
publicType.basicType == EbtInt16 || publicType.basicType == EbtUint16 ||
|
||||
#endif
|
||||
publicType.basicType == EbtInt64 || publicType.basicType == EbtUint64 ||
|
||||
publicType.basicType == EbtDouble)
|
||||
profileRequires(loc, EEsProfile, 300, nullptr, "shader input/output");
|
||||
@ -2538,6 +2553,9 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali
|
||||
if (!qualifier.flat) {
|
||||
#endif
|
||||
if (publicType.basicType == EbtInt || publicType.basicType == EbtUint ||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
publicType.basicType == EbtInt16 || publicType.basicType == EbtUint16 ||
|
||||
#endif
|
||||
publicType.basicType == EbtInt64 || publicType.basicType == EbtUint64 ||
|
||||
publicType.basicType == EbtDouble ||
|
||||
(publicType.userDef && (publicType.userDef->containsBasicType(EbtInt) ||
|
||||
@ -4634,6 +4652,10 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
|
||||
case EbtUint:
|
||||
case EbtInt64:
|
||||
case EbtUint64:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtInt16:
|
||||
case EbtUint16:
|
||||
#endif
|
||||
case EbtBool:
|
||||
case EbtFloat:
|
||||
case EbtDouble:
|
||||
@ -5580,6 +5602,22 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
|
||||
basicOp = EOpConstructUint64;
|
||||
break;
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EOpConstructI16Vec2:
|
||||
case EOpConstructI16Vec3:
|
||||
case EOpConstructI16Vec4:
|
||||
case EOpConstructInt16:
|
||||
basicOp = EOpConstructInt16;
|
||||
break;
|
||||
|
||||
case EOpConstructU16Vec2:
|
||||
case EOpConstructU16Vec3:
|
||||
case EOpConstructU16Vec4:
|
||||
case EOpConstructUint16:
|
||||
basicOp = EOpConstructUint16;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case EOpConstructBVec2:
|
||||
case EOpConstructBVec3:
|
||||
case EOpConstructBVec4:
|
||||
|
@ -464,6 +464,15 @@ void TScanContext::fillInKeywordMap()
|
||||
(*KeywordMap)["u64vec4"] = U64VEC4;
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
(*KeywordMap)["int16_t"] = INT16_T;
|
||||
(*KeywordMap)["uint16_t"] = UINT16_T;
|
||||
(*KeywordMap)["i16vec2"] = I16VEC2;
|
||||
(*KeywordMap)["i16vec3"] = I16VEC3;
|
||||
(*KeywordMap)["i16vec4"] = I16VEC4;
|
||||
(*KeywordMap)["u16vec2"] = U16VEC2;
|
||||
(*KeywordMap)["u16vec3"] = U16VEC3;
|
||||
(*KeywordMap)["u16vec4"] = U16VEC4;
|
||||
|
||||
(*KeywordMap)["float16_t"] = FLOAT16_T;
|
||||
(*KeywordMap)["f16vec2"] = F16VEC2;
|
||||
(*KeywordMap)["f16vec3"] = F16VEC3;
|
||||
@ -709,6 +718,10 @@ int TScanContext::tokenize(TPpContext* pp, TParserToken& token)
|
||||
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;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case PpAtomConstInt16: parserToken->sType.lex.i = ppToken.ival; return INT16CONSTANT;
|
||||
case PpAtomConstUint16: parserToken->sType.lex.i = ppToken.ival; return UINT16CONSTANT;
|
||||
#endif
|
||||
case PpAtomConstFloat: parserToken->sType.lex.d = ppToken.dval; return FLOATCONSTANT;
|
||||
case PpAtomConstDouble: parserToken->sType.lex.d = ppToken.dval; return DOUBLECONSTANT;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
@ -973,6 +986,21 @@ int TScanContext::tokenizeIdentifier()
|
||||
return identifierOrType();
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case INT16_T:
|
||||
case UINT16_T:
|
||||
case I16VEC2:
|
||||
case I16VEC3:
|
||||
case I16VEC4:
|
||||
case U16VEC2:
|
||||
case U16VEC3:
|
||||
case U16VEC4:
|
||||
afterType = true;
|
||||
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||
(parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_int16) &&
|
||||
parseContext.profile != EEsProfile && parseContext.version >= 450))
|
||||
return keyword;
|
||||
return identifierOrType();
|
||||
|
||||
case FLOAT16_T:
|
||||
case F16VEC2:
|
||||
case F16VEC3:
|
||||
|
@ -67,6 +67,10 @@ void TType::buildMangledName(TString& mangledName) const
|
||||
case EbtUint: mangledName += 'u'; break;
|
||||
case EbtInt64: mangledName += "i64"; break;
|
||||
case EbtUint64: mangledName += "u64"; break;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtInt16: mangledName += "i16"; break;
|
||||
case EbtUint16: mangledName += "u16"; break;
|
||||
#endif
|
||||
case EbtBool: mangledName += 'b'; break;
|
||||
case EbtAtomicUint: mangledName += "au"; break;
|
||||
case EbtSampler:
|
||||
|
@ -195,6 +195,7 @@ void TParseVersions::initializeExtensionBehavior()
|
||||
extensionBehavior[E_GL_AMD_gcn_shader] = EBhDisable;
|
||||
extensionBehavior[E_GL_AMD_gpu_shader_half_float] = EBhDisable;
|
||||
extensionBehavior[E_GL_AMD_texture_gather_bias_lod] = EBhDisable;
|
||||
extensionBehavior[E_GL_AMD_gpu_shader_int16] = EBhDisable;
|
||||
#endif
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
@ -318,6 +319,7 @@ void TParseVersions::getPreamble(std::string& preamble)
|
||||
"#define GL_AMD_gcn_shader 1\n"
|
||||
"#define GL_AMD_gpu_shader_half_float 1\n"
|
||||
"#define GL_AMD_texture_gather_bias_lod 1\n"
|
||||
"#define GL_AMD_gpu_shader_int16 1\n"
|
||||
#endif
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
@ -710,10 +712,21 @@ void TParseVersions::doubleCheck(const TSourceLoc& loc, const char* op)
|
||||
}
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
// Call for any operation needing float16 data-type support.
|
||||
// Call for any operation needing GLSL 16-bit integer data-type support.
|
||||
void TParseVersions::int16Check(const TSourceLoc& loc, const char* op, bool builtIn)
|
||||
{
|
||||
if (! builtIn) {
|
||||
requireExtensions(loc, 1, &E_GL_AMD_gpu_shader_int16, "shader int16");
|
||||
requireProfile(loc, ECoreProfile | ECompatibilityProfile, op);
|
||||
profileRequires(loc, ECoreProfile, 450, nullptr, op);
|
||||
profileRequires(loc, ECompatibilityProfile, 450, nullptr, op);
|
||||
}
|
||||
}
|
||||
|
||||
// Call for any operation needing GLSL float16 data-type support.
|
||||
void TParseVersions::float16Check(const TSourceLoc& loc, const char* op, bool builtIn)
|
||||
{
|
||||
if (!builtIn) {
|
||||
if (! builtIn) {
|
||||
requireExtensions(loc, 1, &E_GL_AMD_gpu_shader_half_float, "shader half float");
|
||||
requireProfile(loc, ECoreProfile | ECompatibilityProfile, op);
|
||||
profileRequires(loc, ECoreProfile, 450, nullptr, op);
|
||||
|
@ -147,7 +147,9 @@ const char* const E_GL_AMD_shader_explicit_vertex_parameter = "GL_AMD_shader
|
||||
const char* const E_GL_AMD_gcn_shader = "GL_AMD_gcn_shader";
|
||||
const char* const E_GL_AMD_gpu_shader_half_float = "GL_AMD_gpu_shader_half_float";
|
||||
const char* const E_GL_AMD_texture_gather_bias_lod = "GL_AMD_texture_gather_bias_lod";
|
||||
const char* const E_GL_AMD_gpu_shader_int16 = "GL_AMD_gpu_shader_int16";
|
||||
#endif
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
|
||||
const char* const E_GL_NV_sample_mask_override_coverage = "GL_NV_sample_mask_override_coverage";
|
||||
|
@ -121,7 +121,7 @@ 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 INT64_T UINT64_T FLOAT16_T
|
||||
%token <lex> CONST BOOL FLOAT DOUBLE INT UINT INT64_T UINT64_T INT16_T UINT16_T FLOAT16_T
|
||||
%token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT SUBROUTINE
|
||||
%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
|
||||
@ -129,6 +129,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
|
||||
%token <lex> COHERENT VOLATILE RESTRICT READONLY WRITEONLY
|
||||
%token <lex> DVEC2 DVEC3 DVEC4 DMAT2 DMAT3 DMAT4
|
||||
%token <lex> F16VEC2 F16VEC3 F16VEC4 F16MAT2 F16MAT3 F16MAT4
|
||||
%token <lex> I16VEC2 I16VEC3 I16VEC4 U16VEC2 U16VEC3 U16VEC4
|
||||
%token <lex> NOPERSPECTIVE FLAT SMOOTH LAYOUT __EXPLICITINTERPAMD
|
||||
|
||||
%token <lex> MAT2X2 MAT2X3 MAT2X4
|
||||
@ -188,7 +189,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
|
||||
%token <lex> STRUCT VOID WHILE
|
||||
|
||||
%token <lex> IDENTIFIER TYPE_NAME
|
||||
%token <lex> FLOATCONSTANT DOUBLECONSTANT INTCONSTANT UINTCONSTANT INT64CONSTANT UINT64CONSTANT BOOLCONSTANT FLOAT16CONSTANT
|
||||
%token <lex> FLOATCONSTANT DOUBLECONSTANT INTCONSTANT UINTCONSTANT INT64CONSTANT UINT64CONSTANT INT16CONSTANT UINT16CONSTANT BOOLCONSTANT FLOAT16CONSTANT
|
||||
%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
|
||||
@ -273,6 +274,18 @@ primary_expression
|
||||
parseContext.int64Check($1.loc, "64-bit unsigned integer literal");
|
||||
$$ = parseContext.intermediate.addConstantUnion($1.u64, $1.loc, true);
|
||||
}
|
||||
| INT16CONSTANT {
|
||||
#ifdef AMD_EXTENSIONS
|
||||
parseContext.int16Check($1.loc, "16-bit integer literal");
|
||||
$$ = parseContext.intermediate.addConstantUnion((short)$1.i, $1.loc, true);
|
||||
#endif
|
||||
}
|
||||
| UINT16CONSTANT {
|
||||
#ifdef AMD_EXTENSIONS
|
||||
parseContext.int16Check($1.loc, "16-bit unsigned integer literal");
|
||||
$$ = parseContext.intermediate.addConstantUnion((unsigned short)$1.u, $1.loc, true);
|
||||
#endif
|
||||
}
|
||||
| FLOATCONSTANT {
|
||||
$$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat, $1.loc, true);
|
||||
}
|
||||
@ -1363,6 +1376,20 @@ type_specifier_nonarray
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtUint64;
|
||||
}
|
||||
| INT16_T {
|
||||
#ifdef AMD_EXTENSIONS
|
||||
parseContext.int16Check($1.loc, "16-bit integer", parseContext.symbolTable.atBuiltInLevel());
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtInt16;
|
||||
#endif
|
||||
}
|
||||
| UINT16_T {
|
||||
#ifdef AMD_EXTENSIONS
|
||||
parseContext.int16Check($1.loc, "16-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel());
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtUint16;
|
||||
#endif
|
||||
}
|
||||
| BOOL {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtBool;
|
||||
@ -1472,6 +1499,30 @@ type_specifier_nonarray
|
||||
$$.basicType = EbtInt64;
|
||||
$$.setVector(4);
|
||||
}
|
||||
| I16VEC2 {
|
||||
#ifdef AMD_EXTENSIONS
|
||||
parseContext.int16Check($1.loc, "16-bit integer vector", parseContext.symbolTable.atBuiltInLevel());
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtInt16;
|
||||
$$.setVector(2);
|
||||
#endif
|
||||
}
|
||||
| I16VEC3 {
|
||||
#ifdef AMD_EXTENSIONS
|
||||
parseContext.int16Check($1.loc, "16-bit integer vector", parseContext.symbolTable.atBuiltInLevel());
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtInt16;
|
||||
$$.setVector(3);
|
||||
#endif
|
||||
}
|
||||
| I16VEC4 {
|
||||
#ifdef AMD_EXTENSIONS
|
||||
parseContext.int16Check($1.loc, "16-bit integer vector", parseContext.symbolTable.atBuiltInLevel());
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtInt16;
|
||||
$$.setVector(4);
|
||||
#endif
|
||||
}
|
||||
| UVEC2 {
|
||||
parseContext.fullIntegerCheck($1.loc, "unsigned integer vector");
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
@ -1508,6 +1559,30 @@ type_specifier_nonarray
|
||||
$$.basicType = EbtUint64;
|
||||
$$.setVector(4);
|
||||
}
|
||||
| U16VEC2 {
|
||||
#ifdef AMD_EXTENSIONS
|
||||
parseContext.int16Check($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtUint16;
|
||||
$$.setVector(2);
|
||||
#endif
|
||||
}
|
||||
| U16VEC3 {
|
||||
#ifdef AMD_EXTENSIONS
|
||||
parseContext.int16Check($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtUint16;
|
||||
$$.setVector(3);
|
||||
#endif
|
||||
}
|
||||
| U16VEC4 {
|
||||
#ifdef AMD_EXTENSIONS
|
||||
parseContext.int16Check($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtUint16;
|
||||
$$.setVector(4);
|
||||
#endif
|
||||
}
|
||||
| MAT2 {
|
||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||
$$.basicType = EbtFloat;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,19 +1,21 @@
|
||||
/* A Bison parser, made by GNU Bison 3.0.4. */
|
||||
|
||||
/* Bison interface for Yacc-like parsers in C
|
||||
|
||||
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
|
||||
/* A Bison parser, made by GNU Bison 2.4.1. */
|
||||
|
||||
/* Skeleton interface for Bison's Yacc-like parsers in C
|
||||
|
||||
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
@ -26,319 +28,323 @@
|
||||
special exception, which will cause the skeleton and the resulting
|
||||
Bison output files to be licensed under the GNU General Public
|
||||
License without this special exception.
|
||||
|
||||
|
||||
This special exception was added by the Free Software Foundation in
|
||||
version 2.2 of Bison. */
|
||||
|
||||
#ifndef YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED
|
||||
# define YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED
|
||||
/* Debug traces. */
|
||||
#ifndef YYDEBUG
|
||||
# define YYDEBUG 1
|
||||
#endif
|
||||
#if YYDEBUG
|
||||
extern int yydebug;
|
||||
#endif
|
||||
|
||||
/* Token type. */
|
||||
/* Tokens. */
|
||||
#ifndef YYTOKENTYPE
|
||||
# define YYTOKENTYPE
|
||||
enum yytokentype
|
||||
{
|
||||
ATTRIBUTE = 258,
|
||||
VARYING = 259,
|
||||
CONST = 260,
|
||||
BOOL = 261,
|
||||
FLOAT = 262,
|
||||
DOUBLE = 263,
|
||||
INT = 264,
|
||||
UINT = 265,
|
||||
INT64_T = 266,
|
||||
UINT64_T = 267,
|
||||
FLOAT16_T = 268,
|
||||
BREAK = 269,
|
||||
CONTINUE = 270,
|
||||
DO = 271,
|
||||
ELSE = 272,
|
||||
FOR = 273,
|
||||
IF = 274,
|
||||
DISCARD = 275,
|
||||
RETURN = 276,
|
||||
SWITCH = 277,
|
||||
CASE = 278,
|
||||
DEFAULT = 279,
|
||||
SUBROUTINE = 280,
|
||||
BVEC2 = 281,
|
||||
BVEC3 = 282,
|
||||
BVEC4 = 283,
|
||||
IVEC2 = 284,
|
||||
IVEC3 = 285,
|
||||
IVEC4 = 286,
|
||||
I64VEC2 = 287,
|
||||
I64VEC3 = 288,
|
||||
I64VEC4 = 289,
|
||||
UVEC2 = 290,
|
||||
UVEC3 = 291,
|
||||
UVEC4 = 292,
|
||||
U64VEC2 = 293,
|
||||
U64VEC3 = 294,
|
||||
U64VEC4 = 295,
|
||||
VEC2 = 296,
|
||||
VEC3 = 297,
|
||||
VEC4 = 298,
|
||||
MAT2 = 299,
|
||||
MAT3 = 300,
|
||||
MAT4 = 301,
|
||||
CENTROID = 302,
|
||||
IN = 303,
|
||||
OUT = 304,
|
||||
INOUT = 305,
|
||||
UNIFORM = 306,
|
||||
PATCH = 307,
|
||||
SAMPLE = 308,
|
||||
BUFFER = 309,
|
||||
SHARED = 310,
|
||||
COHERENT = 311,
|
||||
VOLATILE = 312,
|
||||
RESTRICT = 313,
|
||||
READONLY = 314,
|
||||
WRITEONLY = 315,
|
||||
DVEC2 = 316,
|
||||
DVEC3 = 317,
|
||||
DVEC4 = 318,
|
||||
DMAT2 = 319,
|
||||
DMAT3 = 320,
|
||||
DMAT4 = 321,
|
||||
F16VEC2 = 322,
|
||||
F16VEC3 = 323,
|
||||
F16VEC4 = 324,
|
||||
F16MAT2 = 325,
|
||||
F16MAT3 = 326,
|
||||
F16MAT4 = 327,
|
||||
NOPERSPECTIVE = 328,
|
||||
FLAT = 329,
|
||||
SMOOTH = 330,
|
||||
LAYOUT = 331,
|
||||
__EXPLICITINTERPAMD = 332,
|
||||
MAT2X2 = 333,
|
||||
MAT2X3 = 334,
|
||||
MAT2X4 = 335,
|
||||
MAT3X2 = 336,
|
||||
MAT3X3 = 337,
|
||||
MAT3X4 = 338,
|
||||
MAT4X2 = 339,
|
||||
MAT4X3 = 340,
|
||||
MAT4X4 = 341,
|
||||
DMAT2X2 = 342,
|
||||
DMAT2X3 = 343,
|
||||
DMAT2X4 = 344,
|
||||
DMAT3X2 = 345,
|
||||
DMAT3X3 = 346,
|
||||
DMAT3X4 = 347,
|
||||
DMAT4X2 = 348,
|
||||
DMAT4X3 = 349,
|
||||
DMAT4X4 = 350,
|
||||
F16MAT2X2 = 351,
|
||||
F16MAT2X3 = 352,
|
||||
F16MAT2X4 = 353,
|
||||
F16MAT3X2 = 354,
|
||||
F16MAT3X3 = 355,
|
||||
F16MAT3X4 = 356,
|
||||
F16MAT4X2 = 357,
|
||||
F16MAT4X3 = 358,
|
||||
F16MAT4X4 = 359,
|
||||
ATOMIC_UINT = 360,
|
||||
SAMPLER1D = 361,
|
||||
SAMPLER2D = 362,
|
||||
SAMPLER3D = 363,
|
||||
SAMPLERCUBE = 364,
|
||||
SAMPLER1DSHADOW = 365,
|
||||
SAMPLER2DSHADOW = 366,
|
||||
SAMPLERCUBESHADOW = 367,
|
||||
SAMPLER1DARRAY = 368,
|
||||
SAMPLER2DARRAY = 369,
|
||||
SAMPLER1DARRAYSHADOW = 370,
|
||||
SAMPLER2DARRAYSHADOW = 371,
|
||||
ISAMPLER1D = 372,
|
||||
ISAMPLER2D = 373,
|
||||
ISAMPLER3D = 374,
|
||||
ISAMPLERCUBE = 375,
|
||||
ISAMPLER1DARRAY = 376,
|
||||
ISAMPLER2DARRAY = 377,
|
||||
USAMPLER1D = 378,
|
||||
USAMPLER2D = 379,
|
||||
USAMPLER3D = 380,
|
||||
USAMPLERCUBE = 381,
|
||||
USAMPLER1DARRAY = 382,
|
||||
USAMPLER2DARRAY = 383,
|
||||
SAMPLER2DRECT = 384,
|
||||
SAMPLER2DRECTSHADOW = 385,
|
||||
ISAMPLER2DRECT = 386,
|
||||
USAMPLER2DRECT = 387,
|
||||
SAMPLERBUFFER = 388,
|
||||
ISAMPLERBUFFER = 389,
|
||||
USAMPLERBUFFER = 390,
|
||||
SAMPLERCUBEARRAY = 391,
|
||||
SAMPLERCUBEARRAYSHADOW = 392,
|
||||
ISAMPLERCUBEARRAY = 393,
|
||||
USAMPLERCUBEARRAY = 394,
|
||||
SAMPLER2DMS = 395,
|
||||
ISAMPLER2DMS = 396,
|
||||
USAMPLER2DMS = 397,
|
||||
SAMPLER2DMSARRAY = 398,
|
||||
ISAMPLER2DMSARRAY = 399,
|
||||
USAMPLER2DMSARRAY = 400,
|
||||
SAMPLEREXTERNALOES = 401,
|
||||
SAMPLER = 402,
|
||||
SAMPLERSHADOW = 403,
|
||||
TEXTURE1D = 404,
|
||||
TEXTURE2D = 405,
|
||||
TEXTURE3D = 406,
|
||||
TEXTURECUBE = 407,
|
||||
TEXTURE1DARRAY = 408,
|
||||
TEXTURE2DARRAY = 409,
|
||||
ITEXTURE1D = 410,
|
||||
ITEXTURE2D = 411,
|
||||
ITEXTURE3D = 412,
|
||||
ITEXTURECUBE = 413,
|
||||
ITEXTURE1DARRAY = 414,
|
||||
ITEXTURE2DARRAY = 415,
|
||||
UTEXTURE1D = 416,
|
||||
UTEXTURE2D = 417,
|
||||
UTEXTURE3D = 418,
|
||||
UTEXTURECUBE = 419,
|
||||
UTEXTURE1DARRAY = 420,
|
||||
UTEXTURE2DARRAY = 421,
|
||||
TEXTURE2DRECT = 422,
|
||||
ITEXTURE2DRECT = 423,
|
||||
UTEXTURE2DRECT = 424,
|
||||
TEXTUREBUFFER = 425,
|
||||
ITEXTUREBUFFER = 426,
|
||||
UTEXTUREBUFFER = 427,
|
||||
TEXTURECUBEARRAY = 428,
|
||||
ITEXTURECUBEARRAY = 429,
|
||||
UTEXTURECUBEARRAY = 430,
|
||||
TEXTURE2DMS = 431,
|
||||
ITEXTURE2DMS = 432,
|
||||
UTEXTURE2DMS = 433,
|
||||
TEXTURE2DMSARRAY = 434,
|
||||
ITEXTURE2DMSARRAY = 435,
|
||||
UTEXTURE2DMSARRAY = 436,
|
||||
SUBPASSINPUT = 437,
|
||||
SUBPASSINPUTMS = 438,
|
||||
ISUBPASSINPUT = 439,
|
||||
ISUBPASSINPUTMS = 440,
|
||||
USUBPASSINPUT = 441,
|
||||
USUBPASSINPUTMS = 442,
|
||||
IMAGE1D = 443,
|
||||
IIMAGE1D = 444,
|
||||
UIMAGE1D = 445,
|
||||
IMAGE2D = 446,
|
||||
IIMAGE2D = 447,
|
||||
UIMAGE2D = 448,
|
||||
IMAGE3D = 449,
|
||||
IIMAGE3D = 450,
|
||||
UIMAGE3D = 451,
|
||||
IMAGE2DRECT = 452,
|
||||
IIMAGE2DRECT = 453,
|
||||
UIMAGE2DRECT = 454,
|
||||
IMAGECUBE = 455,
|
||||
IIMAGECUBE = 456,
|
||||
UIMAGECUBE = 457,
|
||||
IMAGEBUFFER = 458,
|
||||
IIMAGEBUFFER = 459,
|
||||
UIMAGEBUFFER = 460,
|
||||
IMAGE1DARRAY = 461,
|
||||
IIMAGE1DARRAY = 462,
|
||||
UIMAGE1DARRAY = 463,
|
||||
IMAGE2DARRAY = 464,
|
||||
IIMAGE2DARRAY = 465,
|
||||
UIMAGE2DARRAY = 466,
|
||||
IMAGECUBEARRAY = 467,
|
||||
IIMAGECUBEARRAY = 468,
|
||||
UIMAGECUBEARRAY = 469,
|
||||
IMAGE2DMS = 470,
|
||||
IIMAGE2DMS = 471,
|
||||
UIMAGE2DMS = 472,
|
||||
IMAGE2DMSARRAY = 473,
|
||||
IIMAGE2DMSARRAY = 474,
|
||||
UIMAGE2DMSARRAY = 475,
|
||||
STRUCT = 476,
|
||||
VOID = 477,
|
||||
WHILE = 478,
|
||||
IDENTIFIER = 479,
|
||||
TYPE_NAME = 480,
|
||||
FLOATCONSTANT = 481,
|
||||
DOUBLECONSTANT = 482,
|
||||
INTCONSTANT = 483,
|
||||
UINTCONSTANT = 484,
|
||||
INT64CONSTANT = 485,
|
||||
UINT64CONSTANT = 486,
|
||||
BOOLCONSTANT = 487,
|
||||
FLOAT16CONSTANT = 488,
|
||||
LEFT_OP = 489,
|
||||
RIGHT_OP = 490,
|
||||
INC_OP = 491,
|
||||
DEC_OP = 492,
|
||||
LE_OP = 493,
|
||||
GE_OP = 494,
|
||||
EQ_OP = 495,
|
||||
NE_OP = 496,
|
||||
AND_OP = 497,
|
||||
OR_OP = 498,
|
||||
XOR_OP = 499,
|
||||
MUL_ASSIGN = 500,
|
||||
DIV_ASSIGN = 501,
|
||||
ADD_ASSIGN = 502,
|
||||
MOD_ASSIGN = 503,
|
||||
LEFT_ASSIGN = 504,
|
||||
RIGHT_ASSIGN = 505,
|
||||
AND_ASSIGN = 506,
|
||||
XOR_ASSIGN = 507,
|
||||
OR_ASSIGN = 508,
|
||||
SUB_ASSIGN = 509,
|
||||
LEFT_PAREN = 510,
|
||||
RIGHT_PAREN = 511,
|
||||
LEFT_BRACKET = 512,
|
||||
RIGHT_BRACKET = 513,
|
||||
LEFT_BRACE = 514,
|
||||
RIGHT_BRACE = 515,
|
||||
DOT = 516,
|
||||
COMMA = 517,
|
||||
COLON = 518,
|
||||
EQUAL = 519,
|
||||
SEMICOLON = 520,
|
||||
BANG = 521,
|
||||
DASH = 522,
|
||||
TILDE = 523,
|
||||
PLUS = 524,
|
||||
STAR = 525,
|
||||
SLASH = 526,
|
||||
PERCENT = 527,
|
||||
LEFT_ANGLE = 528,
|
||||
RIGHT_ANGLE = 529,
|
||||
VERTICAL_BAR = 530,
|
||||
CARET = 531,
|
||||
AMPERSAND = 532,
|
||||
QUESTION = 533,
|
||||
INVARIANT = 534,
|
||||
PRECISE = 535,
|
||||
HIGH_PRECISION = 536,
|
||||
MEDIUM_PRECISION = 537,
|
||||
LOW_PRECISION = 538,
|
||||
PRECISION = 539,
|
||||
PACKED = 540,
|
||||
RESOURCE = 541,
|
||||
SUPERP = 542
|
||||
};
|
||||
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
||||
know about them. */
|
||||
enum yytokentype {
|
||||
ATTRIBUTE = 258,
|
||||
VARYING = 259,
|
||||
CONST = 260,
|
||||
BOOL = 261,
|
||||
FLOAT = 262,
|
||||
DOUBLE = 263,
|
||||
INT = 264,
|
||||
UINT = 265,
|
||||
INT64_T = 266,
|
||||
UINT64_T = 267,
|
||||
INT16_T = 268,
|
||||
UINT16_T = 269,
|
||||
FLOAT16_T = 270,
|
||||
BREAK = 271,
|
||||
CONTINUE = 272,
|
||||
DO = 273,
|
||||
ELSE = 274,
|
||||
FOR = 275,
|
||||
IF = 276,
|
||||
DISCARD = 277,
|
||||
RETURN = 278,
|
||||
SWITCH = 279,
|
||||
CASE = 280,
|
||||
DEFAULT = 281,
|
||||
SUBROUTINE = 282,
|
||||
BVEC2 = 283,
|
||||
BVEC3 = 284,
|
||||
BVEC4 = 285,
|
||||
IVEC2 = 286,
|
||||
IVEC3 = 287,
|
||||
IVEC4 = 288,
|
||||
I64VEC2 = 289,
|
||||
I64VEC3 = 290,
|
||||
I64VEC4 = 291,
|
||||
UVEC2 = 292,
|
||||
UVEC3 = 293,
|
||||
UVEC4 = 294,
|
||||
U64VEC2 = 295,
|
||||
U64VEC3 = 296,
|
||||
U64VEC4 = 297,
|
||||
VEC2 = 298,
|
||||
VEC3 = 299,
|
||||
VEC4 = 300,
|
||||
MAT2 = 301,
|
||||
MAT3 = 302,
|
||||
MAT4 = 303,
|
||||
CENTROID = 304,
|
||||
IN = 305,
|
||||
OUT = 306,
|
||||
INOUT = 307,
|
||||
UNIFORM = 308,
|
||||
PATCH = 309,
|
||||
SAMPLE = 310,
|
||||
BUFFER = 311,
|
||||
SHARED = 312,
|
||||
COHERENT = 313,
|
||||
VOLATILE = 314,
|
||||
RESTRICT = 315,
|
||||
READONLY = 316,
|
||||
WRITEONLY = 317,
|
||||
DVEC2 = 318,
|
||||
DVEC3 = 319,
|
||||
DVEC4 = 320,
|
||||
DMAT2 = 321,
|
||||
DMAT3 = 322,
|
||||
DMAT4 = 323,
|
||||
F16VEC2 = 324,
|
||||
F16VEC3 = 325,
|
||||
F16VEC4 = 326,
|
||||
F16MAT2 = 327,
|
||||
F16MAT3 = 328,
|
||||
F16MAT4 = 329,
|
||||
I16VEC2 = 330,
|
||||
I16VEC3 = 331,
|
||||
I16VEC4 = 332,
|
||||
U16VEC2 = 333,
|
||||
U16VEC3 = 334,
|
||||
U16VEC4 = 335,
|
||||
NOPERSPECTIVE = 336,
|
||||
FLAT = 337,
|
||||
SMOOTH = 338,
|
||||
LAYOUT = 339,
|
||||
__EXPLICITINTERPAMD = 340,
|
||||
MAT2X2 = 341,
|
||||
MAT2X3 = 342,
|
||||
MAT2X4 = 343,
|
||||
MAT3X2 = 344,
|
||||
MAT3X3 = 345,
|
||||
MAT3X4 = 346,
|
||||
MAT4X2 = 347,
|
||||
MAT4X3 = 348,
|
||||
MAT4X4 = 349,
|
||||
DMAT2X2 = 350,
|
||||
DMAT2X3 = 351,
|
||||
DMAT2X4 = 352,
|
||||
DMAT3X2 = 353,
|
||||
DMAT3X3 = 354,
|
||||
DMAT3X4 = 355,
|
||||
DMAT4X2 = 356,
|
||||
DMAT4X3 = 357,
|
||||
DMAT4X4 = 358,
|
||||
F16MAT2X2 = 359,
|
||||
F16MAT2X3 = 360,
|
||||
F16MAT2X4 = 361,
|
||||
F16MAT3X2 = 362,
|
||||
F16MAT3X3 = 363,
|
||||
F16MAT3X4 = 364,
|
||||
F16MAT4X2 = 365,
|
||||
F16MAT4X3 = 366,
|
||||
F16MAT4X4 = 367,
|
||||
ATOMIC_UINT = 368,
|
||||
SAMPLER1D = 369,
|
||||
SAMPLER2D = 370,
|
||||
SAMPLER3D = 371,
|
||||
SAMPLERCUBE = 372,
|
||||
SAMPLER1DSHADOW = 373,
|
||||
SAMPLER2DSHADOW = 374,
|
||||
SAMPLERCUBESHADOW = 375,
|
||||
SAMPLER1DARRAY = 376,
|
||||
SAMPLER2DARRAY = 377,
|
||||
SAMPLER1DARRAYSHADOW = 378,
|
||||
SAMPLER2DARRAYSHADOW = 379,
|
||||
ISAMPLER1D = 380,
|
||||
ISAMPLER2D = 381,
|
||||
ISAMPLER3D = 382,
|
||||
ISAMPLERCUBE = 383,
|
||||
ISAMPLER1DARRAY = 384,
|
||||
ISAMPLER2DARRAY = 385,
|
||||
USAMPLER1D = 386,
|
||||
USAMPLER2D = 387,
|
||||
USAMPLER3D = 388,
|
||||
USAMPLERCUBE = 389,
|
||||
USAMPLER1DARRAY = 390,
|
||||
USAMPLER2DARRAY = 391,
|
||||
SAMPLER2DRECT = 392,
|
||||
SAMPLER2DRECTSHADOW = 393,
|
||||
ISAMPLER2DRECT = 394,
|
||||
USAMPLER2DRECT = 395,
|
||||
SAMPLERBUFFER = 396,
|
||||
ISAMPLERBUFFER = 397,
|
||||
USAMPLERBUFFER = 398,
|
||||
SAMPLERCUBEARRAY = 399,
|
||||
SAMPLERCUBEARRAYSHADOW = 400,
|
||||
ISAMPLERCUBEARRAY = 401,
|
||||
USAMPLERCUBEARRAY = 402,
|
||||
SAMPLER2DMS = 403,
|
||||
ISAMPLER2DMS = 404,
|
||||
USAMPLER2DMS = 405,
|
||||
SAMPLER2DMSARRAY = 406,
|
||||
ISAMPLER2DMSARRAY = 407,
|
||||
USAMPLER2DMSARRAY = 408,
|
||||
SAMPLEREXTERNALOES = 409,
|
||||
SAMPLER = 410,
|
||||
SAMPLERSHADOW = 411,
|
||||
TEXTURE1D = 412,
|
||||
TEXTURE2D = 413,
|
||||
TEXTURE3D = 414,
|
||||
TEXTURECUBE = 415,
|
||||
TEXTURE1DARRAY = 416,
|
||||
TEXTURE2DARRAY = 417,
|
||||
ITEXTURE1D = 418,
|
||||
ITEXTURE2D = 419,
|
||||
ITEXTURE3D = 420,
|
||||
ITEXTURECUBE = 421,
|
||||
ITEXTURE1DARRAY = 422,
|
||||
ITEXTURE2DARRAY = 423,
|
||||
UTEXTURE1D = 424,
|
||||
UTEXTURE2D = 425,
|
||||
UTEXTURE3D = 426,
|
||||
UTEXTURECUBE = 427,
|
||||
UTEXTURE1DARRAY = 428,
|
||||
UTEXTURE2DARRAY = 429,
|
||||
TEXTURE2DRECT = 430,
|
||||
ITEXTURE2DRECT = 431,
|
||||
UTEXTURE2DRECT = 432,
|
||||
TEXTUREBUFFER = 433,
|
||||
ITEXTUREBUFFER = 434,
|
||||
UTEXTUREBUFFER = 435,
|
||||
TEXTURECUBEARRAY = 436,
|
||||
ITEXTURECUBEARRAY = 437,
|
||||
UTEXTURECUBEARRAY = 438,
|
||||
TEXTURE2DMS = 439,
|
||||
ITEXTURE2DMS = 440,
|
||||
UTEXTURE2DMS = 441,
|
||||
TEXTURE2DMSARRAY = 442,
|
||||
ITEXTURE2DMSARRAY = 443,
|
||||
UTEXTURE2DMSARRAY = 444,
|
||||
SUBPASSINPUT = 445,
|
||||
SUBPASSINPUTMS = 446,
|
||||
ISUBPASSINPUT = 447,
|
||||
ISUBPASSINPUTMS = 448,
|
||||
USUBPASSINPUT = 449,
|
||||
USUBPASSINPUTMS = 450,
|
||||
IMAGE1D = 451,
|
||||
IIMAGE1D = 452,
|
||||
UIMAGE1D = 453,
|
||||
IMAGE2D = 454,
|
||||
IIMAGE2D = 455,
|
||||
UIMAGE2D = 456,
|
||||
IMAGE3D = 457,
|
||||
IIMAGE3D = 458,
|
||||
UIMAGE3D = 459,
|
||||
IMAGE2DRECT = 460,
|
||||
IIMAGE2DRECT = 461,
|
||||
UIMAGE2DRECT = 462,
|
||||
IMAGECUBE = 463,
|
||||
IIMAGECUBE = 464,
|
||||
UIMAGECUBE = 465,
|
||||
IMAGEBUFFER = 466,
|
||||
IIMAGEBUFFER = 467,
|
||||
UIMAGEBUFFER = 468,
|
||||
IMAGE1DARRAY = 469,
|
||||
IIMAGE1DARRAY = 470,
|
||||
UIMAGE1DARRAY = 471,
|
||||
IMAGE2DARRAY = 472,
|
||||
IIMAGE2DARRAY = 473,
|
||||
UIMAGE2DARRAY = 474,
|
||||
IMAGECUBEARRAY = 475,
|
||||
IIMAGECUBEARRAY = 476,
|
||||
UIMAGECUBEARRAY = 477,
|
||||
IMAGE2DMS = 478,
|
||||
IIMAGE2DMS = 479,
|
||||
UIMAGE2DMS = 480,
|
||||
IMAGE2DMSARRAY = 481,
|
||||
IIMAGE2DMSARRAY = 482,
|
||||
UIMAGE2DMSARRAY = 483,
|
||||
STRUCT = 484,
|
||||
VOID = 485,
|
||||
WHILE = 486,
|
||||
IDENTIFIER = 487,
|
||||
TYPE_NAME = 488,
|
||||
FLOATCONSTANT = 489,
|
||||
DOUBLECONSTANT = 490,
|
||||
INTCONSTANT = 491,
|
||||
UINTCONSTANT = 492,
|
||||
INT64CONSTANT = 493,
|
||||
UINT64CONSTANT = 494,
|
||||
INT16CONSTANT = 495,
|
||||
UINT16CONSTANT = 496,
|
||||
BOOLCONSTANT = 497,
|
||||
FLOAT16CONSTANT = 498,
|
||||
LEFT_OP = 499,
|
||||
RIGHT_OP = 500,
|
||||
INC_OP = 501,
|
||||
DEC_OP = 502,
|
||||
LE_OP = 503,
|
||||
GE_OP = 504,
|
||||
EQ_OP = 505,
|
||||
NE_OP = 506,
|
||||
AND_OP = 507,
|
||||
OR_OP = 508,
|
||||
XOR_OP = 509,
|
||||
MUL_ASSIGN = 510,
|
||||
DIV_ASSIGN = 511,
|
||||
ADD_ASSIGN = 512,
|
||||
MOD_ASSIGN = 513,
|
||||
LEFT_ASSIGN = 514,
|
||||
RIGHT_ASSIGN = 515,
|
||||
AND_ASSIGN = 516,
|
||||
XOR_ASSIGN = 517,
|
||||
OR_ASSIGN = 518,
|
||||
SUB_ASSIGN = 519,
|
||||
LEFT_PAREN = 520,
|
||||
RIGHT_PAREN = 521,
|
||||
LEFT_BRACKET = 522,
|
||||
RIGHT_BRACKET = 523,
|
||||
LEFT_BRACE = 524,
|
||||
RIGHT_BRACE = 525,
|
||||
DOT = 526,
|
||||
COMMA = 527,
|
||||
COLON = 528,
|
||||
EQUAL = 529,
|
||||
SEMICOLON = 530,
|
||||
BANG = 531,
|
||||
DASH = 532,
|
||||
TILDE = 533,
|
||||
PLUS = 534,
|
||||
STAR = 535,
|
||||
SLASH = 536,
|
||||
PERCENT = 537,
|
||||
LEFT_ANGLE = 538,
|
||||
RIGHT_ANGLE = 539,
|
||||
VERTICAL_BAR = 540,
|
||||
CARET = 541,
|
||||
AMPERSAND = 542,
|
||||
QUESTION = 543,
|
||||
INVARIANT = 544,
|
||||
PRECISE = 545,
|
||||
HIGH_PRECISION = 546,
|
||||
MEDIUM_PRECISION = 547,
|
||||
LOW_PRECISION = 548,
|
||||
PRECISION = 549,
|
||||
PACKED = 550,
|
||||
RESOURCE = 551,
|
||||
SUPERP = 552
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Value type. */
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
|
||||
union YYSTYPE
|
||||
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
typedef union YYSTYPE
|
||||
{
|
||||
#line 68 "MachineIndependent/glslang.y" /* yacc.c:1909 */
|
||||
|
||||
/* Line 1676 of yacc.c */
|
||||
#line 68 "glslang.y"
|
||||
|
||||
struct {
|
||||
glslang::TSourceLoc loc;
|
||||
@ -372,16 +378,16 @@ union YYSTYPE
|
||||
};
|
||||
} interm;
|
||||
|
||||
#line 376 "MachineIndependent/glslang_tab.cpp.h" /* yacc.c:1909 */
|
||||
};
|
||||
|
||||
typedef union YYSTYPE YYSTYPE;
|
||||
|
||||
/* Line 1676 of yacc.c */
|
||||
#line 385 "glslang_tab.cpp.h"
|
||||
} YYSTYPE;
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
int yyparse (glslang::TParseContext* pParseContext);
|
||||
|
||||
#endif /* !YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED */
|
||||
|
@ -308,6 +308,13 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
|
||||
case EOpDoubleBitsToUint64: out.debug << "doubleBitsToUint64"; break;
|
||||
case EOpInt64BitsToDouble: out.debug << "int64BitsToDouble"; break;
|
||||
case EOpUint64BitsToDouble: out.debug << "uint64BitsToDouble"; break;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EOpFloat16BitsToInt16: out.debug << "float16BitsToInt16"; break;
|
||||
case EOpFloat16BitsToUint16: out.debug << "float16BitsToUint16"; break;
|
||||
case EOpInt16BitsToFloat16: out.debug << "int16BitsToFloat16"; break;
|
||||
case EOpUint16BitsToFloat16: out.debug << "uint16BitsToFloat16"; break;
|
||||
#endif
|
||||
|
||||
case EOpPackSnorm2x16: out.debug << "packSnorm2x16"; break;
|
||||
case EOpUnpackSnorm2x16:out.debug << "unpackSnorm2x16"; break;
|
||||
case EOpPackUnorm2x16: out.debug << "packUnorm2x16"; break;
|
||||
@ -328,6 +335,16 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
|
||||
case EOpUnpackUint2x32: out.debug << "unpackUint2x32"; break;
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EOpPackInt2x16: out.debug << "packInt2x16"; break;
|
||||
case EOpUnpackInt2x16: out.debug << "unpackInt2x16"; break;
|
||||
case EOpPackUint2x16: out.debug << "packUint2x16"; break;
|
||||
case EOpUnpackUint2x16: out.debug << "unpackUint2x16"; break;
|
||||
|
||||
case EOpPackInt4x16: out.debug << "packInt4x16"; break;
|
||||
case EOpUnpackInt4x16: out.debug << "unpackInt4x16"; break;
|
||||
case EOpPackUint4x16: out.debug << "packUint4x16"; break;
|
||||
case EOpUnpackUint4x16: out.debug << "unpackUint4x16"; break;
|
||||
|
||||
case EOpPackFloat2x16: out.debug << "packFloat2x16"; break;
|
||||
case EOpUnpackFloat2x16: out.debug << "unpackFloat2x16"; break;
|
||||
#endif
|
||||
@ -433,6 +450,42 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
|
||||
case EOpConvFloat16ToDouble: out.debug << "Convert float16 to double"; break;
|
||||
case EOpConvFloat16ToInt64: out.debug << "Convert float16 to int64"; break;
|
||||
case EOpConvFloat16ToUint64: out.debug << "Convert float16 to uint64"; break;
|
||||
|
||||
case EOpConvBoolToInt16: out.debug << "Convert bool to int16"; break;
|
||||
case EOpConvIntToInt16: out.debug << "Convert int to int16"; break;
|
||||
case EOpConvUintToInt16: out.debug << "Convert uint to int16"; break;
|
||||
case EOpConvFloatToInt16: out.debug << "Convert float to int16"; break;
|
||||
case EOpConvDoubleToInt16: out.debug << "Convert double to int16"; break;
|
||||
case EOpConvFloat16ToInt16: out.debug << "Convert float16 to int16"; break;
|
||||
case EOpConvInt64ToInt16: out.debug << "Convert int64 to int16"; break;
|
||||
case EOpConvUint64ToInt16: out.debug << "Convert uint64 to int16"; break;
|
||||
case EOpConvUint16ToInt16: out.debug << "Convert uint16 to int16"; break;
|
||||
case EOpConvInt16ToBool: out.debug << "Convert int16 to bool"; break;
|
||||
case EOpConvInt16ToInt: out.debug << "Convert int16 to int"; break;
|
||||
case EOpConvInt16ToUint: out.debug << "Convert int16 to uint"; break;
|
||||
case EOpConvInt16ToFloat: out.debug << "Convert int16 to float"; break;
|
||||
case EOpConvInt16ToDouble: out.debug << "Convert int16 to double"; break;
|
||||
case EOpConvInt16ToFloat16: out.debug << "Convert int16 to float16"; break;
|
||||
case EOpConvInt16ToInt64: out.debug << "Convert int16 to int64"; break;
|
||||
case EOpConvInt16ToUint64: out.debug << "Convert int16 to uint64"; break;
|
||||
|
||||
case EOpConvBoolToUint16: out.debug << "Convert bool to uint16"; break;
|
||||
case EOpConvIntToUint16: out.debug << "Convert int to uint16"; break;
|
||||
case EOpConvUintToUint16: out.debug << "Convert uint to uint16"; break;
|
||||
case EOpConvFloatToUint16: out.debug << "Convert float to uint16"; break;
|
||||
case EOpConvDoubleToUint16: out.debug << "Convert double to uint16"; break;
|
||||
case EOpConvFloat16ToUint16: out.debug << "Convert float16 to uint16"; break;
|
||||
case EOpConvInt64ToUint16: out.debug << "Convert int64 to uint16"; break;
|
||||
case EOpConvUint64ToUint16: out.debug << "Convert uint64 to uint16"; break;
|
||||
case EOpConvInt16ToUint16: out.debug << "Convert int16 to uint16"; break;
|
||||
case EOpConvUint16ToBool: out.debug << "Convert uint16 to bool"; break;
|
||||
case EOpConvUint16ToInt: out.debug << "Convert uint16 to int"; break;
|
||||
case EOpConvUint16ToUint: out.debug << "Convert uint16 to uint"; break;
|
||||
case EOpConvUint16ToFloat: out.debug << "Convert uint16 to float"; break;
|
||||
case EOpConvUint16ToDouble: out.debug << "Convert uint16 to double"; break;
|
||||
case EOpConvUint16ToFloat16: out.debug << "Convert uint16 to float16"; break;
|
||||
case EOpConvUint16ToInt64: out.debug << "Convert uint16 to int64"; break;
|
||||
case EOpConvUint16ToUint64: out.debug << "Convert uint16 to uint64"; break;
|
||||
#endif
|
||||
|
||||
default: out.debug.message(EPrefixError, "Bad unary op");
|
||||
@ -466,9 +519,13 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
|
||||
|
||||
case EOpConstructFloat: out.debug << "Construct float"; break;
|
||||
case EOpConstructDouble:out.debug << "Construct double"; break;
|
||||
|
||||
case EOpConstructVec2: out.debug << "Construct vec2"; break;
|
||||
case EOpConstructVec3: out.debug << "Construct vec3"; break;
|
||||
case EOpConstructVec4: out.debug << "Construct vec4"; break;
|
||||
case EOpConstructDVec2: out.debug << "Construct dvec2"; break;
|
||||
case EOpConstructDVec3: out.debug << "Construct dvec3"; break;
|
||||
case EOpConstructDVec4: out.debug << "Construct dvec4"; break;
|
||||
case EOpConstructBool: out.debug << "Construct bool"; break;
|
||||
case EOpConstructBVec2: out.debug << "Construct bvec2"; break;
|
||||
case EOpConstructBVec3: out.debug << "Construct bvec3"; break;
|
||||
@ -489,6 +546,16 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
|
||||
case EOpConstructU64Vec2: out.debug << "Construct u64vec2"; break;
|
||||
case EOpConstructU64Vec3: out.debug << "Construct u64vec3"; break;
|
||||
case EOpConstructU64Vec4: out.debug << "Construct u64vec4"; break;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EOpConstructInt16: out.debug << "Construct int16_t"; break;
|
||||
case EOpConstructI16Vec2: out.debug << "Construct i16vec2"; break;
|
||||
case EOpConstructI16Vec3: out.debug << "Construct i16vec3"; break;
|
||||
case EOpConstructI16Vec4: out.debug << "Construct i16vec4"; break;
|
||||
case EOpConstructUint16: out.debug << "Construct uint16_t"; break;
|
||||
case EOpConstructU16Vec2: out.debug << "Construct u16vec2"; break;
|
||||
case EOpConstructU16Vec3: out.debug << "Construct u16vec3"; break;
|
||||
case EOpConstructU16Vec4: out.debug << "Construct u16vec4"; break;
|
||||
#endif
|
||||
case EOpConstructMat2x2: out.debug << "Construct mat2"; break;
|
||||
case EOpConstructMat2x3: out.debug << "Construct mat2x3"; break;
|
||||
case EOpConstructMat2x4: out.debug << "Construct mat2x4"; break;
|
||||
@ -827,6 +894,26 @@ static void OutputConstantUnion(TInfoSink& out, const TIntermTyped* node, const
|
||||
out.debug << buf << "\n";
|
||||
}
|
||||
break;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtInt16:
|
||||
{
|
||||
const int maxSize = 300;
|
||||
char buf[maxSize];
|
||||
snprintf(buf, maxSize, "%d (%s)", constUnion[i].getIConst(), "const int16_t");
|
||||
|
||||
out.debug << buf << "\n";
|
||||
}
|
||||
break;
|
||||
case EbtUint16:
|
||||
{
|
||||
const int maxSize = 300;
|
||||
char buf[maxSize];
|
||||
snprintf(buf, maxSize, "%u (%s)", constUnion[i].getUConst(), "const uint16_t");
|
||||
|
||||
out.debug << buf << "\n";
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
out.info.message(EPrefixInternalError, "Unknown constant", node->getLoc());
|
||||
break;
|
||||
|
@ -1057,6 +1057,8 @@ int TIntermediate::getBaseAlignmentScalar(const TType& type, int& size)
|
||||
case EbtUint64:
|
||||
case EbtDouble: size = 8; return 8;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case EbtInt16:
|
||||
case EbtUint16:
|
||||
case EbtFloat16: size = 2; return 2;
|
||||
#endif
|
||||
default: size = 4; return 4;
|
||||
|
@ -285,6 +285,11 @@ public:
|
||||
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;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
TIntermConstantUnion* addConstantUnion(short, const TSourceLoc&, bool literal = false) const;
|
||||
TIntermConstantUnion* addConstantUnion(unsigned short, const TSourceLoc&, bool literal = false) const;
|
||||
|
||||
#endif
|
||||
TIntermConstantUnion* addConstantUnion(bool, const TSourceLoc&, bool literal = false) const;
|
||||
TIntermConstantUnion* addConstantUnion(double, TBasicType, const TSourceLoc&, bool literal = false) const;
|
||||
TIntermConstantUnion* addConstantUnion(const TString*, const TSourceLoc&, bool literal = false) const;
|
||||
|
@ -78,6 +78,7 @@ public:
|
||||
virtual void fullIntegerCheck(const TSourceLoc&, const char* op);
|
||||
virtual void doubleCheck(const TSourceLoc&, const char* op);
|
||||
#ifdef AMD_EXTENSIONS
|
||||
virtual void int16Check(const TSourceLoc& loc, const char* op, bool builtIn = false);
|
||||
virtual void float16Check(const TSourceLoc&, const char* op, bool builtIn = false);
|
||||
#endif
|
||||
virtual void int64Check(const TSourceLoc&, const char* op, bool builtIn = false);
|
||||
|
@ -724,6 +724,7 @@ int TPpContext::CPPerror(TPpToken* ppToken)
|
||||
if (token == PpAtomConstInt || token == PpAtomConstUint ||
|
||||
token == PpAtomConstInt64 || token == PpAtomConstUint64 ||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
token == PpAtomConstInt16 || token == PpAtomConstUint16 ||
|
||||
token == PpAtomConstFloat16 ||
|
||||
#endif
|
||||
token == PpAtomConstFloat || token == PpAtomConstDouble) {
|
||||
@ -758,6 +759,10 @@ int TPpContext::CPPpragma(TPpToken* ppToken)
|
||||
case PpAtomConstUint:
|
||||
case PpAtomConstInt64:
|
||||
case PpAtomConstUint64:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case PpAtomConstInt16:
|
||||
case PpAtomConstUint16:
|
||||
#endif
|
||||
case PpAtomConstFloat:
|
||||
case PpAtomConstDouble:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
|
@ -334,6 +334,9 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
||||
int ii = 0;
|
||||
unsigned long long ival = 0;
|
||||
bool enableInt64 = pp->parseContext.version >= 450 && pp->parseContext.extensionTurnedOn(E_GL_ARB_gpu_shader_int64);
|
||||
#ifdef AMD_EXTENSIONS
|
||||
bool enableInt16 = pp->parseContext.version >= 450 && pp->parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_int16);
|
||||
#endif
|
||||
bool acceptHalf = pp->parseContext.intermediate.getSource() == EShSourceHlsl;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
if (pp->parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float))
|
||||
@ -406,6 +409,9 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
||||
|
||||
bool isUnsigned = false;
|
||||
bool isInt64 = false;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
bool isInt16 = false;
|
||||
#endif
|
||||
ppToken->name[len++] = (char)ch;
|
||||
ch = getch();
|
||||
if ((ch >= '0' && ch <= '9') ||
|
||||
@ -414,7 +420,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
||||
|
||||
ival = 0;
|
||||
do {
|
||||
if (ival <= 0x0fffffff || (enableInt64 && ival <= 0x0fffffffffffffffull)) {
|
||||
if (ival <= 0x0fffffffu || (enableInt64 && ival <= 0x0fffffffffffffffull)) {
|
||||
ppToken->name[len++] = (char)ch;
|
||||
if (ch >= '0' && ch <= '9') {
|
||||
ii = ch - '0';
|
||||
@ -453,11 +459,28 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
||||
} else
|
||||
ungetch();
|
||||
}
|
||||
}
|
||||
else if (enableInt64 && (ch == 'l' || ch == 'L')) {
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
if (enableInt16) {
|
||||
int nextCh = getch();
|
||||
if ((ch == 'u' && nextCh == 's') || (ch == 'U' && nextCh == 'S')) {
|
||||
if (len < MaxTokenLength)
|
||||
ppToken->name[len++] = (char)nextCh;
|
||||
isInt16 = true;
|
||||
} else
|
||||
ungetch();
|
||||
}
|
||||
#endif
|
||||
} else if (enableInt64 && (ch == 'l' || ch == 'L')) {
|
||||
if (len < MaxTokenLength)
|
||||
ppToken->name[len++] = (char)ch;
|
||||
isInt64 = true;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
} else if (enableInt16 && (ch == 's' || ch == 'S')) {
|
||||
if (len < MaxTokenLength)
|
||||
ppToken->name[len++] = (char)ch;
|
||||
isInt16 = true;
|
||||
#endif
|
||||
} else
|
||||
ungetch();
|
||||
ppToken->name[len] = '\0';
|
||||
@ -465,6 +488,11 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
||||
if (isInt64) {
|
||||
ppToken->i64val = ival;
|
||||
return isUnsigned ? PpAtomConstUint64 : PpAtomConstInt64;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
} else if (isInt16) {
|
||||
ppToken->ival = (int)ival;
|
||||
return isUnsigned ? PpAtomConstUint16 : PpAtomConstInt16;
|
||||
#endif
|
||||
} else {
|
||||
ppToken->ival = (int)ival;
|
||||
return isUnsigned ? PpAtomConstUint : PpAtomConstInt;
|
||||
@ -474,6 +502,9 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
||||
|
||||
bool isUnsigned = false;
|
||||
bool isInt64 = false;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
bool isInt16 = false;
|
||||
#endif
|
||||
bool octalOverflow = false;
|
||||
bool nonOctal = false;
|
||||
ival = 0;
|
||||
@ -486,7 +517,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
||||
pp->parseContext.ppError(ppToken->loc, "numeric literal too long", "", "");
|
||||
AlreadyComplained = 1;
|
||||
}
|
||||
if (ival <= 0x1fffffff || (enableInt64 && ival <= 0x1fffffffffffffffull)) {
|
||||
if (ival <= 0x1fffffffu || (enableInt64 && ival <= 0x1fffffffffffffffull)) {
|
||||
ii = ch - '0';
|
||||
ival = (ival << 3) | ii;
|
||||
} else
|
||||
@ -528,11 +559,28 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
||||
} else
|
||||
ungetch();
|
||||
}
|
||||
}
|
||||
else if (enableInt64 && (ch == 'l' || ch == 'L')) {
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
if (enableInt16) {
|
||||
int nextCh = getch();
|
||||
if ((ch == 'u' && nextCh == 's') || (ch == 'U' && nextCh == 'S')) {
|
||||
if (len < MaxTokenLength)
|
||||
ppToken->name[len++] = (char)nextCh;
|
||||
isInt16 = true;
|
||||
} else
|
||||
ungetch();
|
||||
}
|
||||
#endif
|
||||
} else if (enableInt64 && (ch == 'l' || ch == 'L')) {
|
||||
if (len < MaxTokenLength)
|
||||
ppToken->name[len++] = (char)ch;
|
||||
isInt64 = true;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
} else if (enableInt16 && (ch == 's' || ch == 'S')) {
|
||||
if (len < MaxTokenLength)
|
||||
ppToken->name[len++] = (char)ch;
|
||||
isInt16 = true;
|
||||
#endif
|
||||
} else
|
||||
ungetch();
|
||||
ppToken->name[len] = '\0';
|
||||
@ -543,6 +591,11 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
||||
if (isInt64) {
|
||||
ppToken->i64val = ival;
|
||||
return isUnsigned ? PpAtomConstUint64 : PpAtomConstInt64;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
} else if (isInt16) {
|
||||
ppToken->ival = (int)ival;
|
||||
return isUnsigned ? PpAtomConstUint16 : PpAtomConstInt16;
|
||||
#endif
|
||||
} else {
|
||||
ppToken->ival = (int)ival;
|
||||
return isUnsigned ? PpAtomConstUint : PpAtomConstInt;
|
||||
@ -569,6 +622,9 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
||||
int numericLen = len;
|
||||
bool isUnsigned = false;
|
||||
bool isInt64 = false;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
bool isInt16 = false;
|
||||
#endif
|
||||
if (ch == 'u' || ch == 'U') {
|
||||
if (len < MaxTokenLength)
|
||||
ppToken->name[len++] = (char)ch;
|
||||
@ -583,10 +639,28 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
||||
} else
|
||||
ungetch();
|
||||
}
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
if (enableInt16) {
|
||||
int nextCh = getch();
|
||||
if ((ch == 'u' && nextCh == 's') || (ch == 'U' && nextCh == 'S')) {
|
||||
if (len < MaxTokenLength)
|
||||
ppToken->name[len++] = (char)nextCh;
|
||||
isInt16 = true;
|
||||
} else
|
||||
ungetch();
|
||||
}
|
||||
#endif
|
||||
} else if (enableInt64 && (ch == 'l' || ch == 'L')) {
|
||||
if (len < MaxTokenLength)
|
||||
ppToken->name[len++] = (char)ch;
|
||||
isInt64 = true;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
} else if (enableInt16 && (ch == 's' || ch == 'S')) {
|
||||
if (len < MaxTokenLength)
|
||||
ppToken->name[len++] = (char)ch;
|
||||
isInt16 = true;
|
||||
#endif
|
||||
} else
|
||||
ungetch();
|
||||
|
||||
@ -596,10 +670,22 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
||||
const unsigned remainderMaxInt = 0xFFFFFFFFu - 10 * oneTenthMaxInt;
|
||||
const unsigned long long oneTenthMaxInt64 = 0xFFFFFFFFFFFFFFFFull / 10;
|
||||
const unsigned long long remainderMaxInt64 = 0xFFFFFFFFFFFFFFFFull - 10 * oneTenthMaxInt64;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
const unsigned short oneTenthMaxInt16 = 0xFFFFu / 10;
|
||||
const unsigned short remainderMaxInt16 = 0xFFFFu - 10 * oneTenthMaxInt16;
|
||||
#endif
|
||||
for (int i = 0; i < numericLen; i++) {
|
||||
ch = ppToken->name[i] - '0';
|
||||
if ((enableInt64 == false && ((ival > oneTenthMaxInt) || (ival == oneTenthMaxInt && (unsigned)ch > remainderMaxInt))) ||
|
||||
(enableInt64 && ((ival > oneTenthMaxInt64) || (ival == oneTenthMaxInt64 && (unsigned long long)ch > remainderMaxInt64)))) {
|
||||
bool overflow = false;
|
||||
if (isInt64)
|
||||
overflow = (ival > oneTenthMaxInt64 || (ival == oneTenthMaxInt64 && (unsigned long long)ch > remainderMaxInt64));
|
||||
#ifdef AMD_EXTENSIONS
|
||||
else if (isInt16)
|
||||
overflow = (ival > oneTenthMaxInt16 || (ival == oneTenthMaxInt16 && (unsigned short)ch > remainderMaxInt16));
|
||||
#endif
|
||||
else
|
||||
overflow = (ival > oneTenthMaxInt || (ival == oneTenthMaxInt && (unsigned)ch > remainderMaxInt));
|
||||
if (overflow) {
|
||||
pp->parseContext.ppError(ppToken->loc, "numeric literal too big", "", "");
|
||||
ival = 0xFFFFFFFFFFFFFFFFull;
|
||||
break;
|
||||
@ -610,6 +696,11 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
||||
if (isInt64) {
|
||||
ppToken->i64val = ival;
|
||||
return isUnsigned ? PpAtomConstUint64 : PpAtomConstInt64;
|
||||
#ifdef AMD_EXTENSIONS
|
||||
} else if (isInt16) {
|
||||
ppToken->ival = (int)ival;
|
||||
return isUnsigned ? PpAtomConstUint16 : PpAtomConstInt16;
|
||||
#endif
|
||||
} else {
|
||||
ppToken->ival = (int)ival;
|
||||
return isUnsigned ? PpAtomConstUint : PpAtomConstInt;
|
||||
@ -859,6 +950,10 @@ int TPpContext::tokenize(TPpToken& ppToken)
|
||||
case PpAtomConstFloat:
|
||||
case PpAtomConstInt64:
|
||||
case PpAtomConstUint64:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case PpAtomConstInt16:
|
||||
case PpAtomConstUint16:
|
||||
#endif
|
||||
case PpAtomConstDouble:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case PpAtomConstFloat16:
|
||||
|
@ -141,6 +141,10 @@ void TPpContext::TokenStream::putToken(int token, TPpToken* ppToken)
|
||||
case PpAtomConstUint:
|
||||
case PpAtomConstInt64:
|
||||
case PpAtomConstUint64:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case PpAtomConstInt16:
|
||||
case PpAtomConstUint16:
|
||||
#endif
|
||||
case PpAtomConstFloat:
|
||||
case PpAtomConstDouble:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
@ -190,6 +194,10 @@ int TPpContext::TokenStream::getToken(TParseContextBase& parseContext, TPpToken
|
||||
case PpAtomConstUint:
|
||||
case PpAtomConstInt64:
|
||||
case PpAtomConstUint64:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case PpAtomConstInt16:
|
||||
case PpAtomConstUint16:
|
||||
#endif
|
||||
len = 0;
|
||||
ch = getSubtoken();
|
||||
while (ch != 0 && ch != EndOfInput) {
|
||||
@ -217,6 +225,9 @@ int TPpContext::TokenStream::getToken(TParseContextBase& parseContext, TPpToken
|
||||
ppToken->dval = atof(ppToken->name);
|
||||
break;
|
||||
case PpAtomConstInt:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case PpAtomConstInt16:
|
||||
#endif
|
||||
if (len > 0 && ppToken->name[0] == '0') {
|
||||
if (len > 1 && (ppToken->name[1] == 'x' || ppToken->name[1] == 'X'))
|
||||
ppToken->ival = (int)strtol(ppToken->name, 0, 16);
|
||||
@ -226,6 +237,9 @@ int TPpContext::TokenStream::getToken(TParseContextBase& parseContext, TPpToken
|
||||
ppToken->ival = atoi(ppToken->name);
|
||||
break;
|
||||
case PpAtomConstUint:
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case PpAtomConstUint16:
|
||||
#endif
|
||||
if (len > 0 && ppToken->name[0] == '0') {
|
||||
if (len > 1 && (ppToken->name[1] == 'x' || ppToken->name[1] == 'X'))
|
||||
ppToken->ival = (int)strtoul(ppToken->name, 0, 16);
|
||||
|
@ -127,6 +127,10 @@ enum EFixedAtoms {
|
||||
PpAtomConstUint,
|
||||
PpAtomConstInt64,
|
||||
PpAtomConstUint64,
|
||||
#ifdef AMD_EXTENSIONS
|
||||
PpAtomConstInt16,
|
||||
PpAtomConstUint16,
|
||||
#endif
|
||||
PpAtomConstFloat,
|
||||
PpAtomConstDouble,
|
||||
PpAtomConstFloat16,
|
||||
|
@ -396,6 +396,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
Glsl, CompileVulkanToSpirvTestAMD,
|
||||
::testing::ValuesIn(std::vector<std::string>({
|
||||
"spv.float16.frag",
|
||||
"spv.int16.frag",
|
||||
"spv.shaderBallotAMD.comp",
|
||||
"spv.textureGatherBiasLod.frag"
|
||||
})),
|
||||
|
Loading…
x
Reference in New Issue
Block a user