mirror of
https://github.com/KhronosGroup/glslang
synced 2024-11-08 19:40:06 +00:00
Parser: Implement extension GL_AMD_gpu_shader_half_float.
- Add built-in types: float16_t, f16vec, f16mat. - Add support of half float constant: hf, HF. - Extend built-in floating-point operators: +, -, *, /, ++, --, +=, -=, *=, /=, ==, !=, >=, <=, >, <. - Add support of type conversions: float16_t -> XXX, XXX -> float16_t. - Add new built-in functions.
This commit is contained in:
parent
b1672fa0de
commit
c9e3c3c941
@ -11,10 +11,12 @@ set(SPVREMAP_SOURCES
|
|||||||
doc.cpp)
|
doc.cpp)
|
||||||
|
|
||||||
set(HEADERS
|
set(HEADERS
|
||||||
|
bitutils.h
|
||||||
spirv.hpp
|
spirv.hpp
|
||||||
GLSL.std.450.h
|
GLSL.std.450.h
|
||||||
GLSL.ext.KHR.h
|
GLSL.ext.KHR.h
|
||||||
GlslangToSpv.h
|
GlslangToSpv.h
|
||||||
|
hex_float.h
|
||||||
Logger.h
|
Logger.h
|
||||||
SpvBuilder.h
|
SpvBuilder.h
|
||||||
spvIR.h
|
spvIR.h
|
||||||
@ -26,8 +28,9 @@ set(SPVREMAP_HEADERS
|
|||||||
doc.h)
|
doc.h)
|
||||||
|
|
||||||
if(ENABLE_AMD_EXTENSIONS)
|
if(ENABLE_AMD_EXTENSIONS)
|
||||||
set(HEADERS
|
list(APPEND
|
||||||
GLSL.ext.AMD.h)
|
HEADERS
|
||||||
|
GLSL.ext.AMD.h)
|
||||||
endif(ENABLE_AMD_EXTENSIONS)
|
endif(ENABLE_AMD_EXTENSIONS)
|
||||||
|
|
||||||
add_library(SPIRV STATIC ${SOURCES} ${HEADERS})
|
add_library(SPIRV STATIC ${SOURCES} ${HEADERS})
|
||||||
|
@ -32,7 +32,7 @@ enum Decoration;
|
|||||||
enum Op;
|
enum Op;
|
||||||
|
|
||||||
static const int GLSLextAMDVersion = 100;
|
static const int GLSLextAMDVersion = 100;
|
||||||
static const int GLSLextAMDRevision = 1;
|
static const int GLSLextAMDRevision = 2;
|
||||||
|
|
||||||
// SPV_AMD_shader_ballot
|
// SPV_AMD_shader_ballot
|
||||||
static const char* const E_SPV_AMD_shader_ballot = "SPV_AMD_shader_ballot";
|
static const char* const E_SPV_AMD_shader_ballot = "SPV_AMD_shader_ballot";
|
||||||
@ -110,4 +110,7 @@ enum GcnShaderAMD {
|
|||||||
GcnShaderCountAMD
|
GcnShaderCountAMD
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// SPV_AMD_gpu_shader_half_float
|
||||||
|
static const char* const E_SPV_AMD_gpu_shader_half_float = "SPV_AMD_gpu_shader_half_float";
|
||||||
|
|
||||||
#endif // #ifndef GLSLextAMD_H
|
#endif // #ifndef GLSLextAMD_H
|
||||||
|
@ -1215,6 +1215,10 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI
|
|||||||
one = builder.makeFloatConstant(1.0F);
|
one = builder.makeFloatConstant(1.0F);
|
||||||
else if (node->getBasicType() == glslang::EbtDouble)
|
else if (node->getBasicType() == glslang::EbtDouble)
|
||||||
one = builder.makeDoubleConstant(1.0);
|
one = builder.makeDoubleConstant(1.0);
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
else if (node->getBasicType() == glslang::EbtFloat16)
|
||||||
|
one = builder.makeFloat16Constant(1.0F);
|
||||||
|
#endif
|
||||||
else if (node->getBasicType() == glslang::EbtInt64 || node->getBasicType() == glslang::EbtUint64)
|
else if (node->getBasicType() == glslang::EbtInt64 || node->getBasicType() == glslang::EbtUint64)
|
||||||
one = builder.makeInt64Constant(1);
|
one = builder.makeInt64Constant(1);
|
||||||
else
|
else
|
||||||
@ -1388,6 +1392,17 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
|
|||||||
case glslang::EOpConstructDMat4x2:
|
case glslang::EOpConstructDMat4x2:
|
||||||
case glslang::EOpConstructDMat4x3:
|
case glslang::EOpConstructDMat4x3:
|
||||||
case glslang::EOpConstructDMat4x4:
|
case glslang::EOpConstructDMat4x4:
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case glslang::EOpConstructF16Mat2x2:
|
||||||
|
case glslang::EOpConstructF16Mat2x3:
|
||||||
|
case glslang::EOpConstructF16Mat2x4:
|
||||||
|
case glslang::EOpConstructF16Mat3x2:
|
||||||
|
case glslang::EOpConstructF16Mat3x3:
|
||||||
|
case glslang::EOpConstructF16Mat3x4:
|
||||||
|
case glslang::EOpConstructF16Mat4x2:
|
||||||
|
case glslang::EOpConstructF16Mat4x3:
|
||||||
|
case glslang::EOpConstructF16Mat4x4:
|
||||||
|
#endif
|
||||||
isMatrix = true;
|
isMatrix = true;
|
||||||
// fall through
|
// fall through
|
||||||
case glslang::EOpConstructFloat:
|
case glslang::EOpConstructFloat:
|
||||||
@ -1398,6 +1413,12 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
|
|||||||
case glslang::EOpConstructDVec2:
|
case glslang::EOpConstructDVec2:
|
||||||
case glslang::EOpConstructDVec3:
|
case glslang::EOpConstructDVec3:
|
||||||
case glslang::EOpConstructDVec4:
|
case glslang::EOpConstructDVec4:
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case glslang::EOpConstructFloat16:
|
||||||
|
case glslang::EOpConstructF16Vec2:
|
||||||
|
case glslang::EOpConstructF16Vec3:
|
||||||
|
case glslang::EOpConstructF16Vec4:
|
||||||
|
#endif
|
||||||
case glslang::EOpConstructBool:
|
case glslang::EOpConstructBool:
|
||||||
case glslang::EOpConstructBVec2:
|
case glslang::EOpConstructBVec2:
|
||||||
case glslang::EOpConstructBVec3:
|
case glslang::EOpConstructBVec3:
|
||||||
@ -1901,7 +1922,6 @@ spv::Id TGlslangToSpvTraverser::createInvertedSwizzle(spv::Decoration precision,
|
|||||||
return builder.createRvalueSwizzle(precision, convertGlslangToSpvType(node.getType()), parentResult, swizzle);
|
return builder.createRvalueSwizzle(precision, convertGlslangToSpvType(node.getType()), parentResult, swizzle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Convert a glslang AST swizzle node to a swizzle vector for building SPIR-V.
|
// Convert a glslang AST swizzle node to a swizzle vector for building SPIR-V.
|
||||||
void TGlslangToSpvTraverser::convertSwizzle(const glslang::TIntermAggregate& node, std::vector<unsigned>& swizzle)
|
void TGlslangToSpvTraverser::convertSwizzle(const glslang::TIntermAggregate& node, std::vector<unsigned>& swizzle)
|
||||||
{
|
{
|
||||||
@ -1936,6 +1956,13 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty
|
|||||||
case glslang::EbtDouble:
|
case glslang::EbtDouble:
|
||||||
spvType = builder.makeFloatType(64);
|
spvType = builder.makeFloatType(64);
|
||||||
break;
|
break;
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case glslang::EbtFloat16:
|
||||||
|
builder.addExtension(spv::E_SPV_AMD_gpu_shader_half_float);
|
||||||
|
builder.addCapability(spv::CapabilityFloat16);
|
||||||
|
spvType = builder.makeFloatType(16);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
case glslang::EbtBool:
|
case glslang::EbtBool:
|
||||||
// "transparent" bool doesn't exist in SPIR-V. The GLSL convention is
|
// "transparent" bool doesn't exist in SPIR-V. The GLSL convention is
|
||||||
// a 32-bit int where non-0 means true.
|
// a 32-bit int where non-0 means true.
|
||||||
@ -3040,7 +3067,11 @@ spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, spv
|
|||||||
glslang::TBasicType typeProxy, bool reduceComparison)
|
glslang::TBasicType typeProxy, bool reduceComparison)
|
||||||
{
|
{
|
||||||
bool isUnsigned = typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64;
|
bool isUnsigned = typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64;
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble || typeProxy == glslang::EbtFloat16;
|
||||||
|
#else
|
||||||
bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble;
|
bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble;
|
||||||
|
#endif
|
||||||
bool isBool = typeProxy == glslang::EbtBool;
|
bool isBool = typeProxy == glslang::EbtBool;
|
||||||
|
|
||||||
spv::Op binOp = spv::OpNop;
|
spv::Op binOp = spv::OpNop;
|
||||||
@ -3366,7 +3397,11 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv:
|
|||||||
int extBuiltins = -1;
|
int extBuiltins = -1;
|
||||||
int libCall = -1;
|
int libCall = -1;
|
||||||
bool isUnsigned = typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64;
|
bool isUnsigned = typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64;
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble || typeProxy == glslang::EbtFloat16;
|
||||||
|
#else
|
||||||
bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble;
|
bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble;
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case glslang::EOpNegative:
|
case glslang::EOpNegative:
|
||||||
@ -3550,6 +3585,13 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv:
|
|||||||
unaryOp = spv::OpBitcast;
|
unaryOp = spv::OpBitcast;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case glslang::EOpPackFloat2x16:
|
||||||
|
case glslang::EOpUnpackFloat2x16:
|
||||||
|
unaryOp = spv::OpBitcast;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case glslang::EOpDPdx:
|
case glslang::EOpDPdx:
|
||||||
unaryOp = spv::OpDPdx;
|
unaryOp = spv::OpDPdx;
|
||||||
break;
|
break;
|
||||||
@ -3746,22 +3788,40 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Dec
|
|||||||
zero = makeSmearedConstant(zero, vectorSize);
|
zero = makeSmearedConstant(zero, vectorSize);
|
||||||
return builder.createBinOp(spv::OpFOrdNotEqual, destType, operand, zero);
|
return builder.createBinOp(spv::OpFOrdNotEqual, destType, operand, zero);
|
||||||
|
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case glslang::EOpConvFloat16ToBool:
|
||||||
|
zero = builder.makeFloat16Constant(0.0F);
|
||||||
|
zero = makeSmearedConstant(zero, vectorSize);
|
||||||
|
return builder.createBinOp(spv::OpFOrdNotEqual, destType, operand, zero);
|
||||||
|
#endif
|
||||||
|
|
||||||
case glslang::EOpConvBoolToFloat:
|
case glslang::EOpConvBoolToFloat:
|
||||||
convOp = spv::OpSelect;
|
convOp = spv::OpSelect;
|
||||||
zero = builder.makeFloatConstant(0.0);
|
zero = builder.makeFloatConstant(0.0F);
|
||||||
one = builder.makeFloatConstant(1.0);
|
one = builder.makeFloatConstant(1.0F);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case glslang::EOpConvBoolToDouble:
|
case glslang::EOpConvBoolToDouble:
|
||||||
convOp = spv::OpSelect;
|
convOp = spv::OpSelect;
|
||||||
zero = builder.makeDoubleConstant(0.0);
|
zero = builder.makeDoubleConstant(0.0);
|
||||||
one = builder.makeDoubleConstant(1.0);
|
one = builder.makeDoubleConstant(1.0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case glslang::EOpConvBoolToFloat16:
|
||||||
|
convOp = spv::OpSelect;
|
||||||
|
zero = builder.makeFloat16Constant(0.0F);
|
||||||
|
one = builder.makeFloat16Constant(1.0F);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case glslang::EOpConvBoolToInt:
|
case glslang::EOpConvBoolToInt:
|
||||||
case glslang::EOpConvBoolToInt64:
|
case glslang::EOpConvBoolToInt64:
|
||||||
zero = (op == glslang::EOpConvBoolToInt64) ? builder.makeInt64Constant(0) : builder.makeIntConstant(0);
|
zero = (op == glslang::EOpConvBoolToInt64) ? builder.makeInt64Constant(0) : builder.makeIntConstant(0);
|
||||||
one = (op == glslang::EOpConvBoolToInt64) ? builder.makeInt64Constant(1) : builder.makeIntConstant(1);
|
one = (op == glslang::EOpConvBoolToInt64) ? builder.makeInt64Constant(1) : builder.makeIntConstant(1);
|
||||||
convOp = spv::OpSelect;
|
convOp = spv::OpSelect;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case glslang::EOpConvBoolToUint:
|
case glslang::EOpConvBoolToUint:
|
||||||
case glslang::EOpConvBoolToUint64:
|
case glslang::EOpConvBoolToUint64:
|
||||||
zero = (op == glslang::EOpConvBoolToUint64) ? builder.makeUint64Constant(0) : builder.makeUintConstant(0);
|
zero = (op == glslang::EOpConvBoolToUint64) ? builder.makeUint64Constant(0) : builder.makeUintConstant(0);
|
||||||
@ -3773,6 +3833,10 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Dec
|
|||||||
case glslang::EOpConvIntToDouble:
|
case glslang::EOpConvIntToDouble:
|
||||||
case glslang::EOpConvInt64ToFloat:
|
case glslang::EOpConvInt64ToFloat:
|
||||||
case glslang::EOpConvInt64ToDouble:
|
case glslang::EOpConvInt64ToDouble:
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case glslang::EOpConvIntToFloat16:
|
||||||
|
case glslang::EOpConvInt64ToFloat16:
|
||||||
|
#endif
|
||||||
convOp = spv::OpConvertSToF;
|
convOp = spv::OpConvertSToF;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -3780,11 +3844,21 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Dec
|
|||||||
case glslang::EOpConvUintToDouble:
|
case glslang::EOpConvUintToDouble:
|
||||||
case glslang::EOpConvUint64ToFloat:
|
case glslang::EOpConvUint64ToFloat:
|
||||||
case glslang::EOpConvUint64ToDouble:
|
case glslang::EOpConvUint64ToDouble:
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case glslang::EOpConvUintToFloat16:
|
||||||
|
case glslang::EOpConvUint64ToFloat16:
|
||||||
|
#endif
|
||||||
convOp = spv::OpConvertUToF;
|
convOp = spv::OpConvertUToF;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case glslang::EOpConvDoubleToFloat:
|
case glslang::EOpConvDoubleToFloat:
|
||||||
case glslang::EOpConvFloatToDouble:
|
case glslang::EOpConvFloatToDouble:
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case glslang::EOpConvDoubleToFloat16:
|
||||||
|
case glslang::EOpConvFloat16ToDouble:
|
||||||
|
case glslang::EOpConvFloatToFloat16:
|
||||||
|
case glslang::EOpConvFloat16ToFloat:
|
||||||
|
#endif
|
||||||
convOp = spv::OpFConvert;
|
convOp = spv::OpFConvert;
|
||||||
if (builder.isMatrixType(destType))
|
if (builder.isMatrixType(destType))
|
||||||
return createUnaryMatrixOperation(convOp, precision, noContraction, destType, operand, typeProxy);
|
return createUnaryMatrixOperation(convOp, precision, noContraction, destType, operand, typeProxy);
|
||||||
@ -3794,6 +3868,10 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Dec
|
|||||||
case glslang::EOpConvDoubleToInt:
|
case glslang::EOpConvDoubleToInt:
|
||||||
case glslang::EOpConvFloatToInt64:
|
case glslang::EOpConvFloatToInt64:
|
||||||
case glslang::EOpConvDoubleToInt64:
|
case glslang::EOpConvDoubleToInt64:
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case glslang::EOpConvFloat16ToInt:
|
||||||
|
case glslang::EOpConvFloat16ToInt64:
|
||||||
|
#endif
|
||||||
convOp = spv::OpConvertFToS;
|
convOp = spv::OpConvertFToS;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -3818,6 +3896,10 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Dec
|
|||||||
case glslang::EOpConvDoubleToUint:
|
case glslang::EOpConvDoubleToUint:
|
||||||
case glslang::EOpConvFloatToUint64:
|
case glslang::EOpConvFloatToUint64:
|
||||||
case glslang::EOpConvDoubleToUint64:
|
case glslang::EOpConvDoubleToUint64:
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case glslang::EOpConvFloat16ToUint:
|
||||||
|
case glslang::EOpConvFloat16ToUint64:
|
||||||
|
#endif
|
||||||
convOp = spv::OpConvertFToU;
|
convOp = spv::OpConvertFToU;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -3987,7 +4069,11 @@ spv::Id TGlslangToSpvTraverser::createAtomicOperation(glslang::TOperator op, spv
|
|||||||
spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op, spv::Id typeId, std::vector<spv::Id>& operands, glslang::TBasicType typeProxy)
|
spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op, spv::Id typeId, std::vector<spv::Id>& operands, glslang::TBasicType typeProxy)
|
||||||
{
|
{
|
||||||
bool isUnsigned = typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64;
|
bool isUnsigned = typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64;
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble || typeProxy == glslang::EbtFloat16;
|
||||||
|
#else
|
||||||
bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble;
|
bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble;
|
||||||
|
#endif
|
||||||
|
|
||||||
spv::Op opCode = spv::OpNop;
|
spv::Op opCode = spv::OpNop;
|
||||||
|
|
||||||
@ -4185,7 +4271,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)
|
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;
|
bool isUnsigned = typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64;
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble || typeProxy == glslang::EbtFloat16;
|
||||||
|
#else
|
||||||
bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble;
|
bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble;
|
||||||
|
#endif
|
||||||
|
|
||||||
spv::Op opCode = spv::OpNop;
|
spv::Op opCode = spv::OpNop;
|
||||||
int extBuiltins = -1;
|
int extBuiltins = -1;
|
||||||
@ -4715,6 +4805,11 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstUnionArray(const glsla
|
|||||||
case glslang::EbtDouble:
|
case glslang::EbtDouble:
|
||||||
spvConsts.push_back(builder.makeDoubleConstant(zero ? 0.0 : consts[nextConst].getDConst()));
|
spvConsts.push_back(builder.makeDoubleConstant(zero ? 0.0 : consts[nextConst].getDConst()));
|
||||||
break;
|
break;
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case glslang::EbtFloat16:
|
||||||
|
spvConsts.push_back(builder.makeFloat16Constant(zero ? 0.0F : (float)consts[nextConst].getDConst()));
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
case glslang::EbtBool:
|
case glslang::EbtBool:
|
||||||
spvConsts.push_back(builder.makeBoolConstant(zero ? false : consts[nextConst].getBConst()));
|
spvConsts.push_back(builder.makeBoolConstant(zero ? false : consts[nextConst].getBConst()));
|
||||||
break;
|
break;
|
||||||
@ -4747,6 +4842,11 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstUnionArray(const glsla
|
|||||||
case glslang::EbtDouble:
|
case glslang::EbtDouble:
|
||||||
scalar = builder.makeDoubleConstant(zero ? 0.0 : consts[nextConst].getDConst(), specConstant);
|
scalar = builder.makeDoubleConstant(zero ? 0.0 : consts[nextConst].getDConst(), specConstant);
|
||||||
break;
|
break;
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case glslang::EbtFloat16:
|
||||||
|
scalar = builder.makeFloat16Constant(zero ? 0.0F : (float)consts[nextConst].getDConst(), specConstant);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
case glslang::EbtBool:
|
case glslang::EbtBool:
|
||||||
scalar = builder.makeBoolConstant(zero ? false : consts[nextConst].getBConst(), specConstant);
|
scalar = builder.makeBoolConstant(zero ? false : consts[nextConst].getBConst(), specConstant);
|
||||||
break;
|
break;
|
||||||
|
@ -46,6 +46,10 @@
|
|||||||
|
|
||||||
#include "SpvBuilder.h"
|
#include "SpvBuilder.h"
|
||||||
|
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
#include "hex_float.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#endif
|
#endif
|
||||||
@ -785,6 +789,36 @@ Id Builder::makeDoubleConstant(double d, bool specConstant)
|
|||||||
return c->getResultId();
|
return c->getResultId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
Id Builder::makeFloat16Constant(float f16, bool specConstant)
|
||||||
|
{
|
||||||
|
Op opcode = specConstant ? OpSpecConstant : OpConstant;
|
||||||
|
Id typeId = makeFloatType(16);
|
||||||
|
|
||||||
|
spvutils::HexFloat<spvutils::FloatProxy<float>> fVal(f16);
|
||||||
|
spvutils::HexFloat<spvutils::FloatProxy<spvutils::Float16>> f16Val(0);
|
||||||
|
fVal.castTo(f16Val, spvutils::round_direction::kToZero);
|
||||||
|
|
||||||
|
unsigned value = f16Val.value().getAsFloat().get_value();
|
||||||
|
|
||||||
|
// See if we already made it. Applies only to regular constants, because specialization constants
|
||||||
|
// must remain distinct for the purpose of applying a SpecId decoration.
|
||||||
|
if (!specConstant) {
|
||||||
|
Id existing = findScalarConstant(OpTypeFloat, opcode, typeId, value);
|
||||||
|
if (existing)
|
||||||
|
return existing;
|
||||||
|
}
|
||||||
|
|
||||||
|
Instruction* c = new Instruction(getUniqueId(), typeId, opcode);
|
||||||
|
c->addImmediateOperand(value);
|
||||||
|
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(c));
|
||||||
|
groupedConstants[OpTypeFloat].push_back(c);
|
||||||
|
module.mapInstruction(c);
|
||||||
|
|
||||||
|
return c->getResultId();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
Id Builder::findCompositeConstant(Op typeClass, std::vector<Id>& comps) const
|
Id Builder::findCompositeConstant(Op typeClass, std::vector<Id>& comps) const
|
||||||
{
|
{
|
||||||
Instruction* constant = 0;
|
Instruction* constant = 0;
|
||||||
|
@ -191,6 +191,9 @@ public:
|
|||||||
Id makeUint64Constant(unsigned long long u, bool specConstant = false) { return makeInt64Constant(makeUintType(64), u, specConstant); }
|
Id makeUint64Constant(unsigned long long u, bool specConstant = false) { return makeInt64Constant(makeUintType(64), u, specConstant); }
|
||||||
Id makeFloatConstant(float f, bool specConstant = false);
|
Id makeFloatConstant(float f, bool specConstant = false);
|
||||||
Id makeDoubleConstant(double d, bool specConstant = false);
|
Id makeDoubleConstant(double d, bool specConstant = false);
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
Id makeFloat16Constant(float f16, bool specConstant = false);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Turn the array of constants into a proper spv constant of the requested type.
|
// Turn the array of constants into a proper spv constant of the requested type.
|
||||||
Id makeCompositeConstant(Id type, std::vector<Id>& comps, bool specConst = false);
|
Id makeCompositeConstant(Id type, std::vector<Id>& comps, bool specConst = false);
|
||||||
|
81
SPIRV/bitutils.h
Normal file
81
SPIRV/bitutils.h
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
// Copyright (c) 2015-2016 The Khronos Group Inc.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
#ifndef LIBSPIRV_UTIL_BITUTILS_H_
|
||||||
|
#define LIBSPIRV_UTIL_BITUTILS_H_
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
namespace spvutils {
|
||||||
|
|
||||||
|
// Performs a bitwise copy of source to the destination type Dest.
|
||||||
|
template <typename Dest, typename Src>
|
||||||
|
Dest BitwiseCast(Src source) {
|
||||||
|
Dest dest;
|
||||||
|
static_assert(sizeof(source) == sizeof(dest),
|
||||||
|
"BitwiseCast: Source and destination must have the same size");
|
||||||
|
std::memcpy(&dest, &source, sizeof(dest));
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetBits<T, First, Num> returns an integer of type <T> with bits set
|
||||||
|
// for position <First> through <First + Num - 1>, counting from the least
|
||||||
|
// significant bit. In particular when Num == 0, no positions are set to 1.
|
||||||
|
// A static assert will be triggered if First + Num > sizeof(T) * 8, that is,
|
||||||
|
// a bit that will not fit in the underlying type is set.
|
||||||
|
template <typename T, size_t First = 0, size_t Num = 0>
|
||||||
|
struct SetBits {
|
||||||
|
static_assert(First < sizeof(T) * 8,
|
||||||
|
"Tried to set a bit that is shifted too far.");
|
||||||
|
const static T get = (T(1) << First) | SetBits<T, First + 1, Num - 1>::get;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T, size_t Last>
|
||||||
|
struct SetBits<T, Last, 0> {
|
||||||
|
const static T get = T(0);
|
||||||
|
};
|
||||||
|
|
||||||
|
// This is all compile-time so we can put our tests right here.
|
||||||
|
static_assert(SetBits<uint32_t, 0, 0>::get == uint32_t(0x00000000),
|
||||||
|
"SetBits failed");
|
||||||
|
static_assert(SetBits<uint32_t, 0, 1>::get == uint32_t(0x00000001),
|
||||||
|
"SetBits failed");
|
||||||
|
static_assert(SetBits<uint32_t, 31, 1>::get == uint32_t(0x80000000),
|
||||||
|
"SetBits failed");
|
||||||
|
static_assert(SetBits<uint32_t, 1, 2>::get == uint32_t(0x00000006),
|
||||||
|
"SetBits failed");
|
||||||
|
static_assert(SetBits<uint32_t, 30, 2>::get == uint32_t(0xc0000000),
|
||||||
|
"SetBits failed");
|
||||||
|
static_assert(SetBits<uint32_t, 0, 31>::get == uint32_t(0x7FFFFFFF),
|
||||||
|
"SetBits failed");
|
||||||
|
static_assert(SetBits<uint32_t, 0, 32>::get == uint32_t(0xFFFFFFFF),
|
||||||
|
"SetBits failed");
|
||||||
|
static_assert(SetBits<uint32_t, 16, 16>::get == uint32_t(0xFFFF0000),
|
||||||
|
"SetBits failed");
|
||||||
|
|
||||||
|
static_assert(SetBits<uint64_t, 0, 1>::get == uint64_t(0x0000000000000001LL),
|
||||||
|
"SetBits failed");
|
||||||
|
static_assert(SetBits<uint64_t, 63, 1>::get == uint64_t(0x8000000000000000LL),
|
||||||
|
"SetBits failed");
|
||||||
|
static_assert(SetBits<uint64_t, 62, 2>::get == uint64_t(0xc000000000000000LL),
|
||||||
|
"SetBits failed");
|
||||||
|
static_assert(SetBits<uint64_t, 31, 1>::get == uint64_t(0x0000000080000000LL),
|
||||||
|
"SetBits failed");
|
||||||
|
static_assert(SetBits<uint64_t, 16, 16>::get == uint64_t(0x00000000FFFF0000LL),
|
||||||
|
"SetBits failed");
|
||||||
|
|
||||||
|
} // namespace spvutils
|
||||||
|
|
||||||
|
#endif // LIBSPIRV_UTIL_BITUTILS_H_
|
1076
SPIRV/hex_float.h
Normal file
1076
SPIRV/hex_float.h
Normal file
File diff suppressed because it is too large
Load Diff
837
Test/baseResults/spv.float16.frag.out
Normal file
837
Test/baseResults/spv.float16.frag.out
Normal file
@ -0,0 +1,837 @@
|
|||||||
|
spv.float16.frag
|
||||||
|
Warning, version 450 is not yet complete; most version-specific features are present, but some are missing.
|
||||||
|
|
||||||
|
|
||||||
|
Linked fragment stage:
|
||||||
|
|
||||||
|
|
||||||
|
// Module Version 10000
|
||||||
|
// Generated by (magic number): 80001
|
||||||
|
// Id's are bound by 535
|
||||||
|
|
||||||
|
Capability Shader
|
||||||
|
Capability Float16
|
||||||
|
Capability Float64
|
||||||
|
Capability Int64
|
||||||
|
Capability DerivativeControl
|
||||||
|
Capability InterpolationFunction
|
||||||
|
Extension "SPV_AMD_gpu_shader_half_float"
|
||||||
|
1: ExtInstImport "GLSL.std.450"
|
||||||
|
MemoryModel Logical GLSL450
|
||||||
|
EntryPoint Fragment 4 "main" 465
|
||||||
|
ExecutionMode 4 OriginUpperLeft
|
||||||
|
Source GLSL 450
|
||||||
|
SourceExtension "GL_AMD_gpu_shader_half_float"
|
||||||
|
SourceExtension "GL_ARB_gpu_shader_int64"
|
||||||
|
Name 4 "main"
|
||||||
|
Name 6 "literal("
|
||||||
|
Name 8 "operators("
|
||||||
|
Name 10 "typeCast("
|
||||||
|
Name 12 "builtinAngleTrigFuncs("
|
||||||
|
Name 14 "builtinExpFuncs("
|
||||||
|
Name 16 "builtinCommonFuncs("
|
||||||
|
Name 18 "builtinPackUnpackFuncs("
|
||||||
|
Name 20 "builtinGeometryFuncs("
|
||||||
|
Name 22 "builtinMatrixFuncs("
|
||||||
|
Name 24 "builtinVecRelFuncs("
|
||||||
|
Name 26 "builtinFragProcFuncs("
|
||||||
|
Name 31 "f16v"
|
||||||
|
Name 42 "f16v"
|
||||||
|
Name 64 "f16m"
|
||||||
|
Name 87 "f16"
|
||||||
|
Name 111 "b"
|
||||||
|
Name 153 "f16v"
|
||||||
|
Name 156 "bv"
|
||||||
|
Name 167 "fv"
|
||||||
|
Name 175 "dv"
|
||||||
|
Name 186 "iv"
|
||||||
|
Name 193 "uv"
|
||||||
|
Name 201 "i64v"
|
||||||
|
Name 209 "u64v"
|
||||||
|
Name 216 "f16v2"
|
||||||
|
Name 217 "f16v1"
|
||||||
|
Name 249 "f16v2"
|
||||||
|
Name 250 "f16v1"
|
||||||
|
Name 266 "f16v2"
|
||||||
|
Name 267 "f16v1"
|
||||||
|
Name 288 "f16"
|
||||||
|
Name 292 "f16v3"
|
||||||
|
Name 332 "bv"
|
||||||
|
Name 353 "b"
|
||||||
|
Name 363 "iv"
|
||||||
|
Name 364 "ResType"
|
||||||
|
Name 372 "u"
|
||||||
|
Name 373 "f16v"
|
||||||
|
Name 378 "f16"
|
||||||
|
Name 379 "f16v1"
|
||||||
|
Name 383 "f16v2"
|
||||||
|
Name 389 "f16v3"
|
||||||
|
Name 408 "f16m3"
|
||||||
|
Name 409 "f16m1"
|
||||||
|
Name 411 "f16m2"
|
||||||
|
Name 420 "f16v1"
|
||||||
|
Name 422 "f16v2"
|
||||||
|
Name 427 "f16m4"
|
||||||
|
Name 430 "f16"
|
||||||
|
Name 433 "f16m5"
|
||||||
|
Name 438 "f16m6"
|
||||||
|
Name 439 "f16m7"
|
||||||
|
Name 442 "bv"
|
||||||
|
Name 443 "f16v1"
|
||||||
|
Name 445 "f16v2"
|
||||||
|
Name 463 "f16v"
|
||||||
|
Name 465 "if16v"
|
||||||
|
Name 515 "S"
|
||||||
|
MemberName 515(S) 0 "x"
|
||||||
|
MemberName 515(S) 1 "y"
|
||||||
|
MemberName 515(S) 2 "z"
|
||||||
|
Name 517 "B1"
|
||||||
|
MemberName 517(B1) 0 "a"
|
||||||
|
MemberName 517(B1) 1 "b"
|
||||||
|
MemberName 517(B1) 2 "c"
|
||||||
|
MemberName 517(B1) 3 "d"
|
||||||
|
MemberName 517(B1) 4 "e"
|
||||||
|
MemberName 517(B1) 5 "f"
|
||||||
|
MemberName 517(B1) 6 "g"
|
||||||
|
MemberName 517(B1) 7 "h"
|
||||||
|
Name 519 ""
|
||||||
|
Name 522 "S"
|
||||||
|
MemberName 522(S) 0 "x"
|
||||||
|
MemberName 522(S) 1 "y"
|
||||||
|
MemberName 522(S) 2 "z"
|
||||||
|
Name 524 "B2"
|
||||||
|
MemberName 524(B2) 0 "o"
|
||||||
|
MemberName 524(B2) 1 "p"
|
||||||
|
MemberName 524(B2) 2 "q"
|
||||||
|
MemberName 524(B2) 3 "r"
|
||||||
|
MemberName 524(B2) 4 "s"
|
||||||
|
MemberName 524(B2) 5 "t"
|
||||||
|
MemberName 524(B2) 6 "u"
|
||||||
|
MemberName 524(B2) 7 "v"
|
||||||
|
Name 526 ""
|
||||||
|
Decorate 513 ArrayStride 16
|
||||||
|
Decorate 514 ArrayStride 32
|
||||||
|
MemberDecorate 515(S) 0 Offset 0
|
||||||
|
MemberDecorate 515(S) 1 Offset 4
|
||||||
|
MemberDecorate 515(S) 2 Offset 8
|
||||||
|
Decorate 516 ArrayStride 16
|
||||||
|
MemberDecorate 517(B1) 0 Offset 0
|
||||||
|
MemberDecorate 517(B1) 1 Offset 4
|
||||||
|
MemberDecorate 517(B1) 2 Offset 8
|
||||||
|
MemberDecorate 517(B1) 3 Offset 16
|
||||||
|
MemberDecorate 517(B1) 4 ColMajor
|
||||||
|
MemberDecorate 517(B1) 4 Offset 48
|
||||||
|
MemberDecorate 517(B1) 4 MatrixStride 16
|
||||||
|
MemberDecorate 517(B1) 5 ColMajor
|
||||||
|
MemberDecorate 517(B1) 5 Offset 80
|
||||||
|
MemberDecorate 517(B1) 5 MatrixStride 16
|
||||||
|
MemberDecorate 517(B1) 6 Offset 144
|
||||||
|
MemberDecorate 517(B1) 7 Offset 160
|
||||||
|
Decorate 517(B1) Block
|
||||||
|
Decorate 519 DescriptorSet 0
|
||||||
|
Decorate 520 ArrayStride 2
|
||||||
|
Decorate 521 ArrayStride 12
|
||||||
|
MemberDecorate 522(S) 0 Offset 0
|
||||||
|
MemberDecorate 522(S) 1 Offset 4
|
||||||
|
MemberDecorate 522(S) 2 Offset 8
|
||||||
|
Decorate 523 ArrayStride 16
|
||||||
|
MemberDecorate 524(B2) 0 Offset 0
|
||||||
|
MemberDecorate 524(B2) 1 Offset 4
|
||||||
|
MemberDecorate 524(B2) 2 Offset 8
|
||||||
|
MemberDecorate 524(B2) 3 Offset 14
|
||||||
|
MemberDecorate 524(B2) 4 RowMajor
|
||||||
|
MemberDecorate 524(B2) 4 Offset 20
|
||||||
|
MemberDecorate 524(B2) 4 MatrixStride 4
|
||||||
|
MemberDecorate 524(B2) 5 RowMajor
|
||||||
|
MemberDecorate 524(B2) 5 Offset 32
|
||||||
|
MemberDecorate 524(B2) 5 MatrixStride 4
|
||||||
|
MemberDecorate 524(B2) 6 Offset 56
|
||||||
|
MemberDecorate 524(B2) 7 Offset 72
|
||||||
|
Decorate 524(B2) BufferBlock
|
||||||
|
Decorate 526 DescriptorSet 0
|
||||||
|
Decorate 527 SpecId 100
|
||||||
|
Decorate 528 SpecId 101
|
||||||
|
Decorate 529 SpecId 102
|
||||||
|
2: TypeVoid
|
||||||
|
3: TypeFunction 2
|
||||||
|
28: TypeFloat 16
|
||||||
|
29: TypeVector 28(float) 2
|
||||||
|
30: TypePointer Function 29(fvec2)
|
||||||
|
32: 28(float) Constant 16
|
||||||
|
33: TypeInt 32 0
|
||||||
|
34: 33(int) Constant 0
|
||||||
|
35: TypePointer Function 28(float)
|
||||||
|
37: 28(float) Constant 46080
|
||||||
|
38: 28(float) Constant 10158
|
||||||
|
39: 29(fvec2) ConstantComposite 37 38
|
||||||
|
56: 28(float) Constant 15360
|
||||||
|
62: TypeMatrix 29(fvec2) 2
|
||||||
|
63: TypePointer Function 62
|
||||||
|
90: 33(int) Constant 1
|
||||||
|
109: TypeBool
|
||||||
|
110: TypePointer Function 109(bool)
|
||||||
|
151: TypeVector 28(float) 3
|
||||||
|
152: TypePointer Function 151(fvec3)
|
||||||
|
154: TypeVector 109(bool) 3
|
||||||
|
155: TypePointer Function 154(bvec3)
|
||||||
|
158: 28(float) Constant 0
|
||||||
|
159: 151(fvec3) ConstantComposite 158 158 158
|
||||||
|
160: 151(fvec3) ConstantComposite 56 56 56
|
||||||
|
164: TypeFloat 32
|
||||||
|
165: TypeVector 164(float) 3
|
||||||
|
166: TypePointer Function 165(fvec3)
|
||||||
|
172: TypeFloat 64
|
||||||
|
173: TypeVector 172(float) 3
|
||||||
|
174: TypePointer Function 173(fvec3)
|
||||||
|
183: TypeInt 32 1
|
||||||
|
184: TypeVector 183(int) 3
|
||||||
|
185: TypePointer Function 184(ivec3)
|
||||||
|
191: TypeVector 33(int) 3
|
||||||
|
192: TypePointer Function 191(ivec3)
|
||||||
|
198: TypeInt 64 1
|
||||||
|
199: TypeVector 198(int) 3
|
||||||
|
200: TypePointer Function 199(ivec3)
|
||||||
|
206: TypeInt 64 0
|
||||||
|
207: TypeVector 206(int) 3
|
||||||
|
208: TypePointer Function 207(ivec3)
|
||||||
|
214: TypeVector 28(float) 4
|
||||||
|
215: TypePointer Function 214(fvec4)
|
||||||
|
364(ResType): TypeStruct 151(fvec3) 184(ivec3)
|
||||||
|
371: TypePointer Function 33(int)
|
||||||
|
406: TypeMatrix 151(fvec3) 2
|
||||||
|
407: TypePointer Function 406
|
||||||
|
425: TypeMatrix 29(fvec2) 3
|
||||||
|
426: TypePointer Function 425
|
||||||
|
431: TypeMatrix 151(fvec3) 3
|
||||||
|
432: TypePointer Function 431
|
||||||
|
436: TypeMatrix 214(fvec4) 4
|
||||||
|
437: TypePointer Function 436
|
||||||
|
464: TypePointer Input 151(fvec3)
|
||||||
|
465(if16v): 464(ptr) Variable Input
|
||||||
|
466: TypePointer Input 28(float)
|
||||||
|
503: 183(int) Constant 1
|
||||||
|
508: TypeVector 164(float) 2
|
||||||
|
509: 164(float) Constant 1056964608
|
||||||
|
510: 508(fvec2) ConstantComposite 509 509
|
||||||
|
512: 33(int) Constant 2
|
||||||
|
513: TypeArray 28(float) 512
|
||||||
|
514: TypeArray 406 512
|
||||||
|
515(S): TypeStruct 28(float) 29(fvec2) 151(fvec3)
|
||||||
|
516: TypeArray 515(S) 512
|
||||||
|
517(B1): TypeStruct 28(float) 29(fvec2) 151(fvec3) 513 406 514 515(S) 516
|
||||||
|
518: TypePointer Uniform 517(B1)
|
||||||
|
519: 518(ptr) Variable Uniform
|
||||||
|
520: TypeArray 28(float) 512
|
||||||
|
521: TypeArray 406 512
|
||||||
|
522(S): TypeStruct 28(float) 29(fvec2) 151(fvec3)
|
||||||
|
523: TypeArray 522(S) 512
|
||||||
|
524(B2): TypeStruct 28(float) 29(fvec2) 151(fvec3) 520 406 521 522(S) 523
|
||||||
|
525: TypePointer Uniform 524(B2)
|
||||||
|
526: 525(ptr) Variable Uniform
|
||||||
|
527: 28(float) SpecConstant 12288
|
||||||
|
528: 164(float) SpecConstant 1048576000
|
||||||
|
529: 172(float) SpecConstant 0 1071644672
|
||||||
|
530: 164(float) SpecConstantOp 115 527
|
||||||
|
531: 164(float) SpecConstantOp 115 527
|
||||||
|
532: 172(float) SpecConstantOp 115 531
|
||||||
|
533: 28(float) SpecConstantOp 115 528
|
||||||
|
534: 28(float) SpecConstantOp 115 529
|
||||||
|
4(main): 2 Function None 3
|
||||||
|
5: Label
|
||||||
|
Return
|
||||||
|
FunctionEnd
|
||||||
|
6(literal(): 2 Function None 3
|
||||||
|
7: Label
|
||||||
|
31(f16v): 30(ptr) Variable Function
|
||||||
|
36: 35(ptr) AccessChain 31(f16v) 34
|
||||||
|
Store 36 32
|
||||||
|
40: 29(fvec2) Load 31(f16v)
|
||||||
|
41: 29(fvec2) FAdd 40 39
|
||||||
|
Store 31(f16v) 41
|
||||||
|
Return
|
||||||
|
FunctionEnd
|
||||||
|
8(operators(): 2 Function None 3
|
||||||
|
9: Label
|
||||||
|
42(f16v): 30(ptr) Variable Function
|
||||||
|
64(f16m): 63(ptr) Variable Function
|
||||||
|
87(f16): 35(ptr) Variable Function
|
||||||
|
111(b): 110(ptr) Variable Function
|
||||||
|
43: 29(fvec2) Load 42(f16v)
|
||||||
|
44: 29(fvec2) Load 42(f16v)
|
||||||
|
45: 29(fvec2) FAdd 44 43
|
||||||
|
Store 42(f16v) 45
|
||||||
|
46: 29(fvec2) Load 42(f16v)
|
||||||
|
47: 29(fvec2) Load 42(f16v)
|
||||||
|
48: 29(fvec2) FSub 47 46
|
||||||
|
Store 42(f16v) 48
|
||||||
|
49: 29(fvec2) Load 42(f16v)
|
||||||
|
50: 29(fvec2) Load 42(f16v)
|
||||||
|
51: 29(fvec2) FMul 50 49
|
||||||
|
Store 42(f16v) 51
|
||||||
|
52: 29(fvec2) Load 42(f16v)
|
||||||
|
53: 29(fvec2) Load 42(f16v)
|
||||||
|
54: 29(fvec2) FDiv 53 52
|
||||||
|
Store 42(f16v) 54
|
||||||
|
55: 29(fvec2) Load 42(f16v)
|
||||||
|
57: 29(fvec2) CompositeConstruct 56 56
|
||||||
|
58: 29(fvec2) FAdd 55 57
|
||||||
|
Store 42(f16v) 58
|
||||||
|
59: 29(fvec2) Load 42(f16v)
|
||||||
|
60: 29(fvec2) CompositeConstruct 56 56
|
||||||
|
61: 29(fvec2) FSub 59 60
|
||||||
|
Store 42(f16v) 61
|
||||||
|
65: 62 Load 64(f16m)
|
||||||
|
66: 29(fvec2) CompositeConstruct 56 56
|
||||||
|
67: 29(fvec2) CompositeExtract 65 0
|
||||||
|
68: 29(fvec2) FAdd 67 66
|
||||||
|
69: 29(fvec2) CompositeExtract 65 1
|
||||||
|
70: 29(fvec2) FAdd 69 66
|
||||||
|
71: 62 CompositeConstruct 68 70
|
||||||
|
Store 64(f16m) 71
|
||||||
|
72: 62 Load 64(f16m)
|
||||||
|
73: 29(fvec2) CompositeConstruct 56 56
|
||||||
|
74: 29(fvec2) CompositeExtract 72 0
|
||||||
|
75: 29(fvec2) FSub 74 73
|
||||||
|
76: 29(fvec2) CompositeExtract 72 1
|
||||||
|
77: 29(fvec2) FSub 76 73
|
||||||
|
78: 62 CompositeConstruct 75 77
|
||||||
|
Store 64(f16m) 78
|
||||||
|
79: 29(fvec2) Load 42(f16v)
|
||||||
|
80: 29(fvec2) FNegate 79
|
||||||
|
Store 42(f16v) 80
|
||||||
|
81: 62 Load 64(f16m)
|
||||||
|
82: 29(fvec2) CompositeExtract 81 0
|
||||||
|
83: 29(fvec2) FNegate 82
|
||||||
|
84: 29(fvec2) CompositeExtract 81 1
|
||||||
|
85: 29(fvec2) FNegate 84
|
||||||
|
86: 62 CompositeConstruct 83 85
|
||||||
|
Store 64(f16m) 86
|
||||||
|
88: 35(ptr) AccessChain 42(f16v) 34
|
||||||
|
89: 28(float) Load 88
|
||||||
|
91: 35(ptr) AccessChain 42(f16v) 90
|
||||||
|
92: 28(float) Load 91
|
||||||
|
93: 28(float) FAdd 89 92
|
||||||
|
Store 87(f16) 93
|
||||||
|
94: 35(ptr) AccessChain 42(f16v) 34
|
||||||
|
95: 28(float) Load 94
|
||||||
|
96: 35(ptr) AccessChain 42(f16v) 90
|
||||||
|
97: 28(float) Load 96
|
||||||
|
98: 28(float) FSub 95 97
|
||||||
|
Store 87(f16) 98
|
||||||
|
99: 35(ptr) AccessChain 42(f16v) 34
|
||||||
|
100: 28(float) Load 99
|
||||||
|
101: 35(ptr) AccessChain 42(f16v) 90
|
||||||
|
102: 28(float) Load 101
|
||||||
|
103: 28(float) FMul 100 102
|
||||||
|
Store 87(f16) 103
|
||||||
|
104: 35(ptr) AccessChain 42(f16v) 34
|
||||||
|
105: 28(float) Load 104
|
||||||
|
106: 35(ptr) AccessChain 42(f16v) 90
|
||||||
|
107: 28(float) Load 106
|
||||||
|
108: 28(float) FDiv 105 107
|
||||||
|
Store 87(f16) 108
|
||||||
|
112: 35(ptr) AccessChain 42(f16v) 34
|
||||||
|
113: 28(float) Load 112
|
||||||
|
114: 28(float) Load 87(f16)
|
||||||
|
115: 109(bool) FOrdNotEqual 113 114
|
||||||
|
Store 111(b) 115
|
||||||
|
116: 35(ptr) AccessChain 42(f16v) 90
|
||||||
|
117: 28(float) Load 116
|
||||||
|
118: 28(float) Load 87(f16)
|
||||||
|
119: 109(bool) FOrdEqual 117 118
|
||||||
|
Store 111(b) 119
|
||||||
|
120: 35(ptr) AccessChain 42(f16v) 34
|
||||||
|
121: 28(float) Load 120
|
||||||
|
122: 28(float) Load 87(f16)
|
||||||
|
123: 109(bool) FOrdGreaterThan 121 122
|
||||||
|
Store 111(b) 123
|
||||||
|
124: 35(ptr) AccessChain 42(f16v) 90
|
||||||
|
125: 28(float) Load 124
|
||||||
|
126: 28(float) Load 87(f16)
|
||||||
|
127: 109(bool) FOrdLessThan 125 126
|
||||||
|
Store 111(b) 127
|
||||||
|
128: 35(ptr) AccessChain 42(f16v) 34
|
||||||
|
129: 28(float) Load 128
|
||||||
|
130: 28(float) Load 87(f16)
|
||||||
|
131: 109(bool) FOrdGreaterThanEqual 129 130
|
||||||
|
Store 111(b) 131
|
||||||
|
132: 35(ptr) AccessChain 42(f16v) 90
|
||||||
|
133: 28(float) Load 132
|
||||||
|
134: 28(float) Load 87(f16)
|
||||||
|
135: 109(bool) FOrdLessThanEqual 133 134
|
||||||
|
Store 111(b) 135
|
||||||
|
136: 29(fvec2) Load 42(f16v)
|
||||||
|
137: 28(float) Load 87(f16)
|
||||||
|
138: 29(fvec2) VectorTimesScalar 136 137
|
||||||
|
Store 42(f16v) 138
|
||||||
|
139: 62 Load 64(f16m)
|
||||||
|
140: 28(float) Load 87(f16)
|
||||||
|
141: 62 MatrixTimesScalar 139 140
|
||||||
|
Store 64(f16m) 141
|
||||||
|
142: 62 Load 64(f16m)
|
||||||
|
143: 29(fvec2) Load 42(f16v)
|
||||||
|
144: 29(fvec2) MatrixTimesVector 142 143
|
||||||
|
Store 42(f16v) 144
|
||||||
|
145: 29(fvec2) Load 42(f16v)
|
||||||
|
146: 62 Load 64(f16m)
|
||||||
|
147: 29(fvec2) VectorTimesMatrix 145 146
|
||||||
|
Store 42(f16v) 147
|
||||||
|
148: 62 Load 64(f16m)
|
||||||
|
149: 62 Load 64(f16m)
|
||||||
|
150: 62 MatrixTimesMatrix 148 149
|
||||||
|
Store 64(f16m) 150
|
||||||
|
Return
|
||||||
|
FunctionEnd
|
||||||
|
10(typeCast(): 2 Function None 3
|
||||||
|
11: Label
|
||||||
|
153(f16v): 152(ptr) Variable Function
|
||||||
|
156(bv): 155(ptr) Variable Function
|
||||||
|
167(fv): 166(ptr) Variable Function
|
||||||
|
175(dv): 174(ptr) Variable Function
|
||||||
|
186(iv): 185(ptr) Variable Function
|
||||||
|
193(uv): 192(ptr) Variable Function
|
||||||
|
201(i64v): 200(ptr) Variable Function
|
||||||
|
209(u64v): 208(ptr) Variable Function
|
||||||
|
157: 154(bvec3) Load 156(bv)
|
||||||
|
161: 151(fvec3) Select 157 160 159
|
||||||
|
Store 153(f16v) 161
|
||||||
|
162: 151(fvec3) Load 153(f16v)
|
||||||
|
163: 154(bvec3) FOrdNotEqual 162 159
|
||||||
|
Store 156(bv) 163
|
||||||
|
168: 165(fvec3) Load 167(fv)
|
||||||
|
169: 151(fvec3) FConvert 168
|
||||||
|
Store 153(f16v) 169
|
||||||
|
170: 151(fvec3) Load 153(f16v)
|
||||||
|
171: 165(fvec3) FConvert 170
|
||||||
|
Store 167(fv) 171
|
||||||
|
176: 173(fvec3) Load 175(dv)
|
||||||
|
177: 151(fvec3) FConvert 176
|
||||||
|
Store 153(f16v) 177
|
||||||
|
178: 173(fvec3) Load 175(dv)
|
||||||
|
179: 172(float) CompositeExtract 178 0
|
||||||
|
180: 172(float) CompositeExtract 178 1
|
||||||
|
181: 172(float) CompositeExtract 178 2
|
||||||
|
182: 173(fvec3) CompositeConstruct 179 180 181
|
||||||
|
Store 175(dv) 182
|
||||||
|
187: 184(ivec3) Load 186(iv)
|
||||||
|
188: 151(fvec3) ConvertSToF 187
|
||||||
|
Store 153(f16v) 188
|
||||||
|
189: 151(fvec3) Load 153(f16v)
|
||||||
|
190: 184(ivec3) ConvertFToS 189
|
||||||
|
Store 186(iv) 190
|
||||||
|
194: 191(ivec3) Load 193(uv)
|
||||||
|
195: 151(fvec3) ConvertUToF 194
|
||||||
|
Store 153(f16v) 195
|
||||||
|
196: 151(fvec3) Load 153(f16v)
|
||||||
|
197: 191(ivec3) ConvertFToU 196
|
||||||
|
Store 193(uv) 197
|
||||||
|
202: 199(ivec3) Load 201(i64v)
|
||||||
|
203: 151(fvec3) ConvertSToF 202
|
||||||
|
Store 153(f16v) 203
|
||||||
|
204: 151(fvec3) Load 153(f16v)
|
||||||
|
205: 199(ivec3) ConvertFToS 204
|
||||||
|
Store 201(i64v) 205
|
||||||
|
210: 207(ivec3) Load 209(u64v)
|
||||||
|
211: 151(fvec3) ConvertUToF 210
|
||||||
|
Store 153(f16v) 211
|
||||||
|
212: 151(fvec3) Load 153(f16v)
|
||||||
|
213: 207(ivec3) ConvertFToU 212
|
||||||
|
Store 209(u64v) 213
|
||||||
|
Return
|
||||||
|
FunctionEnd
|
||||||
|
12(builtinAngleTrigFuncs(): 2 Function None 3
|
||||||
|
13: Label
|
||||||
|
216(f16v2): 215(ptr) Variable Function
|
||||||
|
217(f16v1): 215(ptr) Variable Function
|
||||||
|
218: 214(fvec4) Load 217(f16v1)
|
||||||
|
219: 214(fvec4) ExtInst 1(GLSL.std.450) 11(Radians) 218
|
||||||
|
Store 216(f16v2) 219
|
||||||
|
220: 214(fvec4) Load 217(f16v1)
|
||||||
|
221: 214(fvec4) ExtInst 1(GLSL.std.450) 12(Degrees) 220
|
||||||
|
Store 216(f16v2) 221
|
||||||
|
222: 214(fvec4) Load 217(f16v1)
|
||||||
|
223: 214(fvec4) ExtInst 1(GLSL.std.450) 13(Sin) 222
|
||||||
|
Store 216(f16v2) 223
|
||||||
|
224: 214(fvec4) Load 217(f16v1)
|
||||||
|
225: 214(fvec4) ExtInst 1(GLSL.std.450) 14(Cos) 224
|
||||||
|
Store 216(f16v2) 225
|
||||||
|
226: 214(fvec4) Load 217(f16v1)
|
||||||
|
227: 214(fvec4) ExtInst 1(GLSL.std.450) 15(Tan) 226
|
||||||
|
Store 216(f16v2) 227
|
||||||
|
228: 214(fvec4) Load 217(f16v1)
|
||||||
|
229: 214(fvec4) ExtInst 1(GLSL.std.450) 16(Asin) 228
|
||||||
|
Store 216(f16v2) 229
|
||||||
|
230: 214(fvec4) Load 217(f16v1)
|
||||||
|
231: 214(fvec4) ExtInst 1(GLSL.std.450) 17(Acos) 230
|
||||||
|
Store 216(f16v2) 231
|
||||||
|
232: 214(fvec4) Load 217(f16v1)
|
||||||
|
233: 214(fvec4) Load 216(f16v2)
|
||||||
|
234: 214(fvec4) ExtInst 1(GLSL.std.450) 25(Atan2) 232 233
|
||||||
|
Store 216(f16v2) 234
|
||||||
|
235: 214(fvec4) Load 217(f16v1)
|
||||||
|
236: 214(fvec4) ExtInst 1(GLSL.std.450) 18(Atan) 235
|
||||||
|
Store 216(f16v2) 236
|
||||||
|
237: 214(fvec4) Load 217(f16v1)
|
||||||
|
238: 214(fvec4) ExtInst 1(GLSL.std.450) 19(Sinh) 237
|
||||||
|
Store 216(f16v2) 238
|
||||||
|
239: 214(fvec4) Load 217(f16v1)
|
||||||
|
240: 214(fvec4) ExtInst 1(GLSL.std.450) 20(Cosh) 239
|
||||||
|
Store 216(f16v2) 240
|
||||||
|
241: 214(fvec4) Load 217(f16v1)
|
||||||
|
242: 214(fvec4) ExtInst 1(GLSL.std.450) 21(Tanh) 241
|
||||||
|
Store 216(f16v2) 242
|
||||||
|
243: 214(fvec4) Load 217(f16v1)
|
||||||
|
244: 214(fvec4) ExtInst 1(GLSL.std.450) 22(Asinh) 243
|
||||||
|
Store 216(f16v2) 244
|
||||||
|
245: 214(fvec4) Load 217(f16v1)
|
||||||
|
246: 214(fvec4) ExtInst 1(GLSL.std.450) 23(Acosh) 245
|
||||||
|
Store 216(f16v2) 246
|
||||||
|
247: 214(fvec4) Load 217(f16v1)
|
||||||
|
248: 214(fvec4) ExtInst 1(GLSL.std.450) 24(Atanh) 247
|
||||||
|
Store 216(f16v2) 248
|
||||||
|
Return
|
||||||
|
FunctionEnd
|
||||||
|
14(builtinExpFuncs(): 2 Function None 3
|
||||||
|
15: Label
|
||||||
|
249(f16v2): 30(ptr) Variable Function
|
||||||
|
250(f16v1): 30(ptr) Variable Function
|
||||||
|
251: 29(fvec2) Load 250(f16v1)
|
||||||
|
252: 29(fvec2) Load 249(f16v2)
|
||||||
|
253: 29(fvec2) ExtInst 1(GLSL.std.450) 26(Pow) 251 252
|
||||||
|
Store 249(f16v2) 253
|
||||||
|
254: 29(fvec2) Load 250(f16v1)
|
||||||
|
255: 29(fvec2) ExtInst 1(GLSL.std.450) 27(Exp) 254
|
||||||
|
Store 249(f16v2) 255
|
||||||
|
256: 29(fvec2) Load 250(f16v1)
|
||||||
|
257: 29(fvec2) ExtInst 1(GLSL.std.450) 28(Log) 256
|
||||||
|
Store 249(f16v2) 257
|
||||||
|
258: 29(fvec2) Load 250(f16v1)
|
||||||
|
259: 29(fvec2) ExtInst 1(GLSL.std.450) 29(Exp2) 258
|
||||||
|
Store 249(f16v2) 259
|
||||||
|
260: 29(fvec2) Load 250(f16v1)
|
||||||
|
261: 29(fvec2) ExtInst 1(GLSL.std.450) 30(Log2) 260
|
||||||
|
Store 249(f16v2) 261
|
||||||
|
262: 29(fvec2) Load 250(f16v1)
|
||||||
|
263: 29(fvec2) ExtInst 1(GLSL.std.450) 31(Sqrt) 262
|
||||||
|
Store 249(f16v2) 263
|
||||||
|
264: 29(fvec2) Load 250(f16v1)
|
||||||
|
265: 29(fvec2) ExtInst 1(GLSL.std.450) 32(InverseSqrt) 264
|
||||||
|
Store 249(f16v2) 265
|
||||||
|
Return
|
||||||
|
FunctionEnd
|
||||||
|
16(builtinCommonFuncs(): 2 Function None 3
|
||||||
|
17: Label
|
||||||
|
266(f16v2): 152(ptr) Variable Function
|
||||||
|
267(f16v1): 152(ptr) Variable Function
|
||||||
|
288(f16): 35(ptr) Variable Function
|
||||||
|
292(f16v3): 152(ptr) Variable Function
|
||||||
|
332(bv): 155(ptr) Variable Function
|
||||||
|
353(b): 110(ptr) Variable Function
|
||||||
|
363(iv): 185(ptr) Variable Function
|
||||||
|
268: 151(fvec3) Load 267(f16v1)
|
||||||
|
269: 151(fvec3) ExtInst 1(GLSL.std.450) 4(FAbs) 268
|
||||||
|
Store 266(f16v2) 269
|
||||||
|
270: 151(fvec3) Load 267(f16v1)
|
||||||
|
271: 151(fvec3) ExtInst 1(GLSL.std.450) 6(FSign) 270
|
||||||
|
Store 266(f16v2) 271
|
||||||
|
272: 151(fvec3) Load 267(f16v1)
|
||||||
|
273: 151(fvec3) ExtInst 1(GLSL.std.450) 8(Floor) 272
|
||||||
|
Store 266(f16v2) 273
|
||||||
|
274: 151(fvec3) Load 267(f16v1)
|
||||||
|
275: 151(fvec3) ExtInst 1(GLSL.std.450) 3(Trunc) 274
|
||||||
|
Store 266(f16v2) 275
|
||||||
|
276: 151(fvec3) Load 267(f16v1)
|
||||||
|
277: 151(fvec3) ExtInst 1(GLSL.std.450) 1(Round) 276
|
||||||
|
Store 266(f16v2) 277
|
||||||
|
278: 151(fvec3) Load 267(f16v1)
|
||||||
|
279: 151(fvec3) ExtInst 1(GLSL.std.450) 2(RoundEven) 278
|
||||||
|
Store 266(f16v2) 279
|
||||||
|
280: 151(fvec3) Load 267(f16v1)
|
||||||
|
281: 151(fvec3) ExtInst 1(GLSL.std.450) 9(Ceil) 280
|
||||||
|
Store 266(f16v2) 281
|
||||||
|
282: 151(fvec3) Load 267(f16v1)
|
||||||
|
283: 151(fvec3) ExtInst 1(GLSL.std.450) 10(Fract) 282
|
||||||
|
Store 266(f16v2) 283
|
||||||
|
284: 151(fvec3) Load 267(f16v1)
|
||||||
|
285: 151(fvec3) Load 266(f16v2)
|
||||||
|
286: 151(fvec3) FMod 284 285
|
||||||
|
Store 266(f16v2) 286
|
||||||
|
287: 151(fvec3) Load 267(f16v1)
|
||||||
|
289: 28(float) Load 288(f16)
|
||||||
|
290: 151(fvec3) CompositeConstruct 289 289 289
|
||||||
|
291: 151(fvec3) FMod 287 290
|
||||||
|
Store 266(f16v2) 291
|
||||||
|
293: 151(fvec3) Load 267(f16v1)
|
||||||
|
294: 151(fvec3) ExtInst 1(GLSL.std.450) 35(Modf) 293 266(f16v2)
|
||||||
|
Store 292(f16v3) 294
|
||||||
|
295: 151(fvec3) Load 267(f16v1)
|
||||||
|
296: 151(fvec3) Load 266(f16v2)
|
||||||
|
297: 151(fvec3) ExtInst 1(GLSL.std.450) 37(FMin) 295 296
|
||||||
|
Store 292(f16v3) 297
|
||||||
|
298: 151(fvec3) Load 267(f16v1)
|
||||||
|
299: 28(float) Load 288(f16)
|
||||||
|
300: 151(fvec3) CompositeConstruct 299 299 299
|
||||||
|
301: 151(fvec3) ExtInst 1(GLSL.std.450) 37(FMin) 298 300
|
||||||
|
Store 292(f16v3) 301
|
||||||
|
302: 151(fvec3) Load 267(f16v1)
|
||||||
|
303: 151(fvec3) Load 266(f16v2)
|
||||||
|
304: 151(fvec3) ExtInst 1(GLSL.std.450) 40(FMax) 302 303
|
||||||
|
Store 292(f16v3) 304
|
||||||
|
305: 151(fvec3) Load 267(f16v1)
|
||||||
|
306: 28(float) Load 288(f16)
|
||||||
|
307: 151(fvec3) CompositeConstruct 306 306 306
|
||||||
|
308: 151(fvec3) ExtInst 1(GLSL.std.450) 40(FMax) 305 307
|
||||||
|
Store 292(f16v3) 308
|
||||||
|
309: 151(fvec3) Load 267(f16v1)
|
||||||
|
310: 28(float) Load 288(f16)
|
||||||
|
311: 35(ptr) AccessChain 266(f16v2) 34
|
||||||
|
312: 28(float) Load 311
|
||||||
|
313: 151(fvec3) CompositeConstruct 310 310 310
|
||||||
|
314: 151(fvec3) CompositeConstruct 312 312 312
|
||||||
|
315: 151(fvec3) ExtInst 1(GLSL.std.450) 43(FClamp) 309 313 314
|
||||||
|
Store 292(f16v3) 315
|
||||||
|
316: 151(fvec3) Load 267(f16v1)
|
||||||
|
317: 151(fvec3) Load 266(f16v2)
|
||||||
|
318: 28(float) Load 288(f16)
|
||||||
|
319: 151(fvec3) CompositeConstruct 318 318 318
|
||||||
|
320: 151(fvec3) ExtInst 1(GLSL.std.450) 43(FClamp) 316 317 319
|
||||||
|
Store 292(f16v3) 320
|
||||||
|
321: 151(fvec3) Load 267(f16v1)
|
||||||
|
322: 151(fvec3) Load 266(f16v2)
|
||||||
|
323: 28(float) Load 288(f16)
|
||||||
|
324: 151(fvec3) CompositeConstruct 323 323 323
|
||||||
|
325: 151(fvec3) ExtInst 1(GLSL.std.450) 46(FMix) 321 322 324
|
||||||
|
Store 292(f16v3) 325
|
||||||
|
326: 151(fvec3) Load 267(f16v1)
|
||||||
|
327: 151(fvec3) Load 266(f16v2)
|
||||||
|
328: 151(fvec3) Load 292(f16v3)
|
||||||
|
329: 151(fvec3) ExtInst 1(GLSL.std.450) 46(FMix) 326 327 328
|
||||||
|
Store 292(f16v3) 329
|
||||||
|
330: 151(fvec3) Load 267(f16v1)
|
||||||
|
331: 151(fvec3) Load 266(f16v2)
|
||||||
|
333: 154(bvec3) Load 332(bv)
|
||||||
|
334: 151(fvec3) Select 333 331 330
|
||||||
|
Store 292(f16v3) 334
|
||||||
|
335: 151(fvec3) Load 267(f16v1)
|
||||||
|
336: 151(fvec3) Load 266(f16v2)
|
||||||
|
337: 151(fvec3) ExtInst 1(GLSL.std.450) 48(Step) 335 336
|
||||||
|
Store 292(f16v3) 337
|
||||||
|
338: 28(float) Load 288(f16)
|
||||||
|
339: 151(fvec3) Load 292(f16v3)
|
||||||
|
340: 151(fvec3) CompositeConstruct 338 338 338
|
||||||
|
341: 151(fvec3) ExtInst 1(GLSL.std.450) 48(Step) 340 339
|
||||||
|
Store 292(f16v3) 341
|
||||||
|
342: 151(fvec3) Load 267(f16v1)
|
||||||
|
343: 151(fvec3) Load 266(f16v2)
|
||||||
|
344: 151(fvec3) Load 292(f16v3)
|
||||||
|
345: 151(fvec3) ExtInst 1(GLSL.std.450) 49(SmoothStep) 342 343 344
|
||||||
|
Store 292(f16v3) 345
|
||||||
|
346: 28(float) Load 288(f16)
|
||||||
|
347: 35(ptr) AccessChain 267(f16v1) 34
|
||||||
|
348: 28(float) Load 347
|
||||||
|
349: 151(fvec3) Load 266(f16v2)
|
||||||
|
350: 151(fvec3) CompositeConstruct 346 346 346
|
||||||
|
351: 151(fvec3) CompositeConstruct 348 348 348
|
||||||
|
352: 151(fvec3) ExtInst 1(GLSL.std.450) 49(SmoothStep) 350 351 349
|
||||||
|
Store 292(f16v3) 352
|
||||||
|
354: 28(float) Load 288(f16)
|
||||||
|
355: 109(bool) IsNan 354
|
||||||
|
Store 353(b) 355
|
||||||
|
356: 151(fvec3) Load 267(f16v1)
|
||||||
|
357: 154(bvec3) IsInf 356
|
||||||
|
Store 332(bv) 357
|
||||||
|
358: 151(fvec3) Load 267(f16v1)
|
||||||
|
359: 151(fvec3) Load 266(f16v2)
|
||||||
|
360: 151(fvec3) Load 292(f16v3)
|
||||||
|
361: 151(fvec3) ExtInst 1(GLSL.std.450) 50(Fma) 358 359 360
|
||||||
|
Store 292(f16v3) 361
|
||||||
|
362: 151(fvec3) Load 267(f16v1)
|
||||||
|
365:364(ResType) ExtInst 1(GLSL.std.450) 52(FrexpStruct) 362
|
||||||
|
366: 184(ivec3) CompositeExtract 365 1
|
||||||
|
Store 363(iv) 366
|
||||||
|
367: 151(fvec3) CompositeExtract 365 0
|
||||||
|
Store 266(f16v2) 367
|
||||||
|
368: 151(fvec3) Load 267(f16v1)
|
||||||
|
369: 184(ivec3) Load 363(iv)
|
||||||
|
370: 151(fvec3) ExtInst 1(GLSL.std.450) 53(Ldexp) 368 369
|
||||||
|
Store 266(f16v2) 370
|
||||||
|
Return
|
||||||
|
FunctionEnd
|
||||||
|
18(builtinPackUnpackFuncs(): 2 Function None 3
|
||||||
|
19: Label
|
||||||
|
372(u): 371(ptr) Variable Function
|
||||||
|
373(f16v): 30(ptr) Variable Function
|
||||||
|
374: 29(fvec2) Load 373(f16v)
|
||||||
|
375: 33(int) Bitcast 374
|
||||||
|
Store 372(u) 375
|
||||||
|
376: 33(int) Load 372(u)
|
||||||
|
377: 29(fvec2) Bitcast 376
|
||||||
|
Store 373(f16v) 377
|
||||||
|
Return
|
||||||
|
FunctionEnd
|
||||||
|
20(builtinGeometryFuncs(): 2 Function None 3
|
||||||
|
21: Label
|
||||||
|
378(f16): 35(ptr) Variable Function
|
||||||
|
379(f16v1): 152(ptr) Variable Function
|
||||||
|
383(f16v2): 152(ptr) Variable Function
|
||||||
|
389(f16v3): 152(ptr) Variable Function
|
||||||
|
380: 151(fvec3) Load 379(f16v1)
|
||||||
|
381: 28(float) ExtInst 1(GLSL.std.450) 66(Length) 380
|
||||||
|
Store 378(f16) 381
|
||||||
|
382: 151(fvec3) Load 379(f16v1)
|
||||||
|
384: 151(fvec3) Load 383(f16v2)
|
||||||
|
385: 28(float) ExtInst 1(GLSL.std.450) 67(Distance) 382 384
|
||||||
|
Store 378(f16) 385
|
||||||
|
386: 151(fvec3) Load 379(f16v1)
|
||||||
|
387: 151(fvec3) Load 383(f16v2)
|
||||||
|
388: 28(float) Dot 386 387
|
||||||
|
Store 378(f16) 388
|
||||||
|
390: 151(fvec3) Load 379(f16v1)
|
||||||
|
391: 151(fvec3) Load 383(f16v2)
|
||||||
|
392: 151(fvec3) ExtInst 1(GLSL.std.450) 68(Cross) 390 391
|
||||||
|
Store 389(f16v3) 392
|
||||||
|
393: 151(fvec3) Load 379(f16v1)
|
||||||
|
394: 151(fvec3) ExtInst 1(GLSL.std.450) 69(Normalize) 393
|
||||||
|
Store 383(f16v2) 394
|
||||||
|
395: 151(fvec3) Load 379(f16v1)
|
||||||
|
396: 151(fvec3) Load 383(f16v2)
|
||||||
|
397: 151(fvec3) Load 389(f16v3)
|
||||||
|
398: 151(fvec3) ExtInst 1(GLSL.std.450) 70(FaceForward) 395 396 397
|
||||||
|
Store 389(f16v3) 398
|
||||||
|
399: 151(fvec3) Load 379(f16v1)
|
||||||
|
400: 151(fvec3) Load 383(f16v2)
|
||||||
|
401: 151(fvec3) ExtInst 1(GLSL.std.450) 71(Reflect) 399 400
|
||||||
|
Store 389(f16v3) 401
|
||||||
|
402: 151(fvec3) Load 379(f16v1)
|
||||||
|
403: 151(fvec3) Load 383(f16v2)
|
||||||
|
404: 28(float) Load 378(f16)
|
||||||
|
405: 151(fvec3) ExtInst 1(GLSL.std.450) 72(Refract) 402 403 404
|
||||||
|
Store 389(f16v3) 405
|
||||||
|
Return
|
||||||
|
FunctionEnd
|
||||||
|
22(builtinMatrixFuncs(): 2 Function None 3
|
||||||
|
23: Label
|
||||||
|
408(f16m3): 407(ptr) Variable Function
|
||||||
|
409(f16m1): 407(ptr) Variable Function
|
||||||
|
411(f16m2): 407(ptr) Variable Function
|
||||||
|
420(f16v1): 152(ptr) Variable Function
|
||||||
|
422(f16v2): 30(ptr) Variable Function
|
||||||
|
427(f16m4): 426(ptr) Variable Function
|
||||||
|
430(f16): 35(ptr) Variable Function
|
||||||
|
433(f16m5): 432(ptr) Variable Function
|
||||||
|
438(f16m6): 437(ptr) Variable Function
|
||||||
|
439(f16m7): 437(ptr) Variable Function
|
||||||
|
410: 406 Load 409(f16m1)
|
||||||
|
412: 406 Load 411(f16m2)
|
||||||
|
413: 151(fvec3) CompositeExtract 410 0
|
||||||
|
414: 151(fvec3) CompositeExtract 412 0
|
||||||
|
415: 151(fvec3) FMul 413 414
|
||||||
|
416: 151(fvec3) CompositeExtract 410 1
|
||||||
|
417: 151(fvec3) CompositeExtract 412 1
|
||||||
|
418: 151(fvec3) FMul 416 417
|
||||||
|
419: 406 CompositeConstruct 415 418
|
||||||
|
Store 408(f16m3) 419
|
||||||
|
421: 151(fvec3) Load 420(f16v1)
|
||||||
|
423: 29(fvec2) Load 422(f16v2)
|
||||||
|
424: 406 OuterProduct 421 423
|
||||||
|
Store 409(f16m1) 424
|
||||||
|
428: 406 Load 409(f16m1)
|
||||||
|
429: 425 Transpose 428
|
||||||
|
Store 427(f16m4) 429
|
||||||
|
434: 431 Load 433(f16m5)
|
||||||
|
435: 28(float) ExtInst 1(GLSL.std.450) 33(Determinant) 434
|
||||||
|
Store 430(f16) 435
|
||||||
|
440: 436 Load 439(f16m7)
|
||||||
|
441: 436 ExtInst 1(GLSL.std.450) 34(MatrixInverse) 440
|
||||||
|
Store 438(f16m6) 441
|
||||||
|
Return
|
||||||
|
FunctionEnd
|
||||||
|
24(builtinVecRelFuncs(): 2 Function None 3
|
||||||
|
25: Label
|
||||||
|
442(bv): 155(ptr) Variable Function
|
||||||
|
443(f16v1): 152(ptr) Variable Function
|
||||||
|
445(f16v2): 152(ptr) Variable Function
|
||||||
|
444: 151(fvec3) Load 443(f16v1)
|
||||||
|
446: 151(fvec3) Load 445(f16v2)
|
||||||
|
447: 154(bvec3) FOrdLessThan 444 446
|
||||||
|
Store 442(bv) 447
|
||||||
|
448: 151(fvec3) Load 443(f16v1)
|
||||||
|
449: 151(fvec3) Load 445(f16v2)
|
||||||
|
450: 154(bvec3) FOrdLessThanEqual 448 449
|
||||||
|
Store 442(bv) 450
|
||||||
|
451: 151(fvec3) Load 443(f16v1)
|
||||||
|
452: 151(fvec3) Load 445(f16v2)
|
||||||
|
453: 154(bvec3) FOrdGreaterThan 451 452
|
||||||
|
Store 442(bv) 453
|
||||||
|
454: 151(fvec3) Load 443(f16v1)
|
||||||
|
455: 151(fvec3) Load 445(f16v2)
|
||||||
|
456: 154(bvec3) FOrdGreaterThanEqual 454 455
|
||||||
|
Store 442(bv) 456
|
||||||
|
457: 151(fvec3) Load 443(f16v1)
|
||||||
|
458: 151(fvec3) Load 445(f16v2)
|
||||||
|
459: 154(bvec3) FOrdEqual 457 458
|
||||||
|
Store 442(bv) 459
|
||||||
|
460: 151(fvec3) Load 443(f16v1)
|
||||||
|
461: 151(fvec3) Load 445(f16v2)
|
||||||
|
462: 154(bvec3) FOrdNotEqual 460 461
|
||||||
|
Store 442(bv) 462
|
||||||
|
Return
|
||||||
|
FunctionEnd
|
||||||
|
26(builtinFragProcFuncs(): 2 Function None 3
|
||||||
|
27: Label
|
||||||
|
463(f16v): 152(ptr) Variable Function
|
||||||
|
467: 466(ptr) AccessChain 465(if16v) 34
|
||||||
|
468: 28(float) Load 467
|
||||||
|
469: 28(float) DPdx 468
|
||||||
|
470: 35(ptr) AccessChain 463(f16v) 34
|
||||||
|
Store 470 469
|
||||||
|
471: 466(ptr) AccessChain 465(if16v) 90
|
||||||
|
472: 28(float) Load 471
|
||||||
|
473: 28(float) DPdy 472
|
||||||
|
474: 35(ptr) AccessChain 463(f16v) 90
|
||||||
|
Store 474 473
|
||||||
|
475: 151(fvec3) Load 465(if16v)
|
||||||
|
476: 29(fvec2) VectorShuffle 475 475 0 1
|
||||||
|
477: 29(fvec2) DPdxFine 476
|
||||||
|
478: 151(fvec3) Load 463(f16v)
|
||||||
|
479: 151(fvec3) VectorShuffle 478 477 3 4 2
|
||||||
|
Store 463(f16v) 479
|
||||||
|
480: 151(fvec3) Load 465(if16v)
|
||||||
|
481: 29(fvec2) VectorShuffle 480 480 0 1
|
||||||
|
482: 29(fvec2) DPdyFine 481
|
||||||
|
483: 151(fvec3) Load 463(f16v)
|
||||||
|
484: 151(fvec3) VectorShuffle 483 482 3 4 2
|
||||||
|
Store 463(f16v) 484
|
||||||
|
485: 151(fvec3) Load 465(if16v)
|
||||||
|
486: 151(fvec3) DPdxCoarse 485
|
||||||
|
Store 463(f16v) 486
|
||||||
|
487: 151(fvec3) Load 465(if16v)
|
||||||
|
488: 151(fvec3) DPdxCoarse 487
|
||||||
|
Store 463(f16v) 488
|
||||||
|
489: 466(ptr) AccessChain 465(if16v) 34
|
||||||
|
490: 28(float) Load 489
|
||||||
|
491: 28(float) Fwidth 490
|
||||||
|
492: 35(ptr) AccessChain 463(f16v) 34
|
||||||
|
Store 492 491
|
||||||
|
493: 151(fvec3) Load 465(if16v)
|
||||||
|
494: 29(fvec2) VectorShuffle 493 493 0 1
|
||||||
|
495: 29(fvec2) FwidthFine 494
|
||||||
|
496: 151(fvec3) Load 463(f16v)
|
||||||
|
497: 151(fvec3) VectorShuffle 496 495 3 4 2
|
||||||
|
Store 463(f16v) 497
|
||||||
|
498: 151(fvec3) Load 465(if16v)
|
||||||
|
499: 151(fvec3) FwidthCoarse 498
|
||||||
|
Store 463(f16v) 499
|
||||||
|
500: 466(ptr) AccessChain 465(if16v) 34
|
||||||
|
501: 28(float) ExtInst 1(GLSL.std.450) 76(InterpolateAtCentroid) 500
|
||||||
|
502: 35(ptr) AccessChain 463(f16v) 34
|
||||||
|
Store 502 501
|
||||||
|
504: 151(fvec3) ExtInst 1(GLSL.std.450) 77(InterpolateAtSample) 465(if16v) 503
|
||||||
|
505: 29(fvec2) VectorShuffle 504 504 0 1
|
||||||
|
506: 151(fvec3) Load 463(f16v)
|
||||||
|
507: 151(fvec3) VectorShuffle 506 505 3 4 2
|
||||||
|
Store 463(f16v) 507
|
||||||
|
511: 151(fvec3) ExtInst 1(GLSL.std.450) 78(InterpolateAtOffset) 465(if16v) 510
|
||||||
|
Store 463(f16v) 511
|
||||||
|
Return
|
||||||
|
FunctionEnd
|
306
Test/spv.float16.frag
Normal file
306
Test/spv.float16.frag
Normal file
@ -0,0 +1,306 @@
|
|||||||
|
#version 450 core
|
||||||
|
|
||||||
|
#extension GL_AMD_gpu_shader_half_float: enable
|
||||||
|
#extension GL_ARB_gpu_shader_int64: enable
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// Half float literals
|
||||||
|
void literal()
|
||||||
|
{
|
||||||
|
const float16_t f16c = 0.000001hf;
|
||||||
|
const f16vec2 f16cv = f16vec2(-0.25HF, 0.03HF);
|
||||||
|
|
||||||
|
f16vec2 f16v;
|
||||||
|
f16v.x = f16c;
|
||||||
|
f16v += f16cv;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Block memory layout
|
||||||
|
struct S
|
||||||
|
{
|
||||||
|
float16_t x; // rule 1: align = 2, takes offsets 0-1
|
||||||
|
f16vec2 y; // rule 2: align = 4, takes offsets 4-7
|
||||||
|
f16vec3 z; // rule 3: align = 8, takes offsets 8-13
|
||||||
|
};
|
||||||
|
|
||||||
|
layout(column_major, std140) uniform B1
|
||||||
|
{
|
||||||
|
float16_t a; // rule 1: align = 2, takes offsets 0-1
|
||||||
|
f16vec2 b; // rule 2: align = 4, takes offsets 4-7
|
||||||
|
f16vec3 c; // rule 3: align = 8, takes offsets 8-15
|
||||||
|
float16_t d[2]; // rule 4: align = 16, array stride = 16,
|
||||||
|
// takes offsets 16-47
|
||||||
|
f16mat2x3 e; // rule 5: align = 16, matrix stride = 16,
|
||||||
|
// takes offsets 48-79
|
||||||
|
f16mat2x3 f[2]; // rule 6: align = 16, matrix stride = 16,
|
||||||
|
// array stride = 32, f[0] takes
|
||||||
|
// offsets 80-111, f[1] takes offsets
|
||||||
|
// 112-143
|
||||||
|
S g; // rule 9: align = 16, g.x takes offsets
|
||||||
|
// 144-145, g.y takes offsets 148-151,
|
||||||
|
// g.z takes offsets 152-159
|
||||||
|
S h[2]; // rule 10: align = 16, array stride = 16, h[0]
|
||||||
|
// takes offsets 160-175, h[1] takes
|
||||||
|
// offsets 176-191
|
||||||
|
};
|
||||||
|
|
||||||
|
layout(row_major, std430) buffer B2
|
||||||
|
{
|
||||||
|
float16_t o; // rule 1: align = 2, takes offsets 0-1
|
||||||
|
f16vec2 p; // rule 2: align = 4, takes offsets 4-7
|
||||||
|
f16vec3 q; // rule 3: align = 8, takes offsets 8-13
|
||||||
|
float16_t r[2]; // rule 4: align = 2, array stride = 2, takes
|
||||||
|
// offsets 14-17
|
||||||
|
f16mat2x3 s; // rule 7: align = 4, matrix stride = 4, takes
|
||||||
|
// offsets 20-31
|
||||||
|
f16mat2x3 t[2]; // rule 8: align = 4, matrix stride = 4, array
|
||||||
|
// stride = 12, t[0] takes offsets
|
||||||
|
// 32-43, t[1] takes offsets 44-55
|
||||||
|
S u; // rule 9: align = 8, u.x takes offsets
|
||||||
|
// 56-57, u.y takes offsets 60-63, u.z
|
||||||
|
// takes offsets 64-69
|
||||||
|
S v[2]; // rule 10: align = 8, array stride = 16, v[0]
|
||||||
|
// takes offsets 72-87, v[1] takes
|
||||||
|
// offsets 88-103
|
||||||
|
};
|
||||||
|
|
||||||
|
// Specialization constant
|
||||||
|
layout(constant_id = 100) const float16_t sf16 = 0.125hf;
|
||||||
|
layout(constant_id = 101) const float sf = 0.25;
|
||||||
|
layout(constant_id = 102) const double sd = 0.5lf;
|
||||||
|
|
||||||
|
const float f16_to_f = float(sf16);
|
||||||
|
const double f16_to_d = float(sf16);
|
||||||
|
|
||||||
|
const float16_t f_to_f16 = float16_t(sf);
|
||||||
|
const float16_t d_to_f16 = float16_t(sd);
|
||||||
|
|
||||||
|
void operators()
|
||||||
|
{
|
||||||
|
float16_t f16;
|
||||||
|
f16vec2 f16v;
|
||||||
|
f16mat2x2 f16m;
|
||||||
|
bool b;
|
||||||
|
|
||||||
|
// Arithmetic
|
||||||
|
f16v += f16v;
|
||||||
|
f16v -= f16v;
|
||||||
|
f16v *= f16v;
|
||||||
|
f16v /= f16v;
|
||||||
|
f16v++;
|
||||||
|
f16v--;
|
||||||
|
++f16m;
|
||||||
|
--f16m;
|
||||||
|
f16v = -f16v;
|
||||||
|
f16m = -f16m;
|
||||||
|
|
||||||
|
f16 = f16v.x + f16v.y;
|
||||||
|
f16 = f16v.x - f16v.y;
|
||||||
|
f16 = f16v.x * f16v.y;
|
||||||
|
f16 = f16v.x / f16v.y;
|
||||||
|
|
||||||
|
// Relational
|
||||||
|
b = (f16v.x != f16);
|
||||||
|
b = (f16v.y == f16);
|
||||||
|
b = (f16v.x > f16);
|
||||||
|
b = (f16v.y < f16);
|
||||||
|
b = (f16v.x >= f16);
|
||||||
|
b = (f16v.y <= f16);
|
||||||
|
|
||||||
|
// Vector/matrix operations
|
||||||
|
f16v = f16v * f16;
|
||||||
|
f16m = f16m * f16;
|
||||||
|
f16v = f16m * f16v;
|
||||||
|
f16v = f16v * f16m;
|
||||||
|
f16m = f16m * f16m;
|
||||||
|
}
|
||||||
|
|
||||||
|
void typeCast()
|
||||||
|
{
|
||||||
|
bvec3 bv;
|
||||||
|
vec3 fv;
|
||||||
|
dvec3 dv;
|
||||||
|
ivec3 iv;
|
||||||
|
uvec3 uv;
|
||||||
|
i64vec3 i64v;
|
||||||
|
u64vec3 u64v;
|
||||||
|
|
||||||
|
f16vec3 f16v;
|
||||||
|
|
||||||
|
f16v = f16vec3(bv); // bool -> float16
|
||||||
|
bv = bvec3(f16v); // float16 -> bool
|
||||||
|
|
||||||
|
f16v = f16vec3(fv); // float -> float16
|
||||||
|
fv = vec3(f16v); // float16 -> float
|
||||||
|
|
||||||
|
f16v = f16vec3(dv); // double -> float16
|
||||||
|
dv = dvec3(dv); // float16 -> double
|
||||||
|
|
||||||
|
f16v = f16vec3(iv); // int -> float16
|
||||||
|
iv = ivec3(f16v); // float16 -> int
|
||||||
|
|
||||||
|
f16v = f16vec3(uv); // uint -> float16
|
||||||
|
uv = uvec3(f16v); // float16 -> uint
|
||||||
|
|
||||||
|
f16v = f16vec3(i64v); // int64 -> float16
|
||||||
|
i64v = i64vec3(f16v); // float16 -> int64
|
||||||
|
|
||||||
|
f16v = f16vec3(u64v); // uint64 -> float16
|
||||||
|
u64v = u64vec3(f16v); // float16 -> uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
void builtinAngleTrigFuncs()
|
||||||
|
{
|
||||||
|
f16vec4 f16v1, f16v2;
|
||||||
|
|
||||||
|
f16v2 = radians(f16v1);
|
||||||
|
f16v2 = degrees(f16v1);
|
||||||
|
f16v2 = sin(f16v1);
|
||||||
|
f16v2 = cos(f16v1);
|
||||||
|
f16v2 = tan(f16v1);
|
||||||
|
f16v2 = asin(f16v1);
|
||||||
|
f16v2 = acos(f16v1);
|
||||||
|
f16v2 = atan(f16v1, f16v2);
|
||||||
|
f16v2 = atan(f16v1);
|
||||||
|
f16v2 = sinh(f16v1);
|
||||||
|
f16v2 = cosh(f16v1);
|
||||||
|
f16v2 = tanh(f16v1);
|
||||||
|
f16v2 = asinh(f16v1);
|
||||||
|
f16v2 = acosh(f16v1);
|
||||||
|
f16v2 = atanh(f16v1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void builtinExpFuncs()
|
||||||
|
{
|
||||||
|
f16vec2 f16v1, f16v2;
|
||||||
|
|
||||||
|
f16v2 = pow(f16v1, f16v2);
|
||||||
|
f16v2 = exp(f16v1);
|
||||||
|
f16v2 = log(f16v1);
|
||||||
|
f16v2 = exp2(f16v1);
|
||||||
|
f16v2 = log2(f16v1);
|
||||||
|
f16v2 = sqrt(f16v1);
|
||||||
|
f16v2 = inversesqrt(f16v1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void builtinCommonFuncs()
|
||||||
|
{
|
||||||
|
f16vec3 f16v1, f16v2, f16v3;
|
||||||
|
float16_t f16;
|
||||||
|
bool b;
|
||||||
|
bvec3 bv;
|
||||||
|
ivec3 iv;
|
||||||
|
|
||||||
|
f16v2 = abs(f16v1);
|
||||||
|
f16v2 = sign(f16v1);
|
||||||
|
f16v2 = floor(f16v1);
|
||||||
|
f16v2 = trunc(f16v1);
|
||||||
|
f16v2 = round(f16v1);
|
||||||
|
f16v2 = roundEven(f16v1);
|
||||||
|
f16v2 = ceil(f16v1);
|
||||||
|
f16v2 = fract(f16v1);
|
||||||
|
f16v2 = mod(f16v1, f16v2);
|
||||||
|
f16v2 = mod(f16v1, f16);
|
||||||
|
f16v3 = modf(f16v1, f16v2);
|
||||||
|
f16v3 = min(f16v1, f16v2);
|
||||||
|
f16v3 = min(f16v1, f16);
|
||||||
|
f16v3 = max(f16v1, f16v2);
|
||||||
|
f16v3 = max(f16v1, f16);
|
||||||
|
f16v3 = clamp(f16v1, f16, f16v2.x);
|
||||||
|
f16v3 = clamp(f16v1, f16v2, f16vec3(f16));
|
||||||
|
f16v3 = mix(f16v1, f16v2, f16);
|
||||||
|
f16v3 = mix(f16v1, f16v2, f16v3);
|
||||||
|
f16v3 = mix(f16v1, f16v2, bv);
|
||||||
|
f16v3 = step(f16v1, f16v2);
|
||||||
|
f16v3 = step(f16, f16v3);
|
||||||
|
f16v3 = smoothstep(f16v1, f16v2, f16v3);
|
||||||
|
f16v3 = smoothstep(f16, f16v1.x, f16v2);
|
||||||
|
b = isnan(f16);
|
||||||
|
bv = isinf(f16v1);
|
||||||
|
f16v3 = fma(f16v1, f16v2, f16v3);
|
||||||
|
f16v2 = frexp(f16v1, iv);
|
||||||
|
f16v2 = ldexp(f16v1, iv);
|
||||||
|
}
|
||||||
|
|
||||||
|
void builtinPackUnpackFuncs()
|
||||||
|
{
|
||||||
|
uint u;
|
||||||
|
f16vec2 f16v;
|
||||||
|
|
||||||
|
u = packFloat2x16(f16v);
|
||||||
|
f16v = unpackFloat2x16(u);
|
||||||
|
}
|
||||||
|
|
||||||
|
void builtinGeometryFuncs()
|
||||||
|
{
|
||||||
|
float16_t f16;
|
||||||
|
f16vec3 f16v1, f16v2, f16v3;
|
||||||
|
|
||||||
|
f16 = length(f16v1);
|
||||||
|
f16 = distance(f16v1, f16v2);
|
||||||
|
f16 = dot(f16v1, f16v2);
|
||||||
|
f16v3 = cross(f16v1, f16v2);
|
||||||
|
f16v2 = normalize(f16v1);
|
||||||
|
f16v3 = faceforward(f16v1, f16v2, f16v3);
|
||||||
|
f16v3 = reflect(f16v1, f16v2);
|
||||||
|
f16v3 = refract(f16v1, f16v2, f16);
|
||||||
|
}
|
||||||
|
|
||||||
|
void builtinMatrixFuncs()
|
||||||
|
{
|
||||||
|
f16mat2x3 f16m1, f16m2, f16m3;
|
||||||
|
f16mat3x2 f16m4;
|
||||||
|
f16mat3 f16m5;
|
||||||
|
f16mat4 f16m6, f16m7;
|
||||||
|
|
||||||
|
f16vec3 f16v1;
|
||||||
|
f16vec2 f16v2;
|
||||||
|
|
||||||
|
float16_t f16;
|
||||||
|
|
||||||
|
f16m3 = matrixCompMult(f16m1, f16m2);
|
||||||
|
f16m1 = outerProduct(f16v1, f16v2);
|
||||||
|
f16m4 = transpose(f16m1);
|
||||||
|
f16 = determinant(f16m5);
|
||||||
|
f16m6 = inverse(f16m7);
|
||||||
|
}
|
||||||
|
|
||||||
|
void builtinVecRelFuncs()
|
||||||
|
{
|
||||||
|
f16vec3 f16v1, f16v2;
|
||||||
|
bvec3 bv;
|
||||||
|
|
||||||
|
bv = lessThan(f16v1, f16v2);
|
||||||
|
bv = lessThanEqual(f16v1, f16v2);
|
||||||
|
bv = greaterThan(f16v1, f16v2);
|
||||||
|
bv = greaterThanEqual(f16v1, f16v2);
|
||||||
|
bv = equal(f16v1, f16v2);
|
||||||
|
bv = notEqual(f16v1, f16v2);
|
||||||
|
}
|
||||||
|
|
||||||
|
in f16vec3 if16v;
|
||||||
|
|
||||||
|
void builtinFragProcFuncs()
|
||||||
|
{
|
||||||
|
f16vec3 f16v;
|
||||||
|
|
||||||
|
// Derivative
|
||||||
|
f16v.x = dFdx(if16v.x);
|
||||||
|
f16v.y = dFdy(if16v.y);
|
||||||
|
f16v.xy = dFdxFine(if16v.xy);
|
||||||
|
f16v.xy = dFdyFine(if16v.xy);
|
||||||
|
f16v = dFdxCoarse(if16v);
|
||||||
|
f16v = dFdxCoarse(if16v);
|
||||||
|
|
||||||
|
f16v.x = fwidth(if16v.x);
|
||||||
|
f16v.xy = fwidthFine(if16v.xy);
|
||||||
|
f16v = fwidthCoarse(if16v);
|
||||||
|
|
||||||
|
// Interpolation
|
||||||
|
f16v.x = interpolateAtCentroid(if16v.x);
|
||||||
|
f16v.xy = interpolateAtSample(if16v.xy, 1);
|
||||||
|
f16v = interpolateAtOffset(if16v, vec2(0.5));
|
||||||
|
}
|
@ -46,6 +46,9 @@ enum TBasicType {
|
|||||||
EbtVoid,
|
EbtVoid,
|
||||||
EbtFloat,
|
EbtFloat,
|
||||||
EbtDouble,
|
EbtDouble,
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
EbtFloat16,
|
||||||
|
#endif
|
||||||
EbtInt,
|
EbtInt,
|
||||||
EbtUint,
|
EbtUint,
|
||||||
EbtInt64,
|
EbtInt64,
|
||||||
|
@ -185,8 +185,6 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
|
|||||||
case EbtFloat: break;
|
case EbtFloat: break;
|
||||||
case EbtInt: s.append("i"); break;
|
case EbtInt: s.append("i"); break;
|
||||||
case EbtUint: s.append("u"); 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
|
default: break; // some compilers want this
|
||||||
}
|
}
|
||||||
if (image) {
|
if (image) {
|
||||||
@ -1277,7 +1275,11 @@ public:
|
|||||||
virtual bool isImplicitlySizedArray() const { return isArray() && getOuterArraySize() == UnsizedArraySize && qualifier.storage != EvqBuffer; }
|
virtual bool isImplicitlySizedArray() const { return isArray() && getOuterArraySize() == UnsizedArraySize && qualifier.storage != EvqBuffer; }
|
||||||
virtual bool isRuntimeSizedArray() const { return isArray() && getOuterArraySize() == UnsizedArraySize && qualifier.storage == EvqBuffer; }
|
virtual bool isRuntimeSizedArray() const { return isArray() && getOuterArraySize() == UnsizedArraySize && qualifier.storage == EvqBuffer; }
|
||||||
virtual bool isStruct() const { return structure != nullptr; }
|
virtual bool isStruct() const { return structure != nullptr; }
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
virtual bool isFloatingDomain() const { return basicType == EbtFloat || basicType == EbtDouble || basicType == EbtFloat16; }
|
||||||
|
#else
|
||||||
virtual bool isFloatingDomain() const { return basicType == EbtFloat || basicType == EbtDouble; }
|
virtual bool isFloatingDomain() const { return basicType == EbtFloat || basicType == EbtDouble; }
|
||||||
|
#endif
|
||||||
|
|
||||||
virtual bool isOpaque() const { return basicType == EbtSampler || basicType == EbtAtomicUint; }
|
virtual bool isOpaque() const { return basicType == EbtSampler || basicType == EbtAtomicUint; }
|
||||||
|
|
||||||
@ -1359,6 +1361,9 @@ public:
|
|||||||
case EbtVoid:
|
case EbtVoid:
|
||||||
case EbtFloat:
|
case EbtFloat:
|
||||||
case EbtDouble:
|
case EbtDouble:
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EbtFloat16:
|
||||||
|
#endif
|
||||||
case EbtInt:
|
case EbtInt:
|
||||||
case EbtUint:
|
case EbtUint:
|
||||||
case EbtInt64:
|
case EbtInt64:
|
||||||
@ -1451,6 +1456,9 @@ public:
|
|||||||
case EbtVoid: return "void";
|
case EbtVoid: return "void";
|
||||||
case EbtFloat: return "float";
|
case EbtFloat: return "float";
|
||||||
case EbtDouble: return "double";
|
case EbtDouble: return "double";
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EbtFloat16: return "float16_t";
|
||||||
|
#endif
|
||||||
case EbtInt: return "int";
|
case EbtInt: return "int";
|
||||||
case EbtUint: return "uint";
|
case EbtUint: return "uint";
|
||||||
case EbtInt64: return "int64_t";
|
case EbtInt64: return "int64_t";
|
||||||
|
@ -119,6 +119,22 @@ enum TOperator {
|
|||||||
EOpConvFloatToUint64,
|
EOpConvFloatToUint64,
|
||||||
EOpConvDoubleToUint64,
|
EOpConvDoubleToUint64,
|
||||||
EOpConvInt64ToUint64,
|
EOpConvInt64ToUint64,
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
EOpConvBoolToFloat16,
|
||||||
|
EOpConvIntToFloat16,
|
||||||
|
EOpConvUintToFloat16,
|
||||||
|
EOpConvFloatToFloat16,
|
||||||
|
EOpConvDoubleToFloat16,
|
||||||
|
EOpConvInt64ToFloat16,
|
||||||
|
EOpConvUint64ToFloat16,
|
||||||
|
EOpConvFloat16ToBool,
|
||||||
|
EOpConvFloat16ToInt,
|
||||||
|
EOpConvFloat16ToUint,
|
||||||
|
EOpConvFloat16ToFloat,
|
||||||
|
EOpConvFloat16ToDouble,
|
||||||
|
EOpConvFloat16ToInt64,
|
||||||
|
EOpConvFloat16ToUint64,
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// binary operations
|
// binary operations
|
||||||
@ -236,6 +252,10 @@ enum TOperator {
|
|||||||
EOpUnpackInt2x32,
|
EOpUnpackInt2x32,
|
||||||
EOpPackUint2x32,
|
EOpPackUint2x32,
|
||||||
EOpUnpackUint2x32,
|
EOpUnpackUint2x32,
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
EOpPackFloat2x16,
|
||||||
|
EOpUnpackFloat2x16,
|
||||||
|
#endif
|
||||||
|
|
||||||
EOpLength,
|
EOpLength,
|
||||||
EOpDistance,
|
EOpDistance,
|
||||||
@ -396,6 +416,21 @@ enum TOperator {
|
|||||||
EOpConstructDMat4x2,
|
EOpConstructDMat4x2,
|
||||||
EOpConstructDMat4x3,
|
EOpConstructDMat4x3,
|
||||||
EOpConstructDMat4x4,
|
EOpConstructDMat4x4,
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
EOpConstructFloat16,
|
||||||
|
EOpConstructF16Vec2,
|
||||||
|
EOpConstructF16Vec3,
|
||||||
|
EOpConstructF16Vec4,
|
||||||
|
EOpConstructF16Mat2x2,
|
||||||
|
EOpConstructF16Mat2x3,
|
||||||
|
EOpConstructF16Mat2x4,
|
||||||
|
EOpConstructF16Mat3x2,
|
||||||
|
EOpConstructF16Mat3x3,
|
||||||
|
EOpConstructF16Mat3x4,
|
||||||
|
EOpConstructF16Mat4x2,
|
||||||
|
EOpConstructF16Mat4x3,
|
||||||
|
EOpConstructF16Mat4x4,
|
||||||
|
#endif
|
||||||
EOpConstructStruct,
|
EOpConstructStruct,
|
||||||
EOpConstructTextureSampler,
|
EOpConstructTextureSampler,
|
||||||
EOpConstructGuardEnd,
|
EOpConstructGuardEnd,
|
||||||
|
@ -176,6 +176,9 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right
|
|||||||
switch (getType().getBasicType()) {
|
switch (getType().getBasicType()) {
|
||||||
case EbtDouble:
|
case EbtDouble:
|
||||||
case EbtFloat:
|
case EbtFloat:
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EbtFloat16:
|
||||||
|
#endif
|
||||||
newConstArray[i].setDConst(leftUnionArray[i].getDConst() / rightUnionArray[i].getDConst());
|
newConstArray[i].setDConst(leftUnionArray[i].getDConst() / rightUnionArray[i].getDConst());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -450,6 +453,9 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
|
|||||||
case EOpNegative:
|
case EOpNegative:
|
||||||
switch (getType().getBasicType()) {
|
switch (getType().getBasicType()) {
|
||||||
case EbtDouble:
|
case EbtDouble:
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EbtFloat16:
|
||||||
|
#endif
|
||||||
case EbtFloat: newConstArray[i].setDConst(-unionArray[i].getDConst()); break;
|
case EbtFloat: newConstArray[i].setDConst(-unionArray[i].getDConst()); break;
|
||||||
case EbtInt: newConstArray[i].setIConst(-unionArray[i].getIConst()); break;
|
case EbtInt: newConstArray[i].setIConst(-unionArray[i].getIConst()); break;
|
||||||
case EbtUint: newConstArray[i].setUConst(static_cast<unsigned int>(-static_cast<int>(unionArray[i].getUConst()))); break;
|
case EbtUint: newConstArray[i].setUConst(static_cast<unsigned int>(-static_cast<int>(unionArray[i].getUConst()))); break;
|
||||||
@ -688,6 +694,9 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
|
|||||||
// Second, do the actual folding
|
// Second, do the actual folding
|
||||||
|
|
||||||
bool isFloatingPoint = children[0]->getAsTyped()->getBasicType() == EbtFloat ||
|
bool isFloatingPoint = children[0]->getAsTyped()->getBasicType() == EbtFloat ||
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
children[0]->getAsTyped()->getBasicType() == EbtFloat16 ||
|
||||||
|
#endif
|
||||||
children[0]->getAsTyped()->getBasicType() == EbtDouble;
|
children[0]->getAsTyped()->getBasicType() == EbtDouble;
|
||||||
bool isSigned = children[0]->getAsTyped()->getBasicType() == EbtInt ||
|
bool isSigned = children[0]->getAsTyped()->getBasicType() == EbtInt ||
|
||||||
children[0]->getAsTyped()->getBasicType() == EbtInt64;
|
children[0]->getAsTyped()->getBasicType() == EbtInt64;
|
||||||
|
@ -85,8 +85,6 @@ TBuiltIns::TBuiltIns()
|
|||||||
prefixes[EbtFloat] = "";
|
prefixes[EbtFloat] = "";
|
||||||
prefixes[EbtInt] = "i";
|
prefixes[EbtInt] = "i";
|
||||||
prefixes[EbtUint] = "u";
|
prefixes[EbtUint] = "u";
|
||||||
prefixes[EbtInt64] = "i64";
|
|
||||||
prefixes[EbtUint64] = "u64";
|
|
||||||
postfixes[2] = "2";
|
postfixes[2] = "2";
|
||||||
postfixes[3] = "3";
|
postfixes[3] = "3";
|
||||||
postfixes[4] = "4";
|
postfixes[4] = "4";
|
||||||
@ -875,6 +873,21 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
|||||||
"uvec3 mid3(uvec3, uvec3, uvec3);"
|
"uvec3 mid3(uvec3, uvec3, uvec3);"
|
||||||
"uvec4 mid3(uvec4, uvec4, uvec4);"
|
"uvec4 mid3(uvec4, uvec4, uvec4);"
|
||||||
|
|
||||||
|
"float16_t min3(float16_t, float16_t, float16_t);"
|
||||||
|
"f16vec2 min3(f16vec2, f16vec2, f16vec2);"
|
||||||
|
"f16vec3 min3(f16vec3, f16vec3, f16vec3);"
|
||||||
|
"f16vec4 min3(f16vec4, f16vec4, f16vec4);"
|
||||||
|
|
||||||
|
"float16_t max3(float16_t, float16_t, float16_t);"
|
||||||
|
"f16vec2 max3(f16vec2, f16vec2, f16vec2);"
|
||||||
|
"f16vec3 max3(f16vec3, f16vec3, f16vec3);"
|
||||||
|
"f16vec4 max3(f16vec4, f16vec4, f16vec4);"
|
||||||
|
|
||||||
|
"float16_t mid3(float16_t, float16_t, float16_t);"
|
||||||
|
"f16vec2 mid3(f16vec2, f16vec2, f16vec2);"
|
||||||
|
"f16vec3 mid3(f16vec3, f16vec3, f16vec3);"
|
||||||
|
"f16vec4 mid3(f16vec4, f16vec4, f16vec4);"
|
||||||
|
|
||||||
"\n"
|
"\n"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -1709,6 +1722,354 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
|||||||
|
|
||||||
"\n");
|
"\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GL_AMD_gpu_shader_half_float
|
||||||
|
if (profile != EEsProfile && version >= 450) {
|
||||||
|
commonBuiltins.append(
|
||||||
|
"float16_t radians(float16_t);"
|
||||||
|
"f16vec2 radians(f16vec2);"
|
||||||
|
"f16vec3 radians(f16vec3);"
|
||||||
|
"f16vec4 radians(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t degrees(float16_t);"
|
||||||
|
"f16vec2 degrees(f16vec2);"
|
||||||
|
"f16vec3 degrees(f16vec3);"
|
||||||
|
"f16vec4 degrees(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t sin(float16_t);"
|
||||||
|
"f16vec2 sin(f16vec2);"
|
||||||
|
"f16vec3 sin(f16vec3);"
|
||||||
|
"f16vec4 sin(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t cos(float16_t);"
|
||||||
|
"f16vec2 cos(f16vec2);"
|
||||||
|
"f16vec3 cos(f16vec3);"
|
||||||
|
"f16vec4 cos(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t tan(float16_t);"
|
||||||
|
"f16vec2 tan(f16vec2);"
|
||||||
|
"f16vec3 tan(f16vec3);"
|
||||||
|
"f16vec4 tan(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t asin(float16_t);"
|
||||||
|
"f16vec2 asin(f16vec2);"
|
||||||
|
"f16vec3 asin(f16vec3);"
|
||||||
|
"f16vec4 asin(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t acos(float16_t);"
|
||||||
|
"f16vec2 acos(f16vec2);"
|
||||||
|
"f16vec3 acos(f16vec3);"
|
||||||
|
"f16vec4 acos(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t atan(float16_t, float16_t);"
|
||||||
|
"f16vec2 atan(f16vec2, f16vec2);"
|
||||||
|
"f16vec3 atan(f16vec3, f16vec3);"
|
||||||
|
"f16vec4 atan(f16vec4, f16vec4);"
|
||||||
|
|
||||||
|
"float16_t atan(float16_t);"
|
||||||
|
"f16vec2 atan(f16vec2);"
|
||||||
|
"f16vec3 atan(f16vec3);"
|
||||||
|
"f16vec4 atan(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t sinh(float16_t);"
|
||||||
|
"f16vec2 sinh(f16vec2);"
|
||||||
|
"f16vec3 sinh(f16vec3);"
|
||||||
|
"f16vec4 sinh(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t cosh(float16_t);"
|
||||||
|
"f16vec2 cosh(f16vec2);"
|
||||||
|
"f16vec3 cosh(f16vec3);"
|
||||||
|
"f16vec4 cosh(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t tanh(float16_t);"
|
||||||
|
"f16vec2 tanh(f16vec2);"
|
||||||
|
"f16vec3 tanh(f16vec3);"
|
||||||
|
"f16vec4 tanh(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t asinh(float16_t);"
|
||||||
|
"f16vec2 asinh(f16vec2);"
|
||||||
|
"f16vec3 asinh(f16vec3);"
|
||||||
|
"f16vec4 asinh(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t acosh(float16_t);"
|
||||||
|
"f16vec2 acosh(f16vec2);"
|
||||||
|
"f16vec3 acosh(f16vec3);"
|
||||||
|
"f16vec4 acosh(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t atanh(float16_t);"
|
||||||
|
"f16vec2 atanh(f16vec2);"
|
||||||
|
"f16vec3 atanh(f16vec3);"
|
||||||
|
"f16vec4 atanh(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t pow(float16_t, float16_t);"
|
||||||
|
"f16vec2 pow(f16vec2, f16vec2);"
|
||||||
|
"f16vec3 pow(f16vec3, f16vec3);"
|
||||||
|
"f16vec4 pow(f16vec4, f16vec4);"
|
||||||
|
|
||||||
|
"float16_t exp(float16_t);"
|
||||||
|
"f16vec2 exp(f16vec2);"
|
||||||
|
"f16vec3 exp(f16vec3);"
|
||||||
|
"f16vec4 exp(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t log(float16_t);"
|
||||||
|
"f16vec2 log(f16vec2);"
|
||||||
|
"f16vec3 log(f16vec3);"
|
||||||
|
"f16vec4 log(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t exp2(float16_t);"
|
||||||
|
"f16vec2 exp2(f16vec2);"
|
||||||
|
"f16vec3 exp2(f16vec3);"
|
||||||
|
"f16vec4 exp2(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t log2(float16_t);"
|
||||||
|
"f16vec2 log2(f16vec2);"
|
||||||
|
"f16vec3 log2(f16vec3);"
|
||||||
|
"f16vec4 log2(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t sqrt(float16_t);"
|
||||||
|
"f16vec2 sqrt(f16vec2);"
|
||||||
|
"f16vec3 sqrt(f16vec3);"
|
||||||
|
"f16vec4 sqrt(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t inversesqrt(float16_t);"
|
||||||
|
"f16vec2 inversesqrt(f16vec2);"
|
||||||
|
"f16vec3 inversesqrt(f16vec3);"
|
||||||
|
"f16vec4 inversesqrt(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t abs(float16_t);"
|
||||||
|
"f16vec2 abs(f16vec2);"
|
||||||
|
"f16vec3 abs(f16vec3);"
|
||||||
|
"f16vec4 abs(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t sign(float16_t);"
|
||||||
|
"f16vec2 sign(f16vec2);"
|
||||||
|
"f16vec3 sign(f16vec3);"
|
||||||
|
"f16vec4 sign(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t floor(float16_t);"
|
||||||
|
"f16vec2 floor(f16vec2);"
|
||||||
|
"f16vec3 floor(f16vec3);"
|
||||||
|
"f16vec4 floor(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t trunc(float16_t);"
|
||||||
|
"f16vec2 trunc(f16vec2);"
|
||||||
|
"f16vec3 trunc(f16vec3);"
|
||||||
|
"f16vec4 trunc(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t round(float16_t);"
|
||||||
|
"f16vec2 round(f16vec2);"
|
||||||
|
"f16vec3 round(f16vec3);"
|
||||||
|
"f16vec4 round(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t roundEven(float16_t);"
|
||||||
|
"f16vec2 roundEven(f16vec2);"
|
||||||
|
"f16vec3 roundEven(f16vec3);"
|
||||||
|
"f16vec4 roundEven(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t ceil(float16_t);"
|
||||||
|
"f16vec2 ceil(f16vec2);"
|
||||||
|
"f16vec3 ceil(f16vec3);"
|
||||||
|
"f16vec4 ceil(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t fract(float16_t);"
|
||||||
|
"f16vec2 fract(f16vec2);"
|
||||||
|
"f16vec3 fract(f16vec3);"
|
||||||
|
"f16vec4 fract(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t mod(float16_t, float16_t);"
|
||||||
|
"f16vec2 mod(f16vec2, float16_t);"
|
||||||
|
"f16vec3 mod(f16vec3, float16_t);"
|
||||||
|
"f16vec4 mod(f16vec4, float16_t);"
|
||||||
|
"f16vec2 mod(f16vec2, f16vec2);"
|
||||||
|
"f16vec3 mod(f16vec3, f16vec3);"
|
||||||
|
"f16vec4 mod(f16vec4, f16vec4);"
|
||||||
|
|
||||||
|
"float16_t modf(float16_t, out float16_t);"
|
||||||
|
"f16vec2 modf(f16vec2, out f16vec2);"
|
||||||
|
"f16vec3 modf(f16vec3, out f16vec3);"
|
||||||
|
"f16vec4 modf(f16vec4, out f16vec4);"
|
||||||
|
|
||||||
|
"float16_t min(float16_t, float16_t);"
|
||||||
|
"f16vec2 min(f16vec2, float16_t);"
|
||||||
|
"f16vec3 min(f16vec3, float16_t);"
|
||||||
|
"f16vec4 min(f16vec4, float16_t);"
|
||||||
|
"f16vec2 min(f16vec2, f16vec2);"
|
||||||
|
"f16vec3 min(f16vec3, f16vec3);"
|
||||||
|
"f16vec4 min(f16vec4, f16vec4);"
|
||||||
|
|
||||||
|
"float16_t max(float16_t, float16_t);"
|
||||||
|
"f16vec2 max(f16vec2, float16_t);"
|
||||||
|
"f16vec3 max(f16vec3, float16_t);"
|
||||||
|
"f16vec4 max(f16vec4, float16_t);"
|
||||||
|
"f16vec2 max(f16vec2, f16vec2);"
|
||||||
|
"f16vec3 max(f16vec3, f16vec3);"
|
||||||
|
"f16vec4 max(f16vec4, f16vec4);"
|
||||||
|
|
||||||
|
"float16_t clamp(float16_t, float16_t, float16_t);"
|
||||||
|
"f16vec2 clamp(f16vec2, float16_t, float16_t);"
|
||||||
|
"f16vec3 clamp(f16vec3, float16_t, float16_t);"
|
||||||
|
"f16vec4 clamp(f16vec4, float16_t, float16_t);"
|
||||||
|
"f16vec2 clamp(f16vec2, f16vec2, f16vec2);"
|
||||||
|
"f16vec3 clamp(f16vec3, f16vec3, f16vec3);"
|
||||||
|
"f16vec4 clamp(f16vec4, f16vec4, f16vec4);"
|
||||||
|
|
||||||
|
"float16_t mix(float16_t, float16_t, float16_t);"
|
||||||
|
"f16vec2 mix(f16vec2, f16vec2, float16_t);"
|
||||||
|
"f16vec3 mix(f16vec3, f16vec3, float16_t);"
|
||||||
|
"f16vec4 mix(f16vec4, f16vec4, float16_t);"
|
||||||
|
"f16vec2 mix(f16vec2, f16vec2, f16vec2);"
|
||||||
|
"f16vec3 mix(f16vec3, f16vec3, f16vec3);"
|
||||||
|
"f16vec4 mix(f16vec4, f16vec4, f16vec4);"
|
||||||
|
"float16_t mix(float16_t, float16_t, bool);"
|
||||||
|
"f16vec2 mix(f16vec2, f16vec2, bvec2);"
|
||||||
|
"f16vec3 mix(f16vec3, f16vec3, bvec3);"
|
||||||
|
"f16vec4 mix(f16vec4, f16vec4, bvec4);"
|
||||||
|
|
||||||
|
"float16_t step(float16_t, float16_t);"
|
||||||
|
"f16vec2 step(f16vec2, f16vec2);"
|
||||||
|
"f16vec3 step(f16vec3, f16vec3);"
|
||||||
|
"f16vec4 step(f16vec4, f16vec4);"
|
||||||
|
"f16vec2 step(float16_t, f16vec2);"
|
||||||
|
"f16vec3 step(float16_t, f16vec3);"
|
||||||
|
"f16vec4 step(float16_t, f16vec4);"
|
||||||
|
|
||||||
|
"float16_t smoothstep(float16_t, float16_t, float16_t);"
|
||||||
|
"f16vec2 smoothstep(f16vec2, f16vec2, f16vec2);"
|
||||||
|
"f16vec3 smoothstep(f16vec3, f16vec3, f16vec3);"
|
||||||
|
"f16vec4 smoothstep(f16vec4, f16vec4, f16vec4);"
|
||||||
|
"f16vec2 smoothstep(float16_t, float16_t, f16vec2);"
|
||||||
|
"f16vec3 smoothstep(float16_t, float16_t, f16vec3);"
|
||||||
|
"f16vec4 smoothstep(float16_t, float16_t, f16vec4);"
|
||||||
|
|
||||||
|
"bool isnan(float16_t);"
|
||||||
|
"bvec2 isnan(f16vec2);"
|
||||||
|
"bvec3 isnan(f16vec3);"
|
||||||
|
"bvec4 isnan(f16vec4);"
|
||||||
|
|
||||||
|
"bool isinf(float16_t);"
|
||||||
|
"bvec2 isinf(f16vec2);"
|
||||||
|
"bvec3 isinf(f16vec3);"
|
||||||
|
"bvec4 isinf(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t fma(float16_t, float16_t, float16_t);"
|
||||||
|
"f16vec2 fma(f16vec2, f16vec2, f16vec2);"
|
||||||
|
"f16vec3 fma(f16vec3, f16vec3, f16vec3);"
|
||||||
|
"f16vec4 fma(f16vec4, f16vec4, f16vec4);"
|
||||||
|
|
||||||
|
"float16_t frexp(float16_t, out int);"
|
||||||
|
"f16vec2 frexp(f16vec2, out ivec2);"
|
||||||
|
"f16vec3 frexp(f16vec3, out ivec3);"
|
||||||
|
"f16vec4 frexp(f16vec4, out ivec4);"
|
||||||
|
|
||||||
|
"float16_t ldexp(float16_t, in int);"
|
||||||
|
"f16vec2 ldexp(f16vec2, in ivec2);"
|
||||||
|
"f16vec3 ldexp(f16vec3, in ivec3);"
|
||||||
|
"f16vec4 ldexp(f16vec4, in ivec4);"
|
||||||
|
|
||||||
|
"uint packFloat2x16(f16vec2);"
|
||||||
|
"f16vec2 unpackFloat2x16(uint);"
|
||||||
|
|
||||||
|
"float16_t length(float16_t);"
|
||||||
|
"float16_t length(f16vec2);"
|
||||||
|
"float16_t length(f16vec3);"
|
||||||
|
"float16_t length(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t distance(float16_t, float16_t);"
|
||||||
|
"float16_t distance(f16vec2, f16vec2);"
|
||||||
|
"float16_t distance(f16vec3, f16vec3);"
|
||||||
|
"float16_t distance(f16vec4, f16vec4);"
|
||||||
|
|
||||||
|
"float16_t dot(float16_t, float16_t);"
|
||||||
|
"float16_t dot(f16vec2, f16vec2);"
|
||||||
|
"float16_t dot(f16vec3, f16vec3);"
|
||||||
|
"float16_t dot(f16vec4, f16vec4);"
|
||||||
|
|
||||||
|
"f16vec3 cross(f16vec3, f16vec3);"
|
||||||
|
|
||||||
|
"float16_t normalize(float16_t);"
|
||||||
|
"f16vec2 normalize(f16vec2);"
|
||||||
|
"f16vec3 normalize(f16vec3);"
|
||||||
|
"f16vec4 normalize(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t faceforward(float16_t, float16_t, float16_t);"
|
||||||
|
"f16vec2 faceforward(f16vec2, f16vec2, f16vec2);"
|
||||||
|
"f16vec3 faceforward(f16vec3, f16vec3, f16vec3);"
|
||||||
|
"f16vec4 faceforward(f16vec4, f16vec4, f16vec4);"
|
||||||
|
|
||||||
|
"float16_t reflect(float16_t, float16_t);"
|
||||||
|
"f16vec2 reflect(f16vec2, f16vec2);"
|
||||||
|
"f16vec3 reflect(f16vec3, f16vec3);"
|
||||||
|
"f16vec4 reflect(f16vec4, f16vec4);"
|
||||||
|
|
||||||
|
"float16_t refract(float16_t, float16_t, float16_t);"
|
||||||
|
"f16vec2 refract(f16vec2, f16vec2, float16_t);"
|
||||||
|
"f16vec3 refract(f16vec3, f16vec3, float16_t);"
|
||||||
|
"f16vec4 refract(f16vec4, f16vec4, float16_t);"
|
||||||
|
|
||||||
|
"f16mat2 matrixCompMult(f16mat2, f16mat2);"
|
||||||
|
"f16mat3 matrixCompMult(f16mat3, f16mat3);"
|
||||||
|
"f16mat4 matrixCompMult(f16mat4, f16mat4);"
|
||||||
|
"f16mat2x3 matrixCompMult(f16mat2x3, f16mat2x3);"
|
||||||
|
"f16mat2x4 matrixCompMult(f16mat2x4, f16mat2x4);"
|
||||||
|
"f16mat3x2 matrixCompMult(f16mat3x2, f16mat3x2);"
|
||||||
|
"f16mat3x4 matrixCompMult(f16mat3x4, f16mat3x4);"
|
||||||
|
"f16mat4x2 matrixCompMult(f16mat4x2, f16mat4x2);"
|
||||||
|
"f16mat4x3 matrixCompMult(f16mat4x3, f16mat4x3);"
|
||||||
|
|
||||||
|
"f16mat2 outerProduct(f16vec2, f16vec2);"
|
||||||
|
"f16mat3 outerProduct(f16vec3, f16vec3);"
|
||||||
|
"f16mat4 outerProduct(f16vec4, f16vec4);"
|
||||||
|
"f16mat2x3 outerProduct(f16vec3, f16vec2);"
|
||||||
|
"f16mat3x2 outerProduct(f16vec2, f16vec3);"
|
||||||
|
"f16mat2x4 outerProduct(f16vec4, f16vec2);"
|
||||||
|
"f16mat4x2 outerProduct(f16vec2, f16vec4);"
|
||||||
|
"f16mat3x4 outerProduct(f16vec4, f16vec3);"
|
||||||
|
"f16mat4x3 outerProduct(f16vec3, f16vec4);"
|
||||||
|
|
||||||
|
"f16mat2 transpose(f16mat2);"
|
||||||
|
"f16mat3 transpose(f16mat3);"
|
||||||
|
"f16mat4 transpose(f16mat4);"
|
||||||
|
"f16mat2x3 transpose(f16mat3x2);"
|
||||||
|
"f16mat3x2 transpose(f16mat2x3);"
|
||||||
|
"f16mat2x4 transpose(f16mat4x2);"
|
||||||
|
"f16mat4x2 transpose(f16mat2x4);"
|
||||||
|
"f16mat3x4 transpose(f16mat4x3);"
|
||||||
|
"f16mat4x3 transpose(f16mat3x4);"
|
||||||
|
|
||||||
|
"float16_t determinant(f16mat2);"
|
||||||
|
"float16_t determinant(f16mat3);"
|
||||||
|
"float16_t determinant(f16mat4);"
|
||||||
|
|
||||||
|
"f16mat2 inverse(f16mat2);"
|
||||||
|
"f16mat3 inverse(f16mat3);"
|
||||||
|
"f16mat4 inverse(f16mat4);"
|
||||||
|
|
||||||
|
"bvec2 lessThan(f16vec2, f16vec2);"
|
||||||
|
"bvec3 lessThan(f16vec3, f16vec3);"
|
||||||
|
"bvec4 lessThan(f16vec4, f16vec4);"
|
||||||
|
|
||||||
|
"bvec2 lessThanEqual(f16vec2, f16vec2);"
|
||||||
|
"bvec3 lessThanEqual(f16vec3, f16vec3);"
|
||||||
|
"bvec4 lessThanEqual(f16vec4, f16vec4);"
|
||||||
|
|
||||||
|
"bvec2 greaterThan(f16vec2, f16vec2);"
|
||||||
|
"bvec3 greaterThan(f16vec3, f16vec3);"
|
||||||
|
"bvec4 greaterThan(f16vec4, f16vec4);"
|
||||||
|
|
||||||
|
"bvec2 greaterThanEqual(f16vec2, f16vec2);"
|
||||||
|
"bvec3 greaterThanEqual(f16vec3, f16vec3);"
|
||||||
|
"bvec4 greaterThanEqual(f16vec4, f16vec4);"
|
||||||
|
|
||||||
|
"bvec2 equal(f16vec2, f16vec2);"
|
||||||
|
"bvec3 equal(f16vec3, f16vec3);"
|
||||||
|
"bvec4 equal(f16vec4, f16vec4);"
|
||||||
|
|
||||||
|
"bvec2 notEqual(f16vec2, f16vec2);"
|
||||||
|
"bvec3 notEqual(f16vec3, f16vec3);"
|
||||||
|
"bvec4 notEqual(f16vec4, f16vec4);"
|
||||||
|
|
||||||
|
"\n");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
@ -1975,6 +2336,77 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
|||||||
"uvec3 interpolateAtVertexAMD(uvec3, uint);"
|
"uvec3 interpolateAtVertexAMD(uvec3, uint);"
|
||||||
"uvec4 interpolateAtVertexAMD(uvec4, uint);"
|
"uvec4 interpolateAtVertexAMD(uvec4, uint);"
|
||||||
|
|
||||||
|
"uint interpolateAtVertexAMD(float16_t, uint);"
|
||||||
|
"uvec2 interpolateAtVertexAMD(f16vec2, uint);"
|
||||||
|
"uvec3 interpolateAtVertexAMD(f16vec3, uint);"
|
||||||
|
"uvec4 interpolateAtVertexAMD(f16vec4, uint);"
|
||||||
|
|
||||||
|
"\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// GL_AMD_gpu_shader_half_float
|
||||||
|
if (profile != EEsProfile && version >= 450) {
|
||||||
|
stageBuiltins[EShLangFragment].append(
|
||||||
|
"float16_t dFdx(float16_t);"
|
||||||
|
"f16vec2 dFdx(f16vec2);"
|
||||||
|
"f16vec3 dFdx(f16vec3);"
|
||||||
|
"f16vec4 dFdx(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t dFdy(float16_t);"
|
||||||
|
"f16vec2 dFdy(f16vec2);"
|
||||||
|
"f16vec3 dFdy(f16vec3);"
|
||||||
|
"f16vec4 dFdy(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t dFdxFine(float16_t);"
|
||||||
|
"f16vec2 dFdxFine(f16vec2);"
|
||||||
|
"f16vec3 dFdxFine(f16vec3);"
|
||||||
|
"f16vec4 dFdxFine(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t dFdyFine(float16_t);"
|
||||||
|
"f16vec2 dFdyFine(f16vec2);"
|
||||||
|
"f16vec3 dFdyFine(f16vec3);"
|
||||||
|
"f16vec4 dFdyFine(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t dFdxCoarse(float16_t);"
|
||||||
|
"f16vec2 dFdxCoarse(f16vec2);"
|
||||||
|
"f16vec3 dFdxCoarse(f16vec3);"
|
||||||
|
"f16vec4 dFdxCoarse(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t dFdyCoarse(float16_t);"
|
||||||
|
"f16vec2 dFdyCoarse(f16vec2);"
|
||||||
|
"f16vec3 dFdyCoarse(f16vec3);"
|
||||||
|
"f16vec4 dFdyCoarse(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t fwidth(float16_t);"
|
||||||
|
"f16vec2 fwidth(f16vec2);"
|
||||||
|
"f16vec3 fwidth(f16vec3);"
|
||||||
|
"f16vec4 fwidth(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t fwidthFine(float16_t);"
|
||||||
|
"f16vec2 fwidthFine(f16vec2);"
|
||||||
|
"f16vec3 fwidthFine(f16vec3);"
|
||||||
|
"f16vec4 fwidthFine(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t fwidthCoarse(float16_t);"
|
||||||
|
"f16vec2 fwidthCoarse(f16vec2);"
|
||||||
|
"f16vec3 fwidthCoarse(f16vec3);"
|
||||||
|
"f16vec4 fwidthCoarse(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t interpolateAtCentroid(float16_t);"
|
||||||
|
"f16vec2 interpolateAtCentroid(f16vec2);"
|
||||||
|
"f16vec3 interpolateAtCentroid(f16vec3);"
|
||||||
|
"f16vec4 interpolateAtCentroid(f16vec4);"
|
||||||
|
|
||||||
|
"float16_t interpolateAtSample(float16_t, int);"
|
||||||
|
"f16vec2 interpolateAtSample(f16vec2, int);"
|
||||||
|
"f16vec3 interpolateAtSample(f16vec3, int);"
|
||||||
|
"f16vec4 interpolateAtSample(f16vec4, int);"
|
||||||
|
|
||||||
|
"float16_t interpolateAtOffset(float16_t, vec2);"
|
||||||
|
"f16vec2 interpolateAtOffset(f16vec2, vec2);"
|
||||||
|
"f16vec3 interpolateAtOffset(f16vec3, vec2);"
|
||||||
|
"f16vec4 interpolateAtOffset(f16vec4, vec2);"
|
||||||
|
|
||||||
"\n");
|
"\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -4369,6 +4801,11 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
|||||||
symbolTable.relateToOperator("packUint2x32", EOpPackUint2x32);
|
symbolTable.relateToOperator("packUint2x32", EOpPackUint2x32);
|
||||||
symbolTable.relateToOperator("unpackUint2x32", EOpUnpackUint2x32);
|
symbolTable.relateToOperator("unpackUint2x32", EOpUnpackUint2x32);
|
||||||
|
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
symbolTable.relateToOperator("packFloat2x16", EOpPackFloat2x16);
|
||||||
|
symbolTable.relateToOperator("unpackFloat2x16", EOpUnpackFloat2x16);
|
||||||
|
#endif
|
||||||
|
|
||||||
symbolTable.relateToOperator("length", EOpLength);
|
symbolTable.relateToOperator("length", EOpLength);
|
||||||
symbolTable.relateToOperator("distance", EOpDistance);
|
symbolTable.relateToOperator("distance", EOpDistance);
|
||||||
symbolTable.relateToOperator("dot", EOpDot);
|
symbolTable.relateToOperator("dot", EOpDot);
|
||||||
|
@ -268,6 +268,9 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo
|
|||||||
case EOpConstructBool: newType = EbtBool; break;
|
case EOpConstructBool: newType = EbtBool; break;
|
||||||
case EOpConstructFloat: newType = EbtFloat; break;
|
case EOpConstructFloat: newType = EbtFloat; break;
|
||||||
case EOpConstructDouble: newType = EbtDouble; break;
|
case EOpConstructDouble: newType = EbtDouble; break;
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EOpConstructFloat16: newType = EbtFloat16; break;
|
||||||
|
#endif
|
||||||
default: break; // some compilers want this
|
default: break; // some compilers want this
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,6 +296,9 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo
|
|||||||
case EOpConstructBool:
|
case EOpConstructBool:
|
||||||
case EOpConstructFloat:
|
case EOpConstructFloat:
|
||||||
case EOpConstructDouble:
|
case EOpConstructDouble:
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EOpConstructFloat16:
|
||||||
|
#endif
|
||||||
return child;
|
return child;
|
||||||
default: break; // some compilers want this
|
default: break; // some compilers want this
|
||||||
}
|
}
|
||||||
@ -471,6 +477,11 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
|||||||
case EOpConstructDouble:
|
case EOpConstructDouble:
|
||||||
promoteTo = EbtDouble;
|
promoteTo = EbtDouble;
|
||||||
break;
|
break;
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EOpConstructFloat16:
|
||||||
|
promoteTo = EbtFloat16;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
case EOpConstructInt:
|
case EOpConstructInt:
|
||||||
promoteTo = EbtInt;
|
promoteTo = EbtInt;
|
||||||
break;
|
break;
|
||||||
@ -585,6 +596,9 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
|||||||
case EbtUint: newOp = EOpConvUintToDouble; break;
|
case EbtUint: newOp = EOpConvUintToDouble; break;
|
||||||
case EbtBool: newOp = EOpConvBoolToDouble; break;
|
case EbtBool: newOp = EOpConvBoolToDouble; break;
|
||||||
case EbtFloat: newOp = EOpConvFloatToDouble; break;
|
case EbtFloat: newOp = EOpConvFloatToDouble; break;
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EbtFloat16: newOp = EOpConvFloat16ToDouble; break;
|
||||||
|
#endif
|
||||||
case EbtInt64: newOp = EOpConvInt64ToDouble; break;
|
case EbtInt64: newOp = EOpConvInt64ToDouble; break;
|
||||||
case EbtUint64: newOp = EOpConvUint64ToDouble; break;
|
case EbtUint64: newOp = EOpConvUint64ToDouble; break;
|
||||||
default:
|
default:
|
||||||
@ -597,18 +611,39 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
|||||||
case EbtUint: newOp = EOpConvUintToFloat; break;
|
case EbtUint: newOp = EOpConvUintToFloat; break;
|
||||||
case EbtBool: newOp = EOpConvBoolToFloat; break;
|
case EbtBool: newOp = EOpConvBoolToFloat; break;
|
||||||
case EbtDouble: newOp = EOpConvDoubleToFloat; break;
|
case EbtDouble: newOp = EOpConvDoubleToFloat; break;
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EbtFloat16: newOp = EOpConvFloat16ToFloat; break;
|
||||||
|
#endif
|
||||||
case EbtInt64: newOp = EOpConvInt64ToFloat; break;
|
case EbtInt64: newOp = EOpConvInt64ToFloat; break;
|
||||||
case EbtUint64: newOp = EOpConvUint64ToFloat; break;
|
case EbtUint64: newOp = EOpConvUint64ToFloat; break;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EbtFloat16:
|
||||||
|
switch (node->getBasicType()) {
|
||||||
|
case EbtInt: newOp = EOpConvIntToFloat16; break;
|
||||||
|
case EbtUint: newOp = EOpConvUintToFloat16; break;
|
||||||
|
case EbtBool: newOp = EOpConvBoolToFloat16; break;
|
||||||
|
case EbtFloat: newOp = EOpConvFloatToFloat16; break;
|
||||||
|
case EbtDouble: newOp = EOpConvDoubleToFloat16; break;
|
||||||
|
case EbtInt64: newOp = EOpConvInt64ToFloat16; break;
|
||||||
|
case EbtUint64: newOp = EOpConvUint64ToFloat16; break;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
case EbtBool:
|
case EbtBool:
|
||||||
switch (node->getBasicType()) {
|
switch (node->getBasicType()) {
|
||||||
case EbtInt: newOp = EOpConvIntToBool; break;
|
case EbtInt: newOp = EOpConvIntToBool; break;
|
||||||
case EbtUint: newOp = EOpConvUintToBool; break;
|
case EbtUint: newOp = EOpConvUintToBool; break;
|
||||||
case EbtFloat: newOp = EOpConvFloatToBool; break;
|
case EbtFloat: newOp = EOpConvFloatToBool; break;
|
||||||
case EbtDouble: newOp = EOpConvDoubleToBool; break;
|
case EbtDouble: newOp = EOpConvDoubleToBool; break;
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EbtFloat16: newOp = EOpConvFloat16ToBool; break;
|
||||||
|
#endif
|
||||||
case EbtInt64: newOp = EOpConvInt64ToBool; break;
|
case EbtInt64: newOp = EOpConvInt64ToBool; break;
|
||||||
case EbtUint64: newOp = EOpConvUint64ToBool; break;
|
case EbtUint64: newOp = EOpConvUint64ToBool; break;
|
||||||
default:
|
default:
|
||||||
@ -621,6 +656,9 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
|||||||
case EbtBool: newOp = EOpConvBoolToInt; break;
|
case EbtBool: newOp = EOpConvBoolToInt; break;
|
||||||
case EbtFloat: newOp = EOpConvFloatToInt; break;
|
case EbtFloat: newOp = EOpConvFloatToInt; break;
|
||||||
case EbtDouble: newOp = EOpConvDoubleToInt; break;
|
case EbtDouble: newOp = EOpConvDoubleToInt; break;
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EbtFloat16: newOp = EOpConvFloat16ToInt; break;
|
||||||
|
#endif
|
||||||
case EbtInt64: newOp = EOpConvInt64ToInt; break;
|
case EbtInt64: newOp = EOpConvInt64ToInt; break;
|
||||||
case EbtUint64: newOp = EOpConvUint64ToInt; break;
|
case EbtUint64: newOp = EOpConvUint64ToInt; break;
|
||||||
default:
|
default:
|
||||||
@ -633,6 +671,9 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
|||||||
case EbtBool: newOp = EOpConvBoolToUint; break;
|
case EbtBool: newOp = EOpConvBoolToUint; break;
|
||||||
case EbtFloat: newOp = EOpConvFloatToUint; break;
|
case EbtFloat: newOp = EOpConvFloatToUint; break;
|
||||||
case EbtDouble: newOp = EOpConvDoubleToUint; break;
|
case EbtDouble: newOp = EOpConvDoubleToUint; break;
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EbtFloat16: newOp = EOpConvFloat16ToUint; break;
|
||||||
|
#endif
|
||||||
case EbtInt64: newOp = EOpConvInt64ToUint; break;
|
case EbtInt64: newOp = EOpConvInt64ToUint; break;
|
||||||
case EbtUint64: newOp = EOpConvUint64ToUint; break;
|
case EbtUint64: newOp = EOpConvUint64ToUint; break;
|
||||||
default:
|
default:
|
||||||
@ -646,6 +687,9 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
|||||||
case EbtBool: newOp = EOpConvBoolToInt64; break;
|
case EbtBool: newOp = EOpConvBoolToInt64; break;
|
||||||
case EbtFloat: newOp = EOpConvFloatToInt64; break;
|
case EbtFloat: newOp = EOpConvFloatToInt64; break;
|
||||||
case EbtDouble: newOp = EOpConvDoubleToInt64; break;
|
case EbtDouble: newOp = EOpConvDoubleToInt64; break;
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EbtFloat16: newOp = EOpConvFloat16ToInt64; break;
|
||||||
|
#endif
|
||||||
case EbtUint64: newOp = EOpConvUint64ToInt64; break;
|
case EbtUint64: newOp = EOpConvUint64ToInt64; break;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
@ -658,6 +702,9 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
|||||||
case EbtBool: newOp = EOpConvBoolToUint64; break;
|
case EbtBool: newOp = EOpConvBoolToUint64; break;
|
||||||
case EbtFloat: newOp = EOpConvFloatToUint64; break;
|
case EbtFloat: newOp = EOpConvFloatToUint64; break;
|
||||||
case EbtDouble: newOp = EOpConvDoubleToUint64; break;
|
case EbtDouble: newOp = EOpConvDoubleToUint64; break;
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EbtFloat16: newOp = EOpConvFloat16ToUint64; break;
|
||||||
|
#endif
|
||||||
case EbtInt64: newOp = EOpConvInt64ToUint64; break;
|
case EbtInt64: newOp = EOpConvInt64ToUint64; break;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
@ -779,6 +826,9 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
|||||||
case EbtUint64:
|
case EbtUint64:
|
||||||
case EbtFloat:
|
case EbtFloat:
|
||||||
case EbtDouble:
|
case EbtDouble:
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EbtFloat16:
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
@ -788,6 +838,9 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
|||||||
case EbtInt:
|
case EbtInt:
|
||||||
case EbtUint:
|
case EbtUint:
|
||||||
case EbtFloat:
|
case EbtFloat:
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EbtFloat16:
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
@ -923,6 +976,47 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EbtFloat16:
|
||||||
|
if (type.getMatrixCols()) {
|
||||||
|
switch (type.getMatrixCols()) {
|
||||||
|
case 2:
|
||||||
|
switch (type.getMatrixRows()) {
|
||||||
|
case 2: op = EOpConstructF16Mat2x2; break;
|
||||||
|
case 3: op = EOpConstructF16Mat2x3; break;
|
||||||
|
case 4: op = EOpConstructF16Mat2x4; break;
|
||||||
|
default: break; // some compilers want this
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
switch (type.getMatrixRows()) {
|
||||||
|
case 2: op = EOpConstructF16Mat3x2; break;
|
||||||
|
case 3: op = EOpConstructF16Mat3x3; break;
|
||||||
|
case 4: op = EOpConstructF16Mat3x4; break;
|
||||||
|
default: break; // some compilers want this
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
switch (type.getMatrixRows()) {
|
||||||
|
case 2: op = EOpConstructF16Mat4x2; break;
|
||||||
|
case 3: op = EOpConstructF16Mat4x3; break;
|
||||||
|
case 4: op = EOpConstructF16Mat4x4; break;
|
||||||
|
default: break; // some compilers want this
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
switch (type.getVectorSize()) {
|
||||||
|
case 1: op = EOpConstructFloat16; break;
|
||||||
|
case 2: op = EOpConstructF16Vec2; break;
|
||||||
|
case 3: op = EOpConstructF16Vec3; break;
|
||||||
|
case 4: op = EOpConstructF16Vec4; break;
|
||||||
|
default: break; // some compilers want this
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
case EbtInt:
|
case EbtInt:
|
||||||
switch(type.getVectorSize()) {
|
switch(type.getVectorSize()) {
|
||||||
case 1: op = EOpConstructInt; break;
|
case 1: op = EOpConstructInt; break;
|
||||||
@ -1196,7 +1290,11 @@ TIntermConstantUnion* TIntermediate::addConstantUnion(bool b, const TSourceLoc&
|
|||||||
|
|
||||||
TIntermConstantUnion* TIntermediate::addConstantUnion(double d, TBasicType baseType, const TSourceLoc& loc, bool literal) const
|
TIntermConstantUnion* TIntermediate::addConstantUnion(double d, TBasicType baseType, const TSourceLoc& loc, bool literal) const
|
||||||
{
|
{
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
assert(baseType == EbtFloat || baseType == EbtDouble || baseType == EbtFloat16);
|
||||||
|
#else
|
||||||
assert(baseType == EbtFloat || baseType == EbtDouble);
|
assert(baseType == EbtFloat || baseType == EbtDouble);
|
||||||
|
#endif
|
||||||
|
|
||||||
TConstUnionArray unionArray(1);
|
TConstUnionArray unionArray(1);
|
||||||
unionArray[0].setDConst(d);
|
unionArray[0].setDConst(d);
|
||||||
@ -1451,6 +1549,12 @@ bool TIntermediate::isSpecializationOperation(const TIntermOperator& node) const
|
|||||||
case EOpVectorSwizzle:
|
case EOpVectorSwizzle:
|
||||||
case EOpConvFloatToDouble:
|
case EOpConvFloatToDouble:
|
||||||
case EOpConvDoubleToFloat:
|
case EOpConvDoubleToFloat:
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EOpConvFloat16ToFloat:
|
||||||
|
case EOpConvFloatToFloat16:
|
||||||
|
case EOpConvFloat16ToDouble:
|
||||||
|
case EOpConvDoubleToFloat16:
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
@ -1607,6 +1711,9 @@ bool TIntermUnary::promote()
|
|||||||
operand->getBasicType() != EbtInt64 &&
|
operand->getBasicType() != EbtInt64 &&
|
||||||
operand->getBasicType() != EbtUint64 &&
|
operand->getBasicType() != EbtUint64 &&
|
||||||
operand->getBasicType() != EbtFloat &&
|
operand->getBasicType() != EbtFloat &&
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
operand->getBasicType() != EbtFloat16 &&
|
||||||
|
#endif
|
||||||
operand->getBasicType() != EbtDouble)
|
operand->getBasicType() != EbtDouble)
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -1626,7 +1733,11 @@ bool TIntermUnary::promote()
|
|||||||
|
|
||||||
void TIntermUnary::updatePrecision()
|
void TIntermUnary::updatePrecision()
|
||||||
{
|
{
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
if (getBasicType() == EbtInt || getBasicType() == EbtUint || getBasicType() == EbtFloat || getBasicType() == EbtFloat16) {
|
||||||
|
#else
|
||||||
if (getBasicType() == EbtInt || getBasicType() == EbtUint || getBasicType() == EbtFloat) {
|
if (getBasicType() == EbtInt || getBasicType() == EbtUint || getBasicType() == EbtFloat) {
|
||||||
|
#endif
|
||||||
if (operand->getQualifier().precision > getQualifier().precision)
|
if (operand->getQualifier().precision > getQualifier().precision)
|
||||||
getQualifier().precision = operand->getQualifier().precision;
|
getQualifier().precision = operand->getQualifier().precision;
|
||||||
}
|
}
|
||||||
@ -1955,7 +2066,11 @@ bool TIntermBinary::promote()
|
|||||||
|
|
||||||
void TIntermBinary::updatePrecision()
|
void TIntermBinary::updatePrecision()
|
||||||
{
|
{
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
if (getBasicType() == EbtInt || getBasicType() == EbtUint || getBasicType() == EbtFloat || getBasicType() == EbtFloat16) {
|
||||||
|
#else
|
||||||
if (getBasicType() == EbtInt || getBasicType() == EbtUint || getBasicType() == EbtFloat) {
|
if (getBasicType() == EbtInt || getBasicType() == EbtUint || getBasicType() == EbtFloat) {
|
||||||
|
#endif
|
||||||
getQualifier().precision = std::max(right->getQualifier().precision, left->getQualifier().precision);
|
getQualifier().precision = std::max(right->getQualifier().precision, left->getQualifier().precision);
|
||||||
if (getQualifier().precision != EpqNone) {
|
if (getQualifier().precision != EpqNone) {
|
||||||
left->propagatePrecision(getQualifier().precision);
|
left->propagatePrecision(getQualifier().precision);
|
||||||
@ -1966,7 +2081,11 @@ void TIntermBinary::updatePrecision()
|
|||||||
|
|
||||||
void TIntermTyped::propagatePrecision(TPrecisionQualifier newPrecision)
|
void TIntermTyped::propagatePrecision(TPrecisionQualifier newPrecision)
|
||||||
{
|
{
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
if (getQualifier().precision != EpqNone || (getBasicType() != EbtInt && getBasicType() != EbtUint && getBasicType() != EbtFloat && getBasicType() != EbtFloat16))
|
||||||
|
#else
|
||||||
if (getQualifier().precision != EpqNone || (getBasicType() != EbtInt && getBasicType() != EbtUint && getBasicType() != EbtFloat))
|
if (getQualifier().precision != EpqNone || (getBasicType() != EbtInt && getBasicType() != EbtUint && getBasicType() != EbtFloat))
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
|
|
||||||
getQualifier().precision = newPrecision;
|
getQualifier().precision = newPrecision;
|
||||||
@ -2040,10 +2159,11 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
|
|||||||
leftUnionArray[i].setDConst(static_cast<double>(rightUnionArray[i].getBConst()));
|
leftUnionArray[i].setDConst(static_cast<double>(rightUnionArray[i].getBConst()));
|
||||||
break;
|
break;
|
||||||
case EbtFloat:
|
case EbtFloat:
|
||||||
leftUnionArray[i] = rightUnionArray[i];
|
|
||||||
break;
|
|
||||||
case EbtDouble:
|
case EbtDouble:
|
||||||
leftUnionArray[i].setDConst(static_cast<double>(rightUnionArray[i].getDConst()));
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EbtFloat16:
|
||||||
|
#endif
|
||||||
|
leftUnionArray[i] = rightUnionArray[i];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return node;
|
return node;
|
||||||
@ -2068,12 +2188,43 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
|
|||||||
break;
|
break;
|
||||||
case EbtFloat:
|
case EbtFloat:
|
||||||
case EbtDouble:
|
case EbtDouble:
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EbtFloat16:
|
||||||
|
#endif
|
||||||
leftUnionArray[i] = rightUnionArray[i];
|
leftUnionArray[i] = rightUnionArray[i];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EbtFloat16:
|
||||||
|
switch (node->getType().getBasicType()) {
|
||||||
|
case EbtInt:
|
||||||
|
leftUnionArray[i].setDConst(static_cast<double>(rightUnionArray[i].getIConst()));
|
||||||
|
break;
|
||||||
|
case EbtUint:
|
||||||
|
leftUnionArray[i].setDConst(static_cast<double>(rightUnionArray[i].getUConst()));
|
||||||
|
break;
|
||||||
|
case EbtInt64:
|
||||||
|
leftUnionArray[i].setDConst(static_cast<double>(rightUnionArray[i].getI64Const()));
|
||||||
|
break;
|
||||||
|
case EbtUint64:
|
||||||
|
leftUnionArray[i].setDConst(static_cast<double>(rightUnionArray[i].getU64Const()));
|
||||||
|
break;
|
||||||
|
case EbtBool:
|
||||||
|
leftUnionArray[i].setDConst(static_cast<double>(rightUnionArray[i].getBConst()));
|
||||||
|
break;
|
||||||
|
case EbtFloat:
|
||||||
|
case EbtDouble:
|
||||||
|
case EbtFloat16:
|
||||||
|
leftUnionArray[i] = rightUnionArray[i];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
case EbtInt:
|
case EbtInt:
|
||||||
switch (node->getType().getBasicType()) {
|
switch (node->getType().getBasicType()) {
|
||||||
case EbtInt:
|
case EbtInt:
|
||||||
@ -2093,6 +2244,9 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
|
|||||||
break;
|
break;
|
||||||
case EbtFloat:
|
case EbtFloat:
|
||||||
case EbtDouble:
|
case EbtDouble:
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EbtFloat16:
|
||||||
|
#endif
|
||||||
leftUnionArray[i].setIConst(static_cast<int>(rightUnionArray[i].getDConst()));
|
leftUnionArray[i].setIConst(static_cast<int>(rightUnionArray[i].getDConst()));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -2118,6 +2272,9 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
|
|||||||
break;
|
break;
|
||||||
case EbtFloat:
|
case EbtFloat:
|
||||||
case EbtDouble:
|
case EbtDouble:
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EbtFloat16:
|
||||||
|
#endif
|
||||||
leftUnionArray[i].setUConst(static_cast<unsigned int>(rightUnionArray[i].getDConst()));
|
leftUnionArray[i].setUConst(static_cast<unsigned int>(rightUnionArray[i].getDConst()));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -2143,6 +2300,9 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
|
|||||||
break;
|
break;
|
||||||
case EbtFloat:
|
case EbtFloat:
|
||||||
case EbtDouble:
|
case EbtDouble:
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EbtFloat16:
|
||||||
|
#endif
|
||||||
leftUnionArray[i].setBConst(rightUnionArray[i].getDConst() != 0.0);
|
leftUnionArray[i].setBConst(rightUnionArray[i].getDConst() != 0.0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -2168,6 +2328,9 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
|
|||||||
break;
|
break;
|
||||||
case EbtFloat:
|
case EbtFloat:
|
||||||
case EbtDouble:
|
case EbtDouble:
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EbtFloat16:
|
||||||
|
#endif
|
||||||
leftUnionArray[i].setI64Const(static_cast<long long>(rightUnionArray[i].getDConst()));
|
leftUnionArray[i].setI64Const(static_cast<long long>(rightUnionArray[i].getDConst()));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -2193,6 +2356,9 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
|
|||||||
break;
|
break;
|
||||||
case EbtFloat:
|
case EbtFloat:
|
||||||
case EbtDouble:
|
case EbtDouble:
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EbtFloat16:
|
||||||
|
#endif
|
||||||
leftUnionArray[i].setU64Const(static_cast<unsigned long long>(rightUnionArray[i].getDConst()));
|
leftUnionArray[i].setU64Const(static_cast<unsigned long long>(rightUnionArray[i].getDConst()));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -4559,6 +4559,11 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
|
|||||||
// containing a double, the offset must also be a multiple of 8..."
|
// containing a double, the offset must also be a multiple of 8..."
|
||||||
if (type.containsBasicType(EbtDouble) && ! IsMultipleOfPow2(qualifier.layoutXfbOffset, 8))
|
if (type.containsBasicType(EbtDouble) && ! IsMultipleOfPow2(qualifier.layoutXfbOffset, 8))
|
||||||
error(loc, "type contains double; xfb_offset must be a multiple of 8", "xfb_offset", "");
|
error(loc, "type contains double; xfb_offset must be a multiple of 8", "xfb_offset", "");
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
// ..., if applied to an aggregate containing a float16_t, the offset must also be a multiple of 2..."
|
||||||
|
else if (type.containsBasicType(EbtFloat16) && !IsMultipleOfPow2(qualifier.layoutXfbOffset, 2))
|
||||||
|
error(loc, "type contains half float; xfb_offset must be a multiple of 2", "xfb_offset", "");
|
||||||
|
#endif
|
||||||
else if (! IsMultipleOfPow2(qualifier.layoutXfbOffset, 4))
|
else if (! IsMultipleOfPow2(qualifier.layoutXfbOffset, 4))
|
||||||
error(loc, "must be a multiple of size of first component", "xfb_offset", "");
|
error(loc, "must be a multiple of size of first component", "xfb_offset", "");
|
||||||
}
|
}
|
||||||
@ -4662,6 +4667,9 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
|
|||||||
case EbtBool:
|
case EbtBool:
|
||||||
case EbtFloat:
|
case EbtFloat:
|
||||||
case EbtDouble:
|
case EbtDouble:
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EbtFloat16:
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
error(loc, "cannot be applied to this type", "constant_id", "");
|
error(loc, "cannot be applied to this type", "constant_id", "");
|
||||||
@ -5561,6 +5569,24 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
|
|||||||
basicOp = EOpConstructDouble;
|
basicOp = EOpConstructDouble;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EOpConstructF16Vec2:
|
||||||
|
case EOpConstructF16Vec3:
|
||||||
|
case EOpConstructF16Vec4:
|
||||||
|
case EOpConstructF16Mat2x2:
|
||||||
|
case EOpConstructF16Mat2x3:
|
||||||
|
case EOpConstructF16Mat2x4:
|
||||||
|
case EOpConstructF16Mat3x2:
|
||||||
|
case EOpConstructF16Mat3x3:
|
||||||
|
case EOpConstructF16Mat3x4:
|
||||||
|
case EOpConstructF16Mat4x2:
|
||||||
|
case EOpConstructF16Mat4x3:
|
||||||
|
case EOpConstructF16Mat4x4:
|
||||||
|
case EOpConstructFloat16:
|
||||||
|
basicOp = EOpConstructFloat16;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case EOpConstructIVec2:
|
case EOpConstructIVec2:
|
||||||
case EOpConstructIVec3:
|
case EOpConstructIVec3:
|
||||||
case EOpConstructIVec4:
|
case EOpConstructIVec4:
|
||||||
|
@ -463,6 +463,25 @@ void TScanContext::fillInKeywordMap()
|
|||||||
(*KeywordMap)["u64vec3"] = U64VEC3;
|
(*KeywordMap)["u64vec3"] = U64VEC3;
|
||||||
(*KeywordMap)["u64vec4"] = U64VEC4;
|
(*KeywordMap)["u64vec4"] = U64VEC4;
|
||||||
|
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
(*KeywordMap)["float16_t"] = FLOAT16_T;
|
||||||
|
(*KeywordMap)["f16vec2"] = F16VEC2;
|
||||||
|
(*KeywordMap)["f16vec3"] = F16VEC3;
|
||||||
|
(*KeywordMap)["f16vec4"] = F16VEC4;
|
||||||
|
(*KeywordMap)["f16mat2"] = F16MAT2;
|
||||||
|
(*KeywordMap)["f16mat3"] = F16MAT3;
|
||||||
|
(*KeywordMap)["f16mat4"] = F16MAT4;
|
||||||
|
(*KeywordMap)["f16mat2x2"] = F16MAT2X2;
|
||||||
|
(*KeywordMap)["f16mat2x3"] = F16MAT2X3;
|
||||||
|
(*KeywordMap)["f16mat2x4"] = F16MAT2X4;
|
||||||
|
(*KeywordMap)["f16mat3x2"] = F16MAT3X2;
|
||||||
|
(*KeywordMap)["f16mat3x3"] = F16MAT3X3;
|
||||||
|
(*KeywordMap)["f16mat3x4"] = F16MAT3X4;
|
||||||
|
(*KeywordMap)["f16mat4x2"] = F16MAT4X2;
|
||||||
|
(*KeywordMap)["f16mat4x3"] = F16MAT4X3;
|
||||||
|
(*KeywordMap)["f16mat4x4"] = F16MAT4X4;
|
||||||
|
#endif
|
||||||
|
|
||||||
(*KeywordMap)["sampler2D"] = SAMPLER2D;
|
(*KeywordMap)["sampler2D"] = SAMPLER2D;
|
||||||
(*KeywordMap)["samplerCube"] = SAMPLERCUBE;
|
(*KeywordMap)["samplerCube"] = SAMPLERCUBE;
|
||||||
(*KeywordMap)["samplerCubeArray"] = SAMPLERCUBEARRAY;
|
(*KeywordMap)["samplerCubeArray"] = SAMPLERCUBEARRAY;
|
||||||
@ -687,6 +706,9 @@ int TScanContext::tokenize(TPpContext* pp, TParserToken& token)
|
|||||||
case PpAtomConstUint64: parserToken->sType.lex.i64 = ppToken.i64val; return UINT64CONSTANT;
|
case PpAtomConstUint64: parserToken->sType.lex.i64 = ppToken.i64val; return UINT64CONSTANT;
|
||||||
case PpAtomConstFloat: parserToken->sType.lex.d = ppToken.dval; return FLOATCONSTANT;
|
case PpAtomConstFloat: parserToken->sType.lex.d = ppToken.dval; return FLOATCONSTANT;
|
||||||
case PpAtomConstDouble: parserToken->sType.lex.d = ppToken.dval; return DOUBLECONSTANT;
|
case PpAtomConstDouble: parserToken->sType.lex.d = ppToken.dval; return DOUBLECONSTANT;
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case PpAtomConstFloat16: parserToken->sType.lex.d = ppToken.dval; return FLOAT16CONSTANT;
|
||||||
|
#endif
|
||||||
case PpAtomIdentifier:
|
case PpAtomIdentifier:
|
||||||
{
|
{
|
||||||
int token = tokenizeIdentifier();
|
int token = tokenizeIdentifier();
|
||||||
@ -938,10 +960,38 @@ int TScanContext::tokenizeIdentifier()
|
|||||||
case U64VEC2:
|
case U64VEC2:
|
||||||
case U64VEC3:
|
case U64VEC3:
|
||||||
case U64VEC4:
|
case U64VEC4:
|
||||||
if (parseContext.profile != EEsProfile && parseContext.version >= 450)
|
afterType = true;
|
||||||
|
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||||
|
(parseContext.extensionTurnedOn(E_GL_ARB_gpu_shader_int64) &&
|
||||||
|
parseContext.profile != EEsProfile && parseContext.version >= 450))
|
||||||
return keyword;
|
return keyword;
|
||||||
return identifierOrType();
|
return identifierOrType();
|
||||||
|
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case FLOAT16_T:
|
||||||
|
case F16VEC2:
|
||||||
|
case F16VEC3:
|
||||||
|
case F16VEC4:
|
||||||
|
case F16MAT2:
|
||||||
|
case F16MAT3:
|
||||||
|
case F16MAT4:
|
||||||
|
case F16MAT2X2:
|
||||||
|
case F16MAT2X3:
|
||||||
|
case F16MAT2X4:
|
||||||
|
case F16MAT3X2:
|
||||||
|
case F16MAT3X3:
|
||||||
|
case F16MAT3X4:
|
||||||
|
case F16MAT4X2:
|
||||||
|
case F16MAT4X3:
|
||||||
|
case F16MAT4X4:
|
||||||
|
afterType = true;
|
||||||
|
if (parseContext.symbolTable.atBuiltInLevel() ||
|
||||||
|
(parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float) &&
|
||||||
|
parseContext.profile != EEsProfile && parseContext.version >= 450))
|
||||||
|
return keyword;
|
||||||
|
return identifierOrType();
|
||||||
|
#endif
|
||||||
|
|
||||||
case SAMPLERCUBEARRAY:
|
case SAMPLERCUBEARRAY:
|
||||||
case SAMPLERCUBEARRAYSHADOW:
|
case SAMPLERCUBEARRAYSHADOW:
|
||||||
case ISAMPLERCUBEARRAY:
|
case ISAMPLERCUBEARRAY:
|
||||||
|
@ -60,6 +60,9 @@ void TType::buildMangledName(TString& mangledName)
|
|||||||
switch (basicType) {
|
switch (basicType) {
|
||||||
case EbtFloat: mangledName += 'f'; break;
|
case EbtFloat: mangledName += 'f'; break;
|
||||||
case EbtDouble: mangledName += 'd'; break;
|
case EbtDouble: mangledName += 'd'; break;
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EbtFloat16: mangledName += "f16"; break;
|
||||||
|
#endif
|
||||||
case EbtInt: mangledName += 'i'; break;
|
case EbtInt: mangledName += 'i'; break;
|
||||||
case EbtUint: mangledName += 'u'; break;
|
case EbtUint: mangledName += 'u'; break;
|
||||||
case EbtInt64: mangledName += "i64"; break;
|
case EbtInt64: mangledName += "i64"; break;
|
||||||
|
@ -192,6 +192,7 @@ void TParseVersions::initializeExtensionBehavior()
|
|||||||
extensionBehavior[E_GL_AMD_shader_trinary_minmax] = EBhDisable;
|
extensionBehavior[E_GL_AMD_shader_trinary_minmax] = EBhDisable;
|
||||||
extensionBehavior[E_GL_AMD_shader_explicit_vertex_parameter] = EBhDisable;
|
extensionBehavior[E_GL_AMD_shader_explicit_vertex_parameter] = EBhDisable;
|
||||||
extensionBehavior[E_GL_AMD_gcn_shader] = EBhDisable;
|
extensionBehavior[E_GL_AMD_gcn_shader] = EBhDisable;
|
||||||
|
extensionBehavior[E_GL_AMD_gpu_shader_half_float] = EBhDisable;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// AEP
|
// AEP
|
||||||
@ -299,6 +300,7 @@ void TParseVersions::getPreamble(std::string& preamble)
|
|||||||
"#define GL_AMD_shader_trinary_minmax 1\n"
|
"#define GL_AMD_shader_trinary_minmax 1\n"
|
||||||
"#define GL_AMD_shader_explicit_vertex_parameter 1\n"
|
"#define GL_AMD_shader_explicit_vertex_parameter 1\n"
|
||||||
"#define GL_AMD_gcn_shader 1\n"
|
"#define GL_AMD_gcn_shader 1\n"
|
||||||
|
"#define GL_AMD_gpu_shader_half_float 1\n"
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
@ -663,6 +665,19 @@ void TParseVersions::doubleCheck(const TSourceLoc& loc, const char* op)
|
|||||||
profileRequires(loc, ECompatibilityProfile, 400, nullptr, op);
|
profileRequires(loc, ECompatibilityProfile, 400, nullptr, op);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
// Call for any operation needing GLSL float16 data-type support.
|
||||||
|
void TParseVersions::float16Check(const TSourceLoc& loc, const char* op, bool 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);
|
||||||
|
profileRequires(loc, ECompatibilityProfile, 450, nullptr, op);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Call for any operation needing GLSL 64-bit integer data-type support.
|
// Call for any operation needing GLSL 64-bit integer data-type support.
|
||||||
void TParseVersions::int64Check(const TSourceLoc& loc, const char* op, bool builtIn)
|
void TParseVersions::int64Check(const TSourceLoc& loc, const char* op, bool builtIn)
|
||||||
{
|
{
|
||||||
|
@ -136,10 +136,11 @@ const char* const E_GL_GOOGLE_cpp_style_line_directive = "GL_GOOGLE_cpp
|
|||||||
const char* const E_GL_GOOGLE_include_directive = "GL_GOOGLE_include_directive";
|
const char* const E_GL_GOOGLE_include_directive = "GL_GOOGLE_include_directive";
|
||||||
|
|
||||||
#ifdef AMD_EXTENSIONS
|
#ifdef AMD_EXTENSIONS
|
||||||
const char* const E_GL_AMD_shader_ballot = "GL_AMD_shader_ballot";
|
const char* const E_GL_AMD_shader_ballot = "GL_AMD_shader_ballot";
|
||||||
const char* const E_GL_AMD_shader_trinary_minmax = "GL_AMD_shader_trinary_minmax";
|
const char* const E_GL_AMD_shader_trinary_minmax = "GL_AMD_shader_trinary_minmax";
|
||||||
const char* const E_GL_AMD_shader_explicit_vertex_parameter = "GL_AMD_shader_explicit_vertex_parameter";
|
const char* const E_GL_AMD_shader_explicit_vertex_parameter = "GL_AMD_shader_explicit_vertex_parameter";
|
||||||
const char* const E_GL_AMD_gcn_shader = "GL_AMD_gcn_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";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// AEP
|
// AEP
|
||||||
|
@ -76,6 +76,24 @@
|
|||||||
#define GL_DOUBLE_MAT4x2 0x8F4D
|
#define GL_DOUBLE_MAT4x2 0x8F4D
|
||||||
#define GL_DOUBLE_MAT4x3 0x8F4E
|
#define GL_DOUBLE_MAT4x3 0x8F4E
|
||||||
|
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
// Those constants are borrowed from extension NV_gpu_shader5
|
||||||
|
#define GL_FLOAT16_NV 0x8FF8
|
||||||
|
#define GL_FLOAT16_VEC2_NV 0x8FF9
|
||||||
|
#define GL_FLOAT16_VEC3_NV 0x8FFA
|
||||||
|
#define GL_FLOAT16_VEC4_NV 0x8FFB
|
||||||
|
|
||||||
|
#define GL_FLOAT16_MAT2_AMD 0x91C5
|
||||||
|
#define GL_FLOAT16_MAT3_AMD 0x91C6
|
||||||
|
#define GL_FLOAT16_MAT4_AMD 0x91C7
|
||||||
|
#define GL_FLOAT16_MAT2x3_AMD 0x91C8
|
||||||
|
#define GL_FLOAT16_MAT2x4_AMD 0x91C9
|
||||||
|
#define GL_FLOAT16_MAT3x2_AMD 0x91CA
|
||||||
|
#define GL_FLOAT16_MAT3x4_AMD 0x91CB
|
||||||
|
#define GL_FLOAT16_MAT4x2_AMD 0x91CC
|
||||||
|
#define GL_FLOAT16_MAT4x3_AMD 0x91CD
|
||||||
|
#endif
|
||||||
|
|
||||||
#define GL_SAMPLER_1D 0x8B5D
|
#define GL_SAMPLER_1D 0x8B5D
|
||||||
#define GL_SAMPLER_2D 0x8B5E
|
#define GL_SAMPLER_2D 0x8B5E
|
||||||
#define GL_SAMPLER_3D 0x8B5F
|
#define GL_SAMPLER_3D 0x8B5F
|
||||||
|
@ -119,13 +119,14 @@ extern int yylex(YYSTYPE*, TParseContext&);
|
|||||||
%expect 1 // One shift reduce conflict because of if | else
|
%expect 1 // One shift reduce conflict because of if | else
|
||||||
|
|
||||||
%token <lex> ATTRIBUTE VARYING
|
%token <lex> ATTRIBUTE VARYING
|
||||||
%token <lex> CONST BOOL FLOAT DOUBLE INT UINT INT64_T UINT64_T
|
%token <lex> CONST BOOL FLOAT DOUBLE INT UINT INT64_T UINT64_T FLOAT16_T
|
||||||
%token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT SUBROUTINE
|
%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> BVEC2 BVEC3 BVEC4 IVEC2 IVEC3 IVEC4 I64VEC2 I64VEC3 I64VEC4 UVEC2 UVEC3 UVEC4 U64VEC2 U64VEC3 U64VEC4 VEC2 VEC3 VEC4
|
||||||
%token <lex> MAT2 MAT3 MAT4 CENTROID IN OUT INOUT
|
%token <lex> MAT2 MAT3 MAT4 CENTROID IN OUT INOUT
|
||||||
%token <lex> UNIFORM PATCH SAMPLE BUFFER SHARED
|
%token <lex> UNIFORM PATCH SAMPLE BUFFER SHARED
|
||||||
%token <lex> COHERENT VOLATILE RESTRICT READONLY WRITEONLY
|
%token <lex> COHERENT VOLATILE RESTRICT READONLY WRITEONLY
|
||||||
%token <lex> DVEC2 DVEC3 DVEC4 DMAT2 DMAT3 DMAT4
|
%token <lex> DVEC2 DVEC3 DVEC4 DMAT2 DMAT3 DMAT4
|
||||||
|
%token <lex> F16VEC2 F16VEC3 F16VEC4 F16MAT2 F16MAT3 F16MAT4
|
||||||
%token <lex> NOPERSPECTIVE FLAT SMOOTH LAYOUT __EXPLICITINTERPAMD
|
%token <lex> NOPERSPECTIVE FLAT SMOOTH LAYOUT __EXPLICITINTERPAMD
|
||||||
|
|
||||||
%token <lex> MAT2X2 MAT2X3 MAT2X4
|
%token <lex> MAT2X2 MAT2X3 MAT2X4
|
||||||
@ -134,6 +135,9 @@ extern int yylex(YYSTYPE*, TParseContext&);
|
|||||||
%token <lex> DMAT2X2 DMAT2X3 DMAT2X4
|
%token <lex> DMAT2X2 DMAT2X3 DMAT2X4
|
||||||
%token <lex> DMAT3X2 DMAT3X3 DMAT3X4
|
%token <lex> DMAT3X2 DMAT3X3 DMAT3X4
|
||||||
%token <lex> DMAT4X2 DMAT4X3 DMAT4X4
|
%token <lex> DMAT4X2 DMAT4X3 DMAT4X4
|
||||||
|
%token <lex> F16MAT2X2 F16MAT2X3 F16MAT2X4
|
||||||
|
%token <lex> F16MAT3X2 F16MAT3X3 F16MAT3X4
|
||||||
|
%token <lex> F16MAT4X2 F16MAT4X3 F16MAT4X4
|
||||||
%token <lex> ATOMIC_UINT
|
%token <lex> ATOMIC_UINT
|
||||||
|
|
||||||
// combined image/sampler
|
// combined image/sampler
|
||||||
@ -182,7 +186,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
|
|||||||
%token <lex> STRUCT VOID WHILE
|
%token <lex> STRUCT VOID WHILE
|
||||||
|
|
||||||
%token <lex> IDENTIFIER TYPE_NAME
|
%token <lex> IDENTIFIER TYPE_NAME
|
||||||
%token <lex> FLOATCONSTANT DOUBLECONSTANT INTCONSTANT UINTCONSTANT INT64CONSTANT UINT64CONSTANT BOOLCONSTANT
|
%token <lex> FLOATCONSTANT DOUBLECONSTANT INTCONSTANT UINTCONSTANT INT64CONSTANT UINT64CONSTANT BOOLCONSTANT FLOAT16CONSTANT
|
||||||
%token <lex> LEFT_OP RIGHT_OP
|
%token <lex> LEFT_OP RIGHT_OP
|
||||||
%token <lex> INC_OP DEC_OP LE_OP GE_OP EQ_OP NE_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
|
%token <lex> AND_OP OR_OP XOR_OP MUL_ASSIGN DIV_ASSIGN ADD_ASSIGN
|
||||||
@ -274,6 +278,12 @@ primary_expression
|
|||||||
parseContext.doubleCheck($1.loc, "double literal");
|
parseContext.doubleCheck($1.loc, "double literal");
|
||||||
$$ = parseContext.intermediate.addConstantUnion($1.d, EbtDouble, $1.loc, true);
|
$$ = parseContext.intermediate.addConstantUnion($1.d, EbtDouble, $1.loc, true);
|
||||||
}
|
}
|
||||||
|
| FLOAT16CONSTANT {
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
parseContext.float16Check($1.loc, "half float literal");
|
||||||
|
$$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat16, $1.loc, true);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
| BOOLCONSTANT {
|
| BOOLCONSTANT {
|
||||||
$$ = parseContext.intermediate.addConstantUnion($1.b, $1.loc, true);
|
$$ = parseContext.intermediate.addConstantUnion($1.b, $1.loc, true);
|
||||||
}
|
}
|
||||||
@ -1324,6 +1334,13 @@ type_specifier_nonarray
|
|||||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||||
$$.basicType = EbtDouble;
|
$$.basicType = EbtDouble;
|
||||||
}
|
}
|
||||||
|
| FLOAT16_T {
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
parseContext.float16Check($1.loc, "half float", parseContext.symbolTable.atBuiltInLevel());
|
||||||
|
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||||
|
$$.basicType = EbtFloat16;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
| INT {
|
| INT {
|
||||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||||
$$.basicType = EbtInt;
|
$$.basicType = EbtInt;
|
||||||
@ -1380,6 +1397,30 @@ type_specifier_nonarray
|
|||||||
$$.basicType = EbtDouble;
|
$$.basicType = EbtDouble;
|
||||||
$$.setVector(4);
|
$$.setVector(4);
|
||||||
}
|
}
|
||||||
|
| F16VEC2 {
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
parseContext.float16Check($1.loc, "half float vector", parseContext.symbolTable.atBuiltInLevel());
|
||||||
|
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||||
|
$$.basicType = EbtFloat16;
|
||||||
|
$$.setVector(2);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
| F16VEC3 {
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
parseContext.float16Check($1.loc, "half float vector", parseContext.symbolTable.atBuiltInLevel());
|
||||||
|
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||||
|
$$.basicType = EbtFloat16;
|
||||||
|
$$.setVector(3);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
| F16VEC4 {
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
parseContext.float16Check($1.loc, "half float vector", parseContext.symbolTable.atBuiltInLevel());
|
||||||
|
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||||
|
$$.basicType = EbtFloat16;
|
||||||
|
$$.setVector(4);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
| BVEC2 {
|
| BVEC2 {
|
||||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||||
$$.basicType = EbtBool;
|
$$.basicType = EbtBool;
|
||||||
@ -1596,6 +1637,102 @@ type_specifier_nonarray
|
|||||||
$$.basicType = EbtDouble;
|
$$.basicType = EbtDouble;
|
||||||
$$.setMatrix(4, 4);
|
$$.setMatrix(4, 4);
|
||||||
}
|
}
|
||||||
|
| F16MAT2 {
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
|
||||||
|
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||||
|
$$.basicType = EbtFloat16;
|
||||||
|
$$.setMatrix(2, 2);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
| F16MAT3 {
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
|
||||||
|
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||||
|
$$.basicType = EbtFloat16;
|
||||||
|
$$.setMatrix(3, 3);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
| F16MAT4 {
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
|
||||||
|
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||||
|
$$.basicType = EbtFloat16;
|
||||||
|
$$.setMatrix(4, 4);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
| F16MAT2X2 {
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
|
||||||
|
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||||
|
$$.basicType = EbtFloat16;
|
||||||
|
$$.setMatrix(2, 2);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
| F16MAT2X3 {
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
|
||||||
|
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||||
|
$$.basicType = EbtFloat16;
|
||||||
|
$$.setMatrix(2, 3);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
| F16MAT2X4 {
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
|
||||||
|
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||||
|
$$.basicType = EbtFloat16;
|
||||||
|
$$.setMatrix(2, 4);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
| F16MAT3X2 {
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
|
||||||
|
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||||
|
$$.basicType = EbtFloat16;
|
||||||
|
$$.setMatrix(3, 2);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
| F16MAT3X3 {
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
|
||||||
|
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||||
|
$$.basicType = EbtFloat16;
|
||||||
|
$$.setMatrix(3, 3);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
| F16MAT3X4 {
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
|
||||||
|
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||||
|
$$.basicType = EbtFloat16;
|
||||||
|
$$.setMatrix(3, 4);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
| F16MAT4X2 {
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
|
||||||
|
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||||
|
$$.basicType = EbtFloat16;
|
||||||
|
$$.setMatrix(4, 2);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
| F16MAT4X3 {
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
|
||||||
|
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||||
|
$$.basicType = EbtFloat16;
|
||||||
|
$$.setMatrix(4, 3);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
| F16MAT4X4 {
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
|
||||||
|
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||||
|
$$.basicType = EbtFloat16;
|
||||||
|
$$.setMatrix(4, 4);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
| ATOMIC_UINT {
|
| ATOMIC_UINT {
|
||||||
parseContext.vulkanRemoved($1.loc, "atomic counter types");
|
parseContext.vulkanRemoved($1.loc, "atomic counter types");
|
||||||
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,19 +1,19 @@
|
|||||||
/* A Bison parser, made by GNU Bison 3.0.4. */
|
/* A Bison parser, made by GNU Bison 2.7. */
|
||||||
|
|
||||||
/* Bison interface for Yacc-like parsers in C
|
/* Bison interface for Yacc-like parsers in C
|
||||||
|
|
||||||
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
|
Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
@ -26,13 +26,13 @@
|
|||||||
special exception, which will cause the skeleton and the resulting
|
special exception, which will cause the skeleton and the resulting
|
||||||
Bison output files to be licensed under the GNU General Public
|
Bison output files to be licensed under the GNU General Public
|
||||||
License without this special exception.
|
License without this special exception.
|
||||||
|
|
||||||
This special exception was added by the Free Software Foundation in
|
This special exception was added by the Free Software Foundation in
|
||||||
version 2.2 of Bison. */
|
version 2.2 of Bison. */
|
||||||
|
|
||||||
#ifndef YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED
|
#ifndef YY_YY_GLSLANG_TAB_CPP_H_INCLUDED
|
||||||
# define YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED
|
# define YY_YY_GLSLANG_TAB_CPP_H_INCLUDED
|
||||||
/* Debug traces. */
|
/* Enabling traces. */
|
||||||
#ifndef YYDEBUG
|
#ifndef YYDEBUG
|
||||||
# define YYDEBUG 1
|
# define YYDEBUG 1
|
||||||
#endif
|
#endif
|
||||||
@ -40,288 +40,306 @@
|
|||||||
extern int yydebug;
|
extern int yydebug;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Token type. */
|
/* Tokens. */
|
||||||
#ifndef YYTOKENTYPE
|
#ifndef YYTOKENTYPE
|
||||||
# define YYTOKENTYPE
|
# define YYTOKENTYPE
|
||||||
enum yytokentype
|
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
||||||
{
|
know about them. */
|
||||||
ATTRIBUTE = 258,
|
enum yytokentype {
|
||||||
VARYING = 259,
|
ATTRIBUTE = 258,
|
||||||
CONST = 260,
|
VARYING = 259,
|
||||||
BOOL = 261,
|
CONST = 260,
|
||||||
FLOAT = 262,
|
BOOL = 261,
|
||||||
DOUBLE = 263,
|
FLOAT = 262,
|
||||||
INT = 264,
|
DOUBLE = 263,
|
||||||
UINT = 265,
|
INT = 264,
|
||||||
INT64_T = 266,
|
UINT = 265,
|
||||||
UINT64_T = 267,
|
INT64_T = 266,
|
||||||
BREAK = 268,
|
UINT64_T = 267,
|
||||||
CONTINUE = 269,
|
FLOAT16_T = 268,
|
||||||
DO = 270,
|
BREAK = 269,
|
||||||
ELSE = 271,
|
CONTINUE = 270,
|
||||||
FOR = 272,
|
DO = 271,
|
||||||
IF = 273,
|
ELSE = 272,
|
||||||
DISCARD = 274,
|
FOR = 273,
|
||||||
RETURN = 275,
|
IF = 274,
|
||||||
SWITCH = 276,
|
DISCARD = 275,
|
||||||
CASE = 277,
|
RETURN = 276,
|
||||||
DEFAULT = 278,
|
SWITCH = 277,
|
||||||
SUBROUTINE = 279,
|
CASE = 278,
|
||||||
BVEC2 = 280,
|
DEFAULT = 279,
|
||||||
BVEC3 = 281,
|
SUBROUTINE = 280,
|
||||||
BVEC4 = 282,
|
BVEC2 = 281,
|
||||||
IVEC2 = 283,
|
BVEC3 = 282,
|
||||||
IVEC3 = 284,
|
BVEC4 = 283,
|
||||||
IVEC4 = 285,
|
IVEC2 = 284,
|
||||||
I64VEC2 = 286,
|
IVEC3 = 285,
|
||||||
I64VEC3 = 287,
|
IVEC4 = 286,
|
||||||
I64VEC4 = 288,
|
I64VEC2 = 287,
|
||||||
UVEC2 = 289,
|
I64VEC3 = 288,
|
||||||
UVEC3 = 290,
|
I64VEC4 = 289,
|
||||||
UVEC4 = 291,
|
UVEC2 = 290,
|
||||||
U64VEC2 = 292,
|
UVEC3 = 291,
|
||||||
U64VEC3 = 293,
|
UVEC4 = 292,
|
||||||
U64VEC4 = 294,
|
U64VEC2 = 293,
|
||||||
VEC2 = 295,
|
U64VEC3 = 294,
|
||||||
VEC3 = 296,
|
U64VEC4 = 295,
|
||||||
VEC4 = 297,
|
VEC2 = 296,
|
||||||
MAT2 = 298,
|
VEC3 = 297,
|
||||||
MAT3 = 299,
|
VEC4 = 298,
|
||||||
MAT4 = 300,
|
MAT2 = 299,
|
||||||
CENTROID = 301,
|
MAT3 = 300,
|
||||||
IN = 302,
|
MAT4 = 301,
|
||||||
OUT = 303,
|
CENTROID = 302,
|
||||||
INOUT = 304,
|
IN = 303,
|
||||||
UNIFORM = 305,
|
OUT = 304,
|
||||||
PATCH = 306,
|
INOUT = 305,
|
||||||
SAMPLE = 307,
|
UNIFORM = 306,
|
||||||
BUFFER = 308,
|
PATCH = 307,
|
||||||
SHARED = 309,
|
SAMPLE = 308,
|
||||||
COHERENT = 310,
|
BUFFER = 309,
|
||||||
VOLATILE = 311,
|
SHARED = 310,
|
||||||
RESTRICT = 312,
|
COHERENT = 311,
|
||||||
READONLY = 313,
|
VOLATILE = 312,
|
||||||
WRITEONLY = 314,
|
RESTRICT = 313,
|
||||||
DVEC2 = 315,
|
READONLY = 314,
|
||||||
DVEC3 = 316,
|
WRITEONLY = 315,
|
||||||
DVEC4 = 317,
|
DVEC2 = 316,
|
||||||
DMAT2 = 318,
|
DVEC3 = 317,
|
||||||
DMAT3 = 319,
|
DVEC4 = 318,
|
||||||
DMAT4 = 320,
|
DMAT2 = 319,
|
||||||
NOPERSPECTIVE = 321,
|
DMAT3 = 320,
|
||||||
FLAT = 322,
|
DMAT4 = 321,
|
||||||
SMOOTH = 323,
|
F16VEC2 = 322,
|
||||||
LAYOUT = 324,
|
F16VEC3 = 323,
|
||||||
__EXPLICITINTERPAMD = 325,
|
F16VEC4 = 324,
|
||||||
MAT2X2 = 326,
|
F16MAT2 = 325,
|
||||||
MAT2X3 = 327,
|
F16MAT3 = 326,
|
||||||
MAT2X4 = 328,
|
F16MAT4 = 327,
|
||||||
MAT3X2 = 329,
|
NOPERSPECTIVE = 328,
|
||||||
MAT3X3 = 330,
|
FLAT = 329,
|
||||||
MAT3X4 = 331,
|
SMOOTH = 330,
|
||||||
MAT4X2 = 332,
|
LAYOUT = 331,
|
||||||
MAT4X3 = 333,
|
__EXPLICITINTERPAMD = 332,
|
||||||
MAT4X4 = 334,
|
MAT2X2 = 333,
|
||||||
DMAT2X2 = 335,
|
MAT2X3 = 334,
|
||||||
DMAT2X3 = 336,
|
MAT2X4 = 335,
|
||||||
DMAT2X4 = 337,
|
MAT3X2 = 336,
|
||||||
DMAT3X2 = 338,
|
MAT3X3 = 337,
|
||||||
DMAT3X3 = 339,
|
MAT3X4 = 338,
|
||||||
DMAT3X4 = 340,
|
MAT4X2 = 339,
|
||||||
DMAT4X2 = 341,
|
MAT4X3 = 340,
|
||||||
DMAT4X3 = 342,
|
MAT4X4 = 341,
|
||||||
DMAT4X4 = 343,
|
DMAT2X2 = 342,
|
||||||
ATOMIC_UINT = 344,
|
DMAT2X3 = 343,
|
||||||
SAMPLER1D = 345,
|
DMAT2X4 = 344,
|
||||||
SAMPLER2D = 346,
|
DMAT3X2 = 345,
|
||||||
SAMPLER3D = 347,
|
DMAT3X3 = 346,
|
||||||
SAMPLERCUBE = 348,
|
DMAT3X4 = 347,
|
||||||
SAMPLER1DSHADOW = 349,
|
DMAT4X2 = 348,
|
||||||
SAMPLER2DSHADOW = 350,
|
DMAT4X3 = 349,
|
||||||
SAMPLERCUBESHADOW = 351,
|
DMAT4X4 = 350,
|
||||||
SAMPLER1DARRAY = 352,
|
F16MAT2X2 = 351,
|
||||||
SAMPLER2DARRAY = 353,
|
F16MAT2X3 = 352,
|
||||||
SAMPLER1DARRAYSHADOW = 354,
|
F16MAT2X4 = 353,
|
||||||
SAMPLER2DARRAYSHADOW = 355,
|
F16MAT3X2 = 354,
|
||||||
ISAMPLER1D = 356,
|
F16MAT3X3 = 355,
|
||||||
ISAMPLER2D = 357,
|
F16MAT3X4 = 356,
|
||||||
ISAMPLER3D = 358,
|
F16MAT4X2 = 357,
|
||||||
ISAMPLERCUBE = 359,
|
F16MAT4X3 = 358,
|
||||||
ISAMPLER1DARRAY = 360,
|
F16MAT4X4 = 359,
|
||||||
ISAMPLER2DARRAY = 361,
|
ATOMIC_UINT = 360,
|
||||||
USAMPLER1D = 362,
|
SAMPLER1D = 361,
|
||||||
USAMPLER2D = 363,
|
SAMPLER2D = 362,
|
||||||
USAMPLER3D = 364,
|
SAMPLER3D = 363,
|
||||||
USAMPLERCUBE = 365,
|
SAMPLERCUBE = 364,
|
||||||
USAMPLER1DARRAY = 366,
|
SAMPLER1DSHADOW = 365,
|
||||||
USAMPLER2DARRAY = 367,
|
SAMPLER2DSHADOW = 366,
|
||||||
SAMPLER2DRECT = 368,
|
SAMPLERCUBESHADOW = 367,
|
||||||
SAMPLER2DRECTSHADOW = 369,
|
SAMPLER1DARRAY = 368,
|
||||||
ISAMPLER2DRECT = 370,
|
SAMPLER2DARRAY = 369,
|
||||||
USAMPLER2DRECT = 371,
|
SAMPLER1DARRAYSHADOW = 370,
|
||||||
SAMPLERBUFFER = 372,
|
SAMPLER2DARRAYSHADOW = 371,
|
||||||
ISAMPLERBUFFER = 373,
|
ISAMPLER1D = 372,
|
||||||
USAMPLERBUFFER = 374,
|
ISAMPLER2D = 373,
|
||||||
SAMPLERCUBEARRAY = 375,
|
ISAMPLER3D = 374,
|
||||||
SAMPLERCUBEARRAYSHADOW = 376,
|
ISAMPLERCUBE = 375,
|
||||||
ISAMPLERCUBEARRAY = 377,
|
ISAMPLER1DARRAY = 376,
|
||||||
USAMPLERCUBEARRAY = 378,
|
ISAMPLER2DARRAY = 377,
|
||||||
SAMPLER2DMS = 379,
|
USAMPLER1D = 378,
|
||||||
ISAMPLER2DMS = 380,
|
USAMPLER2D = 379,
|
||||||
USAMPLER2DMS = 381,
|
USAMPLER3D = 380,
|
||||||
SAMPLER2DMSARRAY = 382,
|
USAMPLERCUBE = 381,
|
||||||
ISAMPLER2DMSARRAY = 383,
|
USAMPLER1DARRAY = 382,
|
||||||
USAMPLER2DMSARRAY = 384,
|
USAMPLER2DARRAY = 383,
|
||||||
SAMPLEREXTERNALOES = 385,
|
SAMPLER2DRECT = 384,
|
||||||
SAMPLER = 386,
|
SAMPLER2DRECTSHADOW = 385,
|
||||||
SAMPLERSHADOW = 387,
|
ISAMPLER2DRECT = 386,
|
||||||
TEXTURE1D = 388,
|
USAMPLER2DRECT = 387,
|
||||||
TEXTURE2D = 389,
|
SAMPLERBUFFER = 388,
|
||||||
TEXTURE3D = 390,
|
ISAMPLERBUFFER = 389,
|
||||||
TEXTURECUBE = 391,
|
USAMPLERBUFFER = 390,
|
||||||
TEXTURE1DARRAY = 392,
|
SAMPLERCUBEARRAY = 391,
|
||||||
TEXTURE2DARRAY = 393,
|
SAMPLERCUBEARRAYSHADOW = 392,
|
||||||
ITEXTURE1D = 394,
|
ISAMPLERCUBEARRAY = 393,
|
||||||
ITEXTURE2D = 395,
|
USAMPLERCUBEARRAY = 394,
|
||||||
ITEXTURE3D = 396,
|
SAMPLER2DMS = 395,
|
||||||
ITEXTURECUBE = 397,
|
ISAMPLER2DMS = 396,
|
||||||
ITEXTURE1DARRAY = 398,
|
USAMPLER2DMS = 397,
|
||||||
ITEXTURE2DARRAY = 399,
|
SAMPLER2DMSARRAY = 398,
|
||||||
UTEXTURE1D = 400,
|
ISAMPLER2DMSARRAY = 399,
|
||||||
UTEXTURE2D = 401,
|
USAMPLER2DMSARRAY = 400,
|
||||||
UTEXTURE3D = 402,
|
SAMPLEREXTERNALOES = 401,
|
||||||
UTEXTURECUBE = 403,
|
SAMPLER = 402,
|
||||||
UTEXTURE1DARRAY = 404,
|
SAMPLERSHADOW = 403,
|
||||||
UTEXTURE2DARRAY = 405,
|
TEXTURE1D = 404,
|
||||||
TEXTURE2DRECT = 406,
|
TEXTURE2D = 405,
|
||||||
ITEXTURE2DRECT = 407,
|
TEXTURE3D = 406,
|
||||||
UTEXTURE2DRECT = 408,
|
TEXTURECUBE = 407,
|
||||||
TEXTUREBUFFER = 409,
|
TEXTURE1DARRAY = 408,
|
||||||
ITEXTUREBUFFER = 410,
|
TEXTURE2DARRAY = 409,
|
||||||
UTEXTUREBUFFER = 411,
|
ITEXTURE1D = 410,
|
||||||
TEXTURECUBEARRAY = 412,
|
ITEXTURE2D = 411,
|
||||||
ITEXTURECUBEARRAY = 413,
|
ITEXTURE3D = 412,
|
||||||
UTEXTURECUBEARRAY = 414,
|
ITEXTURECUBE = 413,
|
||||||
TEXTURE2DMS = 415,
|
ITEXTURE1DARRAY = 414,
|
||||||
ITEXTURE2DMS = 416,
|
ITEXTURE2DARRAY = 415,
|
||||||
UTEXTURE2DMS = 417,
|
UTEXTURE1D = 416,
|
||||||
TEXTURE2DMSARRAY = 418,
|
UTEXTURE2D = 417,
|
||||||
ITEXTURE2DMSARRAY = 419,
|
UTEXTURE3D = 418,
|
||||||
UTEXTURE2DMSARRAY = 420,
|
UTEXTURECUBE = 419,
|
||||||
SUBPASSINPUT = 421,
|
UTEXTURE1DARRAY = 420,
|
||||||
SUBPASSINPUTMS = 422,
|
UTEXTURE2DARRAY = 421,
|
||||||
ISUBPASSINPUT = 423,
|
TEXTURE2DRECT = 422,
|
||||||
ISUBPASSINPUTMS = 424,
|
ITEXTURE2DRECT = 423,
|
||||||
USUBPASSINPUT = 425,
|
UTEXTURE2DRECT = 424,
|
||||||
USUBPASSINPUTMS = 426,
|
TEXTUREBUFFER = 425,
|
||||||
IMAGE1D = 427,
|
ITEXTUREBUFFER = 426,
|
||||||
IIMAGE1D = 428,
|
UTEXTUREBUFFER = 427,
|
||||||
UIMAGE1D = 429,
|
TEXTURECUBEARRAY = 428,
|
||||||
IMAGE2D = 430,
|
ITEXTURECUBEARRAY = 429,
|
||||||
IIMAGE2D = 431,
|
UTEXTURECUBEARRAY = 430,
|
||||||
UIMAGE2D = 432,
|
TEXTURE2DMS = 431,
|
||||||
IMAGE3D = 433,
|
ITEXTURE2DMS = 432,
|
||||||
IIMAGE3D = 434,
|
UTEXTURE2DMS = 433,
|
||||||
UIMAGE3D = 435,
|
TEXTURE2DMSARRAY = 434,
|
||||||
IMAGE2DRECT = 436,
|
ITEXTURE2DMSARRAY = 435,
|
||||||
IIMAGE2DRECT = 437,
|
UTEXTURE2DMSARRAY = 436,
|
||||||
UIMAGE2DRECT = 438,
|
SUBPASSINPUT = 437,
|
||||||
IMAGECUBE = 439,
|
SUBPASSINPUTMS = 438,
|
||||||
IIMAGECUBE = 440,
|
ISUBPASSINPUT = 439,
|
||||||
UIMAGECUBE = 441,
|
ISUBPASSINPUTMS = 440,
|
||||||
IMAGEBUFFER = 442,
|
USUBPASSINPUT = 441,
|
||||||
IIMAGEBUFFER = 443,
|
USUBPASSINPUTMS = 442,
|
||||||
UIMAGEBUFFER = 444,
|
IMAGE1D = 443,
|
||||||
IMAGE1DARRAY = 445,
|
IIMAGE1D = 444,
|
||||||
IIMAGE1DARRAY = 446,
|
UIMAGE1D = 445,
|
||||||
UIMAGE1DARRAY = 447,
|
IMAGE2D = 446,
|
||||||
IMAGE2DARRAY = 448,
|
IIMAGE2D = 447,
|
||||||
IIMAGE2DARRAY = 449,
|
UIMAGE2D = 448,
|
||||||
UIMAGE2DARRAY = 450,
|
IMAGE3D = 449,
|
||||||
IMAGECUBEARRAY = 451,
|
IIMAGE3D = 450,
|
||||||
IIMAGECUBEARRAY = 452,
|
UIMAGE3D = 451,
|
||||||
UIMAGECUBEARRAY = 453,
|
IMAGE2DRECT = 452,
|
||||||
IMAGE2DMS = 454,
|
IIMAGE2DRECT = 453,
|
||||||
IIMAGE2DMS = 455,
|
UIMAGE2DRECT = 454,
|
||||||
UIMAGE2DMS = 456,
|
IMAGECUBE = 455,
|
||||||
IMAGE2DMSARRAY = 457,
|
IIMAGECUBE = 456,
|
||||||
IIMAGE2DMSARRAY = 458,
|
UIMAGECUBE = 457,
|
||||||
UIMAGE2DMSARRAY = 459,
|
IMAGEBUFFER = 458,
|
||||||
STRUCT = 460,
|
IIMAGEBUFFER = 459,
|
||||||
VOID = 461,
|
UIMAGEBUFFER = 460,
|
||||||
WHILE = 462,
|
IMAGE1DARRAY = 461,
|
||||||
IDENTIFIER = 463,
|
IIMAGE1DARRAY = 462,
|
||||||
TYPE_NAME = 464,
|
UIMAGE1DARRAY = 463,
|
||||||
FLOATCONSTANT = 465,
|
IMAGE2DARRAY = 464,
|
||||||
DOUBLECONSTANT = 466,
|
IIMAGE2DARRAY = 465,
|
||||||
INTCONSTANT = 467,
|
UIMAGE2DARRAY = 466,
|
||||||
UINTCONSTANT = 468,
|
IMAGECUBEARRAY = 467,
|
||||||
INT64CONSTANT = 469,
|
IIMAGECUBEARRAY = 468,
|
||||||
UINT64CONSTANT = 470,
|
UIMAGECUBEARRAY = 469,
|
||||||
BOOLCONSTANT = 471,
|
IMAGE2DMS = 470,
|
||||||
LEFT_OP = 472,
|
IIMAGE2DMS = 471,
|
||||||
RIGHT_OP = 473,
|
UIMAGE2DMS = 472,
|
||||||
INC_OP = 474,
|
IMAGE2DMSARRAY = 473,
|
||||||
DEC_OP = 475,
|
IIMAGE2DMSARRAY = 474,
|
||||||
LE_OP = 476,
|
UIMAGE2DMSARRAY = 475,
|
||||||
GE_OP = 477,
|
STRUCT = 476,
|
||||||
EQ_OP = 478,
|
VOID = 477,
|
||||||
NE_OP = 479,
|
WHILE = 478,
|
||||||
AND_OP = 480,
|
IDENTIFIER = 479,
|
||||||
OR_OP = 481,
|
TYPE_NAME = 480,
|
||||||
XOR_OP = 482,
|
FLOATCONSTANT = 481,
|
||||||
MUL_ASSIGN = 483,
|
DOUBLECONSTANT = 482,
|
||||||
DIV_ASSIGN = 484,
|
INTCONSTANT = 483,
|
||||||
ADD_ASSIGN = 485,
|
UINTCONSTANT = 484,
|
||||||
MOD_ASSIGN = 486,
|
INT64CONSTANT = 485,
|
||||||
LEFT_ASSIGN = 487,
|
UINT64CONSTANT = 486,
|
||||||
RIGHT_ASSIGN = 488,
|
BOOLCONSTANT = 487,
|
||||||
AND_ASSIGN = 489,
|
FLOAT16CONSTANT = 488,
|
||||||
XOR_ASSIGN = 490,
|
LEFT_OP = 489,
|
||||||
OR_ASSIGN = 491,
|
RIGHT_OP = 490,
|
||||||
SUB_ASSIGN = 492,
|
INC_OP = 491,
|
||||||
LEFT_PAREN = 493,
|
DEC_OP = 492,
|
||||||
RIGHT_PAREN = 494,
|
LE_OP = 493,
|
||||||
LEFT_BRACKET = 495,
|
GE_OP = 494,
|
||||||
RIGHT_BRACKET = 496,
|
EQ_OP = 495,
|
||||||
LEFT_BRACE = 497,
|
NE_OP = 496,
|
||||||
RIGHT_BRACE = 498,
|
AND_OP = 497,
|
||||||
DOT = 499,
|
OR_OP = 498,
|
||||||
COMMA = 500,
|
XOR_OP = 499,
|
||||||
COLON = 501,
|
MUL_ASSIGN = 500,
|
||||||
EQUAL = 502,
|
DIV_ASSIGN = 501,
|
||||||
SEMICOLON = 503,
|
ADD_ASSIGN = 502,
|
||||||
BANG = 504,
|
MOD_ASSIGN = 503,
|
||||||
DASH = 505,
|
LEFT_ASSIGN = 504,
|
||||||
TILDE = 506,
|
RIGHT_ASSIGN = 505,
|
||||||
PLUS = 507,
|
AND_ASSIGN = 506,
|
||||||
STAR = 508,
|
XOR_ASSIGN = 507,
|
||||||
SLASH = 509,
|
OR_ASSIGN = 508,
|
||||||
PERCENT = 510,
|
SUB_ASSIGN = 509,
|
||||||
LEFT_ANGLE = 511,
|
LEFT_PAREN = 510,
|
||||||
RIGHT_ANGLE = 512,
|
RIGHT_PAREN = 511,
|
||||||
VERTICAL_BAR = 513,
|
LEFT_BRACKET = 512,
|
||||||
CARET = 514,
|
RIGHT_BRACKET = 513,
|
||||||
AMPERSAND = 515,
|
LEFT_BRACE = 514,
|
||||||
QUESTION = 516,
|
RIGHT_BRACE = 515,
|
||||||
INVARIANT = 517,
|
DOT = 516,
|
||||||
PRECISE = 518,
|
COMMA = 517,
|
||||||
HIGH_PRECISION = 519,
|
COLON = 518,
|
||||||
MEDIUM_PRECISION = 520,
|
EQUAL = 519,
|
||||||
LOW_PRECISION = 521,
|
SEMICOLON = 520,
|
||||||
PRECISION = 522,
|
BANG = 521,
|
||||||
PACKED = 523,
|
DASH = 522,
|
||||||
RESOURCE = 524,
|
TILDE = 523,
|
||||||
SUPERP = 525
|
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
|
||||||
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Value type. */
|
|
||||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
|
||||||
|
|
||||||
union YYSTYPE
|
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||||
|
typedef union YYSTYPE
|
||||||
{
|
{
|
||||||
#line 66 "MachineIndependent/glslang.y" /* yacc.c:1909 */
|
/* Line 2058 of yacc.c */
|
||||||
|
#line 66 "glslang.y"
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
glslang::TSourceLoc loc;
|
glslang::TSourceLoc loc;
|
||||||
@ -355,16 +373,28 @@ union YYSTYPE
|
|||||||
};
|
};
|
||||||
} interm;
|
} interm;
|
||||||
|
|
||||||
#line 359 "MachineIndependent/glslang_tab.cpp.h" /* yacc.c:1909 */
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef union YYSTYPE YYSTYPE;
|
/* Line 2058 of yacc.c */
|
||||||
|
#line 379 "glslang_tab.cpp.h"
|
||||||
|
} YYSTYPE;
|
||||||
# define YYSTYPE_IS_TRIVIAL 1
|
# define YYSTYPE_IS_TRIVIAL 1
|
||||||
|
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||||
# define YYSTYPE_IS_DECLARED 1
|
# define YYSTYPE_IS_DECLARED 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef YYPARSE_PARAM
|
||||||
|
#if defined __STDC__ || defined __cplusplus
|
||||||
|
int yyparse (void *YYPARSE_PARAM);
|
||||||
|
#else
|
||||||
|
int yyparse ();
|
||||||
|
#endif
|
||||||
|
#else /* ! YYPARSE_PARAM */
|
||||||
|
#if defined __STDC__ || defined __cplusplus
|
||||||
int yyparse (glslang::TParseContext* pParseContext);
|
int yyparse (glslang::TParseContext* pParseContext);
|
||||||
|
#else
|
||||||
|
int yyparse ();
|
||||||
|
#endif
|
||||||
|
#endif /* ! YYPARSE_PARAM */
|
||||||
|
|
||||||
#endif /* !YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED */
|
#endif /* !YY_YY_GLSLANG_TAB_CPP_H_INCLUDED */
|
||||||
|
@ -304,6 +304,11 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
|
|||||||
case EOpPackUint2x32: out.debug << "packUint2x32"; break;
|
case EOpPackUint2x32: out.debug << "packUint2x32"; break;
|
||||||
case EOpUnpackUint2x32: out.debug << "unpackUint2x32"; break;
|
case EOpUnpackUint2x32: out.debug << "unpackUint2x32"; break;
|
||||||
|
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EOpPackFloat2x16: out.debug << "packFloat2x16"; break;
|
||||||
|
case EOpUnpackFloat2x16: out.debug << "unpackFloat2x16"; break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case EOpLength: out.debug << "length"; break;
|
case EOpLength: out.debug << "length"; break;
|
||||||
case EOpNormalize: out.debug << "normalize"; break;
|
case EOpNormalize: out.debug << "normalize"; break;
|
||||||
case EOpDPdx: out.debug << "dPdx"; break;
|
case EOpDPdx: out.debug << "dPdx"; break;
|
||||||
@ -373,6 +378,21 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
|
|||||||
|
|
||||||
case EOpCubeFaceIndex: out.debug << "cubeFaceIndex"; break;
|
case EOpCubeFaceIndex: out.debug << "cubeFaceIndex"; break;
|
||||||
case EOpCubeFaceCoord: out.debug << "cubeFaceCoord"; break;
|
case EOpCubeFaceCoord: out.debug << "cubeFaceCoord"; break;
|
||||||
|
|
||||||
|
case EOpConvBoolToFloat16: out.debug << "Convert bool to float16"; break;
|
||||||
|
case EOpConvIntToFloat16: out.debug << "Convert int to float16"; break;
|
||||||
|
case EOpConvUintToFloat16: out.debug << "Convert uint to float16"; break;
|
||||||
|
case EOpConvFloatToFloat16: out.debug << "Convert float to float16"; break;
|
||||||
|
case EOpConvDoubleToFloat16: out.debug << "Convert double to float16"; break;
|
||||||
|
case EOpConvInt64ToFloat16: out.debug << "Convert int64 to float16"; break;
|
||||||
|
case EOpConvUint64ToFloat16: out.debug << "Convert uint64 to float16"; break;
|
||||||
|
case EOpConvFloat16ToBool: out.debug << "Convert float16 to bool"; break;
|
||||||
|
case EOpConvFloat16ToInt: out.debug << "Convert float16 to int"; break;
|
||||||
|
case EOpConvFloat16ToUint: out.debug << "Convert float16 to uint"; break;
|
||||||
|
case EOpConvFloat16ToFloat: out.debug << "Convert float16 to float"; break;
|
||||||
|
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;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
default: out.debug.message(EPrefixError, "Bad unary op");
|
default: out.debug.message(EPrefixError, "Bad unary op");
|
||||||
@ -447,6 +467,21 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
|
|||||||
case EOpConstructDMat4x2: out.debug << "Construct dmat4x2"; break;
|
case EOpConstructDMat4x2: out.debug << "Construct dmat4x2"; break;
|
||||||
case EOpConstructDMat4x3: out.debug << "Construct dmat4x3"; break;
|
case EOpConstructDMat4x3: out.debug << "Construct dmat4x3"; break;
|
||||||
case EOpConstructDMat4x4: out.debug << "Construct dmat4"; break;
|
case EOpConstructDMat4x4: out.debug << "Construct dmat4"; break;
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EOpConstructFloat16: out.debug << "Construct float16_t"; break;
|
||||||
|
case EOpConstructF16Vec2: out.debug << "Construct f16vec2"; break;
|
||||||
|
case EOpConstructF16Vec3: out.debug << "Construct f16vec3"; break;
|
||||||
|
case EOpConstructF16Vec4: out.debug << "Construct f16vec4"; break;
|
||||||
|
case EOpConstructF16Mat2x2: out.debug << "Construct f16mat2"; break;
|
||||||
|
case EOpConstructF16Mat2x3: out.debug << "Construct f16mat2x3"; break;
|
||||||
|
case EOpConstructF16Mat2x4: out.debug << "Construct f16mat2x4"; break;
|
||||||
|
case EOpConstructF16Mat3x2: out.debug << "Construct f16mat3x2"; break;
|
||||||
|
case EOpConstructF16Mat3x3: out.debug << "Construct f16mat3"; break;
|
||||||
|
case EOpConstructF16Mat3x4: out.debug << "Construct f16mat3x4"; break;
|
||||||
|
case EOpConstructF16Mat4x2: out.debug << "Construct f16mat4x2"; break;
|
||||||
|
case EOpConstructF16Mat4x3: out.debug << "Construct f16mat4x3"; break;
|
||||||
|
case EOpConstructF16Mat4x4: out.debug << "Construct f16mat4"; break;
|
||||||
|
#endif
|
||||||
case EOpConstructStruct: out.debug << "Construct structure"; break;
|
case EOpConstructStruct: out.debug << "Construct structure"; break;
|
||||||
case EOpConstructTextureSampler: out.debug << "Construct combined texture-sampler"; break;
|
case EOpConstructTextureSampler: out.debug << "Construct combined texture-sampler"; break;
|
||||||
|
|
||||||
@ -636,6 +671,9 @@ static void OutputConstantUnion(TInfoSink& out, const TIntermTyped* node, const
|
|||||||
break;
|
break;
|
||||||
case EbtFloat:
|
case EbtFloat:
|
||||||
case EbtDouble:
|
case EbtDouble:
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EbtFloat16:
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
const double value = constUnion[i].getDConst();
|
const double value = constUnion[i].getDConst();
|
||||||
// Print infinity in a portable way, for test stability.
|
// Print infinity in a portable way, for test stability.
|
||||||
|
@ -950,6 +950,9 @@ int TIntermediate::getBaseAlignmentScalar(const TType& type, int& size)
|
|||||||
case EbtInt64:
|
case EbtInt64:
|
||||||
case EbtUint64:
|
case EbtUint64:
|
||||||
case EbtDouble: size = 8; return 8;
|
case EbtDouble: size = 8; return 8;
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EbtFloat16: size = 2; return 2;
|
||||||
|
#endif
|
||||||
default: size = 4; return 4;
|
default: size = 4; return 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,6 +76,9 @@ public:
|
|||||||
virtual void updateExtensionBehavior(int line, const char* const extension, const char* behavior);
|
virtual void updateExtensionBehavior(int line, const char* const extension, const char* behavior);
|
||||||
virtual void fullIntegerCheck(const TSourceLoc&, const char* op);
|
virtual void fullIntegerCheck(const TSourceLoc&, const char* op);
|
||||||
virtual void doubleCheck(const TSourceLoc&, const char* op);
|
virtual void doubleCheck(const TSourceLoc&, const char* op);
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
virtual void float16Check(const TSourceLoc&, const char* op, bool builtIn = false);
|
||||||
|
#endif
|
||||||
virtual void int64Check(const TSourceLoc&, const char* op, bool builtIn = false);
|
virtual void int64Check(const TSourceLoc&, const char* op, bool builtIn = false);
|
||||||
virtual void spvRemoved(const TSourceLoc&, const char* op);
|
virtual void spvRemoved(const TSourceLoc&, const char* op);
|
||||||
virtual void vulkanRemoved(const TSourceLoc&, const char* op);
|
virtual void vulkanRemoved(const TSourceLoc&, const char* op);
|
||||||
|
@ -705,6 +705,9 @@ int TPpContext::CPPerror(TPpToken* ppToken)
|
|||||||
while (token != '\n' && token != EndOfInput) {
|
while (token != '\n' && token != EndOfInput) {
|
||||||
if (token == PpAtomConstInt || token == PpAtomConstUint ||
|
if (token == PpAtomConstInt || token == PpAtomConstUint ||
|
||||||
token == PpAtomConstInt64 || token == PpAtomConstUint64 ||
|
token == PpAtomConstInt64 || token == PpAtomConstUint64 ||
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
token == PpAtomConstFloat16 ||
|
||||||
|
#endif
|
||||||
token == PpAtomConstFloat || token == PpAtomConstDouble) {
|
token == PpAtomConstFloat || token == PpAtomConstDouble) {
|
||||||
message.append(ppToken->name);
|
message.append(ppToken->name);
|
||||||
} else if (token == PpAtomIdentifier || token == PpAtomConstString) {
|
} else if (token == PpAtomIdentifier || token == PpAtomConstString) {
|
||||||
@ -739,6 +742,9 @@ int TPpContext::CPPpragma(TPpToken* ppToken)
|
|||||||
case PpAtomConstUint64:
|
case PpAtomConstUint64:
|
||||||
case PpAtomConstFloat:
|
case PpAtomConstFloat:
|
||||||
case PpAtomConstDouble:
|
case PpAtomConstDouble:
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case PpAtomConstFloat16:
|
||||||
|
#endif
|
||||||
tokens.push_back(ppToken->name);
|
tokens.push_back(ppToken->name);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -117,6 +117,10 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
|
|||||||
int declen;
|
int declen;
|
||||||
int str_len;
|
int str_len;
|
||||||
int isDouble = 0;
|
int isDouble = 0;
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
int isFloat16 = 0;
|
||||||
|
bool enableFloat16 = parseContext.version >= 450 && parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float);
|
||||||
|
#endif
|
||||||
|
|
||||||
declen = 0;
|
declen = 0;
|
||||||
|
|
||||||
@ -200,6 +204,28 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
|
|||||||
len = 1,str_len=1;
|
len = 1,str_len=1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
} else if (enableFloat16 && (ch == 'h' || ch == 'H')) {
|
||||||
|
parseContext.float16Check(ppToken->loc, "half floating-point suffix");
|
||||||
|
if (!HasDecimalOrExponent)
|
||||||
|
parseContext.ppError(ppToken->loc, "float literal needs a decimal point or exponent", "", "");
|
||||||
|
int ch2 = getChar();
|
||||||
|
if (ch2 != 'f' && ch2 != 'F') {
|
||||||
|
ungetChar();
|
||||||
|
ungetChar();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (len < MaxTokenLength) {
|
||||||
|
str[len++] = (char)ch;
|
||||||
|
str[len++] = (char)ch2;
|
||||||
|
isFloat16 = 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
parseContext.ppError(ppToken->loc, "float literal too long", "", "");
|
||||||
|
len = 1, str_len = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
} else if (ch == 'f' || ch == 'F') {
|
} else if (ch == 'f' || ch == 'F') {
|
||||||
parseContext.profileRequires(ppToken->loc, EEsProfile, 300, nullptr, "floating-point suffix");
|
parseContext.profileRequires(ppToken->loc, EEsProfile, 300, nullptr, "floating-point suffix");
|
||||||
if (! parseContext.relaxedErrors())
|
if (! parseContext.relaxedErrors())
|
||||||
@ -222,6 +248,10 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
|
|||||||
|
|
||||||
if (isDouble)
|
if (isDouble)
|
||||||
return PpAtomConstDouble;
|
return PpAtomConstDouble;
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
else if (isFloat16)
|
||||||
|
return PpAtomConstFloat16;
|
||||||
|
#endif
|
||||||
else
|
else
|
||||||
return PpAtomConstFloat;
|
return PpAtomConstFloat;
|
||||||
}
|
}
|
||||||
@ -744,6 +774,9 @@ const char* TPpContext::tokenize(TPpToken* ppToken)
|
|||||||
case PpAtomConstInt64:
|
case PpAtomConstInt64:
|
||||||
case PpAtomConstUint64:
|
case PpAtomConstUint64:
|
||||||
case PpAtomConstDouble:
|
case PpAtomConstDouble:
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case PpAtomConstFloat16:
|
||||||
|
#endif
|
||||||
tokenString = ppToken->name;
|
tokenString = ppToken->name;
|
||||||
break;
|
break;
|
||||||
case PpAtomConstString:
|
case PpAtomConstString:
|
||||||
|
@ -144,6 +144,9 @@ void TPpContext::RecordToken(TokenStream *pTok, int token, TPpToken* ppToken)
|
|||||||
case PpAtomConstUint64:
|
case PpAtomConstUint64:
|
||||||
case PpAtomConstFloat:
|
case PpAtomConstFloat:
|
||||||
case PpAtomConstDouble:
|
case PpAtomConstDouble:
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case PpAtomConstFloat16:
|
||||||
|
#endif
|
||||||
str = ppToken->name;
|
str = ppToken->name;
|
||||||
while (*str) {
|
while (*str) {
|
||||||
lAddByte(pTok, (unsigned char) *str);
|
lAddByte(pTok, (unsigned char) *str);
|
||||||
@ -195,6 +198,9 @@ int TPpContext::ReadToken(TokenStream *pTok, TPpToken *ppToken)
|
|||||||
case PpAtomIdentifier:
|
case PpAtomIdentifier:
|
||||||
case PpAtomConstFloat:
|
case PpAtomConstFloat:
|
||||||
case PpAtomConstDouble:
|
case PpAtomConstDouble:
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case PpAtomConstFloat16:
|
||||||
|
#endif
|
||||||
case PpAtomConstInt:
|
case PpAtomConstInt:
|
||||||
case PpAtomConstUint:
|
case PpAtomConstUint:
|
||||||
case PpAtomConstInt64:
|
case PpAtomConstInt64:
|
||||||
@ -221,6 +227,9 @@ int TPpContext::ReadToken(TokenStream *pTok, TPpToken *ppToken)
|
|||||||
break;
|
break;
|
||||||
case PpAtomConstFloat:
|
case PpAtomConstFloat:
|
||||||
case PpAtomConstDouble:
|
case PpAtomConstDouble:
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case PpAtomConstFloat16:
|
||||||
|
#endif
|
||||||
ppToken->dval = atof(ppToken->name);
|
ppToken->dval = atof(ppToken->name);
|
||||||
break;
|
break;
|
||||||
case PpAtomConstInt:
|
case PpAtomConstInt:
|
||||||
|
@ -123,6 +123,9 @@ enum EFixedAtoms {
|
|||||||
PpAtomConstUint64,
|
PpAtomConstUint64,
|
||||||
PpAtomConstFloat,
|
PpAtomConstFloat,
|
||||||
PpAtomConstDouble,
|
PpAtomConstDouble,
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
PpAtomConstFloat16,
|
||||||
|
#endif
|
||||||
PpAtomConstString,
|
PpAtomConstString,
|
||||||
|
|
||||||
// Identifiers
|
// Identifiers
|
||||||
|
@ -529,6 +529,9 @@ public:
|
|||||||
switch (type.getBasicType()) {
|
switch (type.getBasicType()) {
|
||||||
case EbtFloat: return GL_FLOAT_VEC2 + offset;
|
case EbtFloat: return GL_FLOAT_VEC2 + offset;
|
||||||
case EbtDouble: return GL_DOUBLE_VEC2 + offset;
|
case EbtDouble: return GL_DOUBLE_VEC2 + offset;
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EbtFloat16: return GL_FLOAT16_VEC2_NV + offset;
|
||||||
|
#endif
|
||||||
case EbtInt: return GL_INT_VEC2 + offset;
|
case EbtInt: return GL_INT_VEC2 + offset;
|
||||||
case EbtUint: return GL_UNSIGNED_INT_VEC2 + offset;
|
case EbtUint: return GL_UNSIGNED_INT_VEC2 + offset;
|
||||||
case EbtInt64: return GL_INT64_ARB + offset;
|
case EbtInt64: return GL_INT64_ARB + offset;
|
||||||
@ -588,6 +591,32 @@ public:
|
|||||||
default: return 0;
|
default: return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EbtFloat16:
|
||||||
|
switch (type.getMatrixCols()) {
|
||||||
|
case 2:
|
||||||
|
switch (type.getMatrixRows()) {
|
||||||
|
case 2: return GL_FLOAT16_MAT2_AMD;
|
||||||
|
case 3: return GL_FLOAT16_MAT2x3_AMD;
|
||||||
|
case 4: return GL_FLOAT16_MAT2x4_AMD;
|
||||||
|
default: return 0;
|
||||||
|
}
|
||||||
|
case 3:
|
||||||
|
switch (type.getMatrixRows()) {
|
||||||
|
case 2: return GL_FLOAT16_MAT3x2_AMD;
|
||||||
|
case 3: return GL_FLOAT16_MAT3_AMD;
|
||||||
|
case 4: return GL_FLOAT16_MAT3x4_AMD;
|
||||||
|
default: return 0;
|
||||||
|
}
|
||||||
|
case 4:
|
||||||
|
switch (type.getMatrixRows()) {
|
||||||
|
case 2: return GL_FLOAT16_MAT4x2_AMD;
|
||||||
|
case 3: return GL_FLOAT16_MAT4x3_AMD;
|
||||||
|
case 4: return GL_FLOAT16_MAT4_AMD;
|
||||||
|
default: return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -596,6 +625,9 @@ public:
|
|||||||
switch (type.getBasicType()) {
|
switch (type.getBasicType()) {
|
||||||
case EbtFloat: return GL_FLOAT;
|
case EbtFloat: return GL_FLOAT;
|
||||||
case EbtDouble: return GL_DOUBLE;
|
case EbtDouble: return GL_DOUBLE;
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
case EbtFloat16: return GL_FLOAT16_NV;
|
||||||
|
#endif
|
||||||
case EbtInt: return GL_INT;
|
case EbtInt: return GL_INT;
|
||||||
case EbtUint: return GL_UNSIGNED_INT;
|
case EbtUint: return GL_UNSIGNED_INT;
|
||||||
case EbtInt64: return GL_INT64_ARB;
|
case EbtInt64: return GL_INT64_ARB;
|
||||||
|
@ -14,6 +14,7 @@ if (TARGET gmock)
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/AST.FromFile.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/AST.FromFile.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/BuiltInResource.FromFile.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/BuiltInResource.FromFile.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/Config.FromFile.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/Config.FromFile.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/HexFloat.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/Hlsl.FromFile.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/Hlsl.FromFile.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/Link.FromFile.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/Link.FromFile.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/Pp.FromFile.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/Pp.FromFile.cpp
|
||||||
|
1232
gtests/HexFloat.cpp
Normal file
1232
gtests/HexFloat.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@ -67,6 +67,9 @@ using OpenGLSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
|
|||||||
using VulkanAstSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
|
using VulkanAstSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||||
using HlslIoMap = GlslangTest<::testing::TestWithParam<IoMapData>>;
|
using HlslIoMap = GlslangTest<::testing::TestWithParam<IoMapData>>;
|
||||||
using GlslIoMap = GlslangTest<::testing::TestWithParam<IoMapData>>;
|
using GlslIoMap = GlslangTest<::testing::TestWithParam<IoMapData>>;
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
using CompileVulkanToSpirvTestAMD = GlslangTest<::testing::TestWithParam<std::string>>;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Compiling GLSL to SPIR-V under Vulkan semantics. Expected to successfully
|
// Compiling GLSL to SPIR-V under Vulkan semantics. Expected to successfully
|
||||||
// generate SPIR-V.
|
// generate SPIR-V.
|
||||||
@ -138,6 +141,17 @@ TEST_P(GlslIoMap, FromFile)
|
|||||||
GetParam().flattenUniforms);
|
GetParam().flattenUniforms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
// Compiling GLSL to SPIR-V under Vulkan semantics (AMD extensions enabled).
|
||||||
|
// Expected to successfully generate SPIR-V.
|
||||||
|
TEST_P(CompileVulkanToSpirvTestAMD, FromFile)
|
||||||
|
{
|
||||||
|
loadFileCompileAndCheck(GLSLANG_TEST_DIRECTORY, GetParam(),
|
||||||
|
Source::GLSL, Semantics::Vulkan,
|
||||||
|
Target::Spv);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
INSTANTIATE_TEST_CASE_P(
|
INSTANTIATE_TEST_CASE_P(
|
||||||
Glsl, CompileVulkanToSpirvTest,
|
Glsl, CompileVulkanToSpirvTest,
|
||||||
@ -324,6 +338,16 @@ INSTANTIATE_TEST_CASE_P(
|
|||||||
})),
|
})),
|
||||||
FileNameAsCustomTestSuffix
|
FileNameAsCustomTestSuffix
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef AMD_EXTENSIONS
|
||||||
|
INSTANTIATE_TEST_CASE_P(
|
||||||
|
Glsl, CompileVulkanToSpirvTestAMD,
|
||||||
|
::testing::ValuesIn(std::vector<std::string>({
|
||||||
|
"spv.float16.frag",
|
||||||
|
})),
|
||||||
|
FileNameAsCustomTestSuffix
|
||||||
|
);
|
||||||
|
#endif
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
Loading…
Reference in New Issue
Block a user