Commit efe17cda by John Kessenich

Merge remote-tracking branch 'GitHub/master'

parents a9090917 b5b5f918
...@@ -14,6 +14,7 @@ set(HEADERS ...@@ -14,6 +14,7 @@ set(HEADERS
bitutils.h bitutils.h
spirv.hpp spirv.hpp
GLSL.std.450.h GLSL.std.450.h
GLSL.ext.EXT.h
GLSL.ext.KHR.h GLSL.ext.KHR.h
GlslangToSpv.h GlslangToSpv.h
hex_float.h hex_float.h
......
...@@ -27,13 +27,8 @@ ...@@ -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,7 @@ static const char* const E_SPV_AMD_shader_image_load_store_lod = "SPV_AMD_shader ...@@ -107,4 +102,7 @@ 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";
#endif // #ifndef GLSLextAMD_H #endif // #ifndef GLSLextAMD_H
...@@ -27,13 +27,11 @@ ...@@ -27,13 +27,11 @@
#ifndef GLSLextEXT_H #ifndef GLSLextEXT_H
#define GLSLextEXT_H #define GLSLextEXT_H
enum BuiltIn;
enum Op;
enum Capability;
static const int GLSLextEXTVersion = 100; static const int GLSLextEXTVersion = 100;
static const int GLSLextEXTRevision = 1; static const int GLSLextEXTRevision = 1;
static const char* const E_SPV_EXT_shader_stencil_export = "SPV_EXT_shader_stencil_export";
static const char* const E_SPV_EXT_shader_viewport_index_layer = "SPV_EXT_shader_viewport_index_layer";
static const char* const E_SPV_EXT_fragment_fully_covered = "SPV_EXT_fragment_fully_covered"; static const char* const E_SPV_EXT_fragment_fully_covered = "SPV_EXT_fragment_fully_covered";
#endif // #ifndef GLSLextEXT_H #endif // #ifndef GLSLextEXT_H
...@@ -27,10 +27,6 @@ ...@@ -27,10 +27,6 @@
#ifndef GLSLextKHR_H #ifndef GLSLextKHR_H
#define GLSLextKHR_H #define GLSLextKHR_H
enum BuiltIn;
enum Op;
enum Capability;
static const int GLSLextKHRVersion = 100; static const int GLSLextKHRVersion = 100;
static const int GLSLextKHRRevision = 2; static const int GLSLextKHRRevision = 2;
...@@ -42,7 +38,5 @@ static const char* const E_SPV_KHR_shader_draw_parameters = "SPV_KHR_shade ...@@ -42,7 +38,5 @@ static const char* const E_SPV_KHR_shader_draw_parameters = "SPV_KHR_shade
static const char* const E_SPV_KHR_16bit_storage = "SPV_KHR_16bit_storage"; static const char* const E_SPV_KHR_16bit_storage = "SPV_KHR_16bit_storage";
static const char* const E_SPV_KHR_storage_buffer_storage_class = "SPV_KHR_storage_buffer_storage_class"; static const char* const E_SPV_KHR_storage_buffer_storage_class = "SPV_KHR_storage_buffer_storage_class";
static const char* const E_SPV_KHR_post_depth_coverage = "SPV_KHR_post_depth_coverage"; static const char* const E_SPV_KHR_post_depth_coverage = "SPV_KHR_post_depth_coverage";
static const char* const E_SPV_EXT_shader_stencil_export = "SPV_EXT_shader_stencil_export";
static const char* const E_SPV_EXT_shader_viewport_index_layer = "SPV_EXT_shader_viewport_index_layer";
#endif // #ifndef GLSLextKHR_H #endif // #ifndef GLSLextKHR_H
...@@ -2391,6 +2391,12 @@ spv::Id TGlslangToSpvTraverser::getSampledType(const glslang::TSampler& sampler) ...@@ -2391,6 +2391,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:
...@@ -3226,9 +3232,15 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate& ...@@ -3226,9 +3232,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) {
...@@ -3253,6 +3265,21 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate& ...@@ -3253,6 +3265,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;
...@@ -3266,6 +3293,7 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate& ...@@ -3266,6 +3293,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;
...@@ -3274,6 +3302,23 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate& ...@@ -3274,6 +3302,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:
...@@ -3289,6 +3334,7 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate& ...@@ -3289,6 +3334,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;
...@@ -3341,6 +3387,12 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO ...@@ -3341,6 +3387,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);
...@@ -3584,6 +3636,9 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO ...@@ -3584,6 +3636,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;
...@@ -3627,7 +3682,11 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO ...@@ -3627,7 +3682,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) {
......
...@@ -1750,7 +1750,11 @@ Id Builder::createTextureQueryCall(Op opCode, const TextureParameters& parameter ...@@ -1750,7 +1750,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:
......
...@@ -858,6 +858,7 @@ const char* CapabilityString(int info) ...@@ -858,6 +858,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";
......
...@@ -393,6 +393,8 @@ enum Decoration { ...@@ -393,6 +393,8 @@ enum Decoration {
DecorationPassthroughNV = 5250, DecorationPassthroughNV = 5250,
DecorationViewportRelativeNV = 5252, DecorationViewportRelativeNV = 5252,
DecorationSecondaryViewportRelativeNV = 5256, DecorationSecondaryViewportRelativeNV = 5256,
DecorationHlslCounterBufferGOOGLE = 5634,
DecorationHlslSemanticGOOGLE = 5635,
DecorationMax = 0x7fffffff, DecorationMax = 0x7fffffff,
}; };
...@@ -673,6 +675,7 @@ enum Capability { ...@@ -673,6 +675,7 @@ enum Capability {
CapabilityVariablePointers = 4442, CapabilityVariablePointers = 4442,
CapabilityAtomicStorageOps = 4445, CapabilityAtomicStorageOps = 4445,
CapabilitySampleMaskPostDepthCoverage = 4447, CapabilitySampleMaskPostDepthCoverage = 4447,
CapabilityFloat16ImageAMD = 5008,
CapabilityImageGatherBiasLodAMD = 5009, CapabilityImageGatherBiasLodAMD = 5009,
CapabilityFragmentMaskAMD = 5010, CapabilityFragmentMaskAMD = 5010,
CapabilityStencilExportEXT = 5013, CapabilityStencilExportEXT = 5013,
...@@ -1056,6 +1059,8 @@ enum Op { ...@@ -1056,6 +1059,8 @@ enum Op {
OpSubgroupBlockWriteINTEL = 5576, OpSubgroupBlockWriteINTEL = 5576,
OpSubgroupImageBlockReadINTEL = 5577, OpSubgroupImageBlockReadINTEL = 5577,
OpSubgroupImageBlockWriteINTEL = 5578, OpSubgroupImageBlockWriteINTEL = 5578,
OpDecorateStringGOOGLE = 5632,
OpMemberDecorateStringGOOGLE = 5633,
OpMax = 0x7fffffff, OpMax = 0x7fffffff,
}; };
......
...@@ -584,7 +584,7 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem ...@@ -584,7 +584,7 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
case 'V': case 'V':
setVulkanSpv(); setVulkanSpv();
if (argv[0][2] != 0) if (argv[0][2] != 0)
ClientInputSemanticsVersion = getAttachedNumber("-G<num> client input semantics"); ClientInputSemanticsVersion = getAttachedNumber("-V<num> client input semantics");
break; break;
case 'c': case 'c':
Options |= EOptionDumpConfig; Options |= EOptionDumpConfig;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -206,6 +206,9 @@ struct TSampler { // misnomer now; includes images, textures without sampler, ...@@ -206,6 +206,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 EbtInt8: s.append("i8"); break; case EbtInt8: s.append("i8"); break;
case EbtUint16: s.append("u8"); break; case EbtUint16: s.append("u8"); break;
case EbtInt16: s.append("i16"); break; case EbtInt16: s.append("i16"); break;
......
...@@ -1521,6 +1521,12 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan ...@@ -1521,6 +1521,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 {
......
...@@ -630,6 +630,54 @@ void TScanContext::fillInKeywordMap() ...@@ -630,6 +630,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;
...@@ -1165,6 +1213,7 @@ int TScanContext::tokenizeIdentifier() ...@@ -1165,6 +1213,7 @@ int TScanContext::tokenizeIdentifier()
parseContext.extensionTurnedOn(E_GL_KHX_shader_explicit_arithmetic_types) || parseContext.extensionTurnedOn(E_GL_KHX_shader_explicit_arithmetic_types) ||
parseContext.extensionTurnedOn(E_GL_KHX_shader_explicit_arithmetic_types_float16)))) parseContext.extensionTurnedOn(E_GL_KHX_shader_explicit_arithmetic_types_float16))))
return keyword; return keyword;
return identifierOrType(); return identifierOrType();
case SAMPLERCUBEARRAY: case SAMPLERCUBEARRAY:
...@@ -1330,7 +1379,7 @@ int TScanContext::tokenizeIdentifier() ...@@ -1330,7 +1379,7 @@ int TScanContext::tokenizeIdentifier()
case TEXTURE1DARRAY: case TEXTURE1DARRAY:
case SAMPLER: case SAMPLER:
case SAMPLERSHADOW: case SAMPLERSHADOW:
if (parseContext.spvVersion.vulkan >= 100) if (parseContext.spvVersion.vulkan > 0)
return keyword; return keyword;
else else
return identifierOrType(); return identifierOrType();
...@@ -1341,11 +1390,65 @@ int TScanContext::tokenizeIdentifier() ...@@ -1341,11 +1390,65 @@ int TScanContext::tokenizeIdentifier()
case ISUBPASSINPUTMS: case ISUBPASSINPUTMS:
case USUBPASSINPUT: case USUBPASSINPUT:
case USUBPASSINPUTMS: case USUBPASSINPUTMS:
if (parseContext.spvVersion.vulkan >= 100) if (parseContext.spvVersion.vulkan > 0)
return keyword; return keyword;
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);
......
...@@ -578,7 +578,7 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo ...@@ -578,7 +578,7 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
if (spvVersion.spv != 0) { if (spvVersion.spv != 0) {
switch (profile) { switch (profile) {
case EEsProfile: case EEsProfile:
if (spvVersion.vulkan >= 100 && version < 310) { if (spvVersion.vulkan > 0 && version < 310) {
correct = false; correct = false;
infoSink.info.message(EPrefixError, "#version: ES shaders for Vulkan SPIR-V require version 310 or higher"); infoSink.info.message(EPrefixError, "#version: ES shaders for Vulkan SPIR-V require version 310 or higher");
version = 310; version = 310;
...@@ -593,7 +593,7 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo ...@@ -593,7 +593,7 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
infoSink.info.message(EPrefixError, "#version: compilation for SPIR-V does not support the compatibility profile"); infoSink.info.message(EPrefixError, "#version: compilation for SPIR-V does not support the compatibility profile");
break; break;
default: default:
if (spvVersion.vulkan >= 100 && version < 140) { if (spvVersion.vulkan > 0 && version < 140) {
correct = false; correct = false;
infoSink.info.message(EPrefixError, "#version: Desktop shaders for Vulkan SPIR-V require version 140 or higher"); infoSink.info.message(EPrefixError, "#version: Desktop shaders for Vulkan SPIR-V require version 140 or higher");
version = 140; version = 140;
...@@ -814,7 +814,7 @@ bool ProcessDeferred( ...@@ -814,7 +814,7 @@ bool ProcessDeferred(
intermediate.setProfile(profile); intermediate.setProfile(profile);
intermediate.setSpv(spvVersion); intermediate.setSpv(spvVersion);
RecordProcesses(intermediate, messages, sourceEntryPointName); RecordProcesses(intermediate, messages, sourceEntryPointName);
if (spvVersion.vulkan >= 100) if (spvVersion.vulkan > 0)
intermediate.setOriginUpperLeft(); intermediate.setOriginUpperLeft();
if ((messages & EShMsgHlslOffsets) || source == EShSourceHlsl) if ((messages & EShMsgHlslOffsets) || source == EShSourceHlsl)
intermediate.setHlslOffsets(); intermediate.setHlslOffsets();
......
...@@ -74,6 +74,9 @@ void TType::buildMangledName(TString& mangledName) const ...@@ -74,6 +74,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
......
...@@ -214,6 +214,7 @@ void TParseVersions::initializeExtensionBehavior() ...@@ -214,6 +214,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
...@@ -371,6 +372,7 @@ void TParseVersions::getPreamble(std::string& preamble) ...@@ -371,6 +372,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
...@@ -856,6 +858,19 @@ void TParseVersions::explicitInt8Check(const TSourceLoc& loc, const char* op, bo ...@@ -856,6 +858,19 @@ void TParseVersions::explicitInt8Check(const TSourceLoc& loc, const char* op, bo
} }
} }
#ifdef AMD_EXTENSIONS
// 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);
profileRequires(loc, ECoreProfile, 450, nullptr, op);
profileRequires(loc, ECompatibilityProfile, 450, nullptr, op);
}
}
#endif
// Call for any operation needing GLSL explicit int16 data-type support. // Call for any operation needing GLSL explicit int16 data-type support.
void TParseVersions::explicitInt16Check(const TSourceLoc& loc, const char* op, bool builtIn) void TParseVersions::explicitInt16Check(const TSourceLoc& loc, const char* op, bool builtIn)
{ {
...@@ -912,7 +927,7 @@ void TParseVersions::spvRemoved(const TSourceLoc& loc, const char* op) ...@@ -912,7 +927,7 @@ void TParseVersions::spvRemoved(const TSourceLoc& loc, const char* op)
// Call for any operation removed because Vulkan SPIR-V is being generated. // Call for any operation removed because Vulkan SPIR-V is being generated.
void TParseVersions::vulkanRemoved(const TSourceLoc& loc, const char* op) void TParseVersions::vulkanRemoved(const TSourceLoc& loc, const char* op)
{ {
if (spvVersion.vulkan >= 100) if (spvVersion.vulkan > 0)
error(loc, "not allowed when using GLSL for Vulkan", op, ""); error(loc, "not allowed when using GLSL for Vulkan", op, "");
} }
......
...@@ -84,7 +84,7 @@ struct SpvVersion { ...@@ -84,7 +84,7 @@ struct SpvVersion {
SpvVersion() : spv(0), vulkanGlsl(0), vulkan(0), openGl(0) {} SpvVersion() : spv(0), vulkanGlsl(0), vulkan(0), openGl(0) {}
unsigned int spv; // the version of SPIR-V to target, as defined by "word 1" of the SPIR-V binary header unsigned int spv; // the version of SPIR-V to target, as defined by "word 1" of the SPIR-V binary header
int vulkanGlsl; // the version of GLSL semantics for Vulkan, from GL_KHR_vulkan_glsl, for "#define VULKAN XXX" int vulkanGlsl; // the version of GLSL semantics for Vulkan, from GL_KHR_vulkan_glsl, for "#define VULKAN XXX"
int vulkan; // the version of Vulkan, for which SPIR-V execution environment rules to use (100 means 1.0) int vulkan; // the version of Vulkan, for which SPIR-V execution environment rules to use
int openGl; // the version of GLSL semantics for OpenGL, from GL_ARB_gl_spirv, for "#define GL_SPIRV XXX" int openGl; // the version of GLSL semantics for OpenGL, from GL_ARB_gl_spirv, for "#define GL_SPIRV XXX"
}; };
...@@ -184,6 +184,7 @@ const char* const E_GL_AMD_texture_gather_bias_lod = "GL_AMD_textur ...@@ -184,6 +184,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
......
...@@ -117,6 +117,40 @@ ...@@ -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
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -245,151 +245,193 @@ extern int yydebug; ...@@ -245,151 +245,193 @@ extern int yydebug;
ISAMPLER2DMSARRAY = 455, ISAMPLER2DMSARRAY = 455,
USAMPLER2DMSARRAY = 456, USAMPLER2DMSARRAY = 456,
SAMPLEREXTERNALOES = 457, SAMPLEREXTERNALOES = 457,
SAMPLER = 458, F16SAMPLER1D = 458,
SAMPLERSHADOW = 459, F16SAMPLER2D = 459,
TEXTURE1D = 460, F16SAMPLER3D = 460,
TEXTURE2D = 461, F16SAMPLER2DRECT = 461,
TEXTURE3D = 462, F16SAMPLERCUBE = 462,
TEXTURECUBE = 463, F16SAMPLER1DARRAY = 463,
TEXTURE1DARRAY = 464, F16SAMPLER2DARRAY = 464,
TEXTURE2DARRAY = 465, F16SAMPLERCUBEARRAY = 465,
ITEXTURE1D = 466, F16SAMPLERBUFFER = 466,
ITEXTURE2D = 467, F16SAMPLER2DMS = 467,
ITEXTURE3D = 468, F16SAMPLER2DMSARRAY = 468,
ITEXTURECUBE = 469, F16SAMPLER1DSHADOW = 469,
ITEXTURE1DARRAY = 470, F16SAMPLER2DSHADOW = 470,
ITEXTURE2DARRAY = 471, F16SAMPLER1DARRAYSHADOW = 471,
UTEXTURE1D = 472, F16SAMPLER2DARRAYSHADOW = 472,
UTEXTURE2D = 473, F16SAMPLER2DRECTSHADOW = 473,
UTEXTURE3D = 474, F16SAMPLERCUBESHADOW = 474,
UTEXTURECUBE = 475, F16SAMPLERCUBEARRAYSHADOW = 475,
UTEXTURE1DARRAY = 476, SAMPLER = 476,
UTEXTURE2DARRAY = 477, SAMPLERSHADOW = 477,
TEXTURE2DRECT = 478, TEXTURE1D = 478,
ITEXTURE2DRECT = 479, TEXTURE2D = 479,
UTEXTURE2DRECT = 480, TEXTURE3D = 480,
TEXTUREBUFFER = 481, TEXTURECUBE = 481,
ITEXTUREBUFFER = 482, TEXTURE1DARRAY = 482,
UTEXTUREBUFFER = 483, TEXTURE2DARRAY = 483,
TEXTURECUBEARRAY = 484, ITEXTURE1D = 484,
ITEXTURECUBEARRAY = 485, ITEXTURE2D = 485,
UTEXTURECUBEARRAY = 486, ITEXTURE3D = 486,
TEXTURE2DMS = 487, ITEXTURECUBE = 487,
ITEXTURE2DMS = 488, ITEXTURE1DARRAY = 488,
UTEXTURE2DMS = 489, ITEXTURE2DARRAY = 489,
TEXTURE2DMSARRAY = 490, UTEXTURE1D = 490,
ITEXTURE2DMSARRAY = 491, UTEXTURE2D = 491,
UTEXTURE2DMSARRAY = 492, UTEXTURE3D = 492,
SUBPASSINPUT = 493, UTEXTURECUBE = 493,
SUBPASSINPUTMS = 494, UTEXTURE1DARRAY = 494,
ISUBPASSINPUT = 495, UTEXTURE2DARRAY = 495,
ISUBPASSINPUTMS = 496, TEXTURE2DRECT = 496,
USUBPASSINPUT = 497, ITEXTURE2DRECT = 497,
USUBPASSINPUTMS = 498, UTEXTURE2DRECT = 498,
IMAGE1D = 499, TEXTUREBUFFER = 499,
IIMAGE1D = 500, ITEXTUREBUFFER = 500,
UIMAGE1D = 501, UTEXTUREBUFFER = 501,
IMAGE2D = 502, TEXTURECUBEARRAY = 502,
IIMAGE2D = 503, ITEXTURECUBEARRAY = 503,
UIMAGE2D = 504, UTEXTURECUBEARRAY = 504,
IMAGE3D = 505, TEXTURE2DMS = 505,
IIMAGE3D = 506, ITEXTURE2DMS = 506,
UIMAGE3D = 507, UTEXTURE2DMS = 507,
IMAGE2DRECT = 508, TEXTURE2DMSARRAY = 508,
IIMAGE2DRECT = 509, ITEXTURE2DMSARRAY = 509,
UIMAGE2DRECT = 510, UTEXTURE2DMSARRAY = 510,
IMAGECUBE = 511, F16TEXTURE1D = 511,
IIMAGECUBE = 512, F16TEXTURE2D = 512,
UIMAGECUBE = 513, F16TEXTURE3D = 513,
IMAGEBUFFER = 514, F16TEXTURE2DRECT = 514,
IIMAGEBUFFER = 515, F16TEXTURECUBE = 515,
UIMAGEBUFFER = 516, F16TEXTURE1DARRAY = 516,
IMAGE1DARRAY = 517, F16TEXTURE2DARRAY = 517,
IIMAGE1DARRAY = 518, F16TEXTURECUBEARRAY = 518,
UIMAGE1DARRAY = 519, F16TEXTUREBUFFER = 519,
IMAGE2DARRAY = 520, F16TEXTURE2DMS = 520,
IIMAGE2DARRAY = 521, F16TEXTURE2DMSARRAY = 521,
UIMAGE2DARRAY = 522, SUBPASSINPUT = 522,
IMAGECUBEARRAY = 523, SUBPASSINPUTMS = 523,
IIMAGECUBEARRAY = 524, ISUBPASSINPUT = 524,
UIMAGECUBEARRAY = 525, ISUBPASSINPUTMS = 525,
IMAGE2DMS = 526, USUBPASSINPUT = 526,
IIMAGE2DMS = 527, USUBPASSINPUTMS = 527,
UIMAGE2DMS = 528, F16SUBPASSINPUT = 528,
IMAGE2DMSARRAY = 529, F16SUBPASSINPUTMS = 529,
IIMAGE2DMSARRAY = 530, IMAGE1D = 530,
UIMAGE2DMSARRAY = 531, IIMAGE1D = 531,
STRUCT = 532, UIMAGE1D = 532,
VOID = 533, IMAGE2D = 533,
WHILE = 534, IIMAGE2D = 534,
IDENTIFIER = 535, UIMAGE2D = 535,
TYPE_NAME = 536, IMAGE3D = 536,
FLOATCONSTANT = 537, IIMAGE3D = 537,
DOUBLECONSTANT = 538, UIMAGE3D = 538,
INT16CONSTANT = 539, IMAGE2DRECT = 539,
UINT16CONSTANT = 540, IIMAGE2DRECT = 540,
INT32CONSTANT = 541, UIMAGE2DRECT = 541,
UINT32CONSTANT = 542, IMAGECUBE = 542,
INTCONSTANT = 543, IIMAGECUBE = 543,
UINTCONSTANT = 544, UIMAGECUBE = 544,
INT64CONSTANT = 545, IMAGEBUFFER = 545,
UINT64CONSTANT = 546, IIMAGEBUFFER = 546,
BOOLCONSTANT = 547, UIMAGEBUFFER = 547,
FLOAT16CONSTANT = 548, IMAGE1DARRAY = 548,
LEFT_OP = 549, IIMAGE1DARRAY = 549,
RIGHT_OP = 550, UIMAGE1DARRAY = 550,
INC_OP = 551, IMAGE2DARRAY = 551,
DEC_OP = 552, IIMAGE2DARRAY = 552,
LE_OP = 553, UIMAGE2DARRAY = 553,
GE_OP = 554, IMAGECUBEARRAY = 554,
EQ_OP = 555, IIMAGECUBEARRAY = 555,
NE_OP = 556, UIMAGECUBEARRAY = 556,
AND_OP = 557, IMAGE2DMS = 557,
OR_OP = 558, IIMAGE2DMS = 558,
XOR_OP = 559, UIMAGE2DMS = 559,
MUL_ASSIGN = 560, IMAGE2DMSARRAY = 560,
DIV_ASSIGN = 561, IIMAGE2DMSARRAY = 561,
ADD_ASSIGN = 562, UIMAGE2DMSARRAY = 562,
MOD_ASSIGN = 563, F16IMAGE1D = 563,
LEFT_ASSIGN = 564, F16IMAGE2D = 564,
RIGHT_ASSIGN = 565, F16IMAGE3D = 565,
AND_ASSIGN = 566, F16IMAGE2DRECT = 566,
XOR_ASSIGN = 567, F16IMAGECUBE = 567,
OR_ASSIGN = 568, F16IMAGE1DARRAY = 568,
SUB_ASSIGN = 569, F16IMAGE2DARRAY = 569,
LEFT_PAREN = 570, F16IMAGECUBEARRAY = 570,
RIGHT_PAREN = 571, F16IMAGEBUFFER = 571,
LEFT_BRACKET = 572, F16IMAGE2DMS = 572,
RIGHT_BRACKET = 573, F16IMAGE2DMSARRAY = 573,
LEFT_BRACE = 574, STRUCT = 574,
RIGHT_BRACE = 575, VOID = 575,
DOT = 576, WHILE = 576,
COMMA = 577, IDENTIFIER = 577,
COLON = 578, TYPE_NAME = 578,
EQUAL = 579, FLOATCONSTANT = 579,
SEMICOLON = 580, DOUBLECONSTANT = 580,
BANG = 581, INT16CONSTANT = 581,
DASH = 582, UINT16CONSTANT = 582,
TILDE = 583, INT32CONSTANT = 583,
PLUS = 584, UINT32CONSTANT = 584,
STAR = 585, INTCONSTANT = 585,
SLASH = 586, UINTCONSTANT = 586,
PERCENT = 587, INT64CONSTANT = 587,
LEFT_ANGLE = 588, UINT64CONSTANT = 588,
RIGHT_ANGLE = 589, BOOLCONSTANT = 589,
VERTICAL_BAR = 590, FLOAT16CONSTANT = 590,
CARET = 591, LEFT_OP = 591,
AMPERSAND = 592, RIGHT_OP = 592,
QUESTION = 593, INC_OP = 593,
INVARIANT = 594, DEC_OP = 594,
PRECISE = 595, LE_OP = 595,
HIGH_PRECISION = 596, GE_OP = 596,
MEDIUM_PRECISION = 597, EQ_OP = 597,
LOW_PRECISION = 598, NE_OP = 598,
PRECISION = 599, AND_OP = 599,
PACKED = 600, OR_OP = 600,
RESOURCE = 601, XOR_OP = 601,
SUPERP = 602 MUL_ASSIGN = 602,
DIV_ASSIGN = 603,
ADD_ASSIGN = 604,
MOD_ASSIGN = 605,
LEFT_ASSIGN = 606,
RIGHT_ASSIGN = 607,
AND_ASSIGN = 608,
XOR_ASSIGN = 609,
OR_ASSIGN = 610,
SUB_ASSIGN = 611,
LEFT_PAREN = 612,
RIGHT_PAREN = 613,
LEFT_BRACKET = 614,
RIGHT_BRACKET = 615,
LEFT_BRACE = 616,
RIGHT_BRACE = 617,
DOT = 618,
COMMA = 619,
COLON = 620,
EQUAL = 621,
SEMICOLON = 622,
BANG = 623,
DASH = 624,
TILDE = 625,
PLUS = 626,
STAR = 627,
SLASH = 628,
PERCENT = 629,
LEFT_ANGLE = 630,
RIGHT_ANGLE = 631,
VERTICAL_BAR = 632,
CARET = 633,
AMPERSAND = 634,
QUESTION = 635,
INVARIANT = 636,
PRECISE = 637,
HIGH_PRECISION = 638,
MEDIUM_PRECISION = 639,
LOW_PRECISION = 640,
PRECISION = 641,
PACKED = 642,
RESOURCE = 643,
SUPERP = 644
}; };
#endif #endif
...@@ -433,7 +475,7 @@ union YYSTYPE ...@@ -433,7 +475,7 @@ union YYSTYPE
}; };
} interm; } interm;
#line 437 "MachineIndependent/glslang_tab.cpp.h" /* yacc.c:1909 */ #line 479 "MachineIndependent/glslang_tab.cpp.h" /* yacc.c:1909 */
}; };
# define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_DECLARED 1
......
...@@ -379,7 +379,7 @@ public: ...@@ -379,7 +379,7 @@ public:
processes.addProcess("client opengl100"); processes.addProcess("client opengl100");
// target-environment processes // target-environment processes
if (spvVersion.vulkan == 100) if (spvVersion.vulkan > 0)
processes.addProcess("target-env vulkan1.0"); processes.addProcess("target-env vulkan1.0");
else if (spvVersion.vulkan > 0) else if (spvVersion.vulkan > 0)
processes.addProcess("target-env vulkanUnknown"); processes.addProcess("target-env vulkanUnknown");
......
...@@ -79,6 +79,9 @@ public: ...@@ -79,6 +79,9 @@ public:
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);
virtual void float16Check(const TSourceLoc&, const char* op, bool builtIn = false); virtual void float16Check(const TSourceLoc&, const char* op, bool builtIn = false);
#ifdef AMD_EXTENSIONS
virtual void float16OpaqueCheck(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 explicitInt8Check(const TSourceLoc&, const char* op, bool builtIn = false); virtual void explicitInt8Check(const TSourceLoc&, const char* op, bool builtIn = false);
virtual void explicitInt16Check(const TSourceLoc&, const char* op, bool builtIn = false); virtual void explicitInt16Check(const TSourceLoc&, const char* op, bool builtIn = false);
......
...@@ -415,6 +415,36 @@ public: ...@@ -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: ...@@ -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:
......
...@@ -457,6 +457,7 @@ INSTANTIATE_TEST_CASE_P( ...@@ -457,6 +457,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.int16.amd.frag", "spv.int16.amd.frag",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment