Merge pull request #1266 from amdrexu/feature

Implement the extension GL_AMD_gpu_shader_half_float_fetch
This commit is contained in:
John Kessenich 2018-03-02 11:23:15 -07:00 committed by GitHub
commit 29c49e1089
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 13116 additions and 3119 deletions

View File

@ -27,13 +27,8 @@
#ifndef GLSLextAMD_H #ifndef GLSLextAMD_H
#define GLSLextAMD_H #define GLSLextAMD_H
enum BuiltIn;
enum Capability;
enum Decoration;
enum Op;
static const int GLSLextAMDVersion = 100; static const int GLSLextAMDVersion = 100;
static const int GLSLextAMDRevision = 6; static const int GLSLextAMDRevision = 7;
// 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";
@ -107,4 +102,10 @@ static const char* const E_SPV_AMD_shader_image_load_store_lod = "SPV_AMD_shader
// SPV_AMD_shader_fragment_mask // SPV_AMD_shader_fragment_mask
static const char* const E_SPV_AMD_shader_fragment_mask = "SPV_AMD_shader_fragment_mask"; static const char* const E_SPV_AMD_shader_fragment_mask = "SPV_AMD_shader_fragment_mask";
// SPV_AMD_gpu_shader_half_float_fetch
static const char* const E_SPV_AMD_gpu_shader_half_float_fetch = "SPV_AMD_gpu_shader_half_float_fetch";
enum Capability;
static const Capability CapabilityFloat16ImageAMD = static_cast<Capability>(5008);
#endif // #ifndef GLSLextAMD_H #endif // #ifndef GLSLextAMD_H

View File

@ -2340,6 +2340,12 @@ spv::Id TGlslangToSpvTraverser::getSampledType(const glslang::TSampler& sampler)
{ {
switch (sampler.type) { switch (sampler.type) {
case glslang::EbtFloat: return builder.makeFloatType(32); case glslang::EbtFloat: return builder.makeFloatType(32);
#ifdef AMD_EXTENSIONS
case glslang::EbtFloat16:
builder.addExtension(spv::E_SPV_AMD_gpu_shader_half_float_fetch);
builder.addCapability(spv::CapabilityFloat16ImageAMD);
return builder.makeFloatType(16);
#endif
case glslang::EbtInt: return builder.makeIntType(32); case glslang::EbtInt: return builder.makeIntType(32);
case glslang::EbtUint: return builder.makeUintType(32); case glslang::EbtUint: return builder.makeUintType(32);
default: default:
@ -3159,9 +3165,15 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate&
glslang::TSampler sampler = {}; glslang::TSampler sampler = {};
bool cubeCompare = false; bool cubeCompare = false;
#ifdef AMD_EXTENSIONS
bool f16ShadowCompare = false;
#endif
if (node.isTexture() || node.isImage()) { if (node.isTexture() || node.isImage()) {
sampler = glslangArguments[0]->getAsTyped()->getType().getSampler(); sampler = glslangArguments[0]->getAsTyped()->getType().getSampler();
cubeCompare = sampler.dim == glslang::EsdCube && sampler.arrayed && sampler.shadow; cubeCompare = sampler.dim == glslang::EsdCube && sampler.arrayed && sampler.shadow;
#ifdef AMD_EXTENSIONS
f16ShadowCompare = sampler.shadow && glslangArguments[1]->getAsTyped()->getType().getBasicType() == glslang::EbtFloat16;
#endif
} }
for (int i = 0; i < (int)glslangArguments.size(); ++i) { for (int i = 0; i < (int)glslangArguments.size(); ++i) {
@ -3186,6 +3198,21 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate&
if ((sampler.ms && i == 3) || (! sampler.ms && i == 2)) if ((sampler.ms && i == 3) || (! sampler.ms && i == 2))
lvalue = true; lvalue = true;
break; break;
#ifdef AMD_EXTENSIONS
case glslang::EOpSparseTexture:
if (((cubeCompare || f16ShadowCompare) && i == 3) || (! (cubeCompare || f16ShadowCompare) && i == 2))
lvalue = true;
break;
case glslang::EOpSparseTextureClamp:
if (((cubeCompare || f16ShadowCompare) && i == 4) || (! (cubeCompare || f16ShadowCompare) && i == 3))
lvalue = true;
break;
case glslang::EOpSparseTextureLod:
case glslang::EOpSparseTextureOffset:
if ((f16ShadowCompare && i == 4) || (! f16ShadowCompare && i == 3))
lvalue = true;
break;
#else
case glslang::EOpSparseTexture: case glslang::EOpSparseTexture:
if ((cubeCompare && i == 3) || (! cubeCompare && i == 2)) if ((cubeCompare && i == 3) || (! cubeCompare && i == 2))
lvalue = true; lvalue = true;
@ -3199,6 +3226,7 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate&
if (i == 3) if (i == 3)
lvalue = true; lvalue = true;
break; break;
#endif
case glslang::EOpSparseTextureFetch: case glslang::EOpSparseTextureFetch:
if ((sampler.dim != glslang::EsdRect && i == 3) || (sampler.dim == glslang::EsdRect && i == 2)) if ((sampler.dim != glslang::EsdRect && i == 3) || (sampler.dim == glslang::EsdRect && i == 2))
lvalue = true; lvalue = true;
@ -3207,6 +3235,23 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate&
if ((sampler.dim != glslang::EsdRect && i == 4) || (sampler.dim == glslang::EsdRect && i == 3)) if ((sampler.dim != glslang::EsdRect && i == 4) || (sampler.dim == glslang::EsdRect && i == 3))
lvalue = true; lvalue = true;
break; break;
#ifdef AMD_EXTENSIONS
case glslang::EOpSparseTextureLodOffset:
case glslang::EOpSparseTextureGrad:
case glslang::EOpSparseTextureOffsetClamp:
if ((f16ShadowCompare && i == 5) || (! f16ShadowCompare && i == 4))
lvalue = true;
break;
case glslang::EOpSparseTextureGradOffset:
case glslang::EOpSparseTextureGradClamp:
if ((f16ShadowCompare && i == 6) || (! f16ShadowCompare && i == 5))
lvalue = true;
break;
case glslang::EOpSparseTextureGradOffsetClamp:
if ((f16ShadowCompare && i == 7) || (! f16ShadowCompare && i == 6))
lvalue = true;
break;
#else
case glslang::EOpSparseTextureLodOffset: case glslang::EOpSparseTextureLodOffset:
case glslang::EOpSparseTextureGrad: case glslang::EOpSparseTextureGrad:
case glslang::EOpSparseTextureOffsetClamp: case glslang::EOpSparseTextureOffsetClamp:
@ -3222,6 +3267,7 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate&
if (i == 6) if (i == 6)
lvalue = true; lvalue = true;
break; break;
#endif
case glslang::EOpSparseTextureGather: case glslang::EOpSparseTextureGather:
if ((sampler.shadow && i == 3) || (! sampler.shadow && i == 2)) if ((sampler.shadow && i == 3) || (! sampler.shadow && i == 2))
lvalue = true; lvalue = true;
@ -3274,6 +3320,12 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
// Process a GLSL texturing op (will be SPV image) // Process a GLSL texturing op (will be SPV image)
const glslang::TSampler sampler = node->getAsAggregate() ? node->getAsAggregate()->getSequence()[0]->getAsTyped()->getType().getSampler() const glslang::TSampler sampler = node->getAsAggregate() ? node->getAsAggregate()->getSequence()[0]->getAsTyped()->getType().getSampler()
: node->getAsUnaryNode()->getOperand()->getAsTyped()->getType().getSampler(); : node->getAsUnaryNode()->getOperand()->getAsTyped()->getType().getSampler();
#ifdef AMD_EXTENSIONS
bool f16ShadowCompare = (sampler.shadow && node->getAsAggregate())
? node->getAsAggregate()->getSequence()[1]->getAsTyped()->getType().getBasicType() == glslang::EbtFloat16
: false;
#endif
std::vector<spv::Id> arguments; std::vector<spv::Id> arguments;
if (node->getAsAggregate()) if (node->getAsAggregate())
translateArguments(*node->getAsAggregate(), arguments); translateArguments(*node->getAsAggregate(), arguments);
@ -3517,6 +3569,9 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
#ifdef AMD_EXTENSIONS #ifdef AMD_EXTENSIONS
if (cracked.gather) if (cracked.gather)
++nonBiasArgCount; // comp argument should be present when bias argument is present ++nonBiasArgCount; // comp argument should be present when bias argument is present
if (f16ShadowCompare)
++nonBiasArgCount;
#endif #endif
if (cracked.offset) if (cracked.offset)
++nonBiasArgCount; ++nonBiasArgCount;
@ -3560,7 +3615,11 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
bool noImplicitLod = false; bool noImplicitLod = false;
// sort out where Dref is coming from // sort out where Dref is coming from
#ifdef AMD_EXTENSIONS
if (cubeCompare || f16ShadowCompare) {
#else
if (cubeCompare) { if (cubeCompare) {
#endif
params.Dref = arguments[2]; params.Dref = arguments[2];
++extraArgs; ++extraArgs;
} else if (sampler.shadow && cracked.gather) { } else if (sampler.shadow && cracked.gather) {

View File

@ -1751,7 +1751,11 @@ Id Builder::createTextureQueryCall(Op opCode, const TextureParameters& parameter
break; break;
} }
case OpImageQueryLod: case OpImageQueryLod:
#ifdef AMD_EXTENSIONS
resultType = makeVectorType(getScalarTypeId(getTypeId(parameters.coords)), 2);
#else
resultType = makeVectorType(makeFloatType(32), 2); resultType = makeVectorType(makeFloatType(32), 2);
#endif
break; break;
case OpImageQueryLevels: case OpImageQueryLevels:
case OpImageQuerySamples: case OpImageQuerySamples:

View File

@ -849,6 +849,7 @@ const char* CapabilityString(int info)
case 5013: return "StencilExportEXT"; case 5013: return "StencilExportEXT";
#ifdef AMD_EXTENSIONS #ifdef AMD_EXTENSIONS
case 5008: return "Float16ImageAMD";
case 5009: return "ImageGatherBiasLodAMD"; case 5009: return "ImageGatherBiasLodAMD";
case 5010: return "FragmentMaskAMD"; case 5010: return "FragmentMaskAMD";
case 5015: return "ImageReadWriteLodAMD"; case 5015: return "ImageReadWriteLodAMD";

View File

@ -52,7 +52,7 @@ ERROR: 0:209: 'assign' : cannot convert from ' const float' to ' temp 4-compone
ERROR: 0:212: 'sampler2DRect' : Reserved word. ERROR: 0:212: 'sampler2DRect' : Reserved word.
ERROR: 0:244: ':' : wrong operand types: no operation ':' exists that takes a left-hand operand of type ' global void' and a right operand of type ' const int' (or there is no acceptable conversion) ERROR: 0:244: ':' : wrong operand types: no operation ':' exists that takes a left-hand operand of type ' global void' and a right operand of type ' const int' (or there is no acceptable conversion)
ERROR: 0:245: ':' : wrong operand types: no operation ':' exists that takes a left-hand operand of type ' const int' and a right operand of type ' global void' (or there is no acceptable conversion) ERROR: 0:245: ':' : wrong operand types: no operation ':' exists that takes a left-hand operand of type ' const int' and a right operand of type ' global void' (or there is no acceptable conversion)
ERROR: 0:248: 'shader half float' : required extension not requested: GL_AMD_gpu_shader_half_float ERROR: 0:248: 'half floating-point suffix' : required extension not requested: GL_AMD_gpu_shader_half_float
ERROR: 0:248: 'half floating-point suffix' : not supported with this profile: none ERROR: 0:248: 'half floating-point suffix' : not supported with this profile: none
ERROR: 0:248: '' : syntax error, unexpected IDENTIFIER, expecting COMMA or SEMICOLON ERROR: 0:248: '' : syntax error, unexpected IDENTIFIER, expecting COMMA or SEMICOLON
ERROR: 56 compilation errors. No code generated. ERROR: 56 compilation errors. No code generated.

File diff suppressed because it is too large Load Diff

1273
Test/spv.float16Fetch.frag Normal file

File diff suppressed because it is too large Load Diff

View File

@ -205,6 +205,9 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
switch (type) { switch (type) {
case EbtFloat: break; case EbtFloat: break;
#ifdef AMD_EXTENSIONS
case EbtFloat16: s.append("f16"); break;
#endif
case EbtInt: s.append("i"); break; case EbtInt: s.append("i"); break;
case EbtUint: s.append("u"); break; case EbtUint: s.append("u"); break;
default: break; // some compilers want this default: break; // some compilers want this

View File

@ -82,7 +82,10 @@ TBuiltIns::TBuiltIns()
{ {
// Set up textual representations for making all the permutations // Set up textual representations for making all the permutations
// of texturing/imaging functions. // of texturing/imaging functions.
prefixes[EbtFloat] = ""; prefixes[EbtFloat] = "";
#ifdef AMD_EXTENSIONS
prefixes[EbtFloat16] = "f16";
#endif
prefixes[EbtInt] = "i"; prefixes[EbtInt] = "i";
prefixes[EbtUint] = "u"; prefixes[EbtUint] = "u";
postfixes[2] = "2"; postfixes[2] = "2";
@ -4059,8 +4062,11 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c
// In this function proper, enumerate the types, then calls the next set of functions // In this function proper, enumerate the types, then calls the next set of functions
// to enumerate all the uses for that type. // to enumerate all the uses for that type.
// //
#ifdef AMD_EXTENSIONS
TBasicType bTypes[4] = { EbtFloat, EbtFloat16, EbtInt, EbtUint };
#else
TBasicType bTypes[3] = { EbtFloat, EbtInt, EbtUint }; TBasicType bTypes[3] = { EbtFloat, EbtInt, EbtUint };
#endif
bool skipBuffer = (profile == EEsProfile && version < 310) || (profile != EEsProfile && version < 140); bool skipBuffer = (profile == EEsProfile && version < 310) || (profile != EEsProfile && version < 140);
bool skipCubeArrayed = (profile == EEsProfile && version < 310) || (profile != EEsProfile && version < 130); bool skipCubeArrayed = (profile == EEsProfile && version < 310) || (profile != EEsProfile && version < 130);
@ -4100,12 +4106,20 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c
continue; continue;
if (ms && arrayed && profile == EEsProfile && version < 310) if (ms && arrayed && profile == EEsProfile && version < 310)
continue; continue;
#ifdef AMD_EXTENSIONS
for (int bType = 0; bType < 4; ++bType) { // float, float16, int, uint results
if (shadow && bType > 1)
continue;
if (bTypes[bType] == EbtFloat16 && (profile == EEsProfile ||version < 450))
continue;
#else
for (int bType = 0; bType < 3; ++bType) { // float, int, uint results for (int bType = 0; bType < 3; ++bType) { // float, int, uint results
if (shadow && bType > 0) if (shadow && bType > 0)
continue; continue;
#endif
if (dim == EsdRect && version < 140 && bType > 0) if (dim == EsdRect && version < 140 && bType > 0)
continue; continue;
@ -4223,15 +4237,37 @@ void TBuiltIns::addQueryFunctions(TSampler sampler, const TString& typeName, int
// //
if (profile != EEsProfile && version >= 400 && ! sampler.image && sampler.dim != EsdRect && ! sampler.ms && sampler.dim != EsdBuffer) { if (profile != EEsProfile && version >= 400 && ! sampler.image && sampler.dim != EsdRect && ! sampler.ms && sampler.dim != EsdBuffer) {
stageBuiltins[EShLangFragment].append("vec2 textureQueryLod("); #ifdef AMD_EXTENSIONS
stageBuiltins[EShLangFragment].append(typeName); for (int f16TexAddr = 0; f16TexAddr < 2; ++f16TexAddr) {
if (dimMap[sampler.dim] == 1) if (f16TexAddr && sampler.type != EbtFloat16)
stageBuiltins[EShLangFragment].append(", float"); continue;
else { #endif
stageBuiltins[EShLangFragment].append(", vec"); stageBuiltins[EShLangFragment].append("vec2 textureQueryLod(");
stageBuiltins[EShLangFragment].append(postfixes[dimMap[sampler.dim]]); stageBuiltins[EShLangFragment].append(typeName);
if (dimMap[sampler.dim] == 1)
#ifdef AMD_EXTENSIONS
if (f16TexAddr)
stageBuiltins[EShLangFragment].append(", float16_t");
else
stageBuiltins[EShLangFragment].append(", float");
#else
stageBuiltins[EShLangFragment].append(", float");
#endif
else {
#ifdef AMD_EXTENSIONS
if (f16TexAddr)
stageBuiltins[EShLangFragment].append(", f16vec");
else
stageBuiltins[EShLangFragment].append(", vec");
#else
stageBuiltins[EShLangFragment].append(", vec");
#endif
stageBuiltins[EShLangFragment].append(postfixes[dimMap[sampler.dim]]);
}
stageBuiltins[EShLangFragment].append(");\n");
#ifdef AMD_EXTENSIONS
} }
stageBuiltins[EShLangFragment].append(");\n"); #endif
} }
// //
@ -4421,7 +4457,7 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName,
if (bias && (lod || sampler.ms)) if (bias && (lod || sampler.ms))
continue; continue;
if (bias && sampler.dim == Esd2D && sampler.shadow && sampler.arrayed) if (bias && (sampler.dim == Esd2D || sampler.dim == EsdCube) && sampler.shadow && sampler.arrayed)
continue; continue;
if (bias && (sampler.dim == EsdRect || sampler.dim == EsdBuffer)) if (bias && (sampler.dim == EsdRect || sampler.dim == EsdBuffer))
continue; continue;
@ -4470,149 +4506,237 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName,
continue; continue;
if (extraProj && (sampler.dim == Esd3D || sampler.shadow)) if (extraProj && (sampler.dim == Esd3D || sampler.shadow))
continue; continue;
#ifdef AMD_EXTENSIONS
for (int f16TexAddr = 0; f16TexAddr <= 1; ++f16TexAddr) { // loop over 16-bit floating-point texel addressing
for (int lodClamp = 0; lodClamp <= 1 ;++lodClamp) { // loop over "bool" lod clamp if (f16TexAddr && sampler.type != EbtFloat16)
if (lodClamp && (profile == EEsProfile || version < 450))
continue; continue;
if (lodClamp && (proj || lod || fetch)) if (f16TexAddr && sampler.shadow && ! compare) {
continue; compare = true; // compare argument is always present
totalDims--;
for (int sparse = 0; sparse <= 1; ++sparse) { // loop over "bool" sparse or not
if (sparse && (profile == EEsProfile || version < 450))
continue;
// Sparse sampling is not for 1D/1D array texture, buffer texture, and projective texture
if (sparse && (sampler.dim == Esd1D || sampler.dim == EsdBuffer || proj))
continue;
TString s;
// return type
if (sparse)
s.append("int ");
else {
if (sampler.shadow)
s.append("float ");
else {
s.append(prefixes[sampler.type]);
s.append("vec4 ");
}
}
// name
if (sparse) {
if (fetch)
s.append("sparseTexel");
else
s.append("sparseTexture");
} else {
if (fetch)
s.append("texel");
else
s.append("texture");
}
if (proj)
s.append("Proj");
if (lod)
s.append("Lod");
if (grad)
s.append("Grad");
if (fetch)
s.append("Fetch");
if (offset)
s.append("Offset");
if (lodClamp)
s.append("Clamp");
if (lodClamp || sparse)
s.append("ARB");
s.append("(");
// sampler type
s.append(typeName);
// P coordinate
if (extraProj)
s.append(",vec4");
else {
s.append(",");
TBasicType t = fetch ? EbtInt : EbtFloat;
if (totalDims == 1)
s.append(TType::getBasicString(t));
else {
s.append(prefixes[t]);
s.append("vec");
s.append(postfixes[totalDims]);
}
}
if (bias && compare)
continue;
// non-optional lod argument (lod that's not driven by lod loop) or sample
if ((fetch && sampler.dim != EsdBuffer && sampler.dim != EsdRect && !sampler.ms) ||
(sampler.ms && fetch))
s.append(",int");
// non-optional lod
if (lod)
s.append(",float");
// gradient arguments
if (grad) {
if (dimMap[sampler.dim] == 1)
s.append(",float,float");
else {
s.append(",vec");
s.append(postfixes[dimMap[sampler.dim]]);
s.append(",vec");
s.append(postfixes[dimMap[sampler.dim]]);
}
}
// offset
if (offset) {
if (dimMap[sampler.dim] == 1)
s.append(",int");
else {
s.append(",ivec");
s.append(postfixes[dimMap[sampler.dim]]);
}
}
// non-optional compare
if (compare)
s.append(",float");
// lod clamp
if (lodClamp)
s.append(",float");
// texel out (for sparse texture)
if (sparse) {
s.append(",out ");
if (sampler.shadow)
s.append("float ");
else {
s.append(prefixes[sampler.type]);
s.append("vec4 ");
}
}
// optional bias
if (bias)
s.append(",float");
s.append(");\n");
// Add to the per-language set of built-ins
if (bias || lodClamp)
stageBuiltins[EShLangFragment].append(s);
else
commonBuiltins.append(s);
} }
#endif
for (int lodClamp = 0; lodClamp <= 1 ;++lodClamp) { // loop over "bool" lod clamp
if (lodClamp && (profile == EEsProfile || version < 450))
continue;
if (lodClamp && (proj || lod || fetch))
continue;
for (int sparse = 0; sparse <= 1; ++sparse) { // loop over "bool" sparse or not
if (sparse && (profile == EEsProfile || version < 450))
continue;
// Sparse sampling is not for 1D/1D array texture, buffer texture, and projective texture
if (sparse && (sampler.dim == Esd1D || sampler.dim == EsdBuffer || proj))
continue;
TString s;
// return type
if (sparse)
s.append("int ");
else {
if (sampler.shadow)
#ifdef AMD_EXTENSIONS
if (sampler.type == EbtFloat16)
s.append("float16_t ");
else
s.append("float ");
#else
s.append("float ");
#endif
else {
s.append(prefixes[sampler.type]);
s.append("vec4 ");
}
}
// name
if (sparse) {
if (fetch)
s.append("sparseTexel");
else
s.append("sparseTexture");
}
else {
if (fetch)
s.append("texel");
else
s.append("texture");
}
if (proj)
s.append("Proj");
if (lod)
s.append("Lod");
if (grad)
s.append("Grad");
if (fetch)
s.append("Fetch");
if (offset)
s.append("Offset");
if (lodClamp)
s.append("Clamp");
if (lodClamp || sparse)
s.append("ARB");
s.append("(");
// sampler type
s.append(typeName);
#ifdef AMD_EXTENSIONS
// P coordinate
if (extraProj) {
if (f16TexAddr)
s.append(",f16vec4");
else
s.append(",vec4");
} else {
s.append(",");
TBasicType t = fetch ? EbtInt : (f16TexAddr ? EbtFloat16 : EbtFloat);
if (totalDims == 1)
s.append(TType::getBasicString(t));
else {
s.append(prefixes[t]);
s.append("vec");
s.append(postfixes[totalDims]);
}
}
#else
// P coordinate
if (extraProj)
s.append(",vec4");
else {
s.append(",");
TBasicType t = fetch ? EbtInt : EbtFloat;
if (totalDims == 1)
s.append(TType::getBasicString(t));
else {
s.append(prefixes[t]);
s.append("vec");
s.append(postfixes[totalDims]);
}
}
#endif
// non-optional compare
if (compare)
s.append(",float");
// non-optional lod argument (lod that's not driven by lod loop) or sample
if ((fetch && sampler.dim != EsdBuffer && sampler.dim != EsdRect && !sampler.ms) ||
(sampler.ms && fetch))
s.append(",int");
#ifdef AMD_EXTENSIONS
// non-optional lod
if (lod) {
if (f16TexAddr)
s.append(",float16_t");
else
s.append(",float");
}
// gradient arguments
if (grad) {
if (dimMap[sampler.dim] == 1) {
if (f16TexAddr)
s.append(",float16_t,float16_t");
else
s.append(",float,float");
} else {
if (f16TexAddr)
s.append(",f16vec");
else
s.append(",vec");
s.append(postfixes[dimMap[sampler.dim]]);
if (f16TexAddr)
s.append(",f16vec");
else
s.append(",vec");
s.append(postfixes[dimMap[sampler.dim]]);
}
}
#else
// non-optional lod
if (lod)
s.append(",float");
// gradient arguments
if (grad) {
if (dimMap[sampler.dim] == 1)
s.append(",float,float");
else {
s.append(",vec");
s.append(postfixes[dimMap[sampler.dim]]);
s.append(",vec");
s.append(postfixes[dimMap[sampler.dim]]);
}
}
#endif
// offset
if (offset) {
if (dimMap[sampler.dim] == 1)
s.append(",int");
else {
s.append(",ivec");
s.append(postfixes[dimMap[sampler.dim]]);
}
}
#ifdef AMD_EXTENSIONS
// lod clamp
if (lodClamp) {
if (f16TexAddr)
s.append(",float16_t");
else
s.append(",float");
}
#else
// lod clamp
if (lodClamp)
s.append(",float");
#endif
// texel out (for sparse texture)
if (sparse) {
s.append(",out ");
if (sampler.shadow)
#ifdef AMD_EXTENSIONS
if (sampler.type == EbtFloat16)
s.append("float16_t");
else
s.append("float");
#else
s.append("float");
#endif
else {
s.append(prefixes[sampler.type]);
s.append("vec4");
}
}
#ifdef AMD_EXTENSIONS
// optional bias
if (bias) {
if (f16TexAddr)
s.append(",float16_t");
else
s.append(",float");
}
#else
// optional bias
if (bias)
s.append(",float");
#endif
s.append(");\n");
// Add to the per-language set of built-ins
if (bias || lodClamp)
stageBuiltins[EShLangFragment].append(s);
else
commonBuiltins.append(s);
}
}
#ifdef AMD_EXTENSIONS
} }
#endif
} }
} }
} }
@ -4645,81 +4769,96 @@ void TBuiltIns::addGatherFunctions(TSampler sampler, const TString& typeName, in
if (version < 140 && sampler.dim == EsdRect && sampler.type != EbtFloat) if (version < 140 && sampler.dim == EsdRect && sampler.type != EbtFloat)
return; return;
for (int offset = 0; offset < 3; ++offset) { // loop over three forms of offset in the call name: none, Offset, and Offsets #ifdef AMD_EXTENSIONS
for (int f16TexAddr = 0; f16TexAddr <= 1; ++f16TexAddr) { // loop over 16-bit floating-point texel addressing
for (int comp = 0; comp < 2; ++comp) { // loop over presence of comp argument if (f16TexAddr && sampler.type != EbtFloat16)
continue;
#endif
for (int offset = 0; offset < 3; ++offset) { // loop over three forms of offset in the call name: none, Offset, and Offsets
if (comp > 0 && sampler.shadow) for (int comp = 0; comp < 2; ++comp) { // loop over presence of comp argument
continue;
if (offset > 0 && sampler.dim == EsdCube) if (comp > 0 && sampler.shadow)
continue;
for (int sparse = 0; sparse <= 1; ++sparse) { // loop over "bool" sparse or not
if (sparse && (profile == EEsProfile || version < 450))
continue; continue;
TString s; if (offset > 0 && sampler.dim == EsdCube)
continue;
// return type for (int sparse = 0; sparse <= 1; ++sparse) { // loop over "bool" sparse or not
if (sparse) if (sparse && (profile == EEsProfile || version < 450))
s.append("int "); continue;
else {
s.append(prefixes[sampler.type]); TString s;
s.append("vec4 ");
// return type
if (sparse)
s.append("int ");
else {
s.append(prefixes[sampler.type]);
s.append("vec4 ");
}
// name
if (sparse)
s.append("sparseTextureGather");
else
s.append("textureGather");
switch (offset) {
case 1:
s.append("Offset");
break;
case 2:
s.append("Offsets");
default:
break;
}
if (sparse)
s.append("ARB");
s.append("(");
// sampler type argument
s.append(typeName);
// P coordinate argument
#ifdef AMD_EXTENSIONS
if (f16TexAddr)
s.append(",f16vec");
else
s.append(",vec");
#else
s.append(",vec");
#endif
int totalDims = dimMap[sampler.dim] + (sampler.arrayed ? 1 : 0);
s.append(postfixes[totalDims]);
// refZ argument
if (sampler.shadow)
s.append(",float");
// offset argument
if (offset > 0) {
s.append(",ivec2");
if (offset == 2)
s.append("[4]");
}
// texel out (for sparse texture)
if (sparse) {
s.append(",out ");
s.append(prefixes[sampler.type]);
s.append("vec4 ");
}
// comp argument
if (comp)
s.append(",int");
s.append(");\n");
commonBuiltins.append(s);
#ifdef AMD_EXTENSIONS
} }
#endif
// name
if (sparse)
s.append("sparseTextureGather");
else
s.append("textureGather");
switch (offset) {
case 1:
s.append("Offset");
break;
case 2:
s.append("Offsets");
default:
break;
}
if (sparse)
s.append("ARB");
s.append("(");
// sampler type argument
s.append(typeName);
// P coordinate argument
s.append(",vec");
int totalDims = dimMap[sampler.dim] + (sampler.arrayed ? 1 : 0);
s.append(postfixes[totalDims]);
// refZ argument
if (sampler.shadow)
s.append(",float");
// offset argument
if (offset > 0) {
s.append(",ivec2");
if (offset == 2)
s.append("[4]");
}
// texel out (for sparse texture)
if (sparse) {
s.append(",out ");
s.append(prefixes[sampler.type]);
s.append("vec4 ");
}
// comp argument
if (comp)
s.append(",int");
s.append(");\n");
commonBuiltins.append(s);
} }
} }
} }
@ -4738,95 +4877,112 @@ void TBuiltIns::addGatherFunctions(TSampler sampler, const TString& typeName, in
if ((lod && bias) || (lod == 0 && bias == 0)) if ((lod && bias) || (lod == 0 && bias == 0))
continue; continue;
for (int offset = 0; offset < 3; ++offset) { // loop over three forms of offset in the call name: none, Offset, and Offsets for (int f16TexAddr = 0; f16TexAddr <= 1; ++f16TexAddr) { // loop over 16-bit floating-point texel addressing
for (int comp = 0; comp < 2; ++comp) { // loop over presence of comp argument if (f16TexAddr && sampler.type != EbtFloat16)
continue;
if (comp == 0 && bias) for (int offset = 0; offset < 3; ++offset) { // loop over three forms of offset in the call name: none, Offset, and Offsets
continue;
if (offset > 0 && sampler.dim == EsdCube) for (int comp = 0; comp < 2; ++comp) { // loop over presence of comp argument
continue;
for (int sparse = 0; sparse <= 1; ++sparse) { // loop over "bool" sparse or not if (comp == 0 && bias)
if (sparse && (profile == EEsProfile || version < 450))
continue; continue;
TString s; if (offset > 0 && sampler.dim == EsdCube)
continue;
// return type for (int sparse = 0; sparse <= 1; ++sparse) { // loop over "bool" sparse or not
if (sparse) if (sparse && (profile == EEsProfile || version < 450))
s.append("int "); continue;
else {
s.append(prefixes[sampler.type]); TString s;
s.append("vec4 ");
// return type
if (sparse)
s.append("int ");
else {
s.append(prefixes[sampler.type]);
s.append("vec4 ");
}
// name
if (sparse)
s.append("sparseTextureGather");
else
s.append("textureGather");
if (lod)
s.append("Lod");
switch (offset) {
case 1:
s.append("Offset");
break;
case 2:
s.append("Offsets");
default:
break;
}
if (lod)
s.append("AMD");
else if (sparse)
s.append("ARB");
s.append("(");
// sampler type argument
s.append(typeName);
// P coordinate argument
if (f16TexAddr)
s.append(",f16vec");
else
s.append(",vec");
int totalDims = dimMap[sampler.dim] + (sampler.arrayed ? 1 : 0);
s.append(postfixes[totalDims]);
// lod argument
if (lod) {
if (f16TexAddr)
s.append(",float16_t");
else
s.append(",float");
}
// offset argument
if (offset > 0) {
s.append(",ivec2");
if (offset == 2)
s.append("[4]");
}
// texel out (for sparse texture)
if (sparse) {
s.append(",out ");
s.append(prefixes[sampler.type]);
s.append("vec4 ");
}
// comp argument
if (comp)
s.append(",int");
// bias argument
if (bias) {
if (f16TexAddr)
s.append(",float16_t");
else
s.append(",float");
}
s.append(");\n");
if (bias)
stageBuiltins[EShLangFragment].append(s);
else
commonBuiltins.append(s);
} }
// name
if (sparse)
s.append("sparseTextureGather");
else
s.append("textureGather");
if (lod)
s.append("Lod");
switch (offset) {
case 1:
s.append("Offset");
break;
case 2:
s.append("Offsets");
default:
break;
}
if (lod)
s.append("AMD");
else if (sparse)
s.append("ARB");
s.append("(");
// sampler type argument
s.append(typeName);
// P coordinate argument
s.append(",vec");
int totalDims = dimMap[sampler.dim] + (sampler.arrayed ? 1 : 0);
s.append(postfixes[totalDims]);
// lod argument
if (lod)
s.append(",float");
// offset argument
if (offset > 0) {
s.append(",ivec2");
if (offset == 2)
s.append("[4]");
}
// texel out (for sparse texture)
if (sparse) {
s.append(",out ");
s.append(prefixes[sampler.type]);
s.append("vec4 ");
}
// comp argument
if (comp)
s.append(",int");
// bias argument
if (bias)
s.append(",float");
s.append(");\n");
if (bias)
stageBuiltins[EShLangFragment].append(s);
else
commonBuiltins.append(s);
} }
} }
} }

View File

@ -1520,6 +1520,12 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
} }
if (arg > 0) { if (arg > 0) {
#ifdef AMD_EXTENSIONS
bool f16ShadowCompare = (*argp)[1]->getAsTyped()->getBasicType() == EbtFloat16 && arg0->getType().getSampler().shadow;
if (f16ShadowCompare)
++arg;
#endif
if (! (*argp)[arg]->getAsConstantUnion()) if (! (*argp)[arg]->getAsConstantUnion())
error(loc, "argument must be compile-time constant", "texel offset", ""); error(loc, "argument must be compile-time constant", "texel offset", "");
else { else {

View File

@ -579,6 +579,54 @@ void TScanContext::fillInKeywordMap()
(*KeywordMap)["usubpassInput"] = USUBPASSINPUT; (*KeywordMap)["usubpassInput"] = USUBPASSINPUT;
(*KeywordMap)["usubpassInputMS"] = USUBPASSINPUTMS; (*KeywordMap)["usubpassInputMS"] = USUBPASSINPUTMS;
#ifdef AMD_EXTENSIONS
(*KeywordMap)["f16sampler1D"] = F16SAMPLER1D;
(*KeywordMap)["f16sampler2D"] = F16SAMPLER2D;
(*KeywordMap)["f16sampler3D"] = F16SAMPLER3D;
(*KeywordMap)["f16sampler2DRect"] = F16SAMPLER2DRECT;
(*KeywordMap)["f16samplerCube"] = F16SAMPLERCUBE;
(*KeywordMap)["f16sampler1DArray"] = F16SAMPLER1DARRAY;
(*KeywordMap)["f16sampler2DArray"] = F16SAMPLER2DARRAY;
(*KeywordMap)["f16samplerCubeArray"] = F16SAMPLERCUBEARRAY;
(*KeywordMap)["f16samplerBuffer"] = F16SAMPLERBUFFER;
(*KeywordMap)["f16sampler2DMS"] = F16SAMPLER2DMS;
(*KeywordMap)["f16sampler2DMSArray"] = F16SAMPLER2DMSARRAY;
(*KeywordMap)["f16sampler1DShadow"] = F16SAMPLER1DSHADOW;
(*KeywordMap)["f16sampler2DShadow"] = F16SAMPLER2DSHADOW;
(*KeywordMap)["f16sampler2DRectShadow"] = F16SAMPLER2DRECTSHADOW;
(*KeywordMap)["f16samplerCubeShadow"] = F16SAMPLERCUBESHADOW;
(*KeywordMap)["f16sampler1DArrayShadow"] = F16SAMPLER1DARRAYSHADOW;
(*KeywordMap)["f16sampler2DArrayShadow"] = F16SAMPLER2DARRAYSHADOW;
(*KeywordMap)["f16samplerCubeArrayShadow"] = F16SAMPLERCUBEARRAYSHADOW;
(*KeywordMap)["f16image1D"] = F16IMAGE1D;
(*KeywordMap)["f16image2D"] = F16IMAGE2D;
(*KeywordMap)["f16image3D"] = F16IMAGE3D;
(*KeywordMap)["f16image2DRect"] = F16IMAGE2DRECT;
(*KeywordMap)["f16imageCube"] = F16IMAGECUBE;
(*KeywordMap)["f16image1DArray"] = F16IMAGE1DARRAY;
(*KeywordMap)["f16image2DArray"] = F16IMAGE2DARRAY;
(*KeywordMap)["f16imageCubeArray"] = F16IMAGECUBEARRAY;
(*KeywordMap)["f16imageBuffer"] = F16IMAGEBUFFER;
(*KeywordMap)["f16image2DMS"] = F16IMAGE2DMS;
(*KeywordMap)["f16image2DMSArray"] = F16IMAGE2DMSARRAY;
(*KeywordMap)["f16texture1D"] = F16TEXTURE1D;
(*KeywordMap)["f16texture2D"] = F16TEXTURE2D;
(*KeywordMap)["f16texture3D"] = F16TEXTURE3D;
(*KeywordMap)["f16texture2DRect"] = F16TEXTURE2DRECT;
(*KeywordMap)["f16textureCube"] = F16TEXTURECUBE;
(*KeywordMap)["f16texture1DArray"] = F16TEXTURE1DARRAY;
(*KeywordMap)["f16texture2DArray"] = F16TEXTURE2DARRAY;
(*KeywordMap)["f16textureCubeArray"] = F16TEXTURECUBEARRAY;
(*KeywordMap)["f16textureBuffer"] = F16TEXTUREBUFFER;
(*KeywordMap)["f16texture2DMS"] = F16TEXTURE2DMS;
(*KeywordMap)["f16texture2DMSArray"] = F16TEXTURE2DMSARRAY;
(*KeywordMap)["f16subpassInput"] = F16SUBPASSINPUT;
(*KeywordMap)["f16subpassInputMS"] = F16SUBPASSINPUTMS;
#endif
(*KeywordMap)["noperspective"] = NOPERSPECTIVE; (*KeywordMap)["noperspective"] = NOPERSPECTIVE;
(*KeywordMap)["smooth"] = SMOOTH; (*KeywordMap)["smooth"] = SMOOTH;
(*KeywordMap)["flat"] = FLAT; (*KeywordMap)["flat"] = FLAT;
@ -1029,6 +1077,7 @@ int TScanContext::tokenizeIdentifier()
(parseContext.profile != EEsProfile && parseContext.version >= 450 && (parseContext.profile != EEsProfile && parseContext.version >= 450 &&
parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float))) parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float)))
return keyword; return keyword;
return identifierOrType(); return identifierOrType();
#endif #endif
@ -1211,6 +1260,60 @@ int TScanContext::tokenizeIdentifier()
else else
return identifierOrType(); return identifierOrType();
#ifdef AMD_EXTENSIONS
case F16SAMPLER1D:
case F16SAMPLER2D:
case F16SAMPLER3D:
case F16SAMPLER2DRECT:
case F16SAMPLERCUBE:
case F16SAMPLER1DARRAY:
case F16SAMPLER2DARRAY:
case F16SAMPLERCUBEARRAY:
case F16SAMPLERBUFFER:
case F16SAMPLER2DMS:
case F16SAMPLER2DMSARRAY:
case F16SAMPLER1DSHADOW:
case F16SAMPLER2DSHADOW:
case F16SAMPLER1DARRAYSHADOW:
case F16SAMPLER2DARRAYSHADOW:
case F16SAMPLER2DRECTSHADOW:
case F16SAMPLERCUBESHADOW:
case F16SAMPLERCUBEARRAYSHADOW:
case F16IMAGE1D:
case F16IMAGE2D:
case F16IMAGE3D:
case F16IMAGE2DRECT:
case F16IMAGECUBE:
case F16IMAGE1DARRAY:
case F16IMAGE2DARRAY:
case F16IMAGECUBEARRAY:
case F16IMAGEBUFFER:
case F16IMAGE2DMS:
case F16IMAGE2DMSARRAY:
case F16TEXTURE1D:
case F16TEXTURE2D:
case F16TEXTURE3D:
case F16TEXTURE2DRECT:
case F16TEXTURECUBE:
case F16TEXTURE1DARRAY:
case F16TEXTURE2DARRAY:
case F16TEXTURECUBEARRAY:
case F16TEXTUREBUFFER:
case F16TEXTURE2DMS:
case F16TEXTURE2DMSARRAY:
case F16SUBPASSINPUT:
case F16SUBPASSINPUTMS:
afterType = true;
if (parseContext.symbolTable.atBuiltInLevel() ||
(parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float_fetch) &&
parseContext.profile != EEsProfile && parseContext.version >= 450))
return keyword;
return identifierOrType();
#endif
case NOPERSPECTIVE: case NOPERSPECTIVE:
return es30ReservedFromGLSL(130); return es30ReservedFromGLSL(130);

View File

@ -75,6 +75,9 @@ void TType::buildMangledName(TString& mangledName) const
case EbtAtomicUint: mangledName += "au"; break; case EbtAtomicUint: mangledName += "au"; break;
case EbtSampler: case EbtSampler:
switch (sampler.type) { switch (sampler.type) {
#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;
default: break; // some compilers want this default: break; // some compilers want this

View File

@ -204,6 +204,7 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior[E_GL_AMD_gpu_shader_int16] = EBhDisable; extensionBehavior[E_GL_AMD_gpu_shader_int16] = EBhDisable;
extensionBehavior[E_GL_AMD_shader_image_load_store_lod] = EBhDisable; extensionBehavior[E_GL_AMD_shader_image_load_store_lod] = EBhDisable;
extensionBehavior[E_GL_AMD_shader_fragment_mask] = EBhDisable; extensionBehavior[E_GL_AMD_shader_fragment_mask] = EBhDisable;
extensionBehavior[E_GL_AMD_gpu_shader_half_float_fetch] = EBhDisable;
#endif #endif
#ifdef NV_EXTENSIONS #ifdef NV_EXTENSIONS
@ -341,6 +342,7 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_AMD_gpu_shader_int16 1\n" "#define GL_AMD_gpu_shader_int16 1\n"
"#define GL_AMD_shader_image_load_store_lod 1\n" "#define GL_AMD_shader_image_load_store_lod 1\n"
"#define GL_AMD_shader_fragment_mask 1\n" "#define GL_AMD_shader_fragment_mask 1\n"
"#define GL_AMD_gpu_shader_half_float_fetch 1\n"
#endif #endif
#ifdef NV_EXTENSIONS #ifdef NV_EXTENSIONS
@ -749,7 +751,7 @@ void TParseVersions::doubleCheck(const TSourceLoc& loc, const char* op)
void TParseVersions::int16Check(const TSourceLoc& loc, const char* op, bool builtIn) void TParseVersions::int16Check(const TSourceLoc& loc, const char* op, bool builtIn)
{ {
if (! builtIn) { if (! builtIn) {
requireExtensions(loc, 1, &E_GL_AMD_gpu_shader_int16, "shader int16"); requireExtensions(loc, 1, &E_GL_AMD_gpu_shader_int16, op);
requireProfile(loc, ECoreProfile | ECompatibilityProfile, op); requireProfile(loc, ECoreProfile | ECompatibilityProfile, op);
profileRequires(loc, ECoreProfile, 450, nullptr, op); profileRequires(loc, ECoreProfile, 450, nullptr, op);
profileRequires(loc, ECompatibilityProfile, 450, nullptr, op); profileRequires(loc, ECompatibilityProfile, 450, nullptr, op);
@ -760,7 +762,18 @@ void TParseVersions::int16Check(const TSourceLoc& loc, const char* op, bool buil
void TParseVersions::float16Check(const TSourceLoc& loc, const char* op, bool builtIn) void TParseVersions::float16Check(const TSourceLoc& loc, const char* op, bool builtIn)
{ {
if (! builtIn) { if (! builtIn) {
requireExtensions(loc, 1, &E_GL_AMD_gpu_shader_half_float, "shader half float"); requireExtensions(loc, 1, &E_GL_AMD_gpu_shader_half_float, op);
requireProfile(loc, ECoreProfile | ECompatibilityProfile, op);
profileRequires(loc, ECoreProfile, 450, nullptr, op);
profileRequires(loc, ECompatibilityProfile, 450, nullptr, op);
}
}
// Call for any operation needing GLSL float16 opaque-type support
void TParseVersions::float16OpaqueCheck(const TSourceLoc& loc, const char* op, bool builtIn)
{
if (! builtIn) {
requireExtensions(loc, 1, &E_GL_AMD_gpu_shader_half_float_fetch, op);
requireProfile(loc, ECoreProfile | ECompatibilityProfile, op); requireProfile(loc, ECoreProfile | ECompatibilityProfile, op);
profileRequires(loc, ECoreProfile, 450, nullptr, op); profileRequires(loc, ECoreProfile, 450, nullptr, op);
profileRequires(loc, ECompatibilityProfile, 450, nullptr, op); profileRequires(loc, ECompatibilityProfile, 450, nullptr, op);
@ -772,7 +785,7 @@ void TParseVersions::float16Check(const TSourceLoc& loc, const char* op, bool bu
void TParseVersions::int64Check(const TSourceLoc& loc, const char* op, bool builtIn) void TParseVersions::int64Check(const TSourceLoc& loc, const char* op, bool builtIn)
{ {
if (! builtIn) { if (! builtIn) {
requireExtensions(loc, 1, &E_GL_ARB_gpu_shader_int64, "shader int64"); requireExtensions(loc, 1, &E_GL_ARB_gpu_shader_int64, op);
requireProfile(loc, ECoreProfile | ECompatibilityProfile, op); requireProfile(loc, ECoreProfile | ECompatibilityProfile, op);
profileRequires(loc, ECoreProfile, 450, nullptr, op); profileRequires(loc, ECoreProfile, 450, nullptr, op);
profileRequires(loc, ECompatibilityProfile, 450, nullptr, op); profileRequires(loc, ECompatibilityProfile, 450, nullptr, op);

View File

@ -174,6 +174,7 @@ const char* const E_GL_AMD_texture_gather_bias_lod = "GL_AMD_textur
const char* const E_GL_AMD_gpu_shader_int16 = "GL_AMD_gpu_shader_int16"; const char* const E_GL_AMD_gpu_shader_int16 = "GL_AMD_gpu_shader_int16";
const char* const E_GL_AMD_shader_image_load_store_lod = "GL_AMD_shader_image_load_store_lod"; const char* const E_GL_AMD_shader_image_load_store_lod = "GL_AMD_shader_image_load_store_lod";
const char* const E_GL_AMD_shader_fragment_mask = "GL_AMD_shader_fragment_mask"; const char* const E_GL_AMD_shader_fragment_mask = "GL_AMD_shader_fragment_mask";
const char* const E_GL_AMD_gpu_shader_half_float_fetch = "GL_AMD_gpu_shader_half_float_fetch";
#endif #endif
#ifdef NV_EXTENSIONS #ifdef NV_EXTENSIONS

View File

@ -117,6 +117,40 @@
#define GL_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900C #define GL_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900C
#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB 0x900D #define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB 0x900D
#ifdef AMD_EXTENSIONS
#define GL_FLOAT16_SAMPLER_1D_AMD 0x91CE
#define GL_FLOAT16_SAMPLER_2D_AMD 0x91CF
#define GL_FLOAT16_SAMPLER_3D_AMD 0x91D0
#define GL_FLOAT16_SAMPLER_CUBE_AMD 0x91D1
#define GL_FLOAT16_SAMPLER_2D_RECT_AMD 0x91D2
#define GL_FLOAT16_SAMPLER_1D_ARRAY_AMD 0x91D3
#define GL_FLOAT16_SAMPLER_2D_ARRAY_AMD 0x91D4
#define GL_FLOAT16_SAMPLER_CUBE_MAP_ARRAY_AMD 0x91D5
#define GL_FLOAT16_SAMPLER_BUFFER_AMD 0x91D6
#define GL_FLOAT16_SAMPLER_2D_MULTISAMPLE_AMD 0x91D7
#define GL_FLOAT16_SAMPLER_2D_MULTISAMPLE_ARRAY_AMD 0x91D8
#define GL_FLOAT16_SAMPLER_1D_SHADOW_AMD 0x91D9
#define GL_FLOAT16_SAMPLER_2D_SHADOW_AMD 0x91DA
#define GL_FLOAT16_SAMPLER_2D_RECT_SHADOW_AMD 0x91DB
#define GL_FLOAT16_SAMPLER_1D_ARRAY_SHADOW_AMD 0x91DC
#define GL_FLOAT16_SAMPLER_2D_ARRAY_SHADOW_AMD 0x91DD
#define GL_FLOAT16_SAMPLER_CUBE_SHADOW_AMD 0x91DE
#define GL_FLOAT16_SAMPLER_CUBE_MAP_ARRAY_SHADOW_AMD 0x91DF
#define GL_FLOAT16_IMAGE_1D_AMD 0x91E0
#define GL_FLOAT16_IMAGE_2D_AMD 0x91E1
#define GL_FLOAT16_IMAGE_3D_AMD 0x91E2
#define GL_FLOAT16_IMAGE_2D_RECT_AMD 0x91E3
#define GL_FLOAT16_IMAGE_CUBE_AMD 0x91E4
#define GL_FLOAT16_IMAGE_1D_ARRAY_AMD 0x91E5
#define GL_FLOAT16_IMAGE_2D_ARRAY_AMD 0x91E6
#define GL_FLOAT16_IMAGE_CUBE_MAP_ARRAY_AMD 0x91E7
#define GL_FLOAT16_IMAGE_BUFFER_AMD 0x91E8
#define GL_FLOAT16_IMAGE_2D_MULTISAMPLE_AMD 0x91E9
#define GL_FLOAT16_IMAGE_2D_MULTISAMPLE_ARRAY_AMD 0x91EA
#endif
#define GL_INT_SAMPLER_1D 0x8DC9 #define GL_INT_SAMPLER_1D 0x8DC9
#define GL_INT_SAMPLER_2D 0x8DCA #define GL_INT_SAMPLER_2D 0x8DCA
#define GL_INT_SAMPLER_3D 0x8DCB #define GL_INT_SAMPLER_3D 0x8DCB

View File

@ -159,6 +159,12 @@ extern int yylex(YYSTYPE*, TParseContext&);
%token <lex> SAMPLER2DMSARRAY ISAMPLER2DMSARRAY USAMPLER2DMSARRAY %token <lex> SAMPLER2DMSARRAY ISAMPLER2DMSARRAY USAMPLER2DMSARRAY
%token <lex> SAMPLEREXTERNALOES %token <lex> SAMPLEREXTERNALOES
%token <lex> F16SAMPLER1D F16SAMPLER2D F16SAMPLER3D F16SAMPLER2DRECT F16SAMPLERCUBE
%token <lex> F16SAMPLER1DARRAY F16SAMPLER2DARRAY F16SAMPLERCUBEARRAY
%token <lex> F16SAMPLERBUFFER F16SAMPLER2DMS F16SAMPLER2DMSARRAY
%token <lex> F16SAMPLER1DSHADOW F16SAMPLER2DSHADOW F16SAMPLER1DARRAYSHADOW F16SAMPLER2DARRAYSHADOW
%token <lex> F16SAMPLER2DRECTSHADOW F16SAMPLERCUBESHADOW F16SAMPLERCUBEARRAYSHADOW
// pure sampler // pure sampler
%token <lex> SAMPLER SAMPLERSHADOW %token <lex> SAMPLER SAMPLERSHADOW
@ -174,8 +180,13 @@ extern int yylex(YYSTYPE*, TParseContext&);
%token <lex> TEXTURE2DMS ITEXTURE2DMS UTEXTURE2DMS %token <lex> TEXTURE2DMS ITEXTURE2DMS UTEXTURE2DMS
%token <lex> TEXTURE2DMSARRAY ITEXTURE2DMSARRAY UTEXTURE2DMSARRAY %token <lex> TEXTURE2DMSARRAY ITEXTURE2DMSARRAY UTEXTURE2DMSARRAY
%token <lex> F16TEXTURE1D F16TEXTURE2D F16TEXTURE3D F16TEXTURE2DRECT F16TEXTURECUBE
%token <lex> F16TEXTURE1DARRAY F16TEXTURE2DARRAY F16TEXTURECUBEARRAY
%token <lex> F16TEXTUREBUFFER F16TEXTURE2DMS F16TEXTURE2DMSARRAY
// input attachments // input attachments
%token <lex> SUBPASSINPUT SUBPASSINPUTMS ISUBPASSINPUT ISUBPASSINPUTMS USUBPASSINPUT USUBPASSINPUTMS %token <lex> SUBPASSINPUT SUBPASSINPUTMS ISUBPASSINPUT ISUBPASSINPUTMS USUBPASSINPUT USUBPASSINPUTMS
%token <lex> F16SUBPASSINPUT F16SUBPASSINPUTMS
%token <lex> IMAGE1D IIMAGE1D UIMAGE1D IMAGE2D IIMAGE2D %token <lex> IMAGE1D IIMAGE1D UIMAGE1D IMAGE2D IIMAGE2D
%token <lex> UIMAGE2D IMAGE3D IIMAGE3D UIMAGE3D %token <lex> UIMAGE2D IMAGE3D IIMAGE3D UIMAGE3D
@ -188,6 +199,10 @@ extern int yylex(YYSTYPE*, TParseContext&);
%token <lex> IMAGE2DMS IIMAGE2DMS UIMAGE2DMS %token <lex> IMAGE2DMS IIMAGE2DMS UIMAGE2DMS
%token <lex> IMAGE2DMSARRAY IIMAGE2DMSARRAY UIMAGE2DMSARRAY %token <lex> IMAGE2DMSARRAY IIMAGE2DMSARRAY UIMAGE2DMSARRAY
%token <lex> F16IMAGE1D F16IMAGE2D F16IMAGE3D F16IMAGE2DRECT
%token <lex> F16IMAGECUBE F16IMAGE1DARRAY F16IMAGE2DARRAY F16IMAGECUBEARRAY
%token <lex> F16IMAGEBUFFER F16IMAGE2DMS F16IMAGE2DMSARRAY
%token <lex> STRUCT VOID WHILE %token <lex> STRUCT VOID WHILE
%token <lex> IDENTIFIER TYPE_NAME %token <lex> IDENTIFIER TYPE_NAME
@ -1890,6 +1905,110 @@ type_specifier_nonarray
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.set(EbtFloat, EsdCube, true, true); $$.sampler.set(EbtFloat, EsdCube, true, true);
} }
| F16SAMPLER1D {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtFloat16, Esd1D);
#endif
}
| F16SAMPLER2D {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtFloat16, Esd2D);
#endif
}
| F16SAMPLER3D {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtFloat16, Esd3D);
#endif
}
| F16SAMPLERCUBE {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtFloat16, EsdCube);
#endif
}
| F16SAMPLER1DSHADOW {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtFloat16, Esd1D, false, true);
#endif
}
| F16SAMPLER2DSHADOW {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtFloat16, Esd2D, false, true);
#endif
}
| F16SAMPLERCUBESHADOW {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtFloat16, EsdCube, false, true);
#endif
}
| F16SAMPLER1DARRAY {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtFloat16, Esd1D, true);
#endif
}
| F16SAMPLER2DARRAY {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtFloat16, Esd2D, true);
#endif
}
| F16SAMPLER1DARRAYSHADOW {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtFloat16, Esd1D, true, true);
#endif
}
| F16SAMPLER2DARRAYSHADOW {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtFloat16, Esd2D, true, true);
#endif
}
| F16SAMPLERCUBEARRAY {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtFloat16, EsdCube, true);
#endif
}
| F16SAMPLERCUBEARRAYSHADOW {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtFloat16, EsdCube, true, true);
#endif
}
| ISAMPLER1D { | ISAMPLER1D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
@ -1970,6 +2089,22 @@ type_specifier_nonarray
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.set(EbtFloat, EsdRect, false, true); $$.sampler.set(EbtFloat, EsdRect, false, true);
} }
| F16SAMPLER2DRECT {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtFloat16, EsdRect);
#endif
}
| F16SAMPLER2DRECTSHADOW {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtFloat16, EsdRect, false, true);
#endif
}
| ISAMPLER2DRECT { | ISAMPLER2DRECT {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
@ -1985,6 +2120,14 @@ type_specifier_nonarray
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.set(EbtFloat, EsdBuffer); $$.sampler.set(EbtFloat, EsdBuffer);
} }
| F16SAMPLERBUFFER {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtFloat16, EsdBuffer);
#endif
}
| ISAMPLERBUFFER { | ISAMPLERBUFFER {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
@ -2000,6 +2143,14 @@ type_specifier_nonarray
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.set(EbtFloat, Esd2D, false, false, true); $$.sampler.set(EbtFloat, Esd2D, false, false, true);
} }
| F16SAMPLER2DMS {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtFloat16, Esd2D, false, false, true);
#endif
}
| ISAMPLER2DMS { | ISAMPLER2DMS {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
@ -2015,6 +2166,14 @@ type_specifier_nonarray
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.set(EbtFloat, Esd2D, true, false, true); $$.sampler.set(EbtFloat, Esd2D, true, false, true);
} }
| F16SAMPLER2DMSARRAY {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.set(EbtFloat16, Esd2D, true, false, true);
#endif
}
| ISAMPLER2DMSARRAY { | ISAMPLER2DMSARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
@ -2040,36 +2199,92 @@ type_specifier_nonarray
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat, Esd1D); $$.sampler.setTexture(EbtFloat, Esd1D);
} }
| F16TEXTURE1D {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat16, Esd1D);
#endif
}
| TEXTURE2D { | TEXTURE2D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat, Esd2D); $$.sampler.setTexture(EbtFloat, Esd2D);
} }
| F16TEXTURE2D {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat16, Esd2D);
#endif
}
| TEXTURE3D { | TEXTURE3D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat, Esd3D); $$.sampler.setTexture(EbtFloat, Esd3D);
} }
| F16TEXTURE3D {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat16, Esd3D);
#endif
}
| TEXTURECUBE { | TEXTURECUBE {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat, EsdCube); $$.sampler.setTexture(EbtFloat, EsdCube);
} }
| F16TEXTURECUBE {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat16, EsdCube);
#endif
}
| TEXTURE1DARRAY { | TEXTURE1DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat, Esd1D, true); $$.sampler.setTexture(EbtFloat, Esd1D, true);
} }
| F16TEXTURE1DARRAY {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat16, Esd1D, true);
#endif
}
| TEXTURE2DARRAY { | TEXTURE2DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat, Esd2D, true); $$.sampler.setTexture(EbtFloat, Esd2D, true);
} }
| F16TEXTURE2DARRAY {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat16, Esd2D, true);
#endif
}
| TEXTURECUBEARRAY { | TEXTURECUBEARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat, EsdCube, true); $$.sampler.setTexture(EbtFloat, EsdCube, true);
} }
| F16TEXTURECUBEARRAY {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat16, EsdCube, true);
#endif
}
| ITEXTURE1D { | ITEXTURE1D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
@ -2145,6 +2360,14 @@ type_specifier_nonarray
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat, EsdRect); $$.sampler.setTexture(EbtFloat, EsdRect);
} }
| F16TEXTURE2DRECT {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat16, EsdRect);
#endif
}
| ITEXTURE2DRECT { | ITEXTURE2DRECT {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
@ -2160,6 +2383,14 @@ type_specifier_nonarray
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat, EsdBuffer); $$.sampler.setTexture(EbtFloat, EsdBuffer);
} }
| F16TEXTUREBUFFER {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat16, EsdBuffer);
#endif
}
| ITEXTUREBUFFER { | ITEXTUREBUFFER {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
@ -2175,6 +2406,14 @@ type_specifier_nonarray
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat, Esd2D, false, false, true); $$.sampler.setTexture(EbtFloat, Esd2D, false, false, true);
} }
| F16TEXTURE2DMS {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat16, Esd2D, false, false, true);
#endif
}
| ITEXTURE2DMS { | ITEXTURE2DMS {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
@ -2190,6 +2429,14 @@ type_specifier_nonarray
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat, Esd2D, true, false, true); $$.sampler.setTexture(EbtFloat, Esd2D, true, false, true);
} }
| F16TEXTURE2DMSARRAY {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setTexture(EbtFloat16, Esd2D, true, false, true);
#endif
}
| ITEXTURE2DMSARRAY { | ITEXTURE2DMSARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
@ -2205,6 +2452,14 @@ type_specifier_nonarray
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.setImage(EbtFloat, Esd1D); $$.sampler.setImage(EbtFloat, Esd1D);
} }
| F16IMAGE1D {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setImage(EbtFloat16, Esd1D);
#endif
}
| IIMAGE1D { | IIMAGE1D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
@ -2220,6 +2475,14 @@ type_specifier_nonarray
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.setImage(EbtFloat, Esd2D); $$.sampler.setImage(EbtFloat, Esd2D);
} }
| F16IMAGE2D {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setImage(EbtFloat16, Esd2D);
#endif
}
| IIMAGE2D { | IIMAGE2D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
@ -2235,6 +2498,14 @@ type_specifier_nonarray
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.setImage(EbtFloat, Esd3D); $$.sampler.setImage(EbtFloat, Esd3D);
} }
| F16IMAGE3D {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setImage(EbtFloat16, Esd3D);
#endif
}
| IIMAGE3D { | IIMAGE3D {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
@ -2250,6 +2521,14 @@ type_specifier_nonarray
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.setImage(EbtFloat, EsdRect); $$.sampler.setImage(EbtFloat, EsdRect);
} }
| F16IMAGE2DRECT {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setImage(EbtFloat16, EsdRect);
#endif
}
| IIMAGE2DRECT { | IIMAGE2DRECT {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
@ -2265,6 +2544,14 @@ type_specifier_nonarray
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.setImage(EbtFloat, EsdCube); $$.sampler.setImage(EbtFloat, EsdCube);
} }
| F16IMAGECUBE {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setImage(EbtFloat16, EsdCube);
#endif
}
| IIMAGECUBE { | IIMAGECUBE {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
@ -2280,6 +2567,14 @@ type_specifier_nonarray
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.setImage(EbtFloat, EsdBuffer); $$.sampler.setImage(EbtFloat, EsdBuffer);
} }
| F16IMAGEBUFFER {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setImage(EbtFloat16, EsdBuffer);
#endif
}
| IIMAGEBUFFER { | IIMAGEBUFFER {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
@ -2295,6 +2590,14 @@ type_specifier_nonarray
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.setImage(EbtFloat, Esd1D, true); $$.sampler.setImage(EbtFloat, Esd1D, true);
} }
| F16IMAGE1DARRAY {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setImage(EbtFloat16, Esd1D, true);
#endif
}
| IIMAGE1DARRAY { | IIMAGE1DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
@ -2310,6 +2613,14 @@ type_specifier_nonarray
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.setImage(EbtFloat, Esd2D, true); $$.sampler.setImage(EbtFloat, Esd2D, true);
} }
| F16IMAGE2DARRAY {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setImage(EbtFloat16, Esd2D, true);
#endif
}
| IIMAGE2DARRAY { | IIMAGE2DARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
@ -2325,6 +2636,14 @@ type_specifier_nonarray
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.setImage(EbtFloat, EsdCube, true); $$.sampler.setImage(EbtFloat, EsdCube, true);
} }
| F16IMAGECUBEARRAY {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setImage(EbtFloat16, EsdCube, true);
#endif
}
| IIMAGECUBEARRAY { | IIMAGECUBEARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
@ -2340,6 +2659,14 @@ type_specifier_nonarray
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.setImage(EbtFloat, Esd2D, false, false, true); $$.sampler.setImage(EbtFloat, Esd2D, false, false, true);
} }
| F16IMAGE2DMS {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setImage(EbtFloat16, Esd2D, false, false, true);
#endif
}
| IIMAGE2DMS { | IIMAGE2DMS {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
@ -2355,6 +2682,14 @@ type_specifier_nonarray
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.setImage(EbtFloat, Esd2D, true, false, true); $$.sampler.setImage(EbtFloat, Esd2D, true, false, true);
} }
| F16IMAGE2DMSARRAY {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setImage(EbtFloat16, Esd2D, true, false, true);
#endif
}
| IIMAGE2DMSARRAY { | IIMAGE2DMSARRAY {
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
@ -2383,6 +2718,24 @@ type_specifier_nonarray
$$.basicType = EbtSampler; $$.basicType = EbtSampler;
$$.sampler.setSubpass(EbtFloat, true); $$.sampler.setSubpass(EbtFloat, true);
} }
| F16SUBPASSINPUT {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float subpass input", parseContext.symbolTable.atBuiltInLevel());
parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setSubpass(EbtFloat16);
#endif
}
| F16SUBPASSINPUTMS {
#ifdef AMD_EXTENSIONS
parseContext.float16OpaqueCheck($1.loc, "half float subpass input", parseContext.symbolTable.atBuiltInLevel());
parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setSubpass(EbtFloat16, true);
#endif
}
| ISUBPASSINPUT { | ISUBPASSINPUT {
parseContext.requireStage($1.loc, EShLangFragment, "subpass input"); parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
/* A Bison parser, made by GNU Bison 3.0. */ /* A Bison parser, made by GNU Bison 3.0.4. */
/* Bison interface for Yacc-like parsers in C /* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. Copyright (C) 1984, 1989-1990, 2000-2015 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
@ -30,8 +30,8 @@
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. */ /* Debug traces. */
#ifndef YYDEBUG #ifndef YYDEBUG
# define YYDEBUG 1 # define YYDEBUG 1
@ -197,158 +197,200 @@ extern int yydebug;
ISAMPLER2DMSARRAY = 407, ISAMPLER2DMSARRAY = 407,
USAMPLER2DMSARRAY = 408, USAMPLER2DMSARRAY = 408,
SAMPLEREXTERNALOES = 409, SAMPLEREXTERNALOES = 409,
SAMPLER = 410, F16SAMPLER1D = 410,
SAMPLERSHADOW = 411, F16SAMPLER2D = 411,
TEXTURE1D = 412, F16SAMPLER3D = 412,
TEXTURE2D = 413, F16SAMPLER2DRECT = 413,
TEXTURE3D = 414, F16SAMPLERCUBE = 414,
TEXTURECUBE = 415, F16SAMPLER1DARRAY = 415,
TEXTURE1DARRAY = 416, F16SAMPLER2DARRAY = 416,
TEXTURE2DARRAY = 417, F16SAMPLERCUBEARRAY = 417,
ITEXTURE1D = 418, F16SAMPLERBUFFER = 418,
ITEXTURE2D = 419, F16SAMPLER2DMS = 419,
ITEXTURE3D = 420, F16SAMPLER2DMSARRAY = 420,
ITEXTURECUBE = 421, F16SAMPLER1DSHADOW = 421,
ITEXTURE1DARRAY = 422, F16SAMPLER2DSHADOW = 422,
ITEXTURE2DARRAY = 423, F16SAMPLER1DARRAYSHADOW = 423,
UTEXTURE1D = 424, F16SAMPLER2DARRAYSHADOW = 424,
UTEXTURE2D = 425, F16SAMPLER2DRECTSHADOW = 425,
UTEXTURE3D = 426, F16SAMPLERCUBESHADOW = 426,
UTEXTURECUBE = 427, F16SAMPLERCUBEARRAYSHADOW = 427,
UTEXTURE1DARRAY = 428, SAMPLER = 428,
UTEXTURE2DARRAY = 429, SAMPLERSHADOW = 429,
TEXTURE2DRECT = 430, TEXTURE1D = 430,
ITEXTURE2DRECT = 431, TEXTURE2D = 431,
UTEXTURE2DRECT = 432, TEXTURE3D = 432,
TEXTUREBUFFER = 433, TEXTURECUBE = 433,
ITEXTUREBUFFER = 434, TEXTURE1DARRAY = 434,
UTEXTUREBUFFER = 435, TEXTURE2DARRAY = 435,
TEXTURECUBEARRAY = 436, ITEXTURE1D = 436,
ITEXTURECUBEARRAY = 437, ITEXTURE2D = 437,
UTEXTURECUBEARRAY = 438, ITEXTURE3D = 438,
TEXTURE2DMS = 439, ITEXTURECUBE = 439,
ITEXTURE2DMS = 440, ITEXTURE1DARRAY = 440,
UTEXTURE2DMS = 441, ITEXTURE2DARRAY = 441,
TEXTURE2DMSARRAY = 442, UTEXTURE1D = 442,
ITEXTURE2DMSARRAY = 443, UTEXTURE2D = 443,
UTEXTURE2DMSARRAY = 444, UTEXTURE3D = 444,
SUBPASSINPUT = 445, UTEXTURECUBE = 445,
SUBPASSINPUTMS = 446, UTEXTURE1DARRAY = 446,
ISUBPASSINPUT = 447, UTEXTURE2DARRAY = 447,
ISUBPASSINPUTMS = 448, TEXTURE2DRECT = 448,
USUBPASSINPUT = 449, ITEXTURE2DRECT = 449,
USUBPASSINPUTMS = 450, UTEXTURE2DRECT = 450,
IMAGE1D = 451, TEXTUREBUFFER = 451,
IIMAGE1D = 452, ITEXTUREBUFFER = 452,
UIMAGE1D = 453, UTEXTUREBUFFER = 453,
IMAGE2D = 454, TEXTURECUBEARRAY = 454,
IIMAGE2D = 455, ITEXTURECUBEARRAY = 455,
UIMAGE2D = 456, UTEXTURECUBEARRAY = 456,
IMAGE3D = 457, TEXTURE2DMS = 457,
IIMAGE3D = 458, ITEXTURE2DMS = 458,
UIMAGE3D = 459, UTEXTURE2DMS = 459,
IMAGE2DRECT = 460, TEXTURE2DMSARRAY = 460,
IIMAGE2DRECT = 461, ITEXTURE2DMSARRAY = 461,
UIMAGE2DRECT = 462, UTEXTURE2DMSARRAY = 462,
IMAGECUBE = 463, F16TEXTURE1D = 463,
IIMAGECUBE = 464, F16TEXTURE2D = 464,
UIMAGECUBE = 465, F16TEXTURE3D = 465,
IMAGEBUFFER = 466, F16TEXTURE2DRECT = 466,
IIMAGEBUFFER = 467, F16TEXTURECUBE = 467,
UIMAGEBUFFER = 468, F16TEXTURE1DARRAY = 468,
IMAGE1DARRAY = 469, F16TEXTURE2DARRAY = 469,
IIMAGE1DARRAY = 470, F16TEXTURECUBEARRAY = 470,
UIMAGE1DARRAY = 471, F16TEXTUREBUFFER = 471,
IMAGE2DARRAY = 472, F16TEXTURE2DMS = 472,
IIMAGE2DARRAY = 473, F16TEXTURE2DMSARRAY = 473,
UIMAGE2DARRAY = 474, SUBPASSINPUT = 474,
IMAGECUBEARRAY = 475, SUBPASSINPUTMS = 475,
IIMAGECUBEARRAY = 476, ISUBPASSINPUT = 476,
UIMAGECUBEARRAY = 477, ISUBPASSINPUTMS = 477,
IMAGE2DMS = 478, USUBPASSINPUT = 478,
IIMAGE2DMS = 479, USUBPASSINPUTMS = 479,
UIMAGE2DMS = 480, F16SUBPASSINPUT = 480,
IMAGE2DMSARRAY = 481, F16SUBPASSINPUTMS = 481,
IIMAGE2DMSARRAY = 482, IMAGE1D = 482,
UIMAGE2DMSARRAY = 483, IIMAGE1D = 483,
STRUCT = 484, UIMAGE1D = 484,
VOID = 485, IMAGE2D = 485,
WHILE = 486, IIMAGE2D = 486,
IDENTIFIER = 487, UIMAGE2D = 487,
TYPE_NAME = 488, IMAGE3D = 488,
FLOATCONSTANT = 489, IIMAGE3D = 489,
DOUBLECONSTANT = 490, UIMAGE3D = 490,
INTCONSTANT = 491, IMAGE2DRECT = 491,
UINTCONSTANT = 492, IIMAGE2DRECT = 492,
INT64CONSTANT = 493, UIMAGE2DRECT = 493,
UINT64CONSTANT = 494, IMAGECUBE = 494,
INT16CONSTANT = 495, IIMAGECUBE = 495,
UINT16CONSTANT = 496, UIMAGECUBE = 496,
BOOLCONSTANT = 497, IMAGEBUFFER = 497,
FLOAT16CONSTANT = 498, IIMAGEBUFFER = 498,
LEFT_OP = 499, UIMAGEBUFFER = 499,
RIGHT_OP = 500, IMAGE1DARRAY = 500,
INC_OP = 501, IIMAGE1DARRAY = 501,
DEC_OP = 502, UIMAGE1DARRAY = 502,
LE_OP = 503, IMAGE2DARRAY = 503,
GE_OP = 504, IIMAGE2DARRAY = 504,
EQ_OP = 505, UIMAGE2DARRAY = 505,
NE_OP = 506, IMAGECUBEARRAY = 506,
AND_OP = 507, IIMAGECUBEARRAY = 507,
OR_OP = 508, UIMAGECUBEARRAY = 508,
XOR_OP = 509, IMAGE2DMS = 509,
MUL_ASSIGN = 510, IIMAGE2DMS = 510,
DIV_ASSIGN = 511, UIMAGE2DMS = 511,
ADD_ASSIGN = 512, IMAGE2DMSARRAY = 512,
MOD_ASSIGN = 513, IIMAGE2DMSARRAY = 513,
LEFT_ASSIGN = 514, UIMAGE2DMSARRAY = 514,
RIGHT_ASSIGN = 515, F16IMAGE1D = 515,
AND_ASSIGN = 516, F16IMAGE2D = 516,
XOR_ASSIGN = 517, F16IMAGE3D = 517,
OR_ASSIGN = 518, F16IMAGE2DRECT = 518,
SUB_ASSIGN = 519, F16IMAGECUBE = 519,
LEFT_PAREN = 520, F16IMAGE1DARRAY = 520,
RIGHT_PAREN = 521, F16IMAGE2DARRAY = 521,
LEFT_BRACKET = 522, F16IMAGECUBEARRAY = 522,
RIGHT_BRACKET = 523, F16IMAGEBUFFER = 523,
LEFT_BRACE = 524, F16IMAGE2DMS = 524,
RIGHT_BRACE = 525, F16IMAGE2DMSARRAY = 525,
DOT = 526, STRUCT = 526,
COMMA = 527, VOID = 527,
COLON = 528, WHILE = 528,
EQUAL = 529, IDENTIFIER = 529,
SEMICOLON = 530, TYPE_NAME = 530,
BANG = 531, FLOATCONSTANT = 531,
DASH = 532, DOUBLECONSTANT = 532,
TILDE = 533, INTCONSTANT = 533,
PLUS = 534, UINTCONSTANT = 534,
STAR = 535, INT64CONSTANT = 535,
SLASH = 536, UINT64CONSTANT = 536,
PERCENT = 537, INT16CONSTANT = 537,
LEFT_ANGLE = 538, UINT16CONSTANT = 538,
RIGHT_ANGLE = 539, BOOLCONSTANT = 539,
VERTICAL_BAR = 540, FLOAT16CONSTANT = 540,
CARET = 541, LEFT_OP = 541,
AMPERSAND = 542, RIGHT_OP = 542,
QUESTION = 543, INC_OP = 543,
INVARIANT = 544, DEC_OP = 544,
PRECISE = 545, LE_OP = 545,
HIGH_PRECISION = 546, GE_OP = 546,
MEDIUM_PRECISION = 547, EQ_OP = 547,
LOW_PRECISION = 548, NE_OP = 548,
PRECISION = 549, AND_OP = 549,
PACKED = 550, OR_OP = 550,
RESOURCE = 551, XOR_OP = 551,
SUPERP = 552 MUL_ASSIGN = 552,
DIV_ASSIGN = 553,
ADD_ASSIGN = 554,
MOD_ASSIGN = 555,
LEFT_ASSIGN = 556,
RIGHT_ASSIGN = 557,
AND_ASSIGN = 558,
XOR_ASSIGN = 559,
OR_ASSIGN = 560,
SUB_ASSIGN = 561,
LEFT_PAREN = 562,
RIGHT_PAREN = 563,
LEFT_BRACKET = 564,
RIGHT_BRACKET = 565,
LEFT_BRACE = 566,
RIGHT_BRACE = 567,
DOT = 568,
COMMA = 569,
COLON = 570,
EQUAL = 571,
SEMICOLON = 572,
BANG = 573,
DASH = 574,
TILDE = 575,
PLUS = 576,
STAR = 577,
SLASH = 578,
PERCENT = 579,
LEFT_ANGLE = 580,
RIGHT_ANGLE = 581,
VERTICAL_BAR = 582,
CARET = 583,
AMPERSAND = 584,
QUESTION = 585,
INVARIANT = 586,
PRECISE = 587,
HIGH_PRECISION = 588,
MEDIUM_PRECISION = 589,
LOW_PRECISION = 590,
PRECISION = 591,
PACKED = 592,
RESOURCE = 593,
SUPERP = 594
}; };
#endif #endif
/* Value type. */ /* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE YYSTYPE;
union YYSTYPE union YYSTYPE
{ {
#line 69 "MachineIndependent/glslang.y" /* yacc.c:1909 */ #line 69 "glslang.y" /* yacc.c:1909 */
struct { struct {
glslang::TSourceLoc loc; glslang::TSourceLoc loc;
@ -383,8 +425,10 @@ union YYSTYPE
}; };
} interm; } interm;
#line 387 "MachineIndependent/glslang_tab.cpp.h" /* yacc.c:1909 */ #line 429 "glslang_tab.cpp.h" /* yacc.c:1909 */
}; };
typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_DECLARED 1
#endif #endif
@ -393,4 +437,4 @@ union YYSTYPE
int yyparse (glslang::TParseContext* pParseContext); int yyparse (glslang::TParseContext* pParseContext);
#endif /* !YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED */ #endif /* !YY_YY_GLSLANG_TAB_CPP_H_INCLUDED */

View File

@ -80,6 +80,7 @@ public:
#ifdef AMD_EXTENSIONS #ifdef AMD_EXTENSIONS
virtual void int16Check(const TSourceLoc& loc, const char* op, bool builtIn = false); virtual void int16Check(const TSourceLoc& loc, const char* op, bool builtIn = false);
virtual void float16Check(const TSourceLoc&, const char* op, bool builtIn = false); virtual void float16Check(const TSourceLoc&, const char* op, bool builtIn = false);
virtual void float16OpaqueCheck(const TSourceLoc&, const char* op, bool builtIn = false);
#endif #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);

View File

@ -415,6 +415,36 @@ public:
case EsdBuffer: case EsdBuffer:
return GL_SAMPLER_BUFFER; return GL_SAMPLER_BUFFER;
} }
#ifdef AMD_EXTENSIONS
case EbtFloat16:
switch ((int)sampler.dim) {
case Esd1D:
switch ((int)sampler.shadow) {
case false: return sampler.arrayed ? GL_FLOAT16_SAMPLER_1D_ARRAY_AMD : GL_FLOAT16_SAMPLER_1D_AMD;
case true: return sampler.arrayed ? GL_FLOAT16_SAMPLER_1D_ARRAY_SHADOW_AMD : GL_FLOAT16_SAMPLER_1D_SHADOW_AMD;
}
case Esd2D:
switch ((int)sampler.ms) {
case false:
switch ((int)sampler.shadow) {
case false: return sampler.arrayed ? GL_FLOAT16_SAMPLER_2D_ARRAY_AMD : GL_FLOAT16_SAMPLER_2D_AMD;
case true: return sampler.arrayed ? GL_FLOAT16_SAMPLER_2D_ARRAY_SHADOW_AMD : GL_FLOAT16_SAMPLER_2D_SHADOW_AMD;
}
case true: return sampler.arrayed ? GL_FLOAT16_SAMPLER_2D_MULTISAMPLE_ARRAY_AMD : GL_FLOAT16_SAMPLER_2D_MULTISAMPLE_AMD;
}
case Esd3D:
return GL_FLOAT16_SAMPLER_3D_AMD;
case EsdCube:
switch ((int)sampler.shadow) {
case false: return sampler.arrayed ? GL_FLOAT16_SAMPLER_CUBE_MAP_ARRAY_AMD : GL_FLOAT16_SAMPLER_CUBE_AMD;
case true: return sampler.arrayed ? GL_FLOAT16_SAMPLER_CUBE_MAP_ARRAY_SHADOW_AMD : GL_FLOAT16_SAMPLER_CUBE_SHADOW_AMD;
}
case EsdRect:
return sampler.shadow ? GL_FLOAT16_SAMPLER_2D_RECT_SHADOW_AMD : GL_FLOAT16_SAMPLER_2D_RECT_AMD;
case EsdBuffer:
return GL_FLOAT16_SAMPLER_BUFFER_AMD;
}
#endif
case EbtInt: case EbtInt:
switch ((int)sampler.dim) { switch ((int)sampler.dim) {
case Esd1D: case Esd1D:
@ -477,6 +507,26 @@ public:
case EsdBuffer: case EsdBuffer:
return GL_IMAGE_BUFFER; return GL_IMAGE_BUFFER;
} }
#ifdef AMD_EXTENSIONS
case EbtFloat16:
switch ((int)sampler.dim) {
case Esd1D:
return sampler.arrayed ? GL_FLOAT16_IMAGE_1D_ARRAY_AMD : GL_FLOAT16_IMAGE_1D_AMD;
case Esd2D:
switch ((int)sampler.ms) {
case false: return sampler.arrayed ? GL_FLOAT16_IMAGE_2D_ARRAY_AMD : GL_FLOAT16_IMAGE_2D_AMD;
case true: return sampler.arrayed ? GL_FLOAT16_IMAGE_2D_MULTISAMPLE_ARRAY_AMD : GL_FLOAT16_IMAGE_2D_MULTISAMPLE_AMD;
}
case Esd3D:
return GL_FLOAT16_IMAGE_3D_AMD;
case EsdCube:
return sampler.arrayed ? GL_FLOAT16_IMAGE_CUBE_MAP_ARRAY_AMD : GL_FLOAT16_IMAGE_CUBE_AMD;
case EsdRect:
return GL_FLOAT16_IMAGE_2D_RECT_AMD;
case EsdBuffer:
return GL_FLOAT16_IMAGE_BUFFER_AMD;
}
#endif
case EbtInt: case EbtInt:
switch ((int)sampler.dim) { switch ((int)sampler.dim) {
case Esd1D: case Esd1D:

View File

@ -419,6 +419,7 @@ INSTANTIATE_TEST_CASE_P(
Glsl, CompileVulkanToSpirvTestAMD, Glsl, CompileVulkanToSpirvTestAMD,
::testing::ValuesIn(std::vector<std::string>({ ::testing::ValuesIn(std::vector<std::string>({
"spv.float16.frag", "spv.float16.frag",
"spv.float16Fetch.frag",
"spv.imageLoadStoreLod.frag", "spv.imageLoadStoreLod.frag",
"spv.int16.frag", "spv.int16.frag",
"spv.shaderBallotAMD.comp", "spv.shaderBallotAMD.comp",