diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-03-09 09:35:55 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-03-09 09:36:38 +0100 |
commit | 1231c2ecfc70e6efb3fbbdc77c87598a7b767114 (patch) | |
tree | c8ac26bb1f5631c9cff5d8f64dea691e5129bb1e /thirdparty/glslang | |
parent | 214bc9e5a1f3300b97aed407fb62d902c53ae0e6 (diff) |
glslang: Sync with upstream 4fc7a33 for Vulkan SDK 1.2.131
Fixes #36888.
Diffstat (limited to 'thirdparty/glslang')
63 files changed, 12451 insertions, 10807 deletions
diff --git a/thirdparty/glslang/SPIRV/GLSL.ext.EXT.h b/thirdparty/glslang/SPIRV/GLSL.ext.EXT.h index e29c055b9a..40164b6187 100644 --- a/thirdparty/glslang/SPIRV/GLSL.ext.EXT.h +++ b/thirdparty/glslang/SPIRV/GLSL.ext.EXT.h @@ -34,5 +34,6 @@ static const char* const E_SPV_EXT_shader_stencil_export = "SPV_EXT_shade 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_invocation_density = "SPV_EXT_fragment_invocation_density"; +static const char* const E_SPV_EXT_demote_to_helper_invocation = "SPV_EXT_demote_to_helper_invocation"; #endif // #ifndef GLSLextEXT_H diff --git a/thirdparty/glslang/SPIRV/GLSL.ext.KHR.h b/thirdparty/glslang/SPIRV/GLSL.ext.KHR.h index 333442bb3e..e58e836a8d 100644 --- a/thirdparty/glslang/SPIRV/GLSL.ext.KHR.h +++ b/thirdparty/glslang/SPIRV/GLSL.ext.KHR.h @@ -41,5 +41,8 @@ static const char* const E_SPV_KHR_storage_buffer_storage_class = "SPV_KHR_stora static const char* const E_SPV_KHR_post_depth_coverage = "SPV_KHR_post_depth_coverage"; static const char* const E_SPV_KHR_vulkan_memory_model = "SPV_KHR_vulkan_memory_model"; static const char* const E_SPV_EXT_physical_storage_buffer = "SPV_EXT_physical_storage_buffer"; +static const char* const E_SPV_KHR_physical_storage_buffer = "SPV_KHR_physical_storage_buffer"; +static const char* const E_SPV_EXT_fragment_shader_interlock = "SPV_EXT_fragment_shader_interlock"; +static const char* const E_SPV_KHR_shader_clock = "SPV_KHR_shader_clock"; #endif // #ifndef GLSLextKHR_H diff --git a/thirdparty/glslang/SPIRV/GLSL.ext.NV.h b/thirdparty/glslang/SPIRV/GLSL.ext.NV.h index ede2c570eb..50146da104 100644 --- a/thirdparty/glslang/SPIRV/GLSL.ext.NV.h +++ b/thirdparty/glslang/SPIRV/GLSL.ext.NV.h @@ -75,4 +75,7 @@ const char* const E_SPV_NV_shading_rate = "SPV_NV_shading_rate"; //SPV_NV_cooperative_matrix const char* const E_SPV_NV_cooperative_matrix = "SPV_NV_cooperative_matrix"; +//SPV_NV_shader_sm_builtins +const char* const E_SPV_NV_shader_sm_builtins = "SPV_NV_shader_sm_builtins"; + #endif // #ifndef GLSLextNV_H diff --git a/thirdparty/glslang/SPIRV/GlslangToSpv.cpp b/thirdparty/glslang/SPIRV/GlslangToSpv.cpp index 4ef6cd7fc1..0c8a87e3ce 100644..100755 --- a/thirdparty/glslang/SPIRV/GlslangToSpv.cpp +++ b/thirdparty/glslang/SPIRV/GlslangToSpv.cpp @@ -46,9 +46,7 @@ namespace spv { #include "GLSL.std.450.h" #include "GLSL.ext.KHR.h" #include "GLSL.ext.EXT.h" -#ifdef AMD_EXTENSIONS #include "GLSL.ext.AMD.h" -#endif #include "GLSL.ext.NV.h" } @@ -89,9 +87,29 @@ private: }; struct OpDecorations { + public: + OpDecorations(spv::Decoration precision, spv::Decoration noContraction, spv::Decoration nonUniform) : + precision(precision) +#ifndef GLSLANG_WEB + , + noContraction(noContraction), + nonUniform(nonUniform) +#endif + { } + spv::Decoration precision; - spv::Decoration noContraction; - spv::Decoration nonUniform; + +#ifdef GLSLANG_WEB + void addNoContraction(spv::Builder&, spv::Id) const { } + void addNonUniform(spv::Builder&, spv::Id) const { } +#else + void addNoContraction(spv::Builder& builder, spv::Id t) { builder.addDecoration(t, noContraction); } + void addNonUniform(spv::Builder& builder, spv::Id t) { builder.addDecoration(t, nonUniform); } + protected: + spv::Decoration noContraction; + spv::Decoration nonUniform; +#endif + }; } // namespace @@ -138,7 +156,7 @@ protected: spv::LoopControlMask TranslateLoopControl(const glslang::TIntermLoop&, std::vector<unsigned int>& operands) const; spv::StorageClass TranslateStorageClass(const glslang::TType&); void addIndirectionIndexCapabilities(const glslang::TType& baseType, const glslang::TType& indexType); - spv::Id createSpvVariable(const glslang::TIntermSymbol*); + spv::Id createSpvVariable(const glslang::TIntermSymbol*, spv::Id forcedType); spv::Id getSampledType(const glslang::TSampler&); spv::Id getInvertedSwizzleType(const glslang::TIntermTyped&); spv::Id createInvertedSwizzle(spv::Decoration precision, const glslang::TIntermTyped&, spv::Id parentResult); @@ -169,7 +187,7 @@ protected: void makeGlobalInitializers(const glslang::TIntermSequence&); void visitFunctions(const glslang::TIntermSequence&); void handleFunctionEntry(const glslang::TIntermAggregate* node); - void translateArguments(const glslang::TIntermAggregate& node, std::vector<spv::Id>& arguments); + void translateArguments(const glslang::TIntermAggregate& node, std::vector<spv::Id>& arguments, spv::Builder::AccessChain::CoherentFlags &lvalueCoherentFlags); void translateArguments(glslang::TIntermUnary& node, std::vector<spv::Id>& arguments); spv::Id createImageTextureFunctionCall(glslang::TIntermOperator* node); spv::Id handleUserFunctionCall(const glslang::TIntermAggregate*); @@ -178,36 +196,30 @@ protected: glslang::TBasicType typeProxy, bool reduceComparison = true); spv::Id createBinaryMatrixOperation(spv::Op, OpDecorations&, spv::Id typeId, spv::Id left, spv::Id right); spv::Id createUnaryOperation(glslang::TOperator op, OpDecorations&, spv::Id typeId, spv::Id operand, - glslang::TBasicType typeProxy); + glslang::TBasicType typeProxy, const spv::Builder::AccessChain::CoherentFlags &lvalueCoherentFlags); spv::Id createUnaryMatrixOperation(spv::Op op, OpDecorations&, spv::Id typeId, spv::Id operand, glslang::TBasicType typeProxy); spv::Id createConversion(glslang::TOperator op, OpDecorations&, spv::Id destTypeId, spv::Id operand, glslang::TBasicType typeProxy); spv::Id createIntWidthConversion(glslang::TOperator op, spv::Id operand, int vectorSize); spv::Id makeSmearedConstant(spv::Id constant, int vectorSize); - spv::Id createAtomicOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, std::vector<spv::Id>& operands, glslang::TBasicType typeProxy); + spv::Id createAtomicOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, std::vector<spv::Id>& operands, glslang::TBasicType typeProxy, const spv::Builder::AccessChain::CoherentFlags &lvalueCoherentFlags); spv::Id createInvocationsOperation(glslang::TOperator op, spv::Id typeId, std::vector<spv::Id>& operands, glslang::TBasicType typeProxy); spv::Id CreateInvocationsVectorOperation(spv::Op op, spv::GroupOperation groupOperation, spv::Id typeId, std::vector<spv::Id>& operands); spv::Id createSubgroupOperation(glslang::TOperator op, spv::Id typeId, std::vector<spv::Id>& operands, glslang::TBasicType typeProxy); spv::Id createMiscOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, std::vector<spv::Id>& operands, glslang::TBasicType typeProxy); spv::Id createNoArgOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId); spv::Id getSymbolId(const glslang::TIntermSymbol* node); -#ifdef NV_EXTENSIONS void addMeshNVDecoration(spv::Id id, int member, const glslang::TQualifier & qualifier); -#endif spv::Id createSpvConstant(const glslang::TIntermTyped&); spv::Id createSpvConstantFromConstUnionArray(const glslang::TType& type, const glslang::TConstUnionArray&, int& nextConst, bool specConstant); bool isTrivialLeaf(const glslang::TIntermTyped* node); bool isTrivial(const glslang::TIntermTyped* node); spv::Id createShortCircuit(glslang::TOperator, glslang::TIntermTyped& left, glslang::TIntermTyped& right); -#ifdef AMD_EXTENSIONS spv::Id getExtBuiltins(const char* name); -#endif - void addPre13Extension(const char* ext) - { - if (builder.getSpvVersion() < glslang::EShTargetSpv_1_3) - builder.addExtension(ext); - } + std::pair<spv::Id, spv::Id> getForcedType(spv::BuiltIn, const glslang::TType&); + spv::Id translateForcedType(spv::Id object); + spv::Id createCompositeConstruct(spv::Id typeId, std::vector<spv::Id> constituents); glslang::SpvOptions& options; spv::Function* shaderEntry; @@ -224,6 +236,7 @@ protected: bool linkageOnly; // true when visiting the set of objects in the AST present only for establishing interface, whether or not they were statically used std::set<spv::Id> iOSet; // all input/output variables from either static use or declaration of interface const glslang::TIntermediate* glslangIntermediate; + bool nanMinMaxClamp; // true if use NMin/NMax/NClamp instead of FMin/FMax/FClamp spv::Id stdBuiltins; std::unordered_map<const char*, spv::Id> extBuiltinMap; @@ -232,11 +245,17 @@ protected: std::unordered_map<std::string, spv::Function*> functionMap; std::unordered_map<const glslang::TTypeList*, spv::Id> structMap[glslang::ElpCount][glslang::ElmCount]; // for mapping glslang block indices to spv indices (e.g., due to hidden members): - std::unordered_map<const glslang::TTypeList*, std::vector<int> > memberRemapper; + std::unordered_map<int, std::vector<int>> memberRemapper; + // for mapping glslang symbol struct to symbol Id + std::unordered_map<const glslang::TTypeList*, int> glslangTypeToIdMap; std::stack<bool> breakForLoop; // false means break for switch std::unordered_map<std::string, const glslang::TIntermSymbol*> counterOriginator; // Map pointee types for EbtReference to their forward pointers std::map<const glslang::TType *, spv::Id> forwardPointers; + // Type forcing, for when SPIR-V wants a different type than the AST, + // requiring local translation to and from SPIR-V type on every access. + // Maps <builtin-variable-id -> AST-required-type-id> + std::unordered_map<spv::Id, spv::Id> forceType; }; // @@ -246,6 +265,10 @@ protected: // Translate glslang profile to SPIR-V source language. spv::SourceLanguage TranslateSourceLanguage(glslang::EShSource source, EProfile profile) { +#ifdef GLSLANG_WEB + return spv::SourceLanguageESSL; +#endif + switch (source) { case glslang::EShSourceGlsl: switch (profile) { @@ -270,12 +293,12 @@ spv::ExecutionModel TranslateExecutionModel(EShLanguage stage) { switch (stage) { case EShLangVertex: return spv::ExecutionModelVertex; + case EShLangFragment: return spv::ExecutionModelFragment; + case EShLangCompute: return spv::ExecutionModelGLCompute; +#ifndef GLSLANG_WEB case EShLangTessControl: return spv::ExecutionModelTessellationControl; case EShLangTessEvaluation: return spv::ExecutionModelTessellationEvaluation; case EShLangGeometry: return spv::ExecutionModelGeometry; - case EShLangFragment: return spv::ExecutionModelFragment; - case EShLangCompute: return spv::ExecutionModelGLCompute; -#ifdef NV_EXTENSIONS case EShLangRayGenNV: return spv::ExecutionModelRayGenerationNV; case EShLangIntersectNV: return spv::ExecutionModelIntersectionNV; case EShLangAnyHitNV: return spv::ExecutionModelAnyHitNV; @@ -334,7 +357,7 @@ spv::Decoration TranslateBlockDecoration(const glslang::TType& type, bool useSto case glslang::EvqBuffer: return useStorageBuffer ? spv::DecorationBlock : spv::DecorationBufferBlock; case glslang::EvqVaryingIn: return spv::DecorationBlock; case glslang::EvqVaryingOut: return spv::DecorationBlock; -#ifdef NV_EXTENSIONS +#ifndef GLSLANG_WEB case glslang::EvqPayloadNV: return spv::DecorationBlock; case glslang::EvqPayloadInNV: return spv::DecorationBlock; case glslang::EvqHitAttrNV: return spv::DecorationBlock; @@ -354,18 +377,18 @@ spv::Decoration TranslateBlockDecoration(const glslang::TType& type, bool useSto void TranslateMemoryDecoration(const glslang::TQualifier& qualifier, std::vector<spv::Decoration>& memory, bool useVulkanMemoryModel) { if (!useVulkanMemoryModel) { - if (qualifier.coherent) + if (qualifier.isCoherent()) memory.push_back(spv::DecorationCoherent); - if (qualifier.volatil) { + if (qualifier.isVolatile()) { memory.push_back(spv::DecorationVolatile); memory.push_back(spv::DecorationCoherent); } } - if (qualifier.restrict) + if (qualifier.isRestrict()) memory.push_back(spv::DecorationRestrict); - if (qualifier.readonly) + if (qualifier.isReadOnly()) memory.push_back(spv::DecorationNonWritable); - if (qualifier.writeonly) + if (qualifier.isWriteOnly()) memory.push_back(spv::DecorationNonReadable); } @@ -409,7 +432,7 @@ spv::Decoration TranslateLayoutDecoration(const glslang::TType& type, glslang::T assert(type.getQualifier().layoutPacking == glslang::ElpNone); } return spv::DecorationMax; -#ifdef NV_EXTENSIONS +#ifndef GLSLANG_WEB case glslang::EvqPayloadNV: case glslang::EvqPayloadInNV: case glslang::EvqHitAttrNV: @@ -433,16 +456,14 @@ spv::Decoration TGlslangToSpvTraverser::TranslateInterpolationDecoration(const g if (qualifier.smooth) // Smooth decoration doesn't exist in SPIR-V 1.0 return spv::DecorationMax; - else if (qualifier.nopersp) + else if (qualifier.isNonPerspective()) return spv::DecorationNoPerspective; else if (qualifier.flat) return spv::DecorationFlat; -#ifdef AMD_EXTENSIONS - else if (qualifier.explicitInterp) { + else if (qualifier.isExplicitInterpolation()) { builder.addExtension(spv::E_SPV_AMD_shader_explicit_vertex_parameter); return spv::DecorationExplicitInterpAMD; } -#endif else return spv::DecorationMax; } @@ -452,15 +473,18 @@ spv::Decoration TGlslangToSpvTraverser::TranslateInterpolationDecoration(const g // should be applied. spv::Decoration TGlslangToSpvTraverser::TranslateAuxiliaryStorageDecoration(const glslang::TQualifier& qualifier) { - if (qualifier.patch) - return spv::DecorationPatch; - else if (qualifier.centroid) + if (qualifier.centroid) return spv::DecorationCentroid; +#ifndef GLSLANG_WEB + else if (qualifier.patch) + return spv::DecorationPatch; else if (qualifier.sample) { builder.addCapability(spv::CapabilitySampleRateShading); return spv::DecorationSample; - } else - return spv::DecorationMax; + } +#endif + + return spv::DecorationMax; } // If glslang type is invariant, return SPIR-V invariant decoration. @@ -475,29 +499,36 @@ spv::Decoration TranslateInvariantDecoration(const glslang::TQualifier& qualifie // If glslang type is noContraction, return SPIR-V NoContraction decoration. spv::Decoration TranslateNoContractionDecoration(const glslang::TQualifier& qualifier) { - if (qualifier.noContraction) +#ifndef GLSLANG_WEB + if (qualifier.isNoContraction()) return spv::DecorationNoContraction; else +#endif return spv::DecorationMax; } // If glslang type is nonUniform, return SPIR-V NonUniform decoration. spv::Decoration TGlslangToSpvTraverser::TranslateNonUniformDecoration(const glslang::TQualifier& qualifier) { +#ifndef GLSLANG_WEB if (qualifier.isNonUniform()) { - builder.addExtension("SPV_EXT_descriptor_indexing"); + builder.addIncorporatedExtension("SPV_EXT_descriptor_indexing", spv::Spv_1_5); builder.addCapability(spv::CapabilityShaderNonUniformEXT); return spv::DecorationNonUniformEXT; } else +#endif return spv::DecorationMax; } -spv::MemoryAccessMask TGlslangToSpvTraverser::TranslateMemoryAccess(const spv::Builder::AccessChain::CoherentFlags &coherentFlags) +spv::MemoryAccessMask TGlslangToSpvTraverser::TranslateMemoryAccess( + const spv::Builder::AccessChain::CoherentFlags &coherentFlags) { - if (!glslangIntermediate->usingVulkanMemoryModel() || coherentFlags.isImage) { - return spv::MemoryAccessMaskNone; - } spv::MemoryAccessMask mask = spv::MemoryAccessMaskNone; + +#ifndef GLSLANG_WEB + if (!glslangIntermediate->usingVulkanMemoryModel() || coherentFlags.isImage) + return mask; + if (coherentFlags.volatil || coherentFlags.coherent || coherentFlags.devicecoherent || @@ -516,15 +547,20 @@ spv::MemoryAccessMask TGlslangToSpvTraverser::TranslateMemoryAccess(const spv::B if (mask != spv::MemoryAccessMaskNone) { builder.addCapability(spv::CapabilityVulkanMemoryModelKHR); } +#endif + return mask; } -spv::ImageOperandsMask TGlslangToSpvTraverser::TranslateImageOperands(const spv::Builder::AccessChain::CoherentFlags &coherentFlags) +spv::ImageOperandsMask TGlslangToSpvTraverser::TranslateImageOperands( + const spv::Builder::AccessChain::CoherentFlags &coherentFlags) { - if (!glslangIntermediate->usingVulkanMemoryModel()) { - return spv::ImageOperandsMaskNone; - } spv::ImageOperandsMask mask = spv::ImageOperandsMaskNone; + +#ifndef GLSLANG_WEB + if (!glslangIntermediate->usingVulkanMemoryModel()) + return mask; + if (coherentFlags.volatil || coherentFlags.coherent || coherentFlags.devicecoherent || @@ -543,12 +579,15 @@ spv::ImageOperandsMask TGlslangToSpvTraverser::TranslateImageOperands(const spv: if (mask != spv::ImageOperandsMaskNone) { builder.addCapability(spv::CapabilityVulkanMemoryModelKHR); } +#endif + return mask; } spv::Builder::AccessChain::CoherentFlags TGlslangToSpvTraverser::TranslateCoherent(const glslang::TType& type) { - spv::Builder::AccessChain::CoherentFlags flags; + spv::Builder::AccessChain::CoherentFlags flags = {}; +#ifndef GLSLANG_WEB flags.coherent = type.getQualifier().coherent; flags.devicecoherent = type.getQualifier().devicecoherent; flags.queuefamilycoherent = type.getQualifier().queuefamilycoherent; @@ -566,12 +605,16 @@ spv::Builder::AccessChain::CoherentFlags TGlslangToSpvTraverser::TranslateCohere flags.coherent || flags.volatil; flags.isImage = type.getBasicType() == glslang::EbtSampler; +#endif return flags; } -spv::Scope TGlslangToSpvTraverser::TranslateMemoryScope(const spv::Builder::AccessChain::CoherentFlags &coherentFlags) +spv::Scope TGlslangToSpvTraverser::TranslateMemoryScope( + const spv::Builder::AccessChain::CoherentFlags &coherentFlags) { - spv::Scope scope; + spv::Scope scope = spv::ScopeMax; + +#ifndef GLSLANG_WEB if (coherentFlags.volatil || coherentFlags.coherent) { // coherent defaults to Device scope in the old model, QueueFamilyKHR scope in the new model scope = glslangIntermediate->usingVulkanMemoryModel() ? spv::ScopeQueueFamilyKHR : spv::ScopeDevice; @@ -583,12 +626,12 @@ spv::Scope TGlslangToSpvTraverser::TranslateMemoryScope(const spv::Builder::Acce scope = spv::ScopeWorkgroup; } else if (coherentFlags.subgroupcoherent) { scope = spv::ScopeSubgroup; - } else { - scope = spv::ScopeMax; } if (glslangIntermediate->usingVulkanMemoryModel() && scope == spv::ScopeDevice) { builder.addCapability(spv::CapabilityVulkanMemoryModelDeviceScopeKHR); } +#endif + return scope; } @@ -601,6 +644,7 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI { switch (builtIn) { case glslang::EbvPointSize: +#ifndef GLSLANG_WEB // Defer adding the capability until the built-in is actually used. if (! memberDeclaration) { switch (glslangIntermediate->getStage()) { @@ -615,8 +659,28 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI break; } } +#endif return spv::BuiltInPointSize; + case glslang::EbvPosition: return spv::BuiltInPosition; + case glslang::EbvVertexId: return spv::BuiltInVertexId; + case glslang::EbvInstanceId: return spv::BuiltInInstanceId; + case glslang::EbvVertexIndex: return spv::BuiltInVertexIndex; + case glslang::EbvInstanceIndex: return spv::BuiltInInstanceIndex; + + case glslang::EbvFragCoord: return spv::BuiltInFragCoord; + case glslang::EbvPointCoord: return spv::BuiltInPointCoord; + case glslang::EbvFace: return spv::BuiltInFrontFacing; + case glslang::EbvFragDepth: return spv::BuiltInFragDepth; + + case glslang::EbvNumWorkGroups: return spv::BuiltInNumWorkgroups; + case glslang::EbvWorkGroupSize: return spv::BuiltInWorkgroupSize; + case glslang::EbvWorkGroupId: return spv::BuiltInWorkgroupId; + case glslang::EbvLocalInvocationId: return spv::BuiltInLocalInvocationId; + case glslang::EbvLocalInvocationIndex: return spv::BuiltInLocalInvocationIndex; + case glslang::EbvGlobalInvocationId: return spv::BuiltInGlobalInvocationId; + +#ifndef GLSLANG_WEB // These *Distance capabilities logically belong here, but if the member is declared and // then never used, consumers of SPIR-V prefer the capability not be declared. // They are now generated when used, rather than here when declared. @@ -639,7 +703,7 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI glslangIntermediate->getStage() == EShLangTessControl || glslangIntermediate->getStage() == EShLangTessEvaluation) { - builder.addExtension(spv::E_SPV_EXT_shader_viewport_index_layer); + builder.addIncorporatedExtension(spv::E_SPV_EXT_shader_viewport_index_layer, spv::Spv_1_5); builder.addCapability(spv::CapabilityShaderViewportIndexLayerEXT); } return spv::BuiltInViewportIndex; @@ -656,39 +720,31 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI return spv::BuiltInSampleMask; case glslang::EbvLayer: -#ifdef NV_EXTENSIONS if (glslangIntermediate->getStage() == EShLangMeshNV) { return spv::BuiltInLayer; } -#endif builder.addCapability(spv::CapabilityGeometry); if (glslangIntermediate->getStage() == EShLangVertex || glslangIntermediate->getStage() == EShLangTessControl || glslangIntermediate->getStage() == EShLangTessEvaluation) { - builder.addExtension(spv::E_SPV_EXT_shader_viewport_index_layer); + builder.addIncorporatedExtension(spv::E_SPV_EXT_shader_viewport_index_layer, spv::Spv_1_5); builder.addCapability(spv::CapabilityShaderViewportIndexLayerEXT); } return spv::BuiltInLayer; - case glslang::EbvPosition: return spv::BuiltInPosition; - case glslang::EbvVertexId: return spv::BuiltInVertexId; - case glslang::EbvInstanceId: return spv::BuiltInInstanceId; - case glslang::EbvVertexIndex: return spv::BuiltInVertexIndex; - case glslang::EbvInstanceIndex: return spv::BuiltInInstanceIndex; - case glslang::EbvBaseVertex: - addPre13Extension(spv::E_SPV_KHR_shader_draw_parameters); + builder.addIncorporatedExtension(spv::E_SPV_KHR_shader_draw_parameters, spv::Spv_1_3); builder.addCapability(spv::CapabilityDrawParameters); return spv::BuiltInBaseVertex; case glslang::EbvBaseInstance: - addPre13Extension(spv::E_SPV_KHR_shader_draw_parameters); + builder.addIncorporatedExtension(spv::E_SPV_KHR_shader_draw_parameters, spv::Spv_1_3); builder.addCapability(spv::CapabilityDrawParameters); return spv::BuiltInBaseInstance; case glslang::EbvDrawId: - addPre13Extension(spv::E_SPV_KHR_shader_draw_parameters); + builder.addIncorporatedExtension(spv::E_SPV_KHR_shader_draw_parameters, spv::Spv_1_3); builder.addCapability(spv::CapabilityDrawParameters); return spv::BuiltInDrawIndex; @@ -707,17 +763,7 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI case glslang::EbvTessLevelOuter: return spv::BuiltInTessLevelOuter; case glslang::EbvTessCoord: return spv::BuiltInTessCoord; case glslang::EbvPatchVertices: return spv::BuiltInPatchVertices; - case glslang::EbvFragCoord: return spv::BuiltInFragCoord; - case glslang::EbvPointCoord: return spv::BuiltInPointCoord; - case glslang::EbvFace: return spv::BuiltInFrontFacing; - case glslang::EbvFragDepth: return spv::BuiltInFragDepth; case glslang::EbvHelperInvocation: return spv::BuiltInHelperInvocation; - case glslang::EbvNumWorkGroups: return spv::BuiltInNumWorkgroups; - case glslang::EbvWorkGroupSize: return spv::BuiltInWorkgroupSize; - case glslang::EbvWorkGroupId: return spv::BuiltInWorkgroupId; - case glslang::EbvLocalInvocationId: return spv::BuiltInLocalInvocationId; - case glslang::EbvLocalInvocationIndex: return spv::BuiltInLocalInvocationIndex; - case glslang::EbvGlobalInvocationId: return spv::BuiltInGlobalInvocationId; case glslang::EbvSubGroupSize: builder.addExtension(spv::E_SPV_KHR_shader_ballot); @@ -732,27 +778,27 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI case glslang::EbvSubGroupEqMask: builder.addExtension(spv::E_SPV_KHR_shader_ballot); builder.addCapability(spv::CapabilitySubgroupBallotKHR); - return spv::BuiltInSubgroupEqMaskKHR; + return spv::BuiltInSubgroupEqMask; case glslang::EbvSubGroupGeMask: builder.addExtension(spv::E_SPV_KHR_shader_ballot); builder.addCapability(spv::CapabilitySubgroupBallotKHR); - return spv::BuiltInSubgroupGeMaskKHR; + return spv::BuiltInSubgroupGeMask; case glslang::EbvSubGroupGtMask: builder.addExtension(spv::E_SPV_KHR_shader_ballot); builder.addCapability(spv::CapabilitySubgroupBallotKHR); - return spv::BuiltInSubgroupGtMaskKHR; + return spv::BuiltInSubgroupGtMask; case glslang::EbvSubGroupLeMask: builder.addExtension(spv::E_SPV_KHR_shader_ballot); builder.addCapability(spv::CapabilitySubgroupBallotKHR); - return spv::BuiltInSubgroupLeMaskKHR; + return spv::BuiltInSubgroupLeMask; case glslang::EbvSubGroupLtMask: builder.addExtension(spv::E_SPV_KHR_shader_ballot); builder.addCapability(spv::CapabilitySubgroupBallotKHR); - return spv::BuiltInSubgroupLtMaskKHR; + return spv::BuiltInSubgroupLtMask; case glslang::EbvNumSubgroups: builder.addCapability(spv::CapabilityGroupNonUniform); @@ -794,7 +840,7 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI builder.addCapability(spv::CapabilityGroupNonUniform); builder.addCapability(spv::CapabilityGroupNonUniformBallot); return spv::BuiltInSubgroupLtMask; -#ifdef AMD_EXTENSIONS + case glslang::EbvBaryCoordNoPersp: builder.addExtension(spv::E_SPV_AMD_shader_explicit_vertex_parameter); return spv::BuiltInBaryCoordNoPerspAMD; @@ -822,15 +868,14 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI case glslang::EbvBaryCoordPullModel: builder.addExtension(spv::E_SPV_AMD_shader_explicit_vertex_parameter); return spv::BuiltInBaryCoordPullModelAMD; -#endif case glslang::EbvDeviceIndex: - addPre13Extension(spv::E_SPV_KHR_device_group); + builder.addIncorporatedExtension(spv::E_SPV_KHR_device_group, spv::Spv_1_3); builder.addCapability(spv::CapabilityDeviceGroup); return spv::BuiltInDeviceIndex; case glslang::EbvViewIndex: - addPre13Extension(spv::E_SPV_KHR_multiview); + builder.addIncorporatedExtension(spv::E_SPV_KHR_multiview, spv::Spv_1_3); builder.addCapability(spv::CapabilityMultiView); return spv::BuiltInViewIndex; @@ -844,7 +889,6 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI builder.addCapability(spv::CapabilityFragmentDensityEXT); return spv::BuiltInFragInvocationCountEXT; -#ifdef NV_EXTENSIONS case glslang::EbvViewportMaskNV: if (!memberDeclaration) { builder.addExtension(spv::E_SPV_NV_viewport_array2); @@ -888,7 +932,7 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI builder.addCapability(spv::CapabilityShadingRateNV); return spv::BuiltInInvocationsPerPixelNV; - // raytracing + // ray tracing case glslang::EbvLaunchIdNV: return spv::BuiltInLaunchIdNV; case glslang::EbvLaunchSizeNV: @@ -917,6 +961,8 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI return spv::BuiltInWorldToObjectNV; case glslang::EbvIncomingRayFlagsNV: return spv::BuiltInIncomingRayFlagsNV; + + // barycentrics case glslang::EbvBaryCoordNV: builder.addExtension(spv::E_SPV_NV_fragment_shader_barycentric); builder.addCapability(spv::CapabilityFragmentBarycentricNV); @@ -925,23 +971,44 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI builder.addExtension(spv::E_SPV_NV_fragment_shader_barycentric); builder.addCapability(spv::CapabilityFragmentBarycentricNV); return spv::BuiltInBaryCoordNoPerspNV; - case glslang::EbvTaskCountNV: + + // mesh shaders + case glslang::EbvTaskCountNV: return spv::BuiltInTaskCountNV; - case glslang::EbvPrimitiveCountNV: + case glslang::EbvPrimitiveCountNV: return spv::BuiltInPrimitiveCountNV; - case glslang::EbvPrimitiveIndicesNV: + case glslang::EbvPrimitiveIndicesNV: return spv::BuiltInPrimitiveIndicesNV; - case glslang::EbvClipDistancePerViewNV: + case glslang::EbvClipDistancePerViewNV: return spv::BuiltInClipDistancePerViewNV; - case glslang::EbvCullDistancePerViewNV: + case glslang::EbvCullDistancePerViewNV: return spv::BuiltInCullDistancePerViewNV; - case glslang::EbvLayerPerViewNV: + case glslang::EbvLayerPerViewNV: return spv::BuiltInLayerPerViewNV; - case glslang::EbvMeshViewCountNV: + case glslang::EbvMeshViewCountNV: return spv::BuiltInMeshViewCountNV; - case glslang::EbvMeshViewIndicesNV: + case glslang::EbvMeshViewIndicesNV: return spv::BuiltInMeshViewIndicesNV; -#endif + + // sm builtins + case glslang::EbvWarpsPerSM: + builder.addExtension(spv::E_SPV_NV_shader_sm_builtins); + builder.addCapability(spv::CapabilityShaderSMBuiltinsNV); + return spv::BuiltInWarpsPerSMNV; + case glslang::EbvSMCount: + builder.addExtension(spv::E_SPV_NV_shader_sm_builtins); + builder.addCapability(spv::CapabilityShaderSMBuiltinsNV); + return spv::BuiltInSMCountNV; + case glslang::EbvWarpID: + builder.addExtension(spv::E_SPV_NV_shader_sm_builtins); + builder.addCapability(spv::CapabilityShaderSMBuiltinsNV); + return spv::BuiltInWarpIDNV; + case glslang::EbvSMID: + builder.addExtension(spv::E_SPV_NV_shader_sm_builtins); + builder.addCapability(spv::CapabilityShaderSMBuiltinsNV); + return spv::BuiltInSMIDNV; +#endif + default: return spv::BuiltInMax; } @@ -952,8 +1019,12 @@ spv::ImageFormat TGlslangToSpvTraverser::TranslateImageFormat(const glslang::TTy { assert(type.getBasicType() == glslang::EbtSampler); +#ifdef GLSLANG_WEB + return spv::ImageFormatUnknown; +#endif + // Check for capabilities - switch (type.getQualifier().layoutFormat) { + switch (type.getQualifier().getFormat()) { case glslang::ElfRg32f: case glslang::ElfRg16f: case glslang::ElfR11fG11fB10f: @@ -990,7 +1061,7 @@ spv::ImageFormat TGlslangToSpvTraverser::TranslateImageFormat(const glslang::TTy } // do the translation - switch (type.getQualifier().layoutFormat) { + switch (type.getQualifier().getFormat()) { case glslang::ElfNone: return spv::ImageFormatUnknown; case glslang::ElfRgba32f: return spv::ImageFormatRgba32f; case glslang::ElfRgba16f: return spv::ImageFormatRgba16f; @@ -1104,27 +1175,25 @@ spv::StorageClass TGlslangToSpvTraverser::TranslateStorageClass(const glslang::T return spv::StorageClassOutput; if (glslangIntermediate->getSource() != glslang::EShSourceHlsl || - type.getQualifier().storage == glslang::EvqUniform) { - if (type.getBasicType() == glslang::EbtAtomicUint) + type.getQualifier().storage == glslang::EvqUniform) { + if (type.isAtomic()) return spv::StorageClassAtomicCounter; if (type.containsOpaque()) return spv::StorageClassUniformConstant; } -#ifdef NV_EXTENSIONS if (type.getQualifier().isUniformOrBuffer() && - type.getQualifier().layoutShaderRecordNV) { + type.getQualifier().isShaderRecordNV()) { return spv::StorageClassShaderRecordBufferNV; } -#endif if (glslangIntermediate->usingStorageBuffer() && type.getQualifier().storage == glslang::EvqBuffer) { - addPre13Extension(spv::E_SPV_KHR_storage_buffer_storage_class); + builder.addIncorporatedExtension(spv::E_SPV_KHR_storage_buffer_storage_class, spv::Spv_1_3); return spv::StorageClassStorageBuffer; } if (type.getQualifier().isUniformOrBuffer()) { - if (type.getQualifier().layoutPushConstant) + if (type.getQualifier().isPushConstant()) return spv::StorageClassPushConstant; if (type.getBasicType() == glslang::EbtBlock) return spv::StorageClassUniform; @@ -1132,11 +1201,11 @@ spv::StorageClass TGlslangToSpvTraverser::TranslateStorageClass(const glslang::T } switch (type.getQualifier().storage) { - case glslang::EvqShared: return spv::StorageClassWorkgroup; case glslang::EvqGlobal: return spv::StorageClassPrivate; case glslang::EvqConstReadOnly: return spv::StorageClassFunction; case glslang::EvqTemporary: return spv::StorageClassFunction; -#ifdef NV_EXTENSIONS + case glslang::EvqShared: return spv::StorageClassWorkgroup; +#ifndef GLSLANG_WEB case glslang::EvqPayloadNV: return spv::StorageClassRayPayloadNV; case glslang::EvqPayloadInNV: return spv::StorageClassIncomingRayPayloadNV; case glslang::EvqHitAttrNV: return spv::StorageClassHitAttributeNV; @@ -1155,15 +1224,16 @@ spv::StorageClass TGlslangToSpvTraverser::TranslateStorageClass(const glslang::T void TGlslangToSpvTraverser::addIndirectionIndexCapabilities(const glslang::TType& baseType, const glslang::TType& indexType) { +#ifndef GLSLANG_WEB if (indexType.getQualifier().isNonUniform()) { // deal with an asserted non-uniform index // SPV_EXT_descriptor_indexing already added in TranslateNonUniformDecoration if (baseType.getBasicType() == glslang::EbtSampler) { if (baseType.getQualifier().hasAttachment()) builder.addCapability(spv::CapabilityInputAttachmentArrayNonUniformIndexingEXT); - else if (baseType.isImage() && baseType.getSampler().dim == glslang::EsdBuffer) + else if (baseType.isImage() && baseType.getSampler().isBuffer()) builder.addCapability(spv::CapabilityStorageTexelBufferArrayNonUniformIndexingEXT); - else if (baseType.isTexture() && baseType.getSampler().dim == glslang::EsdBuffer) + else if (baseType.isTexture() && baseType.getSampler().isBuffer()) builder.addCapability(spv::CapabilityUniformTexelBufferArrayNonUniformIndexingEXT); else if (baseType.isImage()) builder.addCapability(spv::CapabilityStorageImageArrayNonUniformIndexingEXT); @@ -1179,17 +1249,18 @@ void TGlslangToSpvTraverser::addIndirectionIndexCapabilities(const glslang::TTyp // assume a dynamically uniform index if (baseType.getBasicType() == glslang::EbtSampler) { if (baseType.getQualifier().hasAttachment()) { - builder.addExtension("SPV_EXT_descriptor_indexing"); + builder.addIncorporatedExtension("SPV_EXT_descriptor_indexing", spv::Spv_1_5); builder.addCapability(spv::CapabilityInputAttachmentArrayDynamicIndexingEXT); - } else if (baseType.isImage() && baseType.getSampler().dim == glslang::EsdBuffer) { - builder.addExtension("SPV_EXT_descriptor_indexing"); + } else if (baseType.isImage() && baseType.getSampler().isBuffer()) { + builder.addIncorporatedExtension("SPV_EXT_descriptor_indexing", spv::Spv_1_5); builder.addCapability(spv::CapabilityStorageTexelBufferArrayDynamicIndexingEXT); - } else if (baseType.isTexture() && baseType.getSampler().dim == glslang::EsdBuffer) { - builder.addExtension("SPV_EXT_descriptor_indexing"); + } else if (baseType.isTexture() && baseType.getSampler().isBuffer()) { + builder.addIncorporatedExtension("SPV_EXT_descriptor_indexing", spv::Spv_1_5); builder.addCapability(spv::CapabilityUniformTexelBufferArrayDynamicIndexingEXT); } } } +#endif } // Return whether or not the given type is something that should be tied to a @@ -1199,10 +1270,8 @@ bool IsDescriptorResource(const glslang::TType& type) // uniform and buffer blocks are included, unless it is a push_constant if (type.getBasicType() == glslang::EbtBlock) return type.getQualifier().isUniformOrBuffer() && -#ifdef NV_EXTENSIONS - ! type.getQualifier().layoutShaderRecordNV && -#endif - ! type.getQualifier().layoutPushConstant; + ! type.getQualifier().isShaderRecordNV() && + ! type.getQualifier().isPushConstant(); // non block... // basically samplerXXX/subpass/sampler/texture are all included @@ -1222,16 +1291,21 @@ void InheritQualifiers(glslang::TQualifier& child, const glslang::TQualifier& pa if (parent.invariant) child.invariant = true; - if (parent.nopersp) - child.nopersp = true; -#ifdef AMD_EXTENSIONS - if (parent.explicitInterp) - child.explicitInterp = true; -#endif if (parent.flat) child.flat = true; if (parent.centroid) child.centroid = true; +#ifndef GLSLANG_WEB + if (parent.nopersp) + child.nopersp = true; + if (parent.explicitInterp) + child.explicitInterp = true; + if (parent.perPrimitiveNV) + child.perPrimitiveNV = true; + if (parent.perViewNV) + child.perViewNV = true; + if (parent.perTaskNV) + child.perTaskNV = true; if (parent.patch) child.patch = true; if (parent.sample) @@ -1256,13 +1330,6 @@ void InheritQualifiers(glslang::TQualifier& child, const glslang::TQualifier& pa child.readonly = true; if (parent.writeonly) child.writeonly = true; -#ifdef NV_EXTENSIONS - if (parent.perPrimitiveNV) - child.perPrimitiveNV = true; - if (parent.perViewNV) - child.perViewNV = true; - if (parent.perTaskNV) - child.perTaskNV = true; #endif } @@ -1291,7 +1358,8 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion, const gl sequenceDepth(0), logger(buildLogger), builder(spvVersion, (glslang::GetKhronosToolId() << 16) | glslang::GetSpirvGeneratorVersion(), logger), inEntryPoint(false), entryPointTerminated(false), linkageOnly(false), - glslangIntermediate(glslangIntermediate) + glslangIntermediate(glslangIntermediate), + nanMinMaxClamp(glslangIntermediate->getNanMinMaxClamp()) { spv::ExecutionModel executionModel = TranslateExecutionModel(glslangIntermediate->getStage()); @@ -1332,13 +1400,13 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion, const gl if (glslangIntermediate->usingPhysicalStorageBuffer()) { addressingModel = spv::AddressingModelPhysicalStorageBuffer64EXT; - builder.addExtension(spv::E_SPV_EXT_physical_storage_buffer); + builder.addIncorporatedExtension(spv::E_SPV_EXT_physical_storage_buffer, spv::Spv_1_5); builder.addCapability(spv::CapabilityPhysicalStorageBufferAddressesEXT); }; if (glslangIntermediate->usingVulkanMemoryModel()) { memoryModel = spv::MemoryModelVulkanKHR; builder.addCapability(spv::CapabilityVulkanMemoryModelKHR); - builder.addExtension(spv::E_SPV_KHR_vulkan_memory_model); + builder.addIncorporatedExtension(spv::E_SPV_KHR_vulkan_memory_model, spv::Spv_1_5); } builder.setMemoryModel(addressingModel, memoryModel); @@ -1367,6 +1435,84 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion, const gl builder.addCapability(spv::CapabilityShader); break; + case EShLangFragment: + builder.addCapability(spv::CapabilityShader); + if (glslangIntermediate->getPixelCenterInteger()) + builder.addExecutionMode(shaderEntry, spv::ExecutionModePixelCenterInteger); + + if (glslangIntermediate->getOriginUpperLeft()) + builder.addExecutionMode(shaderEntry, spv::ExecutionModeOriginUpperLeft); + else + builder.addExecutionMode(shaderEntry, spv::ExecutionModeOriginLowerLeft); + + if (glslangIntermediate->getEarlyFragmentTests()) + builder.addExecutionMode(shaderEntry, spv::ExecutionModeEarlyFragmentTests); + + if (glslangIntermediate->getPostDepthCoverage()) { + builder.addCapability(spv::CapabilitySampleMaskPostDepthCoverage); + builder.addExecutionMode(shaderEntry, spv::ExecutionModePostDepthCoverage); + builder.addExtension(spv::E_SPV_KHR_post_depth_coverage); + } + + if (glslangIntermediate->getDepth() != glslang::EldUnchanged && glslangIntermediate->isDepthReplacing()) + builder.addExecutionMode(shaderEntry, spv::ExecutionModeDepthReplacing); + +#ifndef GLSLANG_WEB + switch(glslangIntermediate->getDepth()) { + case glslang::EldGreater: mode = spv::ExecutionModeDepthGreater; break; + case glslang::EldLess: mode = spv::ExecutionModeDepthLess; break; + default: mode = spv::ExecutionModeMax; break; + } + if (mode != spv::ExecutionModeMax) + builder.addExecutionMode(shaderEntry, (spv::ExecutionMode)mode); + switch (glslangIntermediate->getInterlockOrdering()) { + case glslang::EioPixelInterlockOrdered: mode = spv::ExecutionModePixelInterlockOrderedEXT; + break; + case glslang::EioPixelInterlockUnordered: mode = spv::ExecutionModePixelInterlockUnorderedEXT; + break; + case glslang::EioSampleInterlockOrdered: mode = spv::ExecutionModeSampleInterlockOrderedEXT; + break; + case glslang::EioSampleInterlockUnordered: mode = spv::ExecutionModeSampleInterlockUnorderedEXT; + break; + case glslang::EioShadingRateInterlockOrdered: mode = spv::ExecutionModeShadingRateInterlockOrderedEXT; + break; + case glslang::EioShadingRateInterlockUnordered: mode = spv::ExecutionModeShadingRateInterlockUnorderedEXT; + break; + default: mode = spv::ExecutionModeMax; + break; + } + if (mode != spv::ExecutionModeMax) { + builder.addExecutionMode(shaderEntry, (spv::ExecutionMode)mode); + if (mode == spv::ExecutionModeShadingRateInterlockOrderedEXT || + mode == spv::ExecutionModeShadingRateInterlockUnorderedEXT) { + builder.addCapability(spv::CapabilityFragmentShaderShadingRateInterlockEXT); + } else if (mode == spv::ExecutionModePixelInterlockOrderedEXT || + mode == spv::ExecutionModePixelInterlockUnorderedEXT) { + builder.addCapability(spv::CapabilityFragmentShaderPixelInterlockEXT); + } else { + builder.addCapability(spv::CapabilityFragmentShaderSampleInterlockEXT); + } + builder.addExtension(spv::E_SPV_EXT_fragment_shader_interlock); + } +#endif + break; + + case EShLangCompute: + builder.addCapability(spv::CapabilityShader); + builder.addExecutionMode(shaderEntry, spv::ExecutionModeLocalSize, glslangIntermediate->getLocalSize(0), + glslangIntermediate->getLocalSize(1), + glslangIntermediate->getLocalSize(2)); + if (glslangIntermediate->getLayoutDerivativeModeNone() == glslang::LayoutDerivativeGroupQuads) { + builder.addCapability(spv::CapabilityComputeDerivativeGroupQuadsNV); + builder.addExecutionMode(shaderEntry, spv::ExecutionModeDerivativeGroupQuadsNV); + builder.addExtension(spv::E_SPV_NV_compute_shader_derivatives); + } else if (glslangIntermediate->getLayoutDerivativeModeNone() == glslang::LayoutDerivativeGroupLinear) { + builder.addCapability(spv::CapabilityComputeDerivativeGroupLinearNV); + builder.addExecutionMode(shaderEntry, spv::ExecutionModeDerivativeGroupLinearNV); + builder.addExtension(spv::E_SPV_NV_compute_shader_derivatives); + } + break; +#ifndef GLSLANG_WEB case EShLangTessEvaluation: case EShLangTessControl: builder.addCapability(spv::CapabilityTessellation); @@ -1436,56 +1582,6 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion, const gl builder.addExecutionMode(shaderEntry, spv::ExecutionModeOutputVertices, glslangIntermediate->getVertices()); break; - case EShLangFragment: - builder.addCapability(spv::CapabilityShader); - if (glslangIntermediate->getPixelCenterInteger()) - builder.addExecutionMode(shaderEntry, spv::ExecutionModePixelCenterInteger); - - if (glslangIntermediate->getOriginUpperLeft()) - builder.addExecutionMode(shaderEntry, spv::ExecutionModeOriginUpperLeft); - else - builder.addExecutionMode(shaderEntry, spv::ExecutionModeOriginLowerLeft); - - if (glslangIntermediate->getEarlyFragmentTests()) - builder.addExecutionMode(shaderEntry, spv::ExecutionModeEarlyFragmentTests); - - if (glslangIntermediate->getPostDepthCoverage()) { - builder.addCapability(spv::CapabilitySampleMaskPostDepthCoverage); - builder.addExecutionMode(shaderEntry, spv::ExecutionModePostDepthCoverage); - builder.addExtension(spv::E_SPV_KHR_post_depth_coverage); - } - - switch(glslangIntermediate->getDepth()) { - case glslang::EldGreater: mode = spv::ExecutionModeDepthGreater; break; - case glslang::EldLess: mode = spv::ExecutionModeDepthLess; break; - default: mode = spv::ExecutionModeMax; break; - } - if (mode != spv::ExecutionModeMax) - builder.addExecutionMode(shaderEntry, (spv::ExecutionMode)mode); - - if (glslangIntermediate->getDepth() != glslang::EldUnchanged && glslangIntermediate->isDepthReplacing()) - builder.addExecutionMode(shaderEntry, spv::ExecutionModeDepthReplacing); - break; - - case EShLangCompute: - builder.addCapability(spv::CapabilityShader); - builder.addExecutionMode(shaderEntry, spv::ExecutionModeLocalSize, glslangIntermediate->getLocalSize(0), - glslangIntermediate->getLocalSize(1), - glslangIntermediate->getLocalSize(2)); -#ifdef NV_EXTENSIONS - if (glslangIntermediate->getLayoutDerivativeModeNone() == glslang::LayoutDerivativeGroupQuads) { - builder.addCapability(spv::CapabilityComputeDerivativeGroupQuadsNV); - builder.addExecutionMode(shaderEntry, spv::ExecutionModeDerivativeGroupQuadsNV); - builder.addExtension(spv::E_SPV_NV_compute_shader_derivatives); - } else if (glslangIntermediate->getLayoutDerivativeModeNone() == glslang::LayoutDerivativeGroupLinear) { - builder.addCapability(spv::CapabilityComputeDerivativeGroupLinearNV); - builder.addExecutionMode(shaderEntry, spv::ExecutionModeDerivativeGroupLinearNV); - builder.addExtension(spv::E_SPV_NV_compute_shader_derivatives); - } -#endif - break; - -#ifdef NV_EXTENSIONS case EShLangRayGenNV: case EShLangIntersectNV: case EShLangAnyHitNV: @@ -1536,8 +1632,10 @@ void TGlslangToSpvTraverser::finishSpv() for (auto it = iOSet.cbegin(); it != iOSet.cend(); ++it) entryPoint->addIdOperand(*it); - // Add capabilities, extensions, remove unneeded decorations, etc., + // Add capabilities, extensions, remove unneeded decorations, etc., // based on the resulting SPIR-V. + // Note: WebGPU code generation must have the opportunity to aggressively + // prune unreachable merge blocks and continue targets. builder.postProcess(); } @@ -1565,6 +1663,9 @@ void TGlslangToSpvTraverser::dumpSpv(std::vector<unsigned int>& out) void TGlslangToSpvTraverser::visitSymbol(glslang::TIntermSymbol* symbol) { SpecConstantOpModeGuard spec_constant_op_mode_setter(&builder); + if (symbol->getType().isStruct()) + glslangTypeToIdMap[symbol->getType().getStruct()] = symbol->getId(); + if (symbol->getType().getQualifier().isSpecConstant()) spec_constant_op_mode_setter.turnOnSpecConstantOpMode(); @@ -1572,8 +1673,8 @@ void TGlslangToSpvTraverser::visitSymbol(glslang::TIntermSymbol* symbol) // Formal function parameters were mapped during makeFunctions(). spv::Id id = getSymbolId(symbol); - // Include all "static use" and "linkage only" interface variables on the OpEntryPoint instruction if (builder.isPointer(id)) { + // Include all "static use" and "linkage only" interface variables on the OpEntryPoint instruction // Consider adding to the OpEntryPoint interface list. // Only looking at structures if they have at least one member. if (!symbol->getType().isStruct() || symbol->getType().getStruct()->size() > 0) { @@ -1585,6 +1686,14 @@ void TGlslangToSpvTraverser::visitSymbol(glslang::TIntermSymbol* symbol) iOSet.insert(id); } } + + // If the SPIR-V type is required to be different than the AST type, + // translate now from the SPIR-V type to the AST type, for the consuming + // operation. + // Note this turns it from an l-value to an r-value. + // Currently, all symbols needing this are inputs; avoid the map lookup when non-input. + if (symbol->getType().getQualifier().storage == glslang::EvqVaryingIn) + id = translateForcedType(id); } // Only process non-linkage-only nodes for generating actual static uses @@ -1602,13 +1711,16 @@ void TGlslangToSpvTraverser::visitSymbol(glslang::TIntermSymbol* symbol) // See comments in handleUserFunctionCall(). // B) Specialization constants (normal constants don't even come in as a variable), // These are also pure R-values. + // C) R-Values from type translation, see above call to translateForcedType() glslang::TQualifier qualifier = symbol->getQualifier(); - if (qualifier.isSpecConstant() || rValueParameters.find(symbol->getId()) != rValueParameters.end()) + if (qualifier.isSpecConstant() || rValueParameters.find(symbol->getId()) != rValueParameters.end() || + !builder.isPointerType(builder.getTypeId(id))) builder.setAccessChainRValue(id); else builder.setAccessChainLValue(id); } +#ifdef ENABLE_HLSL // Process linkage-only nodes for any special additional interface work. if (linkageOnly) { if (glslangIntermediate->getHlslFunctionality1()) { @@ -1640,11 +1752,18 @@ void TGlslangToSpvTraverser::visitSymbol(glslang::TIntermSymbol* symbol) } } } +#endif } bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::TIntermBinary* node) { builder.setLine(node->getLoc().line, node->getLoc().getFilename()); + if (node->getLeft()->getAsSymbolNode() != nullptr && node->getLeft()->getType().isStruct()) { + glslangTypeToIdMap[node->getLeft()->getType().getStruct()] = node->getLeft()->getAsSymbolNode()->getId(); + } + if (node->getRight()->getAsSymbolNode() != nullptr && node->getRight()->getType().isStruct()) { + glslangTypeToIdMap[node->getRight()->getType().getStruct()] = node->getRight()->getAsSymbolNode()->getId(); + } SpecConstantOpModeGuard spec_constant_op_mode_setter(&builder); if (node->getType().getQualifier().isSpecConstant()) @@ -1734,7 +1853,7 @@ bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::T // Load through a block reference is performed with a dot operator that // is mapped to EOpIndexDirectStruct. When we get to the actual reference, // do a load and reset the access chain. - if (node->getLeft()->getBasicType() == glslang::EbtReference && + if (node->getLeft()->isReference() && !node->getLeft()->getType().isArray() && node->getOp() == glslang::EOpIndexDirectStruct) { @@ -1749,9 +1868,12 @@ bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::T { // This may be, e.g., an anonymous block-member selection, which generally need // index remapping due to hidden members in anonymous blocks. - std::vector<int>& remapper = memberRemapper[node->getLeft()->getType().getStruct()]; - assert(remapper.size() > 0); - spvIndex = remapper[glslangIndex]; + int glslangId = glslangTypeToIdMap[node->getLeft()->getType().getStruct()]; + if (memberRemapper.find(glslangId) != memberRemapper.end()) { + std::vector<int>& remapper = memberRemapper[glslangId]; + assert(remapper.size() > 0); + spvIndex = remapper[glslangIndex]; + } } // normal case for indexing array or structure or block @@ -1860,6 +1982,71 @@ bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::T } } +// Figure out what, if any, type changes are needed when accessing a specific built-in. +// Returns <the type SPIR-V requires for declarion, the type to translate to on use>. +// Also see comment for 'forceType', regarding tracking SPIR-V-required types. +std::pair<spv::Id, spv::Id> TGlslangToSpvTraverser::getForcedType(spv::BuiltIn builtIn, + const glslang::TType& glslangType) +{ + switch(builtIn) + { + case spv::BuiltInSubgroupEqMask: + case spv::BuiltInSubgroupGeMask: + case spv::BuiltInSubgroupGtMask: + case spv::BuiltInSubgroupLeMask: + case spv::BuiltInSubgroupLtMask: { + // these require changing a 64-bit scaler -> a vector of 32-bit components + if (glslangType.isVector()) + break; + std::pair<spv::Id, spv::Id> ret(builder.makeVectorType(builder.makeUintType(32), 4), + builder.makeUintType(64)); + return ret; + } + default: + break; + } + + std::pair<spv::Id, spv::Id> ret(spv::NoType, spv::NoType); + return ret; +} + +// For an object previously identified (see getForcedType() and forceType) +// as needing type translations, do the translation needed for a load, turning +// an L-value into in R-value. +spv::Id TGlslangToSpvTraverser::translateForcedType(spv::Id object) +{ + const auto forceIt = forceType.find(object); + if (forceIt == forceType.end()) + return object; + + spv::Id desiredTypeId = forceIt->second; + spv::Id objectTypeId = builder.getTypeId(object); + assert(builder.isPointerType(objectTypeId)); + objectTypeId = builder.getContainedTypeId(objectTypeId); + if (builder.isVectorType(objectTypeId) && + builder.getScalarTypeWidth(builder.getContainedTypeId(objectTypeId)) == 32) { + if (builder.getScalarTypeWidth(desiredTypeId) == 64) { + // handle 32-bit v.xy* -> 64-bit + builder.clearAccessChain(); + builder.setAccessChainLValue(object); + object = builder.accessChainLoad(spv::NoPrecision, spv::DecorationMax, objectTypeId); + std::vector<spv::Id> components; + components.push_back(builder.createCompositeExtract(object, builder.getContainedTypeId(objectTypeId), 0)); + components.push_back(builder.createCompositeExtract(object, builder.getContainedTypeId(objectTypeId), 1)); + + spv::Id vecType = builder.makeVectorType(builder.getContainedTypeId(objectTypeId), 2); + return builder.createUnaryOp(spv::OpBitcast, desiredTypeId, + builder.createCompositeConstruct(vecType, components)); + } else { + logger->missingFunctionality("forcing 32-bit vector type to non 64-bit scalar"); + } + } else { + logger->missingFunctionality("forcing non 32-bit vector type"); + } + + return object; +} + bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TIntermUnary* node) { builder.setLine(node->getLoc().line, node->getLoc().getFilename()); @@ -1935,20 +2122,31 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI invertedType = getInvertedSwizzleType(*node->getOperand()); builder.clearAccessChain(); + TIntermNode *operandNode; if (invertedType != spv::NoType) - node->getOperand()->getAsBinaryNode()->getLeft()->traverse(this); + operandNode = node->getOperand()->getAsBinaryNode()->getLeft(); else - node->getOperand()->traverse(this); + operandNode = node->getOperand(); + + operandNode->traverse(this); spv::Id operand = spv::NoResult; + spv::Builder::AccessChain::CoherentFlags lvalueCoherentFlags; + +#ifndef GLSLANG_WEB if (node->getOp() == glslang::EOpAtomicCounterIncrement || node->getOp() == glslang::EOpAtomicCounterDecrement || node->getOp() == glslang::EOpAtomicCounter || - node->getOp() == glslang::EOpInterpolateAtCentroid) + node->getOp() == glslang::EOpInterpolateAtCentroid) { operand = builder.accessChainGetLValue(); // Special case l-value operands - else + lvalueCoherentFlags = builder.getAccessChain().coherentFlags; + lvalueCoherentFlags |= TranslateCoherent(operandNode->getAsTyped()->getType()); + } else +#endif + { operand = accessChainLoad(node->getOperand()->getType()); + } OpDecorations decorations = { TranslatePrecisionDecoration(node->getOperationPrecision()), TranslateNoContractionDecoration(node->getType().getQualifier()), @@ -1960,12 +2158,12 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI // if not, then possibly an operation if (! result) - result = createUnaryOperation(node->getOp(), decorations, resultType(), operand, node->getOperand()->getBasicType()); + result = createUnaryOperation(node->getOp(), decorations, resultType(), operand, node->getOperand()->getBasicType(), lvalueCoherentFlags); if (result) { if (invertedType) { result = createInvertedSwizzle(decorations.precision, *node->getOperand(), result); - builder.addDecoration(result, decorations.nonUniform); + decorations.addNonUniform(builder, result); } builder.clearAccessChain(); @@ -1985,6 +2183,7 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI spv::Id one = 0; if (node->getBasicType() == glslang::EbtFloat) one = builder.makeFloatConstant(1.0F); +#ifndef GLSLANG_WEB else if (node->getBasicType() == glslang::EbtDouble) one = builder.makeDoubleConstant(1.0); else if (node->getBasicType() == glslang::EbtFloat16) @@ -1995,6 +2194,7 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI one = builder.makeInt16Constant(1); else if (node->getBasicType() == glslang::EbtInt64 || node->getBasicType() == glslang::EbtUint64) one = builder.makeInt64Constant(1); +#endif else one = builder.makeIntConstant(1); glslang::TOperator op; @@ -2022,12 +2222,14 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI return false; +#ifndef GLSLANG_WEB case glslang::EOpEmitStreamVertex: builder.createNoResultOp(spv::OpEmitStreamVertex, operand); return false; case glslang::EOpEndStreamPrimitive: builder.createNoResultOp(spv::OpEndStreamPrimitive, operand); return false; +#endif default: logger->missingFunctionality("unknown glslang unary"); @@ -2035,6 +2237,39 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI } } +// Construct a composite object, recursively copying members if their types don't match +spv::Id TGlslangToSpvTraverser::createCompositeConstruct(spv::Id resultTypeId, std::vector<spv::Id> constituents) +{ + for (int c = 0; c < (int)constituents.size(); ++c) { + spv::Id& constituent = constituents[c]; + spv::Id lType = builder.getContainedTypeId(resultTypeId, c); + spv::Id rType = builder.getTypeId(constituent); + if (lType != rType) { + if (glslangIntermediate->getSpv().spv >= glslang::EShTargetSpv_1_4) { + constituent = builder.createUnaryOp(spv::OpCopyLogical, lType, constituent); + } else if (builder.isStructType(rType)) { + std::vector<spv::Id> rTypeConstituents; + int numrTypeConstituents = builder.getNumTypeConstituents(rType); + for (int i = 0; i < numrTypeConstituents; ++i) { + rTypeConstituents.push_back(builder.createCompositeExtract(constituent, builder.getContainedTypeId(rType, i), i)); + } + constituents[c] = createCompositeConstruct(lType, rTypeConstituents); + } else { + assert(builder.isArrayType(rType)); + std::vector<spv::Id> rTypeConstituents; + int numrTypeConstituents = builder.getNumTypeConstituents(rType); + + spv::Id elementRType = builder.getContainedTypeId(rType); + for (int i = 0; i < numrTypeConstituents; ++i) { + rTypeConstituents.push_back(builder.createCompositeExtract(constituent, elementRType, i)); + } + constituents[c] = createCompositeConstruct(lType, rTypeConstituents); + } + } + } + return builder.createCompositeConstruct(resultTypeId, constituents); +} + bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TIntermAggregate* node) { SpecConstantOpModeGuard spec_constant_op_mode_setter(&builder); @@ -2052,14 +2287,15 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt builder.setAccessChainRValue(result); return false; - } else if (node->getOp() == glslang::EOpImageStore || -#ifdef AMD_EXTENSIONS + } +#ifndef GLSLANG_WEB + else if (node->getOp() == glslang::EOpImageStore || node->getOp() == glslang::EOpImageStoreLod || -#endif node->getOp() == glslang::EOpImageAtomicStore) { // "imageStore" is a special case, which has no result return false; } +#endif glslang::TOperator binOp = glslang::EOpNull; bool reduceComparison = true; @@ -2067,6 +2303,8 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt bool noReturnValue = false; bool atomic = false; + spv::Builder::AccessChain::CoherentFlags lvalueCoherentFlags; + assert(node->getOp()); spv::Decoration precision = TranslatePrecisionDecoration(node->getOperationPrecision()); @@ -2264,7 +2502,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt { builder.setLine(node->getLoc().line, node->getLoc().getFilename()); std::vector<spv::Id> arguments; - translateArguments(*node, arguments); + translateArguments(*node, arguments, lvalueCoherentFlags); spv::Id constructed; if (node->getOp() == glslang::EOpConstructTextureSampler) constructed = builder.createOp(spv::OpSampledImage, resultType(), arguments); @@ -2274,7 +2512,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt std::vector<spv::Id> constituents; for (int c = 0; c < (int)arguments.size(); ++c) constituents.push_back(arguments[c]); - constructed = builder.createCompositeConstruct(resultType(), constituents); + constructed = createCompositeConstruct(resultType(), constituents); } else if (isMatrix) constructed = builder.createMatrixConstructor(precision, arguments, resultType()); else @@ -2327,6 +2565,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt // which can be emitted by the one in createBinaryOperation() binOp = glslang::EOpMod; break; + case glslang::EOpEmitVertex: case glslang::EOpEndPrimitive: case glslang::EOpBarrier: @@ -2350,10 +2589,6 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt // These all have 0 operands and will naturally finish up in the code below for 0 operands break; - case glslang::EOpAtomicStore: - noReturnValue = true; - // fallthrough - case glslang::EOpAtomicLoad: case glslang::EOpAtomicAdd: case glslang::EOpAtomicMin: case glslang::EOpAtomicMax: @@ -2365,6 +2600,14 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt atomic = true; break; +#ifndef GLSLANG_WEB + case glslang::EOpAtomicStore: + noReturnValue = true; + // fallthrough + case glslang::EOpAtomicLoad: + atomic = true; + break; + case glslang::EOpAtomicCounterAdd: case glslang::EOpAtomicCounterSubtract: case glslang::EOpAtomicCounterMin: @@ -2379,7 +2622,17 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt atomic = true; break; -#ifdef NV_EXTENSIONS + case glslang::EOpAbsDifference: + case glslang::EOpAddSaturate: + case glslang::EOpSubSaturate: + case glslang::EOpAverage: + case glslang::EOpAverageRounded: + case glslang::EOpMul32x16: + builder.addCapability(spv::CapabilityIntegerFunctions2INTEL); + builder.addExtension("SPV_INTEL_shader_integer_functions2"); + binOp = node->getOp(); + break; + case glslang::EOpIgnoreIntersectionNV: case glslang::EOpTerminateRayNV: case glslang::EOpTraceNV: @@ -2387,11 +2640,16 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt case glslang::EOpWritePackedPrimitiveIndices4x8NV: noReturnValue = true; break; -#endif case glslang::EOpCooperativeMatrixLoad: case glslang::EOpCooperativeMatrixStore: noReturnValue = true; break; + case glslang::EOpBeginInvocationInterlock: + case glslang::EOpEndInvocationInterlock: + builder.addExtension(spv::E_SPV_EXT_fragment_shader_interlock); + noReturnValue = true; + break; +#endif default: break; @@ -2439,16 +2697,31 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt // special case l-value operands; there are just a few bool lvalue = false; switch (node->getOp()) { - case glslang::EOpFrexp: case glslang::EOpModf: if (arg == 1) lvalue = true; break; + + case glslang::EOpAtomicAdd: + case glslang::EOpAtomicMin: + case glslang::EOpAtomicMax: + case glslang::EOpAtomicAnd: + case glslang::EOpAtomicOr: + case glslang::EOpAtomicXor: + case glslang::EOpAtomicExchange: + case glslang::EOpAtomicCompSwap: + if (arg == 0) + lvalue = true; + break; + +#ifndef GLSLANG_WEB + case glslang::EOpFrexp: + if (arg == 1) + lvalue = true; + break; case glslang::EOpInterpolateAtSample: case glslang::EOpInterpolateAtOffset: -#ifdef AMD_EXTENSIONS case glslang::EOpInterpolateAtVertex: -#endif if (arg == 0) { lvalue = true; @@ -2459,14 +2732,6 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt invertedType = convertGlslangToSpvType(glslangOperands[0]->getAsBinaryNode()->getLeft()->getType()); } break; - case glslang::EOpAtomicAdd: - case glslang::EOpAtomicMin: - case glslang::EOpAtomicMax: - case glslang::EOpAtomicAnd: - case glslang::EOpAtomicOr: - case glslang::EOpAtomicXor: - case glslang::EOpAtomicExchange: - case glslang::EOpAtomicCompSwap: case glslang::EOpAtomicLoad: case glslang::EOpAtomicStore: case glslang::EOpAtomicCounterAdd: @@ -2499,6 +2764,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt if (arg == 1) lvalue = true; break; +#endif default: break; } @@ -2508,6 +2774,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt else glslangOperands[arg]->traverse(this); +#ifndef GLSLANG_WEB if (node->getOp() == glslang::EOpCooperativeMatrixLoad || node->getOp() == glslang::EOpCooperativeMatrixStore) { @@ -2550,16 +2817,20 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt continue; } } +#endif - if (lvalue) + if (lvalue) { operands.push_back(builder.accessChainGetLValue()); - else { + lvalueCoherentFlags = builder.getAccessChain().coherentFlags; + lvalueCoherentFlags |= TranslateCoherent(glslangOperands[arg]->getAsTyped()->getType()); + } else { builder.setLine(node->getLoc().line, node->getLoc().getFilename()); operands.push_back(accessChainLoad(glslangOperands[arg]->getAsTyped()->getType())); } } builder.setLine(node->getLoc().line, node->getLoc().getFilename()); +#ifndef GLSLANG_WEB if (node->getOp() == glslang::EOpCooperativeMatrixLoad) { std::vector<spv::IdImmediate> idImmOps; @@ -2586,9 +2857,11 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt builder.createNoResultOp(spv::OpCooperativeMatrixStoreNV, idImmOps); result = 0; - } else if (atomic) { + } else +#endif + if (atomic) { // Handle all atomics - result = createAtomicOperation(node->getOp(), precision, resultType(), operands, node->getBasicType()); + result = createAtomicOperation(node->getOp(), precision, resultType(), operands, node->getBasicType(), lvalueCoherentFlags); } else { // Pass through to generic operations. switch (glslangOperands.size()) { @@ -2603,7 +2876,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt result = createUnaryOperation( node->getOp(), decorations, resultType(), operands.front(), - glslangOperands[0]->getAsTyped()->getBasicType()); + glslangOperands[0]->getAsTyped()->getBasicType(), lvalueCoherentFlags); } break; default: @@ -2965,6 +3238,14 @@ bool TGlslangToSpvTraverser::visitBranch(glslang::TVisit /* visit */, glslang::T builder.clearAccessChain(); break; +#ifndef GLSLANG_WEB + case glslang::EOpDemote: + builder.createNoResultOp(spv::OpDemoteToHelperInvocationEXT); + builder.addExtension(spv::E_SPV_EXT_demote_to_helper_invocation); + builder.addCapability(spv::CapabilityDemoteToHelperInvocationEXT); + break; +#endif + default: assert(0); break; @@ -2973,7 +3254,7 @@ bool TGlslangToSpvTraverser::visitBranch(glslang::TVisit /* visit */, glslang::T return false; } -spv::Id TGlslangToSpvTraverser::createSpvVariable(const glslang::TIntermSymbol* node) +spv::Id TGlslangToSpvTraverser::createSpvVariable(const glslang::TIntermSymbol* node, spv::Id forcedType) { // First, steer off constants, which are not SPIR-V variables, but // can still have a mapping to a SPIR-V Id. @@ -2986,51 +3267,57 @@ spv::Id TGlslangToSpvTraverser::createSpvVariable(const glslang::TIntermSymbol* // Now, handle actual variables spv::StorageClass storageClass = TranslateStorageClass(node->getType()); - spv::Id spvType = convertGlslangToSpvType(node->getType()); + spv::Id spvType = forcedType == spv::NoType ? convertGlslangToSpvType(node->getType()) + : forcedType; - const bool contains16BitType = node->getType().containsBasicType(glslang::EbtFloat16) || - node->getType().containsBasicType(glslang::EbtInt16) || - node->getType().containsBasicType(glslang::EbtUint16); + const bool contains16BitType = node->getType().contains16BitFloat() || + node->getType().contains16BitInt(); if (contains16BitType) { switch (storageClass) { case spv::StorageClassInput: case spv::StorageClassOutput: - addPre13Extension(spv::E_SPV_KHR_16bit_storage); + builder.addIncorporatedExtension(spv::E_SPV_KHR_16bit_storage, spv::Spv_1_3); builder.addCapability(spv::CapabilityStorageInputOutput16); break; - case spv::StorageClassPushConstant: - addPre13Extension(spv::E_SPV_KHR_16bit_storage); - builder.addCapability(spv::CapabilityStoragePushConstant16); - break; case spv::StorageClassUniform: - addPre13Extension(spv::E_SPV_KHR_16bit_storage); + builder.addIncorporatedExtension(spv::E_SPV_KHR_16bit_storage, spv::Spv_1_3); if (node->getType().getQualifier().storage == glslang::EvqBuffer) builder.addCapability(spv::CapabilityStorageUniformBufferBlock16); else builder.addCapability(spv::CapabilityStorageUniform16); break; +#ifndef GLSLANG_WEB + case spv::StorageClassPushConstant: + builder.addIncorporatedExtension(spv::E_SPV_KHR_16bit_storage, spv::Spv_1_3); + builder.addCapability(spv::CapabilityStoragePushConstant16); + break; case spv::StorageClassStorageBuffer: case spv::StorageClassPhysicalStorageBufferEXT: - addPre13Extension(spv::E_SPV_KHR_16bit_storage); + builder.addIncorporatedExtension(spv::E_SPV_KHR_16bit_storage, spv::Spv_1_3); builder.addCapability(spv::CapabilityStorageUniformBufferBlock16); break; +#endif default: + if (node->getType().contains16BitFloat()) + builder.addCapability(spv::CapabilityFloat16); + if (node->getType().contains16BitInt()) + builder.addCapability(spv::CapabilityInt16); break; } } - const bool contains8BitType = node->getType().containsBasicType(glslang::EbtInt8) || - node->getType().containsBasicType(glslang::EbtUint8); - if (contains8BitType) { + if (node->getType().contains8BitInt()) { if (storageClass == spv::StorageClassPushConstant) { - builder.addExtension(spv::E_SPV_KHR_8bit_storage); + builder.addIncorporatedExtension(spv::E_SPV_KHR_8bit_storage, spv::Spv_1_5); builder.addCapability(spv::CapabilityStoragePushConstant8); } else if (storageClass == spv::StorageClassUniform) { - builder.addExtension(spv::E_SPV_KHR_8bit_storage); + builder.addIncorporatedExtension(spv::E_SPV_KHR_8bit_storage, spv::Spv_1_5); builder.addCapability(spv::CapabilityUniformAndStorageBuffer8BitAccess); } else if (storageClass == spv::StorageClassStorageBuffer) { - builder.addExtension(spv::E_SPV_KHR_8bit_storage); + builder.addIncorporatedExtension(spv::E_SPV_KHR_8bit_storage, spv::Spv_1_5); builder.addCapability(spv::CapabilityStorageBuffer8BitAccess); + } else { + builder.addCapability(spv::CapabilityInt8); } } @@ -3045,15 +3332,15 @@ spv::Id TGlslangToSpvTraverser::createSpvVariable(const glslang::TIntermSymbol* spv::Id TGlslangToSpvTraverser::getSampledType(const glslang::TSampler& sampler) { switch (sampler.type) { + case glslang::EbtInt: return builder.makeIntType(32); + case glslang::EbtUint: return builder.makeUintType(32); case glslang::EbtFloat: return builder.makeFloatType(32); -#ifdef AMD_EXTENSIONS +#ifndef GLSLANG_WEB 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::EbtUint: return builder.makeUintType(32); default: assert(0); return builder.makeFloatType(32); @@ -3111,23 +3398,30 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty spvType = builder.makeVoidType(); assert (! type.isArray()); break; + case glslang::EbtBool: + // "transparent" bool doesn't exist in SPIR-V. The GLSL convention is + // a 32-bit int where non-0 means true. + if (explicitLayout != glslang::ElpNone) + spvType = builder.makeUintType(32); + else + spvType = builder.makeBoolType(); + break; + case glslang::EbtInt: + spvType = builder.makeIntType(32); + break; + case glslang::EbtUint: + spvType = builder.makeUintType(32); + break; case glslang::EbtFloat: spvType = builder.makeFloatType(32); break; +#ifndef GLSLANG_WEB case glslang::EbtDouble: spvType = builder.makeFloatType(64); break; case glslang::EbtFloat16: spvType = builder.makeFloatType(16); break; - case glslang::EbtBool: - // "transparent" bool doesn't exist in SPIR-V. The GLSL convention is - // a 32-bit int where non-0 means true. - if (explicitLayout != glslang::ElpNone) - spvType = builder.makeUintType(32); - else - spvType = builder.makeBoolType(); - break; case glslang::EbtInt8: spvType = builder.makeIntType(8); break; @@ -3140,12 +3434,6 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty case glslang::EbtUint16: spvType = builder.makeUintType(16); break; - case glslang::EbtInt: - spvType = builder.makeIntType(32); - break; - case glslang::EbtUint: - spvType = builder.makeUintType(32); - break; case glslang::EbtInt64: spvType = builder.makeIntType(64); break; @@ -3156,22 +3444,38 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty builder.addCapability(spv::CapabilityAtomicStorage); spvType = builder.makeUintType(32); break; -#ifdef NV_EXTENSIONS case glslang::EbtAccStructNV: spvType = builder.makeAccelerationStructureNVType(); break; + case glslang::EbtReference: + { + // Make the forward pointer, then recurse to convert the structure type, then + // patch up the forward pointer with a real pointer type. + if (forwardPointers.find(type.getReferentType()) == forwardPointers.end()) { + spv::Id forwardId = builder.makeForwardPointer(spv::StorageClassPhysicalStorageBufferEXT); + forwardPointers[type.getReferentType()] = forwardId; + } + spvType = forwardPointers[type.getReferentType()]; + if (!forwardReferenceOnly) { + spv::Id referentType = convertGlslangToSpvType(*type.getReferentType()); + builder.makePointerFromForwardPointer(spv::StorageClassPhysicalStorageBufferEXT, + forwardPointers[type.getReferentType()], + referentType); + } + } + break; #endif case glslang::EbtSampler: { const glslang::TSampler& sampler = type.getSampler(); - if (sampler.sampler) { - // pure sampler + if (sampler.isPureSampler()) { spvType = builder.makeSamplerType(); } else { // an image is present, make its type - spvType = builder.makeImageType(getSampledType(sampler), TranslateDimensionality(sampler), sampler.shadow, sampler.arrayed, sampler.ms, - sampler.image ? 2 : 1, TranslateImageFormat(type)); - if (sampler.combined) { + spvType = builder.makeImageType(getSampledType(sampler), TranslateDimensionality(sampler), + sampler.isShadow(), sampler.isArrayed(), sampler.isMultiSample(), + sampler.isImageClass() ? 2 : 1, TranslateImageFormat(type)); + if (sampler.isCombined()) { // already has both image and sampler, make the combined type spvType = builder.makeSampledImageType(spvType); } @@ -3193,27 +3497,10 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty // else, we haven't seen it... if (type.getBasicType() == glslang::EbtBlock) - memberRemapper[glslangMembers].resize(glslangMembers->size()); + memberRemapper[glslangTypeToIdMap[glslangMembers]].resize(glslangMembers->size()); spvType = convertGlslangStructToSpvType(type, glslangMembers, explicitLayout, qualifier); } break; - case glslang::EbtReference: - { - // Make the forward pointer, then recurse to convert the structure type, then - // patch up the forward pointer with a real pointer type. - if (forwardPointers.find(type.getReferentType()) == forwardPointers.end()) { - spv::Id forwardId = builder.makeForwardPointer(spv::StorageClassPhysicalStorageBufferEXT); - forwardPointers[type.getReferentType()] = forwardId; - } - spvType = forwardPointers[type.getReferentType()]; - if (!forwardReferenceOnly) { - spv::Id referentType = convertGlslangToSpvType(*type.getReferentType()); - builder.makePointerFromForwardPointer(spv::StorageClassPhysicalStorageBufferEXT, - forwardPointers[type.getReferentType()], - referentType); - } - } - break; default: assert(0); break; @@ -3232,6 +3519,10 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty builder.addExtension(spv::E_SPV_NV_cooperative_matrix); if (type.getBasicType() == glslang::EbtFloat16) builder.addCapability(spv::CapabilityFloat16); + if (type.getBasicType() == glslang::EbtUint8 || + type.getBasicType() == glslang::EbtInt8) { + builder.addCapability(spv::CapabilityInt8); + } spv::Id scope = makeArraySizeId(*type.getTypeParameters(), 1); spv::Id rows = makeArraySizeId(*type.getTypeParameters(), 2); @@ -3278,10 +3569,12 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty if (type.isSizedArray()) spvType = builder.makeArrayType(spvType, makeArraySizeId(*type.getArraySizes(), 0), stride); else { +#ifndef GLSLANG_WEB if (!lastBufferBlockMember) { - builder.addExtension("SPV_EXT_descriptor_indexing"); + builder.addIncorporatedExtension("SPV_EXT_descriptor_indexing", spv::Spv_1_5); builder.addCapability(spv::CapabilityRuntimeDescriptorArrayEXT); } +#endif spvType = builder.makeRuntimeArray(spvType); } if (stride > 0) @@ -3297,7 +3590,7 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty // bool TGlslangToSpvTraverser::filterMember(const glslang::TType& member) { -#ifdef NV_EXTENSIONS +#ifndef GLSLANG_WEB auto& extensions = glslangIntermediate->getRequestedExtensions(); if (member.getFieldName() == "gl_SecondaryViewportMaskNV" && @@ -3340,12 +3633,15 @@ spv::Id TGlslangToSpvTraverser::convertGlslangStructToSpvType(const glslang::TTy if (glslangMember.hiddenMember()) { ++memberDelta; if (type.getBasicType() == glslang::EbtBlock) - memberRemapper[glslangMembers][i] = -1; + memberRemapper[glslangTypeToIdMap[glslangMembers]][i] = -1; } else { if (type.getBasicType() == glslang::EbtBlock) { - memberRemapper[glslangMembers][i] = i - memberDelta; - if (filterMember(glslangMember)) + if (filterMember(glslangMember)) { + memberDelta++; + memberRemapper[glslangTypeToIdMap[glslangMembers]][i] = -1; continue; + } + memberRemapper[glslangTypeToIdMap[glslangMembers]][i] = i - memberDelta; } // modify just this child's view of the qualifier glslang::TQualifier memberQualifier = glslangMember.getQualifier(); @@ -3361,7 +3657,7 @@ spv::Id TGlslangToSpvTraverser::convertGlslangStructToSpvType(const glslang::TTy // Make forward pointers for any pointer members, and create a list of members to // convert to spirv types after creating the struct. - if (glslangMember.getBasicType() == glslang::EbtReference) { + if (glslangMember.isReference()) { if (forwardPointers.find(glslangMember.getReferentType()) == forwardPointers.end()) { deferredForwardPointers.push_back(std::make_pair(&glslangMember, memberQualifier)); } @@ -3403,7 +3699,7 @@ void TGlslangToSpvTraverser::decorateStructType(const glslang::TType& type, glslang::TType& glslangMember = *(*glslangMembers)[i].type; int member = i; if (type.getBasicType() == glslang::EbtBlock) { - member = memberRemapper[glslangMembers][i]; + member = memberRemapper[glslangTypeToIdMap[glslangMembers]][i]; if (filterMember(glslangMember)) continue; } @@ -3428,13 +3724,14 @@ void TGlslangToSpvTraverser::decorateStructType(const glslang::TType& type, glslangIntermediate->getSource() == glslang::EShSourceHlsl) { builder.addMemberDecoration(spvType, member, TranslateInterpolationDecoration(memberQualifier)); builder.addMemberDecoration(spvType, member, TranslateAuxiliaryStorageDecoration(memberQualifier)); -#ifdef NV_EXTENSIONS +#ifndef GLSLANG_WEB addMeshNVDecoration(spvType, member, memberQualifier); #endif } } builder.addMemberDecoration(spvType, member, TranslateInvariantDecoration(memberQualifier)); +#ifndef GLSLANG_WEB if (type.getBasicType() == glslang::EbtBlock && qualifier.storage == glslang::EvqBuffer) { // Add memory decorations only to top-level members of shader storage block @@ -3444,6 +3741,8 @@ void TGlslangToSpvTraverser::decorateStructType(const glslang::TType& type, builder.addMemberDecoration(spvType, member, memory[i]); } +#endif + // Location assignment was already completed correctly by the front end, // just track whether a member needs to be decorated. // Ignore member locations if the container is an array, as that's @@ -3480,6 +3779,7 @@ void TGlslangToSpvTraverser::decorateStructType(const glslang::TType& type, if (builtIn != spv::BuiltInMax) builder.addMemberDecoration(spvType, member, spv::DecorationBuiltIn, (int)builtIn); +#ifndef GLSLANG_WEB // nonuniform builder.addMemberDecoration(spvType, member, TranslateNonUniformDecoration(glslangMember.getQualifier())); @@ -3489,7 +3789,6 @@ void TGlslangToSpvTraverser::decorateStructType(const glslang::TType& type, memberQualifier.semanticName); } -#ifdef NV_EXTENSIONS if (builtIn == spv::BuiltInLayer) { // SPV_NV_viewport_array2 extension if (glslangMember.getQualifier().layoutViewportRelative){ @@ -3828,10 +4127,10 @@ void TGlslangToSpvTraverser::declareUseOfStructMember(const glslang::TTypeList& const glslang::TBuiltInVariable glslangBuiltIn = members[glslangMember].type->getQualifier().builtIn; switch (glslangBuiltIn) { + case glslang::EbvPointSize: +#ifndef GLSLANG_WEB case glslang::EbvClipDistance: case glslang::EbvCullDistance: - case glslang::EbvPointSize: -#ifdef NV_EXTENSIONS case glslang::EbvViewportMaskNV: case glslang::EbvSecondaryPositionNV: case glslang::EbvSecondaryViewportMaskNV: @@ -3894,15 +4193,17 @@ void TGlslangToSpvTraverser::makeFunctions(const glslang::TIntermSequence& glslF if (paramPrecision != spv::NoPrecision) decorations.push_back(paramPrecision); TranslateMemoryDecoration(type.getQualifier(), decorations, useVulkanMemoryModel); - if (type.getBasicType() == glslang::EbtReference) { + if (type.isReference()) { // Original and non-writable params pass the pointer directly and // use restrict/aliased, others are stored to a pointer in Function // memory and use RestrictPointer/AliasedPointer. if (originalParam(type.getQualifier().storage, type, false) || !writableParam(type.getQualifier().storage)) { - decorations.push_back(type.getQualifier().restrict ? spv::DecorationRestrict : spv::DecorationAliased); + decorations.push_back(type.getQualifier().isRestrict() ? spv::DecorationRestrict : + spv::DecorationAliased); } else { - decorations.push_back(type.getQualifier().restrict ? spv::DecorationRestrictPointerEXT : spv::DecorationAliasedPointerEXT); + decorations.push_back(type.getQualifier().isRestrict() ? spv::DecorationRestrictPointerEXT : + spv::DecorationAliasedPointerEXT); } } }; @@ -3930,8 +4231,12 @@ void TGlslangToSpvTraverser::makeFunctions(const glslang::TIntermSequence& glslF std::vector<std::vector<spv::Decoration>> paramDecorations; // list of decorations per parameter glslang::TIntermSequence& parameters = glslFunction->getSequence()[0]->getAsAggregate()->getSequence(); +#ifdef ENABLE_HLSL bool implicitThis = (int)parameters.size() > 0 && parameters[0]->getAsSymbolNode()->getName() == glslangIntermediate->implicitThisName; +#else + bool implicitThis = false; +#endif paramDecorations.resize(parameters.size()); for (int p = 0; p < (int)parameters.size(); ++p) { @@ -3963,6 +4268,14 @@ void TGlslangToSpvTraverser::makeFunctions(const glslang::TIntermSequence& glslF symbolValues[parameters[p]->getAsSymbolNode()->getId()] = function->getParamId(p); // give a name too builder.addName(function->getParamId(p), parameters[p]->getAsSymbolNode()->getName().c_str()); + + const glslang::TType& paramType = parameters[p]->getAsTyped()->getType(); + if (paramType.contains8BitInt()) + builder.addCapability(spv::CapabilityInt8); + if (paramType.contains16BitInt()) + builder.addCapability(spv::CapabilityInt16); + if (paramType.contains16BitFloat()) + builder.addCapability(spv::CapabilityFloat16); } } } @@ -4001,19 +4314,19 @@ void TGlslangToSpvTraverser::handleFunctionEntry(const glslang::TIntermAggregate builder.setBuildPoint(functionBlock); } -void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate& node, std::vector<spv::Id>& arguments) +void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate& node, std::vector<spv::Id>& arguments, spv::Builder::AccessChain::CoherentFlags &lvalueCoherentFlags) { const glslang::TIntermSequence& glslangArguments = node.getSequence(); glslang::TSampler sampler = {}; bool cubeCompare = false; -#ifdef AMD_EXTENSIONS +#ifndef GLSLANG_WEB bool f16ShadowCompare = false; #endif if (node.isTexture() || node.isImage()) { sampler = glslangArguments[0]->getAsTyped()->getType().getSampler(); cubeCompare = sampler.dim == glslang::EsdCube && sampler.arrayed && sampler.shadow; -#ifdef AMD_EXTENSIONS +#ifndef GLSLANG_WEB f16ShadowCompare = sampler.shadow && glslangArguments[1]->getAsTyped()->getType().getBasicType() == glslang::EbtFloat16; #endif } @@ -4022,6 +4335,7 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate& builder.clearAccessChain(); glslangArguments[i]->traverse(this); +#ifndef GLSLANG_WEB // Special case l-value operands bool lvalue = false; switch (node.getOp()) { @@ -4042,7 +4356,6 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate& if ((sampler.ms && i == 3) || (! sampler.ms && i == 2)) lvalue = true; break; -#ifdef AMD_EXTENSIONS case glslang::EOpSparseTexture: if (((cubeCompare || f16ShadowCompare) && i == 3) || (! (cubeCompare || f16ShadowCompare) && i == 2)) lvalue = true; @@ -4056,21 +4369,6 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate& if ((f16ShadowCompare && i == 4) || (! f16ShadowCompare && i == 3)) lvalue = true; break; -#else - case glslang::EOpSparseTexture: - if ((cubeCompare && i == 3) || (! cubeCompare && i == 2)) - lvalue = true; - break; - case glslang::EOpSparseTextureClamp: - if ((cubeCompare && i == 4) || (! cubeCompare && i == 3)) - lvalue = true; - break; - case glslang::EOpSparseTextureLod: - case glslang::EOpSparseTextureOffset: - if (i == 3) - lvalue = true; - break; -#endif case glslang::EOpSparseTextureFetch: if ((sampler.dim != glslang::EsdRect && i == 3) || (sampler.dim == glslang::EsdRect && i == 2)) lvalue = true; @@ -4079,7 +4377,6 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate& if ((sampler.dim != glslang::EsdRect && i == 4) || (sampler.dim == glslang::EsdRect && i == 3)) lvalue = true; break; -#ifdef AMD_EXTENSIONS case glslang::EOpSparseTextureLodOffset: case glslang::EOpSparseTextureGrad: case glslang::EOpSparseTextureOffsetClamp: @@ -4095,23 +4392,6 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate& if ((f16ShadowCompare && i == 7) || (! f16ShadowCompare && i == 6)) lvalue = true; break; -#else - case glslang::EOpSparseTextureLodOffset: - case glslang::EOpSparseTextureGrad: - case glslang::EOpSparseTextureOffsetClamp: - if (i == 4) - lvalue = true; - break; - case glslang::EOpSparseTextureGradOffset: - case glslang::EOpSparseTextureGradClamp: - if (i == 5) - lvalue = true; - break; - case glslang::EOpSparseTextureGradOffsetClamp: - if (i == 6) - lvalue = true; - break; -#endif case glslang::EOpSparseTextureGather: if ((sampler.shadow && i == 3) || (! sampler.shadow && i == 2)) lvalue = true; @@ -4121,7 +4401,6 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate& if ((sampler.shadow && i == 4) || (! sampler.shadow && i == 3)) lvalue = true; break; -#ifdef AMD_EXTENSIONS case glslang::EOpSparseTextureGatherLod: if (i == 3) lvalue = true; @@ -4135,8 +4414,6 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate& if (i == 3) lvalue = true; break; -#endif -#ifdef NV_EXTENSIONS case glslang::EOpImageSampleFootprintNV: if (i == 4) lvalue = true; @@ -4154,14 +4431,16 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate& if (i == 7) lvalue = true; break; -#endif default: break; } - if (lvalue) + if (lvalue) { arguments.push_back(builder.accessChainGetLValue()); - else + lvalueCoherentFlags = builder.getAccessChain().coherentFlags; + lvalueCoherentFlags |= TranslateCoherent(glslangArguments[i]->getAsTyped()->getType()); + } else +#endif arguments.push_back(accessChainLoad(glslangArguments[i]->getAsTyped()->getType())); } } @@ -4186,7 +4465,9 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO ? node->getAsAggregate()->getSequence()[0]->getAsTyped()->getType() : node->getAsUnaryNode()->getOperand()->getAsTyped()->getType(); const glslang::TSampler sampler = imageType.getSampler(); -#ifdef AMD_EXTENSIONS +#ifdef GLSLANG_WEB + const bool f16ShadowCompare = false; +#else bool f16ShadowCompare = (sampler.shadow && node->getAsAggregate()) ? node->getAsAggregate()->getSequence()[1]->getAsTyped()->getType().getBasicType() == glslang::EbtFloat16 : false; @@ -4202,9 +4483,11 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO return spv::ImageOperandsMaskNone; }; + spv::Builder::AccessChain::CoherentFlags lvalueCoherentFlags; + std::vector<spv::Id> arguments; if (node->getAsAggregate()) - translateArguments(*node->getAsAggregate(), arguments); + translateArguments(*node->getAsAggregate(), arguments, lvalueCoherentFlags); else translateArguments(*node->getAsUnaryNode(), arguments); spv::Decoration precision = TranslatePrecisionDecoration(node->getOperationPrecision()); @@ -4231,6 +4514,7 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO return builder.createTextureQueryCall(spv::OpImageQuerySizeLod, params, isUnsignedResult); } else return builder.createTextureQueryCall(spv::OpImageQuerySize, params, isUnsignedResult); +#ifndef GLSLANG_WEB case glslang::EOpImageQuerySamples: case glslang::EOpTextureQuerySamples: return builder.createTextureQueryCall(spv::OpImageQuerySamples, params, isUnsignedResult); @@ -4241,6 +4525,7 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO return builder.createTextureQueryCall(spv::OpImageQueryLevels, params, isUnsignedResult); case glslang::EOpSparseTexelsResident: return builder.createUnaryOp(spv::OpImageSparseTexelsResident, builder.makeBoolType(), arguments[0]); +#endif default: assert(0); break; @@ -4282,12 +4567,12 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO operands.push_back(coord); spv::IdImmediate imageOperands = { false, spv::ImageOperandsMaskNone }; imageOperands.word = imageOperands.word | signExtensionMask(); - if (sampler.ms) { + if (sampler.isMultiSample()) { imageOperands.word = imageOperands.word | spv::ImageOperandsSampleMask; } if (imageOperands.word != spv::ImageOperandsMaskNone) { operands.push_back(imageOperands); - if (sampler.ms) { + if (sampler.isMultiSample()) { spv::IdImmediate imageOperand = { true, *(opIt++) }; operands.push_back(imageOperand); } @@ -4299,22 +4584,16 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO spv::IdImmediate coord = { true, *(opIt++) }; operands.push_back(coord); -#ifdef AMD_EXTENSIONS if (node->getOp() == glslang::EOpImageLoad || node->getOp() == glslang::EOpImageLoadLod) { -#else - if (node->getOp() == glslang::EOpImageLoad) { -#endif spv::ImageOperandsMask mask = spv::ImageOperandsMaskNone; - if (sampler.ms) { + if (sampler.isMultiSample()) { mask = mask | spv::ImageOperandsSampleMask; } -#ifdef AMD_EXTENSIONS if (cracked.lod) { builder.addExtension(spv::E_SPV_AMD_shader_image_load_store_lod); builder.addCapability(spv::CapabilityImageReadWriteLodAMD); mask = mask | spv::ImageOperandsLodMask; } -#endif mask = mask | TranslateImageOperands(TranslateCoherent(imageType)); mask = (spv::ImageOperandsMask)(mask & ~spv::ImageOperandsMakeTexelAvailableKHRMask); mask = mask | signExtensionMask(); @@ -4326,12 +4605,10 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO spv::IdImmediate imageOperand = { true, *opIt++ }; operands.push_back(imageOperand); } -#ifdef AMD_EXTENSIONS if (mask & spv::ImageOperandsLodMask) { spv::IdImmediate imageOperand = { true, *opIt++ }; operands.push_back(imageOperand); } -#endif if (mask & spv::ImageOperandsMakeTexelVisibleKHRMask) { spv::IdImmediate imageOperand = { true, builder.makeUintConstant(TranslateMemoryScope(TranslateCoherent(imageType))) }; @@ -4349,18 +4626,10 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO result[0] = builder.createConstructor(precision, result, convertGlslangToSpvType(node->getType())); return result[0]; -#ifdef AMD_EXTENSIONS } else if (node->getOp() == glslang::EOpImageStore || node->getOp() == glslang::EOpImageStoreLod) { -#else - } else if (node->getOp() == glslang::EOpImageStore) { -#endif // Push the texel value before the operands -#ifdef AMD_EXTENSIONS - if (sampler.ms || cracked.lod) { -#else - if (sampler.ms) { -#endif + if (sampler.isMultiSample() || cracked.lod) { spv::IdImmediate texel = { true, *(opIt + 1) }; operands.push_back(texel); } else { @@ -4369,16 +4638,14 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO } spv::ImageOperandsMask mask = spv::ImageOperandsMaskNone; - if (sampler.ms) { + if (sampler.isMultiSample()) { mask = mask | spv::ImageOperandsSampleMask; } -#ifdef AMD_EXTENSIONS if (cracked.lod) { builder.addExtension(spv::E_SPV_AMD_shader_image_load_store_lod); builder.addCapability(spv::CapabilityImageReadWriteLodAMD); mask = mask | spv::ImageOperandsLodMask; } -#endif mask = mask | TranslateImageOperands(TranslateCoherent(imageType)); mask = (spv::ImageOperandsMask)(mask & ~spv::ImageOperandsMakeTexelVisibleKHRMask); mask = mask | signExtensionMask(); @@ -4390,12 +4657,10 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO spv::IdImmediate imageOperand = { true, *opIt++ }; operands.push_back(imageOperand); } -#ifdef AMD_EXTENSIONS if (mask & spv::ImageOperandsLodMask) { spv::IdImmediate imageOperand = { true, *opIt++ }; operands.push_back(imageOperand); } -#endif if (mask & spv::ImageOperandsMakeTexelAvailableKHRMask) { spv::IdImmediate imageOperand = { true, builder.makeUintConstant(TranslateMemoryScope(TranslateCoherent(imageType))) }; @@ -4406,28 +4671,22 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO if (builder.getImageTypeFormat(builder.getImageType(operands.front().word)) == spv::ImageFormatUnknown) builder.addCapability(spv::CapabilityStorageImageWriteWithoutFormat); return spv::NoResult; -#ifdef AMD_EXTENSIONS } else if (node->getOp() == glslang::EOpSparseImageLoad || node->getOp() == glslang::EOpSparseImageLoadLod) { -#else - } else if (node->getOp() == glslang::EOpSparseImageLoad) { -#endif builder.addCapability(spv::CapabilitySparseResidency); if (builder.getImageTypeFormat(builder.getImageType(operands.front().word)) == spv::ImageFormatUnknown) builder.addCapability(spv::CapabilityStorageImageReadWithoutFormat); spv::ImageOperandsMask mask = spv::ImageOperandsMaskNone; - if (sampler.ms) { + if (sampler.isMultiSample()) { mask = mask | spv::ImageOperandsSampleMask; } -#ifdef AMD_EXTENSIONS if (cracked.lod) { builder.addExtension(spv::E_SPV_AMD_shader_image_load_store_lod); builder.addCapability(spv::CapabilityImageReadWriteLodAMD); mask = mask | spv::ImageOperandsLodMask; } -#endif mask = mask | TranslateImageOperands(TranslateCoherent(imageType)); mask = (spv::ImageOperandsMask)(mask & ~spv::ImageOperandsMakeTexelAvailableKHRMask); mask = mask | signExtensionMask(); @@ -4439,12 +4698,10 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO spv::IdImmediate imageOperand = { true, *opIt++ }; operands.push_back(imageOperand); } -#ifdef AMD_EXTENSIONS if (mask & spv::ImageOperandsLodMask) { spv::IdImmediate imageOperand = { true, *opIt++ }; operands.push_back(imageOperand); } -#endif if (mask & spv::ImageOperandsMakeTexelVisibleKHRMask) { spv::IdImmediate imageOperand = { true, builder.makeUintConstant(TranslateMemoryScope(TranslateCoherent(imageType))) }; operands.push_back(imageOperand); @@ -4467,7 +4724,7 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO // GLSL "IMAGE_PARAMS" will involve in constructing an image texel pointer and this pointer, // as the first source operand, is required by SPIR-V atomic operations. // For non-MS, the sample value should be 0 - spv::IdImmediate sample = { true, sampler.ms ? *(opIt++) : builder.makeUintConstant(0) }; + spv::IdImmediate sample = { true, sampler.isMultiSample() ? *(opIt++) : builder.makeUintConstant(0) }; operands.push_back(sample); spv::Id resultTypeId; @@ -4485,11 +4742,11 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO for (; opIt != arguments.end(); ++opIt) operands.push_back(*opIt); - return createAtomicOperation(node->getOp(), precision, resultType(), operands, node->getBasicType()); + return createAtomicOperation(node->getOp(), precision, resultType(), operands, node->getBasicType(), lvalueCoherentFlags); } } -#ifdef AMD_EXTENSIONS +#ifndef GLSLANG_WEB // Check for fragment mask functions other than queries if (cracked.fragMask) { assert(sampler.ms); @@ -4530,45 +4787,32 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO // Check for texture functions other than queries bool sparse = node->isSparseTexture(); -#ifdef NV_EXTENSIONS bool imageFootprint = node->isImageFootprint(); -#endif - - bool cubeCompare = sampler.dim == glslang::EsdCube && sampler.arrayed && sampler.shadow; + bool cubeCompare = sampler.dim == glslang::EsdCube && sampler.isArrayed() && sampler.isShadow(); // check for bias argument bool bias = false; -#ifdef AMD_EXTENSIONS if (! cracked.lod && ! cracked.grad && ! cracked.fetch && ! cubeCompare) { -#else - if (! cracked.lod && ! cracked.gather && ! cracked.grad && ! cracked.fetch && ! cubeCompare) { -#endif int nonBiasArgCount = 2; -#ifdef AMD_EXTENSIONS if (cracked.gather) ++nonBiasArgCount; // comp argument should be present when bias argument is present if (f16ShadowCompare) ++nonBiasArgCount; -#endif if (cracked.offset) ++nonBiasArgCount; -#ifdef AMD_EXTENSIONS else if (cracked.offsets) ++nonBiasArgCount; -#endif if (cracked.grad) nonBiasArgCount += 2; if (cracked.lodClamp) ++nonBiasArgCount; if (sparse) ++nonBiasArgCount; -#ifdef NV_EXTENSIONS if (imageFootprint) //Following three extra arguments // int granularity, bool coarse, out gl_TextureFootprint2DNV footprint nonBiasArgCount += 3; -#endif if ((int)arguments.size() > nonBiasArgCount) bias = true; } @@ -4580,7 +4824,7 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO params.sampler = builder.createUnaryOp(spv::OpImage, builder.getImageType(params.sampler), params.sampler); } -#ifdef AMD_EXTENSIONS +#ifndef GLSLANG_WEB if (cracked.gather) { const auto& sourceExtensions = glslangIntermediate->getRequestedExtensions(); if (bias || cracked.lod || @@ -4598,11 +4842,7 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO bool noImplicitLod = false; // sort out where Dref is coming from -#ifdef AMD_EXTENSIONS if (cubeCompare || f16ShadowCompare) { -#else - if (cubeCompare) { -#endif params.Dref = arguments[2]; ++extraArgs; } else if (sampler.shadow && cracked.gather) { @@ -4623,19 +4863,15 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO if (cracked.lod) { params.lod = arguments[2 + extraArgs]; ++extraArgs; - } else if (glslangIntermediate->getStage() != EShLangFragment -#ifdef NV_EXTENSIONS - // NV_compute_shader_derivatives layout qualifiers allow for implicit LODs - && !(glslangIntermediate->getStage() == EShLangCompute && - (glslangIntermediate->getLayoutDerivativeModeNone() != glslang::LayoutDerivativeNone)) -#endif - ) { + } else if (glslangIntermediate->getStage() != EShLangFragment && + !(glslangIntermediate->getStage() == EShLangCompute && + glslangIntermediate->hasLayoutDerivativeModeNone())) { // we need to invent the default lod for an explicit lod instruction for a non-fragment stage noImplicitLod = true; } // multisample - if (sampler.ms) { + if (sampler.isMultiSample()) { params.sample = arguments[2 + extraArgs]; // For MS, "sample" should be specified ++extraArgs; } @@ -4656,6 +4892,7 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO ++extraArgs; } +#ifndef GLSLANG_WEB // lod clamp if (cracked.lodClamp) { params.lodClamp = arguments[2 + extraArgs]; @@ -4666,7 +4903,6 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO params.texelOut = arguments[2 + extraArgs]; ++extraArgs; } - // gather component if (cracked.gather && ! sampler.shadow) { // default component is 0, if missing, otherwise an argument @@ -4676,7 +4912,6 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO } else params.component = builder.makeIntConstant(0); } -#ifdef NV_EXTENSIONS spv::Id resultStruct = spv::NoResult; if (imageFootprint) { //Following three extra arguments @@ -4693,7 +4928,7 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO ++extraArgs; } -#ifdef NV_EXTENSIONS +#ifndef GLSLANG_WEB if (imageFootprint) { builder.addExtension(spv::E_SPV_NV_shader_image_footprint); builder.addCapability(spv::CapabilityImageFootprintNV); @@ -4776,6 +5011,7 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO } } +#ifndef GLSLANG_WEB // nonprivate if (imageType.getQualifier().nonprivate) { params.nonprivate = true; @@ -4785,6 +5021,7 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO if (imageType.getQualifier().volatil) { params.volatil = true; } +#endif std::vector<spv::Id> result( 1, builder.createTextureCall(precision, resultType(), sparse, cracked.fetch, cracked.proj, cracked.gather, @@ -5019,6 +5256,30 @@ spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, OpD binOp = spv::OpLogicalNotEqual; break; + case glslang::EOpAbsDifference: + binOp = isUnsigned ? spv::OpAbsUSubINTEL : spv::OpAbsISubINTEL; + break; + + case glslang::EOpAddSaturate: + binOp = isUnsigned ? spv::OpUAddSatINTEL : spv::OpIAddSatINTEL; + break; + + case glslang::EOpSubSaturate: + binOp = isUnsigned ? spv::OpUSubSatINTEL : spv::OpISubSatINTEL; + break; + + case glslang::EOpAverage: + binOp = isUnsigned ? spv::OpUAverageINTEL : spv::OpIAverageINTEL; + break; + + case glslang::EOpAverageRounded: + binOp = isUnsigned ? spv::OpUAverageRoundedINTEL : spv::OpIAverageRoundedINTEL; + break; + + case glslang::EOpMul32x16: + binOp = isUnsigned ? spv::OpUMul32x16INTEL : spv::OpIMul32x16INTEL; + break; + case glslang::EOpLessThan: case glslang::EOpGreaterThan: case glslang::EOpLessThanEqual: @@ -5045,8 +5306,8 @@ spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, OpD builder.promoteScalar(decorations.precision, left, right); spv::Id result = builder.createBinOp(binOp, typeId, left, right); - builder.addDecoration(result, decorations.noContraction); - builder.addDecoration(result, decorations.nonUniform); + decorations.addNoContraction(builder, result); + decorations.addNonUniform(builder, result); return builder.setPrecision(result, decorations.precision); } @@ -5058,7 +5319,7 @@ spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, OpD if (reduceComparison && (op == glslang::EOpEqual || op == glslang::EOpNotEqual) && (builder.isVector(left) || builder.isMatrix(left) || builder.isAggregate(left))) { spv::Id result = builder.createCompositeCompare(decorations.precision, left, right, op == glslang::EOpEqual); - builder.addDecoration(result, decorations.nonUniform); + decorations.addNonUniform(builder, result); return result; } @@ -5119,8 +5380,8 @@ spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, OpD if (binOp != spv::OpNop) { spv::Id result = builder.createBinOp(binOp, typeId, left, right); - builder.addDecoration(result, decorations.noContraction); - builder.addDecoration(result, decorations.nonUniform); + decorations.addNoContraction(builder, result); + decorations.addNonUniform(builder, result); return builder.setPrecision(result, decorations.precision); } @@ -5184,8 +5445,8 @@ spv::Id TGlslangToSpvTraverser::createBinaryMatrixOperation(spv::Op op, OpDecora if (firstClass) { spv::Id result = builder.createBinOp(op, typeId, left, right); - builder.addDecoration(result, decorations.noContraction); - builder.addDecoration(result, decorations.nonUniform); + decorations.addNoContraction(builder, result); + decorations.addNonUniform(builder, result); return builder.setPrecision(result, decorations.precision); } @@ -5224,14 +5485,14 @@ spv::Id TGlslangToSpvTraverser::createBinaryMatrixOperation(spv::Op op, OpDecora spv::Id leftVec = leftMat ? builder.createCompositeExtract( left, vecType, indexes) : smearVec; spv::Id rightVec = rightMat ? builder.createCompositeExtract(right, vecType, indexes) : smearVec; spv::Id result = builder.createBinOp(op, vecType, leftVec, rightVec); - builder.addDecoration(result, decorations.noContraction); - builder.addDecoration(result, decorations.nonUniform); + decorations.addNoContraction(builder, result); + decorations.addNonUniform(builder, result); results.push_back(builder.setPrecision(result, decorations.precision)); } // put the pieces together spv::Id result = builder.setPrecision(builder.createCompositeConstruct(typeId, results), decorations.precision); - builder.addDecoration(result, decorations.nonUniform); + decorations.addNonUniform(builder, result); return result; } default: @@ -5241,7 +5502,7 @@ spv::Id TGlslangToSpvTraverser::createBinaryMatrixOperation(spv::Op op, OpDecora } spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDecorations& decorations, spv::Id typeId, - spv::Id operand, glslang::TBasicType typeProxy) + spv::Id operand, glslang::TBasicType typeProxy, const spv::Builder::AccessChain::CoherentFlags &lvalueCoherentFlags) { spv::Op unaryOp = spv::OpNop; int extBuiltins = -1; @@ -5409,6 +5670,7 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDe case glslang::EOpUnpackHalf2x16: libCall = spv::GLSLstd450UnpackHalf2x16; break; +#ifndef GLSLANG_WEB case glslang::EOpPackSnorm4x8: libCall = spv::GLSLstd450PackSnorm4x8; break; @@ -5427,6 +5689,7 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDe case glslang::EOpUnpackDouble2x32: libCall = spv::GLSLstd450UnpackDouble2x32; break; +#endif case glslang::EOpPackInt2x32: case glslang::EOpUnpackInt2x32: @@ -5460,6 +5723,28 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDe case glslang::EOpFwidth: unaryOp = spv::OpFwidth; break; + + case glslang::EOpAny: + unaryOp = spv::OpAny; + break; + case glslang::EOpAll: + unaryOp = spv::OpAll; + break; + + case glslang::EOpAbs: + if (isFloat) + libCall = spv::GLSLstd450FAbs; + else + libCall = spv::GLSLstd450SAbs; + break; + case glslang::EOpSign: + if (isFloat) + libCall = spv::GLSLstd450FSign; + else + libCall = spv::GLSLstd450SSign; + break; + +#ifndef GLSLANG_WEB case glslang::EOpDPdxFine: unaryOp = spv::OpDPdxFine; break; @@ -5479,32 +5764,10 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDe unaryOp = spv::OpFwidthCoarse; break; case glslang::EOpInterpolateAtCentroid: -#ifdef AMD_EXTENSIONS if (typeProxy == glslang::EbtFloat16) builder.addExtension(spv::E_SPV_AMD_gpu_shader_half_float); -#endif libCall = spv::GLSLstd450InterpolateAtCentroid; break; - case glslang::EOpAny: - unaryOp = spv::OpAny; - break; - case glslang::EOpAll: - unaryOp = spv::OpAll; - break; - - case glslang::EOpAbs: - if (isFloat) - libCall = spv::GLSLstd450FAbs; - else - libCall = spv::GLSLstd450SAbs; - break; - case glslang::EOpSign: - if (isFloat) - libCall = spv::GLSLstd450FSign; - else - libCall = spv::GLSLstd450SSign; - break; - case glslang::EOpAtomicCounterIncrement: case glslang::EOpAtomicCounterDecrement: case glslang::EOpAtomicCounter: @@ -5512,7 +5775,7 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDe // Handle all of the atomics in one place, in createAtomicOperation() std::vector<spv::Id> operands; operands.push_back(operand); - return createAtomicOperation(op, decorations.precision, typeId, operands, typeProxy); + return createAtomicOperation(op, decorations.precision, typeId, operands, typeProxy, lvalueCoherentFlags); } case glslang::EOpBitFieldReverse: @@ -5531,12 +5794,23 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDe libCall = spv::GLSLstd450FindSMsb; break; + case glslang::EOpCountLeadingZeros: + builder.addCapability(spv::CapabilityIntegerFunctions2INTEL); + builder.addExtension("SPV_INTEL_shader_integer_functions2"); + unaryOp = spv::OpUCountLeadingZerosINTEL; + break; + + case glslang::EOpCountTrailingZeros: + builder.addCapability(spv::CapabilityIntegerFunctions2INTEL); + builder.addExtension("SPV_INTEL_shader_integer_functions2"); + unaryOp = spv::OpUCountTrailingZerosINTEL; + break; + case glslang::EOpBallot: case glslang::EOpReadFirstInvocation: case glslang::EOpAnyInvocation: case glslang::EOpAllInvocations: case glslang::EOpAllInvocationsEqual: -#ifdef AMD_EXTENSIONS case glslang::EOpMinInvocations: case glslang::EOpMaxInvocations: case glslang::EOpAddInvocations: @@ -5555,7 +5829,6 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDe case glslang::EOpMinInvocationsExclusiveScanNonUniform: case glslang::EOpMaxInvocationsExclusiveScanNonUniform: case glslang::EOpAddInvocationsExclusiveScanNonUniform: -#endif { std::vector<spv::Id> operands; operands.push_back(operand); @@ -5600,7 +5873,6 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDe operands.push_back(operand); return createSubgroupOperation(op, typeId, operands, typeProxy); } -#ifdef AMD_EXTENSIONS case glslang::EOpMbcnt: extBuiltins = getExtBuiltins(spv::E_SPV_AMD_shader_ballot); libCall = spv::MbcntAMD; @@ -5615,15 +5887,13 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDe extBuiltins = getExtBuiltins(spv::E_SPV_AMD_gcn_shader); libCall = spv::CubeFaceCoordAMD; break; -#endif -#ifdef NV_EXTENSIONS case glslang::EOpSubgroupPartition: unaryOp = spv::OpGroupNonUniformPartitionNV; break; -#endif case glslang::EOpConstructReference: unaryOp = spv::OpBitcast; break; +#endif case glslang::EOpCopyObject: unaryOp = spv::OpCopyObject; @@ -5642,8 +5912,8 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDe id = builder.createUnaryOp(unaryOp, typeId, operand); } - builder.addDecoration(id, decorations.noContraction); - builder.addDecoration(id, decorations.nonUniform); + decorations.addNoContraction(builder, id); + decorations.addNonUniform(builder, id); return builder.setPrecision(id, decorations.precision); } @@ -5671,14 +5941,14 @@ spv::Id TGlslangToSpvTraverser::createUnaryMatrixOperation(spv::Op op, OpDecorat indexes.push_back(c); spv::Id srcVec = builder.createCompositeExtract(operand, srcVecType, indexes); spv::Id destVec = builder.createUnaryOp(op, destVecType, srcVec); - builder.addDecoration(destVec, decorations.noContraction); - builder.addDecoration(destVec, decorations.nonUniform); + decorations.addNoContraction(builder, destVec); + decorations.addNonUniform(builder, destVec); results.push_back(builder.setPrecision(destVec, decorations.precision)); } // put the pieces together spv::Id result = builder.setPrecision(builder.createCompositeConstruct(typeId, results), decorations.precision); - builder.addDecoration(result, decorations.nonUniform); + decorations.addNonUniform(builder, result); return result; } @@ -5770,110 +6040,49 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, OpDecora int vectorSize = builder.isVectorType(destType) ? builder.getNumTypeComponents(destType) : 0; switch (op) { - case glslang::EOpConvInt8ToBool: - case glslang::EOpConvUint8ToBool: - zero = builder.makeUint8Constant(0); - zero = makeSmearedConstant(zero, vectorSize); - return builder.createBinOp(spv::OpINotEqual, destType, operand, zero); - case glslang::EOpConvInt16ToBool: - case glslang::EOpConvUint16ToBool: - zero = builder.makeUint16Constant(0); - zero = makeSmearedConstant(zero, vectorSize); - return builder.createBinOp(spv::OpINotEqual, destType, operand, zero); case glslang::EOpConvIntToBool: case glslang::EOpConvUintToBool: zero = builder.makeUintConstant(0); zero = makeSmearedConstant(zero, vectorSize); return builder.createBinOp(spv::OpINotEqual, destType, operand, zero); - case glslang::EOpConvInt64ToBool: - case glslang::EOpConvUint64ToBool: - zero = builder.makeUint64Constant(0); - zero = makeSmearedConstant(zero, vectorSize); - return builder.createBinOp(spv::OpINotEqual, destType, operand, zero); - case glslang::EOpConvFloatToBool: zero = builder.makeFloatConstant(0.0F); zero = makeSmearedConstant(zero, vectorSize); return builder.createBinOp(spv::OpFOrdNotEqual, destType, operand, zero); - - case glslang::EOpConvDoubleToBool: - zero = builder.makeDoubleConstant(0.0); - zero = makeSmearedConstant(zero, vectorSize); - return builder.createBinOp(spv::OpFOrdNotEqual, destType, operand, zero); - - case glslang::EOpConvFloat16ToBool: - zero = builder.makeFloat16Constant(0.0F); - zero = makeSmearedConstant(zero, vectorSize); - return builder.createBinOp(spv::OpFOrdNotEqual, destType, operand, zero); - case glslang::EOpConvBoolToFloat: convOp = spv::OpSelect; zero = builder.makeFloatConstant(0.0F); one = builder.makeFloatConstant(1.0F); break; - case glslang::EOpConvBoolToDouble: - convOp = spv::OpSelect; - zero = builder.makeDoubleConstant(0.0); - one = builder.makeDoubleConstant(1.0); - break; - - case glslang::EOpConvBoolToFloat16: - convOp = spv::OpSelect; - zero = builder.makeFloat16Constant(0.0F); - one = builder.makeFloat16Constant(1.0F); - break; - - case glslang::EOpConvBoolToInt8: - zero = builder.makeInt8Constant(0); - one = builder.makeInt8Constant(1); - convOp = spv::OpSelect; - break; - - case glslang::EOpConvBoolToUint8: - zero = builder.makeUint8Constant(0); - one = builder.makeUint8Constant(1); - convOp = spv::OpSelect; - break; - - case glslang::EOpConvBoolToInt16: - zero = builder.makeInt16Constant(0); - one = builder.makeInt16Constant(1); - convOp = spv::OpSelect; - break; - - case glslang::EOpConvBoolToUint16: - zero = builder.makeUint16Constant(0); - one = builder.makeUint16Constant(1); - convOp = spv::OpSelect; - break; - case glslang::EOpConvBoolToInt: case glslang::EOpConvBoolToInt64: - if (op == glslang::EOpConvBoolToInt64) +#ifndef GLSLANG_WEB + if (op == glslang::EOpConvBoolToInt64) { zero = builder.makeInt64Constant(0); - else - zero = builder.makeIntConstant(0); - - if (op == glslang::EOpConvBoolToInt64) one = builder.makeInt64Constant(1); - else + } else +#endif + { + zero = builder.makeIntConstant(0); one = builder.makeIntConstant(1); + } convOp = spv::OpSelect; break; case glslang::EOpConvBoolToUint: case glslang::EOpConvBoolToUint64: - if (op == glslang::EOpConvBoolToUint64) +#ifndef GLSLANG_WEB + if (op == glslang::EOpConvBoolToUint64) { zero = builder.makeUint64Constant(0); - else - zero = builder.makeUintConstant(0); - - if (op == glslang::EOpConvBoolToUint64) one = builder.makeUint64Constant(1); - else + } else +#endif + { + zero = builder.makeUintConstant(0); one = builder.makeUintConstant(1); + } convOp = spv::OpSelect; break; @@ -5908,17 +6117,6 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, OpDecora convOp = spv::OpConvertUToF; break; - case glslang::EOpConvDoubleToFloat: - case glslang::EOpConvFloatToDouble: - case glslang::EOpConvDoubleToFloat16: - case glslang::EOpConvFloat16ToDouble: - case glslang::EOpConvFloatToFloat16: - case glslang::EOpConvFloat16ToFloat: - convOp = spv::OpFConvert; - if (builder.isMatrixType(destType)) - return createUnaryMatrixOperation(convOp, decorations, destType, operand, typeProxy); - break; - case glslang::EOpConvFloat16ToInt8: case glslang::EOpConvFloatToInt8: case glslang::EOpConvDoubleToInt8: @@ -5944,13 +6142,16 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, OpDecora case glslang::EOpConvInt64ToUint64: if (builder.isInSpecConstCodeGenMode()) { // Build zero scalar or vector for OpIAdd. +#ifndef GLSLANG_WEB if(op == glslang::EOpConvUint8ToInt8 || op == glslang::EOpConvInt8ToUint8) { zero = builder.makeUint8Constant(0); } else if (op == glslang::EOpConvUint16ToInt16 || op == glslang::EOpConvInt16ToUint16) { zero = builder.makeUint16Constant(0); } else if (op == glslang::EOpConvUint64ToInt64 || op == glslang::EOpConvInt64ToUint64) { zero = builder.makeUint64Constant(0); - } else { + } else +#endif + { zero = builder.makeUintConstant(0); } zero = makeSmearedConstant(zero, vectorSize); @@ -5977,6 +6178,71 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, OpDecora convOp = spv::OpConvertFToU; break; +#ifndef GLSLANG_WEB + case glslang::EOpConvInt8ToBool: + case glslang::EOpConvUint8ToBool: + zero = builder.makeUint8Constant(0); + zero = makeSmearedConstant(zero, vectorSize); + return builder.createBinOp(spv::OpINotEqual, destType, operand, zero); + case glslang::EOpConvInt16ToBool: + case glslang::EOpConvUint16ToBool: + zero = builder.makeUint16Constant(0); + zero = makeSmearedConstant(zero, vectorSize); + return builder.createBinOp(spv::OpINotEqual, destType, operand, zero); + case glslang::EOpConvInt64ToBool: + case glslang::EOpConvUint64ToBool: + zero = builder.makeUint64Constant(0); + zero = makeSmearedConstant(zero, vectorSize); + return builder.createBinOp(spv::OpINotEqual, destType, operand, zero); + case glslang::EOpConvDoubleToBool: + zero = builder.makeDoubleConstant(0.0); + zero = makeSmearedConstant(zero, vectorSize); + return builder.createBinOp(spv::OpFOrdNotEqual, destType, operand, zero); + case glslang::EOpConvFloat16ToBool: + zero = builder.makeFloat16Constant(0.0F); + zero = makeSmearedConstant(zero, vectorSize); + return builder.createBinOp(spv::OpFOrdNotEqual, destType, operand, zero); + case glslang::EOpConvBoolToDouble: + convOp = spv::OpSelect; + zero = builder.makeDoubleConstant(0.0); + one = builder.makeDoubleConstant(1.0); + break; + case glslang::EOpConvBoolToFloat16: + convOp = spv::OpSelect; + zero = builder.makeFloat16Constant(0.0F); + one = builder.makeFloat16Constant(1.0F); + break; + case glslang::EOpConvBoolToInt8: + zero = builder.makeInt8Constant(0); + one = builder.makeInt8Constant(1); + convOp = spv::OpSelect; + break; + case glslang::EOpConvBoolToUint8: + zero = builder.makeUint8Constant(0); + one = builder.makeUint8Constant(1); + convOp = spv::OpSelect; + break; + case glslang::EOpConvBoolToInt16: + zero = builder.makeInt16Constant(0); + one = builder.makeInt16Constant(1); + convOp = spv::OpSelect; + break; + case glslang::EOpConvBoolToUint16: + zero = builder.makeUint16Constant(0); + one = builder.makeUint16Constant(1); + convOp = spv::OpSelect; + break; + case glslang::EOpConvDoubleToFloat: + case glslang::EOpConvFloatToDouble: + case glslang::EOpConvDoubleToFloat16: + case glslang::EOpConvFloat16ToDouble: + case glslang::EOpConvFloatToFloat16: + case glslang::EOpConvFloat16ToFloat: + convOp = spv::OpFConvert; + if (builder.isMatrixType(destType)) + return createUnaryMatrixOperation(convOp, decorations, destType, operand, typeProxy); + break; + case glslang::EOpConvInt8ToInt16: case glslang::EOpConvInt8ToInt: case glslang::EOpConvInt8ToInt64: @@ -6087,6 +6353,15 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, OpDecora case glslang::EOpConvPtrToUint64: convOp = spv::OpConvertPtrToU; break; + case glslang::EOpConvPtrToUvec2: + case glslang::EOpConvUvec2ToPtr: + if (builder.isVector(operand)) + builder.promoteIncorporatedExtension(spv::E_SPV_EXT_physical_storage_buffer, + spv::E_SPV_KHR_physical_storage_buffer, spv::Spv_1_5); + convOp = spv::OpBitcast; + break; +#endif + default: break; } @@ -6103,7 +6378,7 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, OpDecora result = builder.createUnaryOp(convOp, destType, operand); result = builder.setPrecision(result, decorations.precision); - builder.addDecoration(result, decorations.nonUniform); + decorations.addNonUniform(builder, result); return result; } @@ -6120,7 +6395,7 @@ spv::Id TGlslangToSpvTraverser::makeSmearedConstant(spv::Id constant, int vector } // For glslang ops that map to SPV atomic opCodes -spv::Id TGlslangToSpvTraverser::createAtomicOperation(glslang::TOperator op, spv::Decoration /*precision*/, spv::Id typeId, std::vector<spv::Id>& operands, glslang::TBasicType typeProxy) +spv::Id TGlslangToSpvTraverser::createAtomicOperation(glslang::TOperator op, spv::Decoration /*precision*/, spv::Id typeId, std::vector<spv::Id>& operands, glslang::TBasicType typeProxy, const spv::Builder::AccessChain::CoherentFlags &lvalueCoherentFlags) { spv::Op opCode = spv::OpNop; @@ -6206,7 +6481,9 @@ spv::Id TGlslangToSpvTraverser::createAtomicOperation(glslang::TOperator op, spv scopeId = builder.makeUintConstant(spv::ScopeDevice); } // semantics default to relaxed - spv::Id semanticsId = builder.makeUintConstant(spv::MemorySemanticsMaskNone); + spv::Id semanticsId = builder.makeUintConstant(lvalueCoherentFlags.isVolatile() && glslangIntermediate->usingVulkanMemoryModel() ? + spv::MemorySemanticsVolatileMask : + spv::MemorySemanticsMaskNone); spv::Id semanticsId2 = semanticsId; pointerId = operands[0]; @@ -6236,7 +6513,10 @@ spv::Id TGlslangToSpvTraverser::createAtomicOperation(glslang::TOperator op, spv // Check for capabilities unsigned semanticsImmediate = builder.getConstantScalar(semanticsId) | builder.getConstantScalar(semanticsId2); - if (semanticsImmediate & (spv::MemorySemanticsMakeAvailableKHRMask | spv::MemorySemanticsMakeVisibleKHRMask | spv::MemorySemanticsOutputMemoryKHRMask)) { + if (semanticsImmediate & (spv::MemorySemanticsMakeAvailableKHRMask | + spv::MemorySemanticsMakeVisibleKHRMask | + spv::MemorySemanticsOutputMemoryKHRMask | + spv::MemorySemanticsVolatileMask)) { builder.addCapability(spv::CapabilityVulkanMemoryModelKHR); } @@ -6274,10 +6554,8 @@ spv::Id TGlslangToSpvTraverser::createAtomicOperation(glslang::TOperator op, spv // Create group invocation operations. spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op, spv::Id typeId, std::vector<spv::Id>& operands, glslang::TBasicType typeProxy) { -#ifdef AMD_EXTENSIONS bool isUnsigned = isTypeUnsignedInt(typeProxy); bool isFloat = isTypeFloat(typeProxy); -#endif spv::Op opCode = spv::OpNop; std::vector<spv::IdImmediate> spvGroupOperands; @@ -6294,7 +6572,6 @@ spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op builder.addCapability(spv::CapabilitySubgroupVoteKHR); } else { builder.addCapability(spv::CapabilityGroups); -#ifdef AMD_EXTENSIONS if (op == glslang::EOpMinInvocationsNonUniform || op == glslang::EOpMaxInvocationsNonUniform || op == glslang::EOpAddInvocationsNonUniform || @@ -6305,9 +6582,7 @@ spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op op == glslang::EOpMaxInvocationsExclusiveScanNonUniform || op == glslang::EOpAddInvocationsExclusiveScanNonUniform) builder.addExtension(spv::E_SPV_AMD_shader_ballot); -#endif -#ifdef AMD_EXTENSIONS switch (op) { case glslang::EOpMinInvocations: case glslang::EOpMaxInvocations: @@ -6342,7 +6617,6 @@ spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op spv::IdImmediate groupOp = { false, (unsigned)groupOperation }; spvGroupOperands.push_back(groupOp); } -#endif } for (auto opIt = operands.begin(); opIt != operands.end(); ++opIt) { @@ -6389,7 +6663,6 @@ spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op builder.createCompositeConstruct(uvec2Type, components)); } -#ifdef AMD_EXTENSIONS case glslang::EOpMinInvocations: case glslang::EOpMaxInvocations: case glslang::EOpAddInvocations: @@ -6476,7 +6749,6 @@ spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op return CreateInvocationsVectorOperation(opCode, groupOperation, typeId, operands); break; -#endif default: logger->missingFunctionality("invocation operation"); return spv::NoResult; @@ -6490,7 +6762,6 @@ spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op spv::Id TGlslangToSpvTraverser::CreateInvocationsVectorOperation(spv::Op op, spv::GroupOperation groupOperation, spv::Id typeId, std::vector<spv::Id>& operands) { -#ifdef AMD_EXTENSIONS assert(op == spv::OpGroupFMin || op == spv::OpGroupUMin || op == spv::OpGroupSMin || op == spv::OpGroupFMax || op == spv::OpGroupUMax || op == spv::OpGroupSMax || op == spv::OpGroupFAdd || op == spv::OpGroupIAdd || op == spv::OpGroupBroadcast || @@ -6498,12 +6769,6 @@ spv::Id TGlslangToSpvTraverser::CreateInvocationsVectorOperation(spv::Op op, spv op == spv::OpGroupFMinNonUniformAMD || op == spv::OpGroupUMinNonUniformAMD || op == spv::OpGroupSMinNonUniformAMD || op == spv::OpGroupFMaxNonUniformAMD || op == spv::OpGroupUMaxNonUniformAMD || op == spv::OpGroupSMaxNonUniformAMD || op == spv::OpGroupFAddNonUniformAMD || op == spv::OpGroupIAddNonUniformAMD); -#else - assert(op == spv::OpGroupFMin || op == spv::OpGroupUMin || op == spv::OpGroupSMin || - op == spv::OpGroupFMax || op == spv::OpGroupUMax || op == spv::OpGroupSMax || - op == spv::OpGroupFAdd || op == spv::OpGroupIAdd || op == spv::OpGroupBroadcast || - op == spv::OpSubgroupReadInvocationKHR); -#endif // Handle group invocation operations scalar by scalar. // The result type is the same type as the original type. @@ -6627,7 +6892,6 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s builder.addCapability(spv::CapabilityGroupNonUniform); builder.addCapability(spv::CapabilityGroupNonUniformQuad); break; -#ifdef NV_EXTENSIONS case glslang::EOpSubgroupPartitionedAdd: case glslang::EOpSubgroupPartitionedMul: case glslang::EOpSubgroupPartitionedMin: @@ -6652,12 +6916,12 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s builder.addExtension(spv::E_SPV_NV_shader_subgroup_partitioned); builder.addCapability(spv::CapabilityGroupNonUniformPartitionedNV); break; -#endif default: assert(0 && "Unhandled subgroup operation!"); } - const bool isUnsigned = typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64; - const bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble; + + const bool isUnsigned = isTypeUnsignedInt(typeProxy); + const bool isFloat = isTypeFloat(typeProxy); const bool isBool = typeProxy == glslang::EbtBool; spv::Op opCode = spv::OpNop; @@ -6686,11 +6950,9 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s case glslang::EOpSubgroupInclusiveAdd: case glslang::EOpSubgroupExclusiveAdd: case glslang::EOpSubgroupClusteredAdd: -#ifdef NV_EXTENSIONS case glslang::EOpSubgroupPartitionedAdd: case glslang::EOpSubgroupPartitionedInclusiveAdd: case glslang::EOpSubgroupPartitionedExclusiveAdd: -#endif if (isFloat) { opCode = spv::OpGroupNonUniformFAdd; } else { @@ -6701,11 +6963,9 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s case glslang::EOpSubgroupInclusiveMul: case glslang::EOpSubgroupExclusiveMul: case glslang::EOpSubgroupClusteredMul: -#ifdef NV_EXTENSIONS case glslang::EOpSubgroupPartitionedMul: case glslang::EOpSubgroupPartitionedInclusiveMul: case glslang::EOpSubgroupPartitionedExclusiveMul: -#endif if (isFloat) { opCode = spv::OpGroupNonUniformFMul; } else { @@ -6716,11 +6976,9 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s case glslang::EOpSubgroupInclusiveMin: case glslang::EOpSubgroupExclusiveMin: case glslang::EOpSubgroupClusteredMin: -#ifdef NV_EXTENSIONS case glslang::EOpSubgroupPartitionedMin: case glslang::EOpSubgroupPartitionedInclusiveMin: case glslang::EOpSubgroupPartitionedExclusiveMin: -#endif if (isFloat) { opCode = spv::OpGroupNonUniformFMin; } else if (isUnsigned) { @@ -6733,11 +6991,9 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s case glslang::EOpSubgroupInclusiveMax: case glslang::EOpSubgroupExclusiveMax: case glslang::EOpSubgroupClusteredMax: -#ifdef NV_EXTENSIONS case glslang::EOpSubgroupPartitionedMax: case glslang::EOpSubgroupPartitionedInclusiveMax: case glslang::EOpSubgroupPartitionedExclusiveMax: -#endif if (isFloat) { opCode = spv::OpGroupNonUniformFMax; } else if (isUnsigned) { @@ -6750,11 +7006,9 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s case glslang::EOpSubgroupInclusiveAnd: case glslang::EOpSubgroupExclusiveAnd: case glslang::EOpSubgroupClusteredAnd: -#ifdef NV_EXTENSIONS case glslang::EOpSubgroupPartitionedAnd: case glslang::EOpSubgroupPartitionedInclusiveAnd: case glslang::EOpSubgroupPartitionedExclusiveAnd: -#endif if (isBool) { opCode = spv::OpGroupNonUniformLogicalAnd; } else { @@ -6765,11 +7019,9 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s case glslang::EOpSubgroupInclusiveOr: case glslang::EOpSubgroupExclusiveOr: case glslang::EOpSubgroupClusteredOr: -#ifdef NV_EXTENSIONS case glslang::EOpSubgroupPartitionedOr: case glslang::EOpSubgroupPartitionedInclusiveOr: case glslang::EOpSubgroupPartitionedExclusiveOr: -#endif if (isBool) { opCode = spv::OpGroupNonUniformLogicalOr; } else { @@ -6780,11 +7032,9 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s case glslang::EOpSubgroupInclusiveXor: case glslang::EOpSubgroupExclusiveXor: case glslang::EOpSubgroupClusteredXor: -#ifdef NV_EXTENSIONS case glslang::EOpSubgroupPartitionedXor: case glslang::EOpSubgroupPartitionedInclusiveXor: case glslang::EOpSubgroupPartitionedExclusiveXor: -#endif if (isBool) { opCode = spv::OpGroupNonUniformLogicalXor; } else { @@ -6842,7 +7092,6 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s case glslang::EOpSubgroupClusteredXor: groupOperation = spv::GroupOperationClusteredReduce; break; -#ifdef NV_EXTENSIONS case glslang::EOpSubgroupPartitionedAdd: case glslang::EOpSubgroupPartitionedMul: case glslang::EOpSubgroupPartitionedMin: @@ -6870,7 +7119,6 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s case glslang::EOpSubgroupPartitionedExclusiveXor: groupOperation = spv::GroupOperationPartitionedExclusiveScanNV; break; -#endif } // build the instruction @@ -6928,7 +7176,7 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: switch (op) { case glslang::EOpMin: if (isFloat) - libCall = spv::GLSLstd450FMin; + libCall = nanMinMaxClamp ? spv::GLSLstd450NMin : spv::GLSLstd450FMin; else if (isUnsigned) libCall = spv::GLSLstd450UMin; else @@ -6940,7 +7188,7 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: break; case glslang::EOpMax: if (isFloat) - libCall = spv::GLSLstd450FMax; + libCall = nanMinMaxClamp ? spv::GLSLstd450NMax : spv::GLSLstd450FMax; else if (isUnsigned) libCall = spv::GLSLstd450UMax; else @@ -6959,7 +7207,7 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: case glslang::EOpClamp: if (isFloat) - libCall = spv::GLSLstd450FClamp; + libCall = nanMinMaxClamp ? spv::GLSLstd450NClamp : spv::GLSLstd450FClamp; else if (isUnsigned) libCall = spv::GLSLstd450UClamp; else @@ -7002,18 +7250,57 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: case glslang::EOpRefract: libCall = spv::GLSLstd450Refract; break; + case glslang::EOpBarrier: + { + // This is for the extended controlBarrier function, with four operands. + // The unextended barrier() goes through createNoArgOperation. + assert(operands.size() == 4); + unsigned int executionScope = builder.getConstantScalar(operands[0]); + unsigned int memoryScope = builder.getConstantScalar(operands[1]); + unsigned int semantics = builder.getConstantScalar(operands[2]) | builder.getConstantScalar(operands[3]); + builder.createControlBarrier((spv::Scope)executionScope, (spv::Scope)memoryScope, (spv::MemorySemanticsMask)semantics); + if (semantics & (spv::MemorySemanticsMakeAvailableKHRMask | + spv::MemorySemanticsMakeVisibleKHRMask | + spv::MemorySemanticsOutputMemoryKHRMask | + spv::MemorySemanticsVolatileMask)) { + builder.addCapability(spv::CapabilityVulkanMemoryModelKHR); + } + if (glslangIntermediate->usingVulkanMemoryModel() && (executionScope == spv::ScopeDevice || memoryScope == spv::ScopeDevice)) { + builder.addCapability(spv::CapabilityVulkanMemoryModelDeviceScopeKHR); + } + return 0; + } + break; + case glslang::EOpMemoryBarrier: + { + // This is for the extended memoryBarrier function, with three operands. + // The unextended memoryBarrier() goes through createNoArgOperation. + assert(operands.size() == 3); + unsigned int memoryScope = builder.getConstantScalar(operands[0]); + unsigned int semantics = builder.getConstantScalar(operands[1]) | builder.getConstantScalar(operands[2]); + builder.createMemoryBarrier((spv::Scope)memoryScope, (spv::MemorySemanticsMask)semantics); + if (semantics & (spv::MemorySemanticsMakeAvailableKHRMask | + spv::MemorySemanticsMakeVisibleKHRMask | + spv::MemorySemanticsOutputMemoryKHRMask | + spv::MemorySemanticsVolatileMask)) { + builder.addCapability(spv::CapabilityVulkanMemoryModelKHR); + } + if (glslangIntermediate->usingVulkanMemoryModel() && memoryScope == spv::ScopeDevice) { + builder.addCapability(spv::CapabilityVulkanMemoryModelDeviceScopeKHR); + } + return 0; + } + break; + +#ifndef GLSLANG_WEB case glslang::EOpInterpolateAtSample: -#ifdef AMD_EXTENSIONS if (typeProxy == glslang::EbtFloat16) builder.addExtension(spv::E_SPV_AMD_gpu_shader_half_float); -#endif libCall = spv::GLSLstd450InterpolateAtSample; break; case glslang::EOpInterpolateAtOffset: -#ifdef AMD_EXTENSIONS if (typeProxy == glslang::EbtFloat16) builder.addExtension(spv::E_SPV_AMD_gpu_shader_half_float); -#endif libCall = spv::GLSLstd450InterpolateAtOffset; break; case glslang::EOpAddCarry: @@ -7055,11 +7342,9 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: assert(builder.isPointerType(typeId1)); typeId1 = builder.getContainedTypeId(typeId1); int width = builder.getScalarTypeWidth(typeId1); -#ifdef AMD_EXTENSIONS if (width == 16) // Using 16-bit exp operand, enable extension SPV_AMD_gpu_shader_int16 builder.addExtension(spv::E_SPV_AMD_gpu_shader_int16); -#endif if (builder.getNumComponents(operands[0]) == 1) frexpIntType = builder.makeIntegerType(width, true); else @@ -7089,7 +7374,6 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: case glslang::EOpSubgroupClusteredOr: case glslang::EOpSubgroupClusteredXor: case glslang::EOpSubgroupQuadBroadcast: -#ifdef NV_EXTENSIONS case glslang::EOpSubgroupPartitionedAdd: case glslang::EOpSubgroupPartitionedMul: case glslang::EOpSubgroupPartitionedMin: @@ -7111,10 +7395,8 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: case glslang::EOpSubgroupPartitionedExclusiveAnd: case glslang::EOpSubgroupPartitionedExclusiveOr: case glslang::EOpSubgroupPartitionedExclusiveXor: -#endif return createSubgroupOperation(op, typeId, operands, typeProxy); -#ifdef AMD_EXTENSIONS case glslang::EOpSwizzleInvocations: extBuiltins = getExtBuiltins(spv::E_SPV_AMD_shader_ballot); libCall = spv::SwizzleInvocationsAMD; @@ -7168,44 +7450,7 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: extBuiltins = getExtBuiltins(spv::E_SPV_AMD_shader_explicit_vertex_parameter); libCall = spv::InterpolateAtVertexAMD; break; -#endif - case glslang::EOpBarrier: - { - // This is for the extended controlBarrier function, with four operands. - // The unextended barrier() goes through createNoArgOperation. - assert(operands.size() == 4); - unsigned int executionScope = builder.getConstantScalar(operands[0]); - unsigned int memoryScope = builder.getConstantScalar(operands[1]); - unsigned int semantics = builder.getConstantScalar(operands[2]) | builder.getConstantScalar(operands[3]); - builder.createControlBarrier((spv::Scope)executionScope, (spv::Scope)memoryScope, (spv::MemorySemanticsMask)semantics); - if (semantics & (spv::MemorySemanticsMakeAvailableKHRMask | spv::MemorySemanticsMakeVisibleKHRMask | spv::MemorySemanticsOutputMemoryKHRMask)) { - builder.addCapability(spv::CapabilityVulkanMemoryModelKHR); - } - if (glslangIntermediate->usingVulkanMemoryModel() && (executionScope == spv::ScopeDevice || memoryScope == spv::ScopeDevice)) { - builder.addCapability(spv::CapabilityVulkanMemoryModelDeviceScopeKHR); - } - return 0; - } - break; - case glslang::EOpMemoryBarrier: - { - // This is for the extended memoryBarrier function, with three operands. - // The unextended memoryBarrier() goes through createNoArgOperation. - assert(operands.size() == 3); - unsigned int memoryScope = builder.getConstantScalar(operands[0]); - unsigned int semantics = builder.getConstantScalar(operands[1]) | builder.getConstantScalar(operands[2]); - builder.createMemoryBarrier((spv::Scope)memoryScope, (spv::MemorySemanticsMask)semantics); - if (semantics & (spv::MemorySemanticsMakeAvailableKHRMask | spv::MemorySemanticsMakeVisibleKHRMask | spv::MemorySemanticsOutputMemoryKHRMask)) { - builder.addCapability(spv::CapabilityVulkanMemoryModelKHR); - } - if (glslangIntermediate->usingVulkanMemoryModel() && memoryScope == spv::ScopeDevice) { - builder.addCapability(spv::CapabilityVulkanMemoryModelDeviceScopeKHR); - } - return 0; - } - break; -#ifdef NV_EXTENSIONS case glslang::EOpReportIntersectionNV: { typeId = builder.makeBoolType(); @@ -7227,11 +7472,10 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: case glslang::EOpWritePackedPrimitiveIndices4x8NV: builder.createNoResultOp(spv::OpWritePackedPrimitiveIndices4x8NV, operands); return 0; -#endif case glslang::EOpCooperativeMatrixMulAdd: opCode = spv::OpCooperativeMatrixMulAddNV; break; - +#endif // GLSLANG_WEB default: return 0; } @@ -7252,7 +7496,7 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: id = builder.createCompositeExtract(mulOp, typeId, 0); for (int i = 1; i < componentCount; ++i) { builder.setPrecision(id, precision); - id = builder.createBinOp(spv::OpIAdd, typeId, id, builder.createCompositeExtract(operands[0], typeId, i)); + id = builder.createBinOp(spv::OpIAdd, typeId, id, builder.createCompositeExtract(mulOp, typeId, i)); } } else { switch (consumedOperands) { @@ -7275,6 +7519,7 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: } } +#ifndef GLSLANG_WEB // Decode the return types that were structures switch (op) { case glslang::EOpAddCarry: @@ -7304,6 +7549,7 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: default: break; } +#endif return builder.setPrecision(id, precision); } @@ -7315,12 +7561,6 @@ spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op, spv: spv::Scope memoryBarrierScope = glslangIntermediate->usingVulkanMemoryModel() ? spv::ScopeQueueFamilyKHR : spv::ScopeDevice; switch (op) { - case glslang::EOpEmitVertex: - builder.createNoResultOp(spv::OpEmitVertex); - return 0; - case glslang::EOpEndPrimitive: - builder.createNoResultOp(spv::OpEndPrimitive); - return 0; case glslang::EOpBarrier: if (glslangIntermediate->getStage() == EShLangTessControl) { if (glslangIntermediate->usingVulkanMemoryModel()) { @@ -7341,18 +7581,10 @@ spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op, spv: builder.createMemoryBarrier(memoryBarrierScope, spv::MemorySemanticsAllMemory | spv::MemorySemanticsAcquireReleaseMask); return 0; - case glslang::EOpMemoryBarrierAtomicCounter: - builder.createMemoryBarrier(memoryBarrierScope, spv::MemorySemanticsAtomicCounterMemoryMask | - spv::MemorySemanticsAcquireReleaseMask); - return 0; case glslang::EOpMemoryBarrierBuffer: builder.createMemoryBarrier(memoryBarrierScope, spv::MemorySemanticsUniformMemoryMask | spv::MemorySemanticsAcquireReleaseMask); return 0; - case glslang::EOpMemoryBarrierImage: - builder.createMemoryBarrier(memoryBarrierScope, spv::MemorySemanticsImageMemoryMask | - spv::MemorySemanticsAcquireReleaseMask); - return 0; case glslang::EOpMemoryBarrierShared: builder.createMemoryBarrier(memoryBarrierScope, spv::MemorySemanticsWorkgroupMemoryMask | spv::MemorySemanticsAcquireReleaseMask); @@ -7361,6 +7593,15 @@ spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op, spv: builder.createMemoryBarrier(spv::ScopeWorkgroup, spv::MemorySemanticsAllMemory | spv::MemorySemanticsAcquireReleaseMask); return 0; +#ifndef GLSLANG_WEB + case glslang::EOpMemoryBarrierAtomicCounter: + builder.createMemoryBarrier(memoryBarrierScope, spv::MemorySemanticsAtomicCounterMemoryMask | + spv::MemorySemanticsAcquireReleaseMask); + return 0; + case glslang::EOpMemoryBarrierImage: + builder.createMemoryBarrier(memoryBarrierScope, spv::MemorySemanticsImageMemoryMask | + spv::MemorySemanticsAcquireReleaseMask); + return 0; case glslang::EOpAllMemoryBarrierWithGroupSync: builder.createControlBarrier(spv::ScopeWorkgroup, spv::ScopeDevice, spv::MemorySemanticsAllMemory | @@ -7405,30 +7646,69 @@ spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op, spv: builder.createMemoryBarrier(spv::ScopeSubgroup, spv::MemorySemanticsWorkgroupMemoryMask | spv::MemorySemanticsAcquireReleaseMask); return spv::NoResult; + + case glslang::EOpEmitVertex: + builder.createNoResultOp(spv::OpEmitVertex); + return 0; + case glslang::EOpEndPrimitive: + builder.createNoResultOp(spv::OpEndPrimitive); + return 0; + case glslang::EOpSubgroupElect: { std::vector<spv::Id> operands; return createSubgroupOperation(op, typeId, operands, glslang::EbtVoid); } -#ifdef AMD_EXTENSIONS case glslang::EOpTime: { std::vector<spv::Id> args; // Dummy arguments spv::Id id = builder.createBuiltinCall(typeId, getExtBuiltins(spv::E_SPV_AMD_gcn_shader), spv::TimeAMD, args); return builder.setPrecision(id, precision); } -#endif -#ifdef NV_EXTENSIONS case glslang::EOpIgnoreIntersectionNV: builder.createNoResultOp(spv::OpIgnoreIntersectionNV); return 0; case glslang::EOpTerminateRayNV: builder.createNoResultOp(spv::OpTerminateRayNV); return 0; + + case glslang::EOpBeginInvocationInterlock: + builder.createNoResultOp(spv::OpBeginInvocationInterlockEXT); + return 0; + case glslang::EOpEndInvocationInterlock: + builder.createNoResultOp(spv::OpEndInvocationInterlockEXT); + return 0; + + case glslang::EOpIsHelperInvocation: + { + std::vector<spv::Id> args; // Dummy arguments + builder.addExtension(spv::E_SPV_EXT_demote_to_helper_invocation); + builder.addCapability(spv::CapabilityDemoteToHelperInvocationEXT); + return builder.createOp(spv::OpIsHelperInvocationEXT, typeId, args); + } + + case glslang::EOpReadClockSubgroupKHR: { + std::vector<spv::Id> args; + args.push_back(builder.makeUintConstant(spv::ScopeSubgroup)); + builder.addExtension(spv::E_SPV_KHR_shader_clock); + builder.addCapability(spv::CapabilityShaderClockKHR); + return builder.createOp(spv::OpReadClockKHR, typeId, args); + } + + case glslang::EOpReadClockDeviceKHR: { + std::vector<spv::Id> args; + args.push_back(builder.makeUintConstant(spv::ScopeDevice)); + builder.addExtension(spv::E_SPV_KHR_shader_clock); + builder.addCapability(spv::CapabilityShaderClockKHR); + return builder.createOp(spv::OpReadClockKHR, typeId, args); + } #endif default: - logger->missingFunctionality("unknown operation with no arguments"); - return 0; + break; } + + logger->missingFunctionality("unknown operation with no arguments"); + + return 0; } spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol) @@ -7441,22 +7721,26 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol } // it was not found, create it - id = createSpvVariable(symbol); + spv::BuiltIn builtIn = TranslateBuiltInDecoration(symbol->getQualifier().builtIn, false); + auto forcedType = getForcedType(builtIn, symbol->getType()); + id = createSpvVariable(symbol, forcedType.first); symbolValues[symbol->getId()] = id; + if (forcedType.second != spv::NoType) + forceType[id] = forcedType.second; if (symbol->getBasicType() != glslang::EbtBlock) { builder.addDecoration(id, TranslatePrecisionDecoration(symbol->getType())); builder.addDecoration(id, TranslateInterpolationDecoration(symbol->getType().getQualifier())); builder.addDecoration(id, TranslateAuxiliaryStorageDecoration(symbol->getType().getQualifier())); -#ifdef NV_EXTENSIONS +#ifndef GLSLANG_WEB addMeshNVDecoration(id, /*member*/ -1, symbol->getType().getQualifier()); + if (symbol->getQualifier().hasComponent()) + builder.addDecoration(id, spv::DecorationComponent, symbol->getQualifier().layoutComponent); + if (symbol->getQualifier().hasIndex()) + builder.addDecoration(id, spv::DecorationIndex, symbol->getQualifier().layoutIndex); #endif if (symbol->getType().getQualifier().hasSpecConstantId()) builder.addDecoration(id, spv::DecorationSpecId, symbol->getType().getQualifier().layoutSpecConstantId); - if (symbol->getQualifier().hasIndex()) - builder.addDecoration(id, spv::DecorationIndex, symbol->getQualifier().layoutIndex); - if (symbol->getQualifier().hasComponent()) - builder.addDecoration(id, spv::DecorationComponent, symbol->getQualifier().layoutComponent); // atomic counters use this: if (symbol->getQualifier().hasOffset()) builder.addDecoration(id, spv::DecorationOffset, symbol->getQualifier().layoutOffset); @@ -7495,6 +7779,12 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol builder.addDecoration(id, spv::DecorationOffset, symbol->getQualifier().layoutXfbOffset); } + // add built-in variable decoration + if (builtIn != spv::BuiltInMax) { + builder.addDecoration(id, spv::DecorationBuiltIn, (int)builtIn); + } + +#ifndef GLSLANG_WEB if (symbol->getType().isImage()) { std::vector<spv::Decoration> memory; TranslateMemoryDecoration(symbol->getType().getQualifier(), memory, glslangIntermediate->usingVulkanMemoryModel()); @@ -7502,15 +7792,9 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol builder.addDecoration(id, memory[i]); } - // built-in variable decorations - spv::BuiltIn builtIn = TranslateBuiltInDecoration(symbol->getQualifier().builtIn, false); - if (builtIn != spv::BuiltInMax) - builder.addDecoration(id, spv::DecorationBuiltIn, (int)builtIn); - // nonuniform builder.addDecoration(id, TranslateNonUniformDecoration(symbol->getType().getQualifier())); -#ifdef NV_EXTENSIONS if (builtIn == spv::BuiltInSampleMask) { spv::Decoration decoration; // GL_NV_sample_mask_override_coverage extension @@ -7520,6 +7804,7 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol decoration = (spv::Decoration)spv::DecorationMax; builder.addDecoration(id, decoration); if (decoration != spv::DecorationMax) { + builder.addCapability(spv::CapabilitySampleMaskOverrideCoverageNV); builder.addExtension(spv::E_SPV_NV_sample_mask_override_coverage); } } @@ -7548,7 +7833,6 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol builder.addCapability(spv::CapabilityFragmentBarycentricNV); builder.addExtension(spv::E_SPV_NV_fragment_shader_barycentric); } -#endif if (glslangIntermediate->getHlslFunctionality1() && symbol->getType().getQualifier().semanticName != nullptr) { builder.addExtension("SPV_GOOGLE_hlsl_functionality1"); @@ -7556,14 +7840,15 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol symbol->getType().getQualifier().semanticName); } - if (symbol->getBasicType() == glslang::EbtReference) { + if (symbol->isReference()) { builder.addDecoration(id, symbol->getType().getQualifier().restrict ? spv::DecorationRestrictPointerEXT : spv::DecorationAliasedPointerEXT); } +#endif return id; } -#ifdef NV_EXTENSIONS +#ifndef GLSLANG_WEB // add per-primitive, per-view. per-task decorations to a struct member (member >= 0) or an object void TGlslangToSpvTraverser::addMeshNVDecoration(spv::Id id, int member, const glslang::TQualifier& qualifier) { @@ -7699,6 +7984,19 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstUnionArray(const glsla for (unsigned int i = 0; i < (unsigned int)glslangType.getVectorSize(); ++i) { bool zero = nextConst >= consts.size(); switch (glslangType.getBasicType()) { + case glslang::EbtInt: + spvConsts.push_back(builder.makeIntConstant(zero ? 0 : consts[nextConst].getIConst())); + break; + case glslang::EbtUint: + spvConsts.push_back(builder.makeUintConstant(zero ? 0 : consts[nextConst].getUConst())); + break; + case glslang::EbtFloat: + spvConsts.push_back(builder.makeFloatConstant(zero ? 0.0F : (float)consts[nextConst].getDConst())); + break; + case glslang::EbtBool: + spvConsts.push_back(builder.makeBoolConstant(zero ? false : consts[nextConst].getBConst())); + break; +#ifndef GLSLANG_WEB case glslang::EbtInt8: spvConsts.push_back(builder.makeInt8Constant(zero ? 0 : consts[nextConst].getI8Const())); break; @@ -7711,30 +8009,19 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstUnionArray(const glsla case glslang::EbtUint16: spvConsts.push_back(builder.makeUint16Constant(zero ? 0 : consts[nextConst].getU16Const())); break; - case glslang::EbtInt: - spvConsts.push_back(builder.makeIntConstant(zero ? 0 : consts[nextConst].getIConst())); - break; - case glslang::EbtUint: - spvConsts.push_back(builder.makeUintConstant(zero ? 0 : consts[nextConst].getUConst())); - break; case glslang::EbtInt64: spvConsts.push_back(builder.makeInt64Constant(zero ? 0 : consts[nextConst].getI64Const())); break; case glslang::EbtUint64: spvConsts.push_back(builder.makeUint64Constant(zero ? 0 : consts[nextConst].getU64Const())); break; - case glslang::EbtFloat: - spvConsts.push_back(builder.makeFloatConstant(zero ? 0.0F : (float)consts[nextConst].getDConst())); - break; case glslang::EbtDouble: spvConsts.push_back(builder.makeDoubleConstant(zero ? 0.0 : consts[nextConst].getDConst())); break; case glslang::EbtFloat16: spvConsts.push_back(builder.makeFloat16Constant(zero ? 0.0F : (float)consts[nextConst].getDConst())); break; - case glslang::EbtBool: - spvConsts.push_back(builder.makeBoolConstant(zero ? false : consts[nextConst].getBConst())); - break; +#endif default: assert(0); break; @@ -7746,6 +8033,19 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstUnionArray(const glsla bool zero = nextConst >= consts.size(); spv::Id scalar = 0; switch (glslangType.getBasicType()) { + case glslang::EbtInt: + scalar = builder.makeIntConstant(zero ? 0 : consts[nextConst].getIConst(), specConstant); + break; + case glslang::EbtUint: + scalar = builder.makeUintConstant(zero ? 0 : consts[nextConst].getUConst(), specConstant); + break; + case glslang::EbtFloat: + scalar = builder.makeFloatConstant(zero ? 0.0F : (float)consts[nextConst].getDConst(), specConstant); + break; + case glslang::EbtBool: + scalar = builder.makeBoolConstant(zero ? false : consts[nextConst].getBConst(), specConstant); + break; +#ifndef GLSLANG_WEB case glslang::EbtInt8: scalar = builder.makeInt8Constant(zero ? 0 : consts[nextConst].getI8Const(), specConstant); break; @@ -7758,34 +8058,23 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstUnionArray(const glsla case glslang::EbtUint16: scalar = builder.makeUint16Constant(zero ? 0 : consts[nextConst].getU16Const(), specConstant); break; - case glslang::EbtInt: - scalar = builder.makeIntConstant(zero ? 0 : consts[nextConst].getIConst(), specConstant); - break; - case glslang::EbtUint: - scalar = builder.makeUintConstant(zero ? 0 : consts[nextConst].getUConst(), specConstant); - break; case glslang::EbtInt64: scalar = builder.makeInt64Constant(zero ? 0 : consts[nextConst].getI64Const(), specConstant); break; case glslang::EbtUint64: scalar = builder.makeUint64Constant(zero ? 0 : consts[nextConst].getU64Const(), specConstant); break; - case glslang::EbtFloat: - scalar = builder.makeFloatConstant(zero ? 0.0F : (float)consts[nextConst].getDConst(), specConstant); - break; case glslang::EbtDouble: scalar = builder.makeDoubleConstant(zero ? 0.0 : consts[nextConst].getDConst(), specConstant); break; case glslang::EbtFloat16: scalar = builder.makeFloat16Constant(zero ? 0.0F : (float)consts[nextConst].getDConst(), specConstant); break; - case glslang::EbtBool: - scalar = builder.makeBoolConstant(zero ? false : consts[nextConst].getBConst(), specConstant); - break; case glslang::EbtReference: scalar = builder.makeUint64Constant(zero ? 0 : consts[nextConst].getU64Const(), specConstant); scalar = builder.createUnaryOp(spv::OpBitcast, typeId, scalar); break; +#endif default: assert(0); break; @@ -7929,7 +8218,7 @@ spv::Id TGlslangToSpvTraverser::createShortCircuit(glslang::TOperator op, glslan return builder.createOp(spv::OpPhi, boolTypeId, phiOperands); } -#ifdef AMD_EXTENSIONS +#ifndef GLSLANG_WEB // Return type Id of the imported set of extended instructions corresponds to the name. // Import this set if it has not been imported yet. spv::Id TGlslangToSpvTraverser::getExtBuiltins(const char* name) @@ -7969,7 +8258,8 @@ int GetSpirvGeneratorVersion() // return 5; // make OpArrayLength result type be an int with signedness of 0 // return 6; // revert version 5 change, which makes a different (new) kind of incorrect code, // versions 4 and 6 each generate OpArrayLength as it has long been done - return 7; // GLSL volatile keyword maps to both SPIR-V decorations Volatile and Coherent + // return 7; // GLSL volatile keyword maps to both SPIR-V decorations Volatile and Coherent + return 8; // switch to new dead block eliminator; use OpUnreachable } // Write SPIR-V out to a binary file @@ -7989,6 +8279,7 @@ void OutputSpvBin(const std::vector<unsigned int>& spirv, const char* baseName) // Write SPIR-V out to a text file with 32-bit hexadecimal words void OutputSpvHex(const std::vector<unsigned int>& spirv, const char* baseName, const char* varName) { +#ifndef GLSLANG_WEB std::ofstream out; out.open(baseName, std::ios::binary | std::ios::out); if (out.fail()) @@ -8016,6 +8307,7 @@ void OutputSpvHex(const std::vector<unsigned int>& spirv, const char* baseName, out << "};"; } out.close(); +#endif } // @@ -8049,11 +8341,14 @@ void GlslangToSpv(const TIntermediate& intermediate, std::vector<unsigned int>& #if ENABLE_OPT // If from HLSL, run spirv-opt to "legalize" the SPIR-V for Vulkan // eg. forward and remove memory writes of opaque types. - if ((intermediate.getSource() == EShSourceHlsl || options->optimizeSize) && !options->disableOptimizer) + bool prelegalization = intermediate.getSource() == EShSourceHlsl; + if ((intermediate.getSource() == EShSourceHlsl || options->optimizeSize) && !options->disableOptimizer) { SpirvToolsLegalize(intermediate, spirv, logger, options); + prelegalization = false; + } if (options->validate) - SpirvToolsValidate(intermediate, spirv, logger); + SpirvToolsValidate(intermediate, spirv, logger, prelegalization); if (options->disassemble) SpirvToolsDisassemble(std::cout, spirv); diff --git a/thirdparty/glslang/SPIRV/GlslangToSpv.h b/thirdparty/glslang/SPIRV/GlslangToSpv.h index 86e1c23bf6..3907be43b7 100644..100755 --- a/thirdparty/glslang/SPIRV/GlslangToSpv.h +++ b/thirdparty/glslang/SPIRV/GlslangToSpv.h @@ -40,7 +40,7 @@ #endif #include "SpvTools.h" -#include "../glslang/Include/intermediate.h" +#include "glslang/Include/intermediate.h" #include <string> #include <vector> diff --git a/thirdparty/glslang/SPIRV/InReadableOrder.cpp b/thirdparty/glslang/SPIRV/InReadableOrder.cpp index 52b29613a4..9d9410be93 100644 --- a/thirdparty/glslang/SPIRV/InReadableOrder.cpp +++ b/thirdparty/glslang/SPIRV/InReadableOrder.cpp @@ -61,17 +61,22 @@ namespace { // Use by calling visit() on the root block. class ReadableOrderTraverser { public: - explicit ReadableOrderTraverser(std::function<void(Block*)> callback) : callback_(callback) {} + ReadableOrderTraverser(std::function<void(Block*, spv::ReachReason, Block*)> callback) + : callback_(callback) {} // Visits the block if it hasn't been visited already and isn't currently - // being delayed. Invokes callback(block), then descends into its + // being delayed. Invokes callback(block, why, header), then descends into its // successors. Delays merge-block and continue-block processing until all - // the branches have been completed. - void visit(Block* block) + // the branches have been completed. If |block| is an unreachable merge block or + // an unreachable continue target, then |header| is the corresponding header block. + void visit(Block* block, spv::ReachReason why, Block* header) { assert(block); + if (why == spv::ReachViaControlFlow) { + reachableViaControlFlow_.insert(block); + } if (visited_.count(block) || delayed_.count(block)) return; - callback_(block); + callback_(block, why, header); visited_.insert(block); Block* mergeBlock = nullptr; Block* continueBlock = nullptr; @@ -87,27 +92,40 @@ public: delayed_.insert(continueBlock); } } - const auto successors = block->getSuccessors(); - for (auto it = successors.cbegin(); it != successors.cend(); ++it) - visit(*it); + if (why == spv::ReachViaControlFlow) { + const auto& successors = block->getSuccessors(); + for (auto it = successors.cbegin(); it != successors.cend(); ++it) + visit(*it, why, nullptr); + } if (continueBlock) { + const spv::ReachReason continueWhy = + (reachableViaControlFlow_.count(continueBlock) > 0) + ? spv::ReachViaControlFlow + : spv::ReachDeadContinue; delayed_.erase(continueBlock); - visit(continueBlock); + visit(continueBlock, continueWhy, block); } if (mergeBlock) { + const spv::ReachReason mergeWhy = + (reachableViaControlFlow_.count(mergeBlock) > 0) + ? spv::ReachViaControlFlow + : spv::ReachDeadMerge; delayed_.erase(mergeBlock); - visit(mergeBlock); + visit(mergeBlock, mergeWhy, block); } } private: - std::function<void(Block*)> callback_; + std::function<void(Block*, spv::ReachReason, Block*)> callback_; // Whether a block has already been visited or is being delayed. std::unordered_set<Block *> visited_, delayed_; + + // The set of blocks that actually are reached via control flow. + std::unordered_set<Block *> reachableViaControlFlow_; }; } -void spv::inReadableOrder(Block* root, std::function<void(Block*)> callback) +void spv::inReadableOrder(Block* root, std::function<void(Block*, spv::ReachReason, Block*)> callback) { - ReadableOrderTraverser(callback).visit(root); + ReadableOrderTraverser(callback).visit(root, spv::ReachViaControlFlow, nullptr); } diff --git a/thirdparty/glslang/SPIRV/Logger.cpp b/thirdparty/glslang/SPIRV/Logger.cpp index 48bd4e3ade..7ea0c6342b 100644 --- a/thirdparty/glslang/SPIRV/Logger.cpp +++ b/thirdparty/glslang/SPIRV/Logger.cpp @@ -32,6 +32,8 @@ // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. +#ifndef GLSLANG_WEB + #include "Logger.h" #include <algorithm> @@ -66,3 +68,5 @@ std::string SpvBuildLogger::getAllMessages() const { } } // end spv namespace + +#endif
\ No newline at end of file diff --git a/thirdparty/glslang/SPIRV/Logger.h b/thirdparty/glslang/SPIRV/Logger.h index 2e4ddaf517..411367c030 100644 --- a/thirdparty/glslang/SPIRV/Logger.h +++ b/thirdparty/glslang/SPIRV/Logger.h @@ -46,6 +46,14 @@ class SpvBuildLogger { public: SpvBuildLogger() {} +#ifdef GLSLANG_WEB + void tbdFunctionality(const std::string& f) { } + void missingFunctionality(const std::string& f) { } + void warning(const std::string& w) { } + void error(const std::string& e) { errors.push_back(e); } + std::string getAllMessages() { return ""; } +#else + // Registers a TBD functionality. void tbdFunctionality(const std::string& f); // Registers a missing functionality. @@ -59,6 +67,7 @@ public: // Returns all messages accumulated in the order of: // TBD functionalities, missing functionalities, warnings, errors. std::string getAllMessages() const; +#endif private: SpvBuildLogger(const SpvBuildLogger&); diff --git a/thirdparty/glslang/SPIRV/SPVRemapper.h b/thirdparty/glslang/SPIRV/SPVRemapper.h index fa61bb94d8..d6b9c346dd 100644 --- a/thirdparty/glslang/SPIRV/SPVRemapper.h +++ b/thirdparty/glslang/SPIRV/SPVRemapper.h @@ -195,7 +195,7 @@ private: // Header access & set methods spirword_t magic() const { return spv[0]; } // return magic number spirword_t bound() const { return spv[3]; } // return Id bound from header - spirword_t bound(spirword_t b) { return spv[3] = b; }; + spirword_t bound(spirword_t b) { return spv[3] = b; } spirword_t genmagic() const { return spv[2]; } // generator magic spirword_t genmagic(spirword_t m) { return spv[2] = m; } spirword_t schemaNum() const { return spv[4]; } // schema number from header diff --git a/thirdparty/glslang/SPIRV/SpvBuilder.cpp b/thirdparty/glslang/SPIRV/SpvBuilder.cpp index 4ef7e5fe7f..bd208952e0 100644 --- a/thirdparty/glslang/SPIRV/SpvBuilder.cpp +++ b/thirdparty/glslang/SPIRV/SpvBuilder.cpp @@ -46,7 +46,9 @@ #include "SpvBuilder.h" +#ifndef GLSLANG_WEB #include "hex_float.h" +#endif #ifndef _WIN32 #include <cstdio> @@ -230,6 +232,11 @@ Id Builder::makePointerFromForwardPointer(StorageClass storageClass, Id forwardP Id Builder::makeIntegerType(int width, bool hasSign) { +#ifdef GLSLANG_WEB + assert(width == 32); + width = 32; +#endif + // try to find it Instruction* type; for (int t = 0; t < (int)groupedTypes[OpTypeInt].size(); ++t) { @@ -265,6 +272,11 @@ Id Builder::makeIntegerType(int width, bool hasSign) Id Builder::makeFloatType(int width) { +#ifdef GLSLANG_WEB + assert(width == 32); + width = 32; +#endif + // try to find it Instruction* type; for (int t = 0; t < (int)groupedTypes[OpTypeFloat].size(); ++t) { @@ -516,6 +528,7 @@ Id Builder::makeImageType(Id sampledType, Dim dim, bool depth, bool arrayed, boo constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type)); module.mapInstruction(type); +#ifndef GLSLANG_WEB // deal with capabilities switch (dim) { case DimBuffer: @@ -561,6 +574,7 @@ Id Builder::makeImageType(Id sampledType, Dim dim, bool depth, bool arrayed, boo addCapability(CapabilityImageMSArray); } } +#endif return type->getResultId(); } @@ -586,7 +600,7 @@ Id Builder::makeSampledImageType(Id imageType) return type->getResultId(); } -#ifdef NV_EXTENSIONS +#ifndef GLSLANG_WEB Id Builder::makeAccelerationStructureNVType() { Instruction *type; @@ -602,6 +616,7 @@ Id Builder::makeAccelerationStructureNVType() return type->getResultId(); } #endif + Id Builder::getDerefTypeId(Id resultId) const { Id typeId = getTypeId(resultId); @@ -939,6 +954,10 @@ Id Builder::makeFloatConstant(float f, bool specConstant) Id Builder::makeDoubleConstant(double d, bool specConstant) { +#ifdef GLSLANG_WEB + assert(0); + return NoResult; +#else Op opcode = specConstant ? OpSpecConstant : OpConstant; Id typeId = makeFloatType(64); union { double db; unsigned long long ull; } u; @@ -963,10 +982,15 @@ Id Builder::makeDoubleConstant(double d, bool specConstant) module.mapInstruction(c); return c->getResultId(); +#endif } Id Builder::makeFloat16Constant(float f16, bool specConstant) { +#ifdef GLSLANG_WEB + assert(0); + return NoResult; +#else Op opcode = specConstant ? OpSpecConstant : OpConstant; Id typeId = makeFloatType(16); @@ -991,25 +1015,33 @@ Id Builder::makeFloat16Constant(float f16, bool specConstant) module.mapInstruction(c); return c->getResultId(); +#endif } Id Builder::makeFpConstant(Id type, double d, bool specConstant) { - assert(isFloatType(type)); +#ifdef GLSLANG_WEB + const int width = 32; + assert(width == getScalarTypeWidth(type)); +#else + const int width = getScalarTypeWidth(type); +#endif - switch (getScalarTypeWidth(type)) { - case 16: - return makeFloat16Constant((float)d, specConstant); - case 32: - return makeFloatConstant((float)d, specConstant); - case 64: - return makeDoubleConstant(d, specConstant); - default: - break; - } + assert(isFloatType(type)); - assert(false); - return NoResult; + switch (width) { + case 16: + return makeFloat16Constant((float)d, specConstant); + case 32: + return makeFloatConstant((float)d, specConstant); + case 64: + return makeDoubleConstant(d, specConstant); + default: + break; + } + + assert(false); + return NoResult; } Id Builder::findCompositeConstant(Op typeClass, Id typeId, const std::vector<Id>& comps) @@ -1825,7 +1857,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, if (parameters.component != NoResult) texArgs[numArgs++] = parameters.component; -#ifdef NV_EXTENSIONS +#ifndef GLSLANG_WEB if (parameters.granularity != NoResult) texArgs[numArgs++] = parameters.granularity; if (parameters.coarse != NoResult) @@ -1872,6 +1904,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, mask = (ImageOperandsMask)(mask | ImageOperandsConstOffsetsMask); texArgs[numArgs++] = parameters.offsets; } +#ifndef GLSLANG_WEB if (parameters.sample) { mask = (ImageOperandsMask)(mask | ImageOperandsSampleMask); texArgs[numArgs++] = parameters.sample; @@ -1889,6 +1922,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, if (parameters.volatil) { mask = mask | ImageOperandsVolatileTexelKHRMask; } +#endif mask = mask | signExtensionMask; if (mask == ImageOperandsMaskNone) --numArgs; // undo speculative reservation for the mask argument @@ -1904,10 +1938,9 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, opCode = OpImageSparseFetch; else opCode = OpImageFetch; -#ifdef NV_EXTENSIONS +#ifndef GLSLANG_WEB } else if (parameters.granularity && parameters.coarse) { opCode = OpImageSampleFootprintNV; -#endif } else if (gather) { if (parameters.Dref) if (sparse) @@ -1919,6 +1952,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, opCode = OpImageSparseGather; else opCode = OpImageGather; +#endif } else if (explicitLod) { if (parameters.Dref) { if (proj) @@ -2067,11 +2101,7 @@ Id Builder::createTextureQueryCall(Op opCode, const TextureParameters& parameter break; } case OpImageQueryLod: -#ifdef AMD_EXTENSIONS resultType = makeVectorType(getScalarTypeId(getTypeId(parameters.coords)), 2); -#else - resultType = makeVectorType(makeFloatType(32), 2); -#endif break; case OpImageQueryLevels: case OpImageQuerySamples: @@ -2089,6 +2119,7 @@ Id Builder::createTextureQueryCall(Op opCode, const TextureParameters& parameter if (parameters.lod) query->addIdOperand(parameters.lod); buildPoint->addInstruction(std::unique_ptr<Instruction>(query)); + addCapability(CapabilityImageQuery); return query->getResultId(); } @@ -2282,7 +2313,12 @@ Id Builder::createMatrixConstructor(Decoration precision, const std::vector<Id>& int numRows = getTypeNumRows(resultTypeId); Instruction* instr = module.getInstruction(componentTypeId); - unsigned bitCount = instr->getImmediateOperand(0); +#ifdef GLSLANG_WEB + const unsigned bitCount = 32; + assert(bitCount == instr->getImmediateOperand(0)); +#else + const unsigned bitCount = instr->getImmediateOperand(0); +#endif // Optimize matrix constructed from a bigger matrix if (isMatrix(sources[0]) && getNumColumns(sources[0]) >= numCols && getNumRows(sources[0]) >= numRows) { diff --git a/thirdparty/glslang/SPIRV/SpvBuilder.h b/thirdparty/glslang/SPIRV/SpvBuilder.h index faed8e8230..31fee975fc 100644 --- a/thirdparty/glslang/SPIRV/SpvBuilder.h +++ b/thirdparty/glslang/SPIRV/SpvBuilder.h @@ -67,6 +67,7 @@ typedef enum { Spv_1_2 = (1 << 16) | (2 << 8), Spv_1_3 = (1 << 16) | (3 << 8), Spv_1_4 = (1 << 16) | (4 << 8), + Spv_1_5 = (1 << 16) | (5 << 8), } SpvVersion; class Builder { @@ -105,6 +106,20 @@ public: void addModuleProcessed(const std::string& p) { moduleProcesses.push_back(p.c_str()); } void setEmitOpLines() { emitOpLines = true; } void addExtension(const char* ext) { extensions.insert(ext); } + void removeExtension(const char* ext) + { + extensions.erase(ext); + } + void addIncorporatedExtension(const char* ext, SpvVersion incorporatedVersion) + { + if (getSpvVersion() < static_cast<unsigned>(incorporatedVersion)) + addExtension(ext); + } + void promoteIncorporatedExtension(const char* baseExt, const char* promoExt, SpvVersion incorporatedVersion) + { + removeExtension(baseExt); + addIncorporatedExtension(promoExt, incorporatedVersion); + } void addInclude(const std::string& name, const std::string& text) { spv::Id incId = getStringId(name); @@ -201,7 +216,11 @@ public: bool isMatrixType(Id typeId) const { return getTypeClass(typeId) == OpTypeMatrix; } bool isStructType(Id typeId) const { return getTypeClass(typeId) == OpTypeStruct; } bool isArrayType(Id typeId) const { return getTypeClass(typeId) == OpTypeArray; } +#ifdef GLSLANG_WEB + bool isCooperativeMatrixType(Id typeId)const { return false; } +#else bool isCooperativeMatrixType(Id typeId)const { return getTypeClass(typeId) == OpTypeCooperativeMatrixNV; } +#endif bool isAggregateType(Id typeId) const { return isArrayType(typeId) || isStructType(typeId) || isCooperativeMatrixType(typeId); } bool isImageType(Id typeId) const { return getTypeClass(typeId) == OpTypeImage; } bool isSamplerType(Id typeId) const { return getTypeClass(typeId) == OpTypeSampler; } @@ -557,6 +576,14 @@ public: // Accumulate whether anything in the chain of structures has coherent decorations. struct CoherentFlags { + CoherentFlags() { clear(); } +#ifdef GLSLANG_WEB + void clear() { } + bool isVolatile() const { return false; } + CoherentFlags operator |=(const CoherentFlags &other) { return *this; } +#else + bool isVolatile() const { return volatil; } + unsigned coherent : 1; unsigned devicecoherent : 1; unsigned queuefamilycoherent : 1; @@ -577,7 +604,6 @@ public: isImage = 0; } - CoherentFlags() { clear(); } CoherentFlags operator |=(const CoherentFlags &other) { coherent |= other.coherent; devicecoherent |= other.devicecoherent; @@ -589,6 +615,7 @@ public: isImage |= other.isImage; return *this; } +#endif }; CoherentFlags coherentFlags; }; @@ -656,16 +683,21 @@ public: // based on the type of the base and the chain of dereferences. Id accessChainGetInferredType(); - // Add capabilities, extensions, remove unneeded decorations, etc., + // Add capabilities, extensions, remove unneeded decorations, etc., // based on the resulting SPIR-V. void postProcess(); + // Prune unreachable blocks in the CFG and remove unneeded decorations. + void postProcessCFG(); + +#ifndef GLSLANG_WEB + // Add capabilities, extensions based on instructions in the module. + void postProcessFeatures(); // Hook to visit each instruction in a block in a function void postProcess(Instruction&); - // Hook to visit each instruction in a reachable block in a function. - void postProcessReachable(const Instruction&); // Hook to visit each non-32-bit sized float/int operation in a block. void postProcessType(const Instruction&, spv::Id typeId); +#endif void dump(std::vector<unsigned int>&) const; diff --git a/thirdparty/glslang/SPIRV/SpvPostProcess.cpp b/thirdparty/glslang/SPIRV/SpvPostProcess.cpp index 6e1f7cf61f..d40174d172 100644 --- a/thirdparty/glslang/SPIRV/SpvPostProcess.cpp +++ b/thirdparty/glslang/SPIRV/SpvPostProcess.cpp @@ -39,6 +39,7 @@ #include <cassert> #include <cstdlib> +#include <unordered_map> #include <unordered_set> #include <algorithm> @@ -51,16 +52,13 @@ namespace spv { #include "GLSL.std.450.h" #include "GLSL.ext.KHR.h" #include "GLSL.ext.EXT.h" -#ifdef AMD_EXTENSIONS #include "GLSL.ext.AMD.h" -#endif -#ifdef NV_EXTENSIONS #include "GLSL.ext.NV.h" -#endif } namespace spv { +#ifndef GLSLANG_WEB // Hook to visit each operand type and result type of an instruction. // Will be called multiple times for one instruction, once for each typed // operand and the result. @@ -160,7 +158,6 @@ void Builder::postProcessType(const Instruction& inst, Id typeId) } break; case OpExtInst: -#if AMD_EXTENSIONS switch (inst.getImmediateOperand(1)) { case GLSLstd450Frexp: case GLSLstd450FrexpStruct: @@ -176,7 +173,6 @@ void Builder::postProcessType(const Instruction& inst, Id typeId) default: break; } -#endif break; default: if (basicTypeOp == OpTypeFloat && width == 16) @@ -222,12 +218,10 @@ void Builder::postProcess(Instruction& inst) addCapability(CapabilityImageQuery); break; -#ifdef NV_EXTENSIONS case OpGroupNonUniformPartitionNV: addExtension(E_SPV_NV_shader_subgroup_partitioned); addCapability(CapabilityGroupNonUniformPartitionedNV); break; -#endif case OpLoad: case OpStore: @@ -326,17 +320,16 @@ void Builder::postProcess(Instruction& inst) } } } - -// Called for each instruction in a reachable block. -void Builder::postProcessReachable(const Instruction&) -{ - // did have code here, but questionable to do so without deleting the instructions -} +#endif // comment in header -void Builder::postProcess() +void Builder::postProcessCFG() { + // reachableBlocks is the set of blockss reached via control flow, or which are + // unreachable continue targert or unreachable merge. std::unordered_set<const Block*> reachableBlocks; + std::unordered_map<Block*, Block*> headerForUnreachableContinue; + std::unordered_set<Block*> unreachableMerges; std::unordered_set<Id> unreachableDefinitions; // Collect IDs defined in unreachable blocks. For each function, label the // reachable blocks first. Then for each unreachable block, collect the @@ -344,16 +337,41 @@ void Builder::postProcess() for (auto fi = module.getFunctions().cbegin(); fi != module.getFunctions().cend(); fi++) { Function* f = *fi; Block* entry = f->getEntryBlock(); - inReadableOrder(entry, [&reachableBlocks](const Block* b) { reachableBlocks.insert(b); }); + inReadableOrder(entry, + [&reachableBlocks, &unreachableMerges, &headerForUnreachableContinue] + (Block* b, ReachReason why, Block* header) { + reachableBlocks.insert(b); + if (why == ReachDeadContinue) headerForUnreachableContinue[b] = header; + if (why == ReachDeadMerge) unreachableMerges.insert(b); + }); for (auto bi = f->getBlocks().cbegin(); bi != f->getBlocks().cend(); bi++) { Block* b = *bi; - if (reachableBlocks.count(b) == 0) { - for (auto ii = b->getInstructions().cbegin(); ii != b->getInstructions().cend(); ii++) + if (unreachableMerges.count(b) != 0 || headerForUnreachableContinue.count(b) != 0) { + auto ii = b->getInstructions().cbegin(); + ++ii; // Keep potential decorations on the label. + for (; ii != b->getInstructions().cend(); ++ii) + unreachableDefinitions.insert(ii->get()->getResultId()); + } else if (reachableBlocks.count(b) == 0) { + // The normal case for unreachable code. All definitions are considered dead. + for (auto ii = b->getInstructions().cbegin(); ii != b->getInstructions().cend(); ++ii) unreachableDefinitions.insert(ii->get()->getResultId()); } } } + // Modify unreachable merge blocks and unreachable continue targets. + // Delete their contents. + for (auto mergeIter = unreachableMerges.begin(); mergeIter != unreachableMerges.end(); ++mergeIter) { + (*mergeIter)->rewriteAsCanonicalUnreachableMerge(); + } + for (auto continueIter = headerForUnreachableContinue.begin(); + continueIter != headerForUnreachableContinue.end(); + ++continueIter) { + Block* continue_target = continueIter->first; + Block* header = continueIter->second; + continue_target->rewriteAsCanonicalUnreachableContinue(header); + } + // Remove unneeded decorations, for unreachable instructions decorations.erase(std::remove_if(decorations.begin(), decorations.end(), [&unreachableDefinitions](std::unique_ptr<Instruction>& I) -> bool { @@ -361,7 +379,11 @@ void Builder::postProcess() return unreachableDefinitions.count(decoration_id) != 0; }), decorations.end()); +} +#ifndef GLSLANG_WEB +// comment in header +void Builder::postProcessFeatures() { // Add per-instruction capabilities, extensions, etc., // Look for any 8/16 bit type in physical storage buffer class, and set the @@ -371,24 +393,17 @@ void Builder::postProcess() Instruction* type = groupedTypes[OpTypePointer][t]; if (type->getImmediateOperand(0) == (unsigned)StorageClassPhysicalStorageBufferEXT) { if (containsType(type->getIdOperand(1), OpTypeInt, 8)) { - addExtension(spv::E_SPV_KHR_8bit_storage); + addIncorporatedExtension(spv::E_SPV_KHR_8bit_storage, spv::Spv_1_5); addCapability(spv::CapabilityStorageBuffer8BitAccess); } if (containsType(type->getIdOperand(1), OpTypeInt, 16) || containsType(type->getIdOperand(1), OpTypeFloat, 16)) { - addExtension(spv::E_SPV_KHR_16bit_storage); + addIncorporatedExtension(spv::E_SPV_KHR_16bit_storage, spv::Spv_1_3); addCapability(spv::CapabilityStorageBuffer16BitAccess); } } } - // process all reachable instructions... - for (auto bi = reachableBlocks.cbegin(); bi != reachableBlocks.cend(); ++bi) { - const Block* block = *bi; - const auto function = [this](const std::unique_ptr<Instruction>& inst) { postProcessReachable(*inst.get()); }; - std::for_each(block->getInstructions().begin(), block->getInstructions().end(), function); - } - // process all block-contained instructions for (auto fi = module.getFunctions().cbegin(); fi != module.getFunctions().cend(); fi++) { Function* f = *fi; @@ -422,5 +437,14 @@ void Builder::postProcess() } } } +#endif + +// comment in header +void Builder::postProcess() { + postProcessCFG(); +#ifndef GLSLANG_WEB + postProcessFeatures(); +#endif +} }; // end spv namespace diff --git a/thirdparty/glslang/SPIRV/SpvTools.cpp b/thirdparty/glslang/SPIRV/SpvTools.cpp index db26d59089..97bd4e7427 100644 --- a/thirdparty/glslang/SPIRV/SpvTools.cpp +++ b/thirdparty/glslang/SPIRV/SpvTools.cpp @@ -67,6 +67,8 @@ spv_target_env MapToSpirvToolsEnv(const SpvVersion& spvVersion, spv::SpvBuildLog logger->missingFunctionality("Target version for SPIRV-Tools validator"); return spv_target_env::SPV_ENV_VULKAN_1_1; } + case glslang::EShTargetVulkan_1_2: + return spv_target_env::SPV_ENV_VULKAN_1_2; default: break; } @@ -103,7 +105,7 @@ void SpirvToolsDisassemble(std::ostream& out, const std::vector<unsigned int>& s // Apply the SPIRV-Tools validator to generated SPIR-V. void SpirvToolsValidate(const glslang::TIntermediate& intermediate, std::vector<unsigned int>& spirv, - spv::SpvBuildLogger* logger) + spv::SpvBuildLogger* logger, bool prelegalization) { // validate spv_context context = spvContextCreate(MapToSpirvToolsEnv(intermediate.getSpv(), logger)); @@ -111,6 +113,7 @@ void SpirvToolsValidate(const glslang::TIntermediate& intermediate, std::vector< spv_diagnostic diagnostic = nullptr; spv_validator_options options = spvValidatorOptionsCreate(); spvValidatorOptionsSetRelaxBlockLayout(options, intermediate.usingHlslOffsets()); + spvValidatorOptionsSetBeforeHlslLegalization(options, prelegalization); spvValidateWithOptions(context, options, &binary, &diagnostic); // report @@ -172,6 +175,7 @@ void SpirvToolsLegalize(const glslang::TIntermediate&, std::vector<unsigned int> if (options->generateDebugInfo) { optimizer.RegisterPass(spvtools::CreatePropagateLineInfoPass()); } + optimizer.RegisterPass(spvtools::CreateWrapOpKillPass()); optimizer.RegisterPass(spvtools::CreateDeadBranchElimPass()); optimizer.RegisterPass(spvtools::CreateMergeReturnPass()); optimizer.RegisterPass(spvtools::CreateInlineExhaustivePass()); @@ -195,8 +199,6 @@ void SpirvToolsLegalize(const glslang::TIntermediate&, std::vector<unsigned int> optimizer.RegisterPass(spvtools::CreateDeadInsertElimPass()); if (options->optimizeSize) { optimizer.RegisterPass(spvtools::CreateRedundancyEliminationPass()); - // TODO(greg-lunarg): Add this when AMD driver issues are resolved - // optimizer.RegisterPass(CreateCommonUniformElimPass()); } optimizer.RegisterPass(spvtools::CreateAggressiveDCEPass()); optimizer.RegisterPass(spvtools::CreateCFGCleanupPass()); diff --git a/thirdparty/glslang/SPIRV/SpvTools.h b/thirdparty/glslang/SPIRV/SpvTools.h index 7e49ae0b30..59c914da0b 100644 --- a/thirdparty/glslang/SPIRV/SpvTools.h +++ b/thirdparty/glslang/SPIRV/SpvTools.h @@ -41,10 +41,12 @@ #ifndef GLSLANG_SPV_TOOLS_H #define GLSLANG_SPV_TOOLS_H +#ifdef ENABLE_OPT #include <vector> #include <ostream> +#endif -#include "../glslang/MachineIndependent/localintermediate.h" +#include "glslang/MachineIndependent/localintermediate.h" #include "Logger.h" namespace glslang { @@ -59,14 +61,14 @@ struct SpvOptions { bool validate; }; -#if ENABLE_OPT +#ifdef ENABLE_OPT // Use the SPIRV-Tools disassembler to print SPIR-V. void SpirvToolsDisassemble(std::ostream& out, const std::vector<unsigned int>& spirv); // Apply the SPIRV-Tools validator to generated SPIR-V. void SpirvToolsValidate(const glslang::TIntermediate& intermediate, std::vector<unsigned int>& spirv, - spv::SpvBuildLogger*); + spv::SpvBuildLogger*, bool prelegalization); // Apply the SPIRV-Tools optimizer to generated SPIR-V, for the purpose of // legalizing HLSL SPIR-V. diff --git a/thirdparty/glslang/SPIRV/disassemble.cpp b/thirdparty/glslang/SPIRV/disassemble.cpp index 631173c0ec..930e799493 100644 --- a/thirdparty/glslang/SPIRV/disassemble.cpp +++ b/thirdparty/glslang/SPIRV/disassemble.cpp @@ -52,26 +52,16 @@ namespace spv { extern "C" { // Include C-based headers that don't have a namespace #include "GLSL.std.450.h" -#ifdef AMD_EXTENSIONS #include "GLSL.ext.AMD.h" -#endif - -#ifdef NV_EXTENSIONS #include "GLSL.ext.NV.h" -#endif } } const char* GlslStd450DebugNames[spv::GLSLstd450Count]; namespace spv { -#ifdef AMD_EXTENSIONS static const char* GLSLextAMDGetDebugNames(const char*, unsigned); -#endif - -#ifdef NV_EXTENSIONS static const char* GLSLextNVGetDebugNames(const char*, unsigned); -#endif static void Kill(std::ostream& out, const char* message) { @@ -82,15 +72,8 @@ static void Kill(std::ostream& out, const char* message) // used to identify the extended instruction library imported when printing enum ExtInstSet { GLSL450Inst, - -#ifdef AMD_EXTENSIONS GLSLextAMDInst, -#endif - -#ifdef NV_EXTENSIONS GLSLextNVInst, -#endif - OpenCLExtInst, }; @@ -499,37 +482,29 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode, const char* name = idDescriptor[stream[word - 2]].c_str(); if (0 == memcmp("OpenCL", name, 6)) { extInstSet = OpenCLExtInst; -#ifdef AMD_EXTENSIONS } else if (strcmp(spv::E_SPV_AMD_shader_ballot, name) == 0 || strcmp(spv::E_SPV_AMD_shader_trinary_minmax, name) == 0 || strcmp(spv::E_SPV_AMD_shader_explicit_vertex_parameter, name) == 0 || strcmp(spv::E_SPV_AMD_gcn_shader, name) == 0) { extInstSet = GLSLextAMDInst; -#endif -#ifdef NV_EXTENSIONS - }else if (strcmp(spv::E_SPV_NV_sample_mask_override_coverage, name) == 0 || + } else if (strcmp(spv::E_SPV_NV_sample_mask_override_coverage, name) == 0 || strcmp(spv::E_SPV_NV_geometry_shader_passthrough, name) == 0 || strcmp(spv::E_SPV_NV_viewport_array2, name) == 0 || strcmp(spv::E_SPV_NVX_multiview_per_view_attributes, name) == 0 || strcmp(spv::E_SPV_NV_fragment_shader_barycentric, name) == 0 || strcmp(spv::E_SPV_NV_mesh_shader, name) == 0) { extInstSet = GLSLextNVInst; -#endif } unsigned entrypoint = stream[word - 1]; if (extInstSet == GLSL450Inst) { if (entrypoint < GLSLstd450Count) { out << "(" << GlslStd450DebugNames[entrypoint] << ")"; } -#ifdef AMD_EXTENSIONS } else if (extInstSet == GLSLextAMDInst) { out << "(" << GLSLextAMDGetDebugNames(name, entrypoint) << ")"; -#endif -#ifdef NV_EXTENSIONS } else if (extInstSet == GLSLextNVInst) { out << "(" << GLSLextNVGetDebugNames(name, entrypoint) << ")"; -#endif } } break; @@ -648,9 +623,11 @@ static void GLSLstd450GetDebugNames(const char** names) names[GLSLstd450InterpolateAtCentroid] = "InterpolateAtCentroid"; names[GLSLstd450InterpolateAtSample] = "InterpolateAtSample"; names[GLSLstd450InterpolateAtOffset] = "InterpolateAtOffset"; + names[GLSLstd450NMin] = "NMin"; + names[GLSLstd450NMax] = "NMax"; + names[GLSLstd450NClamp] = "NClamp"; } -#ifdef AMD_EXTENSIONS static const char* GLSLextAMDGetDebugNames(const char* name, unsigned entrypoint) { if (strcmp(name, spv::E_SPV_AMD_shader_ballot) == 0) { @@ -692,18 +669,17 @@ static const char* GLSLextAMDGetDebugNames(const char* name, unsigned entrypoint return "Bad"; } -#endif -#ifdef NV_EXTENSIONS static const char* GLSLextNVGetDebugNames(const char* name, unsigned entrypoint) { if (strcmp(name, spv::E_SPV_NV_sample_mask_override_coverage) == 0 || strcmp(name, spv::E_SPV_NV_geometry_shader_passthrough) == 0 || strcmp(name, spv::E_ARB_shader_viewport_layer_array) == 0 || strcmp(name, spv::E_SPV_NV_viewport_array2) == 0 || - strcmp(spv::E_SPV_NVX_multiview_per_view_attributes, name) == 0 || - strcmp(spv::E_SPV_NV_fragment_shader_barycentric, name) == 0 || - strcmp(name, spv::E_SPV_NV_mesh_shader) == 0) { + strcmp(name, spv::E_SPV_NVX_multiview_per_view_attributes) == 0 || + strcmp(name, spv::E_SPV_NV_fragment_shader_barycentric) == 0 || + strcmp(name, spv::E_SPV_NV_mesh_shader) == 0 || + strcmp(name, spv::E_SPV_NV_shader_image_footprint) == 0) { switch (entrypoint) { // NV builtins case BuiltInViewportMaskNV: return "ViewportMaskNV"; @@ -729,6 +705,8 @@ static const char* GLSLextNVGetDebugNames(const char* name, unsigned entrypoint) case CapabilityPerViewAttributesNV: return "PerViewAttributesNV"; case CapabilityFragmentBarycentricNV: return "FragmentBarycentricNV"; case CapabilityMeshShadingNV: return "MeshShadingNV"; + case CapabilityImageFootprintNV: return "ImageFootprintNV"; + case CapabilitySampleMaskOverrideCoverageNV:return "SampleMaskOverrideCoverageNV"; // NV Decorations case DecorationOverrideCoverageNV: return "OverrideCoverageNV"; @@ -745,7 +723,6 @@ static const char* GLSLextNVGetDebugNames(const char* name, unsigned entrypoint) } return "Bad"; } -#endif void Disassemble(std::ostream& out, const std::vector<unsigned int>& stream) { diff --git a/thirdparty/glslang/SPIRV/doc.cpp b/thirdparty/glslang/SPIRV/doc.cpp index 3b85767216..bee5c79729 100644 --- a/thirdparty/glslang/SPIRV/doc.cpp +++ b/thirdparty/glslang/SPIRV/doc.cpp @@ -50,12 +50,8 @@ namespace spv { // Include C-based headers that don't have a namespace #include "GLSL.ext.KHR.h" #include "GLSL.ext.EXT.h" -#ifdef AMD_EXTENSIONS #include "GLSL.ext.AMD.h" -#endif -#ifdef NV_EXTENSIONS #include "GLSL.ext.NV.h" -#endif } } @@ -98,22 +94,17 @@ const char* ExecutionModelString(int model) case 4: return "Fragment"; case 5: return "GLCompute"; case 6: return "Kernel"; -#ifdef NV_EXTENSIONS case ExecutionModelTaskNV: return "TaskNV"; case ExecutionModelMeshNV: return "MeshNV"; -#endif default: return "Bad"; -#ifdef NV_EXTENSIONS case ExecutionModelRayGenerationNV: return "RayGenerationNV"; case ExecutionModelIntersectionNV: return "IntersectionNV"; case ExecutionModelAnyHitNV: return "AnyHitNV"; case ExecutionModelClosestHitNV: return "ClosestHitNV"; case ExecutionModelMissNV: return "MissNV"; case ExecutionModelCallableNV: return "CallableNV"; -#endif - } } @@ -183,13 +174,18 @@ const char* ExecutionModeString(int mode) case 4446: return "PostDepthCoverage"; -#ifdef NV_EXTENSIONS case ExecutionModeOutputLinesNV: return "OutputLinesNV"; case ExecutionModeOutputPrimitivesNV: return "OutputPrimitivesNV"; case ExecutionModeOutputTrianglesNV: return "OutputTrianglesNV"; case ExecutionModeDerivativeGroupQuadsNV: return "DerivativeGroupQuadsNV"; case ExecutionModeDerivativeGroupLinearNV: return "DerivativeGroupLinearNV"; -#endif + + case ExecutionModePixelInterlockOrderedEXT: return "PixelInterlockOrderedEXT"; + case ExecutionModePixelInterlockUnorderedEXT: return "PixelInterlockUnorderedEXT"; + case ExecutionModeSampleInterlockOrderedEXT: return "SampleInterlockOrderedEXT"; + case ExecutionModeSampleInterlockUnorderedEXT: return "SampleInterlockUnorderedEXT"; + case ExecutionModeShadingRateInterlockOrderedEXT: return "ShadingRateInterlockOrderedEXT"; + case ExecutionModeShadingRateInterlockUnorderedEXT: return "ShadingRateInterlockUnorderedEXT"; case ExecutionModeCeiling: default: return "Bad"; @@ -213,14 +209,12 @@ const char* StorageClassString(int StorageClass) case 11: return "Image"; case 12: return "StorageBuffer"; -#ifdef NV_EXTENSIONS case StorageClassRayPayloadNV: return "RayPayloadNV"; case StorageClassHitAttributeNV: return "HitAttributeNV"; case StorageClassIncomingRayPayloadNV: return "IncomingRayPayloadNV"; case StorageClassShaderRecordBufferNV: return "ShaderRecordBufferNV"; case StorageClassCallableDataNV: return "CallableDataNV"; case StorageClassIncomingCallableDataNV: return "IncomingCallableDataNV"; -#endif case StorageClassPhysicalStorageBufferEXT: return "PhysicalStorageBufferEXT"; @@ -282,10 +276,7 @@ const char* DecorationString(int decoration) case DecorationCeiling: default: return "Bad"; -#ifdef AMD_EXTENSIONS case DecorationExplicitInterpAMD: return "ExplicitInterpAMD"; -#endif -#ifdef NV_EXTENSIONS case DecorationOverrideCoverageNV: return "OverrideCoverageNV"; case DecorationPassthroughNV: return "PassthroughNV"; case DecorationViewportRelativeNV: return "ViewportRelativeNV"; @@ -294,7 +285,6 @@ const char* DecorationString(int decoration) case DecorationPerViewNV: return "PerViewNV"; case DecorationPerTaskNV: return "PerTaskNV"; case DecorationPerVertexNV: return "PerVertexNV"; -#endif case DecorationNonUniformEXT: return "DecorationNonUniformEXT"; case DecorationHlslCounterBufferGOOGLE: return "DecorationHlslCounterBufferGOOGLE"; @@ -364,7 +354,6 @@ const char* BuiltInString(int builtIn) case 4426: return "DrawIndex"; case 5014: return "FragStencilRefEXT"; -#ifdef AMD_EXTENSIONS case 4992: return "BaryCoordNoPerspAMD"; case 4993: return "BaryCoordNoPerspCentroidAMD"; case 4994: return "BaryCoordNoPerspSampleAMD"; @@ -372,9 +361,6 @@ const char* BuiltInString(int builtIn) case 4996: return "BaryCoordSmoothCentroidAMD"; case 4997: return "BaryCoordSmoothSampleAMD"; case 4998: return "BaryCoordPullModelAMD"; -#endif - -#ifdef NV_EXTENSIONS case BuiltInLaunchIdNV: return "LaunchIdNV"; case BuiltInLaunchSizeNV: return "LaunchSizeNV"; case BuiltInWorldRayOriginNV: return "WorldRayOriginNV"; @@ -398,15 +384,12 @@ const char* BuiltInString(int builtIn) // case BuiltInInvocationsPerPixelNV: return "InvocationsPerPixelNV"; // superseded by BuiltInFragInvocationCountEXT case BuiltInBaryCoordNV: return "BaryCoordNV"; case BuiltInBaryCoordNoPerspNV: return "BaryCoordNoPerspNV"; -#endif case BuiltInFragSizeEXT: return "FragSizeEXT"; case BuiltInFragInvocationCountEXT: return "FragInvocationCountEXT"; case 5264: return "FullyCoveredEXT"; - -#ifdef NV_EXTENSIONS case BuiltInTaskCountNV: return "TaskCountNV"; case BuiltInPrimitiveCountNV: return "PrimitiveCountNV"; case BuiltInPrimitiveIndicesNV: return "PrimitiveIndicesNV"; @@ -415,7 +398,10 @@ const char* BuiltInString(int builtIn) case BuiltInLayerPerViewNV: return "LayerPerViewNV"; case BuiltInMeshViewCountNV: return "MeshViewCountNV"; case BuiltInMeshViewIndicesNV: return "MeshViewIndicesNV"; -#endif + case BuiltInWarpsPerSMNV: return "WarpsPerSMNV"; + case BuiltInSMCountNV: return "SMCountNV"; + case BuiltInWarpIDNV: return "WarpIDNV"; + case BuiltInSMIDNV: return "SMIDNV"; default: return "Bad"; } @@ -770,11 +756,9 @@ const char* GroupOperationString(int gop) case GroupOperationInclusiveScan: return "InclusiveScan"; case GroupOperationExclusiveScan: return "ExclusiveScan"; case GroupOperationClusteredReduce: return "ClusteredReduce"; -#ifdef NV_EXTENSIONS case GroupOperationPartitionedReduceNV: return "PartitionedReduceNV"; case GroupOperationPartitionedInclusiveScanNV: return "PartitionedInclusiveScanNV"; case GroupOperationPartitionedExclusiveScanNV: return "PartitionedExclusiveScanNV"; -#endif default: return "Bad"; } @@ -882,26 +866,23 @@ const char* CapabilityString(int info) case CapabilityStoragePushConstant16: return "StoragePushConstant16"; case CapabilityStorageInputOutput16: return "StorageInputOutput16"; - case CapabilityStorageBuffer8BitAccess: return "CapabilityStorageBuffer8BitAccess"; - case CapabilityUniformAndStorageBuffer8BitAccess: return "CapabilityUniformAndStorageBuffer8BitAccess"; - case CapabilityStoragePushConstant8: return "CapabilityStoragePushConstant8"; + case CapabilityStorageBuffer8BitAccess: return "StorageBuffer8BitAccess"; + case CapabilityUniformAndStorageBuffer8BitAccess: return "UniformAndStorageBuffer8BitAccess"; + case CapabilityStoragePushConstant8: return "StoragePushConstant8"; case CapabilityDeviceGroup: return "DeviceGroup"; case CapabilityMultiView: return "MultiView"; case CapabilityStencilExportEXT: return "StencilExportEXT"; -#ifdef AMD_EXTENSIONS case CapabilityFloat16ImageAMD: return "Float16ImageAMD"; case CapabilityImageGatherBiasLodAMD: return "ImageGatherBiasLodAMD"; case CapabilityFragmentMaskAMD: return "FragmentMaskAMD"; case CapabilityImageReadWriteLodAMD: return "ImageReadWriteLodAMD"; -#endif case CapabilityAtomicStorageOps: return "AtomicStorageOps"; case CapabilitySampleMaskPostDepthCoverage: return "SampleMaskPostDepthCoverage"; -#ifdef NV_EXTENSIONS case CapabilityGeometryShaderPassthroughNV: return "GeometryShaderPassthroughNV"; case CapabilityShaderViewportIndexLayerNV: return "ShaderViewportIndexLayerNV"; case CapabilityShaderViewportMaskNV: return "ShaderViewportMaskNV"; @@ -913,33 +894,44 @@ const char* CapabilityString(int info) case CapabilityComputeDerivativeGroupLinearNV: return "ComputeDerivativeGroupLinearNV"; case CapabilityFragmentBarycentricNV: return "FragmentBarycentricNV"; case CapabilityMeshShadingNV: return "MeshShadingNV"; -// case CapabilityShadingRateNV: return "ShadingRateNV"; // superseded by CapabilityFragmentDensityEXT -#endif + case CapabilityImageFootprintNV: return "ImageFootprintNV"; +// case CapabilityShadingRateNV: return "ShadingRateNV"; // superseded by FragmentDensityEXT + case CapabilitySampleMaskOverrideCoverageNV: return "SampleMaskOverrideCoverageNV"; case CapabilityFragmentDensityEXT: return "FragmentDensityEXT"; case CapabilityFragmentFullyCoveredEXT: return "FragmentFullyCoveredEXT"; - case CapabilityShaderNonUniformEXT: return "CapabilityShaderNonUniformEXT"; - case CapabilityRuntimeDescriptorArrayEXT: return "CapabilityRuntimeDescriptorArrayEXT"; - case CapabilityInputAttachmentArrayDynamicIndexingEXT: return "CapabilityInputAttachmentArrayDynamicIndexingEXT"; - case CapabilityUniformTexelBufferArrayDynamicIndexingEXT: return "CapabilityUniformTexelBufferArrayDynamicIndexingEXT"; - case CapabilityStorageTexelBufferArrayDynamicIndexingEXT: return "CapabilityStorageTexelBufferArrayDynamicIndexingEXT"; - case CapabilityUniformBufferArrayNonUniformIndexingEXT: return "CapabilityUniformBufferArrayNonUniformIndexingEXT"; - case CapabilitySampledImageArrayNonUniformIndexingEXT: return "CapabilitySampledImageArrayNonUniformIndexingEXT"; - case CapabilityStorageBufferArrayNonUniformIndexingEXT: return "CapabilityStorageBufferArrayNonUniformIndexingEXT"; - case CapabilityStorageImageArrayNonUniformIndexingEXT: return "CapabilityStorageImageArrayNonUniformIndexingEXT"; - case CapabilityInputAttachmentArrayNonUniformIndexingEXT: return "CapabilityInputAttachmentArrayNonUniformIndexingEXT"; - case CapabilityUniformTexelBufferArrayNonUniformIndexingEXT: return "CapabilityUniformTexelBufferArrayNonUniformIndexingEXT"; - case CapabilityStorageTexelBufferArrayNonUniformIndexingEXT: return "CapabilityStorageTexelBufferArrayNonUniformIndexingEXT"; + case CapabilityShaderNonUniformEXT: return "ShaderNonUniformEXT"; + case CapabilityRuntimeDescriptorArrayEXT: return "RuntimeDescriptorArrayEXT"; + case CapabilityInputAttachmentArrayDynamicIndexingEXT: return "InputAttachmentArrayDynamicIndexingEXT"; + case CapabilityUniformTexelBufferArrayDynamicIndexingEXT: return "UniformTexelBufferArrayDynamicIndexingEXT"; + case CapabilityStorageTexelBufferArrayDynamicIndexingEXT: return "StorageTexelBufferArrayDynamicIndexingEXT"; + case CapabilityUniformBufferArrayNonUniformIndexingEXT: return "UniformBufferArrayNonUniformIndexingEXT"; + case CapabilitySampledImageArrayNonUniformIndexingEXT: return "SampledImageArrayNonUniformIndexingEXT"; + case CapabilityStorageBufferArrayNonUniformIndexingEXT: return "StorageBufferArrayNonUniformIndexingEXT"; + case CapabilityStorageImageArrayNonUniformIndexingEXT: return "StorageImageArrayNonUniformIndexingEXT"; + case CapabilityInputAttachmentArrayNonUniformIndexingEXT: return "InputAttachmentArrayNonUniformIndexingEXT"; + case CapabilityUniformTexelBufferArrayNonUniformIndexingEXT: return "UniformTexelBufferArrayNonUniformIndexingEXT"; + case CapabilityStorageTexelBufferArrayNonUniformIndexingEXT: return "StorageTexelBufferArrayNonUniformIndexingEXT"; + + case CapabilityVulkanMemoryModelKHR: return "VulkanMemoryModelKHR"; + case CapabilityVulkanMemoryModelDeviceScopeKHR: return "VulkanMemoryModelDeviceScopeKHR"; + + case CapabilityPhysicalStorageBufferAddressesEXT: return "PhysicalStorageBufferAddressesEXT"; - case CapabilityVulkanMemoryModelKHR: return "CapabilityVulkanMemoryModelKHR"; - case CapabilityVulkanMemoryModelDeviceScopeKHR: return "CapabilityVulkanMemoryModelDeviceScopeKHR"; + case CapabilityVariablePointers: return "VariablePointers"; - case CapabilityPhysicalStorageBufferAddressesEXT: return "CapabilityPhysicalStorageBufferAddressesEXT"; + case CapabilityCooperativeMatrixNV: return "CooperativeMatrixNV"; + case CapabilityShaderSMBuiltinsNV: return "ShaderSMBuiltinsNV"; - case CapabilityVariablePointers: return "CapabilityVariablePointers"; + case CapabilityFragmentShaderSampleInterlockEXT: return "CapabilityFragmentShaderSampleInterlockEXT"; + case CapabilityFragmentShaderPixelInterlockEXT: return "CapabilityFragmentShaderPixelInterlockEXT"; + case CapabilityFragmentShaderShadingRateInterlockEXT: return "CapabilityFragmentShaderShadingRateInterlockEXT"; - case CapabilityCooperativeMatrixNV: return "CapabilityCooperativeMatrixNV"; + case CapabilityDemoteToHelperInvocationEXT: return "DemoteToHelperInvocationEXT"; + case CapabilityShaderClockKHR: return "ShaderClockKHR"; + + case CapabilityIntegerFunctions2INTEL: return "CapabilityIntegerFunctions2INTEL"; default: return "Bad"; } @@ -1316,7 +1308,6 @@ const char* OpcodeString(int op) case 4430: return "OpSubgroupAllEqualKHR"; case 4432: return "OpSubgroupReadInvocationKHR"; -#ifdef AMD_EXTENSIONS case 5000: return "OpGroupIAddNonUniformAMD"; case 5001: return "OpGroupFAddNonUniformAMD"; case 5002: return "OpGroupFMinNonUniformAMD"; @@ -1328,12 +1319,12 @@ const char* OpcodeString(int op) case 5011: return "OpFragmentMaskFetchAMD"; case 5012: return "OpFragmentFetchAMD"; -#endif + + case OpReadClockKHR: return "OpReadClockKHR"; case OpDecorateStringGOOGLE: return "OpDecorateStringGOOGLE"; case OpMemberDecorateStringGOOGLE: return "OpMemberDecorateStringGOOGLE"; -#ifdef NV_EXTENSIONS case OpGroupNonUniformPartitionNV: return "OpGroupNonUniformPartitionNV"; case OpReportIntersectionNV: return "OpReportIntersectionNV"; case OpIgnoreIntersectionNV: return "OpIgnoreIntersectionNV"; @@ -1343,13 +1334,17 @@ const char* OpcodeString(int op) case OpExecuteCallableNV: return "OpExecuteCallableNV"; case OpImageSampleFootprintNV: return "OpImageSampleFootprintNV"; case OpWritePackedPrimitiveIndices4x8NV: return "OpWritePackedPrimitiveIndices4x8NV"; -#endif case OpTypeCooperativeMatrixNV: return "OpTypeCooperativeMatrixNV"; case OpCooperativeMatrixLoadNV: return "OpCooperativeMatrixLoadNV"; case OpCooperativeMatrixStoreNV: return "OpCooperativeMatrixStoreNV"; case OpCooperativeMatrixMulAddNV: return "OpCooperativeMatrixMulAddNV"; case OpCooperativeMatrixLengthNV: return "OpCooperativeMatrixLengthNV"; + case OpDemoteToHelperInvocationEXT: return "OpDemoteToHelperInvocationEXT"; + case OpIsHelperInvocationEXT: return "OpIsHelperInvocationEXT"; + + case OpBeginInvocationInterlockEXT: return "OpBeginInvocationInterlockEXT"; + case OpEndInvocationInterlockEXT: return "OpEndInvocationInterlockEXT"; default: return "Bad"; @@ -1464,6 +1459,8 @@ void Parameterize() InstructionDesc[OpModuleProcessed].setResultAndType(false, false); InstructionDesc[OpTypeCooperativeMatrixNV].setResultAndType(true, false); InstructionDesc[OpCooperativeMatrixStoreNV].setResultAndType(false, false); + InstructionDesc[OpBeginInvocationInterlockEXT].setResultAndType(false, false); + InstructionDesc[OpEndInvocationInterlockEXT].setResultAndType(false, false); // Specific additional context-dependent operands @@ -2656,7 +2653,6 @@ void Parameterize() InstructionDesc[OpModuleProcessed].operands.push(OperandLiteralString, "'process'"); -#ifdef AMD_EXTENSIONS InstructionDesc[OpGroupIAddNonUniformAMD].operands.push(OperandScope, "'Execution'"); InstructionDesc[OpGroupIAddNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'"); InstructionDesc[OpGroupIAddNonUniformAMD].operands.push(OperandId, "'X'"); @@ -2695,9 +2691,7 @@ void Parameterize() InstructionDesc[OpFragmentFetchAMD].operands.push(OperandId, "'Image'"); InstructionDesc[OpFragmentFetchAMD].operands.push(OperandId, "'Coordinate'"); InstructionDesc[OpFragmentFetchAMD].operands.push(OperandId, "'Fragment Index'"); -#endif -#ifdef NV_EXTENSIONS InstructionDesc[OpGroupNonUniformPartitionNV].operands.push(OperandId, "X"); InstructionDesc[OpTypeAccelerationStructureNV].setResultAndType(true, false); @@ -2735,7 +2729,6 @@ void Parameterize() InstructionDesc[OpWritePackedPrimitiveIndices4x8NV].operands.push(OperandId, "'Index Offset'"); InstructionDesc[OpWritePackedPrimitiveIndices4x8NV].operands.push(OperandId, "'Packed Indices'"); -#endif InstructionDesc[OpTypeCooperativeMatrixNV].operands.push(OperandId, "'Component Type'"); InstructionDesc[OpTypeCooperativeMatrixNV].operands.push(OperandId, "'Scope'"); @@ -2762,6 +2755,10 @@ void Parameterize() InstructionDesc[OpCooperativeMatrixMulAddNV].operands.push(OperandId, "'C'"); InstructionDesc[OpCooperativeMatrixLengthNV].operands.push(OperandId, "'Type'"); + + InstructionDesc[OpDemoteToHelperInvocationEXT].setResultAndType(false, false); + + InstructionDesc[OpReadClockKHR].operands.push(OperandScope, "'Scope'"); } }; // end spv namespace diff --git a/thirdparty/glslang/SPIRV/spirv.hpp b/thirdparty/glslang/SPIRV/spirv.hpp index 5297fd3902..1e96f7b4a9 100644 --- a/thirdparty/glslang/SPIRV/spirv.hpp +++ b/thirdparty/glslang/SPIRV/spirv.hpp @@ -91,6 +91,7 @@ enum AddressingModel { AddressingModelLogical = 0, AddressingModelPhysical32 = 1, AddressingModelPhysical64 = 2, + AddressingModelPhysicalStorageBuffer64 = 5348, AddressingModelPhysicalStorageBuffer64EXT = 5348, AddressingModelMax = 0x7fffffff, }; @@ -99,6 +100,7 @@ enum MemoryModel { MemoryModelSimple = 0, MemoryModelGLSL450 = 1, MemoryModelOpenCL = 2, + MemoryModelVulkan = 3, MemoryModelVulkanKHR = 3, MemoryModelMax = 0x7fffffff, }; @@ -154,6 +156,12 @@ enum ExecutionMode { ExecutionModeDerivativeGroupQuadsNV = 5289, ExecutionModeDerivativeGroupLinearNV = 5290, ExecutionModeOutputTrianglesNV = 5298, + ExecutionModePixelInterlockOrderedEXT = 5366, + ExecutionModePixelInterlockUnorderedEXT = 5367, + ExecutionModeSampleInterlockOrderedEXT = 5368, + ExecutionModeSampleInterlockUnorderedEXT = 5369, + ExecutionModeShadingRateInterlockOrderedEXT = 5370, + ExecutionModeShadingRateInterlockUnorderedEXT = 5371, ExecutionModeMax = 0x7fffffff, }; @@ -177,6 +185,7 @@ enum StorageClass { StorageClassHitAttributeNV = 5339, StorageClassIncomingRayPayloadNV = 5342, StorageClassShaderRecordBufferNV = 5343, + StorageClassPhysicalStorageBuffer = 5349, StorageClassPhysicalStorageBufferEXT = 5349, StorageClassMax = 0x7fffffff, }; @@ -305,9 +314,13 @@ enum ImageOperandsShift { ImageOperandsConstOffsetsShift = 5, ImageOperandsSampleShift = 6, ImageOperandsMinLodShift = 7, + ImageOperandsMakeTexelAvailableShift = 8, ImageOperandsMakeTexelAvailableKHRShift = 8, + ImageOperandsMakeTexelVisibleShift = 9, ImageOperandsMakeTexelVisibleKHRShift = 9, + ImageOperandsNonPrivateTexelShift = 10, ImageOperandsNonPrivateTexelKHRShift = 10, + ImageOperandsVolatileTexelShift = 11, ImageOperandsVolatileTexelKHRShift = 11, ImageOperandsSignExtendShift = 12, ImageOperandsZeroExtendShift = 13, @@ -324,9 +337,13 @@ enum ImageOperandsMask { ImageOperandsConstOffsetsMask = 0x00000020, ImageOperandsSampleMask = 0x00000040, ImageOperandsMinLodMask = 0x00000080, + ImageOperandsMakeTexelAvailableMask = 0x00000100, ImageOperandsMakeTexelAvailableKHRMask = 0x00000100, + ImageOperandsMakeTexelVisibleMask = 0x00000200, ImageOperandsMakeTexelVisibleKHRMask = 0x00000200, + ImageOperandsNonPrivateTexelMask = 0x00000400, ImageOperandsNonPrivateTexelKHRMask = 0x00000400, + ImageOperandsVolatileTexelMask = 0x00000800, ImageOperandsVolatileTexelKHRMask = 0x00000800, ImageOperandsSignExtendMask = 0x00001000, ImageOperandsZeroExtendMask = 0x00002000, @@ -442,13 +459,17 @@ enum Decoration { DecorationPerViewNV = 5272, DecorationPerTaskNV = 5273, DecorationPerVertexNV = 5285, + DecorationNonUniform = 5300, DecorationNonUniformEXT = 5300, + DecorationRestrictPointer = 5355, DecorationRestrictPointerEXT = 5355, + DecorationAliasedPointer = 5356, DecorationAliasedPointerEXT = 5356, DecorationCounterBuffer = 5634, DecorationHlslCounterBufferGOOGLE = 5634, DecorationHlslSemanticGOOGLE = 5635, DecorationUserSemantic = 5635, + DecorationUserTypeGOOGLE = 5636, DecorationMax = 0x7fffffff, }; @@ -551,6 +572,10 @@ enum BuiltIn { BuiltInHitTNV = 5332, BuiltInHitKindNV = 5333, BuiltInIncomingRayFlagsNV = 5351, + BuiltInWarpsPerSMNV = 5374, + BuiltInSMCountNV = 5375, + BuiltInWarpIDNV = 5376, + BuiltInSMIDNV = 5377, BuiltInMax = 0x7fffffff, }; @@ -619,9 +644,13 @@ enum MemorySemanticsShift { MemorySemanticsCrossWorkgroupMemoryShift = 9, MemorySemanticsAtomicCounterMemoryShift = 10, MemorySemanticsImageMemoryShift = 11, + MemorySemanticsOutputMemoryShift = 12, MemorySemanticsOutputMemoryKHRShift = 12, + MemorySemanticsMakeAvailableShift = 13, MemorySemanticsMakeAvailableKHRShift = 13, + MemorySemanticsMakeVisibleShift = 14, MemorySemanticsMakeVisibleKHRShift = 14, + MemorySemanticsVolatileShift = 15, MemorySemanticsMax = 0x7fffffff, }; @@ -637,17 +666,24 @@ enum MemorySemanticsMask { MemorySemanticsCrossWorkgroupMemoryMask = 0x00000200, MemorySemanticsAtomicCounterMemoryMask = 0x00000400, MemorySemanticsImageMemoryMask = 0x00000800, + MemorySemanticsOutputMemoryMask = 0x00001000, MemorySemanticsOutputMemoryKHRMask = 0x00001000, + MemorySemanticsMakeAvailableMask = 0x00002000, MemorySemanticsMakeAvailableKHRMask = 0x00002000, + MemorySemanticsMakeVisibleMask = 0x00004000, MemorySemanticsMakeVisibleKHRMask = 0x00004000, + MemorySemanticsVolatileMask = 0x00008000, }; enum MemoryAccessShift { MemoryAccessVolatileShift = 0, MemoryAccessAlignedShift = 1, MemoryAccessNontemporalShift = 2, + MemoryAccessMakePointerAvailableShift = 3, MemoryAccessMakePointerAvailableKHRShift = 3, + MemoryAccessMakePointerVisibleShift = 4, MemoryAccessMakePointerVisibleKHRShift = 4, + MemoryAccessNonPrivatePointerShift = 5, MemoryAccessNonPrivatePointerKHRShift = 5, MemoryAccessMax = 0x7fffffff, }; @@ -657,8 +693,11 @@ enum MemoryAccessMask { MemoryAccessVolatileMask = 0x00000001, MemoryAccessAlignedMask = 0x00000002, MemoryAccessNontemporalMask = 0x00000004, + MemoryAccessMakePointerAvailableMask = 0x00000008, MemoryAccessMakePointerAvailableKHRMask = 0x00000008, + MemoryAccessMakePointerVisibleMask = 0x00000010, MemoryAccessMakePointerVisibleKHRMask = 0x00000010, + MemoryAccessNonPrivatePointerMask = 0x00000020, MemoryAccessNonPrivatePointerKHRMask = 0x00000020, }; @@ -668,6 +707,7 @@ enum Scope { ScopeWorkgroup = 2, ScopeSubgroup = 3, ScopeInvocation = 4, + ScopeQueueFamily = 5, ScopeQueueFamilyKHR = 5, ScopeMax = 0x7fffffff, }; @@ -768,6 +808,8 @@ enum Capability { CapabilityGroupNonUniformShuffleRelative = 66, CapabilityGroupNonUniformClustered = 67, CapabilityGroupNonUniformQuad = 68, + CapabilityShaderLayer = 69, + CapabilityShaderViewportIndex = 70, CapabilitySubgroupBallotKHR = 4423, CapabilityDrawParameters = 4427, CapabilitySubgroupVoteKHR = 4431, @@ -796,6 +838,7 @@ enum Capability { CapabilityFragmentMaskAMD = 5010, CapabilityStencilExportEXT = 5013, CapabilityImageReadWriteLodAMD = 5015, + CapabilityShaderClockKHR = 5055, CapabilitySampleMaskOverrideCoverageNV = 5249, CapabilityGeometryShaderPassthroughNV = 5251, CapabilityShaderViewportIndexLayerEXT = 5254, @@ -811,28 +854,49 @@ enum Capability { CapabilityFragmentDensityEXT = 5291, CapabilityShadingRateNV = 5291, CapabilityGroupNonUniformPartitionedNV = 5297, + CapabilityShaderNonUniform = 5301, CapabilityShaderNonUniformEXT = 5301, + CapabilityRuntimeDescriptorArray = 5302, CapabilityRuntimeDescriptorArrayEXT = 5302, + CapabilityInputAttachmentArrayDynamicIndexing = 5303, CapabilityInputAttachmentArrayDynamicIndexingEXT = 5303, + CapabilityUniformTexelBufferArrayDynamicIndexing = 5304, CapabilityUniformTexelBufferArrayDynamicIndexingEXT = 5304, + CapabilityStorageTexelBufferArrayDynamicIndexing = 5305, CapabilityStorageTexelBufferArrayDynamicIndexingEXT = 5305, + CapabilityUniformBufferArrayNonUniformIndexing = 5306, CapabilityUniformBufferArrayNonUniformIndexingEXT = 5306, + CapabilitySampledImageArrayNonUniformIndexing = 5307, CapabilitySampledImageArrayNonUniformIndexingEXT = 5307, + CapabilityStorageBufferArrayNonUniformIndexing = 5308, CapabilityStorageBufferArrayNonUniformIndexingEXT = 5308, + CapabilityStorageImageArrayNonUniformIndexing = 5309, CapabilityStorageImageArrayNonUniformIndexingEXT = 5309, + CapabilityInputAttachmentArrayNonUniformIndexing = 5310, CapabilityInputAttachmentArrayNonUniformIndexingEXT = 5310, + CapabilityUniformTexelBufferArrayNonUniformIndexing = 5311, CapabilityUniformTexelBufferArrayNonUniformIndexingEXT = 5311, + CapabilityStorageTexelBufferArrayNonUniformIndexing = 5312, CapabilityStorageTexelBufferArrayNonUniformIndexingEXT = 5312, CapabilityRayTracingNV = 5340, + CapabilityVulkanMemoryModel = 5345, CapabilityVulkanMemoryModelKHR = 5345, + CapabilityVulkanMemoryModelDeviceScope = 5346, CapabilityVulkanMemoryModelDeviceScopeKHR = 5346, + CapabilityPhysicalStorageBufferAddresses = 5347, CapabilityPhysicalStorageBufferAddressesEXT = 5347, CapabilityComputeDerivativeGroupLinearNV = 5350, CapabilityCooperativeMatrixNV = 5357, + CapabilityFragmentShaderSampleInterlockEXT = 5363, + CapabilityFragmentShaderShadingRateInterlockEXT = 5372, + CapabilityShaderSMBuiltinsNV = 5373, + CapabilityFragmentShaderPixelInterlockEXT = 5378, + CapabilityDemoteToHelperInvocationEXT = 5379, CapabilitySubgroupShuffleINTEL = 5568, CapabilitySubgroupBufferBlockIOINTEL = 5569, CapabilitySubgroupImageBlockIOINTEL = 5570, CapabilitySubgroupImageMediaBlockIOINTEL = 5579, + CapabilityIntegerFunctions2INTEL = 5584, CapabilitySubgroupAvcMotionEstimationINTEL = 5696, CapabilitySubgroupAvcMotionEstimationIntraINTEL = 5697, CapabilitySubgroupAvcMotionEstimationChromaINTEL = 5698, @@ -1200,6 +1264,7 @@ enum Op { OpGroupSMaxNonUniformAMD = 5007, OpFragmentMaskFetchAMD = 5011, OpFragmentFetchAMD = 5012, + OpReadClockKHR = 5056, OpImageSampleFootprintNV = 5283, OpGroupNonUniformPartitionNV = 5296, OpWritePackedPrimitiveIndices4x8NV = 5299, @@ -1214,6 +1279,10 @@ enum Op { OpCooperativeMatrixStoreNV = 5360, OpCooperativeMatrixMulAddNV = 5361, OpCooperativeMatrixLengthNV = 5362, + OpBeginInvocationInterlockEXT = 5364, + OpEndInvocationInterlockEXT = 5365, + OpDemoteToHelperInvocationEXT = 5380, + OpIsHelperInvocationEXT = 5381, OpSubgroupShuffleINTEL = 5571, OpSubgroupShuffleDownINTEL = 5572, OpSubgroupShuffleUpINTEL = 5573, @@ -1224,6 +1293,20 @@ enum Op { OpSubgroupImageBlockWriteINTEL = 5578, OpSubgroupImageMediaBlockReadINTEL = 5580, OpSubgroupImageMediaBlockWriteINTEL = 5581, + OpUCountLeadingZerosINTEL = 5585, + OpUCountTrailingZerosINTEL = 5586, + OpAbsISubINTEL = 5587, + OpAbsUSubINTEL = 5588, + OpIAddSatINTEL = 5589, + OpUAddSatINTEL = 5590, + OpIAverageINTEL = 5591, + OpUAverageINTEL = 5592, + OpIAverageRoundedINTEL = 5593, + OpUAverageRoundedINTEL = 5594, + OpISubSatINTEL = 5595, + OpUSubSatINTEL = 5596, + OpIMul32x16INTEL = 5597, + OpUMul32x16INTEL = 5598, OpDecorateString = 5632, OpDecorateStringGOOGLE = 5632, OpMemberDecorateString = 5633, @@ -1714,6 +1797,7 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case OpGroupSMaxNonUniformAMD: *hasResult = true; *hasResultType = true; break; case OpFragmentMaskFetchAMD: *hasResult = true; *hasResultType = true; break; case OpFragmentFetchAMD: *hasResult = true; *hasResultType = true; break; + case OpReadClockKHR: *hasResult = true; *hasResultType = true; break; case OpImageSampleFootprintNV: *hasResult = true; *hasResultType = true; break; case OpGroupNonUniformPartitionNV: *hasResult = true; *hasResultType = true; break; case OpWritePackedPrimitiveIndices4x8NV: *hasResult = false; *hasResultType = false; break; @@ -1728,6 +1812,10 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case OpCooperativeMatrixStoreNV: *hasResult = false; *hasResultType = false; break; case OpCooperativeMatrixMulAddNV: *hasResult = true; *hasResultType = true; break; case OpCooperativeMatrixLengthNV: *hasResult = true; *hasResultType = true; break; + case OpBeginInvocationInterlockEXT: *hasResult = false; *hasResultType = false; break; + case OpEndInvocationInterlockEXT: *hasResult = false; *hasResultType = false; break; + case OpDemoteToHelperInvocationEXT: *hasResult = false; *hasResultType = false; break; + case OpIsHelperInvocationEXT: *hasResult = true; *hasResultType = true; break; case OpSubgroupShuffleINTEL: *hasResult = true; *hasResultType = true; break; case OpSubgroupShuffleDownINTEL: *hasResult = true; *hasResultType = true; break; case OpSubgroupShuffleUpINTEL: *hasResult = true; *hasResultType = true; break; @@ -1738,10 +1826,22 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case OpSubgroupImageBlockWriteINTEL: *hasResult = false; *hasResultType = false; break; case OpSubgroupImageMediaBlockReadINTEL: *hasResult = true; *hasResultType = true; break; case OpSubgroupImageMediaBlockWriteINTEL: *hasResult = false; *hasResultType = false; break; + case OpUCountLeadingZerosINTEL: *hasResult = true; *hasResultType = true; break; + case OpUCountTrailingZerosINTEL: *hasResult = true; *hasResultType = true; break; + case OpAbsISubINTEL: *hasResult = true; *hasResultType = true; break; + case OpAbsUSubINTEL: *hasResult = true; *hasResultType = true; break; + case OpIAddSatINTEL: *hasResult = true; *hasResultType = true; break; + case OpUAddSatINTEL: *hasResult = true; *hasResultType = true; break; + case OpIAverageINTEL: *hasResult = true; *hasResultType = true; break; + case OpUAverageINTEL: *hasResult = true; *hasResultType = true; break; + case OpIAverageRoundedINTEL: *hasResult = true; *hasResultType = true; break; + case OpUAverageRoundedINTEL: *hasResult = true; *hasResultType = true; break; + case OpISubSatINTEL: *hasResult = true; *hasResultType = true; break; + case OpUSubSatINTEL: *hasResult = true; *hasResultType = true; break; + case OpIMul32x16INTEL: *hasResult = true; *hasResultType = true; break; + case OpUMul32x16INTEL: *hasResult = true; *hasResultType = true; break; case OpDecorateString: *hasResult = false; *hasResultType = false; break; - case OpDecorateStringGOOGLE: *hasResult = false; *hasResultType = false; break; case OpMemberDecorateString: *hasResult = false; *hasResultType = false; break; - case OpMemberDecorateStringGOOGLE: *hasResult = false; *hasResultType = false; break; case OpVmeImageINTEL: *hasResult = true; *hasResultType = true; break; case OpTypeVmeImageINTEL: *hasResult = true; *hasResultType = false; break; case OpTypeAvcImePayloadINTEL: *hasResult = true; *hasResultType = false; break; diff --git a/thirdparty/glslang/SPIRV/spvIR.h b/thirdparty/glslang/SPIRV/spvIR.h index b3cd0b0613..cf6a71159a 100644..100755 --- a/thirdparty/glslang/SPIRV/spvIR.h +++ b/thirdparty/glslang/SPIRV/spvIR.h @@ -226,6 +226,36 @@ public: return nullptr; } + // Change this block into a canonical dead merge block. Delete instructions + // as necessary. A canonical dead merge block has only an OpLabel and an + // OpUnreachable. + void rewriteAsCanonicalUnreachableMerge() { + assert(localVariables.empty()); + // Delete all instructions except for the label. + assert(instructions.size() > 0); + instructions.resize(1); + successors.clear(); + Instruction* unreachable = new Instruction(OpUnreachable); + addInstruction(std::unique_ptr<Instruction>(unreachable)); + } + // Change this block into a canonical dead continue target branching to the + // given header ID. Delete instructions as necessary. A canonical dead continue + // target has only an OpLabel and an unconditional branch back to the corresponding + // header. + void rewriteAsCanonicalUnreachableContinue(Block* header) { + assert(localVariables.empty()); + // Delete all instructions except for the label. + assert(instructions.size() > 0); + instructions.resize(1); + successors.clear(); + // Add OpBranch back to the header. + assert(header != nullptr); + Instruction* branch = new Instruction(OpBranch); + branch->addIdOperand(header->getId()); + addInstruction(std::unique_ptr<Instruction>(branch)); + successors.push_back(header); + } + bool isTerminated() const { switch (instructions.back()->getOpCode()) { @@ -235,6 +265,7 @@ public: case OpKill: case OpReturn: case OpReturnValue: + case OpUnreachable: return true; default: return false; @@ -268,10 +299,24 @@ protected: bool unreachable; }; +// The different reasons for reaching a block in the inReadableOrder traversal. +enum ReachReason { + // Reachable from the entry block via transfers of control, i.e. branches. + ReachViaControlFlow = 0, + // A continue target that is not reachable via control flow. + ReachDeadContinue, + // A merge block that is not reachable via control flow. + ReachDeadMerge +}; + // Traverses the control-flow graph rooted at root in an order suited for // readable code generation. Invokes callback at every node in the traversal -// order. -void inReadableOrder(Block* root, std::function<void(Block*)> callback); +// order. The callback arguments are: +// - the block, +// - the reason we reached the block, +// - if the reason was that block is an unreachable continue or unreachable merge block +// then the last parameter is the corresponding header block. +void inReadableOrder(Block* root, std::function<void(Block*, ReachReason, Block* header)> callback); // // SPIR-V IR Function. @@ -321,7 +366,7 @@ public: parameterInstructions[p]->dump(out); // Blocks - inReadableOrder(blocks[0], [&out](const Block* b) { b->dump(out); }); + inReadableOrder(blocks[0], [&out](const Block* b, ReachReason, Block*) { b->dump(out); }); Instruction end(0, 0, OpFunctionEnd); end.dump(out); } @@ -436,6 +481,6 @@ __inline void Block::addInstruction(std::unique_ptr<Instruction> inst) parent.getParent().mapInstruction(raw_instruction); } -}; // end spv namespace +} // end spv namespace #endif // spvIR_H diff --git a/thirdparty/glslang/glslang/Include/BaseTypes.h b/thirdparty/glslang/glslang/Include/BaseTypes.h index 1827c49653..6d4b4ff8e3 100644 --- a/thirdparty/glslang/glslang/Include/BaseTypes.h +++ b/thirdparty/glslang/glslang/Include/BaseTypes.h @@ -61,11 +61,7 @@ enum TBasicType { EbtSampler, EbtStruct, EbtBlock, - -#ifdef NV_EXTENSIONS EbtAccStructNV, -#endif - EbtReference, // HLSL types that live only temporarily. @@ -94,13 +90,11 @@ enum TStorageQualifier { EvqBuffer, // read/write, shared with app EvqShared, // compute shader's read/write 'shared' qualifier -#ifdef NV_EXTENSIONS EvqPayloadNV, EvqPayloadInNV, EvqHitAttrNV, EvqCallableDataNV, EvqCallableDataInNV, -#endif // parameters EvqIn, // also, for 'in' in the grammar before we know if it's a pipeline input or an 'in' parameter @@ -221,7 +215,6 @@ enum TBuiltInVariable { EbvSampleMask, EbvHelperInvocation, -#ifdef AMD_EXTENSIONS EbvBaryCoordNoPersp, EbvBaryCoordNoPerspCentroid, EbvBaryCoordNoPerspSample, @@ -229,7 +222,6 @@ enum TBuiltInVariable { EbvBaryCoordSmoothCentroid, EbvBaryCoordSmoothSample, EbvBaryCoordPullModel, -#endif EbvViewIndex, EbvDeviceIndex, @@ -237,7 +229,6 @@ enum TBuiltInVariable { EbvFragSizeEXT, EbvFragInvocationCountEXT, -#ifdef NV_EXTENSIONS EbvViewportMaskNV, EbvSecondaryPositionNV, EbvSecondaryViewportMaskNV, @@ -246,7 +237,7 @@ enum TBuiltInVariable { EbvFragFullyCoveredNV, EbvFragmentSizeNV, EbvInvocationsPerPixelNV, - // raytracing + // ray tracing EbvLaunchIdNV, EbvLaunchSizeNV, EbvInstanceCustomIndexNV, @@ -261,8 +252,10 @@ enum TBuiltInVariable { EbvObjectToWorldNV, EbvWorldToObjectNV, EbvIncomingRayFlagsNV, + // barycentrics EbvBaryCoordNV, EbvBaryCoordNoPerspNV, + // mesh shaders EbvTaskCountNV, EbvPrimitiveCountNV, EbvPrimitiveIndicesNV, @@ -271,7 +264,12 @@ enum TBuiltInVariable { EbvLayerPerViewNV, EbvMeshViewCountNV, EbvMeshViewIndicesNV, -#endif + + // sm builtins + EbvWarpsPerSM, + EbvSMCount, + EbvWarpID, + EbvSMID, // HLSL built-ins that live only temporarily, until they get remapped // to one of the above. @@ -291,6 +289,19 @@ enum TBuiltInVariable { EbvLast }; +// In this enum, order matters; users can assume higher precision is a bigger value +// and EpqNone is 0. +enum TPrecisionQualifier { + EpqNone = 0, + EpqLow, + EpqMedium, + EpqHigh +}; + +#ifdef GLSLANG_WEB +__inline const char* GetStorageQualifierString(TStorageQualifier q) { return ""; } +__inline const char* GetPrecisionQualifierString(TPrecisionQualifier p) { return ""; } +#else // These will show up in error messages __inline const char* GetStorageQualifierString(TStorageQualifier q) { @@ -317,13 +328,11 @@ __inline const char* GetStorageQualifierString(TStorageQualifier q) case EvqPointCoord: return "gl_PointCoord"; break; case EvqFragColor: return "fragColor"; break; case EvqFragDepth: return "gl_FragDepth"; break; -#ifdef NV_EXTENSIONS case EvqPayloadNV: return "rayPayloadNV"; break; case EvqPayloadInNV: return "rayPayloadInNV"; break; case EvqHitAttrNV: return "hitAttributeNV"; break; case EvqCallableDataNV: return "callableDataNV"; break; case EvqCallableDataInNV: return "callableDataInNV"; break; -#endif default: return "unknown qualifier"; } } @@ -338,6 +347,8 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v) case EbvLocalInvocationId: return "LocalInvocationID"; case EbvGlobalInvocationId: return "GlobalInvocationID"; case EbvLocalInvocationIndex: return "LocalInvocationIndex"; + case EbvNumSubgroups: return "NumSubgroups"; + case EbvSubgroupID: return "SubgroupID"; case EbvSubGroupSize: return "SubGroupSize"; case EbvSubGroupInvocation: return "SubGroupInvocation"; case EbvSubGroupEqMask: return "SubGroupEqMask"; @@ -345,6 +356,13 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v) case EbvSubGroupGtMask: return "SubGroupGtMask"; case EbvSubGroupLeMask: return "SubGroupLeMask"; case EbvSubGroupLtMask: return "SubGroupLtMask"; + case EbvSubgroupSize2: return "SubgroupSize"; + case EbvSubgroupInvocation2: return "SubgroupInvocationID"; + case EbvSubgroupEqMask2: return "SubgroupEqMask"; + case EbvSubgroupGeMask2: return "SubgroupGeMask"; + case EbvSubgroupGtMask2: return "SubgroupGtMask"; + case EbvSubgroupLeMask2: return "SubgroupLeMask"; + case EbvSubgroupLtMask2: return "SubgroupLtMask"; case EbvVertexId: return "VertexId"; case EbvInstanceId: return "InstanceId"; case EbvVertexIndex: return "VertexIndex"; @@ -396,7 +414,6 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v) case EbvSampleMask: return "SampleMaskIn"; case EbvHelperInvocation: return "HelperInvocation"; -#ifdef AMD_EXTENSIONS case EbvBaryCoordNoPersp: return "BaryCoordNoPersp"; case EbvBaryCoordNoPerspCentroid: return "BaryCoordNoPerspCentroid"; case EbvBaryCoordNoPerspSample: return "BaryCoordNoPerspSample"; @@ -404,7 +421,6 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v) case EbvBaryCoordSmoothCentroid: return "BaryCoordSmoothCentroid"; case EbvBaryCoordSmoothSample: return "BaryCoordSmoothSample"; case EbvBaryCoordPullModel: return "BaryCoordPullModel"; -#endif case EbvViewIndex: return "ViewIndex"; case EbvDeviceIndex: return "DeviceIndex"; @@ -412,7 +428,6 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v) case EbvFragSizeEXT: return "FragSizeEXT"; case EbvFragInvocationCountEXT: return "FragInvocationCountEXT"; -#ifdef NV_EXTENSIONS case EbvViewportMaskNV: return "ViewportMaskNV"; case EbvSecondaryPositionNV: return "SecondaryPositionNV"; case EbvSecondaryViewportMaskNV: return "SecondaryViewportMaskNV"; @@ -438,6 +453,7 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v) case EbvBaryCoordNV: return "BaryCoordNV"; case EbvBaryCoordNoPerspNV: return "BaryCoordNoPerspNV"; + case EbvTaskCountNV: return "TaskCountNV"; case EbvPrimitiveCountNV: return "PrimitiveCountNV"; case EbvPrimitiveIndicesNV: return "PrimitiveIndicesNV"; @@ -446,20 +462,16 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v) case EbvLayerPerViewNV: return "LayerPerViewNV"; case EbvMeshViewCountNV: return "MeshViewCountNV"; case EbvMeshViewIndicesNV: return "MeshViewIndicesNV"; -#endif + + case EbvWarpsPerSM: return "WarpsPerSMNV"; + case EbvSMCount: return "SMCountNV"; + case EbvWarpID: return "WarpIDNV"; + case EbvSMID: return "SMIDNV"; + default: return "unknown built-in variable"; } } -// In this enum, order matters; users can assume higher precision is a bigger value -// and EpqNone is 0. -enum TPrecisionQualifier { - EpqNone = 0, - EpqLow, - EpqMedium, - EpqHigh -}; - __inline const char* GetPrecisionQualifierString(TPrecisionQualifier p) { switch (p) { @@ -470,6 +482,7 @@ __inline const char* GetPrecisionQualifierString(TPrecisionQualifier p) default: return "unknown precision qualifier"; } } +#endif __inline bool isTypeSignedInt(TBasicType type) { @@ -514,7 +527,8 @@ __inline bool isTypeFloat(TBasicType type) } } -__inline int getTypeRank(TBasicType type) { +__inline int getTypeRank(TBasicType type) +{ int res = -1; switch(type) { case EbtInt8: diff --git a/thirdparty/glslang/glslang/Include/Common.h b/thirdparty/glslang/glslang/Include/Common.h index a82c3af4dc..2c511bc1c5 100644 --- a/thirdparty/glslang/glslang/Include/Common.h +++ b/thirdparty/glslang/glslang/Include/Common.h @@ -51,7 +51,7 @@ std::string to_string(const T& val) { #endif // -- GODOT start -- -#if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/) /* || defined MINGW_HAS_SECURE_API*/ +#if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/) /* || defined MINGW_HAS_SECURE_API */ // -- GODOT end -- #include <basetsd.h> #ifndef snprintf diff --git a/thirdparty/glslang/glslang/Include/ConstantUnion.h b/thirdparty/glslang/glslang/Include/ConstantUnion.h index 3e93340151..76b2d9c08b 100644 --- a/thirdparty/glslang/glslang/Include/ConstantUnion.h +++ b/thirdparty/glslang/glslang/Include/ConstantUnion.h @@ -213,56 +213,59 @@ public: return false; switch (type) { - case EbtInt16: - if (constant.i16Const == i16Const) + case EbtInt: + if (constant.iConst == iConst) return true; break; - case EbtUint16: - if (constant.u16Const == u16Const) + case EbtUint: + if (constant.uConst == uConst) return true; break; - case EbtInt8: - if (constant.i8Const == i8Const) + case EbtBool: + if (constant.bConst == bConst) return true; break; - case EbtUint8: - if (constant.u8Const == u8Const) + case EbtDouble: + if (constant.dConst == dConst) return true; break; - case EbtInt: - if (constant.iConst == iConst) + +#ifndef GLSLANG_WEB + case EbtInt16: + if (constant.i16Const == i16Const) return true; break; - case EbtUint: - if (constant.uConst == uConst) + case EbtUint16: + if (constant.u16Const == u16Const) return true; break; - case EbtInt64: - if (constant.i64Const == i64Const) + case EbtInt8: + if (constant.i8Const == i8Const) return true; break; - case EbtUint64: - if (constant.u64Const == u64Const) + case EbtUint8: + if (constant.u8Const == u8Const) return true; break; - case EbtDouble: - if (constant.dConst == dConst) + case EbtInt64: + if (constant.i64Const == i64Const) return true; break; - case EbtBool: - if (constant.bConst == bConst) + case EbtUint64: + if (constant.u64Const == u64Const) return true; break; +#endif default: assert(false && "Default missing"); } @@ -329,6 +332,22 @@ public: { assert(type == constant.type); switch (type) { + case EbtInt: + if (iConst > constant.iConst) + return true; + + return false; + case EbtUint: + if (uConst > constant.uConst) + return true; + + return false; + case EbtDouble: + if (dConst > constant.dConst) + return true; + + return false; +#ifndef GLSLANG_WEB case EbtInt8: if (i8Const > constant.i8Const) return true; @@ -349,16 +368,6 @@ public: return true; return false; - case EbtInt: - if (iConst > constant.iConst) - return true; - - return false; - case EbtUint: - if (uConst > constant.uConst) - return true; - - return false; case EbtInt64: if (i64Const > constant.i64Const) return true; @@ -369,11 +378,7 @@ public: return true; return false; - case EbtDouble: - if (dConst > constant.dConst) - return true; - - return false; +#endif default: assert(false && "Default missing"); return false; @@ -384,6 +389,7 @@ public: { assert(type == constant.type); switch (type) { +#ifndef GLSLANG_WEB case EbtInt8: if (i8Const < constant.i8Const) return true; @@ -394,7 +400,7 @@ public: return true; return false; - case EbtInt16: + case EbtInt16: if (i16Const < constant.i16Const) return true; @@ -402,17 +408,6 @@ public: case EbtUint16: if (u16Const < constant.u16Const) return true; - - return false; - case EbtInt: - if (iConst < constant.iConst) - return true; - - return false; - case EbtUint: - if (uConst < constant.uConst) - return true; - return false; case EbtInt64: if (i64Const < constant.i64Const) @@ -424,11 +419,22 @@ public: return true; return false; +#endif case EbtDouble: if (dConst < constant.dConst) return true; return false; + case EbtInt: + if (iConst < constant.iConst) + return true; + + return false; + case EbtUint: + if (uConst < constant.uConst) + return true; + + return false; default: assert(false && "Default missing"); return false; @@ -440,15 +446,17 @@ public: TConstUnion returnValue; assert(type == constant.type); switch (type) { + case EbtInt: returnValue.setIConst(iConst + constant.iConst); break; + case EbtUint: returnValue.setUConst(uConst + constant.uConst); break; + case EbtDouble: returnValue.setDConst(dConst + constant.dConst); break; +#ifndef GLSLANG_WEB case EbtInt8: returnValue.setI8Const(i8Const + constant.i8Const); break; case EbtInt16: returnValue.setI16Const(i16Const + constant.i16Const); break; - case EbtInt: returnValue.setIConst(iConst + constant.iConst); break; case EbtInt64: returnValue.setI64Const(i64Const + constant.i64Const); break; case EbtUint8: returnValue.setU8Const(u8Const + constant.u8Const); break; case EbtUint16: returnValue.setU16Const(u16Const + constant.u16Const); break; - case EbtUint: returnValue.setUConst(uConst + constant.uConst); break; case EbtUint64: returnValue.setU64Const(u64Const + constant.u64Const); break; - case EbtDouble: returnValue.setDConst(dConst + constant.dConst); break; +#endif default: assert(false && "Default missing"); } @@ -460,15 +468,17 @@ public: TConstUnion returnValue; assert(type == constant.type); switch (type) { + case EbtInt: returnValue.setIConst(iConst - constant.iConst); break; + case EbtUint: returnValue.setUConst(uConst - constant.uConst); break; + case EbtDouble: returnValue.setDConst(dConst - constant.dConst); break; +#ifndef GLSLANG_WEB case EbtInt8: returnValue.setI8Const(i8Const - constant.i8Const); break; case EbtInt16: returnValue.setI16Const(i16Const - constant.i16Const); break; - case EbtInt: returnValue.setIConst(iConst - constant.iConst); break; case EbtInt64: returnValue.setI64Const(i64Const - constant.i64Const); break; case EbtUint8: returnValue.setU8Const(u8Const - constant.u8Const); break; case EbtUint16: returnValue.setU16Const(u16Const - constant.u16Const); break; - case EbtUint: returnValue.setUConst(uConst - constant.uConst); break; case EbtUint64: returnValue.setU64Const(u64Const - constant.u64Const); break; - case EbtDouble: returnValue.setDConst(dConst - constant.dConst); break; +#endif default: assert(false && "Default missing"); } @@ -480,15 +490,17 @@ public: TConstUnion returnValue; assert(type == constant.type); switch (type) { + case EbtInt: returnValue.setIConst(iConst * constant.iConst); break; + case EbtUint: returnValue.setUConst(uConst * constant.uConst); break; + case EbtDouble: returnValue.setDConst(dConst * constant.dConst); break; +#ifndef GLSLANG_WEB case EbtInt8: returnValue.setI8Const(i8Const * constant.i8Const); break; case EbtInt16: returnValue.setI16Const(i16Const * constant.i16Const); break; - case EbtInt: returnValue.setIConst(iConst * constant.iConst); break; case EbtInt64: returnValue.setI64Const(i64Const * constant.i64Const); break; case EbtUint8: returnValue.setU8Const(u8Const * constant.u8Const); break; case EbtUint16: returnValue.setU16Const(u16Const * constant.u16Const); break; - case EbtUint: returnValue.setUConst(uConst * constant.uConst); break; case EbtUint64: returnValue.setU64Const(u64Const * constant.u64Const); break; - case EbtDouble: returnValue.setDConst(dConst * constant.dConst); break; +#endif default: assert(false && "Default missing"); } @@ -500,14 +512,16 @@ public: TConstUnion returnValue; assert(type == constant.type); switch (type) { + case EbtInt: returnValue.setIConst(iConst % constant.iConst); break; + case EbtUint: returnValue.setUConst(uConst % constant.uConst); break; +#ifndef GLSLANG_WEB case EbtInt8: returnValue.setI8Const(i8Const % constant.i8Const); break; case EbtInt16: returnValue.setI8Const(i8Const % constant.i16Const); break; - case EbtInt: returnValue.setIConst(iConst % constant.iConst); break; case EbtInt64: returnValue.setI64Const(i64Const % constant.i64Const); break; case EbtUint8: returnValue.setU8Const(u8Const % constant.u8Const); break; case EbtUint16: returnValue.setU16Const(u16Const % constant.u16Const); break; - case EbtUint: returnValue.setUConst(uConst % constant.uConst); break; case EbtUint64: returnValue.setU64Const(u64Const % constant.u64Const); break; +#endif default: assert(false && "Default missing"); } @@ -518,6 +532,7 @@ public: { TConstUnion returnValue; switch (type) { +#ifndef GLSLANG_WEB case EbtInt8: switch (constant.type) { case EbtInt8: returnValue.setI8Const(i8Const >> constant.i8Const); break; @@ -570,32 +585,38 @@ public: default: assert(false && "Default missing"); } break; +#endif case EbtInt: switch (constant.type) { + case EbtInt: returnValue.setIConst(iConst >> constant.iConst); break; + case EbtUint: returnValue.setIConst(iConst >> constant.uConst); break; +#ifndef GLSLANG_WEB case EbtInt8: returnValue.setIConst(iConst >> constant.i8Const); break; case EbtUint8: returnValue.setIConst(iConst >> constant.u8Const); break; case EbtInt16: returnValue.setIConst(iConst >> constant.i16Const); break; case EbtUint16: returnValue.setIConst(iConst >> constant.u16Const); break; - case EbtInt: returnValue.setIConst(iConst >> constant.iConst); break; - case EbtUint: returnValue.setIConst(iConst >> constant.uConst); break; case EbtInt64: returnValue.setIConst(iConst >> constant.i64Const); break; case EbtUint64: returnValue.setIConst(iConst >> constant.u64Const); break; +#endif default: assert(false && "Default missing"); } break; case EbtUint: switch (constant.type) { + case EbtInt: returnValue.setUConst(uConst >> constant.iConst); break; + case EbtUint: returnValue.setUConst(uConst >> constant.uConst); break; +#ifndef GLSLANG_WEB case EbtInt8: returnValue.setUConst(uConst >> constant.i8Const); break; case EbtUint8: returnValue.setUConst(uConst >> constant.u8Const); break; case EbtInt16: returnValue.setUConst(uConst >> constant.i16Const); break; case EbtUint16: returnValue.setUConst(uConst >> constant.u16Const); break; - case EbtInt: returnValue.setUConst(uConst >> constant.iConst); break; - case EbtUint: returnValue.setUConst(uConst >> constant.uConst); break; case EbtInt64: returnValue.setUConst(uConst >> constant.i64Const); break; case EbtUint64: returnValue.setUConst(uConst >> constant.u64Const); break; +#endif default: assert(false && "Default missing"); } break; +#ifndef GLSLANG_WEB case EbtInt64: switch (constant.type) { case EbtInt8: returnValue.setI64Const(i64Const >> constant.i8Const); break; @@ -622,6 +643,7 @@ public: default: assert(false && "Default missing"); } break; +#endif default: assert(false && "Default missing"); } @@ -632,6 +654,7 @@ public: { TConstUnion returnValue; switch (type) { +#ifndef GLSLANG_WEB case EbtInt8: switch (constant.type) { case EbtInt8: returnValue.setI8Const(i8Const << constant.i8Const); break; @@ -684,32 +707,6 @@ public: default: assert(false && "Default missing"); } break; - case EbtInt: - switch (constant.type) { - case EbtInt8: returnValue.setIConst(iConst << constant.i8Const); break; - case EbtUint8: returnValue.setIConst(iConst << constant.u8Const); break; - case EbtInt16: returnValue.setIConst(iConst << constant.i16Const); break; - case EbtUint16: returnValue.setIConst(iConst << constant.u16Const); break; - case EbtInt: returnValue.setIConst(iConst << constant.iConst); break; - case EbtUint: returnValue.setIConst(iConst << constant.uConst); break; - case EbtInt64: returnValue.setIConst(iConst << constant.i64Const); break; - case EbtUint64: returnValue.setIConst(iConst << constant.u64Const); break; - default: assert(false && "Default missing"); - } - break; - case EbtUint: - switch (constant.type) { - case EbtInt8: returnValue.setUConst(uConst << constant.i8Const); break; - case EbtUint8: returnValue.setUConst(uConst << constant.u8Const); break; - case EbtInt16: returnValue.setUConst(uConst << constant.i16Const); break; - case EbtUint16: returnValue.setUConst(uConst << constant.u16Const); break; - case EbtInt: returnValue.setUConst(uConst << constant.iConst); break; - case EbtUint: returnValue.setUConst(uConst << constant.uConst); break; - case EbtInt64: returnValue.setUConst(uConst << constant.i64Const); break; - case EbtUint64: returnValue.setUConst(uConst << constant.u64Const); break; - default: assert(false && "Default missing"); - } - break; case EbtInt64: switch (constant.type) { case EbtInt8: returnValue.setI64Const(i64Const << constant.i8Const); break; @@ -736,6 +733,37 @@ public: default: assert(false && "Default missing"); } break; +#endif + case EbtInt: + switch (constant.type) { + case EbtInt: returnValue.setIConst(iConst << constant.iConst); break; + case EbtUint: returnValue.setIConst(iConst << constant.uConst); break; +#ifndef GLSLANG_WEB + case EbtInt8: returnValue.setIConst(iConst << constant.i8Const); break; + case EbtUint8: returnValue.setIConst(iConst << constant.u8Const); break; + case EbtInt16: returnValue.setIConst(iConst << constant.i16Const); break; + case EbtUint16: returnValue.setIConst(iConst << constant.u16Const); break; + case EbtInt64: returnValue.setIConst(iConst << constant.i64Const); break; + case EbtUint64: returnValue.setIConst(iConst << constant.u64Const); break; +#endif + default: assert(false && "Default missing"); + } + break; + case EbtUint: + switch (constant.type) { + case EbtInt: returnValue.setUConst(uConst << constant.iConst); break; + case EbtUint: returnValue.setUConst(uConst << constant.uConst); break; +#ifndef GLSLANG_WEB + case EbtInt8: returnValue.setUConst(uConst << constant.i8Const); break; + case EbtUint8: returnValue.setUConst(uConst << constant.u8Const); break; + case EbtInt16: returnValue.setUConst(uConst << constant.i16Const); break; + case EbtUint16: returnValue.setUConst(uConst << constant.u16Const); break; + case EbtInt64: returnValue.setUConst(uConst << constant.i64Const); break; + case EbtUint64: returnValue.setUConst(uConst << constant.u64Const); break; +#endif + default: assert(false && "Default missing"); + } + break; default: assert(false && "Default missing"); } @@ -747,14 +775,16 @@ public: TConstUnion returnValue; assert(type == constant.type); switch (type) { + case EbtInt: returnValue.setIConst(iConst & constant.iConst); break; + case EbtUint: returnValue.setUConst(uConst & constant.uConst); break; +#ifndef GLSLANG_WEB case EbtInt8: returnValue.setI8Const(i8Const & constant.i8Const); break; case EbtUint8: returnValue.setU8Const(u8Const & constant.u8Const); break; case EbtInt16: returnValue.setI16Const(i16Const & constant.i16Const); break; case EbtUint16: returnValue.setU16Const(u16Const & constant.u16Const); break; - case EbtInt: returnValue.setIConst(iConst & constant.iConst); break; - case EbtUint: returnValue.setUConst(uConst & constant.uConst); break; case EbtInt64: returnValue.setI64Const(i64Const & constant.i64Const); break; case EbtUint64: returnValue.setU64Const(u64Const & constant.u64Const); break; +#endif default: assert(false && "Default missing"); } @@ -766,14 +796,16 @@ public: TConstUnion returnValue; assert(type == constant.type); switch (type) { + case EbtInt: returnValue.setIConst(iConst | constant.iConst); break; + case EbtUint: returnValue.setUConst(uConst | constant.uConst); break; +#ifndef GLSLANG_WEB case EbtInt8: returnValue.setI8Const(i8Const | constant.i8Const); break; case EbtUint8: returnValue.setU8Const(u8Const | constant.u8Const); break; case EbtInt16: returnValue.setI16Const(i16Const | constant.i16Const); break; case EbtUint16: returnValue.setU16Const(u16Const | constant.u16Const); break; - case EbtInt: returnValue.setIConst(iConst | constant.iConst); break; - case EbtUint: returnValue.setUConst(uConst | constant.uConst); break; case EbtInt64: returnValue.setI64Const(i64Const | constant.i64Const); break; case EbtUint64: returnValue.setU64Const(u64Const | constant.u64Const); break; +#endif default: assert(false && "Default missing"); } @@ -785,14 +817,16 @@ public: TConstUnion returnValue; assert(type == constant.type); switch (type) { + case EbtInt: returnValue.setIConst(iConst ^ constant.iConst); break; + case EbtUint: returnValue.setUConst(uConst ^ constant.uConst); break; +#ifndef GLSLANG_WEB case EbtInt8: returnValue.setI8Const(i8Const ^ constant.i8Const); break; case EbtUint8: returnValue.setU8Const(u8Const ^ constant.u8Const); break; case EbtInt16: returnValue.setI16Const(i16Const ^ constant.i16Const); break; case EbtUint16: returnValue.setU16Const(u16Const ^ constant.u16Const); break; - case EbtInt: returnValue.setIConst(iConst ^ constant.iConst); break; - case EbtUint: returnValue.setUConst(uConst ^ constant.uConst); break; case EbtInt64: returnValue.setI64Const(i64Const ^ constant.i64Const); break; case EbtUint64: returnValue.setU64Const(u64Const ^ constant.u64Const); break; +#endif default: assert(false && "Default missing"); } @@ -803,14 +837,16 @@ public: { TConstUnion returnValue; switch (type) { + case EbtInt: returnValue.setIConst(~iConst); break; + case EbtUint: returnValue.setUConst(~uConst); break; +#ifndef GLSLANG_WEB case EbtInt8: returnValue.setI8Const(~i8Const); break; case EbtUint8: returnValue.setU8Const(~u8Const); break; case EbtInt16: returnValue.setI16Const(~i16Const); break; case EbtUint16: returnValue.setU16Const(~u16Const); break; - case EbtInt: returnValue.setIConst(~iConst); break; - case EbtUint: returnValue.setUConst(~uConst); break; case EbtInt64: returnValue.setI64Const(~i64Const); break; case EbtUint64: returnValue.setU64Const(~u64Const); break; +#endif default: assert(false && "Default missing"); } diff --git a/thirdparty/glslang/glslang/Include/PoolAlloc.h b/thirdparty/glslang/glslang/Include/PoolAlloc.h index 0e237a6a2c..b8eccb8832 100644 --- a/thirdparty/glslang/glslang/Include/PoolAlloc.h +++ b/thirdparty/glslang/glslang/Include/PoolAlloc.h @@ -304,7 +304,6 @@ public: size_type max_size() const { return static_cast<size_type>(-1) / sizeof(T); } size_type max_size(int size) const { return static_cast<size_type>(-1) / size; } - void setAllocator(TPoolAllocator* a) { allocator = *a; } TPoolAllocator& getAllocator() const { return allocator; } protected: diff --git a/thirdparty/glslang/glslang/Include/Types.h b/thirdparty/glslang/glslang/Include/Types.h index 90341dcb27..3572099e3d 100644 --- a/thirdparty/glslang/glslang/Include/Types.h +++ b/thirdparty/glslang/glslang/Include/Types.h @@ -80,31 +80,59 @@ struct TSampler { // misnomer now; includes images, textures without sampler, bool image : 1; // image, combined should be false bool combined : 1; // true means texture is combined with a sampler, false means texture with no sampler bool sampler : 1; // true means a pure sampler, other fields should be clear() - bool external : 1; // GL_OES_EGL_image_external - bool yuv : 1; // GL_EXT_YUV_target - unsigned int vectorSize : 3; // vector return type size. +#ifdef GLSLANG_WEB + bool is1D() const { return false; } + bool isBuffer() const { return false; } + bool isRect() const { return false; } + bool isSubpass() const { return false; } + bool isCombined() const { return true; } + bool isImage() const { return false; } + bool isImageClass() const { return false; } + bool isMultiSample() const { return false; } + bool isExternal() const { return false; } + void setExternal(bool e) { } + bool isYuv() const { return false; } +#else + unsigned int vectorSize : 3; // vector return type size. // Some languages support structures as sample results. Storing the whole structure in the // TSampler is too large, so there is an index to a separate table. static const unsigned structReturnIndexBits = 4; // number of index bits to use. static const unsigned structReturnSlots = (1<<structReturnIndexBits)-1; // number of valid values static const unsigned noReturnStruct = structReturnSlots; // value if no return struct type. - // Index into a language specific table of texture return structures. unsigned int structReturnIndex : structReturnIndexBits; - // Encapsulate getting members' vector sizes packed into the vectorSize bitfield. + bool external : 1; // GL_OES_EGL_image_external + bool yuv : 1; // GL_EXT_YUV_target + +#ifdef ENABLE_HLSL unsigned int getVectorSize() const { return vectorSize; } + void clearReturnStruct() { structReturnIndex = noReturnStruct; } + bool hasReturnStruct() const { return structReturnIndex != noReturnStruct; } + unsigned getStructReturnIndex() const { return structReturnIndex; } +#endif - bool isImage() const { return image && dim != EsdSubpass; } + bool is1D() const { return dim == Esd1D; } + bool isBuffer() const { return dim == EsdBuffer; } + bool isRect() const { return dim == EsdRect; } bool isSubpass() const { return dim == EsdSubpass; } bool isCombined() const { return combined; } - bool isPureSampler() const { return sampler; } + bool isImage() const { return image && !isSubpass(); } + bool isImageClass() const { return image; } + bool isMultiSample() const { return ms; } + bool isExternal() const { return external; } + void setExternal(bool e) { external = e; } + bool isYuv() const { return yuv; } +#endif bool isTexture() const { return !sampler && !image; } + bool isPureSampler() const { return sampler; } + + void setCombined(bool c) { combined = c; } + void setBasicType(TBasicType t) { type = t; } + TBasicType getBasicType() const { return type; } bool isShadow() const { return shadow; } bool isArrayed() const { return arrayed; } - bool isMultiSample() const { return ms; } - bool hasReturnStruct() const { return structReturnIndex != noReturnStruct; } void clear() { @@ -116,12 +144,16 @@ struct TSampler { // misnomer now; includes images, textures without sampler, image = false; combined = false; sampler = false; +#ifndef GLSLANG_WEB external = false; yuv = false; - structReturnIndex = noReturnStruct; +#endif +#ifdef ENABLE_HLSL + clearReturnStruct(); // by default, returns a single vec4; vectorSize = 4; +#endif } // make a combined sampler and texture @@ -159,6 +191,15 @@ struct TSampler { // misnomer now; includes images, textures without sampler, ms = m; } + // make a pure sampler, no texture, no image, nothing combined, the 'sampler' keyword + void setPureSampler(bool s) + { + clear(); + sampler = true; + shadow = s; + } + +#ifndef GLSLANG_WEB // make a subpass input attachment void setSubpass(TBasicType t, bool m = false) { @@ -168,14 +209,7 @@ struct TSampler { // misnomer now; includes images, textures without sampler, dim = EsdSubpass; ms = m; } - - // make a pure sampler, no texture, no image, nothing combined, the 'sampler' keyword - void setPureSampler(bool s) - { - clear(); - sampler = true; - shadow = s; - } +#endif bool operator==(const TSampler& right) const { @@ -183,14 +217,17 @@ struct TSampler { // misnomer now; includes images, textures without sampler, dim == right.dim && arrayed == right.arrayed && shadow == right.shadow && - ms == right.ms && - image == right.image && - combined == right.combined && - sampler == right.sampler && - external == right.external && - yuv == right.yuv && - vectorSize == right.vectorSize && - structReturnIndex == right.structReturnIndex; + isMultiSample() == right.isMultiSample() && + isImageClass() == right.isImageClass() && + isCombined() == right.isCombined() && + isPureSampler() == right.isPureSampler() && + isExternal() == right.isExternal() && + isYuv() == right.isYuv() +#ifdef ENABLE_HLSL + && getVectorSize() == right.getVectorSize() && + getStructReturnIndex() == right.getStructReturnIndex() +#endif + ; } bool operator!=(const TSampler& right) const @@ -202,54 +239,55 @@ struct TSampler { // misnomer now; includes images, textures without sampler, { TString s; - if (sampler) { + if (isPureSampler()) { s.append("sampler"); return s; } switch (type) { - case EbtFloat: break; -#ifdef AMD_EXTENSIONS + case EbtInt: s.append("i"); break; + case EbtUint: s.append("u"); break; +#ifndef GLSLANG_WEB case EbtFloat16: s.append("f16"); break; -#endif case EbtInt8: s.append("i8"); break; case EbtUint16: s.append("u8"); break; case EbtInt16: s.append("i16"); break; case EbtUint8: s.append("u16"); break; - case EbtInt: s.append("i"); break; - case EbtUint: s.append("u"); break; case EbtInt64: s.append("i64"); break; case EbtUint64: s.append("u64"); break; - default: break; // some compilers want this +#endif + default: break; } - if (image) { - if (dim == EsdSubpass) + if (isImageClass()) { + if (isSubpass()) s.append("subpass"); else s.append("image"); - } else if (combined) { + } else if (isCombined()) { s.append("sampler"); } else { s.append("texture"); } - if (external) { + if (isExternal()) { s.append("ExternalOES"); return s; } - if (yuv) { + if (isYuv()) { return "__" + s + "External2DY2YEXT"; } switch (dim) { - case Esd1D: s.append("1D"); break; case Esd2D: s.append("2D"); break; case Esd3D: s.append("3D"); break; case EsdCube: s.append("Cube"); break; +#ifndef GLSLANG_WEB + case Esd1D: s.append("1D"); break; case EsdRect: s.append("2DRect"); break; case EsdBuffer: s.append("Buffer"); break; case EsdSubpass: s.append("Input"); break; +#endif default: break; // some compilers want this } - if (ms) + if (isMultiSample()) s.append("MS"); if (arrayed) s.append("Array"); @@ -422,6 +460,18 @@ enum TBlendEquationShift { EBlendCount }; +enum TInterlockOrdering { + EioNone, + EioPixelInterlockOrdered, + EioPixelInterlockUnordered, + EioSampleInterlockOrdered, + EioSampleInterlockUnordered, + EioShadingRateInterlockOrdered, + EioShadingRateInterlockUnordered, + + EioCount, +}; + class TQualifier { public: static const int layoutNotSet = -1; @@ -430,9 +480,11 @@ public: { precision = EpqNone; invariant = false; - noContraction = false; makeTemporary(); declaredBuiltIn = EbvNone; +#ifndef GLSLANG_WEB + noContraction = false; +#endif } // drop qualifiers that don't belong in a temporary variable @@ -451,8 +503,10 @@ public: void clearInterstage() { clearInterpolation(); +#ifndef GLSLANG_WEB patch = false; sample = false; +#endif } void clearInterpolation() @@ -460,11 +514,9 @@ public: centroid = false; smooth = false; flat = false; +#ifndef GLSLANG_WEB nopersp = false; -#ifdef AMD_EXTENSIONS explicitInterp = false; -#endif -#ifdef NV_EXTENSIONS pervertexNV = false; perPrimitiveNV = false; perViewNV = false; @@ -474,6 +526,7 @@ public: void clearMemory() { +#ifndef GLSLANG_WEB coherent = false; devicecoherent = false; queuefamilycoherent = false; @@ -484,57 +537,66 @@ public: restrict = false; readonly = false; writeonly = false; - } - - // Drop just the storage qualification, which perhaps should - // never be done, as it is fundamentally inconsistent, but need to - // explore what downstream consumers need. - // E.g., in a dereference, it is an inconsistency between: - // A) partially dereferenced resource is still in the storage class it started in - // B) partially dereferenced resource is a new temporary object - // If A, then nothing should change, if B, then everything should change, but this is half way. - void makePartialTemporary() - { - storage = EvqTemporary; - specConstant = false; - nonUniform = false; +#endif } const char* semanticName; TStorageQualifier storage : 6; - TBuiltInVariable builtIn : 8; - TBuiltInVariable declaredBuiltIn : 8; + TBuiltInVariable builtIn : 9; + TBuiltInVariable declaredBuiltIn : 9; + static_assert(EbvLast < 256, "need to increase size of TBuiltInVariable bitfields!"); TPrecisionQualifier precision : 3; bool invariant : 1; // require canonical treatment for cross-shader invariance - bool noContraction: 1; // prevent contraction and reassociation, e.g., for 'precise' keyword, and expressions it affects bool centroid : 1; bool smooth : 1; bool flat : 1; + // having a constant_id is not sufficient: expressions have no id, but are still specConstant + bool specConstant : 1; + bool nonUniform : 1; + +#ifdef GLSLANG_WEB + bool isWriteOnly() const { return false; } + bool isReadOnly() const { return false; } + bool isRestrict() const { return false; } + bool isCoherent() const { return false; } + bool isVolatile() const { return false; } + bool isSample() const { return false; } + bool isMemory() const { return false; } + bool isMemoryQualifierImageAndSSBOOnly() const { return false; } + bool bufferReferenceNeedsVulkanMemoryModel() const { return false; } + bool isInterpolation() const { return flat || smooth; } + bool isExplicitInterpolation() const { return false; } + bool isAuxiliary() const { return centroid; } + bool isPatch() const { return false; } + bool isNoContraction() const { return false; } + void setNoContraction() { } + bool isPervertexNV() const { return false; } +#else + bool noContraction: 1; // prevent contraction and reassociation, e.g., for 'precise' keyword, and expressions it affects bool nopersp : 1; -#ifdef AMD_EXTENSIONS bool explicitInterp : 1; -#endif -#ifdef NV_EXTENSIONS bool pervertexNV : 1; bool perPrimitiveNV : 1; bool perViewNV : 1; bool perTaskNV : 1; -#endif bool patch : 1; bool sample : 1; + bool restrict : 1; + bool readonly : 1; + bool writeonly : 1; bool coherent : 1; + bool volatil : 1; bool devicecoherent : 1; bool queuefamilycoherent : 1; bool workgroupcoherent : 1; bool subgroupcoherent : 1; bool nonprivate : 1; - bool volatil : 1; - bool restrict : 1; - bool readonly : 1; - bool writeonly : 1; - bool specConstant : 1; // having a constant_id is not sufficient: expressions have no id, but are still specConstant - bool nonUniform : 1; - + bool isWriteOnly() const { return writeonly; } + bool isReadOnly() const { return readonly; } + bool isRestrict() const { return restrict; } + bool isCoherent() const { return coherent; } + bool isVolatile() const { return volatil; } + bool isSample() const { return sample; } bool isMemory() const { return subgroupcoherent || workgroupcoherent || queuefamilycoherent || devicecoherent || coherent || volatil || restrict || readonly || writeonly || nonprivate; @@ -548,31 +610,23 @@ public: // include qualifiers that map to load/store availability/visibility/nonprivate memory access operands return subgroupcoherent || workgroupcoherent || queuefamilycoherent || devicecoherent || coherent || nonprivate; } - bool isInterpolation() const { -#ifdef AMD_EXTENSIONS return flat || smooth || nopersp || explicitInterp; -#else - return flat || smooth || nopersp; -#endif } - -#ifdef AMD_EXTENSIONS bool isExplicitInterpolation() const { return explicitInterp; } -#endif - bool isAuxiliary() const { -#ifdef NV_EXTENSIONS return centroid || patch || sample || pervertexNV; -#else - return centroid || patch || sample; -#endif } + bool isPatch() const { return patch; } + bool isNoContraction() const { return noContraction; } + void setNoContraction() { noContraction = true; } + bool isPervertexNV() const { return pervertexNV; } +#endif bool isPipeInput() const { @@ -638,33 +692,6 @@ public: } } - bool isPerPrimitive() const - { -#ifdef NV_EXTENSIONS - return perPrimitiveNV; -#else - return false; -#endif - } - - bool isPerView() const - { -#ifdef NV_EXTENSIONS - return perViewNV; -#else - return false; -#endif - } - - bool isTaskMemory() const - { -#ifdef NV_EXTENSIONS - return perTaskNV; -#else - return false; -#endif - } - bool isIo() const { switch (storage) { @@ -704,6 +731,15 @@ public: } } +#ifdef GLSLANG_WEB + bool isPerView() const { return false; } + bool isTaskMemory() const { return false; } + bool isArrayedIo(EShLanguage language) const { return false; } +#else + bool isPerPrimitive() const { return perPrimitiveNV; } + bool isPerView() const { return perViewNV; } + bool isTaskMemory() const { return perTaskNV; } + // True if this type of IO is supposed to be arrayed with extra level for per-vertex data bool isArrayedIo(EShLanguage language) const { @@ -714,49 +750,50 @@ public: return ! patch && (isPipeInput() || isPipeOutput()); case EShLangTessEvaluation: return ! patch && isPipeInput(); -#ifdef NV_EXTENSIONS case EShLangFragment: return pervertexNV && isPipeInput(); case EShLangMeshNV: return ! perTaskNV && isPipeOutput(); -#endif default: return false; } } +#endif // Implementing an embedded layout-qualifier class here, since C++ can't have a real class bitfield void clearLayout() // all layout { clearUniformLayout(); +#ifndef GLSLANG_WEB layoutPushConstant = false; layoutBufferReference = false; -#ifdef NV_EXTENSIONS layoutPassthrough = false; layoutViewportRelative = false; // -2048 as the default value indicating layoutSecondaryViewportRelative is not set layoutSecondaryViewportRelativeOffset = -2048; layoutShaderRecordNV = false; -#endif - layoutBufferReferenceAlign = layoutBufferReferenceAlignEnd; + layoutFormat = ElfNone; +#endif clearInterstageLayout(); layoutSpecConstantId = layoutSpecConstantIdEnd; - - layoutFormat = ElfNone; } void clearInterstageLayout() { layoutLocation = layoutLocationEnd; layoutComponent = layoutComponentEnd; +#ifndef GLSLANG_WEB layoutIndex = layoutIndexEnd; clearStreamLayout(); clearXfbLayout(); +#endif } + +#ifndef GLSLANG_WEB void clearStreamLayout() { layoutStream = layoutStreamEnd; @@ -767,6 +804,7 @@ public: layoutXfbStride = layoutXfbStrideEnd; layoutXfbOffset = layoutXfbOffsetEnd; } +#endif bool hasNonXfbLayout() const { @@ -774,11 +812,9 @@ public: hasAnyLocation() || hasStream() || hasFormat() || -#ifdef NV_EXTENSIONS - layoutShaderRecordNV || -#endif - layoutPushConstant || - layoutBufferReference; + isShaderRecordNV() || + isPushConstant() || + hasBufferReference(); } bool hasLayout() const { @@ -823,6 +859,7 @@ public: unsigned int layoutSpecConstantId : 11; static const unsigned int layoutSpecConstantIdEnd = 0x7FF; +#ifndef GLSLANG_WEB // stored as log2 of the actual alignment value unsigned int layoutBufferReferenceAlign : 6; static const unsigned int layoutBufferReferenceAlignEnd = 0x3F; @@ -831,8 +868,6 @@ public: bool layoutPushConstant; bool layoutBufferReference; - -#ifdef NV_EXTENSIONS bool layoutPassthrough; bool layoutViewportRelative; int layoutSecondaryViewportRelativeOffset; @@ -857,7 +892,9 @@ public: layoutSet = layoutSetEnd; layoutBinding = layoutBindingEnd; +#ifndef GLSLANG_WEB layoutAttachment = layoutAttachmentEnd; +#endif } bool hasMatrix() const @@ -868,10 +905,6 @@ public: { return layoutPacking != ElpNone; } - bool hasOffset() const - { - return layoutOffset != layoutNotSet; - } bool hasAlign() const { return layoutAlign != layoutNotSet; @@ -886,14 +919,6 @@ public: { return layoutLocation != layoutLocationEnd; } - bool hasComponent() const - { - return layoutComponent != layoutComponentEnd; - } - bool hasIndex() const - { - return layoutIndex != layoutIndexEnd; - } bool hasSet() const { return layoutSet != layoutSetEnd; @@ -902,6 +927,40 @@ public: { return layoutBinding != layoutBindingEnd; } +#ifdef GLSLANG_WEB + bool hasOffset() const { return false; } + bool isNonPerspective() const { return false; } + bool hasIndex() const { return false; } + unsigned getIndex() const { return 0; } + bool hasComponent() const { return false; } + bool hasStream() const { return false; } + bool hasFormat() const { return false; } + bool hasXfb() const { return false; } + bool hasXfbBuffer() const { return false; } + bool hasXfbStride() const { return false; } + bool hasXfbOffset() const { return false; } + bool hasAttachment() const { return false; } + TLayoutFormat getFormat() const { return ElfNone; } + bool isPushConstant() const { return false; } + bool isShaderRecordNV() const { return false; } + bool hasBufferReference() const { return false; } + bool hasBufferReferenceAlign() const { return false; } + bool isNonUniform() const { return false; } +#else + bool hasOffset() const + { + return layoutOffset != layoutNotSet; + } + bool isNonPerspective() const { return nopersp; } + bool hasIndex() const + { + return layoutIndex != layoutIndexEnd; + } + unsigned getIndex() const { return layoutIndex; } + bool hasComponent() const + { + return layoutComponent != layoutComponentEnd; + } bool hasStream() const { return layoutStream != layoutStreamEnd; @@ -932,16 +991,25 @@ public: { return layoutAttachment != layoutAttachmentEnd; } + TLayoutFormat getFormat() const { return layoutFormat; } + bool isPushConstant() const { return layoutPushConstant; } + bool isShaderRecordNV() const { return layoutShaderRecordNV; } + bool hasBufferReference() const { return layoutBufferReference; } + bool hasBufferReferenceAlign() const + { + return layoutBufferReferenceAlign != layoutBufferReferenceAlignEnd; + } + bool isNonUniform() const + { + return nonUniform; + } +#endif bool hasSpecConstantId() const { // Not the same thing as being a specialization constant, this // is just whether or not it was declared with an ID. return layoutSpecConstantId != layoutSpecConstantIdEnd; } - bool hasBufferReferenceAlign() const - { - return layoutBufferReferenceAlign != layoutBufferReferenceAlignEnd; - } bool isSpecConstant() const { // True if type is a specialization constant, whether or not it @@ -949,10 +1017,6 @@ public: // true front-end constant. return specConstant; } - bool isNonUniform() const - { - return nonUniform; - } bool isFrontEndConstant() const { // True if the front-end knows the final constant value. @@ -972,11 +1036,13 @@ public: static const char* getLayoutPackingString(TLayoutPacking packing) { switch (packing) { + case ElpStd140: return "std140"; +#ifndef GLSLANG_WEB case ElpPacked: return "packed"; case ElpShared: return "shared"; - case ElpStd140: return "std140"; case ElpStd430: return "std430"; case ElpScalar: return "scalar"; +#endif default: return "none"; } } @@ -988,6 +1054,9 @@ public: default: return "none"; } } +#ifdef GLSLANG_WEB + static const char* getLayoutFormatString(TLayoutFormat f) { return "none"; } +#else static const char* getLayoutFormatString(TLayoutFormat f) { switch (f) { @@ -1110,6 +1179,19 @@ public: default: return 0; } } + static const char* getInterlockOrderingString(TInterlockOrdering order) + { + switch (order) { + case EioPixelInterlockOrdered: return "pixel_interlock_ordered"; + case EioPixelInterlockUnordered: return "pixel_interlock_unordered"; + case EioSampleInterlockOrdered: return "sample_interlock_ordered"; + case EioSampleInterlockUnordered: return "sample_interlock_unordered"; + case EioShadingRateInterlockOrdered: return "shading_rate_interlock_ordered"; + case EioShadingRateInterlockUnordered: return "shading_rate_interlock_unordered"; + default: return "none"; + } + } +#endif }; // Qualifiers that don't need to be keep per object. They have shader scope, not object scope. @@ -1124,18 +1206,22 @@ struct TShaderQualifiers { TVertexOrder order; bool pointMode; int localSize[3]; // compute shader + bool localSizeNotDefault[3]; // compute shader int localSizeSpecId[3]; // compute shader specialization id for gl_WorkGroupSize +#ifndef GLSLANG_WEB bool earlyFragmentTests; // fragment input bool postDepthCoverage; // fragment input TLayoutDepth layoutDepth; bool blendEquation; // true if any blend equation was specified int numViews; // multiview extenstions - -#ifdef NV_EXTENSIONS + TInterlockOrdering interlockOrdering; bool layoutOverrideCoverage; // true if layout override_coverage set bool layoutDerivativeGroupQuads; // true if layout derivative_group_quadsNV set bool layoutDerivativeGroupLinear; // true if layout derivative_group_linearNV set int primitives; // mesh shader "max_primitives"DerivativeGroupLinear; // true if layout derivative_group_linearNV set + TLayoutDepth getDepth() const { return layoutDepth; } +#else + TLayoutDepth getDepth() const { return EldNone; } #endif void init() @@ -1151,22 +1237,32 @@ struct TShaderQualifiers { localSize[0] = 1; localSize[1] = 1; localSize[2] = 1; + localSizeNotDefault[0] = false; + localSizeNotDefault[1] = false; + localSizeNotDefault[2] = false; localSizeSpecId[0] = TQualifier::layoutNotSet; localSizeSpecId[1] = TQualifier::layoutNotSet; localSizeSpecId[2] = TQualifier::layoutNotSet; +#ifndef GLSLANG_WEB earlyFragmentTests = false; postDepthCoverage = false; layoutDepth = EldNone; blendEquation = false; numViews = TQualifier::layoutNotSet; -#ifdef NV_EXTENSIONS layoutOverrideCoverage = false; layoutDerivativeGroupQuads = false; layoutDerivativeGroupLinear = false; primitives = TQualifier::layoutNotSet; + interlockOrdering = EioNone; #endif } +#ifdef GLSLANG_WEB + bool hasBlendEquation() const { return false; } +#else + bool hasBlendEquation() const { return blendEquation; } +#endif + // Merge in characteristics from the 'src' qualifier. They can override when // set, but never erase when not set. void merge(const TShaderQualifiers& src) @@ -1192,9 +1288,13 @@ struct TShaderQualifiers { localSize[i] = src.localSize[i]; } for (int i = 0; i < 3; ++i) { + localSizeNotDefault[i] = src.localSizeNotDefault[i] || localSizeNotDefault[i]; + } + for (int i = 0; i < 3; ++i) { if (src.localSizeSpecId[i] != TQualifier::layoutNotSet) localSizeSpecId[i] = src.localSizeSpecId[i]; } +#ifndef GLSLANG_WEB if (src.earlyFragmentTests) earlyFragmentTests = true; if (src.postDepthCoverage) @@ -1205,7 +1305,6 @@ struct TShaderQualifiers { blendEquation = src.blendEquation; if (src.numViews != TQualifier::layoutNotSet) numViews = src.numViews; -#ifdef NV_EXTENSIONS if (src.layoutOverrideCoverage) layoutOverrideCoverage = src.layoutOverrideCoverage; if (src.layoutDerivativeGroupQuads) @@ -1214,6 +1313,8 @@ struct TShaderQualifiers { layoutDerivativeGroupLinear = src.layoutDerivativeGroupLinear; if (src.primitives != TQualifier::layoutNotSet) primitives = src.primitives; + if (src.interlockOrdering != EioNone) + interlockOrdering = src.interlockOrdering; #endif } }; @@ -1241,6 +1342,12 @@ public: TSourceLoc loc; TArraySizes* typeParameters; +#ifdef GLSLANG_WEB + bool isCoopmat() const { return false; } +#else + bool isCoopmat() const { return coopmat; } +#endif + void initType(const TSourceLoc& l) { basicType = EbtVoid; @@ -1344,11 +1451,18 @@ public: } typeName = NewPoolTString(p.userDef->getTypeName().c_str()); } - if (p.coopmat && p.basicType == EbtFloat && - p.typeParameters && p.typeParameters->getNumDims() > 0 && - p.typeParameters->getDimSize(0) == 16) { - basicType = EbtFloat16; - qualifier.precision = EpqNone; + if (p.isCoopmat() && p.typeParameters && p.typeParameters->getNumDims() > 0) { + int numBits = p.typeParameters->getDimSize(0); + if (p.basicType == EbtFloat && numBits == 16) { + basicType = EbtFloat16; + qualifier.precision = EpqNone; + } else if (p.basicType == EbtUint && numBits == 8) { + basicType = EbtUint8; + qualifier.precision = EpqNone; + } else if (p.basicType == EbtInt && numBits == 8) { + basicType = EbtInt8; + qualifier.precision = EpqNone; + } } } // for construction of sampler types @@ -1453,7 +1567,7 @@ public: referentType = copyOf.referentType; } typeParameters = copyOf.typeParameters; - coopmat = copyOf.coopmat; + coopmat = copyOf.isCoopMat(); } // Make complete copy of the whole type graph rooted at 'copyOf'. @@ -1512,7 +1626,11 @@ public: virtual int getOuterArraySize() const { return arraySizes->getOuterSize(); } virtual TIntermTyped* getOuterArrayNode() const { return arraySizes->getOuterNode(); } virtual int getCumulativeArraySize() const { return arraySizes->getCumulativeSize(); } - virtual bool isArrayOfArrays() const { return arraySizes != nullptr && arraySizes->getNumDims() > 1; } +#ifdef GLSLANG_WEB + bool isArrayOfArrays() const { return false; } +#else + bool isArrayOfArrays() const { return arraySizes != nullptr && arraySizes->getNumDims() > 1; } +#endif virtual int getImplicitArraySize() const { return arraySizes->getImplicitSize(); } virtual const TArraySizes* getArraySizes() const { return arraySizes; } virtual TArraySizes* getArraySizes() { return arraySizes; } @@ -1550,9 +1668,9 @@ public: } return false; } - virtual bool isOpaque() const { return basicType == EbtSampler || basicType == EbtAtomicUint -#ifdef NV_EXTENSIONS - || basicType == EbtAccStructNV + virtual bool isOpaque() const { return basicType == EbtSampler +#ifndef GLSLANG_WEB + || basicType == EbtAtomicUint || basicType == EbtAccStructNV #endif ; } virtual bool isBuiltIn() const { return getQualifier().builtIn != EbvNone; } @@ -1561,8 +1679,18 @@ public: virtual bool isImage() const { return basicType == EbtSampler && getSampler().isImage(); } virtual bool isSubpass() const { return basicType == EbtSampler && getSampler().isSubpass(); } virtual bool isTexture() const { return basicType == EbtSampler && getSampler().isTexture(); } + // Check the block-name convention of creating a block without populating it's members: + virtual bool isUnusableName() const { return isStruct() && structure == nullptr; } virtual bool isParameterized() const { return typeParameters != nullptr; } - virtual bool isCoopMat() const { return coopmat; } +#ifdef GLSLANG_WEB + bool isAtomic() const { return false; } + bool isCoopMat() const { return false; } + bool isReference() const { return false; } +#else + bool isAtomic() const { return basicType == EbtAtomicUint; } + bool isCoopMat() const { return coopmat; } + bool isReference() const { return getBasicType() == EbtReference; } +#endif // return true if this type contains any subtype which satisfies the given predicate. template <typename P> @@ -1643,20 +1771,44 @@ public: return contains([](const TType* t) { return t->isArray() && t->arraySizes->isOuterSpecialization(); } ); } - virtual bool contains16BitInt() const +#ifdef GLSLANG_WEB + bool containsDouble() const { return false; } + bool contains16BitFloat() const { return false; } + bool contains64BitInt() const { return false; } + bool contains16BitInt() const { return false; } + bool contains8BitInt() const { return false; } + bool containsCoopMat() const { return false; } + bool containsReference() const { return false; } +#else + bool containsDouble() const + { + return containsBasicType(EbtDouble); + } + bool contains16BitFloat() const + { + return containsBasicType(EbtFloat16); + } + bool contains64BitInt() const + { + return containsBasicType(EbtInt64) || containsBasicType(EbtUint64); + } + bool contains16BitInt() const { return containsBasicType(EbtInt16) || containsBasicType(EbtUint16); } - - virtual bool contains8BitInt() const + bool contains8BitInt() const { return containsBasicType(EbtInt8) || containsBasicType(EbtUint8); } - - virtual bool containsCoopMat() const + bool containsCoopMat() const { return contains([](const TType* t) { return t->coopmat; } ); } + bool containsReference() const + { + return containsBasicType(EbtReference); + } +#endif // Array editing methods. Array descriptors can be shared across // type instances. This allows all uses of the same array @@ -1716,11 +1868,9 @@ public: { if (isUnsizedArray() && !(skipNonvariablyIndexed || isArrayVariablyIndexed())) changeOuterArraySize(getImplicitArraySize()); -#ifdef NV_EXTENSIONS // For multi-dim per-view arrays, set unsized inner dimension size to 1 if (qualifier.isPerView() && arraySizes && arraySizes->isInnerUnsized()) arraySizes->clearInnerUnsized(); -#endif if (isStruct() && structure->size() > 0) { int lastMember = (int)structure->size() - 1; for (int i = 0; i < lastMember; ++i) @@ -1778,31 +1928,38 @@ public: static const char* getBasicString(TBasicType t) { switch (t) { - case EbtVoid: return "void"; case EbtFloat: return "float"; + case EbtInt: return "int"; + case EbtUint: return "uint"; + case EbtSampler: return "sampler/image"; +#ifndef GLSLANG_WEB + case EbtVoid: return "void"; case EbtDouble: return "double"; case EbtFloat16: return "float16_t"; case EbtInt8: return "int8_t"; case EbtUint8: return "uint8_t"; case EbtInt16: return "int16_t"; case EbtUint16: return "uint16_t"; - case EbtInt: return "int"; - case EbtUint: return "uint"; case EbtInt64: return "int64_t"; case EbtUint64: return "uint64_t"; case EbtBool: return "bool"; case EbtAtomicUint: return "atomic_uint"; - case EbtSampler: return "sampler/image"; case EbtStruct: return "structure"; case EbtBlock: return "block"; -#ifdef NV_EXTENSIONS case EbtAccStructNV: return "accelerationStructureNV"; -#endif case EbtReference: return "reference"; +#endif default: return "unknown type"; } } +#ifdef GLSLANG_WEB + TString getCompleteString() const { return ""; } + const char* getStorageQualifierString() const { return ""; } + const char* getBuiltInVariableString() const { return ""; } + const char* getPrecisionQualifierString() const { return ""; } + TString getBasicTypeString() const { return ""; } +#else TString getCompleteString() const { TString typeString; @@ -1891,7 +2048,6 @@ public: appendUint(1u << qualifier.layoutBufferReferenceAlign); } -#ifdef NV_EXTENSIONS if (qualifier.layoutPassthrough) appendStr(" passthrough"); if (qualifier.layoutViewportRelative) @@ -1902,7 +2058,6 @@ public: } if (qualifier.layoutShaderRecordNV) appendStr(" shaderRecordNV"); -#endif appendStr(")"); } @@ -1920,11 +2075,8 @@ public: appendStr(" flat"); if (qualifier.nopersp) appendStr(" noperspective"); -#ifdef AMD_EXTENSIONS if (qualifier.explicitInterp) appendStr(" __explicitInterpAMD"); -#endif -#ifdef NV_EXTENSIONS if (qualifier.pervertexNV) appendStr(" pervertexNV"); if (qualifier.perPrimitiveNV) @@ -1933,7 +2085,6 @@ public: appendStr(" perviewNV"); if (qualifier.perTaskNV) appendStr(" taskNV"); -#endif if (qualifier.patch) appendStr(" patch"); if (qualifier.sample) @@ -2020,13 +2171,15 @@ public: // Add struct/block members if (isStruct() && structure) { appendStr("{"); + bool hasHiddenMember = true; for (size_t i = 0; i < structure->size(); ++i) { if (! (*structure)[i].type->hiddenMember()) { + if (!hasHiddenMember) + appendStr(", "); typeString.append((*structure)[i].type->getCompleteString()); typeString.append(" "); typeString.append((*structure)[i].type->getFieldName()); - if (i < structure->size() - 1) - appendStr(", "); + hasHiddenMember = false; } } appendStr("}"); @@ -2046,10 +2199,13 @@ public: const char* getStorageQualifierString() const { return GetStorageQualifierString(qualifier.storage); } const char* getBuiltInVariableString() const { return GetBuiltInVariableString(qualifier.builtIn); } const char* getPrecisionQualifierString() const { return GetPrecisionQualifierString(qualifier.precision); } +#endif + const TTypeList* getStruct() const { assert(isStruct()); return structure; } void setStruct(TTypeList* s) { assert(isStruct()); structure = s; } TTypeList* getWritableStruct() const { assert(isStruct()); return structure; } // This should only be used when known to not be sharing with other threads - + void setBasicType(const TBasicType& t) { basicType = t; } + int computeNumComponents() const { int components = 0; @@ -2112,12 +2268,12 @@ public: return true; } - bool sameReferenceType(const TType& right) const + bool sameReferenceType(const TType& right) const { - if ((basicType == EbtReference) != (right.basicType == EbtReference)) + if (isReference() != right.isReference()) return false; - if ((basicType != EbtReference) && (right.basicType != EbtReference)) + if (!isReference() && !right.isReference()) return true; assert(referentType != nullptr); @@ -2129,7 +2285,7 @@ public: return *referentType == *right.referentType; } - // See if two types match, in all aspects except arrayness + // See if two types match, in all aspects except arrayness bool sameElementType(const TType& right) const { return basicType == right.basicType && sameElementShape(right); @@ -2164,7 +2320,7 @@ public: matrixCols == right.matrixCols && matrixRows == right.matrixRows && vector1 == right.vector1 && - coopmat == right.coopmat && + isCoopMat() == right.isCoopMat() && sameStructType(right) && sameReferenceType(right); } @@ -2173,10 +2329,24 @@ public: // an OK function parameter bool coopMatParameterOK(const TType& right) const { - return coopmat && right.coopmat && + return isCoopMat() && right.isCoopMat() && (getBasicType() == right.getBasicType()) && typeParameters == nullptr && right.typeParameters != nullptr; } + bool sameCoopMatBaseType(const TType &right) const { + bool rv = coopmat && right.coopmat; + if (getBasicType() == EbtFloat || getBasicType() == EbtFloat16) + rv = right.getBasicType() == EbtFloat || right.getBasicType() == EbtFloat16; + else if (getBasicType() == EbtUint || getBasicType() == EbtUint8) + rv = right.getBasicType() == EbtUint || right.getBasicType() == EbtUint8; + else if (getBasicType() == EbtInt || getBasicType() == EbtInt8) + rv = right.getBasicType() == EbtInt || right.getBasicType() == EbtInt8; + else + rv = false; + return rv; + } + + // See if two types match in all ways (just the actual type, not qualification) bool operator==(const TType& right) const { @@ -2190,12 +2360,13 @@ public: unsigned int getBufferReferenceAlignment() const { +#ifndef GLSLANG_WEB if (getBasicType() == glslang::EbtReference) { return getReferentType()->getQualifier().hasBufferReferenceAlign() ? (1u << getReferentType()->getQualifier().layoutBufferReferenceAlign) : 16u; - } else { - return 0; } +#endif + return 0; } protected: diff --git a/thirdparty/glslang/glslang/Include/intermediate.h b/thirdparty/glslang/glslang/Include/intermediate.h index 89d1954959..29d58ca635 100644 --- a/thirdparty/glslang/glslang/Include/intermediate.h +++ b/thirdparty/glslang/glslang/Include/intermediate.h @@ -275,6 +275,10 @@ enum TOperator { EOpConvUint64ToPtr, EOpConvPtrToUint64, + // uvec2 <-> pointer + EOpConvUvec2ToPtr, + EOpConvPtrToUvec2, + // // binary operations // @@ -422,11 +426,9 @@ enum TOperator { EOpReflect, EOpRefract, -#ifdef AMD_EXTENSIONS EOpMin3, EOpMax3, EOpMid3, -#endif EOpDPdx, // Fragment only EOpDPdy, // Fragment only @@ -441,10 +443,7 @@ enum TOperator { EOpInterpolateAtCentroid, // Fragment only EOpInterpolateAtSample, // Fragment only EOpInterpolateAtOffset, // Fragment only - -#ifdef AMD_EXTENSIONS EOpInterpolateAtVertex, -#endif EOpMatrixTimesMatrix, EOpOuterProduct, @@ -534,7 +533,6 @@ enum TOperator { EOpSubgroupQuadSwapVertical, EOpSubgroupQuadSwapDiagonal, -#ifdef NV_EXTENSIONS EOpSubgroupPartition, EOpSubgroupPartitionedAdd, EOpSubgroupPartitionedMul, @@ -557,11 +555,9 @@ enum TOperator { EOpSubgroupPartitionedExclusiveAnd, EOpSubgroupPartitionedExclusiveOr, EOpSubgroupPartitionedExclusiveXor, -#endif EOpSubgroupGuardStop, -#ifdef AMD_EXTENSIONS EOpMinInvocations, EOpMaxInvocations, EOpAddInvocations, @@ -588,7 +584,6 @@ enum TOperator { EOpCubeFaceIndex, EOpCubeFaceCoord, EOpTime, -#endif EOpAtomicAdd, EOpAtomicMin, @@ -621,6 +616,11 @@ enum TOperator { EOpCooperativeMatrixStore, EOpCooperativeMatrixMulAdd, + EOpBeginInvocationInterlock, // Fragment only + EOpEndInvocationInterlock, // Fragment only + + EOpIsHelperInvocation, + // // Branch // @@ -631,6 +631,7 @@ enum TOperator { EOpContinue, EOpCase, EOpDefault, + EOpDemote, // Fragment only // // Constructors @@ -648,9 +649,21 @@ enum TOperator { EOpConstructBool, EOpConstructFloat, EOpConstructDouble, + // Keep vector and matrix constructors in a consistent relative order for + // TParseContext::constructBuiltIn, which converts between 8/16/32 bit + // vector constructors EOpConstructVec2, EOpConstructVec3, EOpConstructVec4, + EOpConstructMat2x2, + EOpConstructMat2x3, + EOpConstructMat2x4, + EOpConstructMat3x2, + EOpConstructMat3x3, + EOpConstructMat3x4, + EOpConstructMat4x2, + EOpConstructMat4x3, + EOpConstructMat4x4, EOpConstructDVec2, EOpConstructDVec3, EOpConstructDVec4, @@ -681,15 +694,6 @@ enum TOperator { EOpConstructU64Vec2, EOpConstructU64Vec3, EOpConstructU64Vec4, - EOpConstructMat2x2, - EOpConstructMat2x3, - EOpConstructMat2x4, - EOpConstructMat3x2, - EOpConstructMat3x3, - EOpConstructMat3x4, - EOpConstructMat4x2, - EOpConstructMat4x3, - EOpConstructMat4x4, EOpConstructDMat2x2, EOpConstructDMat2x3, EOpConstructDMat2x4, @@ -786,10 +790,8 @@ enum TOperator { EOpImageQuerySamples, EOpImageLoad, EOpImageStore, -#ifdef AMD_EXTENSIONS EOpImageLoadLod, EOpImageStoreLod, -#endif EOpImageAtomicAdd, EOpImageAtomicMin, EOpImageAtomicMax, @@ -804,9 +806,7 @@ enum TOperator { EOpSubpassLoad, EOpSubpassLoadMS, EOpSparseImageLoad, -#ifdef AMD_EXTENSIONS EOpSparseImageLoadLod, -#endif EOpImageGuardEnd, @@ -844,13 +844,11 @@ enum TOperator { EOpTextureOffsetClamp, EOpTextureGradClamp, EOpTextureGradOffsetClamp, -#ifdef AMD_EXTENSIONS EOpTextureGatherLod, EOpTextureGatherLodOffset, EOpTextureGatherLodOffsets, EOpFragmentMaskFetch, EOpFragmentFetch, -#endif EOpSparseTextureGuardBegin, @@ -870,15 +868,12 @@ enum TOperator { EOpSparseTextureOffsetClamp, EOpSparseTextureGradClamp, EOpSparseTextureGradOffsetClamp, -#ifdef AMD_EXTENSIONS EOpSparseTextureGatherLod, EOpSparseTextureGatherLodOffset, EOpSparseTextureGatherLodOffsets, -#endif EOpSparseTextureGuardEnd, -#ifdef NV_EXTENSIONS EOpImageFootprintGuardBegin, EOpImageSampleFootprintNV, EOpImageSampleFootprintClampNV, @@ -886,7 +881,6 @@ enum TOperator { EOpImageSampleFootprintGradNV, EOpImageSampleFootprintGradClampNV, EOpImageFootprintGuardEnd, -#endif EOpSamplingGuardEnd, EOpTextureGuardEnd, @@ -905,14 +899,21 @@ enum TOperator { EOpFindLSB, EOpFindMSB, -#ifdef NV_EXTENSIONS + EOpCountLeadingZeros, + EOpCountTrailingZeros, + EOpAbsDifference, + EOpAddSaturate, + EOpSubSaturate, + EOpAverage, + EOpAverageRounded, + EOpMul32x16, + EOpTraceNV, EOpReportIntersectionNV, EOpIgnoreIntersectionNV, EOpTerminateRayNV, EOpExecuteCallableNV, EOpWritePackedPrimitiveIndices4x8NV, -#endif // // HLSL operations // @@ -996,6 +997,10 @@ enum TOperator { EOpWaveGetLaneIndex, // Will decompose to gl_SubgroupInvocationID. EOpWaveActiveCountBits, // Will decompose to subgroupBallotBitCount(subgroupBallot()). EOpWavePrefixCountBits, // Will decompose to subgroupBallotInclusiveBitCount(subgroupBallot()). + + // Shader Clock Ops + EOpReadClockSubgroupKHR, + EOpReadClockDeviceKHR, }; class TIntermTraverser; @@ -1097,6 +1102,8 @@ public: virtual bool isStruct() const { return type.isStruct(); } virtual bool isFloatingDomain() const { return type.isFloatingDomain(); } virtual bool isIntegerDomain() const { return type.isIntegerDomain(); } + bool isAtomic() const { return type.isAtomic(); } + bool isReference() const { return type.isReference(); } TString getCompleteString() const { return type.getCompleteString(); } protected: @@ -1191,6 +1198,7 @@ public: virtual void traverse(TIntermTraverser*); TOperator getFlowOp() const { return flowOp; } TIntermTyped* getExpression() const { return expression; } + void setExpression(TIntermTyped* pExpression) { expression = pExpression; } protected: TOperator flowOp; TIntermTyped* expression; @@ -1224,7 +1232,7 @@ public: // it is essential to use "symbol = sym" to assign to symbol TIntermSymbol(int i, const TString& n, const TType& t) : TIntermTyped(t), id(i), -#ifdef ENABLE_HLSL +#ifndef GLSLANG_WEB flattenSubset(-1), #endif constSubtree(nullptr) @@ -1239,7 +1247,7 @@ public: const TConstUnionArray& getConstArray() const { return constArray; } void setConstSubtree(TIntermTyped* subtree) { constSubtree = subtree; } TIntermTyped* getConstSubtree() const { return constSubtree; } -#ifdef ENABLE_HLSL +#ifndef GLSLANG_WEB void setFlattenSubset(int subset) { flattenSubset = subset; } int getFlattenSubset() const { return flattenSubset; } // -1 means full object #endif @@ -1250,7 +1258,7 @@ public: protected: int id; // the unique id of the symbol this node represents -#ifdef ENABLE_HLSL +#ifndef GLSLANG_WEB int flattenSubset; // how deeply the flattened object rooted at id has been dereferenced #endif TString name; // the name of the symbol this node represents @@ -1290,9 +1298,7 @@ struct TCrackedTextureOp { bool grad; bool subpass; bool lodClamp; -#ifdef AMD_EXTENSIONS bool fragMask; -#endif }; // @@ -1308,12 +1314,19 @@ public: bool isConstructor() const; bool isTexture() const { return op > EOpTextureGuardBegin && op < EOpTextureGuardEnd; } bool isSampling() const { return op > EOpSamplingGuardBegin && op < EOpSamplingGuardEnd; } +#ifdef GLSLANG_WEB + bool isImage() const { return false; } + bool isSparseTexture() const { return false; } + bool isImageFootprint() const { return false; } + bool isSparseImage() const { return false; } + bool isSubgroup() const { return false; } +#else bool isImage() const { return op > EOpImageGuardBegin && op < EOpImageGuardEnd; } bool isSparseTexture() const { return op > EOpSparseTextureGuardBegin && op < EOpSparseTextureGuardEnd; } -#ifdef NV_EXTENSIONS bool isImageFootprint() const { return op > EOpImageFootprintGuardBegin && op < EOpImageFootprintGuardEnd; } -#endif bool isSparseImage() const { return op == EOpSparseImageLoad; } + bool isSubgroup() const { return op > EOpSubgroupGuardStart && op < EOpSubgroupGuardStop; } +#endif void setOperationPrecision(TPrecisionQualifier p) { operationPrecision = p; } TPrecisionQualifier getOperationPrecision() const { return operationPrecision != EpqNone ? @@ -1343,9 +1356,7 @@ public: cracked.grad = false; cracked.subpass = false; cracked.lodClamp = false; -#ifdef AMD_EXTENSIONS cracked.fragMask = false; -#endif switch (op) { case EOpImageQuerySize: @@ -1360,10 +1371,6 @@ public: case EOpTexture: case EOpSparseTexture: break; - case EOpTextureClamp: - case EOpSparseTextureClamp: - cracked.lodClamp = true; - break; case EOpTextureProj: cracked.proj = true; break; @@ -1375,22 +1382,17 @@ public: case EOpSparseTextureOffset: cracked.offset = true; break; - case EOpTextureOffsetClamp: - case EOpSparseTextureOffsetClamp: - cracked.offset = true; - cracked.lodClamp = true; - break; case EOpTextureFetch: case EOpSparseTextureFetch: cracked.fetch = true; - if (sampler.dim == Esd1D || (sampler.dim == Esd2D && ! sampler.ms) || sampler.dim == Esd3D) + if (sampler.is1D() || (sampler.dim == Esd2D && ! sampler.isMultiSample()) || sampler.dim == Esd3D) cracked.lod = true; break; case EOpTextureFetchOffset: case EOpSparseTextureFetchOffset: cracked.fetch = true; cracked.offset = true; - if (sampler.dim == Esd1D || (sampler.dim == Esd2D && ! sampler.ms) || sampler.dim == Esd3D) + if (sampler.is1D() || (sampler.dim == Esd2D && ! sampler.isMultiSample()) || sampler.dim == Esd3D) cracked.lod = true; break; case EOpTextureProjOffset: @@ -1415,11 +1417,6 @@ public: case EOpSparseTextureGrad: cracked.grad = true; break; - case EOpTextureGradClamp: - case EOpSparseTextureGradClamp: - cracked.grad = true; - cracked.lodClamp = true; - break; case EOpTextureGradOffset: case EOpSparseTextureGradOffset: cracked.grad = true; @@ -1434,6 +1431,21 @@ public: cracked.offset = true; cracked.proj = true; break; +#ifndef GLSLANG_WEB + case EOpTextureClamp: + case EOpSparseTextureClamp: + cracked.lodClamp = true; + break; + case EOpTextureOffsetClamp: + case EOpSparseTextureOffsetClamp: + cracked.offset = true; + cracked.lodClamp = true; + break; + case EOpTextureGradClamp: + case EOpSparseTextureGradClamp: + cracked.grad = true; + cracked.lodClamp = true; + break; case EOpTextureGradOffsetClamp: case EOpSparseTextureGradOffsetClamp: cracked.grad = true; @@ -1454,7 +1466,6 @@ public: cracked.gather = true; cracked.offsets = true; break; -#ifdef AMD_EXTENSIONS case EOpTextureGatherLod: case EOpSparseTextureGatherLod: cracked.gather = true; @@ -1485,8 +1496,6 @@ public: cracked.subpass = sampler.dim == EsdSubpass; cracked.fragMask = true; break; -#endif -#ifdef NV_EXTENSIONS case EOpImageSampleFootprintNV: break; case EOpImageSampleFootprintClampNV: @@ -1502,11 +1511,11 @@ public: cracked.lodClamp = true; cracked.grad = true; break; -#endif case EOpSubpassLoad: case EOpSubpassLoadMS: cracked.subpass = true; break; +#endif default: break; } diff --git a/thirdparty/glslang/glslang/Include/revision.h b/thirdparty/glslang/glslang/Include/revision.h index dd6c8da04f..a0e4b2066c 100644 --- a/thirdparty/glslang/glslang/Include/revision.h +++ b/thirdparty/glslang/glslang/Include/revision.h @@ -1,3 +1,3 @@ // This header is generated by the make-revision script. -#define GLSLANG_PATCH_LEVEL 3226 +#define GLSLANG_PATCH_LEVEL 3559 diff --git a/thirdparty/glslang/glslang/MachineIndependent/Constant.cpp b/thirdparty/glslang/glslang/MachineIndependent/Constant.cpp index b75e3efb00..98c2666fbb 100644 --- a/thirdparty/glslang/glslang/MachineIndependent/Constant.cpp +++ b/thirdparty/glslang/glslang/MachineIndependent/Constant.cpp @@ -189,6 +189,24 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right else newConstArray[i].setDConst((double)NAN); break; + + case EbtInt: + if (rightUnionArray[i] == 0) + newConstArray[i].setIConst(0x7FFFFFFF); + else if (rightUnionArray[i].getIConst() == -1 && leftUnionArray[i].getIConst() == (int)-0x80000000ll) + newConstArray[i].setIConst((int)-0x80000000ll); + else + newConstArray[i].setIConst(leftUnionArray[i].getIConst() / rightUnionArray[i].getIConst()); + break; + + case EbtUint: + if (rightUnionArray[i] == 0u) + newConstArray[i].setUConst(0xFFFFFFFFu); + else + newConstArray[i].setUConst(leftUnionArray[i].getUConst() / rightUnionArray[i].getUConst()); + break; + +#ifndef GLSLANG_WEB case EbtInt8: if (rightUnionArray[i] == (signed char)0) newConstArray[i].setI8Const((signed char)0x7F); @@ -221,22 +239,6 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right newConstArray[i].setU16Const(leftUnionArray[i].getU16Const() / rightUnionArray[i].getU16Const()); break; - case EbtInt: - if (rightUnionArray[i] == 0) - newConstArray[i].setIConst(0x7FFFFFFF); - else if (rightUnionArray[i].getIConst() == -1 && leftUnionArray[i].getIConst() == (int)-0x80000000ll) - newConstArray[i].setIConst((int)-0x80000000ll); - else - newConstArray[i].setIConst(leftUnionArray[i].getIConst() / rightUnionArray[i].getIConst()); - break; - - case EbtUint: - if (rightUnionArray[i] == 0u) - newConstArray[i].setUConst(0xFFFFFFFFu); - else - newConstArray[i].setUConst(leftUnionArray[i].getUConst() / rightUnionArray[i].getUConst()); - break; - case EbtInt64: if (rightUnionArray[i] == 0ll) newConstArray[i].setI64Const(0x7FFFFFFFFFFFFFFFll); @@ -254,6 +256,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right break; default: return 0; +#endif } } break; @@ -292,13 +295,12 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right newConstArray[i].setIConst(0); break; } else goto modulo_default; - +#ifndef GLSLANG_WEB case EbtInt64: if (rightUnionArray[i].getI64Const() == -1 && leftUnionArray[i].getI64Const() == LLONG_MIN) { newConstArray[i].setI64Const(0); break; } else goto modulo_default; -#ifdef AMD_EXTENSIONS case EbtInt16: if (rightUnionArray[i].getIConst() == -1 && leftUnionArray[i].getIConst() == SHRT_MIN) { newConstArray[i].setIConst(0); @@ -415,8 +417,8 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) case EOpEmitStreamVertex: case EOpEndStreamPrimitive: - // These don't actually fold - return 0; + // These don't fold + return nullptr; case EOpPackSnorm2x16: case EOpPackUnorm2x16: @@ -491,8 +493,6 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) break; } - // TODO: 3.0 Functionality: unary constant folding: the rest of the ops have to be fleshed out - case EOpPackSnorm2x16: case EOpPackUnorm2x16: case EOpPackHalf2x16: @@ -510,7 +510,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) case EOpDeterminant: case EOpMatrixInverse: case EOpTranspose: - return 0; + return nullptr; default: assert(componentWise); @@ -529,16 +529,18 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) case EbtDouble: case EbtFloat16: case EbtFloat: newConstArray[i].setDConst(-unionArray[i].getDConst()); break; + case EbtInt: newConstArray[i].setIConst(-unionArray[i].getIConst()); break; + case EbtUint: newConstArray[i].setUConst(static_cast<unsigned int>(-static_cast<int>(unionArray[i].getUConst()))); break; +#ifndef GLSLANG_WEB case EbtInt8: newConstArray[i].setI8Const(-unionArray[i].getI8Const()); break; case EbtUint8: newConstArray[i].setU8Const(static_cast<unsigned int>(-static_cast<signed int>(unionArray[i].getU8Const()))); break; case EbtInt16: newConstArray[i].setI16Const(-unionArray[i].getI16Const()); break; case EbtUint16:newConstArray[i].setU16Const(static_cast<unsigned int>(-static_cast<signed int>(unionArray[i].getU16Const()))); break; - case EbtInt: newConstArray[i].setIConst(-unionArray[i].getIConst()); break; - case EbtUint: newConstArray[i].setUConst(static_cast<unsigned int>(-static_cast<int>(unionArray[i].getUConst()))); break; case EbtInt64: newConstArray[i].setI64Const(-unionArray[i].getI64Const()); break; case EbtUint64: newConstArray[i].setU64Const(static_cast<unsigned long long>(-static_cast<long long>(unionArray[i].getU64Const()))); break; +#endif default: - return 0; + return nullptr; } break; case EOpLogicalNot: @@ -546,7 +548,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) switch (getType().getBasicType()) { case EbtBool: newConstArray[i].setBConst(!unionArray[i].getBConst()); break; default: - return 0; + return nullptr; } break; case EOpBitwiseNot: @@ -671,6 +673,48 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) break; } + case EOpConvIntToBool: + newConstArray[i].setBConst(unionArray[i].getIConst() != 0); break; + case EOpConvUintToBool: + newConstArray[i].setBConst(unionArray[i].getUConst() != 0); break; + case EOpConvBoolToInt: + newConstArray[i].setIConst(unionArray[i].getBConst()); break; + case EOpConvBoolToUint: + newConstArray[i].setUConst(unionArray[i].getBConst()); break; + case EOpConvIntToUint: + newConstArray[i].setUConst(unionArray[i].getIConst()); break; + case EOpConvUintToInt: + newConstArray[i].setIConst(unionArray[i].getUConst()); break; + + case EOpConvFloatToBool: + case EOpConvDoubleToBool: + newConstArray[i].setBConst(unionArray[i].getDConst() != 0); break; + + case EOpConvBoolToFloat: + case EOpConvBoolToDouble: + newConstArray[i].setDConst(unionArray[i].getBConst()); break; + + case EOpConvIntToFloat: + case EOpConvIntToDouble: + newConstArray[i].setDConst(unionArray[i].getIConst()); break; + + case EOpConvUintToFloat: + case EOpConvUintToDouble: + newConstArray[i].setDConst(unionArray[i].getUConst()); break; + + case EOpConvDoubleToFloat: + case EOpConvFloatToDouble: + newConstArray[i].setDConst(unionArray[i].getDConst()); break; + + case EOpConvFloatToUint: + case EOpConvDoubleToUint: + newConstArray[i].setUConst(static_cast<unsigned int>(unionArray[i].getDConst())); break; + + case EOpConvFloatToInt: + case EOpConvDoubleToInt: + newConstArray[i].setIConst(static_cast<int>(unionArray[i].getDConst())); break; + +#ifndef GLSLANG_WEB case EOpConvInt8ToBool: newConstArray[i].setBConst(unionArray[i].getI8Const() != 0); break; case EOpConvUint8ToBool: @@ -679,20 +723,12 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) newConstArray[i].setBConst(unionArray[i].getI16Const() != 0); break; case EOpConvUint16ToBool: newConstArray[i].setBConst(unionArray[i].getU16Const() != 0); break; - case EOpConvIntToBool: - newConstArray[i].setBConst(unionArray[i].getIConst() != 0); break; - case EOpConvUintToBool: - newConstArray[i].setBConst(unionArray[i].getUConst() != 0); break; case EOpConvInt64ToBool: newConstArray[i].setBConst(unionArray[i].getI64Const() != 0); break; case EOpConvUint64ToBool: newConstArray[i].setBConst(unionArray[i].getI64Const() != 0); break; case EOpConvFloat16ToBool: newConstArray[i].setBConst(unionArray[i].getDConst() != 0); break; - case EOpConvFloatToBool: - newConstArray[i].setBConst(unionArray[i].getDConst() != 0); break; - case EOpConvDoubleToBool: - newConstArray[i].setBConst(unionArray[i].getDConst() != 0); break; case EOpConvBoolToInt8: newConstArray[i].setI8Const(unionArray[i].getBConst()); break; @@ -702,20 +738,12 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) newConstArray[i].setI16Const(unionArray[i].getBConst()); break; case EOpConvBoolToUint16: newConstArray[i].setU16Const(unionArray[i].getBConst()); break; - case EOpConvBoolToInt: - newConstArray[i].setIConst(unionArray[i].getBConst()); break; - case EOpConvBoolToUint: - newConstArray[i].setUConst(unionArray[i].getBConst()); break; case EOpConvBoolToInt64: newConstArray[i].setI64Const(unionArray[i].getBConst()); break; case EOpConvBoolToUint64: newConstArray[i].setU64Const(unionArray[i].getBConst()); break; case EOpConvBoolToFloat16: newConstArray[i].setDConst(unionArray[i].getBConst()); break; - case EOpConvBoolToFloat: - newConstArray[i].setDConst(unionArray[i].getBConst()); break; - case EOpConvBoolToDouble: - newConstArray[i].setDConst(unionArray[i].getBConst()); break; case EOpConvInt8ToInt16: newConstArray[i].setI16Const(unionArray[i].getI8Const()); break; @@ -810,8 +838,6 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) newConstArray[i].setU8Const((unsigned char)unionArray[i].getIConst()); break; case EOpConvIntToUint16: newConstArray[i].setU16Const((unsigned char)unionArray[i].getIConst()); break; - case EOpConvIntToUint: - newConstArray[i].setUConst(unionArray[i].getIConst()); break; case EOpConvIntToUint64: newConstArray[i].setU64Const(unionArray[i].getIConst()); break; @@ -819,8 +845,6 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) newConstArray[i].setI8Const((signed char)unionArray[i].getUConst()); break; case EOpConvUintToInt16: newConstArray[i].setI16Const((signed short)unionArray[i].getUConst()); break; - case EOpConvUintToInt: - newConstArray[i].setIConst(unionArray[i].getUConst()); break; case EOpConvUintToInt64: newConstArray[i].setI64Const(unionArray[i].getUConst()); break; case EOpConvUintToUint8: @@ -831,16 +855,8 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) newConstArray[i].setU64Const(unionArray[i].getUConst()); break; case EOpConvIntToFloat16: newConstArray[i].setDConst(unionArray[i].getIConst()); break; - case EOpConvIntToFloat: - newConstArray[i].setDConst(unionArray[i].getIConst()); break; - case EOpConvIntToDouble: - newConstArray[i].setDConst(unionArray[i].getIConst()); break; case EOpConvUintToFloat16: newConstArray[i].setDConst(unionArray[i].getUConst()); break; - case EOpConvUintToFloat: - newConstArray[i].setDConst(unionArray[i].getUConst()); break; - case EOpConvUintToDouble: - newConstArray[i].setDConst(unionArray[i].getUConst()); break; case EOpConvInt64ToInt8: newConstArray[i].setI8Const(static_cast<signed char>(unionArray[i].getI64Const())); break; case EOpConvInt64ToInt16: @@ -905,48 +921,35 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) newConstArray[i].setI8Const(static_cast<signed char>(unionArray[i].getDConst())); break; case EOpConvFloatToInt16: newConstArray[i].setI16Const(static_cast<signed short>(unionArray[i].getDConst())); break; - case EOpConvFloatToInt: - newConstArray[i].setIConst(static_cast<int>(unionArray[i].getDConst())); break; case EOpConvFloatToInt64: newConstArray[i].setI64Const(static_cast<long long>(unionArray[i].getDConst())); break; case EOpConvFloatToUint8: newConstArray[i].setU8Const(static_cast<unsigned char>(unionArray[i].getDConst())); break; case EOpConvFloatToUint16: newConstArray[i].setU16Const(static_cast<unsigned short>(unionArray[i].getDConst())); break; - case EOpConvFloatToUint: - newConstArray[i].setUConst(static_cast<unsigned int>(unionArray[i].getDConst())); break; case EOpConvFloatToUint64: newConstArray[i].setU64Const(static_cast<unsigned long long>(unionArray[i].getDConst())); break; case EOpConvFloatToFloat16: newConstArray[i].setDConst(unionArray[i].getDConst()); break; - case EOpConvFloatToDouble: - newConstArray[i].setDConst(unionArray[i].getDConst()); break; case EOpConvDoubleToInt8: newConstArray[i].setI8Const(static_cast<signed char>(unionArray[i].getDConst())); break; case EOpConvDoubleToInt16: newConstArray[i].setI16Const(static_cast<signed short>(unionArray[i].getDConst())); break; - case EOpConvDoubleToInt: - newConstArray[i].setIConst(static_cast<int>(unionArray[i].getDConst())); break; case EOpConvDoubleToInt64: newConstArray[i].setI64Const(static_cast<long long>(unionArray[i].getDConst())); break; case EOpConvDoubleToUint8: newConstArray[i].setU8Const(static_cast<unsigned char>(unionArray[i].getDConst())); break; case EOpConvDoubleToUint16: newConstArray[i].setU16Const(static_cast<unsigned short>(unionArray[i].getDConst())); break; - case EOpConvDoubleToUint: - newConstArray[i].setUConst(static_cast<unsigned int>(unionArray[i].getDConst())); break; case EOpConvDoubleToUint64: newConstArray[i].setU64Const(static_cast<unsigned long long>(unionArray[i].getDConst())); break; case EOpConvDoubleToFloat16: newConstArray[i].setDConst(unionArray[i].getDConst()); break; - case EOpConvDoubleToFloat: - newConstArray[i].setDConst(unionArray[i].getDConst()); break; case EOpConvPtrToUint64: case EOpConvUint64ToPtr: case EOpConstructReference: newConstArray[i].setU64Const(unionArray[i].getU64Const()); break; - - +#endif // TODO: 3.0 Functionality: unary constant folding: the rest of the ops have to be fleshed out @@ -970,7 +973,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) case EOpInt16BitsToFloat16: case EOpUint16BitsToFloat16: default: - return 0; + return nullptr; } } @@ -1078,6 +1081,13 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode) case EbtDouble: newConstArray[comp].setDConst(std::min(childConstUnions[0][arg0comp].getDConst(), childConstUnions[1][arg1comp].getDConst())); break; + case EbtInt: + newConstArray[comp].setIConst(std::min(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst())); + break; + case EbtUint: + newConstArray[comp].setUConst(std::min(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst())); + break; +#ifndef GLSLANG_WEB case EbtInt8: newConstArray[comp].setI8Const(std::min(childConstUnions[0][arg0comp].getI8Const(), childConstUnions[1][arg1comp].getI8Const())); break; @@ -1090,18 +1100,13 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode) case EbtUint16: newConstArray[comp].setU16Const(std::min(childConstUnions[0][arg0comp].getU16Const(), childConstUnions[1][arg1comp].getU16Const())); break; - case EbtInt: - newConstArray[comp].setIConst(std::min(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst())); - break; - case EbtUint: - newConstArray[comp].setUConst(std::min(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst())); - break; case EbtInt64: newConstArray[comp].setI64Const(std::min(childConstUnions[0][arg0comp].getI64Const(), childConstUnions[1][arg1comp].getI64Const())); break; case EbtUint64: newConstArray[comp].setU64Const(std::min(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const())); break; +#endif default: assert(false && "Default missing"); } break; @@ -1112,6 +1117,13 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode) case EbtDouble: newConstArray[comp].setDConst(std::max(childConstUnions[0][arg0comp].getDConst(), childConstUnions[1][arg1comp].getDConst())); break; + case EbtInt: + newConstArray[comp].setIConst(std::max(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst())); + break; + case EbtUint: + newConstArray[comp].setUConst(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst())); + break; +#ifndef GLSLANG_WEB case EbtInt8: newConstArray[comp].setI8Const(std::max(childConstUnions[0][arg0comp].getI8Const(), childConstUnions[1][arg1comp].getI8Const())); break; @@ -1124,18 +1136,13 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode) case EbtUint16: newConstArray[comp].setU16Const(std::max(childConstUnions[0][arg0comp].getU16Const(), childConstUnions[1][arg1comp].getU16Const())); break; - case EbtInt: - newConstArray[comp].setIConst(std::max(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst())); - break; - case EbtUint: - newConstArray[comp].setUConst(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst())); - break; case EbtInt64: newConstArray[comp].setI64Const(std::max(childConstUnions[0][arg0comp].getI64Const(), childConstUnions[1][arg1comp].getI64Const())); break; case EbtUint64: newConstArray[comp].setU64Const(std::max(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const())); break; +#endif default: assert(false && "Default missing"); } break; @@ -1147,6 +1154,11 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode) newConstArray[comp].setDConst(std::min(std::max(childConstUnions[0][arg0comp].getDConst(), childConstUnions[1][arg1comp].getDConst()), childConstUnions[2][arg2comp].getDConst())); break; + case EbtUint: + newConstArray[comp].setUConst(std::min(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst()), + childConstUnions[2][arg2comp].getUConst())); + break; +#ifndef GLSLANG_WEB case EbtInt8: newConstArray[comp].setI8Const(std::min(std::max(childConstUnions[0][arg0comp].getI8Const(), childConstUnions[1][arg1comp].getI8Const()), childConstUnions[2][arg2comp].getI8Const())); @@ -1167,10 +1179,6 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode) newConstArray[comp].setIConst(std::min(std::max(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst()), childConstUnions[2][arg2comp].getIConst())); break; - case EbtUint: - newConstArray[comp].setUConst(std::min(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst()), - childConstUnions[2][arg2comp].getUConst())); - break; case EbtInt64: newConstArray[comp].setI64Const(std::min(std::max(childConstUnions[0][arg0comp].getI64Const(), childConstUnions[1][arg1comp].getI64Const()), childConstUnions[2][arg2comp].getI64Const())); @@ -1179,6 +1187,7 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode) newConstArray[comp].setU64Const(std::min(std::max(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const()), childConstUnions[2][arg2comp].getU64Const())); break; +#endif default: assert(false && "Default missing"); } break; @@ -1201,12 +1210,17 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode) newConstArray[comp].setBConst(childConstUnions[0][arg0comp] != childConstUnions[1][arg1comp]); break; case EOpMix: - if (children[2]->getAsTyped()->getBasicType() == EbtBool) - newConstArray[comp].setDConst(childConstUnions[2][arg2comp].getBConst() ? childConstUnions[1][arg1comp].getDConst() : - childConstUnions[0][arg0comp].getDConst()); - else - newConstArray[comp].setDConst(childConstUnions[0][arg0comp].getDConst() * (1.0 - childConstUnions[2][arg2comp].getDConst()) + - childConstUnions[1][arg1comp].getDConst() * childConstUnions[2][arg2comp].getDConst()); + if (!children[0]->getAsTyped()->isFloatingDomain()) + return aggrNode; + if (children[2]->getAsTyped()->getBasicType() == EbtBool) { + newConstArray[comp].setDConst(childConstUnions[2][arg2comp].getBConst() + ? childConstUnions[1][arg1comp].getDConst() + : childConstUnions[0][arg0comp].getDConst()); + } else { + newConstArray[comp].setDConst( + childConstUnions[0][arg0comp].getDConst() * (1.0 - childConstUnions[2][arg2comp].getDConst()) + + childConstUnions[1][arg1comp].getDConst() * childConstUnions[2][arg2comp].getDConst()); + } break; case EOpStep: newConstArray[comp].setDConst(childConstUnions[1][arg1comp].getDConst() < childConstUnions[0][arg0comp].getDConst() ? 0.0 : 1.0); diff --git a/thirdparty/glslang/glslang/MachineIndependent/Initialize.cpp b/thirdparty/glslang/glslang/MachineIndependent/Initialize.cpp index 0498b4871a..de55742649 100644 --- a/thirdparty/glslang/glslang/MachineIndependent/Initialize.cpp +++ b/thirdparty/glslang/glslang/MachineIndependent/Initialize.cpp @@ -64,6 +64,420 @@ const bool ForwardCompatibility = false; // Using PureOperatorBuiltins=false is deprecated. bool PureOperatorBuiltins = true; +namespace { + +// +// A set of definitions for tabling of the built-in functions. +// + +// Order matters here, as does correlation with the subsequent +// "const int ..." declarations and the ArgType enumerants. +const char* TypeString[] = { + "bool", "bvec2", "bvec3", "bvec4", + "float", "vec2", "vec3", "vec4", + "int", "ivec2", "ivec3", "ivec4", + "uint", "uvec2", "uvec3", "uvec4", +}; +const int TypeStringCount = sizeof(TypeString) / sizeof(char*); // number of entries in 'TypeString' +const int TypeStringRowShift = 2; // shift amount to go downe one row in 'TypeString' +const int TypeStringColumnMask = (1 << TypeStringRowShift) - 1; // reduce type to its column number in 'TypeString' +const int TypeStringScalarMask = ~TypeStringColumnMask; // take type to its scalar column in 'TypeString' + +enum ArgType { + // numbers hardcoded to correspond to 'TypeString'; order and value matter + TypeB = 1 << 0, // Boolean + TypeF = 1 << 1, // float 32 + TypeI = 1 << 2, // int 32 + TypeU = 1 << 3, // uint 32 + TypeF16 = 1 << 4, // float 16 + TypeF64 = 1 << 5, // float 64 + TypeI8 = 1 << 6, // int 8 + TypeI16 = 1 << 7, // int 16 + TypeI64 = 1 << 8, // int 64 + TypeU8 = 1 << 9, // uint 8 + TypeU16 = 1 << 10, // uint 16 + TypeU64 = 1 << 11, // uint 64 +}; +// Mixtures of the above, to help the function tables +const ArgType TypeFI = static_cast<ArgType>(TypeF | TypeI); +const ArgType TypeFIB = static_cast<ArgType>(TypeF | TypeI | TypeB); +const ArgType TypeIU = static_cast<ArgType>(TypeI | TypeU); + +// The relationships between arguments and return type, whether anything is +// output, or other unusual situations. +enum ArgClass { + ClassRegular = 0, // nothing special, just all vector widths with matching return type; traditional arithmetic + ClassLS = 1 << 0, // the last argument is also held fixed as a (type-matched) scalar while the others cycle + ClassXLS = 1 << 1, // the last argument is exclusively a (type-matched) scalar while the others cycle + ClassLS2 = 1 << 2, // the last two arguments are held fixed as a (type-matched) scalar while the others cycle + ClassFS = 1 << 3, // the first argument is held fixed as a (type-matched) scalar while the others cycle + ClassFS2 = 1 << 4, // the first two arguments are held fixed as a (type-matched) scalar while the others cycle + ClassLO = 1 << 5, // the last argument is an output + ClassB = 1 << 6, // return type cycles through only bool/bvec, matching vector width of args + ClassLB = 1 << 7, // last argument cycles through only bool/bvec, matching vector width of args + ClassV1 = 1 << 8, // scalar only + ClassFIO = 1 << 9, // first argument is inout + ClassRS = 1 << 10, // the return is held scalar as the arguments cycle + ClassNS = 1 << 11, // no scalar prototype + ClassCV = 1 << 12, // first argument is 'coherent volatile' + ClassFO = 1 << 13, // first argument is output + ClassV3 = 1 << 14, // vec3 only +}; +// Mixtures of the above, to help the function tables +const ArgClass ClassV1FIOCV = (ArgClass)(ClassV1 | ClassFIO | ClassCV); +const ArgClass ClassV1FOCV = (ArgClass)(ClassV1 | ClassFO | ClassCV); +const ArgClass ClassV1CV = (ArgClass)(ClassV1 | ClassCV); +const ArgClass ClassBNS = (ArgClass)(ClassB | ClassNS); +const ArgClass ClassRSNS = (ArgClass)(ClassRS | ClassNS); + +// A descriptor, for a single profile, of when something is available. +// If the current profile does not match 'profile' mask below, the other fields +// do not apply (nor validate). +// profiles == EBadProfile is the end of an array of these +struct Versioning { + EProfile profiles; // the profile(s) (mask) that the following fields are valid for + int minExtendedVersion; // earliest version when extensions are enabled; ignored if numExtensions is 0 + int minCoreVersion; // earliest version function is in core; 0 means never + int numExtensions; // how many extensions are in the 'extensions' list + const char** extensions; // list of extension names enabling the function +}; + +EProfile EDesktopProfile = static_cast<EProfile>(ENoProfile | ECoreProfile | ECompatibilityProfile); + +// Declare pointers to put into the table for versioning. +#ifdef GLSLANG_WEB + const Versioning* Es300Desktop130 = nullptr; + const Versioning* Es310Desktop430 = nullptr; +#else + const Versioning Es300Desktop130Version[] = { { EEsProfile, 0, 300, 0, nullptr }, + { EDesktopProfile, 0, 130, 0, nullptr }, + { EBadProfile } }; + const Versioning* Es300Desktop130 = &Es300Desktop130Version[0]; + + const Versioning Es310Desktop430Version[] = { { EEsProfile, 0, 310, 0, nullptr }, + { EDesktopProfile, 0, 430, 0, nullptr }, + { EBadProfile } }; + const Versioning* Es310Desktop430 = &Es310Desktop430Version[0]; + + const Versioning Es310Desktop450Version[] = { { EEsProfile, 0, 310, 0, nullptr }, + { EDesktopProfile, 0, 450, 0, nullptr }, + { EBadProfile } }; + const Versioning* Es310Desktop450 = &Es310Desktop450Version[0]; +#endif + +// The main descriptor of what a set of function prototypes can look like, and +// a pointer to extra versioning information, when needed. +struct BuiltInFunction { + TOperator op; // operator to map the name to + const char* name; // function name + int numArguments; // number of arguments (overloads with varying arguments need different entries) + ArgType types; // ArgType mask + ArgClass classes; // the ways this particular function entry manifests + const Versioning* versioning; // nullptr means always a valid version +}; + +// The tables can have the same built-in function name more than one time, +// but the exact same prototype must be indicated at most once. +// The prototypes that get declared are the union of all those indicated. +// This is important when different releases add new prototypes for the same name. +// It also also congnitively simpler tiling of the prototype space. +// In practice, most names can be fully represented with one entry. +// +// Table is terminated by an OpNull TOperator. + +const BuiltInFunction BaseFunctions[] = { +// TOperator, name, arg-count, ArgType, ArgClass, versioning +// --------- ---- --------- ------- -------- ---------- + { EOpRadians, "radians", 1, TypeF, ClassRegular, nullptr }, + { EOpDegrees, "degrees", 1, TypeF, ClassRegular, nullptr }, + { EOpSin, "sin", 1, TypeF, ClassRegular, nullptr }, + { EOpCos, "cos", 1, TypeF, ClassRegular, nullptr }, + { EOpTan, "tan", 1, TypeF, ClassRegular, nullptr }, + { EOpAsin, "asin", 1, TypeF, ClassRegular, nullptr }, + { EOpAcos, "acos", 1, TypeF, ClassRegular, nullptr }, + { EOpAtan, "atan", 2, TypeF, ClassRegular, nullptr }, + { EOpAtan, "atan", 1, TypeF, ClassRegular, nullptr }, + { EOpPow, "pow", 2, TypeF, ClassRegular, nullptr }, + { EOpExp, "exp", 1, TypeF, ClassRegular, nullptr }, + { EOpLog, "log", 1, TypeF, ClassRegular, nullptr }, + { EOpExp2, "exp2", 1, TypeF, ClassRegular, nullptr }, + { EOpLog2, "log2", 1, TypeF, ClassRegular, nullptr }, + { EOpSqrt, "sqrt", 1, TypeF, ClassRegular, nullptr }, + { EOpInverseSqrt, "inversesqrt", 1, TypeF, ClassRegular, nullptr }, + { EOpAbs, "abs", 1, TypeF, ClassRegular, nullptr }, + { EOpSign, "sign", 1, TypeF, ClassRegular, nullptr }, + { EOpFloor, "floor", 1, TypeF, ClassRegular, nullptr }, + { EOpCeil, "ceil", 1, TypeF, ClassRegular, nullptr }, + { EOpFract, "fract", 1, TypeF, ClassRegular, nullptr }, + { EOpMod, "mod", 2, TypeF, ClassLS, nullptr }, + { EOpMin, "min", 2, TypeF, ClassLS, nullptr }, + { EOpMax, "max", 2, TypeF, ClassLS, nullptr }, + { EOpClamp, "clamp", 3, TypeF, ClassLS2, nullptr }, + { EOpMix, "mix", 3, TypeF, ClassLS, nullptr }, + { EOpStep, "step", 2, TypeF, ClassFS, nullptr }, + { EOpSmoothStep, "smoothstep", 3, TypeF, ClassFS2, nullptr }, + { EOpNormalize, "normalize", 1, TypeF, ClassRegular, nullptr }, + { EOpFaceForward, "faceforward", 3, TypeF, ClassRegular, nullptr }, + { EOpReflect, "reflect", 2, TypeF, ClassRegular, nullptr }, + { EOpRefract, "refract", 3, TypeF, ClassXLS, nullptr }, + { EOpLength, "length", 1, TypeF, ClassRS, nullptr }, + { EOpDistance, "distance", 2, TypeF, ClassRS, nullptr }, + { EOpDot, "dot", 2, TypeF, ClassRS, nullptr }, + { EOpCross, "cross", 2, TypeF, ClassV3, nullptr }, + { EOpLessThan, "lessThan", 2, TypeFI, ClassBNS, nullptr }, + { EOpLessThanEqual, "lessThanEqual", 2, TypeFI, ClassBNS, nullptr }, + { EOpGreaterThan, "greaterThan", 2, TypeFI, ClassBNS, nullptr }, + { EOpGreaterThanEqual, "greaterThanEqual", 2, TypeFI, ClassBNS, nullptr }, + { EOpVectorEqual, "equal", 2, TypeFIB, ClassBNS, nullptr }, + { EOpVectorNotEqual, "notEqual", 2, TypeFIB, ClassBNS, nullptr }, + { EOpAny, "any", 1, TypeB, ClassRSNS, nullptr }, + { EOpAll, "all", 1, TypeB, ClassRSNS, nullptr }, + { EOpVectorLogicalNot, "not", 1, TypeB, ClassNS, nullptr }, + { EOpSinh, "sinh", 1, TypeF, ClassRegular, Es300Desktop130 }, + { EOpCosh, "cosh", 1, TypeF, ClassRegular, Es300Desktop130 }, + { EOpTanh, "tanh", 1, TypeF, ClassRegular, Es300Desktop130 }, + { EOpAsinh, "asinh", 1, TypeF, ClassRegular, Es300Desktop130 }, + { EOpAcosh, "acosh", 1, TypeF, ClassRegular, Es300Desktop130 }, + { EOpAtanh, "atanh", 1, TypeF, ClassRegular, Es300Desktop130 }, + { EOpAbs, "abs", 1, TypeI, ClassRegular, Es300Desktop130 }, + { EOpSign, "sign", 1, TypeI, ClassRegular, Es300Desktop130 }, + { EOpTrunc, "trunc", 1, TypeF, ClassRegular, Es300Desktop130 }, + { EOpRound, "round", 1, TypeF, ClassRegular, Es300Desktop130 }, + { EOpRoundEven, "roundEven", 1, TypeF, ClassRegular, Es300Desktop130 }, + { EOpModf, "modf", 2, TypeF, ClassLO, Es300Desktop130 }, + { EOpMin, "min", 2, TypeIU, ClassLS, Es300Desktop130 }, + { EOpMax, "max", 2, TypeIU, ClassLS, Es300Desktop130 }, + { EOpClamp, "clamp", 3, TypeIU, ClassLS2, Es300Desktop130 }, + { EOpMix, "mix", 3, TypeF, ClassLB, Es300Desktop130 }, + { EOpIsInf, "isinf", 1, TypeF, ClassB, Es300Desktop130 }, + { EOpIsNan, "isnan", 1, TypeF, ClassB, Es300Desktop130 }, + { EOpLessThan, "lessThan", 2, TypeU, ClassBNS, Es300Desktop130 }, + { EOpLessThanEqual, "lessThanEqual", 2, TypeU, ClassBNS, Es300Desktop130 }, + { EOpGreaterThan, "greaterThan", 2, TypeU, ClassBNS, Es300Desktop130 }, + { EOpGreaterThanEqual, "greaterThanEqual", 2, TypeU, ClassBNS, Es300Desktop130 }, + { EOpVectorEqual, "equal", 2, TypeU, ClassBNS, Es300Desktop130 }, + { EOpVectorNotEqual, "notEqual", 2, TypeU, ClassBNS, Es300Desktop130 }, + { EOpAtomicAdd, "atomicAdd", 2, TypeIU, ClassV1FIOCV, Es310Desktop430 }, + { EOpAtomicMin, "atomicMin", 2, TypeIU, ClassV1FIOCV, Es310Desktop430 }, + { EOpAtomicMax, "atomicMax", 2, TypeIU, ClassV1FIOCV, Es310Desktop430 }, + { EOpAtomicAnd, "atomicAnd", 2, TypeIU, ClassV1FIOCV, Es310Desktop430 }, + { EOpAtomicOr, "atomicOr", 2, TypeIU, ClassV1FIOCV, Es310Desktop430 }, + { EOpAtomicXor, "atomicXor", 2, TypeIU, ClassV1FIOCV, Es310Desktop430 }, + { EOpAtomicExchange, "atomicExchange", 2, TypeIU, ClassV1FIOCV, Es310Desktop430 }, + { EOpAtomicCompSwap, "atomicCompSwap", 3, TypeIU, ClassV1FIOCV, Es310Desktop430 }, +#ifndef GLSLANG_WEB + { EOpMix, "mix", 3, TypeB, ClassRegular, Es310Desktop450 }, + { EOpMix, "mix", 3, TypeIU, ClassLB, Es310Desktop450 }, +#endif + + { EOpNull } +}; + +const BuiltInFunction DerivativeFunctions[] = { + { EOpDPdx, "dFdx", 1, TypeF, ClassRegular, nullptr }, + { EOpDPdy, "dFdy", 1, TypeF, ClassRegular, nullptr }, + { EOpFwidth, "fwidth", 1, TypeF, ClassRegular, nullptr }, + { EOpNull } +}; + +// For functions declared some other way, but still use the table to relate to operator. +struct CustomFunction { + TOperator op; // operator to map the name to + const char* name; // function name + const Versioning* versioning; // nullptr means always a valid version +}; + +const CustomFunction CustomFunctions[] = { + { EOpBarrier, "barrier", nullptr }, + { EOpMemoryBarrierShared, "memoryBarrierShared", nullptr }, + { EOpGroupMemoryBarrier, "groupMemoryBarrier", nullptr }, + { EOpMemoryBarrier, "memoryBarrier", nullptr }, + { EOpMemoryBarrierBuffer, "memoryBarrierBuffer", nullptr }, + + { EOpPackSnorm2x16, "packSnorm2x16", nullptr }, + { EOpUnpackSnorm2x16, "unpackSnorm2x16", nullptr }, + { EOpPackUnorm2x16, "packUnorm2x16", nullptr }, + { EOpUnpackUnorm2x16, "unpackUnorm2x16", nullptr }, + { EOpPackHalf2x16, "packHalf2x16", nullptr }, + { EOpUnpackHalf2x16, "unpackHalf2x16", nullptr }, + + { EOpMul, "matrixCompMult", nullptr }, + { EOpOuterProduct, "outerProduct", nullptr }, + { EOpTranspose, "transpose", nullptr }, + { EOpDeterminant, "determinant", nullptr }, + { EOpMatrixInverse, "inverse", nullptr }, + { EOpFloatBitsToInt, "floatBitsToInt", nullptr }, + { EOpFloatBitsToUint, "floatBitsToUint", nullptr }, + { EOpIntBitsToFloat, "intBitsToFloat", nullptr }, + { EOpUintBitsToFloat, "uintBitsToFloat", nullptr }, + + { EOpTextureQuerySize, "textureSize", nullptr }, + { EOpTextureQueryLod, "textureQueryLod", nullptr }, + { EOpTextureQueryLevels, "textureQueryLevels", nullptr }, + { EOpTextureQuerySamples, "textureSamples", nullptr }, + { EOpTexture, "texture", nullptr }, + { EOpTextureProj, "textureProj", nullptr }, + { EOpTextureLod, "textureLod", nullptr }, + { EOpTextureOffset, "textureOffset", nullptr }, + { EOpTextureFetch, "texelFetch", nullptr }, + { EOpTextureFetchOffset, "texelFetchOffset", nullptr }, + { EOpTextureProjOffset, "textureProjOffset", nullptr }, + { EOpTextureLodOffset, "textureLodOffset", nullptr }, + { EOpTextureProjLod, "textureProjLod", nullptr }, + { EOpTextureProjLodOffset, "textureProjLodOffset", nullptr }, + { EOpTextureGrad, "textureGrad", nullptr }, + { EOpTextureGradOffset, "textureGradOffset", nullptr }, + { EOpTextureProjGrad, "textureProjGrad", nullptr }, + { EOpTextureProjGradOffset, "textureProjGradOffset", nullptr }, + + { EOpNull } +}; + +// For the given table of functions, add all the indicated prototypes for each +// one, to be returned in the passed in decls. +void AddTabledBuiltin(TString& decls, const BuiltInFunction& function) +{ + const auto isScalarType = [](int type) { return (type & TypeStringColumnMask) == 0; }; + + // loop across these two: + // 0: the varying arg set, and + // 1: the fixed scalar args + const ArgClass ClassFixed = (ArgClass)(ClassLS | ClassXLS | ClassLS2 | ClassFS | ClassFS2); + for (int fixed = 0; fixed < ((function.classes & ClassFixed) > 0 ? 2 : 1); ++fixed) { + + if (fixed == 0 && (function.classes & ClassXLS)) + continue; + + // walk the type strings in TypeString[] + for (int type = 0; type < TypeStringCount; ++type) { + // skip types not selected: go from type to row number to type bit + if ((function.types & (1 << (type >> TypeStringRowShift))) == 0) + continue; + + // if we aren't on a scalar, and should be, skip + if ((function.classes & ClassV1) && !isScalarType(type)) + continue; + + // if we aren't on a 3-vector, and should be, skip + if ((function.classes & ClassV3) && (type & TypeStringColumnMask) != 2) + continue; + + // skip replication of all arg scalars between the varying arg set and the fixed args + if (fixed == 1 && type == (type & TypeStringScalarMask) && (function.classes & ClassXLS) == 0) + continue; + + // skip scalars when we are told to + if ((function.classes & ClassNS) && isScalarType(type)) + continue; + + // return type + if (function.classes & ClassB) + decls.append(TypeString[type & TypeStringColumnMask]); + else if (function.classes & ClassRS) + decls.append(TypeString[type & TypeStringScalarMask]); + else + decls.append(TypeString[type]); + decls.append(" "); + decls.append(function.name); + decls.append("("); + + // arguments + for (int arg = 0; arg < function.numArguments; ++arg) { + if (arg == function.numArguments - 1 && (function.classes & ClassLO)) + decls.append("out "); + if (arg == 0) { +#ifndef GLSLANG_WEB + if (function.classes & ClassCV) + decls.append("coherent volatile "); +#endif + if (function.classes & ClassFIO) + decls.append("inout "); + if (function.classes & ClassFO) + decls.append("out "); + } + if ((function.classes & ClassLB) && arg == function.numArguments - 1) + decls.append(TypeString[type & TypeStringColumnMask]); + else if (fixed && ((arg == function.numArguments - 1 && (function.classes & (ClassLS | ClassXLS | + ClassLS2))) || + (arg == function.numArguments - 2 && (function.classes & ClassLS2)) || + (arg == 0 && (function.classes & (ClassFS | ClassFS2))) || + (arg == 1 && (function.classes & ClassFS2)))) + decls.append(TypeString[type & TypeStringScalarMask]); + else + decls.append(TypeString[type]); + if (arg < function.numArguments - 1) + decls.append(","); + } + decls.append(");\n"); + } + } +} + +// See if the tabled versioning information allows the current version. +bool ValidVersion(const BuiltInFunction& function, int version, EProfile profile, const SpvVersion& /* spVersion */) +{ +#ifdef GLSLANG_WEB + // all entries in table are valid + return true; +#endif + + // nullptr means always valid + if (function.versioning == nullptr) + return true; + + // check for what is said about our current profile + for (const Versioning* v = function.versioning; v->profiles != EBadProfile; ++v) { + if ((v->profiles & profile) != 0) { + if (v->minCoreVersion <= version || (v->numExtensions > 0 && v->minExtendedVersion <= version)) + return true; + } + } + + return false; +} + +// Relate a single table of built-ins to their AST operator. +// This can get called redundantly (especially for the common built-ins, when +// called once per stage). This is a performance issue only, not a correctness +// concern. It is done for quality arising from simplicity, as there are subtleties +// to get correct if instead trying to do it surgically. +template<class FunctionT> +void RelateTabledBuiltins(const FunctionT* functions, TSymbolTable& symbolTable) +{ + while (functions->op != EOpNull) { + symbolTable.relateToOperator(functions->name, functions->op); + ++functions; + } +} + +} // end anonymous namespace + +// Add declarations for all tables of built-in functions. +void TBuiltIns::addTabledBuiltins(int version, EProfile profile, const SpvVersion& spvVersion) +{ + const auto forEachFunction = [&](TString& decls, const BuiltInFunction* function) { + while (function->op != EOpNull) { + if (ValidVersion(*function, version, profile, spvVersion)) + AddTabledBuiltin(decls, *function); + ++function; + } + }; + + forEachFunction(commonBuiltins, BaseFunctions); + forEachFunction(stageBuiltins[EShLangFragment], DerivativeFunctions); + + if ((profile == EEsProfile && version >= 320) || (profile != EEsProfile && version >= 450)) + forEachFunction(stageBuiltins[EShLangCompute], DerivativeFunctions); +} + +// Relate all tables of built-ins to the AST operators. +void TBuiltIns::relateTabledBuiltins(int /* version */, EProfile /* profile */, const SpvVersion& /* spvVersion */, EShLanguage /* stage */, TSymbolTable& symbolTable) +{ + RelateTabledBuiltins(BaseFunctions, symbolTable); + RelateTabledBuiltins(DerivativeFunctions, symbolTable); + RelateTabledBuiltins(CustomFunctions, symbolTable); +} + inline bool IncludeLegacy(int version, EProfile profile, const SpvVersion& spvVersion) { return profile != EEsProfile && (version <= 130 || (spvVersion.spv == 0 && ARBCompatibility) || profile == ECompatibilityProfile); @@ -84,27 +498,30 @@ TBuiltIns::TBuiltIns() // Set up textual representations for making all the permutations // of texturing/imaging functions. prefixes[EbtFloat] = ""; -#ifdef AMD_EXTENSIONS + prefixes[EbtInt] = "i"; + prefixes[EbtUint] = "u"; +#ifndef GLSLANG_WEB prefixes[EbtFloat16] = "f16"; -#endif prefixes[EbtInt8] = "i8"; prefixes[EbtUint8] = "u8"; prefixes[EbtInt16] = "i16"; prefixes[EbtUint16] = "u16"; - prefixes[EbtInt] = "i"; - prefixes[EbtUint] = "u"; +#endif + postfixes[2] = "2"; postfixes[3] = "3"; postfixes[4] = "4"; // Map from symbolic class of texturing dimension to numeric dimensions. - dimMap[Esd1D] = 1; dimMap[Esd2D] = 2; - dimMap[EsdRect] = 2; dimMap[Esd3D] = 3; dimMap[EsdCube] = 3; +#ifndef GLSLANG_WEB + dimMap[Esd1D] = 1; + dimMap[EsdRect] = 2; dimMap[EsdBuffer] = 1; - dimMap[EsdSubpass] = 2; // potientially unused for now + dimMap[EsdSubpass] = 2; // potentially unused for now +#endif } TBuiltIns::~TBuiltIns() @@ -122,32 +539,22 @@ TBuiltIns::~TBuiltIns() // void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvVersion) { +#ifdef GLSLANG_WEB + version = 310; + profile = EEsProfile; +#endif + addTabledBuiltins(version, profile, spvVersion); + //============================================================================ // // Prototypes for built-in functions used repeatly by different shaders // //============================================================================ +#ifndef GLSLANG_WEB // // Derivatives Functions. // - TString derivatives ( - "float dFdx(float p);" - "vec2 dFdx(vec2 p);" - "vec3 dFdx(vec3 p);" - "vec4 dFdx(vec4 p);" - - "float dFdy(float p);" - "vec2 dFdy(vec2 p);" - "vec3 dFdy(vec3 p);" - "vec4 dFdy(vec4 p);" - - "float fwidth(float p);" - "vec2 fwidth(vec2 p);" - "vec3 fwidth(vec3 p);" - "vec4 fwidth(vec4 p);" - ); - TString derivativeControls ( "float dFdxFine(float p);" "vec2 dFdxFine(vec2 p);" @@ -281,321 +688,9 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV //============================================================================ // - // Angle and Trigonometric Functions. - // - commonBuiltins.append( - "float radians(float degrees);" - "vec2 radians(vec2 degrees);" - "vec3 radians(vec3 degrees);" - "vec4 radians(vec4 degrees);" - - "float degrees(float radians);" - "vec2 degrees(vec2 radians);" - "vec3 degrees(vec3 radians);" - "vec4 degrees(vec4 radians);" - - "float sin(float angle);" - "vec2 sin(vec2 angle);" - "vec3 sin(vec3 angle);" - "vec4 sin(vec4 angle);" - - "float cos(float angle);" - "vec2 cos(vec2 angle);" - "vec3 cos(vec3 angle);" - "vec4 cos(vec4 angle);" - - "float tan(float angle);" - "vec2 tan(vec2 angle);" - "vec3 tan(vec3 angle);" - "vec4 tan(vec4 angle);" - - "float asin(float x);" - "vec2 asin(vec2 x);" - "vec3 asin(vec3 x);" - "vec4 asin(vec4 x);" - - "float acos(float x);" - "vec2 acos(vec2 x);" - "vec3 acos(vec3 x);" - "vec4 acos(vec4 x);" - - "float atan(float y, float x);" - "vec2 atan(vec2 y, vec2 x);" - "vec3 atan(vec3 y, vec3 x);" - "vec4 atan(vec4 y, vec4 x);" - - "float atan(float y_over_x);" - "vec2 atan(vec2 y_over_x);" - "vec3 atan(vec3 y_over_x);" - "vec4 atan(vec4 y_over_x);" - - "\n"); - - if (version >= 130) { - commonBuiltins.append( - "float sinh(float angle);" - "vec2 sinh(vec2 angle);" - "vec3 sinh(vec3 angle);" - "vec4 sinh(vec4 angle);" - - "float cosh(float angle);" - "vec2 cosh(vec2 angle);" - "vec3 cosh(vec3 angle);" - "vec4 cosh(vec4 angle);" - - "float tanh(float angle);" - "vec2 tanh(vec2 angle);" - "vec3 tanh(vec3 angle);" - "vec4 tanh(vec4 angle);" - - "float asinh(float x);" - "vec2 asinh(vec2 x);" - "vec3 asinh(vec3 x);" - "vec4 asinh(vec4 x);" - - "float acosh(float x);" - "vec2 acosh(vec2 x);" - "vec3 acosh(vec3 x);" - "vec4 acosh(vec4 x);" - - "float atanh(float y_over_x);" - "vec2 atanh(vec2 y_over_x);" - "vec3 atanh(vec3 y_over_x);" - "vec4 atanh(vec4 y_over_x);" - - "\n"); - } - - // - // Exponential Functions. - // - commonBuiltins.append( - "float pow(float x, float y);" - "vec2 pow(vec2 x, vec2 y);" - "vec3 pow(vec3 x, vec3 y);" - "vec4 pow(vec4 x, vec4 y);" - - "float exp(float x);" - "vec2 exp(vec2 x);" - "vec3 exp(vec3 x);" - "vec4 exp(vec4 x);" - - "float log(float x);" - "vec2 log(vec2 x);" - "vec3 log(vec3 x);" - "vec4 log(vec4 x);" - - "float exp2(float x);" - "vec2 exp2(vec2 x);" - "vec3 exp2(vec3 x);" - "vec4 exp2(vec4 x);" - - "float log2(float x);" - "vec2 log2(vec2 x);" - "vec3 log2(vec3 x);" - "vec4 log2(vec4 x);" - - "float sqrt(float x);" - "vec2 sqrt(vec2 x);" - "vec3 sqrt(vec3 x);" - "vec4 sqrt(vec4 x);" - - "float inversesqrt(float x);" - "vec2 inversesqrt(vec2 x);" - "vec3 inversesqrt(vec3 x);" - "vec4 inversesqrt(vec4 x);" - - "\n"); - - // - // Common Functions. - // - commonBuiltins.append( - "float abs(float x);" - "vec2 abs(vec2 x);" - "vec3 abs(vec3 x);" - "vec4 abs(vec4 x);" - - "float sign(float x);" - "vec2 sign(vec2 x);" - "vec3 sign(vec3 x);" - "vec4 sign(vec4 x);" - - "float floor(float x);" - "vec2 floor(vec2 x);" - "vec3 floor(vec3 x);" - "vec4 floor(vec4 x);" - - "float ceil(float x);" - "vec2 ceil(vec2 x);" - "vec3 ceil(vec3 x);" - "vec4 ceil(vec4 x);" - - "float fract(float x);" - "vec2 fract(vec2 x);" - "vec3 fract(vec3 x);" - "vec4 fract(vec4 x);" - - "float mod(float x, float y);" - "vec2 mod(vec2 x, float y);" - "vec3 mod(vec3 x, float y);" - "vec4 mod(vec4 x, float y);" - "vec2 mod(vec2 x, vec2 y);" - "vec3 mod(vec3 x, vec3 y);" - "vec4 mod(vec4 x, vec4 y);" - - "float min(float x, float y);" - "vec2 min(vec2 x, float y);" - "vec3 min(vec3 x, float y);" - "vec4 min(vec4 x, float y);" - "vec2 min(vec2 x, vec2 y);" - "vec3 min(vec3 x, vec3 y);" - "vec4 min(vec4 x, vec4 y);" - - "float max(float x, float y);" - "vec2 max(vec2 x, float y);" - "vec3 max(vec3 x, float y);" - "vec4 max(vec4 x, float y);" - "vec2 max(vec2 x, vec2 y);" - "vec3 max(vec3 x, vec3 y);" - "vec4 max(vec4 x, vec4 y);" - - "float clamp(float x, float minVal, float maxVal);" - "vec2 clamp(vec2 x, float minVal, float maxVal);" - "vec3 clamp(vec3 x, float minVal, float maxVal);" - "vec4 clamp(vec4 x, float minVal, float maxVal);" - "vec2 clamp(vec2 x, vec2 minVal, vec2 maxVal);" - "vec3 clamp(vec3 x, vec3 minVal, vec3 maxVal);" - "vec4 clamp(vec4 x, vec4 minVal, vec4 maxVal);" - - "float mix(float x, float y, float a);" - "vec2 mix(vec2 x, vec2 y, float a);" - "vec3 mix(vec3 x, vec3 y, float a);" - "vec4 mix(vec4 x, vec4 y, float a);" - "vec2 mix(vec2 x, vec2 y, vec2 a);" - "vec3 mix(vec3 x, vec3 y, vec3 a);" - "vec4 mix(vec4 x, vec4 y, vec4 a);" - - "float step(float edge, float x);" - "vec2 step(vec2 edge, vec2 x);" - "vec3 step(vec3 edge, vec3 x);" - "vec4 step(vec4 edge, vec4 x);" - "vec2 step(float edge, vec2 x);" - "vec3 step(float edge, vec3 x);" - "vec4 step(float edge, vec4 x);" - - "float smoothstep(float edge0, float edge1, float x);" - "vec2 smoothstep(vec2 edge0, vec2 edge1, vec2 x);" - "vec3 smoothstep(vec3 edge0, vec3 edge1, vec3 x);" - "vec4 smoothstep(vec4 edge0, vec4 edge1, vec4 x);" - "vec2 smoothstep(float edge0, float edge1, vec2 x);" - "vec3 smoothstep(float edge0, float edge1, vec3 x);" - "vec4 smoothstep(float edge0, float edge1, vec4 x);" - - "\n"); - - if (version >= 130) { - commonBuiltins.append( - " int abs( int x);" - "ivec2 abs(ivec2 x);" - "ivec3 abs(ivec3 x);" - "ivec4 abs(ivec4 x);" - - " int sign( int x);" - "ivec2 sign(ivec2 x);" - "ivec3 sign(ivec3 x);" - "ivec4 sign(ivec4 x);" - - "float trunc(float x);" - "vec2 trunc(vec2 x);" - "vec3 trunc(vec3 x);" - "vec4 trunc(vec4 x);" - - "float round(float x);" - "vec2 round(vec2 x);" - "vec3 round(vec3 x);" - "vec4 round(vec4 x);" - - "float roundEven(float x);" - "vec2 roundEven(vec2 x);" - "vec3 roundEven(vec3 x);" - "vec4 roundEven(vec4 x);" - - "float modf(float, out float);" - "vec2 modf(vec2, out vec2 );" - "vec3 modf(vec3, out vec3 );" - "vec4 modf(vec4, out vec4 );" - - " int min(int x, int y);" - "ivec2 min(ivec2 x, int y);" - "ivec3 min(ivec3 x, int y);" - "ivec4 min(ivec4 x, int y);" - "ivec2 min(ivec2 x, ivec2 y);" - "ivec3 min(ivec3 x, ivec3 y);" - "ivec4 min(ivec4 x, ivec4 y);" - - " uint min(uint x, uint y);" - "uvec2 min(uvec2 x, uint y);" - "uvec3 min(uvec3 x, uint y);" - "uvec4 min(uvec4 x, uint y);" - "uvec2 min(uvec2 x, uvec2 y);" - "uvec3 min(uvec3 x, uvec3 y);" - "uvec4 min(uvec4 x, uvec4 y);" - - " int max(int x, int y);" - "ivec2 max(ivec2 x, int y);" - "ivec3 max(ivec3 x, int y);" - "ivec4 max(ivec4 x, int y);" - "ivec2 max(ivec2 x, ivec2 y);" - "ivec3 max(ivec3 x, ivec3 y);" - "ivec4 max(ivec4 x, ivec4 y);" - - " uint max(uint x, uint y);" - "uvec2 max(uvec2 x, uint y);" - "uvec3 max(uvec3 x, uint y);" - "uvec4 max(uvec4 x, uint y);" - "uvec2 max(uvec2 x, uvec2 y);" - "uvec3 max(uvec3 x, uvec3 y);" - "uvec4 max(uvec4 x, uvec4 y);" - - "int clamp(int x, int minVal, int maxVal);" - "ivec2 clamp(ivec2 x, int minVal, int maxVal);" - "ivec3 clamp(ivec3 x, int minVal, int maxVal);" - "ivec4 clamp(ivec4 x, int minVal, int maxVal);" - "ivec2 clamp(ivec2 x, ivec2 minVal, ivec2 maxVal);" - "ivec3 clamp(ivec3 x, ivec3 minVal, ivec3 maxVal);" - "ivec4 clamp(ivec4 x, ivec4 minVal, ivec4 maxVal);" - - "uint clamp(uint x, uint minVal, uint maxVal);" - "uvec2 clamp(uvec2 x, uint minVal, uint maxVal);" - "uvec3 clamp(uvec3 x, uint minVal, uint maxVal);" - "uvec4 clamp(uvec4 x, uint minVal, uint maxVal);" - "uvec2 clamp(uvec2 x, uvec2 minVal, uvec2 maxVal);" - "uvec3 clamp(uvec3 x, uvec3 minVal, uvec3 maxVal);" - "uvec4 clamp(uvec4 x, uvec4 minVal, uvec4 maxVal);" - - "float mix(float x, float y, bool a);" - "vec2 mix(vec2 x, vec2 y, bvec2 a);" - "vec3 mix(vec3 x, vec3 y, bvec3 a);" - "vec4 mix(vec4 x, vec4 y, bvec4 a);" - - "bool isnan(float x);" - "bvec2 isnan(vec2 x);" - "bvec3 isnan(vec3 x);" - "bvec4 isnan(vec4 x);" - - "bool isinf(float x);" - "bvec2 isinf(vec2 x);" - "bvec3 isinf(vec3 x);" - "bvec4 isinf(vec4 x);" - - "\n"); - } - - // // double functions added to desktop 4.00, but not fma, frexp, ldexp, or pack/unpack // - if (profile != EEsProfile && version >= 400) { + if (profile != EEsProfile && version >= 150) { // ARB_gpu_shader_fp64 commonBuiltins.append( "double sqrt(double);" @@ -959,31 +1054,30 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "bvec3 notEqual(u64vec3, u64vec3);" "bvec4 notEqual(u64vec4, u64vec4);" - "int findLSB(int64_t);" - "ivec2 findLSB(i64vec2);" - "ivec3 findLSB(i64vec3);" - "ivec4 findLSB(i64vec4);" + "int64_t findLSB(int64_t);" + "i64vec2 findLSB(i64vec2);" + "i64vec3 findLSB(i64vec3);" + "i64vec4 findLSB(i64vec4);" - "int findLSB(uint64_t);" - "ivec2 findLSB(u64vec2);" - "ivec3 findLSB(u64vec3);" - "ivec4 findLSB(u64vec4);" + "int64_t findLSB(uint64_t);" + "i64vec2 findLSB(u64vec2);" + "i64vec3 findLSB(u64vec3);" + "i64vec4 findLSB(u64vec4);" - "int findMSB(int64_t);" - "ivec2 findMSB(i64vec2);" - "ivec3 findMSB(i64vec3);" - "ivec4 findMSB(i64vec4);" + "int64_t findMSB(int64_t);" + "i64vec2 findMSB(i64vec2);" + "i64vec3 findMSB(i64vec3);" + "i64vec4 findMSB(i64vec4);" - "int findMSB(uint64_t);" - "ivec2 findMSB(u64vec2);" - "ivec3 findMSB(u64vec3);" - "ivec4 findMSB(u64vec4);" + "int64_t findMSB(uint64_t);" + "i64vec2 findMSB(u64vec2);" + "i64vec3 findMSB(u64vec3);" + "i64vec4 findMSB(u64vec4);" "\n" ); } -#ifdef AMD_EXTENSIONS // GL_AMD_shader_trinary_minmax if (profile != EEsProfile && version >= 430) { commonBuiltins.append( @@ -1080,48 +1174,31 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n" ); } -#endif if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 430)) { commonBuiltins.append( - "uint atomicAdd(coherent volatile inout uint, uint);" - " int atomicAdd(coherent volatile inout int, int);" "uint atomicAdd(coherent volatile inout uint, uint, int, int, int);" " int atomicAdd(coherent volatile inout int, int, int, int, int);" - "uint atomicMin(coherent volatile inout uint, uint);" - " int atomicMin(coherent volatile inout int, int);" "uint atomicMin(coherent volatile inout uint, uint, int, int, int);" " int atomicMin(coherent volatile inout int, int, int, int, int);" - "uint atomicMax(coherent volatile inout uint, uint);" - " int atomicMax(coherent volatile inout int, int);" "uint atomicMax(coherent volatile inout uint, uint, int, int, int);" " int atomicMax(coherent volatile inout int, int, int, int, int);" - "uint atomicAnd(coherent volatile inout uint, uint);" - " int atomicAnd(coherent volatile inout int, int);" "uint atomicAnd(coherent volatile inout uint, uint, int, int, int);" " int atomicAnd(coherent volatile inout int, int, int, int, int);" - "uint atomicOr (coherent volatile inout uint, uint);" - " int atomicOr (coherent volatile inout int, int);" "uint atomicOr (coherent volatile inout uint, uint, int, int, int);" " int atomicOr (coherent volatile inout int, int, int, int, int);" - "uint atomicXor(coherent volatile inout uint, uint);" - " int atomicXor(coherent volatile inout int, int);" "uint atomicXor(coherent volatile inout uint, uint, int, int, int);" " int atomicXor(coherent volatile inout int, int, int, int, int);" - "uint atomicExchange(coherent volatile inout uint, uint);" - " int atomicExchange(coherent volatile inout int, int);" "uint atomicExchange(coherent volatile inout uint, uint, int, int, int);" " int atomicExchange(coherent volatile inout int, int, int, int, int);" - "uint atomicCompSwap(coherent volatile inout uint, uint, uint);" - " int atomicCompSwap(coherent volatile inout int, int, int);" "uint atomicCompSwap(coherent volatile inout uint, uint, uint, int, int, int, int, int);" " int atomicCompSwap(coherent volatile inout int, int, int, int, int, int, int, int);" @@ -1183,27 +1260,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "void atomicStore(coherent volatile out int64_t, int64_t, int, int, int);" "\n"); } - - if ((profile == EEsProfile && version >= 310) || - (profile != EEsProfile && version >= 450)) { - commonBuiltins.append( - "int mix(int x, int y, bool a);" - "ivec2 mix(ivec2 x, ivec2 y, bvec2 a);" - "ivec3 mix(ivec3 x, ivec3 y, bvec3 a);" - "ivec4 mix(ivec4 x, ivec4 y, bvec4 a);" - - "uint mix(uint x, uint y, bool a);" - "uvec2 mix(uvec2 x, uvec2 y, bvec2 a);" - "uvec3 mix(uvec3 x, uvec3 y, bvec3 a);" - "uvec4 mix(uvec4 x, uvec4 y, bvec4 a);" - - "bool mix(bool x, bool y, bool a);" - "bvec2 mix(bvec2 x, bvec2 y, bvec2 a);" - "bvec3 mix(bvec3 x, bvec3 y, bvec3 a);" - "bvec4 mix(bvec4 x, bvec4 y, bvec4 a);" - - "\n"); - } +#endif if ((profile == EEsProfile && version >= 300) || (profile != EEsProfile && version >= 330)) { @@ -1231,6 +1288,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } +#ifndef GLSLANG_WEB if ((profile != EEsProfile && version >= 400) || (profile == EEsProfile && version >= 310)) { // GL_OES_gpu_shader5 @@ -1240,15 +1298,15 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "vec3 fma(vec3, vec3, vec3 );" "vec4 fma(vec4, vec4, vec4 );" "\n"); + } - if (profile != EEsProfile) { + if (profile != EEsProfile && version >= 150) { // ARB_gpu_shader_fp64 commonBuiltins.append( "double fma(double, double, double);" "dvec2 fma(dvec2, dvec2, dvec2 );" "dvec3 fma(dvec3, dvec3, dvec3 );" "dvec4 fma(dvec4, dvec4, dvec4 );" "\n"); - } } if ((profile == EEsProfile && version >= 310) || @@ -1267,7 +1325,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } - if (profile != EEsProfile && version >= 400) { + if (profile != EEsProfile && version >= 150) { // ARB_gpu_shader_fp64 commonBuiltins.append( "double frexp(double, out int);" "dvec2 frexp( dvec2, out ivec2);" @@ -1284,6 +1342,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } +#endif if ((profile == EEsProfile && version >= 300) || (profile != EEsProfile && version >= 400)) { @@ -1312,6 +1371,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } +#ifndef GLSLANG_WEB if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 400)) { commonBuiltins.append( @@ -1331,48 +1391,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "vec4 unpackUnorm4x8(highp uint);" "\n"); } - - // - // Geometric Functions. - // - commonBuiltins.append( - "float length(float x);" - "float length(vec2 x);" - "float length(vec3 x);" - "float length(vec4 x);" - - "float distance(float p0, float p1);" - "float distance(vec2 p0, vec2 p1);" - "float distance(vec3 p0, vec3 p1);" - "float distance(vec4 p0, vec4 p1);" - - "float dot(float x, float y);" - "float dot(vec2 x, vec2 y);" - "float dot(vec3 x, vec3 y);" - "float dot(vec4 x, vec4 y);" - - "vec3 cross(vec3 x, vec3 y);" - "float normalize(float x);" - "vec2 normalize(vec2 x);" - "vec3 normalize(vec3 x);" - "vec4 normalize(vec4 x);" - - "float faceforward(float N, float I, float Nref);" - "vec2 faceforward(vec2 N, vec2 I, vec2 Nref);" - "vec3 faceforward(vec3 N, vec3 I, vec3 Nref);" - "vec4 faceforward(vec4 N, vec4 I, vec4 Nref);" - - "float reflect(float I, float N);" - "vec2 reflect(vec2 I, vec2 N);" - "vec3 reflect(vec3 I, vec3 N);" - "vec4 reflect(vec4 I, vec4 N);" - - "float refract(float I, float N, float eta);" - "vec2 refract(vec2 I, vec2 N, float eta);" - "vec3 refract(vec3 I, vec3 N, float eta);" - "vec4 refract(vec4 I, vec4 N, float eta);" - - "\n"); +#endif // // Matrix Functions. @@ -1431,109 +1450,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV } } - // - // Vector relational functions. - // - commonBuiltins.append( - "bvec2 lessThan(vec2 x, vec2 y);" - "bvec3 lessThan(vec3 x, vec3 y);" - "bvec4 lessThan(vec4 x, vec4 y);" - - "bvec2 lessThan(ivec2 x, ivec2 y);" - "bvec3 lessThan(ivec3 x, ivec3 y);" - "bvec4 lessThan(ivec4 x, ivec4 y);" - - "bvec2 lessThanEqual(vec2 x, vec2 y);" - "bvec3 lessThanEqual(vec3 x, vec3 y);" - "bvec4 lessThanEqual(vec4 x, vec4 y);" - - "bvec2 lessThanEqual(ivec2 x, ivec2 y);" - "bvec3 lessThanEqual(ivec3 x, ivec3 y);" - "bvec4 lessThanEqual(ivec4 x, ivec4 y);" - - "bvec2 greaterThan(vec2 x, vec2 y);" - "bvec3 greaterThan(vec3 x, vec3 y);" - "bvec4 greaterThan(vec4 x, vec4 y);" - - "bvec2 greaterThan(ivec2 x, ivec2 y);" - "bvec3 greaterThan(ivec3 x, ivec3 y);" - "bvec4 greaterThan(ivec4 x, ivec4 y);" - - "bvec2 greaterThanEqual(vec2 x, vec2 y);" - "bvec3 greaterThanEqual(vec3 x, vec3 y);" - "bvec4 greaterThanEqual(vec4 x, vec4 y);" - - "bvec2 greaterThanEqual(ivec2 x, ivec2 y);" - "bvec3 greaterThanEqual(ivec3 x, ivec3 y);" - "bvec4 greaterThanEqual(ivec4 x, ivec4 y);" - - "bvec2 equal(vec2 x, vec2 y);" - "bvec3 equal(vec3 x, vec3 y);" - "bvec4 equal(vec4 x, vec4 y);" - - "bvec2 equal(ivec2 x, ivec2 y);" - "bvec3 equal(ivec3 x, ivec3 y);" - "bvec4 equal(ivec4 x, ivec4 y);" - - "bvec2 equal(bvec2 x, bvec2 y);" - "bvec3 equal(bvec3 x, bvec3 y);" - "bvec4 equal(bvec4 x, bvec4 y);" - - "bvec2 notEqual(vec2 x, vec2 y);" - "bvec3 notEqual(vec3 x, vec3 y);" - "bvec4 notEqual(vec4 x, vec4 y);" - - "bvec2 notEqual(ivec2 x, ivec2 y);" - "bvec3 notEqual(ivec3 x, ivec3 y);" - "bvec4 notEqual(ivec4 x, ivec4 y);" - - "bvec2 notEqual(bvec2 x, bvec2 y);" - "bvec3 notEqual(bvec3 x, bvec3 y);" - "bvec4 notEqual(bvec4 x, bvec4 y);" - - "bool any(bvec2 x);" - "bool any(bvec3 x);" - "bool any(bvec4 x);" - - "bool all(bvec2 x);" - "bool all(bvec3 x);" - "bool all(bvec4 x);" - - "bvec2 not(bvec2 x);" - "bvec3 not(bvec3 x);" - "bvec4 not(bvec4 x);" - - "\n"); - - if (version >= 130) { - commonBuiltins.append( - "bvec2 lessThan(uvec2 x, uvec2 y);" - "bvec3 lessThan(uvec3 x, uvec3 y);" - "bvec4 lessThan(uvec4 x, uvec4 y);" - - "bvec2 lessThanEqual(uvec2 x, uvec2 y);" - "bvec3 lessThanEqual(uvec3 x, uvec3 y);" - "bvec4 lessThanEqual(uvec4 x, uvec4 y);" - - "bvec2 greaterThan(uvec2 x, uvec2 y);" - "bvec3 greaterThan(uvec3 x, uvec3 y);" - "bvec4 greaterThan(uvec4 x, uvec4 y);" - - "bvec2 greaterThanEqual(uvec2 x, uvec2 y);" - "bvec3 greaterThanEqual(uvec3 x, uvec3 y);" - "bvec4 greaterThanEqual(uvec4 x, uvec4 y);" - - "bvec2 equal(uvec2 x, uvec2 y);" - "bvec3 equal(uvec3 x, uvec3 y);" - "bvec4 equal(uvec4 x, uvec4 y);" - - "bvec2 notEqual(uvec2 x, uvec2 y);" - "bvec3 notEqual(uvec3 x, uvec3 y);" - "bvec4 notEqual(uvec4 x, uvec4 y);" - - "\n"); - } - +#ifndef GLSLANG_WEB // // Original-style texture functions existing in all stages. // (Per-stage functions below.) @@ -1884,58 +1801,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "bool subgroupAll(bool);\n" "bool subgroupAny(bool);\n" - - "bool subgroupAllEqual(float);\n" - "bool subgroupAllEqual(vec2);\n" - "bool subgroupAllEqual(vec3);\n" - "bool subgroupAllEqual(vec4);\n" - "bool subgroupAllEqual(int);\n" - "bool subgroupAllEqual(ivec2);\n" - "bool subgroupAllEqual(ivec3);\n" - "bool subgroupAllEqual(ivec4);\n" - "bool subgroupAllEqual(uint);\n" - "bool subgroupAllEqual(uvec2);\n" - "bool subgroupAllEqual(uvec3);\n" - "bool subgroupAllEqual(uvec4);\n" - "bool subgroupAllEqual(bool);\n" - "bool subgroupAllEqual(bvec2);\n" - "bool subgroupAllEqual(bvec3);\n" - "bool subgroupAllEqual(bvec4);\n" - - "float subgroupBroadcast(float, uint);\n" - "vec2 subgroupBroadcast(vec2, uint);\n" - "vec3 subgroupBroadcast(vec3, uint);\n" - "vec4 subgroupBroadcast(vec4, uint);\n" - "int subgroupBroadcast(int, uint);\n" - "ivec2 subgroupBroadcast(ivec2, uint);\n" - "ivec3 subgroupBroadcast(ivec3, uint);\n" - "ivec4 subgroupBroadcast(ivec4, uint);\n" - "uint subgroupBroadcast(uint, uint);\n" - "uvec2 subgroupBroadcast(uvec2, uint);\n" - "uvec3 subgroupBroadcast(uvec3, uint);\n" - "uvec4 subgroupBroadcast(uvec4, uint);\n" - "bool subgroupBroadcast(bool, uint);\n" - "bvec2 subgroupBroadcast(bvec2, uint);\n" - "bvec3 subgroupBroadcast(bvec3, uint);\n" - "bvec4 subgroupBroadcast(bvec4, uint);\n" - - "float subgroupBroadcastFirst(float);\n" - "vec2 subgroupBroadcastFirst(vec2);\n" - "vec3 subgroupBroadcastFirst(vec3);\n" - "vec4 subgroupBroadcastFirst(vec4);\n" - "int subgroupBroadcastFirst(int);\n" - "ivec2 subgroupBroadcastFirst(ivec2);\n" - "ivec3 subgroupBroadcastFirst(ivec3);\n" - "ivec4 subgroupBroadcastFirst(ivec4);\n" - "uint subgroupBroadcastFirst(uint);\n" - "uvec2 subgroupBroadcastFirst(uvec2);\n" - "uvec3 subgroupBroadcastFirst(uvec3);\n" - "uvec4 subgroupBroadcastFirst(uvec4);\n" - "bool subgroupBroadcastFirst(bool);\n" - "bvec2 subgroupBroadcastFirst(bvec2);\n" - "bvec3 subgroupBroadcastFirst(bvec3);\n" - "bvec4 subgroupBroadcastFirst(bvec4);\n" - "uvec4 subgroupBallot(bool);\n" "bool subgroupInverseBallot(uvec4);\n" "bool subgroupBallotBitExtract(uvec4, uint);\n" @@ -1944,1015 +1809,136 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "uint subgroupBallotExclusiveBitCount(uvec4);\n" "uint subgroupBallotFindLSB(uvec4);\n" "uint subgroupBallotFindMSB(uvec4);\n" + ); - "float subgroupShuffle(float, uint);\n" - "vec2 subgroupShuffle(vec2, uint);\n" - "vec3 subgroupShuffle(vec3, uint);\n" - "vec4 subgroupShuffle(vec4, uint);\n" - "int subgroupShuffle(int, uint);\n" - "ivec2 subgroupShuffle(ivec2, uint);\n" - "ivec3 subgroupShuffle(ivec3, uint);\n" - "ivec4 subgroupShuffle(ivec4, uint);\n" - "uint subgroupShuffle(uint, uint);\n" - "uvec2 subgroupShuffle(uvec2, uint);\n" - "uvec3 subgroupShuffle(uvec3, uint);\n" - "uvec4 subgroupShuffle(uvec4, uint);\n" - "bool subgroupShuffle(bool, uint);\n" - "bvec2 subgroupShuffle(bvec2, uint);\n" - "bvec3 subgroupShuffle(bvec3, uint);\n" - "bvec4 subgroupShuffle(bvec4, uint);\n" - - "float subgroupShuffleXor(float, uint);\n" - "vec2 subgroupShuffleXor(vec2, uint);\n" - "vec3 subgroupShuffleXor(vec3, uint);\n" - "vec4 subgroupShuffleXor(vec4, uint);\n" - "int subgroupShuffleXor(int, uint);\n" - "ivec2 subgroupShuffleXor(ivec2, uint);\n" - "ivec3 subgroupShuffleXor(ivec3, uint);\n" - "ivec4 subgroupShuffleXor(ivec4, uint);\n" - "uint subgroupShuffleXor(uint, uint);\n" - "uvec2 subgroupShuffleXor(uvec2, uint);\n" - "uvec3 subgroupShuffleXor(uvec3, uint);\n" - "uvec4 subgroupShuffleXor(uvec4, uint);\n" - "bool subgroupShuffleXor(bool, uint);\n" - "bvec2 subgroupShuffleXor(bvec2, uint);\n" - "bvec3 subgroupShuffleXor(bvec3, uint);\n" - "bvec4 subgroupShuffleXor(bvec4, uint);\n" - - "float subgroupShuffleUp(float, uint delta);\n" - "vec2 subgroupShuffleUp(vec2, uint delta);\n" - "vec3 subgroupShuffleUp(vec3, uint delta);\n" - "vec4 subgroupShuffleUp(vec4, uint delta);\n" - "int subgroupShuffleUp(int, uint delta);\n" - "ivec2 subgroupShuffleUp(ivec2, uint delta);\n" - "ivec3 subgroupShuffleUp(ivec3, uint delta);\n" - "ivec4 subgroupShuffleUp(ivec4, uint delta);\n" - "uint subgroupShuffleUp(uint, uint delta);\n" - "uvec2 subgroupShuffleUp(uvec2, uint delta);\n" - "uvec3 subgroupShuffleUp(uvec3, uint delta);\n" - "uvec4 subgroupShuffleUp(uvec4, uint delta);\n" - "bool subgroupShuffleUp(bool, uint delta);\n" - "bvec2 subgroupShuffleUp(bvec2, uint delta);\n" - "bvec3 subgroupShuffleUp(bvec3, uint delta);\n" - "bvec4 subgroupShuffleUp(bvec4, uint delta);\n" - - "float subgroupShuffleDown(float, uint delta);\n" - "vec2 subgroupShuffleDown(vec2, uint delta);\n" - "vec3 subgroupShuffleDown(vec3, uint delta);\n" - "vec4 subgroupShuffleDown(vec4, uint delta);\n" - "int subgroupShuffleDown(int, uint delta);\n" - "ivec2 subgroupShuffleDown(ivec2, uint delta);\n" - "ivec3 subgroupShuffleDown(ivec3, uint delta);\n" - "ivec4 subgroupShuffleDown(ivec4, uint delta);\n" - "uint subgroupShuffleDown(uint, uint delta);\n" - "uvec2 subgroupShuffleDown(uvec2, uint delta);\n" - "uvec3 subgroupShuffleDown(uvec3, uint delta);\n" - "uvec4 subgroupShuffleDown(uvec4, uint delta);\n" - "bool subgroupShuffleDown(bool, uint delta);\n" - "bvec2 subgroupShuffleDown(bvec2, uint delta);\n" - "bvec3 subgroupShuffleDown(bvec3, uint delta);\n" - "bvec4 subgroupShuffleDown(bvec4, uint delta);\n" - - "float subgroupAdd(float);\n" - "vec2 subgroupAdd(vec2);\n" - "vec3 subgroupAdd(vec3);\n" - "vec4 subgroupAdd(vec4);\n" - "int subgroupAdd(int);\n" - "ivec2 subgroupAdd(ivec2);\n" - "ivec3 subgroupAdd(ivec3);\n" - "ivec4 subgroupAdd(ivec4);\n" - "uint subgroupAdd(uint);\n" - "uvec2 subgroupAdd(uvec2);\n" - "uvec3 subgroupAdd(uvec3);\n" - "uvec4 subgroupAdd(uvec4);\n" - - "float subgroupMul(float);\n" - "vec2 subgroupMul(vec2);\n" - "vec3 subgroupMul(vec3);\n" - "vec4 subgroupMul(vec4);\n" - "int subgroupMul(int);\n" - "ivec2 subgroupMul(ivec2);\n" - "ivec3 subgroupMul(ivec3);\n" - "ivec4 subgroupMul(ivec4);\n" - "uint subgroupMul(uint);\n" - "uvec2 subgroupMul(uvec2);\n" - "uvec3 subgroupMul(uvec3);\n" - "uvec4 subgroupMul(uvec4);\n" - - "float subgroupMin(float);\n" - "vec2 subgroupMin(vec2);\n" - "vec3 subgroupMin(vec3);\n" - "vec4 subgroupMin(vec4);\n" - "int subgroupMin(int);\n" - "ivec2 subgroupMin(ivec2);\n" - "ivec3 subgroupMin(ivec3);\n" - "ivec4 subgroupMin(ivec4);\n" - "uint subgroupMin(uint);\n" - "uvec2 subgroupMin(uvec2);\n" - "uvec3 subgroupMin(uvec3);\n" - "uvec4 subgroupMin(uvec4);\n" - - "float subgroupMax(float);\n" - "vec2 subgroupMax(vec2);\n" - "vec3 subgroupMax(vec3);\n" - "vec4 subgroupMax(vec4);\n" - "int subgroupMax(int);\n" - "ivec2 subgroupMax(ivec2);\n" - "ivec3 subgroupMax(ivec3);\n" - "ivec4 subgroupMax(ivec4);\n" - "uint subgroupMax(uint);\n" - "uvec2 subgroupMax(uvec2);\n" - "uvec3 subgroupMax(uvec3);\n" - "uvec4 subgroupMax(uvec4);\n" - - "int subgroupAnd(int);\n" - "ivec2 subgroupAnd(ivec2);\n" - "ivec3 subgroupAnd(ivec3);\n" - "ivec4 subgroupAnd(ivec4);\n" - "uint subgroupAnd(uint);\n" - "uvec2 subgroupAnd(uvec2);\n" - "uvec3 subgroupAnd(uvec3);\n" - "uvec4 subgroupAnd(uvec4);\n" - "bool subgroupAnd(bool);\n" - "bvec2 subgroupAnd(bvec2);\n" - "bvec3 subgroupAnd(bvec3);\n" - "bvec4 subgroupAnd(bvec4);\n" - - "int subgroupOr(int);\n" - "ivec2 subgroupOr(ivec2);\n" - "ivec3 subgroupOr(ivec3);\n" - "ivec4 subgroupOr(ivec4);\n" - "uint subgroupOr(uint);\n" - "uvec2 subgroupOr(uvec2);\n" - "uvec3 subgroupOr(uvec3);\n" - "uvec4 subgroupOr(uvec4);\n" - "bool subgroupOr(bool);\n" - "bvec2 subgroupOr(bvec2);\n" - "bvec3 subgroupOr(bvec3);\n" - "bvec4 subgroupOr(bvec4);\n" - - "int subgroupXor(int);\n" - "ivec2 subgroupXor(ivec2);\n" - "ivec3 subgroupXor(ivec3);\n" - "ivec4 subgroupXor(ivec4);\n" - "uint subgroupXor(uint);\n" - "uvec2 subgroupXor(uvec2);\n" - "uvec3 subgroupXor(uvec3);\n" - "uvec4 subgroupXor(uvec4);\n" - "bool subgroupXor(bool);\n" - "bvec2 subgroupXor(bvec2);\n" - "bvec3 subgroupXor(bvec3);\n" - "bvec4 subgroupXor(bvec4);\n" - - "float subgroupInclusiveAdd(float);\n" - "vec2 subgroupInclusiveAdd(vec2);\n" - "vec3 subgroupInclusiveAdd(vec3);\n" - "vec4 subgroupInclusiveAdd(vec4);\n" - "int subgroupInclusiveAdd(int);\n" - "ivec2 subgroupInclusiveAdd(ivec2);\n" - "ivec3 subgroupInclusiveAdd(ivec3);\n" - "ivec4 subgroupInclusiveAdd(ivec4);\n" - "uint subgroupInclusiveAdd(uint);\n" - "uvec2 subgroupInclusiveAdd(uvec2);\n" - "uvec3 subgroupInclusiveAdd(uvec3);\n" - "uvec4 subgroupInclusiveAdd(uvec4);\n" - - "float subgroupInclusiveMul(float);\n" - "vec2 subgroupInclusiveMul(vec2);\n" - "vec3 subgroupInclusiveMul(vec3);\n" - "vec4 subgroupInclusiveMul(vec4);\n" - "int subgroupInclusiveMul(int);\n" - "ivec2 subgroupInclusiveMul(ivec2);\n" - "ivec3 subgroupInclusiveMul(ivec3);\n" - "ivec4 subgroupInclusiveMul(ivec4);\n" - "uint subgroupInclusiveMul(uint);\n" - "uvec2 subgroupInclusiveMul(uvec2);\n" - "uvec3 subgroupInclusiveMul(uvec3);\n" - "uvec4 subgroupInclusiveMul(uvec4);\n" - - "float subgroupInclusiveMin(float);\n" - "vec2 subgroupInclusiveMin(vec2);\n" - "vec3 subgroupInclusiveMin(vec3);\n" - "vec4 subgroupInclusiveMin(vec4);\n" - "int subgroupInclusiveMin(int);\n" - "ivec2 subgroupInclusiveMin(ivec2);\n" - "ivec3 subgroupInclusiveMin(ivec3);\n" - "ivec4 subgroupInclusiveMin(ivec4);\n" - "uint subgroupInclusiveMin(uint);\n" - "uvec2 subgroupInclusiveMin(uvec2);\n" - "uvec3 subgroupInclusiveMin(uvec3);\n" - "uvec4 subgroupInclusiveMin(uvec4);\n" - - "float subgroupInclusiveMax(float);\n" - "vec2 subgroupInclusiveMax(vec2);\n" - "vec3 subgroupInclusiveMax(vec3);\n" - "vec4 subgroupInclusiveMax(vec4);\n" - "int subgroupInclusiveMax(int);\n" - "ivec2 subgroupInclusiveMax(ivec2);\n" - "ivec3 subgroupInclusiveMax(ivec3);\n" - "ivec4 subgroupInclusiveMax(ivec4);\n" - "uint subgroupInclusiveMax(uint);\n" - "uvec2 subgroupInclusiveMax(uvec2);\n" - "uvec3 subgroupInclusiveMax(uvec3);\n" - "uvec4 subgroupInclusiveMax(uvec4);\n" - - "int subgroupInclusiveAnd(int);\n" - "ivec2 subgroupInclusiveAnd(ivec2);\n" - "ivec3 subgroupInclusiveAnd(ivec3);\n" - "ivec4 subgroupInclusiveAnd(ivec4);\n" - "uint subgroupInclusiveAnd(uint);\n" - "uvec2 subgroupInclusiveAnd(uvec2);\n" - "uvec3 subgroupInclusiveAnd(uvec3);\n" - "uvec4 subgroupInclusiveAnd(uvec4);\n" - "bool subgroupInclusiveAnd(bool);\n" - "bvec2 subgroupInclusiveAnd(bvec2);\n" - "bvec3 subgroupInclusiveAnd(bvec3);\n" - "bvec4 subgroupInclusiveAnd(bvec4);\n" - - "int subgroupInclusiveOr(int);\n" - "ivec2 subgroupInclusiveOr(ivec2);\n" - "ivec3 subgroupInclusiveOr(ivec3);\n" - "ivec4 subgroupInclusiveOr(ivec4);\n" - "uint subgroupInclusiveOr(uint);\n" - "uvec2 subgroupInclusiveOr(uvec2);\n" - "uvec3 subgroupInclusiveOr(uvec3);\n" - "uvec4 subgroupInclusiveOr(uvec4);\n" - "bool subgroupInclusiveOr(bool);\n" - "bvec2 subgroupInclusiveOr(bvec2);\n" - "bvec3 subgroupInclusiveOr(bvec3);\n" - "bvec4 subgroupInclusiveOr(bvec4);\n" - - "int subgroupInclusiveXor(int);\n" - "ivec2 subgroupInclusiveXor(ivec2);\n" - "ivec3 subgroupInclusiveXor(ivec3);\n" - "ivec4 subgroupInclusiveXor(ivec4);\n" - "uint subgroupInclusiveXor(uint);\n" - "uvec2 subgroupInclusiveXor(uvec2);\n" - "uvec3 subgroupInclusiveXor(uvec3);\n" - "uvec4 subgroupInclusiveXor(uvec4);\n" - "bool subgroupInclusiveXor(bool);\n" - "bvec2 subgroupInclusiveXor(bvec2);\n" - "bvec3 subgroupInclusiveXor(bvec3);\n" - "bvec4 subgroupInclusiveXor(bvec4);\n" - - "float subgroupExclusiveAdd(float);\n" - "vec2 subgroupExclusiveAdd(vec2);\n" - "vec3 subgroupExclusiveAdd(vec3);\n" - "vec4 subgroupExclusiveAdd(vec4);\n" - "int subgroupExclusiveAdd(int);\n" - "ivec2 subgroupExclusiveAdd(ivec2);\n" - "ivec3 subgroupExclusiveAdd(ivec3);\n" - "ivec4 subgroupExclusiveAdd(ivec4);\n" - "uint subgroupExclusiveAdd(uint);\n" - "uvec2 subgroupExclusiveAdd(uvec2);\n" - "uvec3 subgroupExclusiveAdd(uvec3);\n" - "uvec4 subgroupExclusiveAdd(uvec4);\n" - - "float subgroupExclusiveMul(float);\n" - "vec2 subgroupExclusiveMul(vec2);\n" - "vec3 subgroupExclusiveMul(vec3);\n" - "vec4 subgroupExclusiveMul(vec4);\n" - "int subgroupExclusiveMul(int);\n" - "ivec2 subgroupExclusiveMul(ivec2);\n" - "ivec3 subgroupExclusiveMul(ivec3);\n" - "ivec4 subgroupExclusiveMul(ivec4);\n" - "uint subgroupExclusiveMul(uint);\n" - "uvec2 subgroupExclusiveMul(uvec2);\n" - "uvec3 subgroupExclusiveMul(uvec3);\n" - "uvec4 subgroupExclusiveMul(uvec4);\n" - - "float subgroupExclusiveMin(float);\n" - "vec2 subgroupExclusiveMin(vec2);\n" - "vec3 subgroupExclusiveMin(vec3);\n" - "vec4 subgroupExclusiveMin(vec4);\n" - "int subgroupExclusiveMin(int);\n" - "ivec2 subgroupExclusiveMin(ivec2);\n" - "ivec3 subgroupExclusiveMin(ivec3);\n" - "ivec4 subgroupExclusiveMin(ivec4);\n" - "uint subgroupExclusiveMin(uint);\n" - "uvec2 subgroupExclusiveMin(uvec2);\n" - "uvec3 subgroupExclusiveMin(uvec3);\n" - "uvec4 subgroupExclusiveMin(uvec4);\n" - - "float subgroupExclusiveMax(float);\n" - "vec2 subgroupExclusiveMax(vec2);\n" - "vec3 subgroupExclusiveMax(vec3);\n" - "vec4 subgroupExclusiveMax(vec4);\n" - "int subgroupExclusiveMax(int);\n" - "ivec2 subgroupExclusiveMax(ivec2);\n" - "ivec3 subgroupExclusiveMax(ivec3);\n" - "ivec4 subgroupExclusiveMax(ivec4);\n" - "uint subgroupExclusiveMax(uint);\n" - "uvec2 subgroupExclusiveMax(uvec2);\n" - "uvec3 subgroupExclusiveMax(uvec3);\n" - "uvec4 subgroupExclusiveMax(uvec4);\n" - - "int subgroupExclusiveAnd(int);\n" - "ivec2 subgroupExclusiveAnd(ivec2);\n" - "ivec3 subgroupExclusiveAnd(ivec3);\n" - "ivec4 subgroupExclusiveAnd(ivec4);\n" - "uint subgroupExclusiveAnd(uint);\n" - "uvec2 subgroupExclusiveAnd(uvec2);\n" - "uvec3 subgroupExclusiveAnd(uvec3);\n" - "uvec4 subgroupExclusiveAnd(uvec4);\n" - "bool subgroupExclusiveAnd(bool);\n" - "bvec2 subgroupExclusiveAnd(bvec2);\n" - "bvec3 subgroupExclusiveAnd(bvec3);\n" - "bvec4 subgroupExclusiveAnd(bvec4);\n" - - "int subgroupExclusiveOr(int);\n" - "ivec2 subgroupExclusiveOr(ivec2);\n" - "ivec3 subgroupExclusiveOr(ivec3);\n" - "ivec4 subgroupExclusiveOr(ivec4);\n" - "uint subgroupExclusiveOr(uint);\n" - "uvec2 subgroupExclusiveOr(uvec2);\n" - "uvec3 subgroupExclusiveOr(uvec3);\n" - "uvec4 subgroupExclusiveOr(uvec4);\n" - "bool subgroupExclusiveOr(bool);\n" - "bvec2 subgroupExclusiveOr(bvec2);\n" - "bvec3 subgroupExclusiveOr(bvec3);\n" - "bvec4 subgroupExclusiveOr(bvec4);\n" - - "int subgroupExclusiveXor(int);\n" - "ivec2 subgroupExclusiveXor(ivec2);\n" - "ivec3 subgroupExclusiveXor(ivec3);\n" - "ivec4 subgroupExclusiveXor(ivec4);\n" - "uint subgroupExclusiveXor(uint);\n" - "uvec2 subgroupExclusiveXor(uvec2);\n" - "uvec3 subgroupExclusiveXor(uvec3);\n" - "uvec4 subgroupExclusiveXor(uvec4);\n" - "bool subgroupExclusiveXor(bool);\n" - "bvec2 subgroupExclusiveXor(bvec2);\n" - "bvec3 subgroupExclusiveXor(bvec3);\n" - "bvec4 subgroupExclusiveXor(bvec4);\n" - - "float subgroupClusteredAdd(float, uint);\n" - "vec2 subgroupClusteredAdd(vec2, uint);\n" - "vec3 subgroupClusteredAdd(vec3, uint);\n" - "vec4 subgroupClusteredAdd(vec4, uint);\n" - "int subgroupClusteredAdd(int, uint);\n" - "ivec2 subgroupClusteredAdd(ivec2, uint);\n" - "ivec3 subgroupClusteredAdd(ivec3, uint);\n" - "ivec4 subgroupClusteredAdd(ivec4, uint);\n" - "uint subgroupClusteredAdd(uint, uint);\n" - "uvec2 subgroupClusteredAdd(uvec2, uint);\n" - "uvec3 subgroupClusteredAdd(uvec3, uint);\n" - "uvec4 subgroupClusteredAdd(uvec4, uint);\n" - - "float subgroupClusteredMul(float, uint);\n" - "vec2 subgroupClusteredMul(vec2, uint);\n" - "vec3 subgroupClusteredMul(vec3, uint);\n" - "vec4 subgroupClusteredMul(vec4, uint);\n" - "int subgroupClusteredMul(int, uint);\n" - "ivec2 subgroupClusteredMul(ivec2, uint);\n" - "ivec3 subgroupClusteredMul(ivec3, uint);\n" - "ivec4 subgroupClusteredMul(ivec4, uint);\n" - "uint subgroupClusteredMul(uint, uint);\n" - "uvec2 subgroupClusteredMul(uvec2, uint);\n" - "uvec3 subgroupClusteredMul(uvec3, uint);\n" - "uvec4 subgroupClusteredMul(uvec4, uint);\n" - - "float subgroupClusteredMin(float, uint);\n" - "vec2 subgroupClusteredMin(vec2, uint);\n" - "vec3 subgroupClusteredMin(vec3, uint);\n" - "vec4 subgroupClusteredMin(vec4, uint);\n" - "int subgroupClusteredMin(int, uint);\n" - "ivec2 subgroupClusteredMin(ivec2, uint);\n" - "ivec3 subgroupClusteredMin(ivec3, uint);\n" - "ivec4 subgroupClusteredMin(ivec4, uint);\n" - "uint subgroupClusteredMin(uint, uint);\n" - "uvec2 subgroupClusteredMin(uvec2, uint);\n" - "uvec3 subgroupClusteredMin(uvec3, uint);\n" - "uvec4 subgroupClusteredMin(uvec4, uint);\n" - - "float subgroupClusteredMax(float, uint);\n" - "vec2 subgroupClusteredMax(vec2, uint);\n" - "vec3 subgroupClusteredMax(vec3, uint);\n" - "vec4 subgroupClusteredMax(vec4, uint);\n" - "int subgroupClusteredMax(int, uint);\n" - "ivec2 subgroupClusteredMax(ivec2, uint);\n" - "ivec3 subgroupClusteredMax(ivec3, uint);\n" - "ivec4 subgroupClusteredMax(ivec4, uint);\n" - "uint subgroupClusteredMax(uint, uint);\n" - "uvec2 subgroupClusteredMax(uvec2, uint);\n" - "uvec3 subgroupClusteredMax(uvec3, uint);\n" - "uvec4 subgroupClusteredMax(uvec4, uint);\n" - - "int subgroupClusteredAnd(int, uint);\n" - "ivec2 subgroupClusteredAnd(ivec2, uint);\n" - "ivec3 subgroupClusteredAnd(ivec3, uint);\n" - "ivec4 subgroupClusteredAnd(ivec4, uint);\n" - "uint subgroupClusteredAnd(uint, uint);\n" - "uvec2 subgroupClusteredAnd(uvec2, uint);\n" - "uvec3 subgroupClusteredAnd(uvec3, uint);\n" - "uvec4 subgroupClusteredAnd(uvec4, uint);\n" - "bool subgroupClusteredAnd(bool, uint);\n" - "bvec2 subgroupClusteredAnd(bvec2, uint);\n" - "bvec3 subgroupClusteredAnd(bvec3, uint);\n" - "bvec4 subgroupClusteredAnd(bvec4, uint);\n" - - "int subgroupClusteredOr(int, uint);\n" - "ivec2 subgroupClusteredOr(ivec2, uint);\n" - "ivec3 subgroupClusteredOr(ivec3, uint);\n" - "ivec4 subgroupClusteredOr(ivec4, uint);\n" - "uint subgroupClusteredOr(uint, uint);\n" - "uvec2 subgroupClusteredOr(uvec2, uint);\n" - "uvec3 subgroupClusteredOr(uvec3, uint);\n" - "uvec4 subgroupClusteredOr(uvec4, uint);\n" - "bool subgroupClusteredOr(bool, uint);\n" - "bvec2 subgroupClusteredOr(bvec2, uint);\n" - "bvec3 subgroupClusteredOr(bvec3, uint);\n" - "bvec4 subgroupClusteredOr(bvec4, uint);\n" - - "int subgroupClusteredXor(int, uint);\n" - "ivec2 subgroupClusteredXor(ivec2, uint);\n" - "ivec3 subgroupClusteredXor(ivec3, uint);\n" - "ivec4 subgroupClusteredXor(ivec4, uint);\n" - "uint subgroupClusteredXor(uint, uint);\n" - "uvec2 subgroupClusteredXor(uvec2, uint);\n" - "uvec3 subgroupClusteredXor(uvec3, uint);\n" - "uvec4 subgroupClusteredXor(uvec4, uint);\n" - "bool subgroupClusteredXor(bool, uint);\n" - "bvec2 subgroupClusteredXor(bvec2, uint);\n" - "bvec3 subgroupClusteredXor(bvec3, uint);\n" - "bvec4 subgroupClusteredXor(bvec4, uint);\n" - - "float subgroupQuadBroadcast(float, uint);\n" - "vec2 subgroupQuadBroadcast(vec2, uint);\n" - "vec3 subgroupQuadBroadcast(vec3, uint);\n" - "vec4 subgroupQuadBroadcast(vec4, uint);\n" - "int subgroupQuadBroadcast(int, uint);\n" - "ivec2 subgroupQuadBroadcast(ivec2, uint);\n" - "ivec3 subgroupQuadBroadcast(ivec3, uint);\n" - "ivec4 subgroupQuadBroadcast(ivec4, uint);\n" - "uint subgroupQuadBroadcast(uint, uint);\n" - "uvec2 subgroupQuadBroadcast(uvec2, uint);\n" - "uvec3 subgroupQuadBroadcast(uvec3, uint);\n" - "uvec4 subgroupQuadBroadcast(uvec4, uint);\n" - "bool subgroupQuadBroadcast(bool, uint);\n" - "bvec2 subgroupQuadBroadcast(bvec2, uint);\n" - "bvec3 subgroupQuadBroadcast(bvec3, uint);\n" - "bvec4 subgroupQuadBroadcast(bvec4, uint);\n" - - "float subgroupQuadSwapHorizontal(float);\n" - "vec2 subgroupQuadSwapHorizontal(vec2);\n" - "vec3 subgroupQuadSwapHorizontal(vec3);\n" - "vec4 subgroupQuadSwapHorizontal(vec4);\n" - "int subgroupQuadSwapHorizontal(int);\n" - "ivec2 subgroupQuadSwapHorizontal(ivec2);\n" - "ivec3 subgroupQuadSwapHorizontal(ivec3);\n" - "ivec4 subgroupQuadSwapHorizontal(ivec4);\n" - "uint subgroupQuadSwapHorizontal(uint);\n" - "uvec2 subgroupQuadSwapHorizontal(uvec2);\n" - "uvec3 subgroupQuadSwapHorizontal(uvec3);\n" - "uvec4 subgroupQuadSwapHorizontal(uvec4);\n" - "bool subgroupQuadSwapHorizontal(bool);\n" - "bvec2 subgroupQuadSwapHorizontal(bvec2);\n" - "bvec3 subgroupQuadSwapHorizontal(bvec3);\n" - "bvec4 subgroupQuadSwapHorizontal(bvec4);\n" - - "float subgroupQuadSwapVertical(float);\n" - "vec2 subgroupQuadSwapVertical(vec2);\n" - "vec3 subgroupQuadSwapVertical(vec3);\n" - "vec4 subgroupQuadSwapVertical(vec4);\n" - "int subgroupQuadSwapVertical(int);\n" - "ivec2 subgroupQuadSwapVertical(ivec2);\n" - "ivec3 subgroupQuadSwapVertical(ivec3);\n" - "ivec4 subgroupQuadSwapVertical(ivec4);\n" - "uint subgroupQuadSwapVertical(uint);\n" - "uvec2 subgroupQuadSwapVertical(uvec2);\n" - "uvec3 subgroupQuadSwapVertical(uvec3);\n" - "uvec4 subgroupQuadSwapVertical(uvec4);\n" - "bool subgroupQuadSwapVertical(bool);\n" - "bvec2 subgroupQuadSwapVertical(bvec2);\n" - "bvec3 subgroupQuadSwapVertical(bvec3);\n" - "bvec4 subgroupQuadSwapVertical(bvec4);\n" - - "float subgroupQuadSwapDiagonal(float);\n" - "vec2 subgroupQuadSwapDiagonal(vec2);\n" - "vec3 subgroupQuadSwapDiagonal(vec3);\n" - "vec4 subgroupQuadSwapDiagonal(vec4);\n" - "int subgroupQuadSwapDiagonal(int);\n" - "ivec2 subgroupQuadSwapDiagonal(ivec2);\n" - "ivec3 subgroupQuadSwapDiagonal(ivec3);\n" - "ivec4 subgroupQuadSwapDiagonal(ivec4);\n" - "uint subgroupQuadSwapDiagonal(uint);\n" - "uvec2 subgroupQuadSwapDiagonal(uvec2);\n" - "uvec3 subgroupQuadSwapDiagonal(uvec3);\n" - "uvec4 subgroupQuadSwapDiagonal(uvec4);\n" - "bool subgroupQuadSwapDiagonal(bool);\n" - "bvec2 subgroupQuadSwapDiagonal(bvec2);\n" - "bvec3 subgroupQuadSwapDiagonal(bvec3);\n" - "bvec4 subgroupQuadSwapDiagonal(bvec4);\n" - -#ifdef NV_EXTENSIONS - "uvec4 subgroupPartitionNV(float);\n" - "uvec4 subgroupPartitionNV(vec2);\n" - "uvec4 subgroupPartitionNV(vec3);\n" - "uvec4 subgroupPartitionNV(vec4);\n" - "uvec4 subgroupPartitionNV(int);\n" - "uvec4 subgroupPartitionNV(ivec2);\n" - "uvec4 subgroupPartitionNV(ivec3);\n" - "uvec4 subgroupPartitionNV(ivec4);\n" - "uvec4 subgroupPartitionNV(uint);\n" - "uvec4 subgroupPartitionNV(uvec2);\n" - "uvec4 subgroupPartitionNV(uvec3);\n" - "uvec4 subgroupPartitionNV(uvec4);\n" - "uvec4 subgroupPartitionNV(bool);\n" - "uvec4 subgroupPartitionNV(bvec2);\n" - "uvec4 subgroupPartitionNV(bvec3);\n" - "uvec4 subgroupPartitionNV(bvec4);\n" - - "float subgroupPartitionedAddNV(float, uvec4 ballot);\n" - "vec2 subgroupPartitionedAddNV(vec2, uvec4 ballot);\n" - "vec3 subgroupPartitionedAddNV(vec3, uvec4 ballot);\n" - "vec4 subgroupPartitionedAddNV(vec4, uvec4 ballot);\n" - "int subgroupPartitionedAddNV(int, uvec4 ballot);\n" - "ivec2 subgroupPartitionedAddNV(ivec2, uvec4 ballot);\n" - "ivec3 subgroupPartitionedAddNV(ivec3, uvec4 ballot);\n" - "ivec4 subgroupPartitionedAddNV(ivec4, uvec4 ballot);\n" - "uint subgroupPartitionedAddNV(uint, uvec4 ballot);\n" - "uvec2 subgroupPartitionedAddNV(uvec2, uvec4 ballot);\n" - "uvec3 subgroupPartitionedAddNV(uvec3, uvec4 ballot);\n" - "uvec4 subgroupPartitionedAddNV(uvec4, uvec4 ballot);\n" - - "float subgroupPartitionedMulNV(float, uvec4 ballot);\n" - "vec2 subgroupPartitionedMulNV(vec2, uvec4 ballot);\n" - "vec3 subgroupPartitionedMulNV(vec3, uvec4 ballot);\n" - "vec4 subgroupPartitionedMulNV(vec4, uvec4 ballot);\n" - "int subgroupPartitionedMulNV(int, uvec4 ballot);\n" - "ivec2 subgroupPartitionedMulNV(ivec2, uvec4 ballot);\n" - "ivec3 subgroupPartitionedMulNV(ivec3, uvec4 ballot);\n" - "ivec4 subgroupPartitionedMulNV(ivec4, uvec4 ballot);\n" - "uint subgroupPartitionedMulNV(uint, uvec4 ballot);\n" - "uvec2 subgroupPartitionedMulNV(uvec2, uvec4 ballot);\n" - "uvec3 subgroupPartitionedMulNV(uvec3, uvec4 ballot);\n" - "uvec4 subgroupPartitionedMulNV(uvec4, uvec4 ballot);\n" - - "float subgroupPartitionedMinNV(float, uvec4 ballot);\n" - "vec2 subgroupPartitionedMinNV(vec2, uvec4 ballot);\n" - "vec3 subgroupPartitionedMinNV(vec3, uvec4 ballot);\n" - "vec4 subgroupPartitionedMinNV(vec4, uvec4 ballot);\n" - "int subgroupPartitionedMinNV(int, uvec4 ballot);\n" - "ivec2 subgroupPartitionedMinNV(ivec2, uvec4 ballot);\n" - "ivec3 subgroupPartitionedMinNV(ivec3, uvec4 ballot);\n" - "ivec4 subgroupPartitionedMinNV(ivec4, uvec4 ballot);\n" - "uint subgroupPartitionedMinNV(uint, uvec4 ballot);\n" - "uvec2 subgroupPartitionedMinNV(uvec2, uvec4 ballot);\n" - "uvec3 subgroupPartitionedMinNV(uvec3, uvec4 ballot);\n" - "uvec4 subgroupPartitionedMinNV(uvec4, uvec4 ballot);\n" - - "float subgroupPartitionedMaxNV(float, uvec4 ballot);\n" - "vec2 subgroupPartitionedMaxNV(vec2, uvec4 ballot);\n" - "vec3 subgroupPartitionedMaxNV(vec3, uvec4 ballot);\n" - "vec4 subgroupPartitionedMaxNV(vec4, uvec4 ballot);\n" - "int subgroupPartitionedMaxNV(int, uvec4 ballot);\n" - "ivec2 subgroupPartitionedMaxNV(ivec2, uvec4 ballot);\n" - "ivec3 subgroupPartitionedMaxNV(ivec3, uvec4 ballot);\n" - "ivec4 subgroupPartitionedMaxNV(ivec4, uvec4 ballot);\n" - "uint subgroupPartitionedMaxNV(uint, uvec4 ballot);\n" - "uvec2 subgroupPartitionedMaxNV(uvec2, uvec4 ballot);\n" - "uvec3 subgroupPartitionedMaxNV(uvec3, uvec4 ballot);\n" - "uvec4 subgroupPartitionedMaxNV(uvec4, uvec4 ballot);\n" - - "int subgroupPartitionedAndNV(int, uvec4 ballot);\n" - "ivec2 subgroupPartitionedAndNV(ivec2, uvec4 ballot);\n" - "ivec3 subgroupPartitionedAndNV(ivec3, uvec4 ballot);\n" - "ivec4 subgroupPartitionedAndNV(ivec4, uvec4 ballot);\n" - "uint subgroupPartitionedAndNV(uint, uvec4 ballot);\n" - "uvec2 subgroupPartitionedAndNV(uvec2, uvec4 ballot);\n" - "uvec3 subgroupPartitionedAndNV(uvec3, uvec4 ballot);\n" - "uvec4 subgroupPartitionedAndNV(uvec4, uvec4 ballot);\n" - "bool subgroupPartitionedAndNV(bool, uvec4 ballot);\n" - "bvec2 subgroupPartitionedAndNV(bvec2, uvec4 ballot);\n" - "bvec3 subgroupPartitionedAndNV(bvec3, uvec4 ballot);\n" - "bvec4 subgroupPartitionedAndNV(bvec4, uvec4 ballot);\n" - - "int subgroupPartitionedOrNV(int, uvec4 ballot);\n" - "ivec2 subgroupPartitionedOrNV(ivec2, uvec4 ballot);\n" - "ivec3 subgroupPartitionedOrNV(ivec3, uvec4 ballot);\n" - "ivec4 subgroupPartitionedOrNV(ivec4, uvec4 ballot);\n" - "uint subgroupPartitionedOrNV(uint, uvec4 ballot);\n" - "uvec2 subgroupPartitionedOrNV(uvec2, uvec4 ballot);\n" - "uvec3 subgroupPartitionedOrNV(uvec3, uvec4 ballot);\n" - "uvec4 subgroupPartitionedOrNV(uvec4, uvec4 ballot);\n" - "bool subgroupPartitionedOrNV(bool, uvec4 ballot);\n" - "bvec2 subgroupPartitionedOrNV(bvec2, uvec4 ballot);\n" - "bvec3 subgroupPartitionedOrNV(bvec3, uvec4 ballot);\n" - "bvec4 subgroupPartitionedOrNV(bvec4, uvec4 ballot);\n" - - "int subgroupPartitionedXorNV(int, uvec4 ballot);\n" - "ivec2 subgroupPartitionedXorNV(ivec2, uvec4 ballot);\n" - "ivec3 subgroupPartitionedXorNV(ivec3, uvec4 ballot);\n" - "ivec4 subgroupPartitionedXorNV(ivec4, uvec4 ballot);\n" - "uint subgroupPartitionedXorNV(uint, uvec4 ballot);\n" - "uvec2 subgroupPartitionedXorNV(uvec2, uvec4 ballot);\n" - "uvec3 subgroupPartitionedXorNV(uvec3, uvec4 ballot);\n" - "uvec4 subgroupPartitionedXorNV(uvec4, uvec4 ballot);\n" - "bool subgroupPartitionedXorNV(bool, uvec4 ballot);\n" - "bvec2 subgroupPartitionedXorNV(bvec2, uvec4 ballot);\n" - "bvec3 subgroupPartitionedXorNV(bvec3, uvec4 ballot);\n" - "bvec4 subgroupPartitionedXorNV(bvec4, uvec4 ballot);\n" - - "float subgroupPartitionedInclusiveAddNV(float, uvec4 ballot);\n" - "vec2 subgroupPartitionedInclusiveAddNV(vec2, uvec4 ballot);\n" - "vec3 subgroupPartitionedInclusiveAddNV(vec3, uvec4 ballot);\n" - "vec4 subgroupPartitionedInclusiveAddNV(vec4, uvec4 ballot);\n" - "int subgroupPartitionedInclusiveAddNV(int, uvec4 ballot);\n" - "ivec2 subgroupPartitionedInclusiveAddNV(ivec2, uvec4 ballot);\n" - "ivec3 subgroupPartitionedInclusiveAddNV(ivec3, uvec4 ballot);\n" - "ivec4 subgroupPartitionedInclusiveAddNV(ivec4, uvec4 ballot);\n" - "uint subgroupPartitionedInclusiveAddNV(uint, uvec4 ballot);\n" - "uvec2 subgroupPartitionedInclusiveAddNV(uvec2, uvec4 ballot);\n" - "uvec3 subgroupPartitionedInclusiveAddNV(uvec3, uvec4 ballot);\n" - "uvec4 subgroupPartitionedInclusiveAddNV(uvec4, uvec4 ballot);\n" - - "float subgroupPartitionedInclusiveMulNV(float, uvec4 ballot);\n" - "vec2 subgroupPartitionedInclusiveMulNV(vec2, uvec4 ballot);\n" - "vec3 subgroupPartitionedInclusiveMulNV(vec3, uvec4 ballot);\n" - "vec4 subgroupPartitionedInclusiveMulNV(vec4, uvec4 ballot);\n" - "int subgroupPartitionedInclusiveMulNV(int, uvec4 ballot);\n" - "ivec2 subgroupPartitionedInclusiveMulNV(ivec2, uvec4 ballot);\n" - "ivec3 subgroupPartitionedInclusiveMulNV(ivec3, uvec4 ballot);\n" - "ivec4 subgroupPartitionedInclusiveMulNV(ivec4, uvec4 ballot);\n" - "uint subgroupPartitionedInclusiveMulNV(uint, uvec4 ballot);\n" - "uvec2 subgroupPartitionedInclusiveMulNV(uvec2, uvec4 ballot);\n" - "uvec3 subgroupPartitionedInclusiveMulNV(uvec3, uvec4 ballot);\n" - "uvec4 subgroupPartitionedInclusiveMulNV(uvec4, uvec4 ballot);\n" - - "float subgroupPartitionedInclusiveMinNV(float, uvec4 ballot);\n" - "vec2 subgroupPartitionedInclusiveMinNV(vec2, uvec4 ballot);\n" - "vec3 subgroupPartitionedInclusiveMinNV(vec3, uvec4 ballot);\n" - "vec4 subgroupPartitionedInclusiveMinNV(vec4, uvec4 ballot);\n" - "int subgroupPartitionedInclusiveMinNV(int, uvec4 ballot);\n" - "ivec2 subgroupPartitionedInclusiveMinNV(ivec2, uvec4 ballot);\n" - "ivec3 subgroupPartitionedInclusiveMinNV(ivec3, uvec4 ballot);\n" - "ivec4 subgroupPartitionedInclusiveMinNV(ivec4, uvec4 ballot);\n" - "uint subgroupPartitionedInclusiveMinNV(uint, uvec4 ballot);\n" - "uvec2 subgroupPartitionedInclusiveMinNV(uvec2, uvec4 ballot);\n" - "uvec3 subgroupPartitionedInclusiveMinNV(uvec3, uvec4 ballot);\n" - "uvec4 subgroupPartitionedInclusiveMinNV(uvec4, uvec4 ballot);\n" - - "float subgroupPartitionedInclusiveMaxNV(float, uvec4 ballot);\n" - "vec2 subgroupPartitionedInclusiveMaxNV(vec2, uvec4 ballot);\n" - "vec3 subgroupPartitionedInclusiveMaxNV(vec3, uvec4 ballot);\n" - "vec4 subgroupPartitionedInclusiveMaxNV(vec4, uvec4 ballot);\n" - "int subgroupPartitionedInclusiveMaxNV(int, uvec4 ballot);\n" - "ivec2 subgroupPartitionedInclusiveMaxNV(ivec2, uvec4 ballot);\n" - "ivec3 subgroupPartitionedInclusiveMaxNV(ivec3, uvec4 ballot);\n" - "ivec4 subgroupPartitionedInclusiveMaxNV(ivec4, uvec4 ballot);\n" - "uint subgroupPartitionedInclusiveMaxNV(uint, uvec4 ballot);\n" - "uvec2 subgroupPartitionedInclusiveMaxNV(uvec2, uvec4 ballot);\n" - "uvec3 subgroupPartitionedInclusiveMaxNV(uvec3, uvec4 ballot);\n" - "uvec4 subgroupPartitionedInclusiveMaxNV(uvec4, uvec4 ballot);\n" - - "int subgroupPartitionedInclusiveAndNV(int, uvec4 ballot);\n" - "ivec2 subgroupPartitionedInclusiveAndNV(ivec2, uvec4 ballot);\n" - "ivec3 subgroupPartitionedInclusiveAndNV(ivec3, uvec4 ballot);\n" - "ivec4 subgroupPartitionedInclusiveAndNV(ivec4, uvec4 ballot);\n" - "uint subgroupPartitionedInclusiveAndNV(uint, uvec4 ballot);\n" - "uvec2 subgroupPartitionedInclusiveAndNV(uvec2, uvec4 ballot);\n" - "uvec3 subgroupPartitionedInclusiveAndNV(uvec3, uvec4 ballot);\n" - "uvec4 subgroupPartitionedInclusiveAndNV(uvec4, uvec4 ballot);\n" - "bool subgroupPartitionedInclusiveAndNV(bool, uvec4 ballot);\n" - "bvec2 subgroupPartitionedInclusiveAndNV(bvec2, uvec4 ballot);\n" - "bvec3 subgroupPartitionedInclusiveAndNV(bvec3, uvec4 ballot);\n" - "bvec4 subgroupPartitionedInclusiveAndNV(bvec4, uvec4 ballot);\n" - - "int subgroupPartitionedInclusiveOrNV(int, uvec4 ballot);\n" - "ivec2 subgroupPartitionedInclusiveOrNV(ivec2, uvec4 ballot);\n" - "ivec3 subgroupPartitionedInclusiveOrNV(ivec3, uvec4 ballot);\n" - "ivec4 subgroupPartitionedInclusiveOrNV(ivec4, uvec4 ballot);\n" - "uint subgroupPartitionedInclusiveOrNV(uint, uvec4 ballot);\n" - "uvec2 subgroupPartitionedInclusiveOrNV(uvec2, uvec4 ballot);\n" - "uvec3 subgroupPartitionedInclusiveOrNV(uvec3, uvec4 ballot);\n" - "uvec4 subgroupPartitionedInclusiveOrNV(uvec4, uvec4 ballot);\n" - "bool subgroupPartitionedInclusiveOrNV(bool, uvec4 ballot);\n" - "bvec2 subgroupPartitionedInclusiveOrNV(bvec2, uvec4 ballot);\n" - "bvec3 subgroupPartitionedInclusiveOrNV(bvec3, uvec4 ballot);\n" - "bvec4 subgroupPartitionedInclusiveOrNV(bvec4, uvec4 ballot);\n" - - "int subgroupPartitionedInclusiveXorNV(int, uvec4 ballot);\n" - "ivec2 subgroupPartitionedInclusiveXorNV(ivec2, uvec4 ballot);\n" - "ivec3 subgroupPartitionedInclusiveXorNV(ivec3, uvec4 ballot);\n" - "ivec4 subgroupPartitionedInclusiveXorNV(ivec4, uvec4 ballot);\n" - "uint subgroupPartitionedInclusiveXorNV(uint, uvec4 ballot);\n" - "uvec2 subgroupPartitionedInclusiveXorNV(uvec2, uvec4 ballot);\n" - "uvec3 subgroupPartitionedInclusiveXorNV(uvec3, uvec4 ballot);\n" - "uvec4 subgroupPartitionedInclusiveXorNV(uvec4, uvec4 ballot);\n" - "bool subgroupPartitionedInclusiveXorNV(bool, uvec4 ballot);\n" - "bvec2 subgroupPartitionedInclusiveXorNV(bvec2, uvec4 ballot);\n" - "bvec3 subgroupPartitionedInclusiveXorNV(bvec3, uvec4 ballot);\n" - "bvec4 subgroupPartitionedInclusiveXorNV(bvec4, uvec4 ballot);\n" - - "float subgroupPartitionedExclusiveAddNV(float, uvec4 ballot);\n" - "vec2 subgroupPartitionedExclusiveAddNV(vec2, uvec4 ballot);\n" - "vec3 subgroupPartitionedExclusiveAddNV(vec3, uvec4 ballot);\n" - "vec4 subgroupPartitionedExclusiveAddNV(vec4, uvec4 ballot);\n" - "int subgroupPartitionedExclusiveAddNV(int, uvec4 ballot);\n" - "ivec2 subgroupPartitionedExclusiveAddNV(ivec2, uvec4 ballot);\n" - "ivec3 subgroupPartitionedExclusiveAddNV(ivec3, uvec4 ballot);\n" - "ivec4 subgroupPartitionedExclusiveAddNV(ivec4, uvec4 ballot);\n" - "uint subgroupPartitionedExclusiveAddNV(uint, uvec4 ballot);\n" - "uvec2 subgroupPartitionedExclusiveAddNV(uvec2, uvec4 ballot);\n" - "uvec3 subgroupPartitionedExclusiveAddNV(uvec3, uvec4 ballot);\n" - "uvec4 subgroupPartitionedExclusiveAddNV(uvec4, uvec4 ballot);\n" - - "float subgroupPartitionedExclusiveMulNV(float, uvec4 ballot);\n" - "vec2 subgroupPartitionedExclusiveMulNV(vec2, uvec4 ballot);\n" - "vec3 subgroupPartitionedExclusiveMulNV(vec3, uvec4 ballot);\n" - "vec4 subgroupPartitionedExclusiveMulNV(vec4, uvec4 ballot);\n" - "int subgroupPartitionedExclusiveMulNV(int, uvec4 ballot);\n" - "ivec2 subgroupPartitionedExclusiveMulNV(ivec2, uvec4 ballot);\n" - "ivec3 subgroupPartitionedExclusiveMulNV(ivec3, uvec4 ballot);\n" - "ivec4 subgroupPartitionedExclusiveMulNV(ivec4, uvec4 ballot);\n" - "uint subgroupPartitionedExclusiveMulNV(uint, uvec4 ballot);\n" - "uvec2 subgroupPartitionedExclusiveMulNV(uvec2, uvec4 ballot);\n" - "uvec3 subgroupPartitionedExclusiveMulNV(uvec3, uvec4 ballot);\n" - "uvec4 subgroupPartitionedExclusiveMulNV(uvec4, uvec4 ballot);\n" - - "float subgroupPartitionedExclusiveMinNV(float, uvec4 ballot);\n" - "vec2 subgroupPartitionedExclusiveMinNV(vec2, uvec4 ballot);\n" - "vec3 subgroupPartitionedExclusiveMinNV(vec3, uvec4 ballot);\n" - "vec4 subgroupPartitionedExclusiveMinNV(vec4, uvec4 ballot);\n" - "int subgroupPartitionedExclusiveMinNV(int, uvec4 ballot);\n" - "ivec2 subgroupPartitionedExclusiveMinNV(ivec2, uvec4 ballot);\n" - "ivec3 subgroupPartitionedExclusiveMinNV(ivec3, uvec4 ballot);\n" - "ivec4 subgroupPartitionedExclusiveMinNV(ivec4, uvec4 ballot);\n" - "uint subgroupPartitionedExclusiveMinNV(uint, uvec4 ballot);\n" - "uvec2 subgroupPartitionedExclusiveMinNV(uvec2, uvec4 ballot);\n" - "uvec3 subgroupPartitionedExclusiveMinNV(uvec3, uvec4 ballot);\n" - "uvec4 subgroupPartitionedExclusiveMinNV(uvec4, uvec4 ballot);\n" - - "float subgroupPartitionedExclusiveMaxNV(float, uvec4 ballot);\n" - "vec2 subgroupPartitionedExclusiveMaxNV(vec2, uvec4 ballot);\n" - "vec3 subgroupPartitionedExclusiveMaxNV(vec3, uvec4 ballot);\n" - "vec4 subgroupPartitionedExclusiveMaxNV(vec4, uvec4 ballot);\n" - "int subgroupPartitionedExclusiveMaxNV(int, uvec4 ballot);\n" - "ivec2 subgroupPartitionedExclusiveMaxNV(ivec2, uvec4 ballot);\n" - "ivec3 subgroupPartitionedExclusiveMaxNV(ivec3, uvec4 ballot);\n" - "ivec4 subgroupPartitionedExclusiveMaxNV(ivec4, uvec4 ballot);\n" - "uint subgroupPartitionedExclusiveMaxNV(uint, uvec4 ballot);\n" - "uvec2 subgroupPartitionedExclusiveMaxNV(uvec2, uvec4 ballot);\n" - "uvec3 subgroupPartitionedExclusiveMaxNV(uvec3, uvec4 ballot);\n" - "uvec4 subgroupPartitionedExclusiveMaxNV(uvec4, uvec4 ballot);\n" - - "int subgroupPartitionedExclusiveAndNV(int, uvec4 ballot);\n" - "ivec2 subgroupPartitionedExclusiveAndNV(ivec2, uvec4 ballot);\n" - "ivec3 subgroupPartitionedExclusiveAndNV(ivec3, uvec4 ballot);\n" - "ivec4 subgroupPartitionedExclusiveAndNV(ivec4, uvec4 ballot);\n" - "uint subgroupPartitionedExclusiveAndNV(uint, uvec4 ballot);\n" - "uvec2 subgroupPartitionedExclusiveAndNV(uvec2, uvec4 ballot);\n" - "uvec3 subgroupPartitionedExclusiveAndNV(uvec3, uvec4 ballot);\n" - "uvec4 subgroupPartitionedExclusiveAndNV(uvec4, uvec4 ballot);\n" - "bool subgroupPartitionedExclusiveAndNV(bool, uvec4 ballot);\n" - "bvec2 subgroupPartitionedExclusiveAndNV(bvec2, uvec4 ballot);\n" - "bvec3 subgroupPartitionedExclusiveAndNV(bvec3, uvec4 ballot);\n" - "bvec4 subgroupPartitionedExclusiveAndNV(bvec4, uvec4 ballot);\n" - - "int subgroupPartitionedExclusiveOrNV(int, uvec4 ballot);\n" - "ivec2 subgroupPartitionedExclusiveOrNV(ivec2, uvec4 ballot);\n" - "ivec3 subgroupPartitionedExclusiveOrNV(ivec3, uvec4 ballot);\n" - "ivec4 subgroupPartitionedExclusiveOrNV(ivec4, uvec4 ballot);\n" - "uint subgroupPartitionedExclusiveOrNV(uint, uvec4 ballot);\n" - "uvec2 subgroupPartitionedExclusiveOrNV(uvec2, uvec4 ballot);\n" - "uvec3 subgroupPartitionedExclusiveOrNV(uvec3, uvec4 ballot);\n" - "uvec4 subgroupPartitionedExclusiveOrNV(uvec4, uvec4 ballot);\n" - "bool subgroupPartitionedExclusiveOrNV(bool, uvec4 ballot);\n" - "bvec2 subgroupPartitionedExclusiveOrNV(bvec2, uvec4 ballot);\n" - "bvec3 subgroupPartitionedExclusiveOrNV(bvec3, uvec4 ballot);\n" - "bvec4 subgroupPartitionedExclusiveOrNV(bvec4, uvec4 ballot);\n" - - "int subgroupPartitionedExclusiveXorNV(int, uvec4 ballot);\n" - "ivec2 subgroupPartitionedExclusiveXorNV(ivec2, uvec4 ballot);\n" - "ivec3 subgroupPartitionedExclusiveXorNV(ivec3, uvec4 ballot);\n" - "ivec4 subgroupPartitionedExclusiveXorNV(ivec4, uvec4 ballot);\n" - "uint subgroupPartitionedExclusiveXorNV(uint, uvec4 ballot);\n" - "uvec2 subgroupPartitionedExclusiveXorNV(uvec2, uvec4 ballot);\n" - "uvec3 subgroupPartitionedExclusiveXorNV(uvec3, uvec4 ballot);\n" - "uvec4 subgroupPartitionedExclusiveXorNV(uvec4, uvec4 ballot);\n" - "bool subgroupPartitionedExclusiveXorNV(bool, uvec4 ballot);\n" - "bvec2 subgroupPartitionedExclusiveXorNV(bvec2, uvec4 ballot);\n" - "bvec3 subgroupPartitionedExclusiveXorNV(bvec3, uvec4 ballot);\n" - "bvec4 subgroupPartitionedExclusiveXorNV(bvec4, uvec4 ballot);\n" -#endif - - "\n"); - - if (profile != EEsProfile && version >= 400) { - commonBuiltins.append( - "bool subgroupAllEqual(double);\n" - "bool subgroupAllEqual(dvec2);\n" - "bool subgroupAllEqual(dvec3);\n" - "bool subgroupAllEqual(dvec4);\n" - - "double subgroupBroadcast(double, uint);\n" - "dvec2 subgroupBroadcast(dvec2, uint);\n" - "dvec3 subgroupBroadcast(dvec3, uint);\n" - "dvec4 subgroupBroadcast(dvec4, uint);\n" - - "double subgroupBroadcastFirst(double);\n" - "dvec2 subgroupBroadcastFirst(dvec2);\n" - "dvec3 subgroupBroadcastFirst(dvec3);\n" - "dvec4 subgroupBroadcastFirst(dvec4);\n" - - "double subgroupShuffle(double, uint);\n" - "dvec2 subgroupShuffle(dvec2, uint);\n" - "dvec3 subgroupShuffle(dvec3, uint);\n" - "dvec4 subgroupShuffle(dvec4, uint);\n" - - "double subgroupShuffleXor(double, uint);\n" - "dvec2 subgroupShuffleXor(dvec2, uint);\n" - "dvec3 subgroupShuffleXor(dvec3, uint);\n" - "dvec4 subgroupShuffleXor(dvec4, uint);\n" - - "double subgroupShuffleUp(double, uint delta);\n" - "dvec2 subgroupShuffleUp(dvec2, uint delta);\n" - "dvec3 subgroupShuffleUp(dvec3, uint delta);\n" - "dvec4 subgroupShuffleUp(dvec4, uint delta);\n" - - "double subgroupShuffleDown(double, uint delta);\n" - "dvec2 subgroupShuffleDown(dvec2, uint delta);\n" - "dvec3 subgroupShuffleDown(dvec3, uint delta);\n" - "dvec4 subgroupShuffleDown(dvec4, uint delta);\n" - - "double subgroupAdd(double);\n" - "dvec2 subgroupAdd(dvec2);\n" - "dvec3 subgroupAdd(dvec3);\n" - "dvec4 subgroupAdd(dvec4);\n" - - "double subgroupMul(double);\n" - "dvec2 subgroupMul(dvec2);\n" - "dvec3 subgroupMul(dvec3);\n" - "dvec4 subgroupMul(dvec4);\n" - - "double subgroupMin(double);\n" - "dvec2 subgroupMin(dvec2);\n" - "dvec3 subgroupMin(dvec3);\n" - "dvec4 subgroupMin(dvec4);\n" - - "double subgroupMax(double);\n" - "dvec2 subgroupMax(dvec2);\n" - "dvec3 subgroupMax(dvec3);\n" - "dvec4 subgroupMax(dvec4);\n" - - "double subgroupInclusiveAdd(double);\n" - "dvec2 subgroupInclusiveAdd(dvec2);\n" - "dvec3 subgroupInclusiveAdd(dvec3);\n" - "dvec4 subgroupInclusiveAdd(dvec4);\n" - - "double subgroupInclusiveMul(double);\n" - "dvec2 subgroupInclusiveMul(dvec2);\n" - "dvec3 subgroupInclusiveMul(dvec3);\n" - "dvec4 subgroupInclusiveMul(dvec4);\n" - - "double subgroupInclusiveMin(double);\n" - "dvec2 subgroupInclusiveMin(dvec2);\n" - "dvec3 subgroupInclusiveMin(dvec3);\n" - "dvec4 subgroupInclusiveMin(dvec4);\n" - - "double subgroupInclusiveMax(double);\n" - "dvec2 subgroupInclusiveMax(dvec2);\n" - "dvec3 subgroupInclusiveMax(dvec3);\n" - "dvec4 subgroupInclusiveMax(dvec4);\n" - - "double subgroupExclusiveAdd(double);\n" - "dvec2 subgroupExclusiveAdd(dvec2);\n" - "dvec3 subgroupExclusiveAdd(dvec3);\n" - "dvec4 subgroupExclusiveAdd(dvec4);\n" - - "double subgroupExclusiveMul(double);\n" - "dvec2 subgroupExclusiveMul(dvec2);\n" - "dvec3 subgroupExclusiveMul(dvec3);\n" - "dvec4 subgroupExclusiveMul(dvec4);\n" - - "double subgroupExclusiveMin(double);\n" - "dvec2 subgroupExclusiveMin(dvec2);\n" - "dvec3 subgroupExclusiveMin(dvec3);\n" - "dvec4 subgroupExclusiveMin(dvec4);\n" - - "double subgroupExclusiveMax(double);\n" - "dvec2 subgroupExclusiveMax(dvec2);\n" - "dvec3 subgroupExclusiveMax(dvec3);\n" - "dvec4 subgroupExclusiveMax(dvec4);\n" - - "double subgroupClusteredAdd(double, uint);\n" - "dvec2 subgroupClusteredAdd(dvec2, uint);\n" - "dvec3 subgroupClusteredAdd(dvec3, uint);\n" - "dvec4 subgroupClusteredAdd(dvec4, uint);\n" - - "double subgroupClusteredMul(double, uint);\n" - "dvec2 subgroupClusteredMul(dvec2, uint);\n" - "dvec3 subgroupClusteredMul(dvec3, uint);\n" - "dvec4 subgroupClusteredMul(dvec4, uint);\n" - - "double subgroupClusteredMin(double, uint);\n" - "dvec2 subgroupClusteredMin(dvec2, uint);\n" - "dvec3 subgroupClusteredMin(dvec3, uint);\n" - "dvec4 subgroupClusteredMin(dvec4, uint);\n" - - "double subgroupClusteredMax(double, uint);\n" - "dvec2 subgroupClusteredMax(dvec2, uint);\n" - "dvec3 subgroupClusteredMax(dvec3, uint);\n" - "dvec4 subgroupClusteredMax(dvec4, uint);\n" - - "double subgroupQuadBroadcast(double, uint);\n" - "dvec2 subgroupQuadBroadcast(dvec2, uint);\n" - "dvec3 subgroupQuadBroadcast(dvec3, uint);\n" - "dvec4 subgroupQuadBroadcast(dvec4, uint);\n" - - "double subgroupQuadSwapHorizontal(double);\n" - "dvec2 subgroupQuadSwapHorizontal(dvec2);\n" - "dvec3 subgroupQuadSwapHorizontal(dvec3);\n" - "dvec4 subgroupQuadSwapHorizontal(dvec4);\n" - - "double subgroupQuadSwapVertical(double);\n" - "dvec2 subgroupQuadSwapVertical(dvec2);\n" - "dvec3 subgroupQuadSwapVertical(dvec3);\n" - "dvec4 subgroupQuadSwapVertical(dvec4);\n" - - "double subgroupQuadSwapDiagonal(double);\n" - "dvec2 subgroupQuadSwapDiagonal(dvec2);\n" - "dvec3 subgroupQuadSwapDiagonal(dvec3);\n" - "dvec4 subgroupQuadSwapDiagonal(dvec4);\n" - - -#ifdef NV_EXTENSIONS - "uvec4 subgroupPartitionNV(double);\n" - "uvec4 subgroupPartitionNV(dvec2);\n" - "uvec4 subgroupPartitionNV(dvec3);\n" - "uvec4 subgroupPartitionNV(dvec4);\n" - - "double subgroupPartitionedAddNV(double, uvec4 ballot);\n" - "dvec2 subgroupPartitionedAddNV(dvec2, uvec4 ballot);\n" - "dvec3 subgroupPartitionedAddNV(dvec3, uvec4 ballot);\n" - "dvec4 subgroupPartitionedAddNV(dvec4, uvec4 ballot);\n" - - "double subgroupPartitionedMulNV(double, uvec4 ballot);\n" - "dvec2 subgroupPartitionedMulNV(dvec2, uvec4 ballot);\n" - "dvec3 subgroupPartitionedMulNV(dvec3, uvec4 ballot);\n" - "dvec4 subgroupPartitionedMulNV(dvec4, uvec4 ballot);\n" - - "double subgroupPartitionedMinNV(double, uvec4 ballot);\n" - "dvec2 subgroupPartitionedMinNV(dvec2, uvec4 ballot);\n" - "dvec3 subgroupPartitionedMinNV(dvec3, uvec4 ballot);\n" - "dvec4 subgroupPartitionedMinNV(dvec4, uvec4 ballot);\n" - - "double subgroupPartitionedMaxNV(double, uvec4 ballot);\n" - "dvec2 subgroupPartitionedMaxNV(dvec2, uvec4 ballot);\n" - "dvec3 subgroupPartitionedMaxNV(dvec3, uvec4 ballot);\n" - "dvec4 subgroupPartitionedMaxNV(dvec4, uvec4 ballot);\n" - - "double subgroupPartitionedInclusiveAddNV(double, uvec4 ballot);\n" - "dvec2 subgroupPartitionedInclusiveAddNV(dvec2, uvec4 ballot);\n" - "dvec3 subgroupPartitionedInclusiveAddNV(dvec3, uvec4 ballot);\n" - "dvec4 subgroupPartitionedInclusiveAddNV(dvec4, uvec4 ballot);\n" - - "double subgroupPartitionedInclusiveMulNV(double, uvec4 ballot);\n" - "dvec2 subgroupPartitionedInclusiveMulNV(dvec2, uvec4 ballot);\n" - "dvec3 subgroupPartitionedInclusiveMulNV(dvec3, uvec4 ballot);\n" - "dvec4 subgroupPartitionedInclusiveMulNV(dvec4, uvec4 ballot);\n" - - "double subgroupPartitionedInclusiveMinNV(double, uvec4 ballot);\n" - "dvec2 subgroupPartitionedInclusiveMinNV(dvec2, uvec4 ballot);\n" - "dvec3 subgroupPartitionedInclusiveMinNV(dvec3, uvec4 ballot);\n" - "dvec4 subgroupPartitionedInclusiveMinNV(dvec4, uvec4 ballot);\n" - - "double subgroupPartitionedInclusiveMaxNV(double, uvec4 ballot);\n" - "dvec2 subgroupPartitionedInclusiveMaxNV(dvec2, uvec4 ballot);\n" - "dvec3 subgroupPartitionedInclusiveMaxNV(dvec3, uvec4 ballot);\n" - "dvec4 subgroupPartitionedInclusiveMaxNV(dvec4, uvec4 ballot);\n" - - "double subgroupPartitionedExclusiveAddNV(double, uvec4 ballot);\n" - "dvec2 subgroupPartitionedExclusiveAddNV(dvec2, uvec4 ballot);\n" - "dvec3 subgroupPartitionedExclusiveAddNV(dvec3, uvec4 ballot);\n" - "dvec4 subgroupPartitionedExclusiveAddNV(dvec4, uvec4 ballot);\n" - - "double subgroupPartitionedExclusiveMulNV(double, uvec4 ballot);\n" - "dvec2 subgroupPartitionedExclusiveMulNV(dvec2, uvec4 ballot);\n" - "dvec3 subgroupPartitionedExclusiveMulNV(dvec3, uvec4 ballot);\n" - "dvec4 subgroupPartitionedExclusiveMulNV(dvec4, uvec4 ballot);\n" - - "double subgroupPartitionedExclusiveMinNV(double, uvec4 ballot);\n" - "dvec2 subgroupPartitionedExclusiveMinNV(dvec2, uvec4 ballot);\n" - "dvec3 subgroupPartitionedExclusiveMinNV(dvec3, uvec4 ballot);\n" - "dvec4 subgroupPartitionedExclusiveMinNV(dvec4, uvec4 ballot);\n" - - "double subgroupPartitionedExclusiveMaxNV(double, uvec4 ballot);\n" - "dvec2 subgroupPartitionedExclusiveMaxNV(dvec2, uvec4 ballot);\n" - "dvec3 subgroupPartitionedExclusiveMaxNV(dvec3, uvec4 ballot);\n" - "dvec4 subgroupPartitionedExclusiveMaxNV(dvec4, uvec4 ballot);\n" -#endif - - "\n"); + // Generate all flavors of subgroup ops. + static const char *subgroupOps[] = + { + "bool subgroupAllEqual(%s);\n", + "%s subgroupBroadcast(%s, uint);\n", + "%s subgroupBroadcastFirst(%s);\n", + "%s subgroupShuffle(%s, uint);\n", + "%s subgroupShuffleXor(%s, uint);\n", + "%s subgroupShuffleUp(%s, uint delta);\n", + "%s subgroupShuffleDown(%s, uint delta);\n", + "%s subgroupAdd(%s);\n", + "%s subgroupMul(%s);\n", + "%s subgroupMin(%s);\n", + "%s subgroupMax(%s);\n", + "%s subgroupAnd(%s);\n", + "%s subgroupOr(%s);\n", + "%s subgroupXor(%s);\n", + "%s subgroupInclusiveAdd(%s);\n", + "%s subgroupInclusiveMul(%s);\n", + "%s subgroupInclusiveMin(%s);\n", + "%s subgroupInclusiveMax(%s);\n", + "%s subgroupInclusiveAnd(%s);\n", + "%s subgroupInclusiveOr(%s);\n", + "%s subgroupInclusiveXor(%s);\n", + "%s subgroupExclusiveAdd(%s);\n", + "%s subgroupExclusiveMul(%s);\n", + "%s subgroupExclusiveMin(%s);\n", + "%s subgroupExclusiveMax(%s);\n", + "%s subgroupExclusiveAnd(%s);\n", + "%s subgroupExclusiveOr(%s);\n", + "%s subgroupExclusiveXor(%s);\n", + "%s subgroupClusteredAdd(%s, uint);\n", + "%s subgroupClusteredMul(%s, uint);\n", + "%s subgroupClusteredMin(%s, uint);\n", + "%s subgroupClusteredMax(%s, uint);\n", + "%s subgroupClusteredAnd(%s, uint);\n", + "%s subgroupClusteredOr(%s, uint);\n", + "%s subgroupClusteredXor(%s, uint);\n", + "%s subgroupQuadBroadcast(%s, uint);\n", + "%s subgroupQuadSwapHorizontal(%s);\n", + "%s subgroupQuadSwapVertical(%s);\n", + "%s subgroupQuadSwapDiagonal(%s);\n", + "uvec4 subgroupPartitionNV(%s);\n", + "%s subgroupPartitionedAddNV(%s, uvec4 ballot);\n", + "%s subgroupPartitionedMulNV(%s, uvec4 ballot);\n", + "%s subgroupPartitionedMinNV(%s, uvec4 ballot);\n", + "%s subgroupPartitionedMaxNV(%s, uvec4 ballot);\n", + "%s subgroupPartitionedAndNV(%s, uvec4 ballot);\n", + "%s subgroupPartitionedOrNV(%s, uvec4 ballot);\n", + "%s subgroupPartitionedXorNV(%s, uvec4 ballot);\n", + "%s subgroupPartitionedInclusiveAddNV(%s, uvec4 ballot);\n", + "%s subgroupPartitionedInclusiveMulNV(%s, uvec4 ballot);\n", + "%s subgroupPartitionedInclusiveMinNV(%s, uvec4 ballot);\n", + "%s subgroupPartitionedInclusiveMaxNV(%s, uvec4 ballot);\n", + "%s subgroupPartitionedInclusiveAndNV(%s, uvec4 ballot);\n", + "%s subgroupPartitionedInclusiveOrNV(%s, uvec4 ballot);\n", + "%s subgroupPartitionedInclusiveXorNV(%s, uvec4 ballot);\n", + "%s subgroupPartitionedExclusiveAddNV(%s, uvec4 ballot);\n", + "%s subgroupPartitionedExclusiveMulNV(%s, uvec4 ballot);\n", + "%s subgroupPartitionedExclusiveMinNV(%s, uvec4 ballot);\n", + "%s subgroupPartitionedExclusiveMaxNV(%s, uvec4 ballot);\n", + "%s subgroupPartitionedExclusiveAndNV(%s, uvec4 ballot);\n", + "%s subgroupPartitionedExclusiveOrNV(%s, uvec4 ballot);\n", + "%s subgroupPartitionedExclusiveXorNV(%s, uvec4 ballot);\n", + }; + + static const char *floatTypes[] = { + "float", "vec2", "vec3", "vec4", + "float16_t", "f16vec2", "f16vec3", "f16vec4", + }; + static const char *doubleTypes[] = { + "double", "dvec2", "dvec3", "dvec4", + }; + static const char *intTypes[] = { + "int8_t", "i8vec2", "i8vec3", "i8vec4", + "int16_t", "i16vec2", "i16vec3", "i16vec4", + "int", "ivec2", "ivec3", "ivec4", + "int64_t", "i64vec2", "i64vec3", "i64vec4", + "uint8_t", "u8vec2", "u8vec3", "u8vec4", + "uint16_t", "u16vec2", "u16vec3", "u16vec4", + "uint", "uvec2", "uvec3", "uvec4", + "uint64_t", "u64vec2", "u64vec3", "u64vec4", + }; + static const char *boolTypes[] = { + "bool", "bvec2", "bvec3", "bvec4", + }; + + for (size_t i = 0; i < sizeof(subgroupOps)/sizeof(subgroupOps[0]); ++i) { + const char *op = subgroupOps[i]; + + // Logical operations don't support float + bool logicalOp = strstr(op, "Or") || strstr(op, "And") || + (strstr(op, "Xor") && !strstr(op, "ShuffleXor")); + // Math operations don't support bool + bool mathOp = strstr(op, "Add") || strstr(op, "Mul") || strstr(op, "Min") || strstr(op, "Max"); + + const int bufSize = 256; + char buf[bufSize]; + + if (!logicalOp) { + for (size_t j = 0; j < sizeof(floatTypes)/sizeof(floatTypes[0]); ++j) { + snprintf(buf, bufSize, op, floatTypes[j], floatTypes[j]); + commonBuiltins.append(buf); + } + if (profile != EEsProfile && version >= 400) { + for (size_t j = 0; j < sizeof(doubleTypes)/sizeof(doubleTypes[0]); ++j) { + snprintf(buf, bufSize, op, doubleTypes[j], doubleTypes[j]); + commonBuiltins.append(buf); + } + } + } + if (!mathOp) { + for (size_t j = 0; j < sizeof(boolTypes)/sizeof(boolTypes[0]); ++j) { + snprintf(buf, bufSize, op, boolTypes[j], boolTypes[j]); + commonBuiltins.append(buf); + } + } + for (size_t j = 0; j < sizeof(intTypes)/sizeof(intTypes[0]); ++j) { + snprintf(buf, bufSize, op, intTypes[j], intTypes[j]); + commonBuiltins.append(buf); } + } stageBuiltins[EShLangCompute].append( "void subgroupMemoryBarrierShared();" "\n" ); -#ifdef NV_EXTENSIONS stageBuiltins[EShLangMeshNV].append( "void subgroupMemoryBarrierShared();" "\n" @@ -2961,7 +1947,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "void subgroupMemoryBarrierShared();" "\n" ); -#endif } if (profile != EEsProfile && version >= 460) { @@ -2973,7 +1958,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } -#ifdef AMD_EXTENSIONS // GL_AMD_shader_ballot if (profile != EEsProfile && version >= 450) { commonBuiltins.append( @@ -3838,12 +2822,13 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV } // GL_AMD_gcn_shader - if (profile != EEsProfile && version >= 450) { + if (profile != EEsProfile && version >= 440) { commonBuiltins.append( "float cubeFaceIndexAMD(vec3);" "vec2 cubeFaceCoordAMD(vec3);" "uint64_t timeAMD();" + "in int gl_SIMDGroupSizeAMD;" "\n"); } @@ -3869,11 +2854,182 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } -#endif // AMD_EXTENSIONS - + if ((profile != EEsProfile && version >= 130) || + (profile == EEsProfile && version >= 300)) { + commonBuiltins.append( + "uint countLeadingZeros(uint);" + "uvec2 countLeadingZeros(uvec2);" + "uvec3 countLeadingZeros(uvec3);" + "uvec4 countLeadingZeros(uvec4);" + + "uint countTrailingZeros(uint);" + "uvec2 countTrailingZeros(uvec2);" + "uvec3 countTrailingZeros(uvec3);" + "uvec4 countTrailingZeros(uvec4);" + + "uint absoluteDifference(int, int);" + "uvec2 absoluteDifference(ivec2, ivec2);" + "uvec3 absoluteDifference(ivec3, ivec3);" + "uvec4 absoluteDifference(ivec4, ivec4);" + + "uint16_t absoluteDifference(int16_t, int16_t);" + "u16vec2 absoluteDifference(i16vec2, i16vec2);" + "u16vec3 absoluteDifference(i16vec3, i16vec3);" + "u16vec4 absoluteDifference(i16vec4, i16vec4);" + + "uint64_t absoluteDifference(int64_t, int64_t);" + "u64vec2 absoluteDifference(i64vec2, i64vec2);" + "u64vec3 absoluteDifference(i64vec3, i64vec3);" + "u64vec4 absoluteDifference(i64vec4, i64vec4);" + + "uint absoluteDifference(uint, uint);" + "uvec2 absoluteDifference(uvec2, uvec2);" + "uvec3 absoluteDifference(uvec3, uvec3);" + "uvec4 absoluteDifference(uvec4, uvec4);" + + "uint16_t absoluteDifference(uint16_t, uint16_t);" + "u16vec2 absoluteDifference(u16vec2, u16vec2);" + "u16vec3 absoluteDifference(u16vec3, u16vec3);" + "u16vec4 absoluteDifference(u16vec4, u16vec4);" + + "uint64_t absoluteDifference(uint64_t, uint64_t);" + "u64vec2 absoluteDifference(u64vec2, u64vec2);" + "u64vec3 absoluteDifference(u64vec3, u64vec3);" + "u64vec4 absoluteDifference(u64vec4, u64vec4);" + + "int addSaturate(int, int);" + "ivec2 addSaturate(ivec2, ivec2);" + "ivec3 addSaturate(ivec3, ivec3);" + "ivec4 addSaturate(ivec4, ivec4);" + + "int16_t addSaturate(int16_t, int16_t);" + "i16vec2 addSaturate(i16vec2, i16vec2);" + "i16vec3 addSaturate(i16vec3, i16vec3);" + "i16vec4 addSaturate(i16vec4, i16vec4);" + + "int64_t addSaturate(int64_t, int64_t);" + "i64vec2 addSaturate(i64vec2, i64vec2);" + "i64vec3 addSaturate(i64vec3, i64vec3);" + "i64vec4 addSaturate(i64vec4, i64vec4);" + + "uint addSaturate(uint, uint);" + "uvec2 addSaturate(uvec2, uvec2);" + "uvec3 addSaturate(uvec3, uvec3);" + "uvec4 addSaturate(uvec4, uvec4);" + + "uint16_t addSaturate(uint16_t, uint16_t);" + "u16vec2 addSaturate(u16vec2, u16vec2);" + "u16vec3 addSaturate(u16vec3, u16vec3);" + "u16vec4 addSaturate(u16vec4, u16vec4);" + + "uint64_t addSaturate(uint64_t, uint64_t);" + "u64vec2 addSaturate(u64vec2, u64vec2);" + "u64vec3 addSaturate(u64vec3, u64vec3);" + "u64vec4 addSaturate(u64vec4, u64vec4);" + + "int subtractSaturate(int, int);" + "ivec2 subtractSaturate(ivec2, ivec2);" + "ivec3 subtractSaturate(ivec3, ivec3);" + "ivec4 subtractSaturate(ivec4, ivec4);" + + "int16_t subtractSaturate(int16_t, int16_t);" + "i16vec2 subtractSaturate(i16vec2, i16vec2);" + "i16vec3 subtractSaturate(i16vec3, i16vec3);" + "i16vec4 subtractSaturate(i16vec4, i16vec4);" + + "int64_t subtractSaturate(int64_t, int64_t);" + "i64vec2 subtractSaturate(i64vec2, i64vec2);" + "i64vec3 subtractSaturate(i64vec3, i64vec3);" + "i64vec4 subtractSaturate(i64vec4, i64vec4);" + + "uint subtractSaturate(uint, uint);" + "uvec2 subtractSaturate(uvec2, uvec2);" + "uvec3 subtractSaturate(uvec3, uvec3);" + "uvec4 subtractSaturate(uvec4, uvec4);" + + "uint16_t subtractSaturate(uint16_t, uint16_t);" + "u16vec2 subtractSaturate(u16vec2, u16vec2);" + "u16vec3 subtractSaturate(u16vec3, u16vec3);" + "u16vec4 subtractSaturate(u16vec4, u16vec4);" + + "uint64_t subtractSaturate(uint64_t, uint64_t);" + "u64vec2 subtractSaturate(u64vec2, u64vec2);" + "u64vec3 subtractSaturate(u64vec3, u64vec3);" + "u64vec4 subtractSaturate(u64vec4, u64vec4);" + + "int average(int, int);" + "ivec2 average(ivec2, ivec2);" + "ivec3 average(ivec3, ivec3);" + "ivec4 average(ivec4, ivec4);" + + "int16_t average(int16_t, int16_t);" + "i16vec2 average(i16vec2, i16vec2);" + "i16vec3 average(i16vec3, i16vec3);" + "i16vec4 average(i16vec4, i16vec4);" + + "int64_t average(int64_t, int64_t);" + "i64vec2 average(i64vec2, i64vec2);" + "i64vec3 average(i64vec3, i64vec3);" + "i64vec4 average(i64vec4, i64vec4);" + + "uint average(uint, uint);" + "uvec2 average(uvec2, uvec2);" + "uvec3 average(uvec3, uvec3);" + "uvec4 average(uvec4, uvec4);" + + "uint16_t average(uint16_t, uint16_t);" + "u16vec2 average(u16vec2, u16vec2);" + "u16vec3 average(u16vec3, u16vec3);" + "u16vec4 average(u16vec4, u16vec4);" + + "uint64_t average(uint64_t, uint64_t);" + "u64vec2 average(u64vec2, u64vec2);" + "u64vec3 average(u64vec3, u64vec3);" + "u64vec4 average(u64vec4, u64vec4);" + + "int averageRounded(int, int);" + "ivec2 averageRounded(ivec2, ivec2);" + "ivec3 averageRounded(ivec3, ivec3);" + "ivec4 averageRounded(ivec4, ivec4);" + + "int16_t averageRounded(int16_t, int16_t);" + "i16vec2 averageRounded(i16vec2, i16vec2);" + "i16vec3 averageRounded(i16vec3, i16vec3);" + "i16vec4 averageRounded(i16vec4, i16vec4);" + + "int64_t averageRounded(int64_t, int64_t);" + "i64vec2 averageRounded(i64vec2, i64vec2);" + "i64vec3 averageRounded(i64vec3, i64vec3);" + "i64vec4 averageRounded(i64vec4, i64vec4);" + + "uint averageRounded(uint, uint);" + "uvec2 averageRounded(uvec2, uvec2);" + "uvec3 averageRounded(uvec3, uvec3);" + "uvec4 averageRounded(uvec4, uvec4);" + + "uint16_t averageRounded(uint16_t, uint16_t);" + "u16vec2 averageRounded(u16vec2, u16vec2);" + "u16vec3 averageRounded(u16vec3, u16vec3);" + "u16vec4 averageRounded(u16vec4, u16vec4);" + + "uint64_t averageRounded(uint64_t, uint64_t);" + "u64vec2 averageRounded(u64vec2, u64vec2);" + "u64vec3 averageRounded(u64vec3, u64vec3);" + "u64vec4 averageRounded(u64vec4, u64vec4);" + + "int multiply32x16(int, int);" + "ivec2 multiply32x16(ivec2, ivec2);" + "ivec3 multiply32x16(ivec3, ivec3);" + "ivec4 multiply32x16(ivec4, ivec4);" + + "uint multiply32x16(uint, uint);" + "uvec2 multiply32x16(uvec2, uvec2);" + "uvec3 multiply32x16(uvec3, uvec3);" + "uvec4 multiply32x16(uvec4, uvec4);" + "\n"); + } -#ifdef NV_EXTENSIONS - if ((profile != EEsProfile && version >= 450) || + if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) { commonBuiltins.append( "struct gl_TextureFootprint2DNV {" @@ -3906,7 +3062,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } -#endif // NV_EXTENSIONS // GL_AMD_gpu_shader_half_float/Explicit types if (profile != EEsProfile && version >= 450) { commonBuiltins.append( @@ -4791,7 +3946,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV // // Geometric Functions. // - if (IncludeLegacy(version, profile, spvVersion)) + if (spvVersion.vulkan == 0 && IncludeLegacy(version, profile, spvVersion)) stageBuiltins[EShLangVertex].append("vec4 ftransform();"); // @@ -4873,6 +4028,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "void EndPrimitive();" "\n"); } +#endif //============================================================================ // @@ -4888,7 +4044,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV stageBuiltins[EShLangCompute].append( "void barrier();" ); -#ifdef NV_EXTENSIONS if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) { stageBuiltins[EShLangMeshNV].append( "void barrier();" @@ -4897,23 +4052,26 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "void barrier();" ); } -#endif if ((profile != EEsProfile && version >= 130) || esBarrier) commonBuiltins.append( "void memoryBarrier();" ); if ((profile != EEsProfile && version >= 420) || esBarrier) { commonBuiltins.append( - "void memoryBarrierAtomicCounter();" "void memoryBarrierBuffer();" - "void memoryBarrierImage();" ); stageBuiltins[EShLangCompute].append( "void memoryBarrierShared();" "void groupMemoryBarrier();" ); } -#ifdef NV_EXTENSIONS +#ifndef GLSLANG_WEB + if ((profile != EEsProfile && version >= 420) || esBarrier) { + commonBuiltins.append( + "void memoryBarrierAtomicCounter();" + "void memoryBarrierImage();" + ); + } if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) { stageBuiltins[EShLangMeshNV].append( "void memoryBarrierShared();" @@ -4924,7 +4082,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "void groupMemoryBarrier();" ); } -#endif commonBuiltins.append("void controlBarrier(int, int, int, int);\n" "void memoryBarrier(int, int, int);\n"); @@ -4954,6 +4111,60 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "void coopMatStoreNV(fcoopmatNV m, volatile coherent uvec4[] buf, uint element, uint stride, bool colMajor);\n" "fcoopmatNV coopMatMulAddNV(fcoopmatNV A, fcoopmatNV B, fcoopmatNV C);\n" + "void coopMatLoadNV(out icoopmatNV m, volatile coherent int8_t[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatLoadNV(out icoopmatNV m, volatile coherent int16_t[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatLoadNV(out icoopmatNV m, volatile coherent int[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatLoadNV(out icoopmatNV m, volatile coherent int64_t[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatLoadNV(out icoopmatNV m, volatile coherent ivec2[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatLoadNV(out icoopmatNV m, volatile coherent ivec4[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatLoadNV(out icoopmatNV m, volatile coherent uint8_t[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatLoadNV(out icoopmatNV m, volatile coherent uint16_t[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatLoadNV(out icoopmatNV m, volatile coherent uint[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatLoadNV(out icoopmatNV m, volatile coherent uint64_t[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatLoadNV(out icoopmatNV m, volatile coherent uvec2[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatLoadNV(out icoopmatNV m, volatile coherent uvec4[] buf, uint element, uint stride, bool colMajor);\n" + + "void coopMatLoadNV(out ucoopmatNV m, volatile coherent int8_t[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatLoadNV(out ucoopmatNV m, volatile coherent int16_t[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatLoadNV(out ucoopmatNV m, volatile coherent int[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatLoadNV(out ucoopmatNV m, volatile coherent int64_t[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatLoadNV(out ucoopmatNV m, volatile coherent ivec2[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatLoadNV(out ucoopmatNV m, volatile coherent ivec4[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatLoadNV(out ucoopmatNV m, volatile coherent uint8_t[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatLoadNV(out ucoopmatNV m, volatile coherent uint16_t[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatLoadNV(out ucoopmatNV m, volatile coherent uint[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatLoadNV(out ucoopmatNV m, volatile coherent uint64_t[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatLoadNV(out ucoopmatNV m, volatile coherent uvec2[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatLoadNV(out ucoopmatNV m, volatile coherent uvec4[] buf, uint element, uint stride, bool colMajor);\n" + + "void coopMatStoreNV(icoopmatNV m, volatile coherent int8_t[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatStoreNV(icoopmatNV m, volatile coherent int16_t[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatStoreNV(icoopmatNV m, volatile coherent int[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatStoreNV(icoopmatNV m, volatile coherent int64_t[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatStoreNV(icoopmatNV m, volatile coherent ivec2[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatStoreNV(icoopmatNV m, volatile coherent ivec4[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatStoreNV(icoopmatNV m, volatile coherent uint8_t[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatStoreNV(icoopmatNV m, volatile coherent uint16_t[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatStoreNV(icoopmatNV m, volatile coherent uint[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatStoreNV(icoopmatNV m, volatile coherent uint64_t[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatStoreNV(icoopmatNV m, volatile coherent uvec2[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatStoreNV(icoopmatNV m, volatile coherent uvec4[] buf, uint element, uint stride, bool colMajor);\n" + + "void coopMatStoreNV(ucoopmatNV m, volatile coherent int8_t[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatStoreNV(ucoopmatNV m, volatile coherent int16_t[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatStoreNV(ucoopmatNV m, volatile coherent int[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatStoreNV(ucoopmatNV m, volatile coherent int64_t[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatStoreNV(ucoopmatNV m, volatile coherent ivec2[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatStoreNV(ucoopmatNV m, volatile coherent ivec4[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatStoreNV(ucoopmatNV m, volatile coherent uint8_t[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatStoreNV(ucoopmatNV m, volatile coherent uint16_t[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatStoreNV(ucoopmatNV m, volatile coherent uint[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatStoreNV(ucoopmatNV m, volatile coherent uint64_t[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatStoreNV(ucoopmatNV m, volatile coherent uvec2[] buf, uint element, uint stride, bool colMajor);\n" + "void coopMatStoreNV(ucoopmatNV m, volatile coherent uvec4[] buf, uint element, uint stride, bool colMajor);\n" + + "icoopmatNV coopMatMulAddNV(icoopmatNV A, icoopmatNV B, icoopmatNV C);\n" + "ucoopmatNV coopMatMulAddNV(ucoopmatNV A, ucoopmatNV B, ucoopmatNV C);\n" ); } @@ -4999,9 +4210,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } - stageBuiltins[EShLangFragment].append(derivatives); - stageBuiltins[EShLangFragment].append("\n"); - // GL_ARB_derivative_control if (profile != EEsProfile && version >= 400) { stageBuiltins[EShLangFragment].append(derivativeControls); @@ -5030,7 +4238,14 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } -#ifdef AMD_EXTENSIONS + stageBuiltins[EShLangFragment].append( + "void beginInvocationInterlockARB(void);" + "void endInvocationInterlockARB(void);"); + + stageBuiltins[EShLangFragment].append( + "bool helperInvocationEXT();" + "\n"); + // GL_AMD_shader_explicit_vertex_parameter if (profile != EEsProfile && version >= 450) { stageBuiltins[EShLangFragment].append( @@ -5081,6 +4296,16 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } + // GL_ARB_shader_clock & GL_EXT_shader_realtime_clock + if (profile != EEsProfile && version >= 450) { + commonBuiltins.append( + "uvec2 clock2x32ARB();" + "uint64_t clockARB();" + "uvec2 clockRealtime2x32EXT();" + "uint64_t clockRealtimeEXT();" + "\n"); + } + // GL_AMD_shader_fragment_mask if (profile != EEsProfile && version >= 450 && spvVersion.vulkan > 0) { stageBuiltins[EShLangFragment].append( @@ -5094,9 +4319,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } -#endif - -#ifdef NV_EXTENSIONS // Builtins for GL_NV_ray_tracing if (profile != EEsProfile && version >= 460) { @@ -5125,14 +4347,11 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV } //E_SPV_NV_compute_shader_derivatives - - stageBuiltins[EShLangCompute].append(derivatives); - stageBuiltins[EShLangCompute].append(derivativeControls); - stageBuiltins[EShLangCompute].append("\n"); - - + if ((profile == EEsProfile && version >= 320) || (profile != EEsProfile && version >= 450)) { + stageBuiltins[EShLangCompute].append(derivativeControls); + stageBuiltins[EShLangCompute].append("\n"); + } if (profile != EEsProfile && version >= 450) { - stageBuiltins[EShLangCompute].append(derivativesAndControl16bits); stageBuiltins[EShLangCompute].append(derivativesAndControl64bits); stageBuiltins[EShLangCompute].append("\n"); @@ -5142,7 +4361,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) { stageBuiltins[EShLangMeshNV].append( "void writePackedPrimitiveIndices4x8NV(uint, uint);" - "\n"); + "\n"); } #endif @@ -5166,11 +4385,13 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "highp float diff;" // f - n ); } else { +#ifndef GLSLANG_WEB commonBuiltins.append( "float near;" // n "float far;" // f "float diff;" // f - n ); +#endif } commonBuiltins.append( @@ -5179,6 +4400,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } +#ifndef GLSLANG_WEB if (spvVersion.spv == 0 && IncludeLegacy(version, profile, spvVersion)) { // // Matrix state. p. 31, 32, 37, 39, 40. @@ -5296,6 +4518,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } +#endif //============================================================================ // @@ -5325,7 +4548,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } -#ifdef NV_EXTENSIONS +#ifndef GLSLANG_WEB //============================================================================ // // Define the interface to the mesh/task shader. @@ -5413,7 +4636,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } } -#endif //============================================================================ // @@ -5547,7 +4769,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV ); } -#ifdef NV_EXTENSIONS if (version >= 450) stageBuiltins[EShLangVertex].append( "out int gl_ViewportMask[];" // GL_NV_viewport_array2 @@ -5556,8 +4777,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "out vec4 gl_PositionPerViewNV[];" // GL_NVX_multiview_per_view_attributes "out int gl_ViewportMaskPerViewNV[];" // GL_NVX_multiview_per_view_attributes ); -#endif - } else { // ES profile if (version == 100) { @@ -5572,15 +4791,19 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "in highp int gl_InstanceID;" // needs qualifier fixed later ); if (spvVersion.vulkan > 0) +#endif stageBuiltins[EShLangVertex].append( "in highp int gl_VertexIndex;" "in highp int gl_InstanceIndex;" ); +#ifndef GLSLANG_WEB if (version < 310) +#endif stageBuiltins[EShLangVertex].append( "highp vec4 gl_Position;" // needs qualifier fixed later "highp float gl_PointSize;" // needs qualifier fixed later ); +#ifndef GLSLANG_WEB else stageBuiltins[EShLangVertex].append( "out gl_PerVertex {" @@ -5632,10 +4855,8 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV if (version >= 450) stageBuiltins[EShLangGeometry].append( "float gl_CullDistance[];" -#ifdef NV_EXTENSIONS "vec4 gl_SecondaryPositionNV;" // GL_NV_stereo_view_rendering "vec4 gl_PositionPerViewNV[];" // GL_NVX_multiview_per_view_attributes -#endif ); stageBuiltins[EShLangGeometry].append( "} gl_in[];" @@ -5681,7 +4902,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "in int gl_InvocationID;" ); -#ifdef NV_EXTENSIONS if (version >= 450) stageBuiltins[EShLangGeometry].append( "out int gl_ViewportMask[];" // GL_NV_viewport_array2 @@ -5690,7 +4910,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "out vec4 gl_PositionPerViewNV[];" // GL_NVX_multiview_per_view_attributes "out int gl_ViewportMaskPerViewNV[];" // GL_NVX_multiview_per_view_attributes ); -#endif stageBuiltins[EShLangGeometry].append("\n"); } else if (profile == EEsProfile && version >= 310) { @@ -5755,13 +4974,11 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV if (version >= 450) stageBuiltins[EShLangTessControl].append( "float gl_CullDistance[];" -#ifdef NV_EXTENSIONS "int gl_ViewportMask[];" // GL_NV_viewport_array2 "vec4 gl_SecondaryPositionNV;" // GL_NV_stereo_view_rendering "int gl_SecondaryViewportMaskNV[];" // GL_NV_stereo_view_rendering "vec4 gl_PositionPerViewNV[];" // GL_NVX_multiview_per_view_attributes "int gl_ViewportMaskPerViewNV[];" // GL_NVX_multiview_per_view_attributes -#endif ); stageBuiltins[EShLangTessControl].append( "} gl_out[];" @@ -5860,7 +5077,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "out int gl_Layer;" "\n"); -#ifdef NV_EXTENSIONS if (version >= 450) stageBuiltins[EShLangTessEvaluation].append( "out int gl_ViewportMask[];" // GL_NV_viewport_array2 @@ -5869,7 +5085,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "out vec4 gl_PositionPerViewNV[];" // GL_NVX_multiview_per_view_attributes "out int gl_ViewportMaskPerViewNV[];" // GL_NVX_multiview_per_view_attributes ); -#endif } else if (profile == EEsProfile && version >= 310) { // Note: "in gl_PerVertex {...} gl_in[gl_MaxPatchVertices];" is declared in initialize() below, @@ -5963,19 +5178,25 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "flat in int gl_PrimitiveID;" ); - if (version >= 400) { + if (version >= 130) { // ARB_sample_shading stageBuiltins[EShLangFragment].append( "flat in int gl_SampleID;" " in vec2 gl_SamplePosition;" - "flat in int gl_SampleMaskIn[];" " out int gl_SampleMask[];" ); - if (spvVersion.spv == 0) + + if (spvVersion.spv == 0) { stageBuiltins[EShLangFragment].append( "uniform int gl_NumSamples;" - ); + ); + } } + if (version >= 400) + stageBuiltins[EShLangFragment].append( + "flat in int gl_SampleMaskIn[];" + ); + if (version >= 430) stageBuiltins[EShLangFragment].append( "flat in int gl_Layer;" @@ -5994,7 +5215,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "flat in int gl_FragInvocationCountEXT;" ); -#ifdef AMD_EXTENSIONS if (version >= 450) stageBuiltins[EShLangFragment].append( "in vec2 gl_BaryCoordNoPerspAMD;" @@ -6005,9 +5225,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "in vec2 gl_BaryCoordSmoothSampleAMD;" "in vec3 gl_BaryCoordPullModelAMD;" ); -#endif -#ifdef NV_EXTENSIONS if (version >= 430) stageBuiltins[EShLangFragment].append( "in bool gl_FragFullyCoveredNV;" @@ -6020,7 +5238,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "in vec3 gl_BaryCoordNoPerspNV;" ); -#endif } else { // ES profile @@ -6032,6 +5249,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "mediump vec2 gl_PointCoord;" // needs qualifier fixed later ); } +#endif if (version >= 300) { stageBuiltins[EShLangFragment].append( "highp vec4 gl_FragCoord;" // needs qualifier fixed later @@ -6040,6 +5258,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "highp float gl_FragDepth;" // needs qualifier fixed later ); } +#ifndef GLSLANG_WEB if (version >= 310) { stageBuiltins[EShLangFragment].append( "bool gl_HelperInvocation;" // needs qualifier fixed later @@ -6067,7 +5286,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "flat in ivec2 gl_FragSizeEXT;" "flat in int gl_FragInvocationCountEXT;" ); -#ifdef NV_EXTENSIONS if (version >= 320) stageBuiltins[EShLangFragment].append( // GL_NV_shading_rate_image "flat in ivec2 gl_FragmentSizeNV;" @@ -6078,17 +5296,19 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "in vec3 gl_BaryCoordNV;" "in vec3 gl_BaryCoordNoPerspNV;" ); + } #endif - } stageBuiltins[EShLangFragment].append("\n"); if (version >= 130) add2ndGenerationSamplingImaging(version, profile, spvVersion); +#ifndef GLSLANG_WEB + // GL_ARB_shader_ballot if (profile != EEsProfile && version >= 450) { - const char* ballotDecls = + const char* ballotDecls = "uniform uint gl_SubGroupSizeARB;" "in uint gl_SubGroupInvocationARB;" "in uint64_t gl_SubGroupEqMaskARB;" @@ -6097,7 +5317,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "in uint64_t gl_SubGroupLeMaskARB;" "in uint64_t gl_SubGroupLtMaskARB;" "\n"; - const char* fragmentBallotDecls = + const char* fragmentBallotDecls = "uniform uint gl_SubGroupSizeARB;" "flat in uint gl_SubGroupInvocationARB;" "flat in uint64_t gl_SubGroupEqMaskARB;" @@ -6112,10 +5332,8 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV stageBuiltins[EShLangGeometry] .append(ballotDecls); stageBuiltins[EShLangCompute] .append(ballotDecls); stageBuiltins[EShLangFragment] .append(fragmentBallotDecls); -#ifdef NV_EXTENSIONS stageBuiltins[EShLangMeshNV] .append(ballotDecls); stageBuiltins[EShLangTaskNV] .append(ballotDecls); -#endif } if ((profile != EEsProfile && version >= 140) || @@ -6129,7 +5347,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV // GL_KHR_shader_subgroup if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 140)) { - const char* ballotDecls = + const char* subgroupDecls = "in mediump uint gl_SubgroupSize;" "in mediump uint gl_SubgroupInvocationID;" "in highp uvec4 gl_SubgroupEqMask;" @@ -6137,8 +5355,13 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "in highp uvec4 gl_SubgroupGtMask;" "in highp uvec4 gl_SubgroupLeMask;" "in highp uvec4 gl_SubgroupLtMask;" + // GL_NV_shader_sm_builtins + "in highp uint gl_WarpsPerSMNV;" + "in highp uint gl_SMCountNV;" + "in highp uint gl_WarpIDNV;" + "in highp uint gl_SMIDNV;" "\n"; - const char* fragmentBallotDecls = + const char* fragmentSubgroupDecls = "flat in mediump uint gl_SubgroupSize;" "flat in mediump uint gl_SubgroupInvocationID;" "flat in highp uvec4 gl_SubgroupEqMask;" @@ -6146,35 +5369,36 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "flat in highp uvec4 gl_SubgroupGtMask;" "flat in highp uvec4 gl_SubgroupLeMask;" "flat in highp uvec4 gl_SubgroupLtMask;" + // GL_NV_shader_sm_builtins + "flat in highp uint gl_WarpsPerSMNV;" + "flat in highp uint gl_SMCountNV;" + "flat in highp uint gl_WarpIDNV;" + "flat in highp uint gl_SMIDNV;" + "\n"; + const char* computeSubgroupDecls = + "in highp uint gl_NumSubgroups;" + "in highp uint gl_SubgroupID;" "\n"; - stageBuiltins[EShLangVertex] .append(ballotDecls); - stageBuiltins[EShLangTessControl] .append(ballotDecls); - stageBuiltins[EShLangTessEvaluation].append(ballotDecls); - stageBuiltins[EShLangGeometry] .append(ballotDecls); - stageBuiltins[EShLangCompute] .append(ballotDecls); - stageBuiltins[EShLangFragment] .append(fragmentBallotDecls); -#ifdef NV_EXTENSIONS - stageBuiltins[EShLangMeshNV] .append(ballotDecls); - stageBuiltins[EShLangTaskNV] .append(ballotDecls); -#endif - stageBuiltins[EShLangCompute].append( - "highp in uint gl_NumSubgroups;" - "highp in uint gl_SubgroupID;" - "\n"); -#ifdef NV_EXTENSIONS - stageBuiltins[EShLangMeshNV].append( - "highp in uint gl_NumSubgroups;" - "highp in uint gl_SubgroupID;" - "\n"); - stageBuiltins[EShLangTaskNV].append( - "highp in uint gl_NumSubgroups;" - "highp in uint gl_SubgroupID;" - "\n"); -#endif + stageBuiltins[EShLangVertex] .append(subgroupDecls); + stageBuiltins[EShLangTessControl] .append(subgroupDecls); + stageBuiltins[EShLangTessEvaluation].append(subgroupDecls); + stageBuiltins[EShLangGeometry] .append(subgroupDecls); + stageBuiltins[EShLangCompute] .append(subgroupDecls); + stageBuiltins[EShLangCompute] .append(computeSubgroupDecls); + stageBuiltins[EShLangFragment] .append(fragmentSubgroupDecls); + stageBuiltins[EShLangMeshNV] .append(subgroupDecls); + stageBuiltins[EShLangMeshNV] .append(computeSubgroupDecls); + stageBuiltins[EShLangTaskNV] .append(subgroupDecls); + stageBuiltins[EShLangTaskNV] .append(computeSubgroupDecls); + stageBuiltins[EShLangRayGenNV] .append(subgroupDecls); + stageBuiltins[EShLangIntersectNV] .append(subgroupDecls); + stageBuiltins[EShLangAnyHitNV] .append(subgroupDecls); + stageBuiltins[EShLangClosestHitNV] .append(subgroupDecls); + stageBuiltins[EShLangMissNV] .append(subgroupDecls); + stageBuiltins[EShLangCallableNV] .append(subgroupDecls); } -#ifdef NV_EXTENSIONS // GL_NV_ray_tracing if (profile != EEsProfile && version >= 460) { @@ -6274,7 +5498,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV stageBuiltins[EShLangClosestHitNV].append(deviceIndex); stageBuiltins[EShLangMissNV].append(deviceIndex); } -#endif if (version >= 300 /* both ES and non-ES */) { stageBuiltins[EShLangFragment].append( @@ -6296,6 +5519,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV commonBuiltins.append("const int gl_SemanticsAcquireRelease = 0x8;\n"); commonBuiltins.append("const int gl_SemanticsMakeAvailable = 0x2000;\n"); commonBuiltins.append("const int gl_SemanticsMakeVisible = 0x4000;\n"); + commonBuiltins.append("const int gl_SemanticsVolatile = 0x8000;\n"); commonBuiltins.append("const int gl_StorageSemanticsNone = 0x0;\n"); commonBuiltins.append("const int gl_StorageSemanticsBuffer = 0x40;\n"); @@ -6303,6 +5527,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV commonBuiltins.append("const int gl_StorageSemanticsImage = 0x800;\n"); commonBuiltins.append("const int gl_StorageSemanticsOutput = 0x1000;\n"); } +#endif // printf("%s\n", commonBuiltins.c_str()); // printf("%s\n", stageBuiltins[EShLangFragment].c_str()); @@ -6318,19 +5543,27 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c // In this function proper, enumerate the types, then calls the next set of functions // to enumerate all the uses for that type. // -#ifdef AMD_EXTENSIONS - TBasicType bTypes[4] = { EbtFloat, EbtFloat16, EbtInt, EbtUint }; + + // enumerate all the types +#ifdef GLSLANG_WEB + const TBasicType bTypes[] = { EbtFloat, EbtInt, EbtUint }; + bool skipBuffer = true; + bool skipCubeArrayed = true; + const int image = 0; #else - TBasicType bTypes[3] = { EbtFloat, EbtInt, EbtUint }; -#endif + const TBasicType bTypes[] = { EbtFloat, EbtInt, EbtUint, EbtFloat16 }; bool skipBuffer = (profile == EEsProfile && version < 310) || (profile != EEsProfile && version < 140); bool skipCubeArrayed = (profile == EEsProfile && version < 310) || (profile != EEsProfile && version < 130); - - // enumerate all the types - for (int image = 0; image <= 1; ++image) { // loop over "bool" image vs sampler - + for (int image = 0; image <= 1; ++image) // loop over "bool" image vs sampler +#endif + { for (int shadow = 0; shadow <= 1; ++shadow) { // loop over "bool" shadow or not - for (int ms = 0; ms <=1; ++ms) { +#ifdef GLSLANG_WEB + const int ms = 0; +#else + for (int ms = 0; ms <= 1; ++ms) // loop over "bool" multisample or not +#endif + { if ((ms || image) && shadow) continue; if (ms && profile != EEsProfile && version < 150) @@ -6341,20 +5574,23 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c continue; for (int arrayed = 0; arrayed <= 1; ++arrayed) { // loop over "bool" arrayed or not - for (int dim = Esd1D; dim < EsdNumDims; ++dim) { // 1D, 2D, ..., buffer +#ifdef GLSLANG_WEB + for (int dim = Esd2D; dim <= EsdCube; ++dim) { // 2D, 3D, and Cube +#else + for (int dim = Esd1D; dim < EsdNumDims; ++dim) { // 1D, ..., buffer, subpass if (dim == EsdSubpass && spvVersion.vulkan == 0) continue; if (dim == EsdSubpass && (image || shadow || arrayed)) continue; if ((dim == Esd1D || dim == EsdRect) && profile == EEsProfile) continue; - if (dim != Esd2D && dim != EsdSubpass && ms) + if (dim == EsdSubpass && spvVersion.vulkan == 0) continue; - if ((dim == Esd3D || dim == EsdRect) && arrayed) + if (dim == EsdSubpass && (image || shadow || arrayed)) continue; - if (dim == Esd3D && shadow) + if ((dim == Esd1D || dim == EsdRect) && profile == EEsProfile) continue; - if (dim == EsdCube && arrayed && skipCubeArrayed) + if (dim != Esd2D && dim != EsdSubpass && ms) continue; if (dim == EsdBuffer && skipBuffer) continue; @@ -6362,31 +5598,35 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c continue; if (ms && arrayed && profile == EEsProfile && version < 310) continue; -#ifdef AMD_EXTENSIONS - for (int bType = 0; bType < 4; ++bType) { // float, float16, int, uint results - - if (shadow && bType > 1) - continue; +#endif + if (dim == Esd3D && shadow) + continue; + if (dim == EsdCube && arrayed && skipCubeArrayed) + continue; + if ((dim == Esd3D || dim == EsdRect) && arrayed) + continue; - if (bTypes[bType] == EbtFloat16 && (profile == EEsProfile ||version < 450)) + // Loop over the bTypes + for (size_t bType = 0; bType < sizeof(bTypes)/sizeof(TBasicType); ++bType) { +#ifndef GLSLANG_WEB + if (bTypes[bType] == EbtFloat16 && (profile == EEsProfile || version < 450)) continue; -#else - for (int bType = 0; bType < 3; ++bType) { // float, int, uint results - - if (shadow && bType > 0) + if (dim == EsdRect && version < 140 && bType > 0) continue; #endif - if (dim == EsdRect && version < 140 && bType > 0) + if (shadow && (bTypes[bType] == EbtInt || bTypes[bType] == EbtUint)) continue; // // Now, make all the function prototypes for the type we just built... // - TSampler sampler; +#ifndef GLSLANG_WEB if (dim == EsdSubpass) { sampler.setSubpass(bTypes[bType], ms ? true : false); - } else if (image) { + } else +#endif + if (image) { sampler.setImage(bTypes[bType], (TSamplerDim)dim, arrayed ? true : false, shadow ? true : false, ms ? true : false); @@ -6398,10 +5638,12 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c TString typeName = sampler.getString(); +#ifndef GLSLANG_WEB if (dim == EsdSubpass) { addSubpassSampling(sampler, typeName, version, profile); continue; } +#endif addQueryFunctions(sampler, typeName, version, profile); @@ -6409,8 +5651,8 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c addImageFunctions(sampler, typeName, version, profile); else { addSamplingFunctions(sampler, typeName, version, profile); +#ifndef GLSLANG_WEB addGatherFunctions(sampler, typeName, version, profile); - if (spvVersion.vulkan > 0 && sampler.isCombined() && !sampler.shadow) { // Base Vulkan allows texelFetch() for // textureBuffer (i.e. without sampler). @@ -6425,6 +5667,7 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c addSamplingFunctions(sampler, textureTypeName, version, profile); addQueryFunctions(sampler, textureTypeName, version, profile); } +#endif } } } @@ -6436,7 +5679,6 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c // // sparseTexelsResidentARB() // - if (profile != EEsProfile && version >= 450) { commonBuiltins.append("bool sparseTexelsResidentARB(int code);\n"); } @@ -6450,14 +5692,25 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c // void TBuiltIns::addQueryFunctions(TSampler sampler, const TString& typeName, int version, EProfile profile) { - if (sampler.image && ((profile == EEsProfile && version < 310) || (profile != EEsProfile && version < 430))) - return; - // // textureSize() and imageSize() // int sizeDims = dimMap[sampler.dim] + (sampler.arrayed ? 1 : 0) - (sampler.dim == EsdCube ? 1 : 0); + +#ifdef GLSLANG_WEB + commonBuiltins.append("highp "); + commonBuiltins.append("ivec"); + commonBuiltins.append(postfixes[sizeDims]); + commonBuiltins.append(" textureSize("); + commonBuiltins.append(typeName); + commonBuiltins.append(",int);\n"); + return; +#endif + + if (sampler.isImage() && ((profile == EEsProfile && version < 310) || (profile != EEsProfile && version < 430))) + return; + if (profile == EEsProfile) commonBuiltins.append("highp "); if (sizeDims == 1) @@ -6466,12 +5719,12 @@ void TBuiltIns::addQueryFunctions(TSampler sampler, const TString& typeName, int commonBuiltins.append("ivec"); commonBuiltins.append(postfixes[sizeDims]); } - if (sampler.image) + if (sampler.isImage()) commonBuiltins.append(" imageSize(readonly writeonly volatile coherent "); else commonBuiltins.append(" textureSize("); commonBuiltins.append(typeName); - if (! sampler.image && sampler.dim != EsdRect && sampler.dim != EsdBuffer && ! sampler.ms) + if (! sampler.isImage() && ! sampler.isRect() && ! sampler.isBuffer() && ! sampler.isMultiSample()) commonBuiltins.append(",int);\n"); else commonBuiltins.append(");\n"); @@ -6482,9 +5735,9 @@ void TBuiltIns::addQueryFunctions(TSampler sampler, const TString& typeName, int // GL_ARB_shader_texture_image_samples // TODO: spec issue? there are no memory qualifiers; how to query a writeonly/readonly image, etc? - if (profile != EEsProfile && version >= 430 && sampler.ms) { + if (profile != EEsProfile && version >= 430 && sampler.isMultiSample()) { commonBuiltins.append("int "); - if (sampler.image) + if (sampler.isImage()) commonBuiltins.append("imageSamples(readonly writeonly volatile coherent "); else commonBuiltins.append("textureSamples("); @@ -6496,40 +5749,28 @@ void TBuiltIns::addQueryFunctions(TSampler sampler, const TString& typeName, int // textureQueryLod(), fragment stage only // - if (profile != EEsProfile && version >= 400 && sampler.combined && sampler.dim != EsdRect && ! sampler.ms && sampler.dim != EsdBuffer) { -#ifdef AMD_EXTENSIONS + if (profile != EEsProfile && version >= 400 && sampler.isCombined() && sampler.dim != EsdRect && + ! sampler.isMultiSample() && ! sampler.isBuffer()) { for (int f16TexAddr = 0; f16TexAddr < 2; ++f16TexAddr) { if (f16TexAddr && sampler.type != EbtFloat16) continue; -#endif stageBuiltins[EShLangFragment].append("vec2 textureQueryLod("); 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 } -#endif -#ifdef NV_EXTENSIONS stageBuiltins[EShLangCompute].append("vec2 textureQueryLod("); stageBuiltins[EShLangCompute].append(typeName); if (dimMap[sampler.dim] == 1) @@ -6539,14 +5780,14 @@ void TBuiltIns::addQueryFunctions(TSampler sampler, const TString& typeName, int stageBuiltins[EShLangCompute].append(postfixes[dimMap[sampler.dim]]); } stageBuiltins[EShLangCompute].append(");\n"); -#endif } // // textureQueryLevels() // - if (profile != EEsProfile && version >= 430 && ! sampler.image && sampler.dim != EsdRect && ! sampler.ms && sampler.dim != EsdBuffer) { + if (profile != EEsProfile && version >= 430 && ! sampler.isImage() && sampler.dim != EsdRect && + ! sampler.isMultiSample() && ! sampler.isBuffer()) { commonBuiltins.append("int textureQueryLevels("); commonBuiltins.append(typeName); commonBuiltins.append(");\n"); @@ -6573,7 +5814,7 @@ void TBuiltIns::addImageFunctions(TSampler sampler, const TString& typeName, int imageParams.append(", ivec"); imageParams.append(postfixes[dims]); } - if (sampler.ms) + if (sampler.isMultiSample()) imageParams.append(", int"); if (profile == EEsProfile) @@ -6589,7 +5830,7 @@ void TBuiltIns::addImageFunctions(TSampler sampler, const TString& typeName, int commonBuiltins.append(prefixes[sampler.type]); commonBuiltins.append("vec4);\n"); - if (sampler.dim != Esd1D && sampler.dim != EsdBuffer && profile != EEsProfile && version >= 450) { + if (! sampler.is1D() && ! sampler.isBuffer() && profile != EEsProfile && version >= 450) { commonBuiltins.append("int sparseImageLoadARB(readonly volatile coherent "); commonBuiltins.append(imageParams); commonBuiltins.append(", out "); @@ -6666,8 +5907,7 @@ void TBuiltIns::addImageFunctions(TSampler sampler, const TString& typeName, int } } -#ifdef AMD_EXTENSIONS - if (sampler.dim == EsdRect || sampler.dim == EsdBuffer || sampler.shadow || sampler.ms) + if (sampler.dim == EsdRect || sampler.dim == EsdBuffer || sampler.shadow || sampler.isMultiSample()) return; if (profile == EEsProfile || version < 450) @@ -6693,7 +5933,7 @@ void TBuiltIns::addImageFunctions(TSampler sampler, const TString& typeName, int commonBuiltins.append(prefixes[sampler.type]); commonBuiltins.append("vec4);\n"); - if (sampler.dim != Esd1D) { + if (! sampler.is1D()) { commonBuiltins.append("int sparseImageLoadLodAMD(readonly volatile coherent "); commonBuiltins.append(imageLodParams); commonBuiltins.append(", out "); @@ -6701,7 +5941,6 @@ void TBuiltIns::addImageFunctions(TSampler sampler, const TString& typeName, int commonBuiltins.append("vec4"); commonBuiltins.append(");\n"); } -#endif } // @@ -6716,7 +5955,7 @@ void TBuiltIns::addSubpassSampling(TSampler sampler, const TString& typeName, in stageBuiltins[EShLangFragment].append("vec4 subpassLoad"); stageBuiltins[EShLangFragment].append("("); stageBuiltins[EShLangFragment].append(typeName.c_str()); - if (sampler.ms) + if (sampler.isMultiSample()) stageBuiltins[EShLangFragment].append(", int"); stageBuiltins[EShLangFragment].append(");\n"); } @@ -6729,17 +5968,23 @@ void TBuiltIns::addSubpassSampling(TSampler sampler, const TString& typeName, in // void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName, int version, EProfile profile) { +#ifdef GLSLANG_WEB + profile = EEsProfile; + version = 310; +#endif + // // texturing // for (int proj = 0; proj <= 1; ++proj) { // loop over "bool" projective or not - if (proj && (sampler.dim == EsdCube || sampler.dim == EsdBuffer || sampler.arrayed || sampler.ms || !sampler.combined)) + if (proj && (sampler.dim == EsdCube || sampler.isBuffer() || sampler.arrayed || sampler.isMultiSample() + || !sampler.isCombined())) continue; for (int lod = 0; lod <= 1; ++lod) { - if (lod && (sampler.dim == EsdBuffer || sampler.dim == EsdRect || sampler.ms || !sampler.combined)) + if (lod && (sampler.isBuffer() || sampler.isRect() || sampler.isMultiSample() || !sampler.isCombined())) continue; if (lod && sampler.dim == Esd2D && sampler.arrayed && sampler.shadow) continue; @@ -6748,18 +5993,18 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName, for (int bias = 0; bias <= 1; ++bias) { - if (bias && (lod || sampler.ms || !sampler.combined)) + if (bias && (lod || sampler.isMultiSample() || !sampler.isCombined())) continue; if (bias && (sampler.dim == Esd2D || sampler.dim == EsdCube) && sampler.shadow && sampler.arrayed) continue; - if (bias && (sampler.dim == EsdRect || sampler.dim == EsdBuffer)) + if (bias && (sampler.isRect() || sampler.isBuffer())) continue; for (int offset = 0; offset <= 1; ++offset) { // loop over "bool" offset or not if (proj + offset + bias + lod > 3) continue; - if (offset && (sampler.dim == EsdCube || sampler.dim == EsdBuffer || sampler.ms)) + if (offset && (sampler.dim == EsdCube || sampler.isBuffer() || sampler.isMultiSample())) continue; for (int fetch = 0; fetch <= 1; ++fetch) { // loop over "bool" fetch or not @@ -6770,14 +6015,15 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName, continue; if (fetch && (sampler.shadow || sampler.dim == EsdCube)) continue; - if (fetch == 0 && (sampler.ms || sampler.dim == EsdBuffer || !sampler.combined)) + if (fetch == 0 && (sampler.isMultiSample() || sampler.isBuffer() + || !sampler.isCombined())) continue; for (int grad = 0; grad <= 1; ++grad) { // loop over "bool" grad or not - if (grad && (lod || bias || sampler.ms || !sampler.combined)) + if (grad && (lod || bias || sampler.isMultiSample() || !sampler.isCombined())) continue; - if (grad && sampler.dim == EsdBuffer) + if (grad && sampler.isBuffer()) continue; if (proj + offset + fetch + grad + bias + lod > 3) continue; @@ -6797,31 +6043,46 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName, if (extraProj && ! proj) continue; - if (extraProj && (sampler.dim == Esd3D || sampler.shadow || !sampler.combined)) + if (extraProj && (sampler.dim == Esd3D || sampler.shadow || !sampler.isCombined())) continue; -#ifdef AMD_EXTENSIONS - for (int f16TexAddr = 0; f16TexAddr <= 1; ++f16TexAddr) { // loop over 16-bit floating-point texel addressing + // loop over 16-bit floating-point texel addressing +#ifdef GLSLANG_WEB + const int f16TexAddr = 0; +#else + for (int f16TexAddr = 0; f16TexAddr <= 1; ++f16TexAddr) +#endif + { if (f16TexAddr && sampler.type != EbtFloat16) continue; if (f16TexAddr && sampler.shadow && ! compare) { compare = true; // compare argument is always present totalDims--; } + // loop over "bool" lod clamp +#ifdef GLSLANG_WEB + const int lodClamp = 0; +#else + for (int lodClamp = 0; lodClamp <= 1 ;++lodClamp) #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 - + // loop over "bool" sparse or not +#ifdef GLSLANG_WEB + const int sparse = 0; +#else + for (int sparse = 0; sparse <= 1; ++sparse) +#endif + { 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)) + // Sparse sampling is not for 1D/1D array texture, buffer texture, and + // projective texture + if (sparse && (sampler.is1D() || sampler.isBuffer() || proj)) continue; TString s; @@ -6831,14 +6092,10 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName, 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 "); @@ -6876,7 +6133,6 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName, // sampler type s.append(typeName); -#ifdef AMD_EXTENSIONS // P coordinate if (extraProj) { if (f16TexAddr) @@ -6894,31 +6150,15 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName, 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)) + if ((fetch && !sampler.isBuffer() && + !sampler.isRect() && !sampler.isMultiSample()) + || (sampler.isMultiSample() && fetch)) s.append(",int"); -#ifdef AMD_EXTENSIONS // non-optional lod if (lod) { if (f16TexAddr) @@ -6947,23 +6187,6 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName, 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) @@ -6974,7 +6197,6 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName, } } -#ifdef AMD_EXTENSIONS // lod clamp if (lodClamp) { if (f16TexAddr) @@ -6982,29 +6204,19 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName, 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) @@ -7012,27 +6224,18 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName, 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); -#ifdef NV_EXTENSIONS stageBuiltins[EShLangCompute].append(s); -#endif } else commonBuiltins.append(s); } } -#ifdef AMD_EXTENSIONS } -#endif } } } @@ -7050,6 +6253,11 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName, // void TBuiltIns::addGatherFunctions(TSampler sampler, const TString& typeName, int version, EProfile profile) { +#ifdef GLSLANG_WEB + profile = EEsProfile; + version = 310; +#endif + switch (sampler.dim) { case Esd2D: case EsdRect: @@ -7059,18 +6267,16 @@ void TBuiltIns::addGatherFunctions(TSampler sampler, const TString& typeName, in return; } - if (sampler.ms) + if (sampler.isMultiSample()) return; if (version < 140 && sampler.dim == EsdRect && sampler.type != EbtFloat) return; -#ifdef AMD_EXTENSIONS for (int f16TexAddr = 0; f16TexAddr <= 1; ++f16TexAddr) { // loop over 16-bit floating-point texel addressing 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 for (int comp = 0; comp < 2; ++comp) { // loop over presence of comp argument @@ -7118,14 +6324,10 @@ void TBuiltIns::addGatherFunctions(TSampler sampler, const TString& typeName, in 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]); @@ -7153,14 +6355,11 @@ void TBuiltIns::addGatherFunctions(TSampler sampler, const TString& typeName, in s.append(");\n"); commonBuiltins.append(s); -#ifdef AMD_EXTENSIONS } -#endif } } } -#ifdef AMD_EXTENSIONS if (sampler.dim == EsdRect || sampler.shadow) return; @@ -7286,7 +6485,6 @@ void TBuiltIns::addGatherFunctions(TSampler sampler, const TString& typeName, in } } } -#endif } // @@ -7298,6 +6496,11 @@ void TBuiltIns::addGatherFunctions(TSampler sampler, const TString& typeName, in // void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language) { +#ifdef GLSLANG_WEB + version = 310; + profile = EEsProfile; +#endif + // // Initialize the context-dependent (resource-dependent) built-in strings for parsing. // @@ -7309,7 +6512,7 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf //============================================================================ TString& s = commonBuiltins; - const int maxSize = 80; + const int maxSize = 200; char builtInConstant[maxSize]; // @@ -7355,6 +6558,7 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf s.append(builtInConstant); } +#ifndef GLSLANG_WEB if (version >= 310) { // geometry @@ -7413,10 +6617,8 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf "in gl_PerVertex {" "highp vec4 gl_Position;" "highp float gl_PointSize;" -#ifdef NV_EXTENSIONS "highp vec4 gl_SecondaryPositionNV;" // GL_NV_stereo_view_rendering "highp vec4 gl_PositionPerViewNV[];" // GL_NVX_multiview_per_view_attributes -#endif "} gl_in[gl_MaxPatchVertices];" "\n"); } @@ -7425,6 +6627,14 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf } else { // non-ES profile + if (version > 400) { + snprintf(builtInConstant, maxSize, "const int gl_MaxVertexUniformVectors = %d;", resources.maxVertexUniformVectors); + s.append(builtInConstant); + + snprintf(builtInConstant, maxSize, "const int gl_MaxFragmentUniformVectors = %d;", resources.maxFragmentUniformVectors); + s.append(builtInConstant); + } + snprintf(builtInConstant, maxSize, "const int gl_MaxVertexAttribs = %d;", resources.maxVertexAttribs); s.append(builtInConstant); @@ -7603,10 +6813,8 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf if (profile != EEsProfile && version >= 450) s.append( "float gl_CullDistance[];" -#ifdef NV_EXTENSIONS "vec4 gl_SecondaryPositionNV;" // GL_NV_stereo_view_rendering "vec4 gl_PositionPerViewNV[];" // GL_NVX_multiview_per_view_attributes -#endif ); s.append( "} gl_in[gl_MaxPatchVertices];" @@ -7640,8 +6848,29 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf snprintf(builtInConstant, maxSize, "const int gl_MaxTransformFeedbackInterleavedComponents = %d;", resources.maxTransformFeedbackInterleavedComponents); s.append(builtInConstant); } +#endif + } + + // compute + if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 420)) { + snprintf(builtInConstant, maxSize, "const ivec3 gl_MaxComputeWorkGroupCount = ivec3(%d,%d,%d);", resources.maxComputeWorkGroupCountX, + resources.maxComputeWorkGroupCountY, + resources.maxComputeWorkGroupCountZ); + s.append(builtInConstant); + snprintf(builtInConstant, maxSize, "const ivec3 gl_MaxComputeWorkGroupSize = ivec3(%d,%d,%d);", resources.maxComputeWorkGroupSizeX, + resources.maxComputeWorkGroupSizeY, + resources.maxComputeWorkGroupSizeZ); + s.append(builtInConstant); + + snprintf(builtInConstant, maxSize, "const int gl_MaxComputeUniformComponents = %d;", resources.maxComputeUniformComponents); + s.append(builtInConstant); + snprintf(builtInConstant, maxSize, "const int gl_MaxComputeTextureImageUnits = %d;", resources.maxComputeTextureImageUnits); + s.append(builtInConstant); + + s.append("\n"); } +#ifndef GLSLANG_WEB // images (some in compute below) if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 130)) { @@ -7657,6 +6886,18 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf s.append(builtInConstant); } + // compute + if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 420)) { + snprintf(builtInConstant, maxSize, "const int gl_MaxComputeImageUniforms = %d;", resources.maxComputeImageUniforms); + s.append(builtInConstant); + snprintf(builtInConstant, maxSize, "const int gl_MaxComputeAtomicCounters = %d;", resources.maxComputeAtomicCounters); + s.append(builtInConstant); + snprintf(builtInConstant, maxSize, "const int gl_MaxComputeAtomicCounterBuffers = %d;", resources.maxComputeAtomicCounterBuffers); + s.append(builtInConstant); + + s.append("\n"); + } + // atomic counters (some in compute below) if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 420)) { @@ -7694,31 +6935,6 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf s.append("\n"); } - // compute - if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 420)) { - snprintf(builtInConstant, maxSize, "const ivec3 gl_MaxComputeWorkGroupCount = ivec3(%d,%d,%d);", resources.maxComputeWorkGroupCountX, - resources.maxComputeWorkGroupCountY, - resources.maxComputeWorkGroupCountZ); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const ivec3 gl_MaxComputeWorkGroupSize = ivec3(%d,%d,%d);", resources.maxComputeWorkGroupSizeX, - resources.maxComputeWorkGroupSizeY, - resources.maxComputeWorkGroupSizeZ); - s.append(builtInConstant); - - snprintf(builtInConstant, maxSize, "const int gl_MaxComputeUniformComponents = %d;", resources.maxComputeUniformComponents); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxComputeTextureImageUnits = %d;", resources.maxComputeTextureImageUnits); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxComputeImageUniforms = %d;", resources.maxComputeImageUniforms); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxComputeAtomicCounters = %d;", resources.maxComputeAtomicCounters); - s.append(builtInConstant); - snprintf(builtInConstant, maxSize, "const int gl_MaxComputeAtomicCounterBuffers = %d;", resources.maxComputeAtomicCounterBuffers); - s.append(builtInConstant); - - s.append("\n"); - } - // GL_ARB_cull_distance if (profile != EEsProfile && version >= 450) { snprintf(builtInConstant, maxSize, "const int gl_MaxCullDistances = %d;", resources.maxCullDistances); @@ -7734,15 +6950,6 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf s.append(builtInConstant); } -#ifdef AMD_EXTENSIONS - // GL_AMD_gcn_shader - if (profile != EEsProfile && version >= 450) { - snprintf(builtInConstant, maxSize, "const int gl_SIMDGroupSizeAMD = 64;"); - s.append(builtInConstant); - } -#endif - -#ifdef NV_EXTENSIONS // SPV_NV_mesh_shader if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) { snprintf(builtInConstant, maxSize, "const int gl_MaxMeshOutputVerticesNV = %d;", resources.maxMeshOutputVerticesNV); @@ -7846,6 +7053,11 @@ static void BuiltInVariable(const char* blockName, const char* name, TBuiltInVar // void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable) { +#ifdef GLSLANG_WEB + version = 310; + profile = EEsProfile; +#endif + // // Tag built-in variables and functions with additional qualifier and extension information // that cannot be declared with the text strings. @@ -7860,6 +7072,17 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion switch(language) { case EShLangVertex: + if (spvVersion.vulkan > 0) { + BuiltInVariable("gl_VertexIndex", EbvVertexIndex, symbolTable); + BuiltInVariable("gl_InstanceIndex", EbvInstanceIndex, symbolTable); + } + +#ifndef GLSLANG_WEB + if (spvVersion.vulkan == 0) { + SpecialQualifier("gl_VertexID", EvqVertexId, EbvVertexId, symbolTable); + SpecialQualifier("gl_InstanceID", EvqInstanceId, EbvInstanceId, symbolTable); + } + if (profile != EEsProfile) { if (version >= 440) { symbolTable.setVariableExtensions("gl_BaseVertexARB", 1, &E_GL_ARB_shader_draw_parameters); @@ -7886,19 +7109,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.setFunctionExtensions("readInvocationARB", 1, &E_GL_ARB_shader_ballot); symbolTable.setFunctionExtensions("readFirstInvocationARB", 1, &E_GL_ARB_shader_ballot); - BuiltInVariable("gl_SubGroupInvocationARB", EbvSubGroupInvocation, symbolTable); - BuiltInVariable("gl_SubGroupEqMaskARB", EbvSubGroupEqMask, symbolTable); - BuiltInVariable("gl_SubGroupGeMaskARB", EbvSubGroupGeMask, symbolTable); - BuiltInVariable("gl_SubGroupGtMaskARB", EbvSubGroupGtMask, symbolTable); - BuiltInVariable("gl_SubGroupLeMaskARB", EbvSubGroupLeMask, symbolTable); - BuiltInVariable("gl_SubGroupLtMaskARB", EbvSubGroupLtMask, symbolTable); - - if (spvVersion.vulkan > 0) - // Treat "gl_SubGroupSizeARB" as shader input instead of uniform for Vulkan - SpecialQualifier("gl_SubGroupSizeARB", EvqVaryingIn, EbvSubGroupSize, symbolTable); - else - BuiltInVariable("gl_SubGroupSizeARB", EbvSubGroupSize, symbolTable); - if (version >= 430) { symbolTable.setFunctionExtensions("anyInvocationARB", 1, &E_GL_ARB_shader_group_vote); symbolTable.setFunctionExtensions("allInvocationsARB", 1, &E_GL_ARB_shader_group_vote); @@ -7906,7 +7116,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion } } -#ifdef AMD_EXTENSIONS + if (profile != EEsProfile) { symbolTable.setFunctionExtensions("minInvocationsAMD", 1, &E_GL_AMD_shader_ballot); symbolTable.setFunctionExtensions("maxInvocationsAMD", 1, &E_GL_AMD_shader_ballot); @@ -7940,6 +7150,9 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion } if (profile != EEsProfile) { + symbolTable.setVariableExtensions("gl_SIMDGroupSizeAMD", 1, &E_GL_AMD_gcn_shader); + SpecialQualifier("gl_SIMDGroupSizeAMD", EvqVaryingIn, EbvSubGroupSize, symbolTable); + symbolTable.setFunctionExtensions("cubeFaceIndexAMD", 1, &E_GL_AMD_gcn_shader); symbolTable.setFunctionExtensions("cubeFaceCoordAMD", 1, &E_GL_AMD_gcn_shader); symbolTable.setFunctionExtensions("timeAMD", 1, &E_GL_AMD_gcn_shader); @@ -7949,15 +7162,21 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.setFunctionExtensions("fragmentMaskFetchAMD", 1, &E_GL_AMD_shader_fragment_mask); symbolTable.setFunctionExtensions("fragmentFetchAMD", 1, &E_GL_AMD_shader_fragment_mask); } -#endif -#ifdef NV_EXTENSIONS + symbolTable.setFunctionExtensions("countLeadingZeros", 1, &E_GL_INTEL_shader_integer_functions2); + symbolTable.setFunctionExtensions("countTrailingZeros", 1, &E_GL_INTEL_shader_integer_functions2); + symbolTable.setFunctionExtensions("absoluteDifference", 1, &E_GL_INTEL_shader_integer_functions2); + symbolTable.setFunctionExtensions("addSaturate", 1, &E_GL_INTEL_shader_integer_functions2); + symbolTable.setFunctionExtensions("subtractSaturate", 1, &E_GL_INTEL_shader_integer_functions2); + symbolTable.setFunctionExtensions("average", 1, &E_GL_INTEL_shader_integer_functions2); + symbolTable.setFunctionExtensions("averageRounded", 1, &E_GL_INTEL_shader_integer_functions2); + symbolTable.setFunctionExtensions("multiply32x16", 1, &E_GL_INTEL_shader_integer_functions2); + symbolTable.setFunctionExtensions("textureFootprintNV", 1, &E_GL_NV_shader_texture_footprint); symbolTable.setFunctionExtensions("textureFootprintClampNV", 1, &E_GL_NV_shader_texture_footprint); symbolTable.setFunctionExtensions("textureFootprintLodNV", 1, &E_GL_NV_shader_texture_footprint); symbolTable.setFunctionExtensions("textureFootprintGradNV", 1, &E_GL_NV_shader_texture_footprint); symbolTable.setFunctionExtensions("textureFootprintGradClampNV", 1, &E_GL_NV_shader_texture_footprint); -#endif // Compatibility variables, vertex only if (spvVersion.spv == 0) { BuiltInVariable("gl_Color", EbvColor, symbolTable); @@ -7998,16 +7217,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.setFunctionExtensions("imageAtomicCompSwap", 1, &E_GL_OES_shader_image_atomic); } - if (spvVersion.vulkan == 0) { - SpecialQualifier("gl_VertexID", EvqVertexId, EbvVertexId, symbolTable); - SpecialQualifier("gl_InstanceID", EvqInstanceId, EbvInstanceId, symbolTable); - } - - if (spvVersion.vulkan > 0) { - BuiltInVariable("gl_VertexIndex", EbvVertexIndex, symbolTable); - BuiltInVariable("gl_InstanceIndex", EbvInstanceIndex, symbolTable); - } - if (version >= 300 /* both ES and non-ES */) { symbolTable.setVariableExtensions("gl_ViewID_OVR", Num_OVR_multiview_EXTs, OVR_multiview_EXTs); BuiltInVariable("gl_ViewID_OVR", EbvViewIndex, symbolTable); @@ -8017,7 +7226,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.setFunctionExtensions("shadow2DEXT", 1, &E_GL_EXT_shadow_samplers); symbolTable.setFunctionExtensions("shadow2DProjEXT", 1, &E_GL_EXT_shadow_samplers); } - // Fall through case EShLangTessControl: @@ -8033,22 +7241,26 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_BoundingBox", EbvBoundingBox, symbolTable); } } - // Fall through case EShLangTessEvaluation: case EShLangGeometry: +#endif SpecialQualifier("gl_Position", EvqPosition, EbvPosition, symbolTable); SpecialQualifier("gl_PointSize", EvqPointSize, EbvPointSize, symbolTable); - SpecialQualifier("gl_ClipVertex", EvqClipVertex, EbvClipVertex, symbolTable); BuiltInVariable("gl_in", "gl_Position", EbvPosition, symbolTable); BuiltInVariable("gl_in", "gl_PointSize", EbvPointSize, symbolTable); - BuiltInVariable("gl_in", "gl_ClipDistance", EbvClipDistance, symbolTable); - BuiltInVariable("gl_in", "gl_CullDistance", EbvCullDistance, symbolTable); BuiltInVariable("gl_out", "gl_Position", EbvPosition, symbolTable); BuiltInVariable("gl_out", "gl_PointSize", EbvPointSize, symbolTable); + +#ifndef GLSLANG_WEB + SpecialQualifier("gl_ClipVertex", EvqClipVertex, EbvClipVertex, symbolTable); + + BuiltInVariable("gl_in", "gl_ClipDistance", EbvClipDistance, symbolTable); + BuiltInVariable("gl_in", "gl_CullDistance", EbvCullDistance, symbolTable); + BuiltInVariable("gl_out", "gl_ClipDistance", EbvClipDistance, symbolTable); BuiltInVariable("gl_out", "gl_CullDistance", EbvCullDistance, symbolTable); @@ -8060,19 +7272,10 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_Layer", EbvLayer, symbolTable); BuiltInVariable("gl_ViewportIndex", EbvViewportIndex, symbolTable); -#ifdef NV_EXTENSIONS if (language != EShLangGeometry) { symbolTable.setVariableExtensions("gl_Layer", Num_viewportEXTs, viewportEXTs); symbolTable.setVariableExtensions("gl_ViewportIndex", Num_viewportEXTs, viewportEXTs); } -#else - if (language != EShLangGeometry && version >= 410) { - symbolTable.setVariableExtensions("gl_Layer", 1, &E_GL_ARB_shader_viewport_layer_array); - symbolTable.setVariableExtensions("gl_ViewportIndex", 1, &E_GL_ARB_shader_viewport_layer_array); - } -#endif - -#ifdef NV_EXTENSIONS symbolTable.setVariableExtensions("gl_ViewportMask", 1, &E_GL_NV_viewport_array2); symbolTable.setVariableExtensions("gl_SecondaryPositionNV", 1, &E_GL_NV_stereo_view_rendering); symbolTable.setVariableExtensions("gl_SecondaryViewportMaskNV", 1, &E_GL_NV_stereo_view_rendering); @@ -8085,7 +7288,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_PositionPerViewNV", EbvPositionPerViewNV, symbolTable); BuiltInVariable("gl_ViewportMaskPerViewNV", EbvViewportMaskPerViewNV, symbolTable); - if (language != EShLangVertex) { + if (language == EShLangVertex || language == EShLangGeometry) { symbolTable.setVariableExtensions("gl_in", "gl_SecondaryPositionNV", 1, &E_GL_NV_stereo_view_rendering); symbolTable.setVariableExtensions("gl_in", "gl_PositionPerViewNV", 1, &E_GL_NVX_multiview_per_view_attributes); @@ -8103,7 +7306,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_out", "gl_SecondaryViewportMaskNV", EbvSecondaryViewportMaskNV, symbolTable); BuiltInVariable("gl_out", "gl_PositionPerViewNV", EbvPositionPerViewNV, symbolTable); BuiltInVariable("gl_out", "gl_ViewportMaskPerViewNV", EbvViewportMaskPerViewNV, symbolTable); -#endif BuiltInVariable("gl_PatchVerticesIn", EbvPatchVertices, symbolTable); BuiltInVariable("gl_TessLevelOuter", EbvTessLevelOuter, symbolTable); @@ -8159,7 +7361,22 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.setVariableExtensions("gl_ViewIndex", 1, &E_GL_EXT_multiview); BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable); } - + + if (profile != EEsProfile) { + BuiltInVariable("gl_SubGroupInvocationARB", EbvSubGroupInvocation, symbolTable); + BuiltInVariable("gl_SubGroupEqMaskARB", EbvSubGroupEqMask, symbolTable); + BuiltInVariable("gl_SubGroupGeMaskARB", EbvSubGroupGeMask, symbolTable); + BuiltInVariable("gl_SubGroupGtMaskARB", EbvSubGroupGtMask, symbolTable); + BuiltInVariable("gl_SubGroupLeMaskARB", EbvSubGroupLeMask, symbolTable); + BuiltInVariable("gl_SubGroupLtMaskARB", EbvSubGroupLtMask, symbolTable); + + if (spvVersion.vulkan > 0) + // Treat "gl_SubGroupSizeARB" as shader input instead of uniform for Vulkan + SpecialQualifier("gl_SubGroupSizeARB", EvqVaryingIn, EbvSubGroupSize, symbolTable); + else + BuiltInVariable("gl_SubGroupSizeARB", EbvSubGroupSize, symbolTable); + } + // GL_KHR_shader_subgroup if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 140)) { @@ -8178,8 +7395,18 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_SubgroupGtMask", EbvSubgroupGtMask2, symbolTable); BuiltInVariable("gl_SubgroupLeMask", EbvSubgroupLeMask2, symbolTable); BuiltInVariable("gl_SubgroupLtMask", EbvSubgroupLtMask2, symbolTable); - } + // GL_NV_shader_sm_builtins + symbolTable.setVariableExtensions("gl_WarpsPerSMNV", 1, &E_GL_NV_shader_sm_builtins); + symbolTable.setVariableExtensions("gl_SMCountNV", 1, &E_GL_NV_shader_sm_builtins); + symbolTable.setVariableExtensions("gl_WarpIDNV", 1, &E_GL_NV_shader_sm_builtins); + symbolTable.setVariableExtensions("gl_SMIDNV", 1, &E_GL_NV_shader_sm_builtins); + BuiltInVariable("gl_WarpsPerSMNV", EbvWarpsPerSM, symbolTable); + BuiltInVariable("gl_SMCountNV", EbvSMCount, symbolTable); + BuiltInVariable("gl_WarpIDNV", EbvWarpID, symbolTable); + BuiltInVariable("gl_SMIDNV", EbvSMID, symbolTable); + } +#endif break; case EShLangFragment: @@ -8196,6 +7423,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion } } SpecialQualifier("gl_FragDepth", EvqFragDepth, EbvFragDepth, symbolTable); +#ifndef GLSLANG_WEB SpecialQualifier("gl_FragDepthEXT", EvqFragDepth, EbvFragDepth, symbolTable); SpecialQualifier("gl_HelperInvocation", EvqVaryingIn, EbvHelperInvocation, symbolTable); @@ -8208,18 +7436,29 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_FragStencilRefARB", EbvFragStencilRef, symbolTable); } - if ((profile != EEsProfile && version >= 400) || + if ((profile != EEsProfile && version >= 130) || (profile == EEsProfile && version >= 310)) { - BuiltInVariable("gl_SampleID", EbvSampleId, symbolTable); - BuiltInVariable("gl_SamplePosition", EbvSamplePosition, symbolTable); - BuiltInVariable("gl_SampleMaskIn", EbvSampleMask, symbolTable); - BuiltInVariable("gl_SampleMask", EbvSampleMask, symbolTable); - if (profile == EEsProfile && version < 320) { - symbolTable.setVariableExtensions("gl_SampleID", 1, &E_GL_OES_sample_variables); - symbolTable.setVariableExtensions("gl_SamplePosition", 1, &E_GL_OES_sample_variables); - symbolTable.setVariableExtensions("gl_SampleMaskIn", 1, &E_GL_OES_sample_variables); - symbolTable.setVariableExtensions("gl_SampleMask", 1, &E_GL_OES_sample_variables); - symbolTable.setVariableExtensions("gl_NumSamples", 1, &E_GL_OES_sample_variables); + BuiltInVariable("gl_SampleID", EbvSampleId, symbolTable); + BuiltInVariable("gl_SamplePosition", EbvSamplePosition, symbolTable); + BuiltInVariable("gl_SampleMask", EbvSampleMask, symbolTable); + + if (profile != EEsProfile && version < 400) { + BuiltInVariable("gl_NumSamples", EbvSampleMask, symbolTable); + + symbolTable.setVariableExtensions("gl_SampleMask", 1, &E_GL_ARB_sample_shading); + symbolTable.setVariableExtensions("gl_SampleID", 1, &E_GL_ARB_sample_shading); + symbolTable.setVariableExtensions("gl_SamplePosition", 1, &E_GL_ARB_sample_shading); + symbolTable.setVariableExtensions("gl_NumSamples", 1, &E_GL_ARB_sample_shading); + } else { + BuiltInVariable("gl_SampleMaskIn", EbvSampleMask, symbolTable); + + if (profile == EEsProfile && version < 320) { + symbolTable.setVariableExtensions("gl_SampleID", 1, &E_GL_OES_sample_variables); + symbolTable.setVariableExtensions("gl_SamplePosition", 1, &E_GL_OES_sample_variables); + symbolTable.setVariableExtensions("gl_SampleMaskIn", 1, &E_GL_OES_sample_variables); + symbolTable.setVariableExtensions("gl_SampleMask", 1, &E_GL_OES_sample_variables); + symbolTable.setVariableExtensions("gl_NumSamples", 1, &E_GL_OES_sample_variables); + } } } @@ -8350,7 +7589,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.setFunctionExtensions("textureGradOffsetClampARB", 1, &E_GL_ARB_sparse_texture_clamp); } -#ifdef AMD_EXTENSIONS // E_GL_AMD_shader_explicit_vertex_parameter if (profile != EEsProfile) { symbolTable.setVariableExtensions("gl_BaryCoordNoPerspAMD", 1, &E_GL_AMD_shader_explicit_vertex_parameter); @@ -8388,9 +7626,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.setFunctionExtensions("imageStoreLodAMD", 1, &E_GL_AMD_shader_image_load_store_lod); symbolTable.setFunctionExtensions("sparseImageLoadLodAMD", 1, &E_GL_AMD_shader_image_load_store_lod); } -#endif - -#ifdef NV_EXTENSIONS if (profile != EEsProfile && version >= 430) { symbolTable.setVariableExtensions("gl_FragFullyCoveredNV", 1, &E_GL_NV_conservative_raster_underestimation); BuiltInVariable("gl_FragFullyCoveredNV", EbvFragFullyCoveredNV, symbolTable); @@ -8406,20 +7641,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_BaryCoordNV", EbvBaryCoordNV, symbolTable); BuiltInVariable("gl_BaryCoordNoPerspNV", EbvBaryCoordNoPerspNV, symbolTable); } - if (((profile != EEsProfile && version >= 450) || - (profile == EEsProfile && version >= 320)) && - language == EShLangCompute) { - symbolTable.setFunctionExtensions("dFdx", 1, &E_GL_NV_compute_shader_derivatives); - symbolTable.setFunctionExtensions("dFdy", 1, &E_GL_NV_compute_shader_derivatives); - symbolTable.setFunctionExtensions("fwidth", 1, &E_GL_NV_compute_shader_derivatives); - symbolTable.setFunctionExtensions("dFdxFine", 1, &E_GL_NV_compute_shader_derivatives); - symbolTable.setFunctionExtensions("dFdyFine", 1, &E_GL_NV_compute_shader_derivatives); - symbolTable.setFunctionExtensions("fwidthFine", 1, &E_GL_NV_compute_shader_derivatives); - symbolTable.setFunctionExtensions("dFdxCoarse", 1, &E_GL_NV_compute_shader_derivatives); - symbolTable.setFunctionExtensions("dFdyCoarse", 1, &E_GL_NV_compute_shader_derivatives); - symbolTable.setFunctionExtensions("fwidthCoarse", 1, &E_GL_NV_compute_shader_derivatives); - } -#endif if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 310)) { @@ -8431,6 +7652,12 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.setVariableExtensions("gl_FragDepthEXT", 1, &E_GL_EXT_frag_depth); + symbolTable.setFunctionExtensions("clockARB", 1, &E_GL_ARB_shader_clock); + symbolTable.setFunctionExtensions("clock2x32ARB", 1, &E_GL_ARB_shader_clock); + + symbolTable.setFunctionExtensions("clockRealtimeEXT", 1, &E_GL_EXT_shader_realtime_clock); + symbolTable.setFunctionExtensions("clockRealtime2x32EXT", 1, &E_GL_EXT_shader_realtime_clock); + if (profile == EEsProfile && version < 320) { symbolTable.setVariableExtensions("gl_PrimitiveID", Num_AEP_geometry_shader, AEP_geometry_shader); symbolTable.setVariableExtensions("gl_Layer", Num_AEP_geometry_shader, AEP_geometry_shader); @@ -8553,8 +7780,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.setFunctionExtensions("subgroupQuadSwapHorizontal", 1, &E_GL_KHR_shader_subgroup_quad); symbolTable.setFunctionExtensions("subgroupQuadSwapVertical", 1, &E_GL_KHR_shader_subgroup_quad); symbolTable.setFunctionExtensions("subgroupQuadSwapDiagonal", 1, &E_GL_KHR_shader_subgroup_quad); - -#ifdef NV_EXTENSIONS symbolTable.setFunctionExtensions("subgroupPartitionNV", 1, &E_GL_NV_shader_subgroup_partitioned); symbolTable.setFunctionExtensions("subgroupPartitionedAddNV", 1, &E_GL_NV_shader_subgroup_partitioned); symbolTable.setFunctionExtensions("subgroupPartitionedMulNV", 1, &E_GL_NV_shader_subgroup_partitioned); @@ -8577,8 +7802,16 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.setFunctionExtensions("subgroupPartitionedExclusiveAndNV", 1, &E_GL_NV_shader_subgroup_partitioned); symbolTable.setFunctionExtensions("subgroupPartitionedExclusiveOrNV", 1, &E_GL_NV_shader_subgroup_partitioned); symbolTable.setFunctionExtensions("subgroupPartitionedExclusiveXorNV", 1, &E_GL_NV_shader_subgroup_partitioned); -#endif + // GL_NV_shader_sm_builtins + symbolTable.setVariableExtensions("gl_WarpsPerSMNV", 1, &E_GL_NV_shader_sm_builtins); + symbolTable.setVariableExtensions("gl_SMCountNV", 1, &E_GL_NV_shader_sm_builtins); + symbolTable.setVariableExtensions("gl_WarpIDNV", 1, &E_GL_NV_shader_sm_builtins); + symbolTable.setVariableExtensions("gl_SMIDNV", 1, &E_GL_NV_shader_sm_builtins); + BuiltInVariable("gl_WarpsPerSMNV", EbvWarpsPerSM, symbolTable); + BuiltInVariable("gl_SMCountNV", EbvSMCount, symbolTable); + BuiltInVariable("gl_WarpIDNV", EbvWarpID, symbolTable); + BuiltInVariable("gl_SMIDNV", EbvSMID, symbolTable); } if (profile == EEsProfile) { @@ -8598,6 +7831,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.setVariableExtensions("gl_SemanticsAcquireRelease", 1, &E_GL_KHR_memory_scope_semantics); symbolTable.setVariableExtensions("gl_SemanticsMakeAvailable", 1, &E_GL_KHR_memory_scope_semantics); symbolTable.setVariableExtensions("gl_SemanticsMakeVisible", 1, &E_GL_KHR_memory_scope_semantics); + symbolTable.setVariableExtensions("gl_SemanticsVolatile", 1, &E_GL_KHR_memory_scope_semantics); symbolTable.setVariableExtensions("gl_StorageSemanticsNone", 1, &E_GL_KHR_memory_scope_semantics); symbolTable.setVariableExtensions("gl_StorageSemanticsBuffer", 1, &E_GL_KHR_memory_scope_semantics); @@ -8605,6 +7839,9 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.setVariableExtensions("gl_StorageSemanticsImage", 1, &E_GL_KHR_memory_scope_semantics); symbolTable.setVariableExtensions("gl_StorageSemanticsOutput", 1, &E_GL_KHR_memory_scope_semantics); } + + symbolTable.setFunctionExtensions("helperInvocationEXT", 1, &E_GL_EXT_demote_to_helper_invocation); +#endif break; case EShLangCompute: @@ -8614,6 +7851,15 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_LocalInvocationID", EbvLocalInvocationId, symbolTable); BuiltInVariable("gl_GlobalInvocationID", EbvGlobalInvocationId, symbolTable); BuiltInVariable("gl_LocalInvocationIndex", EbvLocalInvocationIndex, symbolTable); + BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable); + BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable); + +#ifndef GLSLANG_WEB + if ((profile != EEsProfile && version >= 140) || + (profile == EEsProfile && version >= 310)) { + symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group); + symbolTable.setVariableExtensions("gl_ViewIndex", 1, &E_GL_EXT_multiview); + } if (profile != EEsProfile && version < 430) { symbolTable.setVariableExtensions("gl_NumWorkGroups", 1, &E_GL_ARB_compute_shader); @@ -8683,14 +7929,16 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_SubgroupGtMask", EbvSubgroupGtMask2, symbolTable); BuiltInVariable("gl_SubgroupLeMask", EbvSubgroupLeMask2, symbolTable); BuiltInVariable("gl_SubgroupLtMask", EbvSubgroupLtMask2, symbolTable); - } - if ((profile != EEsProfile && version >= 140) || - (profile == EEsProfile && version >= 310)) { - symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group); - BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable); - symbolTable.setVariableExtensions("gl_ViewIndex", 1, &E_GL_EXT_multiview); - BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable); + // GL_NV_shader_sm_builtins + symbolTable.setVariableExtensions("gl_WarpsPerSMNV", 1, &E_GL_NV_shader_sm_builtins); + symbolTable.setVariableExtensions("gl_SMCountNV", 1, &E_GL_NV_shader_sm_builtins); + symbolTable.setVariableExtensions("gl_WarpIDNV", 1, &E_GL_NV_shader_sm_builtins); + symbolTable.setVariableExtensions("gl_SMIDNV", 1, &E_GL_NV_shader_sm_builtins); + BuiltInVariable("gl_WarpsPerSMNV", EbvWarpsPerSM, symbolTable); + BuiltInVariable("gl_SMCountNV", EbvSMCount, symbolTable); + BuiltInVariable("gl_WarpIDNV", EbvWarpID, symbolTable); + BuiltInVariable("gl_SMIDNV", EbvSMID, symbolTable); } // GL_KHR_shader_subgroup @@ -8705,12 +7953,28 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.setFunctionExtensions("subgroupMemoryBarrierShared", 1, &E_GL_KHR_shader_subgroup_basic); } - symbolTable.setFunctionExtensions("coopMatLoadNV", 1, &E_GL_NV_cooperative_matrix); - symbolTable.setFunctionExtensions("coopMatStoreNV", 1, &E_GL_NV_cooperative_matrix); - symbolTable.setFunctionExtensions("coopMatMulAddNV", 1, &E_GL_NV_cooperative_matrix); + { + const char *coopExt[2] = { E_GL_NV_cooperative_matrix, E_GL_NV_integer_cooperative_matrix }; + symbolTable.setFunctionExtensions("coopMatLoadNV", 2, coopExt); + symbolTable.setFunctionExtensions("coopMatStoreNV", 2, coopExt); + symbolTable.setFunctionExtensions("coopMatMulAddNV", 2, coopExt); + } + if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) { + symbolTable.setFunctionExtensions("dFdx", 1, &E_GL_NV_compute_shader_derivatives); + symbolTable.setFunctionExtensions("dFdy", 1, &E_GL_NV_compute_shader_derivatives); + symbolTable.setFunctionExtensions("fwidth", 1, &E_GL_NV_compute_shader_derivatives); + symbolTable.setFunctionExtensions("dFdxFine", 1, &E_GL_NV_compute_shader_derivatives); + symbolTable.setFunctionExtensions("dFdyFine", 1, &E_GL_NV_compute_shader_derivatives); + symbolTable.setFunctionExtensions("fwidthFine", 1, &E_GL_NV_compute_shader_derivatives); + symbolTable.setFunctionExtensions("dFdxCoarse", 1, &E_GL_NV_compute_shader_derivatives); + symbolTable.setFunctionExtensions("dFdyCoarse", 1, &E_GL_NV_compute_shader_derivatives); + symbolTable.setFunctionExtensions("fwidthCoarse", 1, &E_GL_NV_compute_shader_derivatives); + } +#endif break; -#ifdef NV_EXTENSIONS + +#ifndef GLSLANG_WEB case EShLangRayGenNV: case EShLangIntersectNV: case EShLangAnyHitNV: @@ -8754,8 +8018,62 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_WorldToObjectNV", EbvWorldToObjectNV, symbolTable); BuiltInVariable("gl_IncomingRayFlagsNV", EbvIncomingRayFlagsNV, symbolTable); BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable); - } + + // GL_ARB_shader_ballot + symbolTable.setVariableExtensions("gl_SubGroupSizeARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupInvocationARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupEqMaskARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupGeMaskARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupGtMaskARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupLeMaskARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupLtMaskARB", 1, &E_GL_ARB_shader_ballot); + + BuiltInVariable("gl_SubGroupInvocationARB", EbvSubGroupInvocation, symbolTable); + BuiltInVariable("gl_SubGroupEqMaskARB", EbvSubGroupEqMask, symbolTable); + BuiltInVariable("gl_SubGroupGeMaskARB", EbvSubGroupGeMask, symbolTable); + BuiltInVariable("gl_SubGroupGtMaskARB", EbvSubGroupGtMask, symbolTable); + BuiltInVariable("gl_SubGroupLeMaskARB", EbvSubGroupLeMask, symbolTable); + BuiltInVariable("gl_SubGroupLtMaskARB", EbvSubGroupLtMask, symbolTable); + + if (spvVersion.vulkan > 0) + // Treat "gl_SubGroupSizeARB" as shader input instead of uniform for Vulkan + SpecialQualifier("gl_SubGroupSizeARB", EvqVaryingIn, EbvSubGroupSize, symbolTable); + else + BuiltInVariable("gl_SubGroupSizeARB", EbvSubGroupSize, symbolTable); + + // GL_KHR_shader_subgroup + symbolTable.setVariableExtensions("gl_NumSubgroups", 1, &E_GL_KHR_shader_subgroup_basic); + symbolTable.setVariableExtensions("gl_SubgroupID", 1, &E_GL_KHR_shader_subgroup_basic); + symbolTable.setVariableExtensions("gl_SubgroupSize", 1, &E_GL_KHR_shader_subgroup_basic); + symbolTable.setVariableExtensions("gl_SubgroupInvocationID", 1, &E_GL_KHR_shader_subgroup_basic); + symbolTable.setVariableExtensions("gl_SubgroupEqMask", 1, &E_GL_KHR_shader_subgroup_ballot); + symbolTable.setVariableExtensions("gl_SubgroupGeMask", 1, &E_GL_KHR_shader_subgroup_ballot); + symbolTable.setVariableExtensions("gl_SubgroupGtMask", 1, &E_GL_KHR_shader_subgroup_ballot); + symbolTable.setVariableExtensions("gl_SubgroupLeMask", 1, &E_GL_KHR_shader_subgroup_ballot); + symbolTable.setVariableExtensions("gl_SubgroupLtMask", 1, &E_GL_KHR_shader_subgroup_ballot); + + BuiltInVariable("gl_NumSubgroups", EbvNumSubgroups, symbolTable); + BuiltInVariable("gl_SubgroupID", EbvSubgroupID, symbolTable); + BuiltInVariable("gl_SubgroupSize", EbvSubgroupSize2, symbolTable); + BuiltInVariable("gl_SubgroupInvocationID", EbvSubgroupInvocation2, symbolTable); + BuiltInVariable("gl_SubgroupEqMask", EbvSubgroupEqMask2, symbolTable); + BuiltInVariable("gl_SubgroupGeMask", EbvSubgroupGeMask2, symbolTable); + BuiltInVariable("gl_SubgroupGtMask", EbvSubgroupGtMask2, symbolTable); + BuiltInVariable("gl_SubgroupLeMask", EbvSubgroupLeMask2, symbolTable); + BuiltInVariable("gl_SubgroupLtMask", EbvSubgroupLtMask2, symbolTable); + + // GL_NV_shader_sm_builtins + symbolTable.setVariableExtensions("gl_WarpsPerSMNV", 1, &E_GL_NV_shader_sm_builtins); + symbolTable.setVariableExtensions("gl_SMCountNV", 1, &E_GL_NV_shader_sm_builtins); + symbolTable.setVariableExtensions("gl_WarpIDNV", 1, &E_GL_NV_shader_sm_builtins); + symbolTable.setVariableExtensions("gl_SMIDNV", 1, &E_GL_NV_shader_sm_builtins); + BuiltInVariable("gl_WarpsPerSMNV", EbvWarpsPerSM, symbolTable); + BuiltInVariable("gl_SMCountNV", EbvSMCount, symbolTable); + BuiltInVariable("gl_WarpIDNV", EbvWarpID, symbolTable); + BuiltInVariable("gl_SMIDNV", EbvSMID, symbolTable); + } break; + case EShLangMeshNV: if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) { // per-vertex builtins @@ -8887,6 +8205,16 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_SubgroupLtMask", EbvSubgroupLtMask2, symbolTable); symbolTable.setFunctionExtensions("subgroupMemoryBarrierShared", 1, &E_GL_KHR_shader_subgroup_basic); + + // GL_NV_shader_sm_builtins + symbolTable.setVariableExtensions("gl_WarpsPerSMNV", 1, &E_GL_NV_shader_sm_builtins); + symbolTable.setVariableExtensions("gl_SMCountNV", 1, &E_GL_NV_shader_sm_builtins); + symbolTable.setVariableExtensions("gl_WarpIDNV", 1, &E_GL_NV_shader_sm_builtins); + symbolTable.setVariableExtensions("gl_SMIDNV", 1, &E_GL_NV_shader_sm_builtins); + BuiltInVariable("gl_WarpsPerSMNV", EbvWarpsPerSM, symbolTable); + BuiltInVariable("gl_SMCountNV", EbvSMCount, symbolTable); + BuiltInVariable("gl_WarpIDNV", EbvWarpID, symbolTable); + BuiltInVariable("gl_SMIDNV", EbvSMID, symbolTable); } break; @@ -8977,6 +8305,16 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_SubgroupLtMask", EbvSubgroupLtMask2, symbolTable); symbolTable.setFunctionExtensions("subgroupMemoryBarrierShared", 1, &E_GL_KHR_shader_subgroup_basic); + + // GL_NV_shader_sm_builtins + symbolTable.setVariableExtensions("gl_WarpsPerSMNV", 1, &E_GL_NV_shader_sm_builtins); + symbolTable.setVariableExtensions("gl_SMCountNV", 1, &E_GL_NV_shader_sm_builtins); + symbolTable.setVariableExtensions("gl_WarpIDNV", 1, &E_GL_NV_shader_sm_builtins); + symbolTable.setVariableExtensions("gl_SMIDNV", 1, &E_GL_NV_shader_sm_builtins); + BuiltInVariable("gl_WarpsPerSMNV", EbvWarpsPerSM, symbolTable); + BuiltInVariable("gl_SMCountNV", EbvSMCount, symbolTable); + BuiltInVariable("gl_WarpIDNV", EbvWarpID, symbolTable); + BuiltInVariable("gl_SMIDNV", EbvSMID, symbolTable); } break; #endif @@ -8992,74 +8330,10 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion // expected to be resolved through a library of functions, versus as // operations. // - symbolTable.relateToOperator("not", EOpVectorLogicalNot); - symbolTable.relateToOperator("matrixCompMult", EOpMul); - // 120 and 150 are correct for both ES and desktop - if (version >= 120) { - symbolTable.relateToOperator("outerProduct", EOpOuterProduct); - symbolTable.relateToOperator("transpose", EOpTranspose); - if (version >= 150) { - symbolTable.relateToOperator("determinant", EOpDeterminant); - symbolTable.relateToOperator("inverse", EOpMatrixInverse); - } - } + relateTabledBuiltins(version, profile, spvVersion, language, symbolTable); - symbolTable.relateToOperator("mod", EOpMod); - symbolTable.relateToOperator("modf", EOpModf); - - symbolTable.relateToOperator("equal", EOpVectorEqual); - symbolTable.relateToOperator("notEqual", EOpVectorNotEqual); - symbolTable.relateToOperator("lessThan", EOpLessThan); - symbolTable.relateToOperator("greaterThan", EOpGreaterThan); - symbolTable.relateToOperator("lessThanEqual", EOpLessThanEqual); - symbolTable.relateToOperator("greaterThanEqual", EOpGreaterThanEqual); - - symbolTable.relateToOperator("radians", EOpRadians); - symbolTable.relateToOperator("degrees", EOpDegrees); - symbolTable.relateToOperator("sin", EOpSin); - symbolTable.relateToOperator("cos", EOpCos); - symbolTable.relateToOperator("tan", EOpTan); - symbolTable.relateToOperator("asin", EOpAsin); - symbolTable.relateToOperator("acos", EOpAcos); - symbolTable.relateToOperator("atan", EOpAtan); - symbolTable.relateToOperator("sinh", EOpSinh); - symbolTable.relateToOperator("cosh", EOpCosh); - symbolTable.relateToOperator("tanh", EOpTanh); - symbolTable.relateToOperator("asinh", EOpAsinh); - symbolTable.relateToOperator("acosh", EOpAcosh); - symbolTable.relateToOperator("atanh", EOpAtanh); - - symbolTable.relateToOperator("pow", EOpPow); - symbolTable.relateToOperator("exp2", EOpExp2); - symbolTable.relateToOperator("log", EOpLog); - symbolTable.relateToOperator("exp", EOpExp); - symbolTable.relateToOperator("log2", EOpLog2); - symbolTable.relateToOperator("sqrt", EOpSqrt); - symbolTable.relateToOperator("inversesqrt", EOpInverseSqrt); - - symbolTable.relateToOperator("abs", EOpAbs); - symbolTable.relateToOperator("sign", EOpSign); - symbolTable.relateToOperator("floor", EOpFloor); - symbolTable.relateToOperator("trunc", EOpTrunc); - symbolTable.relateToOperator("round", EOpRound); - symbolTable.relateToOperator("roundEven", EOpRoundEven); - symbolTable.relateToOperator("ceil", EOpCeil); - symbolTable.relateToOperator("fract", EOpFract); - symbolTable.relateToOperator("min", EOpMin); - symbolTable.relateToOperator("max", EOpMax); - symbolTable.relateToOperator("clamp", EOpClamp); - symbolTable.relateToOperator("mix", EOpMix); - symbolTable.relateToOperator("step", EOpStep); - symbolTable.relateToOperator("smoothstep", EOpSmoothStep); - - symbolTable.relateToOperator("isnan", EOpIsNan); - symbolTable.relateToOperator("isinf", EOpIsInf); - - symbolTable.relateToOperator("floatBitsToInt", EOpFloatBitsToInt); - symbolTable.relateToOperator("floatBitsToUint", EOpFloatBitsToUint); - symbolTable.relateToOperator("intBitsToFloat", EOpIntBitsToFloat); - symbolTable.relateToOperator("uintBitsToFloat", EOpUintBitsToFloat); +#ifndef GLSLANG_WEB symbolTable.relateToOperator("doubleBitsToInt64", EOpDoubleBitsToInt64); symbolTable.relateToOperator("doubleBitsToUint64", EOpDoubleBitsToUint64); symbolTable.relateToOperator("int64BitsToDouble", EOpInt64BitsToDouble); @@ -9074,11 +8348,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("int16BitsToHalf", EOpInt16BitsToFloat16); symbolTable.relateToOperator("uint16BitsToHalf", EOpUint16BitsToFloat16); - symbolTable.relateToOperator("packSnorm2x16", EOpPackSnorm2x16); - symbolTable.relateToOperator("unpackSnorm2x16", EOpUnpackSnorm2x16); - symbolTable.relateToOperator("packUnorm2x16", EOpPackUnorm2x16); - symbolTable.relateToOperator("unpackUnorm2x16", EOpUnpackUnorm2x16); - symbolTable.relateToOperator("packSnorm4x8", EOpPackSnorm4x8); symbolTable.relateToOperator("unpackSnorm4x8", EOpUnpackSnorm4x8); symbolTable.relateToOperator("packUnorm4x8", EOpPackUnorm4x8); @@ -9087,9 +8356,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("packDouble2x32", EOpPackDouble2x32); symbolTable.relateToOperator("unpackDouble2x32", EOpUnpackDouble2x32); - symbolTable.relateToOperator("packHalf2x16", EOpPackHalf2x16); - symbolTable.relateToOperator("unpackHalf2x16", EOpUnpackHalf2x16); - symbolTable.relateToOperator("packInt2x32", EOpPackInt2x32); symbolTable.relateToOperator("unpackInt2x32", EOpUnpackInt2x32); symbolTable.relateToOperator("packUint2x32", EOpPackUint2x32); @@ -9115,33 +8381,10 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("unpack16", EOpUnpack16); symbolTable.relateToOperator("unpack8", EOpUnpack8); - symbolTable.relateToOperator("length", EOpLength); - symbolTable.relateToOperator("distance", EOpDistance); - symbolTable.relateToOperator("dot", EOpDot); - symbolTable.relateToOperator("cross", EOpCross); - symbolTable.relateToOperator("normalize", EOpNormalize); - symbolTable.relateToOperator("faceforward", EOpFaceForward); - symbolTable.relateToOperator("reflect", EOpReflect); - symbolTable.relateToOperator("refract", EOpRefract); - - symbolTable.relateToOperator("any", EOpAny); - symbolTable.relateToOperator("all", EOpAll); - - symbolTable.relateToOperator("barrier", EOpBarrier); symbolTable.relateToOperator("controlBarrier", EOpBarrier); - symbolTable.relateToOperator("memoryBarrier", EOpMemoryBarrier); symbolTable.relateToOperator("memoryBarrierAtomicCounter", EOpMemoryBarrierAtomicCounter); - symbolTable.relateToOperator("memoryBarrierBuffer", EOpMemoryBarrierBuffer); symbolTable.relateToOperator("memoryBarrierImage", EOpMemoryBarrierImage); - symbolTable.relateToOperator("atomicAdd", EOpAtomicAdd); - symbolTable.relateToOperator("atomicMin", EOpAtomicMin); - symbolTable.relateToOperator("atomicMax", EOpAtomicMax); - symbolTable.relateToOperator("atomicAnd", EOpAtomicAnd); - symbolTable.relateToOperator("atomicOr", EOpAtomicOr); - symbolTable.relateToOperator("atomicXor", EOpAtomicXor); - symbolTable.relateToOperator("atomicExchange", EOpAtomicExchange); - symbolTable.relateToOperator("atomicCompSwap", EOpAtomicCompSwap); symbolTable.relateToOperator("atomicLoad", EOpAtomicLoad); symbolTable.relateToOperator("atomicStore", EOpAtomicStore); @@ -9149,6 +8392,12 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("atomicCounterDecrement", EOpAtomicCounterDecrement); symbolTable.relateToOperator("atomicCounter", EOpAtomicCounter); + symbolTable.relateToOperator("clockARB", EOpReadClockSubgroupKHR); + symbolTable.relateToOperator("clock2x32ARB", EOpReadClockSubgroupKHR); + + symbolTable.relateToOperator("clockRealtimeEXT", EOpReadClockDeviceKHR); + symbolTable.relateToOperator("clockRealtime2x32EXT", EOpReadClockDeviceKHR); + if (profile != EEsProfile && version >= 460) { symbolTable.relateToOperator("atomicCounterAdd", EOpAtomicCounterAdd); symbolTable.relateToOperator("atomicCounterSubtract", EOpAtomicCounterSubtract); @@ -9175,6 +8424,17 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("findLSB", EOpFindLSB); symbolTable.relateToOperator("findMSB", EOpFindMSB); + symbolTable.relateToOperator("helperInvocationEXT", EOpIsHelperInvocation); + + symbolTable.relateToOperator("countLeadingZeros", EOpCountLeadingZeros); + symbolTable.relateToOperator("countTrailingZeros", EOpCountTrailingZeros); + symbolTable.relateToOperator("absoluteDifference", EOpAbsDifference); + symbolTable.relateToOperator("addSaturate", EOpAddSaturate); + symbolTable.relateToOperator("subtractSaturate", EOpSubSaturate); + symbolTable.relateToOperator("average", EOpAverage); + symbolTable.relateToOperator("averageRounded", EOpAverageRounded); + symbolTable.relateToOperator("multiply32x16", EOpMul32x16); + if (PureOperatorBuiltins) { symbolTable.relateToOperator("imageSize", EOpImageQuerySize); symbolTable.relateToOperator("imageSamples", EOpImageQuerySamples); @@ -9194,24 +8454,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("subpassLoad", EOpSubpassLoad); symbolTable.relateToOperator("subpassLoadMS", EOpSubpassLoadMS); - symbolTable.relateToOperator("textureSize", EOpTextureQuerySize); - symbolTable.relateToOperator("textureQueryLod", EOpTextureQueryLod); - symbolTable.relateToOperator("textureQueryLevels", EOpTextureQueryLevels); - symbolTable.relateToOperator("textureSamples", EOpTextureQuerySamples); - symbolTable.relateToOperator("texture", EOpTexture); - symbolTable.relateToOperator("textureProj", EOpTextureProj); - symbolTable.relateToOperator("textureLod", EOpTextureLod); - symbolTable.relateToOperator("textureOffset", EOpTextureOffset); - symbolTable.relateToOperator("texelFetch", EOpTextureFetch); - symbolTable.relateToOperator("texelFetchOffset", EOpTextureFetchOffset); - symbolTable.relateToOperator("textureProjOffset", EOpTextureProjOffset); - symbolTable.relateToOperator("textureLodOffset", EOpTextureLodOffset); - symbolTable.relateToOperator("textureProjLod", EOpTextureProjLod); - symbolTable.relateToOperator("textureProjLodOffset", EOpTextureProjLodOffset); - symbolTable.relateToOperator("textureGrad", EOpTextureGrad); - symbolTable.relateToOperator("textureGradOffset", EOpTextureGradOffset); - symbolTable.relateToOperator("textureProjGrad", EOpTextureProjGrad); - symbolTable.relateToOperator("textureProjGradOffset", EOpTextureProjGradOffset); symbolTable.relateToOperator("textureGather", EOpTextureGather); symbolTable.relateToOperator("textureGatherOffset", EOpTextureGatherOffset); symbolTable.relateToOperator("textureGatherOffsets", EOpTextureGatherOffsets); @@ -9221,17 +8463,17 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("noise3", EOpNoise); symbolTable.relateToOperator("noise4", EOpNoise); -#ifdef NV_EXTENSIONS symbolTable.relateToOperator("textureFootprintNV", EOpImageSampleFootprintNV); symbolTable.relateToOperator("textureFootprintClampNV", EOpImageSampleFootprintClampNV); symbolTable.relateToOperator("textureFootprintLodNV", EOpImageSampleFootprintLodNV); symbolTable.relateToOperator("textureFootprintGradNV", EOpImageSampleFootprintGradNV); symbolTable.relateToOperator("textureFootprintGradClampNV", EOpImageSampleFootprintGradClampNV); -#endif + + if (spvVersion.spv == 0 && IncludeLegacy(version, profile, spvVersion)) + symbolTable.relateToOperator("ftransform", EOpFtransform); if (spvVersion.spv == 0 && (IncludeLegacy(version, profile, spvVersion) || (profile == EEsProfile && version == 100))) { - symbolTable.relateToOperator("ftransform", EOpFtransform); symbolTable.relateToOperator("texture1D", EOpTexture); symbolTable.relateToOperator("texture1DGradARB", EOpTextureGrad); @@ -9323,7 +8565,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("allInvocations", EOpAllInvocations); symbolTable.relateToOperator("allInvocationsEqual", EOpAllInvocationsEqual); } -#ifdef AMD_EXTENSIONS symbolTable.relateToOperator("minInvocationsAMD", EOpMinInvocations); symbolTable.relateToOperator("maxInvocationsAMD", EOpMaxInvocations); symbolTable.relateToOperator("addInvocationsAMD", EOpAddInvocations); @@ -9368,7 +8609,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("fragmentMaskFetchAMD", EOpFragmentMaskFetch); symbolTable.relateToOperator("fragmentFetchAMD", EOpFragmentFetch); -#endif } // GL_KHR_shader_subgroup @@ -9429,7 +8669,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("subgroupQuadSwapVertical", EOpSubgroupQuadSwapVertical); symbolTable.relateToOperator("subgroupQuadSwapDiagonal", EOpSubgroupQuadSwapDiagonal); -#ifdef NV_EXTENSIONS symbolTable.relateToOperator("subgroupPartitionNV", EOpSubgroupPartition); symbolTable.relateToOperator("subgroupPartitionedAddNV", EOpSubgroupPartitionedAdd); symbolTable.relateToOperator("subgroupPartitionedMulNV", EOpSubgroupPartitionedMul); @@ -9452,7 +8691,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("subgroupPartitionedExclusiveAndNV", EOpSubgroupPartitionedExclusiveAnd); symbolTable.relateToOperator("subgroupPartitionedExclusiveOrNV", EOpSubgroupPartitionedExclusiveOr); symbolTable.relateToOperator("subgroupPartitionedExclusiveXorNV", EOpSubgroupPartitionedExclusiveXor); -#endif } if (profile == EEsProfile) { @@ -9477,9 +8715,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion break; case EShLangFragment: - symbolTable.relateToOperator("dFdx", EOpDPdx); - symbolTable.relateToOperator("dFdy", EOpDPdy); - symbolTable.relateToOperator("fwidth", EOpFwidth); if (profile != EEsProfile && version >= 400) { symbolTable.relateToOperator("dFdxFine", EOpDPdxFine); symbolTable.relateToOperator("dFdyFine", EOpDPdyFine); @@ -9492,17 +8727,16 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("interpolateAtSample", EOpInterpolateAtSample); symbolTable.relateToOperator("interpolateAtOffset", EOpInterpolateAtOffset); -#ifdef AMD_EXTENSIONS if (profile != EEsProfile) symbolTable.relateToOperator("interpolateAtVertexAMD", EOpInterpolateAtVertex); -#endif + + symbolTable.relateToOperator("beginInvocationInterlockARB", EOpBeginInvocationInterlock); + symbolTable.relateToOperator("endInvocationInterlockARB", EOpEndInvocationInterlock); + break; case EShLangCompute: - symbolTable.relateToOperator("memoryBarrierShared", EOpMemoryBarrierShared); - symbolTable.relateToOperator("groupMemoryBarrier", EOpGroupMemoryBarrier); symbolTable.relateToOperator("subgroupMemoryBarrierShared", EOpSubgroupMemoryBarrierShared); -#ifdef NV_EXTENSIONS if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) { symbolTable.relateToOperator("dFdx", EOpDPdx); @@ -9515,13 +8749,11 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("dFdyCoarse", EOpDPdyCoarse); symbolTable.relateToOperator("fwidthCoarse",EOpFwidthCoarse); } -#endif symbolTable.relateToOperator("coopMatLoadNV", EOpCooperativeMatrixLoad); symbolTable.relateToOperator("coopMatStoreNV", EOpCooperativeMatrixStore); symbolTable.relateToOperator("coopMatMulAddNV", EOpCooperativeMatrixMulAdd); break; -#ifdef NV_EXTENSIONS case EShLangRayGenNV: case EShLangClosestHitNV: case EShLangMissNV: @@ -9554,13 +8786,14 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) { symbolTable.relateToOperator("memoryBarrierShared", EOpMemoryBarrierShared); symbolTable.relateToOperator("groupMemoryBarrier", EOpGroupMemoryBarrier); + symbolTable.relateToOperator("subgroupMemoryBarrierShared", EOpSubgroupMemoryBarrierShared); } break; -#endif default: assert(false && "Language not supported"); } +#endif } // @@ -9574,6 +8807,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion // void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources) { +#ifndef GLSLANG_WEB if (profile != EEsProfile && version >= 430 && version < 440) { symbolTable.setVariableExtensions("gl_MaxTransformFeedbackBuffers", 1, &E_GL_ARB_enhanced_layouts); symbolTable.setVariableExtensions("gl_MaxTransformFeedbackInterleavedComponents", 1, &E_GL_ARB_enhanced_layouts); @@ -9619,6 +8853,12 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_in", "gl_TexCoord", EbvTexCoord, symbolTable); BuiltInVariable("gl_in", "gl_FogFragCoord", EbvFogFragCoord, symbolTable); + symbolTable.setVariableExtensions("gl_in", "gl_SecondaryPositionNV", 1, &E_GL_NV_stereo_view_rendering); + symbolTable.setVariableExtensions("gl_in", "gl_PositionPerViewNV", 1, &E_GL_NVX_multiview_per_view_attributes); + + BuiltInVariable("gl_in", "gl_SecondaryPositionNV", EbvSecondaryPositionNV, symbolTable); + BuiltInVariable("gl_in", "gl_PositionPerViewNV", EbvPositionPerViewNV, symbolTable); + // extension requirements if (profile == EEsProfile) { symbolTable.setVariableExtensions("gl_in", "gl_PointSize", Num_AEP_tessellation_point_size, AEP_tessellation_point_size); @@ -9629,6 +8869,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion default: break; } +#endif } } // end namespace glslang diff --git a/thirdparty/glslang/glslang/MachineIndependent/Initialize.h b/thirdparty/glslang/glslang/MachineIndependent/Initialize.h index b5de324233..ac8ec33e99 100644 --- a/thirdparty/glslang/glslang/MachineIndependent/Initialize.h +++ b/thirdparty/glslang/glslang/MachineIndependent/Initialize.h @@ -91,6 +91,8 @@ public: void identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources); protected: + void addTabledBuiltins(int version, EProfile profile, const SpvVersion& spvVersion); + void relateTabledBuiltins(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage, TSymbolTable&); void add2ndGenerationSamplingImaging(int version, EProfile profile, const SpvVersion& spvVersion); void addSubpassSampling(TSampler, const TString& typeName, int version, EProfile profile); void addQueryFunctions(TSampler, const TString& typeName, int version, EProfile profile); diff --git a/thirdparty/glslang/glslang/MachineIndependent/Intermediate.cpp b/thirdparty/glslang/glslang/MachineIndependent/Intermediate.cpp index 584d880501..d0f86e6389 100644..100755 --- a/thirdparty/glslang/glslang/MachineIndependent/Intermediate.cpp +++ b/thirdparty/glslang/glslang/MachineIndependent/Intermediate.cpp @@ -123,12 +123,12 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn if ((op == EOpAdd || op == EOpSub) && extensionRequested(E_GL_EXT_buffer_reference2)) { // No addressing math on struct with unsized array. - if ((left->getBasicType() == EbtReference && left->getType().getReferentType()->containsUnsizedArray()) || - (right->getBasicType() == EbtReference && right->getType().getReferentType()->containsUnsizedArray())) { + if ((left->isReference() && left->getType().getReferentType()->containsUnsizedArray()) || + (right->isReference() && right->getType().getReferentType()->containsUnsizedArray())) { return nullptr; } - if (left->getBasicType() == EbtReference && isTypeInt(right->getBasicType())) { + if (left->isReference() && isTypeInt(right->getBasicType())) { const TType& referenceType = left->getType(); TIntermConstantUnion* size = addConstantUnion((unsigned long long)computeBufferReferenceTypeSize(left->getType()), loc, true); left = addBuiltInFunctionCall(loc, EOpConvPtrToUint64, true, left, TType(EbtUint64)); @@ -141,7 +141,7 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn return node; } - if (op == EOpAdd && right->getBasicType() == EbtReference && isTypeInt(left->getBasicType())) { + if (op == EOpAdd && right->isReference() && isTypeInt(left->getBasicType())) { const TType& referenceType = right->getType(); TIntermConstantUnion* size = addConstantUnion((unsigned long long)computeBufferReferenceTypeSize(right->getType()), loc, true); right = addBuiltInFunctionCall(loc, EOpConvPtrToUint64, true, right, TType(EbtUint64)); @@ -154,7 +154,7 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn return node; } - if (op == EOpSub && left->getBasicType() == EbtReference && right->getBasicType() == EbtReference) { + if (op == EOpSub && left->isReference() && right->isReference()) { TIntermConstantUnion* size = addConstantUnion((long long)computeBufferReferenceTypeSize(left->getType()), loc, true); left = addBuiltInFunctionCall(loc, EOpConvPtrToUint64, true, left, TType(EbtUint64)); @@ -170,7 +170,7 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn } // No other math operators supported on references - if (left->getBasicType() == EbtReference || right->getBasicType() == EbtReference) { + if (left->isReference() || right->isReference()) { return nullptr; } } @@ -216,7 +216,7 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn node->getWritableType().getQualifier().makeSpecConstant(); // If must propagate nonuniform, make a nonuniform. - if ((node->getLeft()->getQualifier().nonUniform || node->getRight()->getQualifier().nonUniform) && + if ((node->getLeft()->getQualifier().isNonUniform() || node->getRight()->getQualifier().isNonUniform()) && isNonuniformPropagating(node->getOp())) node->getWritableType().getQualifier().nonUniform = true; @@ -290,7 +290,7 @@ TIntermTyped* TIntermediate::addAssign(TOperator op, TIntermTyped* left, TInterm // Convert "reference += int" to "reference = reference + int". We need this because the // "reference + int" calculation involves a cast back to the original type, which makes it // not an lvalue. - if ((op == EOpAddAssign || op == EOpSubAssign) && left->getBasicType() == EbtReference && + if ((op == EOpAddAssign || op == EOpSubAssign) && left->isReference() && extensionRequested(E_GL_EXT_buffer_reference2)) { if (!(right->getType().isScalar() && right->getType().isIntegerDomain())) @@ -359,7 +359,7 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo switch (op) { case EOpLogicalNot: - if (source == EShSourceHlsl) { + if (getSource() == EShSourceHlsl) { break; // HLSL can promote logical not } @@ -383,18 +383,20 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo // TBasicType newType = EbtVoid; switch (op) { - case EOpConstructInt8: newType = EbtInt8; break; - case EOpConstructUint8: newType = EbtUint8; break; - case EOpConstructInt16: newType = EbtInt16; break; - case EOpConstructUint16: newType = EbtUint16; break; + case EOpConstructBool: newType = EbtBool; break; + case EOpConstructFloat: newType = EbtFloat; break; case EOpConstructInt: newType = EbtInt; break; case EOpConstructUint: newType = EbtUint; break; +#ifndef GLSLANG_WEB + case EOpConstructInt8: newType = EbtInt8; break; + case EOpConstructUint8: newType = EbtUint8; break; + case EOpConstructInt16: newType = EbtInt16; break; + case EOpConstructUint16: newType = EbtUint16; break; case EOpConstructInt64: newType = EbtInt64; break; case EOpConstructUint64: newType = EbtUint64; break; - case EOpConstructBool: newType = EbtBool; break; - case EOpConstructFloat: newType = EbtFloat; break; case EOpConstructDouble: newType = EbtDouble; break; case EOpConstructFloat16: newType = EbtFloat16; break; +#endif default: break; // some compilers want this } @@ -449,7 +451,7 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo node->getWritableType().getQualifier().makeSpecConstant(); // If must propagate nonuniform, make a nonuniform. - if (node->getOperand()->getQualifier().nonUniform && isNonuniformPropagating(node->getOp())) + if (node->getOperand()->getQualifier().isNonUniform() && isNonuniformPropagating(node->getOp())) node->getWritableType().getQualifier().nonUniform = true; return node; @@ -536,15 +538,13 @@ bool TIntermediate::isConversionAllowed(TOperator op, TIntermTyped* node) const return false; case EbtAtomicUint: case EbtSampler: -#ifdef NV_EXTENSIONS case EbtAccStructNV: -#endif // opaque types can be passed to functions if (op == EOpFunction) break; // HLSL can assign samplers directly (no constructor) - if (source == EShSourceHlsl && node->getBasicType() == EbtSampler) + if (getSource() == EShSourceHlsl && node->getBasicType() == EbtSampler) break; // samplers can get assigned via a sampler constructor @@ -562,107 +562,50 @@ bool TIntermediate::isConversionAllowed(TOperator op, TIntermTyped* node) const return true; } -// This is 'mechanism' here, it does any conversion told. -// It is about basic type, not about shape. -// The policy comes from the shader or the calling code. -TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped* node) const +bool TIntermediate::buildConvertOp(TBasicType dst, TBasicType src, TOperator& newOp) const { - // - // Add a new newNode for the conversion. - // - TIntermUnary* newNode = nullptr; - - TOperator newOp = EOpNull; - - // Certain explicit conversions are allowed conditionally - bool arithemeticInt8Enabled = extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) || - extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int8); -#ifdef AMD_EXTENSIONS - bool arithemeticInt16Enabled = extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) || - extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int16) || - extensionRequested(E_GL_AMD_gpu_shader_int16); - - bool arithemeticFloat16Enabled = extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) || - extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_float16) || - extensionRequested(E_GL_AMD_gpu_shader_half_float); -#else - bool arithemeticInt16Enabled = extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) || - extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int16); - - bool arithemeticFloat16Enabled = extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) || - extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_float16); -#endif - bool convertToIntTypes = (convertTo == EbtInt8 || convertTo == EbtUint8 || - convertTo == EbtInt16 || convertTo == EbtUint16 || - convertTo == EbtInt || convertTo == EbtUint || - convertTo == EbtInt64 || convertTo == EbtUint64); - - bool convertFromIntTypes = (node->getBasicType() == EbtInt8 || node->getBasicType() == EbtUint8 || - node->getBasicType() == EbtInt16 || node->getBasicType() == EbtUint16 || - node->getBasicType() == EbtInt || node->getBasicType() == EbtUint || - node->getBasicType() == EbtInt64 || node->getBasicType() == EbtUint64); - - bool convertToFloatTypes = (convertTo == EbtFloat16 || convertTo == EbtFloat || convertTo == EbtDouble); - - bool convertFromFloatTypes = (node->getBasicType() == EbtFloat16 || - node->getBasicType() == EbtFloat || - node->getBasicType() == EbtDouble); - - if (! arithemeticInt8Enabled) { - if (((convertTo == EbtInt8 || convertTo == EbtUint8) && ! convertFromIntTypes) || - ((node->getBasicType() == EbtInt8 || node->getBasicType() == EbtUint8) && ! convertToIntTypes)) - return nullptr; - } - - if (! arithemeticInt16Enabled) { - if (((convertTo == EbtInt16 || convertTo == EbtUint16) && ! convertFromIntTypes) || - ((node->getBasicType() == EbtInt16 || node->getBasicType() == EbtUint16) && ! convertToIntTypes)) - return nullptr; - } - - if (! arithemeticFloat16Enabled) { - if ((convertTo == EbtFloat16 && ! convertFromFloatTypes) || - (node->getBasicType() == EbtFloat16 && ! convertToFloatTypes)) - return nullptr; - } - - switch (convertTo) { + switch (dst) { +#ifndef GLSLANG_WEB case EbtDouble: - switch (node->getBasicType()) { + switch (src) { + case EbtUint: newOp = EOpConvUintToDouble; break; + case EbtBool: newOp = EOpConvBoolToDouble; break; + case EbtFloat: newOp = EOpConvFloatToDouble; break; + case EbtInt: newOp = EOpConvIntToDouble; break; case EbtInt8: newOp = EOpConvInt8ToDouble; break; case EbtUint8: newOp = EOpConvUint8ToDouble; break; case EbtInt16: newOp = EOpConvInt16ToDouble; break; case EbtUint16: newOp = EOpConvUint16ToDouble; break; - case EbtInt: newOp = EOpConvIntToDouble; break; - case EbtUint: newOp = EOpConvUintToDouble; break; - case EbtBool: newOp = EOpConvBoolToDouble; break; - case EbtFloat: newOp = EOpConvFloatToDouble; break; case EbtFloat16: newOp = EOpConvFloat16ToDouble; break; case EbtInt64: newOp = EOpConvInt64ToDouble; break; case EbtUint64: newOp = EOpConvUint64ToDouble; break; default: - return nullptr; + return false; } break; +#endif case EbtFloat: - switch (node->getBasicType()) { - case EbtInt8: newOp = EOpConvInt8ToFloat; break; - case EbtUint8: newOp = EOpConvUint8ToFloat; break; - case EbtInt16: newOp = EOpConvInt16ToFloat; break; - case EbtUint16: newOp = EOpConvUint16ToFloat; break; + switch (src) { case EbtInt: newOp = EOpConvIntToFloat; break; case EbtUint: newOp = EOpConvUintToFloat; break; case EbtBool: newOp = EOpConvBoolToFloat; break; +#ifndef GLSLANG_WEB case EbtDouble: newOp = EOpConvDoubleToFloat; break; + case EbtInt8: newOp = EOpConvInt8ToFloat; break; + case EbtUint8: newOp = EOpConvUint8ToFloat; break; + case EbtInt16: newOp = EOpConvInt16ToFloat; break; + case EbtUint16: newOp = EOpConvUint16ToFloat; break; case EbtFloat16: newOp = EOpConvFloat16ToFloat; break; case EbtInt64: newOp = EOpConvInt64ToFloat; break; case EbtUint64: newOp = EOpConvUint64ToFloat; break; +#endif default: - return nullptr; + return false; } break; +#ifndef GLSLANG_WEB case EbtFloat16: - switch (node->getBasicType()) { + switch (src) { case EbtInt8: newOp = EOpConvInt8ToFloat16; break; case EbtUint8: newOp = EOpConvUint8ToFloat16; break; case EbtInt16: newOp = EOpConvInt16ToFloat16; break; @@ -675,28 +618,32 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped case EbtInt64: newOp = EOpConvInt64ToFloat16; break; case EbtUint64: newOp = EOpConvUint64ToFloat16; break; default: - return nullptr; + return false; } break; +#endif case EbtBool: - switch (node->getBasicType()) { - case EbtInt8: newOp = EOpConvInt8ToBool; break; - case EbtUint8: newOp = EOpConvUint8ToBool; break; - case EbtInt16: newOp = EOpConvInt16ToBool; break; - case EbtUint16: newOp = EOpConvUint16ToBool; break; + switch (src) { case EbtInt: newOp = EOpConvIntToBool; break; case EbtUint: newOp = EOpConvUintToBool; break; case EbtFloat: newOp = EOpConvFloatToBool; break; +#ifndef GLSLANG_WEB case EbtDouble: newOp = EOpConvDoubleToBool; break; + case EbtInt8: newOp = EOpConvInt8ToBool; break; + case EbtUint8: newOp = EOpConvUint8ToBool; break; + case EbtInt16: newOp = EOpConvInt16ToBool; break; + case EbtUint16: newOp = EOpConvUint16ToBool; break; case EbtFloat16: newOp = EOpConvFloat16ToBool; break; case EbtInt64: newOp = EOpConvInt64ToBool; break; case EbtUint64: newOp = EOpConvUint64ToBool; break; +#endif default: - return nullptr; + return false; } break; +#ifndef GLSLANG_WEB case EbtInt8: - switch (node->getBasicType()) { + switch (src) { case EbtUint8: newOp = EOpConvUint8ToInt8; break; case EbtInt16: newOp = EOpConvInt16ToInt8; break; case EbtUint16: newOp = EOpConvUint16ToInt8; break; @@ -709,11 +656,11 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped case EbtDouble: newOp = EOpConvDoubleToInt8; break; case EbtFloat16: newOp = EOpConvFloat16ToInt8; break; default: - return nullptr; + return false; } break; case EbtUint8: - switch (node->getBasicType()) { + switch (src) { case EbtInt8: newOp = EOpConvInt8ToUint8; break; case EbtInt16: newOp = EOpConvInt16ToUint8; break; case EbtUint16: newOp = EOpConvUint16ToUint8; break; @@ -726,12 +673,12 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped case EbtDouble: newOp = EOpConvDoubleToUint8; break; case EbtFloat16: newOp = EOpConvFloat16ToUint8; break; default: - return nullptr; + return false; } break; case EbtInt16: - switch (node->getBasicType()) { + switch (src) { case EbtUint8: newOp = EOpConvUint8ToInt16; break; case EbtInt8: newOp = EOpConvInt8ToInt16; break; case EbtUint16: newOp = EOpConvUint16ToInt16; break; @@ -744,11 +691,11 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped case EbtDouble: newOp = EOpConvDoubleToInt16; break; case EbtFloat16: newOp = EOpConvFloat16ToInt16; break; default: - return nullptr; + return false; } break; case EbtUint16: - switch (node->getBasicType()) { + switch (src) { case EbtInt8: newOp = EOpConvInt8ToUint16; break; case EbtUint8: newOp = EOpConvUint8ToUint16; break; case EbtInt16: newOp = EOpConvInt16ToUint16; break; @@ -761,46 +708,52 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped case EbtDouble: newOp = EOpConvDoubleToUint16; break; case EbtFloat16: newOp = EOpConvFloat16ToUint16; break; default: - return nullptr; + return false; } break; +#endif case EbtInt: - switch (node->getBasicType()) { + switch (src) { + case EbtUint: newOp = EOpConvUintToInt; break; + case EbtBool: newOp = EOpConvBoolToInt; break; + case EbtFloat: newOp = EOpConvFloatToInt; break; +#ifndef GLSLANG_WEB case EbtInt8: newOp = EOpConvInt8ToInt; break; case EbtUint8: newOp = EOpConvUint8ToInt; break; case EbtInt16: newOp = EOpConvInt16ToInt; break; case EbtUint16: newOp = EOpConvUint16ToInt; break; - case EbtUint: newOp = EOpConvUintToInt; break; - case EbtBool: newOp = EOpConvBoolToInt; break; - case EbtFloat: newOp = EOpConvFloatToInt; break; case EbtDouble: newOp = EOpConvDoubleToInt; break; case EbtFloat16: newOp = EOpConvFloat16ToInt; break; case EbtInt64: newOp = EOpConvInt64ToInt; break; case EbtUint64: newOp = EOpConvUint64ToInt; break; +#endif default: - return nullptr; + return false; } break; case EbtUint: - switch (node->getBasicType()) { + switch (src) { + case EbtInt: newOp = EOpConvIntToUint; break; + case EbtBool: newOp = EOpConvBoolToUint; break; + case EbtFloat: newOp = EOpConvFloatToUint; break; +#ifndef GLSLANG_WEB case EbtInt8: newOp = EOpConvInt8ToUint; break; case EbtUint8: newOp = EOpConvUint8ToUint; break; case EbtInt16: newOp = EOpConvInt16ToUint; break; case EbtUint16: newOp = EOpConvUint16ToUint; break; - case EbtInt: newOp = EOpConvIntToUint; break; - case EbtBool: newOp = EOpConvBoolToUint; break; - case EbtFloat: newOp = EOpConvFloatToUint; break; case EbtDouble: newOp = EOpConvDoubleToUint; break; case EbtFloat16: newOp = EOpConvFloat16ToUint; break; case EbtInt64: newOp = EOpConvInt64ToUint; break; case EbtUint64: newOp = EOpConvUint64ToUint; break; +#endif default: - return nullptr; + return false; } break; +#ifndef GLSLANG_WEB case EbtInt64: - switch (node->getBasicType()) { + switch (src) { case EbtInt8: newOp = EOpConvInt8ToInt64; break; case EbtUint8: newOp = EOpConvUint8ToInt64; break; case EbtInt16: newOp = EOpConvInt16ToInt64; break; @@ -813,11 +766,11 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped case EbtFloat16: newOp = EOpConvFloat16ToInt64; break; case EbtUint64: newOp = EOpConvUint64ToInt64; break; default: - return nullptr; + return false; } break; case EbtUint64: - switch (node->getBasicType()) { + switch (src) { case EbtInt8: newOp = EOpConvInt8ToUint64; break; case EbtUint8: newOp = EOpConvUint8ToUint64; break; case EbtInt16: newOp = EOpConvInt16ToUint64; break; @@ -830,10 +783,64 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped case EbtFloat16: newOp = EOpConvFloat16ToUint64; break; case EbtInt64: newOp = EOpConvInt64ToUint64; break; default: - return nullptr; + return false; } break; +#endif default: + return false; + } + return true; +} + +// This is 'mechanism' here, it does any conversion told. +// It is about basic type, not about shape. +// The policy comes from the shader or the calling code. +TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped* node) const +{ + // + // Add a new newNode for the conversion. + // + +#ifndef GLSLANG_WEB + bool convertToIntTypes = (convertTo == EbtInt8 || convertTo == EbtUint8 || + convertTo == EbtInt16 || convertTo == EbtUint16 || + convertTo == EbtInt || convertTo == EbtUint || + convertTo == EbtInt64 || convertTo == EbtUint64); + + bool convertFromIntTypes = (node->getBasicType() == EbtInt8 || node->getBasicType() == EbtUint8 || + node->getBasicType() == EbtInt16 || node->getBasicType() == EbtUint16 || + node->getBasicType() == EbtInt || node->getBasicType() == EbtUint || + node->getBasicType() == EbtInt64 || node->getBasicType() == EbtUint64); + + bool convertToFloatTypes = (convertTo == EbtFloat16 || convertTo == EbtFloat || convertTo == EbtDouble); + + bool convertFromFloatTypes = (node->getBasicType() == EbtFloat16 || + node->getBasicType() == EbtFloat || + node->getBasicType() == EbtDouble); + + if (! getArithemeticInt8Enabled()) { + if (((convertTo == EbtInt8 || convertTo == EbtUint8) && ! convertFromIntTypes) || + ((node->getBasicType() == EbtInt8 || node->getBasicType() == EbtUint8) && ! convertToIntTypes)) + return nullptr; + } + + if (! getArithemeticInt16Enabled()) { + if (((convertTo == EbtInt16 || convertTo == EbtUint16) && ! convertFromIntTypes) || + ((node->getBasicType() == EbtInt16 || node->getBasicType() == EbtUint16) && ! convertToIntTypes)) + return nullptr; + } + + if (! getArithemeticFloat16Enabled()) { + if ((convertTo == EbtFloat16 && ! convertFromFloatTypes) || + (node->getBasicType() == EbtFloat16 && ! convertToFloatTypes)) + return nullptr; + } +#endif + + TIntermUnary* newNode = nullptr; + TOperator newOp = EOpNull; + if (!buildConvertOp(convertTo, node->getBasicType(), newOp)) { return nullptr; } @@ -841,9 +848,18 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped newNode = addUnaryNode(newOp, node, node->getLoc(), newType); if (node->getAsConstantUnion()) { - TIntermTyped* folded = node->getAsConstantUnion()->fold(newOp, newType); - if (folded) - return folded; +#ifndef GLSLANG_WEB + // 8/16-bit storage extensions don't support 8/16-bit constants, so don't fold conversions + // to those types + if ((getArithemeticInt8Enabled() || !(convertTo == EbtInt8 || convertTo == EbtUint8)) && + (getArithemeticInt16Enabled() || !(convertTo == EbtInt16 || convertTo == EbtUint16)) && + (getArithemeticFloat16Enabled() || !(convertTo == EbtFloat16))) +#endif + { + TIntermTyped* folded = node->getAsConstantUnion()->fold(newOp, newType); + if (folded) + return folded; + } } // Propagate specialization-constant-ness, if allowed @@ -933,7 +949,7 @@ TIntermediate::addConversion(TOperator op, TIntermTyped* node0, TIntermTyped* no case EOpLogicalAnd: case EOpLogicalOr: case EOpLogicalXor: - if (source == EShSourceHlsl) + if (getSource() == EShSourceHlsl) promoteTo = std::make_tuple(EbtBool, EbtBool); else return std::make_tuple(node0, node1); @@ -944,7 +960,7 @@ TIntermediate::addConversion(TOperator op, TIntermTyped* node0, TIntermTyped* no // HLSL can promote bools to ints to make this work. case EOpLeftShift: case EOpRightShift: - if (source == EShSourceHlsl) { + if (getSource() == EShSourceHlsl) { TBasicType node0BasicType = node0->getBasicType(); if (node0BasicType == EbtBool) node0BasicType = EbtInt; @@ -1039,6 +1055,13 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt case EOpConstructFloat: promoteTo = EbtFloat; break; + case EOpConstructInt: + promoteTo = EbtInt; + break; + case EOpConstructUint: + promoteTo = EbtUint; + break; +#ifndef GLSLANG_WEB case EOpConstructDouble: promoteTo = EbtDouble; break; @@ -1067,18 +1090,13 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt canPromoteConstant = extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) || extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int16); break; - case EOpConstructInt: - promoteTo = EbtInt; - break; - case EOpConstructUint: - promoteTo = EbtUint; - break; case EOpConstructInt64: promoteTo = EbtInt64; break; case EOpConstructUint64: promoteTo = EbtUint64; break; +#endif case EOpLogicalNot: @@ -1111,6 +1129,7 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt case EOpLit: case EOpMax: case EOpMin: + case EOpMod: case EOpModf: case EOpPow: case EOpReflect: @@ -1122,7 +1141,7 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt case EOpConstructStruct: case EOpConstructCooperativeMatrix: - if (type.getBasicType() == EbtReference || node->getType().getBasicType() == EbtReference) { + if (type.isReference() || node->getType().isReference()) { // types must match to assign a reference if (type == node->getType()) return node; @@ -1145,7 +1164,7 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt case EOpLeftShiftAssign: case EOpRightShiftAssign: { - if (source == EShSourceHlsl && node->getType().getBasicType() == EbtBool) + if (getSource() == EShSourceHlsl && node->getType().getBasicType() == EbtBool) promoteTo = type.getBasicType(); else { if (isTypeInt(type.getBasicType()) && isTypeInt(node->getBasicType())) @@ -1191,7 +1210,7 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt TIntermTyped* TIntermediate::addUniShapeConversion(TOperator op, const TType& type, TIntermTyped* node) { // some source languages don't do this - switch (source) { + switch (getSource()) { case EShSourceHlsl: break; case EShSourceGlsl: @@ -1244,7 +1263,7 @@ TIntermTyped* TIntermediate::addUniShapeConversion(TOperator op, const TType& ty void TIntermediate::addBiShapeConversion(TOperator op, TIntermTyped*& lhsNode, TIntermTyped*& rhsNode) { // some source languages don't do this - switch (source) { + switch (getSource()) { case EShSourceHlsl: break; case EShSourceGlsl: @@ -1347,7 +1366,7 @@ TIntermTyped* TIntermediate::addShapeConversion(const TType& type, TIntermTyped* // The new node that handles the conversion TOperator constructorOp = mapTypeToConstructorOp(type); - if (source == EShSourceHlsl) { + if (getSource() == EShSourceHlsl) { // HLSL rules for scalar, vector and matrix conversions: // 1) scalar can become anything, initializing every component with its value // 2) vector and matrix can become scalar, first element is used (warning: truncation) @@ -1460,13 +1479,15 @@ bool TIntermediate::isFPPromotion(TBasicType from, TBasicType to) const bool TIntermediate::isIntegralConversion(TBasicType from, TBasicType to) const { +#ifdef GLSLANG_WEB + return false; +#endif + switch (from) { - case EbtInt8: - switch (to) { - case EbtUint8: - case EbtInt16: - case EbtUint16: + case EbtInt: + switch(to) { case EbtUint: + return version >= 400 || getSource() == EShSourceHlsl; case EbtInt64: case EbtUint64: return true; @@ -1474,11 +1495,8 @@ bool TIntermediate::isIntegralConversion(TBasicType from, TBasicType to) const break; } break; - case EbtUint8: - switch (to) { - case EbtInt16: - case EbtUint16: - case EbtUint: + case EbtUint: + switch(to) { case EbtInt64: case EbtUint64: return true; @@ -1486,8 +1504,10 @@ bool TIntermediate::isIntegralConversion(TBasicType from, TBasicType to) const break; } break; - case EbtInt16: - switch(to) { + case EbtInt8: + switch (to) { + case EbtUint8: + case EbtInt16: case EbtUint16: case EbtUint: case EbtInt64: @@ -1497,8 +1517,10 @@ bool TIntermediate::isIntegralConversion(TBasicType from, TBasicType to) const break; } break; - case EbtUint16: - switch(to) { + case EbtUint8: + switch (to) { + case EbtInt16: + case EbtUint16: case EbtUint: case EbtInt64: case EbtUint64: @@ -1507,10 +1529,10 @@ bool TIntermediate::isIntegralConversion(TBasicType from, TBasicType to) const break; } break; - case EbtInt: + case EbtInt16: switch(to) { + case EbtUint16: case EbtUint: - return version >= 400 || (source == EShSourceHlsl); case EbtInt64: case EbtUint64: return true; @@ -1518,8 +1540,9 @@ bool TIntermediate::isIntegralConversion(TBasicType from, TBasicType to) const break; } break; - case EbtUint: + case EbtUint16: switch(to) { + case EbtUint: case EbtInt64: case EbtUint64: return true; @@ -1540,6 +1563,10 @@ bool TIntermediate::isIntegralConversion(TBasicType from, TBasicType to) const bool TIntermediate::isFPConversion(TBasicType from, TBasicType to) const { +#ifdef GLSLANG_WEB + return false; +#endif + if (to == EbtFloat && from == EbtFloat16) { return true; } else { @@ -1550,12 +1577,9 @@ bool TIntermediate::isFPConversion(TBasicType from, TBasicType to) const bool TIntermediate::isFPIntegralConversion(TBasicType from, TBasicType to) const { switch (from) { - case EbtInt8: - case EbtUint8: - case EbtInt16: - case EbtUint16: - switch (to) { - case EbtFloat16: + case EbtInt: + case EbtUint: + switch(to) { case EbtFloat: case EbtDouble: return true; @@ -1563,9 +1587,13 @@ bool TIntermediate::isFPIntegralConversion(TBasicType from, TBasicType to) const break; } break; - case EbtInt: - case EbtUint: - switch(to) { +#ifndef GLSLANG_WEB + case EbtInt8: + case EbtUint8: + case EbtInt16: + case EbtUint16: + switch (to) { + case EbtFloat16: case EbtFloat: case EbtDouble: return true; @@ -1579,7 +1607,7 @@ bool TIntermediate::isFPIntegralConversion(TBasicType from, TBasicType to) const return true; } break; - +#endif default: break; } @@ -1592,7 +1620,7 @@ bool TIntermediate::isFPIntegralConversion(TBasicType from, TBasicType to) const // bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperator op) const { - if (profile == EEsProfile || version == 110) + if (isEsProfile() || version == 110) return false; if (from == to) @@ -1600,7 +1628,7 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat // TODO: Move more policies into language-specific handlers. // Some languages allow more general (or potentially, more specific) conversions under some conditions. - if (source == EShSourceHlsl) { + if (getSource() == EShSourceHlsl) { const bool fromConvertable = (from == EbtFloat || from == EbtDouble || from == EbtInt || from == EbtUint || from == EbtBool); const bool toConvertable = (to == EbtFloat || to == EbtDouble || to == EbtInt || to == EbtUint || to == EbtBool); @@ -1667,7 +1695,7 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat } // hlsl supported conversions - if (source == EShSourceHlsl) { + if (getSource() == EShSourceHlsl) { if (from == EbtBool && (to == EbtInt || to == EbtUint || to == EbtFloat)) return true; } @@ -1682,13 +1710,11 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat case EbtFloat: case EbtDouble: return true; -#ifdef AMD_EXTENSIONS case EbtInt16: case EbtUint16: return extensionRequested(E_GL_AMD_gpu_shader_int16); case EbtFloat16: return extensionRequested(E_GL_AMD_gpu_shader_half_float); -#endif default: return false; } @@ -1699,34 +1725,28 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat case EbtFloat: return true; case EbtBool: - return (source == EShSourceHlsl); -#ifdef AMD_EXTENSIONS + return getSource() == EShSourceHlsl; case EbtInt16: case EbtUint16: return extensionRequested(E_GL_AMD_gpu_shader_int16); -#endif case EbtFloat16: return -#ifdef AMD_EXTENSIONS extensionRequested(E_GL_AMD_gpu_shader_half_float) || -#endif - (source == EShSourceHlsl); + getSource() == EShSourceHlsl; default: return false; } case EbtUint: switch (from) { case EbtInt: - return version >= 400 || (source == EShSourceHlsl); + return version >= 400 || getSource() == EShSourceHlsl; case EbtUint: return true; case EbtBool: - return (source == EShSourceHlsl); -#ifdef AMD_EXTENSIONS + return getSource() == EShSourceHlsl; case EbtInt16: case EbtUint16: return extensionRequested(E_GL_AMD_gpu_shader_int16); -#endif default: return false; } @@ -1735,11 +1755,9 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat case EbtInt: return true; case EbtBool: - return (source == EShSourceHlsl); -#ifdef AMD_EXTENSIONS + return getSource() == EShSourceHlsl; case EbtInt16: return extensionRequested(E_GL_AMD_gpu_shader_int16); -#endif default: return false; } @@ -1750,11 +1768,9 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat case EbtInt64: case EbtUint64: return true; -#ifdef AMD_EXTENSIONS case EbtInt16: case EbtUint16: return extensionRequested(E_GL_AMD_gpu_shader_int16); -#endif default: return false; } @@ -1763,15 +1779,12 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat case EbtInt: case EbtInt64: return true; -#ifdef AMD_EXTENSIONS case EbtInt16: return extensionRequested(E_GL_AMD_gpu_shader_int16); -#endif default: return false; } case EbtFloat16: -#ifdef AMD_EXTENSIONS switch (from) { case EbtInt16: case EbtUint16: @@ -1781,10 +1794,8 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat default: break; } -#endif return false; case EbtUint16: -#ifdef AMD_EXTENSIONS switch (from) { case EbtInt16: case EbtUint16: @@ -1792,7 +1803,6 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat default: break; } -#endif return false; default: return false; @@ -1802,7 +1812,12 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat return false; } -static bool canSignedIntTypeRepresentAllUnsignedValues(TBasicType sintType, TBasicType uintType) { +static bool canSignedIntTypeRepresentAllUnsignedValues(TBasicType sintType, TBasicType uintType) +{ +#ifdef GLSLANG_WEB + return false; +#endif + switch(sintType) { case EbtInt8: switch(uintType) { @@ -1861,7 +1876,13 @@ static bool canSignedIntTypeRepresentAllUnsignedValues(TBasicType sintType, TBas } -static TBasicType getCorrespondingUnsignedType(TBasicType type) { +static TBasicType getCorrespondingUnsignedType(TBasicType type) +{ +#ifdef GLSLANG_WEB + assert(type == EbtInt); + return EbtUint; +#endif + switch(type) { case EbtInt8: return EbtUint8; @@ -1910,10 +1931,10 @@ std::tuple<TBasicType, TBasicType> TIntermediate::getConversionDestinatonType(TB TBasicType res0 = EbtNumTypes; TBasicType res1 = EbtNumTypes; - if (profile == EEsProfile || version == 110) - return std::make_tuple(res0, res1);; + if (isEsProfile() || version == 110) + return std::make_tuple(res0, res1); - if (source == EShSourceHlsl) { + if (getSource() == EShSourceHlsl) { if (canImplicitlyPromote(type1, type0, op)) { res0 = type0; res1 = type0; @@ -1982,7 +2003,7 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const { TOperator op = EOpNull; - if (type.getQualifier().nonUniform) + if (type.getQualifier().isNonUniform()) return EOpConstructNonuniform; if (type.isCoopMat()) @@ -1993,7 +2014,7 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const op = EOpConstructStruct; break; case EbtSampler: - if (type.getSampler().combined) + if (type.getSampler().isCombined()) op = EOpConstructTextureSampler; break; case EbtFloat: @@ -2035,6 +2056,121 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const } } break; + case EbtInt: + if (type.getMatrixCols()) { + switch (type.getMatrixCols()) { + case 2: + switch (type.getMatrixRows()) { + case 2: op = EOpConstructIMat2x2; break; + case 3: op = EOpConstructIMat2x3; break; + case 4: op = EOpConstructIMat2x4; break; + default: break; // some compilers want this + } + break; + case 3: + switch (type.getMatrixRows()) { + case 2: op = EOpConstructIMat3x2; break; + case 3: op = EOpConstructIMat3x3; break; + case 4: op = EOpConstructIMat3x4; break; + default: break; // some compilers want this + } + break; + case 4: + switch (type.getMatrixRows()) { + case 2: op = EOpConstructIMat4x2; break; + case 3: op = EOpConstructIMat4x3; break; + case 4: op = EOpConstructIMat4x4; break; + default: break; // some compilers want this + } + break; + } + } else { + switch(type.getVectorSize()) { + case 1: op = EOpConstructInt; break; + case 2: op = EOpConstructIVec2; break; + case 3: op = EOpConstructIVec3; break; + case 4: op = EOpConstructIVec4; break; + default: break; // some compilers want this + } + } + break; + case EbtUint: + if (type.getMatrixCols()) { + switch (type.getMatrixCols()) { + case 2: + switch (type.getMatrixRows()) { + case 2: op = EOpConstructUMat2x2; break; + case 3: op = EOpConstructUMat2x3; break; + case 4: op = EOpConstructUMat2x4; break; + default: break; // some compilers want this + } + break; + case 3: + switch (type.getMatrixRows()) { + case 2: op = EOpConstructUMat3x2; break; + case 3: op = EOpConstructUMat3x3; break; + case 4: op = EOpConstructUMat3x4; break; + default: break; // some compilers want this + } + break; + case 4: + switch (type.getMatrixRows()) { + case 2: op = EOpConstructUMat4x2; break; + case 3: op = EOpConstructUMat4x3; break; + case 4: op = EOpConstructUMat4x4; break; + default: break; // some compilers want this + } + break; + } + } else { + switch(type.getVectorSize()) { + case 1: op = EOpConstructUint; break; + case 2: op = EOpConstructUVec2; break; + case 3: op = EOpConstructUVec3; break; + case 4: op = EOpConstructUVec4; break; + default: break; // some compilers want this + } + } + break; + case EbtBool: + if (type.getMatrixCols()) { + switch (type.getMatrixCols()) { + case 2: + switch (type.getMatrixRows()) { + case 2: op = EOpConstructBMat2x2; break; + case 3: op = EOpConstructBMat2x3; break; + case 4: op = EOpConstructBMat2x4; break; + default: break; // some compilers want this + } + break; + case 3: + switch (type.getMatrixRows()) { + case 2: op = EOpConstructBMat3x2; break; + case 3: op = EOpConstructBMat3x3; break; + case 4: op = EOpConstructBMat3x4; break; + default: break; // some compilers want this + } + break; + case 4: + switch (type.getMatrixRows()) { + case 2: op = EOpConstructBMat4x2; break; + case 3: op = EOpConstructBMat4x3; break; + case 4: op = EOpConstructBMat4x4; break; + default: break; // some compilers want this + } + break; + } + } else { + switch(type.getVectorSize()) { + case 1: op = EOpConstructBool; break; + case 2: op = EOpConstructBVec2; break; + case 3: op = EOpConstructBVec3; break; + case 4: op = EOpConstructBVec4; break; + default: break; // some compilers want this + } + } + break; +#ifndef GLSLANG_WEB case EbtDouble: if (type.getMatrixCols()) { switch (type.getMatrixCols()) { @@ -2148,82 +2284,6 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const default: break; // some compilers want this } break; - case EbtInt: - if (type.getMatrixCols()) { - switch (type.getMatrixCols()) { - case 2: - switch (type.getMatrixRows()) { - case 2: op = EOpConstructIMat2x2; break; - case 3: op = EOpConstructIMat2x3; break; - case 4: op = EOpConstructIMat2x4; break; - default: break; // some compilers want this - } - break; - case 3: - switch (type.getMatrixRows()) { - case 2: op = EOpConstructIMat3x2; break; - case 3: op = EOpConstructIMat3x3; break; - case 4: op = EOpConstructIMat3x4; break; - default: break; // some compilers want this - } - break; - case 4: - switch (type.getMatrixRows()) { - case 2: op = EOpConstructIMat4x2; break; - case 3: op = EOpConstructIMat4x3; break; - case 4: op = EOpConstructIMat4x4; break; - default: break; // some compilers want this - } - break; - } - } else { - switch(type.getVectorSize()) { - case 1: op = EOpConstructInt; break; - case 2: op = EOpConstructIVec2; break; - case 3: op = EOpConstructIVec3; break; - case 4: op = EOpConstructIVec4; break; - default: break; // some compilers want this - } - } - break; - case EbtUint: - if (type.getMatrixCols()) { - switch (type.getMatrixCols()) { - case 2: - switch (type.getMatrixRows()) { - case 2: op = EOpConstructUMat2x2; break; - case 3: op = EOpConstructUMat2x3; break; - case 4: op = EOpConstructUMat2x4; break; - default: break; // some compilers want this - } - break; - case 3: - switch (type.getMatrixRows()) { - case 2: op = EOpConstructUMat3x2; break; - case 3: op = EOpConstructUMat3x3; break; - case 4: op = EOpConstructUMat3x4; break; - default: break; // some compilers want this - } - break; - case 4: - switch (type.getMatrixRows()) { - case 2: op = EOpConstructUMat4x2; break; - case 3: op = EOpConstructUMat4x3; break; - case 4: op = EOpConstructUMat4x4; break; - default: break; // some compilers want this - } - break; - } - } else { - switch(type.getVectorSize()) { - case 1: op = EOpConstructUint; break; - case 2: op = EOpConstructUVec2; break; - case 3: op = EOpConstructUVec3; break; - case 4: op = EOpConstructUVec4; break; - default: break; // some compilers want this - } - } - break; case EbtInt64: switch(type.getVectorSize()) { case 1: op = EOpConstructInt64; break; @@ -2242,47 +2302,10 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const default: break; // some compilers want this } break; - case EbtBool: - if (type.getMatrixCols()) { - switch (type.getMatrixCols()) { - case 2: - switch (type.getMatrixRows()) { - case 2: op = EOpConstructBMat2x2; break; - case 3: op = EOpConstructBMat2x3; break; - case 4: op = EOpConstructBMat2x4; break; - default: break; // some compilers want this - } - break; - case 3: - switch (type.getMatrixRows()) { - case 2: op = EOpConstructBMat3x2; break; - case 3: op = EOpConstructBMat3x3; break; - case 4: op = EOpConstructBMat3x4; break; - default: break; // some compilers want this - } - break; - case 4: - switch (type.getMatrixRows()) { - case 2: op = EOpConstructBMat4x2; break; - case 3: op = EOpConstructBMat4x3; break; - case 4: op = EOpConstructBMat4x4; break; - default: break; // some compilers want this - } - break; - } - } else { - switch(type.getVectorSize()) { - case 1: op = EOpConstructBool; break; - case 2: op = EOpConstructBVec2; break; - case 3: op = EOpConstructBVec3; break; - case 4: op = EOpConstructBVec4; break; - default: break; // some compilers want this - } - } - break; case EbtReference: op = EOpConstructReference; break; +#endif default: break; } @@ -2741,6 +2764,7 @@ bool TIntermediate::postProcess(TIntermNode* root, EShLanguage /*language*/) if (aggRoot && aggRoot->getOp() == EOpNull) aggRoot->setOperator(EOpSequence); +#ifndef GLSLANG_WEB // Propagate 'noContraction' label in backward from 'precise' variables. glslang::PropagateNoContraction(*this); @@ -2751,6 +2775,7 @@ bool TIntermediate::postProcess(TIntermNode* root, EShLanguage /*language*/) performTextureUpgradeAndSamplerRemovalTransformation(root); break; } +#endif return true; } @@ -3788,217 +3813,54 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC TConstUnionArray leftUnionArray(size); for (int i=0; i < size; i++) { - switch (promoteTo) { - case EbtFloat: - switch (node->getType().getBasicType()) { - case EbtInt: - leftUnionArray[i].setDConst(static_cast<double>(rightUnionArray[i].getIConst())); - break; - case EbtUint: - leftUnionArray[i].setDConst(static_cast<double>(rightUnionArray[i].getUConst())); - break; - case EbtInt64: - leftUnionArray[i].setDConst(static_cast<double>(rightUnionArray[i].getI64Const())); - break; - case EbtUint64: - leftUnionArray[i].setDConst(static_cast<double>(rightUnionArray[i].getU64Const())); - break; - case EbtBool: - leftUnionArray[i].setDConst(static_cast<double>(rightUnionArray[i].getBConst())); - break; - case EbtFloat: - case EbtDouble: - case EbtFloat16: - leftUnionArray[i] = rightUnionArray[i]; - break; - default: - return node; - } - break; - case EbtDouble: - switch (node->getType().getBasicType()) { - case EbtInt: - leftUnionArray[i].setDConst(static_cast<double>(rightUnionArray[i].getIConst())); - break; - case EbtUint: - leftUnionArray[i].setDConst(static_cast<double>(rightUnionArray[i].getUConst())); - break; - case EbtInt64: - leftUnionArray[i].setDConst(static_cast<double>(rightUnionArray[i].getI64Const())); - break; - case EbtUint64: - leftUnionArray[i].setDConst(static_cast<double>(rightUnionArray[i].getU64Const())); - break; - case EbtBool: - leftUnionArray[i].setDConst(static_cast<double>(rightUnionArray[i].getBConst())); - break; - case EbtFloat: - case EbtDouble: - case EbtFloat16: - leftUnionArray[i] = rightUnionArray[i]; - break; - default: - return node; - } - break; - case EbtFloat16: - switch (node->getType().getBasicType()) { - case EbtInt: - leftUnionArray[i].setDConst(static_cast<double>(rightUnionArray[i].getIConst())); - break; - case EbtUint: - leftUnionArray[i].setDConst(static_cast<double>(rightUnionArray[i].getUConst())); - break; - case EbtInt64: - leftUnionArray[i].setDConst(static_cast<double>(rightUnionArray[i].getI64Const())); - break; - case EbtUint64: - leftUnionArray[i].setDConst(static_cast<double>(rightUnionArray[i].getU64Const())); - break; - case EbtBool: - leftUnionArray[i].setDConst(static_cast<double>(rightUnionArray[i].getBConst())); - break; - case EbtFloat: - case EbtDouble: - case EbtFloat16: - leftUnionArray[i] = rightUnionArray[i]; - break; - default: - return node; - } - break; - case EbtInt: - switch (node->getType().getBasicType()) { - case EbtInt: - leftUnionArray[i] = rightUnionArray[i]; - break; - case EbtUint: - leftUnionArray[i].setIConst(static_cast<int>(rightUnionArray[i].getUConst())); - break; - case EbtInt64: - leftUnionArray[i].setIConst(static_cast<int>(rightUnionArray[i].getI64Const())); - break; - case EbtUint64: - leftUnionArray[i].setIConst(static_cast<int>(rightUnionArray[i].getU64Const())); - break; - case EbtBool: - leftUnionArray[i].setIConst(static_cast<int>(rightUnionArray[i].getBConst())); - break; - case EbtFloat: - case EbtDouble: - case EbtFloat16: - leftUnionArray[i].setIConst(static_cast<int>(rightUnionArray[i].getDConst())); - break; - default: - return node; - } - break; - case EbtUint: - switch (node->getType().getBasicType()) { - case EbtInt: - leftUnionArray[i].setUConst(static_cast<unsigned int>(rightUnionArray[i].getIConst())); - break; - case EbtUint: - leftUnionArray[i] = rightUnionArray[i]; - break; - case EbtInt64: - leftUnionArray[i].setUConst(static_cast<unsigned int>(rightUnionArray[i].getI64Const())); - break; - case EbtUint64: - leftUnionArray[i].setUConst(static_cast<unsigned int>(rightUnionArray[i].getU64Const())); - break; - case EbtBool: - leftUnionArray[i].setUConst(static_cast<unsigned int>(rightUnionArray[i].getBConst())); - break; - case EbtFloat: - case EbtDouble: - case EbtFloat16: - leftUnionArray[i].setUConst(static_cast<unsigned int>(rightUnionArray[i].getDConst())); - break; - default: - return node; - } - break; - case EbtBool: - switch (node->getType().getBasicType()) { - case EbtInt: - leftUnionArray[i].setBConst(rightUnionArray[i].getIConst() != 0); - break; - case EbtUint: - leftUnionArray[i].setBConst(rightUnionArray[i].getUConst() != 0); - break; - case EbtInt64: - leftUnionArray[i].setBConst(rightUnionArray[i].getI64Const() != 0); - break; - case EbtUint64: - leftUnionArray[i].setBConst(rightUnionArray[i].getU64Const() != 0); - break; - case EbtBool: - leftUnionArray[i] = rightUnionArray[i]; - break; - case EbtFloat: - case EbtDouble: - case EbtFloat16: - leftUnionArray[i].setBConst(rightUnionArray[i].getDConst() != 0.0); - break; - default: - return node; - } - break; - case EbtInt64: - switch (node->getType().getBasicType()) { - case EbtInt: - leftUnionArray[i].setI64Const(static_cast<long long>(rightUnionArray[i].getIConst())); - break; - case EbtUint: - leftUnionArray[i].setI64Const(static_cast<long long>(rightUnionArray[i].getUConst())); - break; - case EbtInt64: - leftUnionArray[i] = rightUnionArray[i]; - break; - case EbtUint64: - leftUnionArray[i].setI64Const(static_cast<long long>(rightUnionArray[i].getU64Const())); - break; - case EbtBool: - leftUnionArray[i].setI64Const(static_cast<long long>(rightUnionArray[i].getBConst())); - break; - case EbtFloat: - case EbtDouble: - case EbtFloat16: - leftUnionArray[i].setI64Const(static_cast<long long>(rightUnionArray[i].getDConst())); - break; - default: - return node; - } - break; - case EbtUint64: - switch (node->getType().getBasicType()) { - case EbtInt: - leftUnionArray[i].setU64Const(static_cast<unsigned long long>(rightUnionArray[i].getIConst())); - break; - case EbtUint: - leftUnionArray[i].setU64Const(static_cast<unsigned long long>(rightUnionArray[i].getUConst())); - break; - case EbtInt64: - leftUnionArray[i].setU64Const(static_cast<unsigned long long>(rightUnionArray[i].getI64Const())); - break; - case EbtUint64: - leftUnionArray[i] = rightUnionArray[i]; - break; - case EbtBool: - leftUnionArray[i].setU64Const(static_cast<unsigned long long>(rightUnionArray[i].getBConst())); - break; - case EbtFloat: - case EbtDouble: - case EbtFloat16: - leftUnionArray[i].setU64Const(static_cast<unsigned long long>(rightUnionArray[i].getDConst())); - break; - default: - return node; - } - break; - default: - return node; + +#define PROMOTE(Set, CType, Get) leftUnionArray[i].Set(static_cast<CType>(rightUnionArray[i].Get())) +#define PROMOTE_TO_BOOL(Get) leftUnionArray[i].setBConst(rightUnionArray[i].Get() != 0) + +#ifdef GLSLANG_WEB +#define TO_ALL(Get) \ + switch (promoteTo) { \ + case EbtFloat: PROMOTE(setDConst, double, Get); break; \ + case EbtInt: PROMOTE(setIConst, int, Get); break; \ + case EbtUint: PROMOTE(setUConst, unsigned int, Get); break; \ + case EbtBool: PROMOTE_TO_BOOL(Get); break; \ + default: return node; \ + } +#else +#define TO_ALL(Get) \ + switch (promoteTo) { \ + case EbtFloat16: PROMOTE(setDConst, double, Get); break; \ + case EbtFloat: PROMOTE(setDConst, double, Get); break; \ + case EbtDouble: PROMOTE(setDConst, double, Get); break; \ + case EbtInt8: PROMOTE(setI8Const, char, Get); break; \ + case EbtInt16: PROMOTE(setI16Const, short, Get); break; \ + case EbtInt: PROMOTE(setIConst, int, Get); break; \ + case EbtInt64: PROMOTE(setI64Const, long long, Get); break; \ + case EbtUint8: PROMOTE(setU8Const, unsigned char, Get); break; \ + case EbtUint16: PROMOTE(setU16Const, unsigned short, Get); break; \ + case EbtUint: PROMOTE(setUConst, unsigned int, Get); break; \ + case EbtUint64: PROMOTE(setU64Const, unsigned long long, Get); break; \ + case EbtBool: PROMOTE_TO_BOOL(Get); break; \ + default: return node; \ + } +#endif + + switch (node->getType().getBasicType()) { + case EbtFloat: TO_ALL(getDConst); break; + case EbtInt: TO_ALL(getIConst); break; + case EbtUint: TO_ALL(getUConst); break; + case EbtBool: TO_ALL(getBConst); break; +#ifndef GLSLANG_WEB + case EbtFloat16: TO_ALL(getDConst); break; + case EbtDouble: TO_ALL(getDConst); break; + case EbtInt8: TO_ALL(getI8Const); break; + case EbtInt16: TO_ALL(getI16Const); break; + case EbtInt64: TO_ALL(getI64Const); break; + case EbtUint8: TO_ALL(getU8Const); break; + case EbtUint16: TO_ALL(getU16Const); break; + case EbtUint64: TO_ALL(getU64Const); break; +#endif + default: return node; } } @@ -4027,7 +3889,7 @@ bool TIntermediate::specConstantPropagates(const TIntermTyped& node1, const TInt struct TextureUpgradeAndSamplerRemovalTransform : public TIntermTraverser { void visitSymbol(TIntermSymbol* symbol) override { if (symbol->getBasicType() == EbtSampler && symbol->getType().getSampler().isTexture()) { - symbol->getWritableType().getSampler().combined = true; + symbol->getWritableType().getSampler().setCombined(true); } } bool visitAggregate(TVisit, TIntermAggregate* ag) override { diff --git a/thirdparty/glslang/glslang/MachineIndependent/ParseContextBase.cpp b/thirdparty/glslang/glslang/MachineIndependent/ParseContextBase.cpp index c9ddaeadb0..282ecca0e0 100644 --- a/thirdparty/glslang/glslang/MachineIndependent/ParseContextBase.cpp +++ b/thirdparty/glslang/glslang/MachineIndependent/ParseContextBase.cpp @@ -67,6 +67,8 @@ void TParseContextBase::outputMessage(const TSourceLoc& loc, const char* szReaso } } +#if !defined(GLSLANG_WEB) || defined(GLSLANG_WEB_DEVEL) + void C_DECL TParseContextBase::error(const TSourceLoc& loc, const char* szReason, const char* szToken, const char* szExtraInfoFormat, ...) { @@ -113,6 +115,8 @@ void C_DECL TParseContextBase::ppWarn(const TSourceLoc& loc, const char* szReaso va_end(args); } +#endif + // // Both test and if necessary, spit out an error, to see if the node is really // an l-value that can be operated on this way. @@ -149,15 +153,13 @@ bool TParseContextBase::lValueErrorCheck(const TSourceLoc& loc, const char* op, case EvqConst: message = "can't modify a const"; break; case EvqConstReadOnly: message = "can't modify a const"; break; case EvqUniform: message = "can't modify a uniform"; break; +#ifndef GLSLANG_WEB case EvqBuffer: - if (node->getQualifier().readonly) + if (node->getQualifier().isReadOnly()) message = "can't modify a readonly buffer"; -#ifdef NV_EXTENSIONS - if (node->getQualifier().layoutShaderRecordNV) + if (node->getQualifier().isShaderRecordNV()) message = "can't modify a shaderrecordnv qualified buffer"; -#endif break; -#ifdef NV_EXTENSIONS case EvqHitAttrNV: if (language != EShLangIntersectNV) message = "cannot modify hitAttributeNV in this stage"; @@ -172,13 +174,13 @@ bool TParseContextBase::lValueErrorCheck(const TSourceLoc& loc, const char* op, case EbtSampler: message = "can't modify a sampler"; break; - case EbtAtomicUint: - message = "can't modify an atomic_uint"; - break; case EbtVoid: message = "can't modify void"; break; -#ifdef NV_EXTENSIONS +#ifndef GLSLANG_WEB + case EbtAtomicUint: + message = "can't modify an atomic_uint"; + break; case EbtAccStructNV: message = "can't modify accelerationStructureNV"; break; @@ -234,7 +236,7 @@ void TParseContextBase::rValueErrorCheck(const TSourceLoc& loc, const char* op, } TIntermSymbol* symNode = node->getAsSymbolNode(); - if (symNode && symNode->getQualifier().writeonly) + if (symNode && symNode->getQualifier().isWriteOnly()) error(loc, "can't read from writeonly object: ", op, symNode->getName().c_str()); } @@ -254,11 +256,17 @@ void TParseContextBase::trackLinkage(TSymbol& symbol) // Give an error if not. void TParseContextBase::checkIndex(const TSourceLoc& loc, const TType& type, int& index) { + const auto sizeIsSpecializationExpression = [&type]() { + return type.containsSpecializationSize() && + type.getArraySizes()->getOuterNode() != nullptr && + type.getArraySizes()->getOuterNode()->getAsSymbolNode() == nullptr; }; + if (index < 0) { error(loc, "", "[", "index out of range '%d'", index); index = 0; } else if (type.isArray()) { - if (type.isSizedArray() && index >= type.getOuterArraySize()) { + if (type.isSizedArray() && !sizeIsSpecializationExpression() && + index >= type.getOuterArraySize()) { error(loc, "", "[", "array index out of range '%d'", index); index = type.getOuterArraySize() - 1; } @@ -568,6 +576,7 @@ void TParseContextBase::parseSwizzleSelector(const TSourceLoc& loc, const TStrin selector.push_back(0); } +#ifdef ENABLE_HLSL // // Make the passed-in variable information become a member of the // global uniform block. If this doesn't exist yet, make it. @@ -612,6 +621,7 @@ void TParseContextBase::growGlobalUniformBlock(const TSourceLoc& loc, TType& mem ++firstNewMember; } +#endif void TParseContextBase::finish() { diff --git a/thirdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp b/thirdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp index 6a8d379b09..a2224e1609 100644 --- a/thirdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp +++ b/thirdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2002-2005 3Dlabs Inc. Ltd. // Copyright (C) 2012-2015 LunarG, Inc. // Copyright (C) 2015-2018 Google, Inc. -// Copyright (C) 2017 ARM Limited. +// Copyright (C) 2017, 2019 ARM Limited. // // All rights reserved. // @@ -56,13 +56,16 @@ TParseContext::TParseContext(TSymbolTable& symbolTable, TIntermediate& interm, b infoSink, forwardCompatible, messages, entryPoint), inMain(false), blockName(nullptr), - limits(resources.limits), + limits(resources.limits) +#ifndef GLSLANG_WEB + , atomicUintOffsets(nullptr), anyIndexLimits(false) +#endif { // decide whether precision qualifiers should be ignored or respected - if (profile == EEsProfile || spvVersion.vulkan > 0) { + if (isEsProfile() || spvVersion.vulkan > 0) { precisionManager.respectPrecisionQualifiers(); - if (! parsingBuiltins && language == EShLangFragment && profile != EEsProfile && spvVersion.vulkan > 0) + if (! parsingBuiltins && language == EShLangFragment && !isEsProfile() && spvVersion.vulkan > 0) precisionManager.warnAboutDefaults(); } @@ -83,6 +86,7 @@ TParseContext::TParseContext(TSymbolTable& symbolTable, TIntermediate& interm, b globalInputDefaults.clear(); globalOutputDefaults.clear(); +#ifndef GLSLANG_WEB // "Shaders in the transform // feedback capturing mode have an initial global default of // layout(xfb_buffer = 0) out;" @@ -94,6 +98,7 @@ TParseContext::TParseContext(TSymbolTable& symbolTable, TIntermediate& interm, b if (language == EShLangGeometry) globalOutputDefaults.layoutStream = 0; +#endif if (entryPoint != nullptr && entryPoint->size() > 0 && *entryPoint != "main") infoSink.info.message(EPrefixError, "Source entry point must be \"main\""); @@ -101,7 +106,9 @@ TParseContext::TParseContext(TSymbolTable& symbolTable, TIntermediate& interm, b TParseContext::~TParseContext() { +#ifndef GLSLANG_WEB delete [] atomicUintOffsets; +#endif } // Set up all default precisions as needed by the current environment. @@ -121,7 +128,7 @@ void TParseContext::setPrecisionDefaults() // replace with real precision defaults for those that have them if (obeyPrecisionQualifiers()) { - if (profile == EEsProfile) { + if (isEsProfile()) { // Most don't have defaults, a few default to lowp. TSampler sampler; sampler.set(EbtFloat, Esd2D); @@ -129,7 +136,7 @@ void TParseContext::setPrecisionDefaults() sampler.set(EbtFloat, EsdCube); defaultSamplerPrecision[computeSamplerTypeIndex(sampler)] = EpqLow; sampler.set(EbtFloat, Esd2D); - sampler.external = true; + sampler.setExternal(true); defaultSamplerPrecision[computeSamplerTypeIndex(sampler)] = EpqLow; } @@ -138,7 +145,7 @@ void TParseContext::setPrecisionDefaults() // is used to resolve the precision from the supplied arguments/operands instead. // So, we don't actually want to replace EpqNone with a default precision for built-ins. if (! parsingBuiltins) { - if (profile == EEsProfile && language == EShLangFragment) { + if (isEsProfile() && language == EShLangFragment) { defaultPrecision[EbtInt] = EpqMedium; defaultPrecision[EbtUint] = EpqMedium; } else { @@ -147,7 +154,7 @@ void TParseContext::setPrecisionDefaults() defaultPrecision[EbtFloat] = EpqHigh; } - if (profile != EEsProfile) { + if (!isEsProfile()) { // Non-ES profile // All sampler precisions default to highp. for (int type = 0; type < maxSamplerIndex; ++type) @@ -163,7 +170,9 @@ void TParseContext::setPrecisionDefaults() void TParseContext::setLimits(const TBuiltInResource& r) { resources = r; + intermediate.setLimits(r); +#ifndef GLSLANG_WEB anyIndexLimits = ! limits.generalAttributeMatrixVectorIndexing || ! limits.generalConstantMatrixVectorIndexing || ! limits.generalSamplerIndexing || @@ -171,7 +180,6 @@ void TParseContext::setLimits(const TBuiltInResource& r) ! limits.generalVariableIndexing || ! limits.generalVaryingIndexing; - intermediate.setLimits(resources); // "Each binding point tracks its own current default offset for // inheritance of subsequent variables using the same binding. The initial state of compilation is that all @@ -179,6 +187,7 @@ void TParseContext::setLimits(const TBuiltInResource& r) atomicUintOffsets = new int[resources.maxAtomicCounterBindings]; for (int b = 0; b < resources.maxAtomicCounterBindings; ++b) atomicUintOffsets[b] = 0; +#endif } // @@ -213,6 +222,7 @@ void TParseContext::parserError(const char* s) void TParseContext::handlePragma(const TSourceLoc& loc, const TVector<TString>& tokens) { +#ifndef GLSLANG_WEB if (pragmaCallback) pragmaCallback(loc.line, tokens); @@ -285,6 +295,7 @@ void TParseContext::handlePragma(const TSourceLoc& loc, const TVector<TString>& warn(loc, "not implemented", "#pragma once", ""); } else if (tokens[0].compare("glslang_binary_double_output") == 0) intermediate.setBinaryDoubleOutput(); +#endif } // @@ -298,6 +309,7 @@ TIntermTyped* TParseContext::handleVariable(const TSourceLoc& loc, TSymbol* symb if (symbol && symbol->getNumExtensions()) requireExtensions(loc, symbol->getNumExtensions(), symbol->getExtensions(), symbol->getName().c_str()); +#ifndef GLSLANG_WEB if (symbol && symbol->isReadOnly()) { // All shared things containing an unsized array must be copied up // on first use, so that all future references will share its array structure, @@ -307,11 +319,17 @@ TIntermTyped* TParseContext::handleVariable(const TSourceLoc& loc, TSymbol* symb // If this is a variable or a block, check it and all it contains, but if this // is a member of an anonymous block, check the whole block, as the whole block // will need to be copied up if it contains an unsized array. - if (symbol->getType().containsUnsizedArray() || - (symbol->getAsAnonMember() && - symbol->getAsAnonMember()->getAnonContainer().getType().containsUnsizedArray())) - makeEditable(symbol); + // + // This check is being done before the block-name check further down, so guard + // for that too. + if (!symbol->getType().isUnusableName()) { + if (symbol->getType().containsUnsizedArray() || + (symbol->getAsAnonMember() && + symbol->getAsAnonMember()->getAnonContainer().getType().containsUnsizedArray())) + makeEditable(symbol); + } } +#endif const TVariable* variable; const TAnonMember* anon = symbol ? symbol->getAsAnonMember() : nullptr; @@ -334,8 +352,7 @@ TIntermTyped* TParseContext::handleVariable(const TSourceLoc& loc, TSymbol* symb // See if it was a variable. variable = symbol ? symbol->getAsVariable() : nullptr; if (variable) { - if ((variable->getType().getBasicType() == EbtBlock || - variable->getType().getBasicType() == EbtStruct) && variable->getType().getStruct() == nullptr) { + if (variable->getType().isUnusableName()) { error(loc, "cannot be used (maybe an instance name is needed)", string->c_str(), ""); variable = nullptr; } @@ -357,7 +374,7 @@ TIntermTyped* TParseContext::handleVariable(const TSourceLoc& loc, TSymbol* symb if (variable->getType().getQualifier().isIo()) intermediate.addIoAccessed(*string); - if (variable->getType().getBasicType() == EbtReference && + if (variable->getType().isReference() && variable->getType().getQualifier().bufferReferenceNeedsVulkanMemoryModel()) { intermediate.setUseVulkanMemoryModel(); } @@ -378,7 +395,7 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn variableCheck(base); if (! base->isArray() && ! base->isMatrix() && ! base->isVector() && ! base->getType().isCoopMat() && - base->getBasicType() != EbtReference) { + ! base->isReference()) { if (base->getAsSymbolNode()) error(loc, " left of '[' is not of type array, matrix, or vector ", base->getAsSymbolNode()->getName().c_str(), ""); else @@ -389,7 +406,7 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn } if (!base->isArray() && base->isVector()) { - if (base->getType().containsBasicType(EbtFloat16)) + if (base->getType().contains16BitFloat()) requireFloat16Arithmetic(loc, "[", "does not operate on types containing float16"); if (base->getType().contains16BitInt()) requireInt16Arithmetic(loc, "[", "does not operate on types containing (u)int16"); @@ -407,23 +424,24 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn // at least one of base and index is not a front-end constant variable... TIntermTyped* result = nullptr; - if (base->getBasicType() == EbtReference && ! base->isArray()) { +#ifndef GLSLANG_WEB + if (base->isReference() && ! base->isArray()) { requireExtensions(loc, 1, &E_GL_EXT_buffer_reference2, "buffer reference indexing"); result = intermediate.addBinaryMath(EOpAdd, base, index, loc); result->setType(base->getType()); return result; } + if (base->getAsSymbolNode() && isIoResizeArray(base->getType())) + handleIoResizeArrayAccess(loc, base); +#endif if (index->getQualifier().isFrontEndConstant()) checkIndex(loc, base->getType(), indexValue); - if (base->getAsSymbolNode() && isIoResizeArray(base->getType())) - handleIoResizeArrayAccess(loc, base); - if (index->getQualifier().isFrontEndConstant()) { +#ifndef GLSLANG_WEB if (base->getType().isUnsizedArray()) { base->getWritableType().updateImplicitArraySize(indexValue + 1); -#ifdef NV_EXTENSIONS // For 2D per-view builtin arrays, update the inner dimension size in parent type if (base->getQualifier().isPerView() && base->getQualifier().builtIn != EbvNone) { TIntermBinary* binaryNode = base->getAsBinaryNode(); @@ -434,11 +452,12 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn arraySizes.setDimSize(1, std::max(arraySizes.getDimSize(1), indexValue + 1)); } } -#endif } else +#endif checkIndex(loc, base->getType(), indexValue); result = intermediate.addIndex(EOpIndexDirect, base, index, loc); } else { +#ifndef GLSLANG_WEB if (base->getType().isUnsizedArray()) { // we have a variable index into an unsized array, which is okay, // depending on the situation @@ -450,6 +469,7 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn } base->getWritableType().setArrayVariablyIndexed(); } +#endif if (base->getBasicType() == EbtBlock) { if (base->getQualifier().storage == EvqBuffer) requireProfile(base->getLoc(), ~EEsProfile, "variable indexing buffer block array"); @@ -457,7 +477,7 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn profileRequires(base->getLoc(), EEsProfile, 320, Num_AEP_gpu_shader5, AEP_gpu_shader5, "variable indexing uniform block array"); else { - // input/output blocks either don't exist or can be variable indexed + // input/output blocks either don't exist or can't be variably indexed } } else if (language == EShLangFragment && base->getQualifier().isPipeOutput()) requireProfile(base->getLoc(), ~EEsProfile, "variable indexing fragment shader output array"); @@ -471,8 +491,8 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn result = intermediate.addIndex(EOpIndexIndirect, base, index, loc); } - // Insert valid dereferenced result - TType newType(base->getType(), 0); // dereferenced type + // Insert valid dereferenced result type + TType newType(base->getType(), 0); if (base->getType().getQualifier().isConstant() && index->getQualifier().isConstant()) { newType.getQualifier().storage = EvqConst; // If base or index is a specialization constant, the result should also be a specialization constant. @@ -480,20 +500,27 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn newType.getQualifier().makeSpecConstant(); } } else { - newType.getQualifier().makePartialTemporary(); + newType.getQualifier().storage = EvqTemporary; + newType.getQualifier().specConstant = false; } result->setType(newType); +#ifndef GLSLANG_WEB + inheritMemoryQualifiers(base->getQualifier(), result->getWritableType().getQualifier()); + // Propagate nonuniform if (base->getQualifier().isNonUniform() || index->getQualifier().isNonUniform()) result->getWritableType().getQualifier().nonUniform = true; if (anyIndexLimits) handleIndexLimits(loc, base, index); +#endif return result; } +#ifndef GLSLANG_WEB + // for ES 2.0 (version 100) limitations for almost all index operations except vertex-shader uniforms void TParseContext::handleIndexLimits(const TSourceLoc& /*loc*/, TIntermTyped* base, TIntermTyped* index) { @@ -530,14 +557,12 @@ bool TParseContext::isIoResizeArray(const TType& type) const { return type.isArray() && ((language == EShLangGeometry && type.getQualifier().storage == EvqVaryingIn) || - (language == EShLangTessControl && type.getQualifier().storage == EvqVaryingOut && ! type.getQualifier().patch) -#ifdef NV_EXTENSIONS - || - (language == EShLangFragment && type.getQualifier().storage == EvqVaryingIn && type.getQualifier().pervertexNV) || - (language == EShLangMeshNV && type.getQualifier().storage == EvqVaryingOut && !type.getQualifier().perTaskNV) - -#endif - ); + (language == EShLangTessControl && type.getQualifier().storage == EvqVaryingOut && + ! type.getQualifier().patch) || + (language == EShLangFragment && type.getQualifier().storage == EvqVaryingIn && + type.getQualifier().pervertexNV) || + (language == EShLangMeshNV && type.getQualifier().storage == EvqVaryingOut && + !type.getQualifier().perTaskNV)); } // If an array is not isIoResizeArray() but is an io array, make sure it has the right size @@ -566,11 +591,7 @@ void TParseContext::fixIoArraySize(const TSourceLoc& loc, TType& type) void TParseContext::ioArrayCheck(const TSourceLoc& loc, const TType& type, const TString& identifier) { if (! type.isArray() && ! symbolTable.atBuiltInLevel()) { - if (type.getQualifier().isArrayedIo(language) -#ifdef NV_EXTENSIONS - && !type.getQualifier().layoutPassthrough -#endif - ) + if (type.getQualifier().isArrayedIo(language) && !type.getQualifier().layoutPassthrough) error(loc, "type must be an array:", type.getStorageQualifierString(), identifier.c_str()); } } @@ -617,12 +638,7 @@ void TParseContext::checkIoArraysConsistency(const TSourceLoc &loc, bool tailOnl // As I/O array sizes don't change, fetch requiredSize only once, // except for mesh shaders which could have different I/O array sizes based on type qualifiers. - if (firstIteration -#ifdef NV_EXTENSIONS - || (language == EShLangMeshNV) -#endif - ) - { + if (firstIteration || (language == EShLangMeshNV)) { requiredSize = getIoArrayImplicitSize(type.getQualifier(), &featureString); if (requiredSize == 0) break; @@ -647,14 +663,11 @@ int TParseContext::getIoArrayImplicitSize(const TQualifier &qualifier, TString * else if (language == EShLangTessControl) { expectedSize = maxVertices; str = "vertices"; - } -#ifdef NV_EXTENSIONS - else if (language == EShLangFragment) { + } else if (language == EShLangFragment) { // Number of vertices for Fragment shader is always three. expectedSize = 3; str = "vertices"; - } - else if (language == EShLangMeshNV) { + } else if (language == EShLangMeshNV) { unsigned int maxPrimitives = intermediate.getPrimitives() != TQualifier::layoutNotSet ? intermediate.getPrimitives() : 0; if (qualifier.builtIn == EbvPrimitiveIndicesNV) { @@ -671,7 +684,6 @@ int TParseContext::getIoArrayImplicitSize(const TQualifier &qualifier, TString * str = "max_vertices"; } } -#endif if (featureString) *featureString = str; return expectedSize; @@ -686,19 +698,19 @@ void TParseContext::checkIoArrayConsistency(const TSourceLoc& loc, int requiredS error(loc, "inconsistent input primitive for array size of", feature, name.c_str()); else if (language == EShLangTessControl) error(loc, "inconsistent output number of vertices for array size of", feature, name.c_str()); -#ifdef NV_EXTENSIONS else if (language == EShLangFragment) { if (type.getOuterArraySize() > requiredSize) error(loc, " cannot be greater than 3 for pervertexNV", feature, name.c_str()); } else if (language == EShLangMeshNV) error(loc, "inconsistent output array size of", feature, name.c_str()); -#endif else assert(0); } } +#endif // GLSLANG_WEB + // Handle seeing a binary node with a math operation. // Returns nullptr if not semantically allowed. TIntermTyped* TParseContext::handleBinaryMath(const TSourceLoc& loc, const char* str, TOperator op, TIntermTyped* left, TIntermTyped* right) @@ -721,7 +733,7 @@ TIntermTyped* TParseContext::handleBinaryMath(const TSourceLoc& loc, const char* break; } - if (((left->getType().containsBasicType(EbtFloat16) || right->getType().containsBasicType(EbtFloat16)) && !float16Arithmetic()) || + if (((left->getType().contains16BitFloat() || right->getType().contains16BitFloat()) && !float16Arithmetic()) || ((left->getType().contains16BitInt() || right->getType().contains16BitInt()) && !int16Arithmetic()) || ((left->getType().contains8BitInt() || right->getType().contains8BitInt()) && !int8Arithmetic())) { allowed = false; @@ -743,14 +755,13 @@ TIntermTyped* TParseContext::handleUnaryMath(const TSourceLoc& loc, const char* rValueErrorCheck(loc, str, childNode); bool allowed = true; - if ((childNode->getType().containsBasicType(EbtFloat16) && !float16Arithmetic()) || + if ((childNode->getType().contains16BitFloat() && !float16Arithmetic()) || (childNode->getType().contains16BitInt() && !int16Arithmetic()) || (childNode->getType().contains8BitInt() && !int8Arithmetic())) { allowed = false; } TIntermTyped* result = nullptr; - if (allowed) result = intermediate.addUnaryMath(op, childNode, loc); @@ -819,7 +830,7 @@ TIntermTyped* TParseContext::handleDotDereference(const TSourceLoc& loc, TInterm TSwizzleSelectors<TVectorSelector> selectors; parseSwizzleSelector(loc, field, base->getVectorSize(), selectors); - if (base->isVector() && selectors.size() != 1 && base->getType().containsBasicType(EbtFloat16)) + if (base->isVector() && selectors.size() != 1 && base->getType().contains16BitFloat()) requireFloat16Arithmetic(loc, ".", "can't swizzle types containing float16"); if (base->isVector() && selectors.size() != 1 && base->getType().contains16BitInt()) requireInt16Arithmetic(loc, ".", "can't swizzle types containing (u)int16"); @@ -854,12 +865,10 @@ TIntermTyped* TParseContext::handleDotDereference(const TSourceLoc& loc, TInterm if (base->getType().getQualifier().isSpecConstant()) result->getWritableType().getQualifier().makeSpecConstant(); } - } else if (base->getBasicType() == EbtStruct || - base->getBasicType() == EbtBlock || - base->getBasicType() == EbtReference) { - const TTypeList* fields = base->getBasicType() == EbtReference ? - base->getType().getReferentType()->getStruct() : - base->getType().getStruct(); + } else if (base->isStruct() || base->isReference()) { + const TTypeList* fields = base->isReference() ? + base->getType().getReferentType()->getStruct() : + base->getType().getStruct(); bool fieldFound = false; int member; for (member = 0; member < (int)fields->size(); ++member) { @@ -879,14 +888,15 @@ TIntermTyped* TParseContext::handleDotDereference(const TSourceLoc& loc, TInterm if ((*fields)[member].type->getQualifier().isIo()) intermediate.addIoAccessed(field); } + inheritMemoryQualifiers(base->getQualifier(), result->getWritableType().getQualifier()); } else error(loc, "no such field in structure", field.c_str(), ""); } else error(loc, "does not apply to this type:", field.c_str(), base->getType().getCompleteString().c_str()); // Propagate noContraction up the dereference chain - if (base->getQualifier().noContraction) - result->getWritableType().getQualifier().noContraction = true; + if (base->getQualifier().isNoContraction()) + result->getWritableType().getQualifier().setNoContraction(); // Propagate nonuniform if (base->getQualifier().isNonUniform()) @@ -1126,7 +1136,7 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction if (builtIn && fnCandidate->getNumExtensions()) requireExtensions(loc, fnCandidate->getNumExtensions(), fnCandidate->getExtensions(), fnCandidate->getName().c_str()); - if (builtIn && fnCandidate->getType().containsBasicType(EbtFloat16)) + if (builtIn && fnCandidate->getType().contains16BitFloat()) requireFloat16Arithmetic(loc, "built-in function", "float16 types can only be in uniform block or buffer storage"); if (builtIn && fnCandidate->getType().contains16BitInt()) requireInt16Arithmetic(loc, "built-in function", "(u)int16 types can only be in uniform block or buffer storage"); @@ -1146,9 +1156,11 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction if (lValueErrorCheck(arguments->getLoc(), "assign", arg->getAsTyped())) error(arguments->getLoc(), "Non-L-value cannot be passed for 'out' or 'inout' parameters.", "out", ""); } - TQualifier& argQualifier = arg->getAsTyped()->getQualifier(); - if (argQualifier.isMemory()) { + const TType& argType = arg->getAsTyped()->getType(); + const TQualifier& argQualifier = argType.getQualifier(); + if (argQualifier.isMemory() && (argType.containsOpaque() || argType.isReference())) { const char* message = "argument cannot drop memory qualifier when passed to formal parameter"; +#ifndef GLSLANG_WEB if (argQualifier.volatil && ! formalQualifier.volatil) error(arguments->getLoc(), message, "volatile", ""); if (argQualifier.coherent && ! (formalQualifier.devicecoherent || formalQualifier.coherent)) @@ -1165,18 +1177,19 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction error(arguments->getLoc(), message, "readonly", ""); if (argQualifier.writeonly && ! formalQualifier.writeonly) error(arguments->getLoc(), message, "writeonly", ""); - if (!builtIn && argQualifier.restrict && ! formalQualifier.restrict) - error(arguments->getLoc(), message, "restrict", ""); + // Don't check 'restrict', it is different than the rest: + // "...but only restrict can be taken away from a calling argument, by a formal parameter that + // lacks the restrict qualifier..." +#endif } - if (!builtIn && argQualifier.layoutFormat != formalQualifier.layoutFormat) { + if (!builtIn && argQualifier.getFormat() != formalQualifier.getFormat()) { // we have mismatched formats, which should only be allowed if writeonly // and at least one format is unknown - if (!formalQualifier.writeonly || (formalQualifier.layoutFormat != ElfNone && - argQualifier.layoutFormat != ElfNone)) + if (!formalQualifier.isWriteOnly() || (formalQualifier.getFormat() != ElfNone && + argQualifier.getFormat() != ElfNone)) error(arguments->getLoc(), "image formats must match", "format", ""); } - - if (builtIn && arg->getAsTyped()->getType().containsBasicType(EbtFloat16)) + if (builtIn && arg->getAsTyped()->getType().contains16BitFloat()) requireFloat16Arithmetic(arguments->getLoc(), "built-in function", "float16 types can only be in uniform block or buffer storage"); if (builtIn && arg->getAsTyped()->getType().contains16BitInt()) requireInt16Arithmetic(arguments->getLoc(), "built-in function", "(u)int16 types can only be in uniform block or buffer storage"); @@ -1216,9 +1229,11 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction intermediate.addToCallGraph(infoSink, currentCaller, fnCandidate->getMangledName()); } +#ifndef GLSLANG_WEB if (builtIn) nonOpBuiltInCheck(loc, *fnCandidate, *call); else +#endif userFunctionCallCheck(loc, *call); } @@ -1347,13 +1362,9 @@ void TParseContext::computeBuiltinPrecisions(TIntermTyped& node, const TFunction operationPrecision = std::max(operationPrecision, function[arg].type->getQualifier().precision); } // compute the result precision -#ifdef AMD_EXTENSIONS if (agg->isSampling() || agg->getOp() == EOpImageLoad || agg->getOp() == EOpImageStore || agg->getOp() == EOpImageLoadLod || agg->getOp() == EOpImageStoreLod) -#else - if (agg->isSampling() || agg->getOp() == EOpImageLoad || agg->getOp() == EOpImageStore) -#endif resultPrecision = sequence[0]->getAsTyped()->getQualifier().precision; else if (function.getType().getBasicType() != EbtBool) resultPrecision = function.getType().getQualifier().precision == EpqNone ? @@ -1374,7 +1385,9 @@ void TParseContext::computeBuiltinPrecisions(TIntermTyped& node, const TFunction TIntermNode* TParseContext::handleReturnValue(const TSourceLoc& loc, TIntermTyped* value) { +#ifndef GLSLANG_WEB storage16BitAssignmentCheck(loc, value->getType(), "return"); +#endif functionReturnsValue = true; if (currentFunctionType->getBasicType() == EbtVoid) { @@ -1399,6 +1412,7 @@ TIntermNode* TParseContext::handleReturnValue(const TSourceLoc& loc, TIntermType // See if the operation is being done in an illegal location. void TParseContext::checkLocation(const TSourceLoc& loc, TOperator op) { +#ifndef GLSLANG_WEB switch (op) { case EOpBarrier: if (language == EShLangTessControl) { @@ -1410,9 +1424,48 @@ void TParseContext::checkLocation(const TSourceLoc& loc, TOperator op) error(loc, "tessellation control barrier() cannot be placed after a return from main()", "", ""); } break; + case EOpBeginInvocationInterlock: + if (language != EShLangFragment) + error(loc, "beginInvocationInterlockARB() must be in a fragment shader", "", ""); + if (! inMain) + error(loc, "beginInvocationInterlockARB() must be in main()", "", ""); + else if (postEntryPointReturn) + error(loc, "beginInvocationInterlockARB() cannot be placed after a return from main()", "", ""); + if (controlFlowNestingLevel > 0) + error(loc, "beginInvocationInterlockARB() cannot be placed within flow control", "", ""); + + if (beginInvocationInterlockCount > 0) + error(loc, "beginInvocationInterlockARB() must only be called once", "", ""); + if (endInvocationInterlockCount > 0) + error(loc, "beginInvocationInterlockARB() must be called before endInvocationInterlockARB()", "", ""); + + beginInvocationInterlockCount++; + + // default to pixel_interlock_ordered + if (intermediate.getInterlockOrdering() == EioNone) + intermediate.setInterlockOrdering(EioPixelInterlockOrdered); + break; + case EOpEndInvocationInterlock: + if (language != EShLangFragment) + error(loc, "endInvocationInterlockARB() must be in a fragment shader", "", ""); + if (! inMain) + error(loc, "endInvocationInterlockARB() must be in main()", "", ""); + else if (postEntryPointReturn) + error(loc, "endInvocationInterlockARB() cannot be placed after a return from main()", "", ""); + if (controlFlowNestingLevel > 0) + error(loc, "endInvocationInterlockARB() cannot be placed within flow control", "", ""); + + if (endInvocationInterlockCount > 0) + error(loc, "endInvocationInterlockARB() must only be called once", "", ""); + if (beginInvocationInterlockCount == 0) + error(loc, "beginInvocationInterlockARB() must be called before endInvocationInterlockARB()", "", ""); + + endInvocationInterlockCount++; + break; default: break; } +#endif } // Finish processing object.length(). This started earlier in handleDotDereference(), where @@ -1430,29 +1483,28 @@ TIntermTyped* TParseContext::handleLengthMethod(const TSourceLoc& loc, TFunction const TType& type = intermNode->getAsTyped()->getType(); if (type.isArray()) { if (type.isUnsizedArray()) { +#ifndef GLSLANG_WEB if (intermNode->getAsSymbolNode() && isIoResizeArray(type)) { // We could be between a layout declaration that gives a built-in io array implicit size and // a user redeclaration of that array, meaning we have to substitute its implicit size here // without actually redeclaring the array. (It is an error to use a member before the // redeclaration, but not an error to use the array name itself.) const TString& name = intermNode->getAsSymbolNode()->getName(); - if (name == "gl_in" || name == "gl_out" -#ifdef NV_EXTENSIONS - || name == "gl_MeshVerticesNV" - || name == "gl_MeshPrimitivesNV" -#endif - ) - { + if (name == "gl_in" || name == "gl_out" || name == "gl_MeshVerticesNV" || + name == "gl_MeshPrimitivesNV") { length = getIoArrayImplicitSize(type.getQualifier()); } } +#endif if (length == 0) { +#ifndef GLSLANG_WEB if (intermNode->getAsSymbolNode() && isIoResizeArray(type)) error(loc, "", function->getName().c_str(), "array must first be sized by a redeclaration or layout qualifier"); else if (isRuntimeLength(*intermNode->getAsTyped())) { // Create a unary op and let the back end handle it return intermediate.addBuiltInFunctionCall(loc, EOpArrayLength, true, intermNode, TType(EbtInt)); } else +#endif error(loc, "", function->getName().c_str(), "array must be declared with a size before using this method"); } } else if (type.getOuterArrayNode()) { @@ -1485,6 +1537,7 @@ TIntermTyped* TParseContext::handleLengthMethod(const TSourceLoc& loc, TFunction // void TParseContext::addInputArgumentConversions(const TFunction& function, TIntermNode*& arguments) const { +#ifndef GLSLANG_WEB TIntermAggregate* aggregate = arguments->getAsAggregate(); // Process each argument's conversion @@ -1512,6 +1565,7 @@ void TParseContext::addInputArgumentConversions(const TFunction& function, TInte } } } +#endif } // @@ -1523,6 +1577,9 @@ void TParseContext::addInputArgumentConversions(const TFunction& function, TInte // TIntermTyped* TParseContext::addOutputArgumentConversions(const TFunction& function, TIntermAggregate& intermNode) const { +#ifdef GLSLANG_WEB + return &intermNode; +#else TIntermSequence& arguments = intermNode.getSequence(); // Will there be any output conversions? @@ -1590,6 +1647,7 @@ TIntermTyped* TParseContext::addOutputArgumentConversions(const TFunction& funct conversionTree = intermediate.setAggregateOperator(conversionTree, EOpComma, intermNode.getType(), intermNode.getLoc()); return conversionTree; +#endif } void TParseContext::memorySemanticsCheck(const TSourceLoc& loc, const TFunction& fnCandidate, const TIntermOperator& callNode) @@ -1602,6 +1660,7 @@ void TParseContext::memorySemanticsCheck(const TSourceLoc& loc, const TFunction& const int gl_SemanticsAcquireRelease = 0x8; const int gl_SemanticsMakeAvailable = 0x2000; const int gl_SemanticsMakeVisible = 0x4000; + const int gl_SemanticsVolatile = 0x8000; //const int gl_StorageSemanticsNone = 0x0; const int gl_StorageSemanticsBuffer = 0x40; @@ -1691,7 +1750,8 @@ void TParseContext::memorySemanticsCheck(const TSourceLoc& loc, const TFunction& gl_SemanticsRelease | gl_SemanticsAcquireRelease | gl_SemanticsMakeAvailable | - gl_SemanticsMakeVisible))) { + gl_SemanticsMakeVisible | + gl_SemanticsVolatile))) { error(loc, "Invalid semantics value", fnCandidate.getName().c_str(), ""); } if (((storageClassSemantics | storageClassSemantics2) & ~(gl_StorageSemanticsBuffer | @@ -1743,10 +1803,18 @@ void TParseContext::memorySemanticsCheck(const TSourceLoc& loc, const TFunction& error(loc, "gl_SemanticsMakeVisible requires gl_SemanticsAcquire or gl_SemanticsAcquireRelease", fnCandidate.getName().c_str(), ""); } - + if ((semantics & gl_SemanticsVolatile) && + (callNode.getOp() == EOpMemoryBarrier || callNode.getOp() == EOpBarrier)) { + error(loc, "gl_SemanticsVolatile must not be used with memoryBarrier or controlBarrier", + fnCandidate.getName().c_str(), ""); + } + if ((callNode.getOp() == EOpAtomicCompSwap || callNode.getOp() == EOpImageAtomicCompSwap) && + ((semantics ^ semantics2) & gl_SemanticsVolatile)) { + error(loc, "semEqual and semUnequal must either both include gl_SemanticsVolatile or neither", + fnCandidate.getName().c_str(), ""); + } } - // // Do additional checking of built-in function calls that is not caught // by normal semantic checks on argument type, extension tagging, etc. @@ -1774,6 +1842,7 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan TString featureString; const char* feature = nullptr; switch (callNode.getOp()) { +#ifndef GLSLANG_WEB case EOpTextureGather: case EOpTextureGatherOffset: case EOpTextureGatherOffsets: @@ -1830,7 +1899,6 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan error(loc, "must be a compile-time constant:", feature, "component argument"); } -#ifdef AMD_EXTENSIONS bool bias = false; if (callNode.getOp() == EOpTextureGather) bias = fnCandidate.getParamCount() > 3; @@ -1845,12 +1913,8 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan profileRequires(loc, ~EEsProfile, 450, nullptr, feature); requireExtensions(loc, 1, &E_GL_AMD_texture_gather_bias_lod, feature); } -#endif - break; } - -#ifdef AMD_EXTENSIONS case EOpSparseTextureGather: case EOpSparseTextureGatherOffset: case EOpSparseTextureGatherOffsets: @@ -1928,7 +1992,7 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan int arg = -1; switch (callNode.getOp()) { case EOpTextureOffset: arg = 2; break; - case EOpTextureFetchOffset: arg = (arg0->getType().getSampler().dim != EsdRect) ? 3 : 2; break; + case EOpTextureFetchOffset: arg = (arg0->getType().getSampler().isRect()) ? 2 : 3; break; case EOpTextureProjOffset: arg = 2; break; case EOpTextureLodOffset: arg = 3; break; case EOpTextureProjLodOffset: arg = 3; break; @@ -1941,7 +2005,7 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan if (arg > 0) { -#ifdef AMD_EXTENSIONS +#ifndef GLSLANG_WEB bool f16ShadowCompare = (*argp)[1]->getAsTyped()->getBasicType() == EbtFloat16 && arg0->getType().getSampler().shadow; if (f16ShadowCompare) ++arg; @@ -1961,7 +2025,7 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan break; } -#ifdef NV_EXTENSIONS +#ifndef GLSLANG_WEB case EOpTraceNV: if (!(*argp)[10]->getAsConstantUnion()) error(loc, "argument must be compile-time constant", "payload number", ""); @@ -1970,7 +2034,6 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan if (!(*argp)[1]->getAsConstantUnion()) error(loc, "argument must be compile-time constant", "callable data number", ""); break; -#endif case EOpTextureQuerySamples: case EOpImageQuerySamples: @@ -1992,12 +2055,12 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan // Make sure the image types have the correct layout() format and correct argument types const TType& imageType = arg0->getType(); if (imageType.getSampler().type == EbtInt || imageType.getSampler().type == EbtUint) { - if (imageType.getQualifier().layoutFormat != ElfR32i && imageType.getQualifier().layoutFormat != ElfR32ui) + if (imageType.getQualifier().getFormat() != ElfR32i && imageType.getQualifier().getFormat() != ElfR32ui) error(loc, "only supported on image with format r32i or r32ui", fnCandidate.getName().c_str(), ""); } else { if (fnCandidate.getName().compare(0, 19, "imageAtomicExchange") != 0) error(loc, "only supported on integer images", fnCandidate.getName().c_str(), ""); - else if (imageType.getQualifier().layoutFormat != ElfR32f && profile == EEsProfile) + else if (imageType.getQualifier().getFormat() != ElfR32f && isEsProfile()) error(loc, "only supported on image with format r32f", fnCandidate.getName().c_str(), ""); } @@ -2025,13 +2088,9 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan requireExtensions(loc, 1, &E_GL_KHR_memory_scope_semantics, fnCandidate.getName().c_str()); memorySemanticsCheck(loc, fnCandidate, callNode); } else if (arg0->getType().getBasicType() == EbtInt64 || arg0->getType().getBasicType() == EbtUint64) { -#ifdef NV_EXTENSIONS const char* const extensions[2] = { E_GL_NV_shader_atomic_int64, E_GL_EXT_shader_atomic_int64 }; requireExtensions(loc, 2, extensions, fnCandidate.getName().c_str()); -#else - requireExtensions(loc, 1, &E_GL_EXT_shader_atomic_int64, fnCandidate.getName().c_str()); -#endif } break; } @@ -2039,9 +2098,7 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan case EOpInterpolateAtCentroid: case EOpInterpolateAtSample: case EOpInterpolateAtOffset: -#ifdef AMD_EXTENSIONS case EOpInterpolateAtVertex: -#endif // Make sure the first argument is an interpolant, or an array element of an interpolant if (arg0->getType().getQualifier().storage != EvqVaryingIn) { // It might still be an array element. @@ -2051,13 +2108,12 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan // // ES and desktop 4.3 and earlier: swizzles may not be used // desktop 4.4 and later: swizzles may be used - bool swizzleOkay = (profile != EEsProfile) && (version >= 440); + bool swizzleOkay = (!isEsProfile()) && (version >= 440); const TIntermTyped* base = TIntermediate::findLValueBase(arg0, swizzleOkay); if (base == nullptr || base->getType().getQualifier().storage != EvqVaryingIn) error(loc, "first argument must be an interpolant, or interpolant-array element", fnCandidate.getName().c_str(), ""); } -#ifdef AMD_EXTENSIONS if (callNode.getOp() == EOpInterpolateAtVertex) { if (!arg0->getType().getQualifier().isExplicitInterpolation()) error(loc, "argument must be qualified as __explicitInterpAMD in", "interpolant", ""); @@ -2071,8 +2127,6 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan } } } -#endif - break; case EOpEmitStreamVertex: @@ -2103,9 +2157,12 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan break; case EOpSubgroupBroadcast: - // <id> must be an integral constant expression. - if ((*argp)[1]->getAsConstantUnion() == nullptr) - error(loc, "argument must be compile-time constant", "id", ""); + case EOpSubgroupQuadBroadcast: + if (spvVersion.spv < EShTargetSpv_1_5) { + // <id> must be an integral constant expression. + if ((*argp)[1]->getAsConstantUnion() == nullptr) + error(loc, "argument must be compile-time constant", "id", ""); + } break; case EOpBarrier: @@ -2115,6 +2172,7 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan memorySemanticsCheck(loc, fnCandidate, callNode); } break; +#endif default: break; @@ -2132,7 +2190,7 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan const TSampler& sampler = fnCandidate[0].type->getSampler(); const bool isTexture = sampler.isTexture() && !sampler.isCombined(); - const bool isBuffer = sampler.dim == EsdBuffer; + const bool isBuffer = sampler.isBuffer(); const bool isFetch = callNode.getOp() == EOpTextureFetch || callNode.getOp() == EOpTextureFetchOffset; if (isTexture && (!isBuffer || !isFetch)) @@ -2145,13 +2203,39 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan break; } - if (callNode.getOp() > EOpSubgroupGuardStart && callNode.getOp() < EOpSubgroupGuardStop) { + if (callNode.isSubgroup()) { // these require SPIR-V 1.3 if (spvVersion.spv > 0 && spvVersion.spv < EShTargetSpv_1_3) error(loc, "requires SPIR-V 1.3", "subgroup op", ""); + + // Check that if extended types are being used that the correct extensions are enabled. + if (arg0 != nullptr) { + const TType& type = arg0->getType(); + switch (type.getBasicType()) { + default: + break; + case EbtInt8: + case EbtUint8: + requireExtensions(loc, 1, &E_GL_EXT_shader_subgroup_extended_types_int8, type.getCompleteString().c_str()); + break; + case EbtInt16: + case EbtUint16: + requireExtensions(loc, 1, &E_GL_EXT_shader_subgroup_extended_types_int16, type.getCompleteString().c_str()); + break; + case EbtInt64: + case EbtUint64: + requireExtensions(loc, 1, &E_GL_EXT_shader_subgroup_extended_types_int64, type.getCompleteString().c_str()); + break; + case EbtFloat16: + requireExtensions(loc, 1, &E_GL_EXT_shader_subgroup_extended_types_float16, type.getCompleteString().c_str()); + break; + } + } } } +#ifndef GLSLANG_WEB + extern bool PureOperatorBuiltins; // Deprecated! Use PureOperatorBuiltins == true instead, in which case this @@ -2267,17 +2351,19 @@ void TParseContext::nonOpBuiltInCheck(const TSourceLoc& loc, const TFunction& fn if (fnCandidate.getName().compare(0, 11, "imageAtomic") == 0) { const TType& imageType = callNode.getSequence()[0]->getAsTyped()->getType(); if (imageType.getSampler().type == EbtInt || imageType.getSampler().type == EbtUint) { - if (imageType.getQualifier().layoutFormat != ElfR32i && imageType.getQualifier().layoutFormat != ElfR32ui) + if (imageType.getQualifier().getFormat() != ElfR32i && imageType.getQualifier().getFormat() != ElfR32ui) error(loc, "only supported on image with format r32i or r32ui", fnCandidate.getName().c_str(), ""); } else { if (fnCandidate.getName().compare(0, 19, "imageAtomicExchange") != 0) error(loc, "only supported on integer images", fnCandidate.getName().c_str(), ""); - else if (imageType.getQualifier().layoutFormat != ElfR32f && profile == EEsProfile) + else if (imageType.getQualifier().getFormat() != ElfR32f && isEsProfile()) error(loc, "only supported on image with format r32f", fnCandidate.getName().c_str(), ""); } } } +#endif + // // Do any extra checking for a user function call. // @@ -2425,6 +2511,7 @@ bool TParseContext::lValueErrorCheck(const TSourceLoc& loc, const char* op, TInt bool errorReturn = false; switch(binaryNode->getOp()) { +#ifndef GLSLANG_WEB case EOpIndexDirect: case EOpIndexIndirect: // ... tessellation control shader ... @@ -2440,10 +2527,8 @@ bool TParseContext::lValueErrorCheck(const TSourceLoc& loc, const char* op, TInt error(loc, "tessellation-control per-vertex output l-value must be indexed with gl_InvocationID", "[]", ""); } } - - break; // left node is checked by base class - case EOpIndexDirectStruct: break; // left node is checked by base class +#endif case EOpVectorSwizzle: errorReturn = lValueErrorCheck(loc, op, binaryNode->getLeft()); if (!errorReturn) { @@ -2475,8 +2560,7 @@ bool TParseContext::lValueErrorCheck(const TSourceLoc& loc, const char* op, TInt } } - if (binaryNode && binaryNode->getOp() == EOpIndexDirectStruct && - binaryNode->getLeft()->getBasicType() == EbtReference) + if (binaryNode && binaryNode->getOp() == EOpIndexDirectStruct && binaryNode->getLeft()->isReference()) return false; // Let the base class check errors @@ -2499,7 +2583,7 @@ bool TParseContext::lValueErrorCheck(const TSourceLoc& loc, const char* op, TInt case EvqFragDepth: intermediate.setDepthReplacing(); // "In addition, it is an error to statically write to gl_FragDepth in the fragment shader." - if (profile == EEsProfile && intermediate.getEarlyFragmentTests()) + if (isEsProfile() && intermediate.getEarlyFragmentTests()) message = "can't modify gl_FragDepth if using early_fragment_tests"; break; @@ -2536,12 +2620,10 @@ void TParseContext::rValueErrorCheck(const TSourceLoc& loc, const char* op, TInt // Let the base class check errors TParseContextBase::rValueErrorCheck(loc, op, node); -#ifdef AMD_EXTENSIONS TIntermSymbol* symNode = node->getAsSymbolNode(); - if (!(symNode && symNode->getQualifier().writeonly)) // base class checks - if (symNode && symNode->getQualifier().explicitInterp) + if (!(symNode && symNode->getQualifier().isWriteOnly())) // base class checks + if (symNode && symNode->getQualifier().isExplicitInterpolation()) error(loc, "can't read from explicitly-interpolated object: ", op, symNode->getName().c_str()); -#endif } // @@ -2587,14 +2669,14 @@ void TParseContext::reservedErrorCheck(const TSourceLoc& loc, const TString& ide if (builtInName(identifier)) error(loc, "identifiers starting with \"gl_\" are reserved", identifier.c_str(), ""); - // "__" are not supposed to be an error. ES 310 (and desktop) added the clarification: + // "__" are not supposed to be an error. ES 300 (and desktop) added the clarification: // "In addition, all identifiers containing two consecutive underscores (__) are // reserved; using such a name does not itself result in an error, but may result // in undefined behavior." // however, before that, ES tests required an error. if (identifier.find("__") != TString::npos) { - if (profile == EEsProfile && version <= 300) - error(loc, "identifiers containing consecutive underscores (\"__\") are reserved, and an error if version <= 300", identifier.c_str(), ""); + if (isEsProfile() && version < 300) + error(loc, "identifiers containing consecutive underscores (\"__\") are reserved, and an error if version < 300", identifier.c_str(), ""); else warn(loc, "identifiers containing consecutive underscores (\"__\") are reserved", identifier.c_str(), ""); } @@ -2606,7 +2688,7 @@ void TParseContext::reservedErrorCheck(const TSourceLoc& loc, const TString& ide // void TParseContext::reservedPpErrorCheck(const TSourceLoc& loc, const char* identifier, const char* op) { - // "__" are not supposed to be an error. ES 310 (and desktop) added the clarification: + // "__" are not supposed to be an error. ES 300 (and desktop) added the clarification: // "All macro names containing two consecutive underscores ( __ ) are reserved; // defining such a name does not itself result in an error, but may result in // undefined behavior. All macro names prefixed with "GL_" ("GL" followed by a @@ -2618,14 +2700,14 @@ void TParseContext::reservedPpErrorCheck(const TSourceLoc& loc, const char* iden else if (strncmp(identifier, "defined", 8) == 0) ppError(loc, "\"defined\" can't be (un)defined:", op, identifier); else if (strstr(identifier, "__") != 0) { - if (profile == EEsProfile && version >= 300 && + if (isEsProfile() && version >= 300 && (strcmp(identifier, "__LINE__") == 0 || strcmp(identifier, "__FILE__") == 0 || strcmp(identifier, "__VERSION__") == 0)) ppError(loc, "predefined names can't be (un)defined:", op, identifier); else { - if (profile == EEsProfile && version <= 300) - ppError(loc, "names containing consecutive underscores are reserved, and an error if version <= 300:", op, identifier); + if (isEsProfile() && version < 300) + ppError(loc, "names containing consecutive underscores are reserved, and an error if version < 300:", op, identifier); else ppWarn(loc, "names containing consecutive underscores are reserved:", op, identifier); } @@ -2639,10 +2721,14 @@ void TParseContext::reservedPpErrorCheck(const TSourceLoc& loc, const char* iden // bool TParseContext::lineContinuationCheck(const TSourceLoc& loc, bool endOfComment) { +#ifdef GLSLANG_WEB + return true; +#endif + const char* message = "line continuation"; - bool lineContinuationAllowed = (profile == EEsProfile && version >= 300) || - (profile != EEsProfile && (version >= 420 || extensionTurnedOn(E_GL_ARB_shading_language_420pack))); + bool lineContinuationAllowed = (isEsProfile() && version >= 300) || + (!isEsProfile() && (version >= 420 || extensionTurnedOn(E_GL_ARB_shading_language_420pack))); if (endOfComment) { if (lineContinuationAllowed) @@ -2691,10 +2777,27 @@ bool TParseContext::builtInName(const TString& identifier) // bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, TFunction& function, TOperator op, TType& type) { - type.shallowCopy(function.getType()); + // See if the constructor does not establish the main type, only requalifies + // it, in which case the type comes from the argument instead of from the + // constructor function. + switch (op) { +#ifndef GLSLANG_WEB + case EOpConstructNonuniform: + if (node != nullptr && node->getAsTyped() != nullptr) { + type.shallowCopy(node->getAsTyped()->getType()); + type.getQualifier().makeTemporary(); + type.getQualifier().nonUniform = true; + } + break; +#endif + default: + type.shallowCopy(function.getType()); + break; + } + // See if it's a matrix bool constructingMatrix = false; - switch(op) { + switch (op) { case EOpConstructTextureSampler: return constructorTextureSamplerError(loc, function); case EOpConstructMat2x2: @@ -2706,6 +2809,7 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T case EOpConstructMat4x2: case EOpConstructMat4x3: case EOpConstructMat4x4: +#ifndef GLSLANG_WEB case EOpConstructDMat2x2: case EOpConstructDMat2x3: case EOpConstructDMat2x4: @@ -2724,6 +2828,7 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T case EOpConstructF16Mat4x2: case EOpConstructF16Mat4x3: case EOpConstructF16Mat4x4: +#endif constructingMatrix = true; break; default: @@ -2773,20 +2878,21 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T if (function[arg].type->isFloatingDomain()) floatArgument = true; if (type.isStruct()) { - if (function[arg].type->containsBasicType(EbtFloat16)) { + if (function[arg].type->contains16BitFloat()) { requireFloat16Arithmetic(loc, "constructor", "can't construct structure containing 16-bit type"); } - if (function[arg].type->containsBasicType(EbtUint16) || - function[arg].type->containsBasicType(EbtInt16)) { + if (function[arg].type->contains16BitInt()) { requireInt16Arithmetic(loc, "constructor", "can't construct structure containing 16-bit type"); } - if (function[arg].type->containsBasicType(EbtUint8) || - function[arg].type->containsBasicType(EbtInt8)) { + if (function[arg].type->contains8BitInt()) { requireInt8Arithmetic(loc, "constructor", "can't construct structure containing 8-bit type"); } } } + if (op == EOpConstructNonuniform) + constType = false; +#ifndef GLSLANG_WEB switch (op) { case EOpConstructFloat16: case EOpConstructF16Vec2: @@ -2826,6 +2932,7 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T default: break; } +#endif // inherit constness from children if (constType) { @@ -2834,17 +2941,24 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T if (specConstType) { switch (op) { case EOpConstructInt8: - case EOpConstructUint8: - case EOpConstructInt16: - case EOpConstructUint16: case EOpConstructInt: case EOpConstructUint: - case EOpConstructInt64: - case EOpConstructUint64: case EOpConstructBool: case EOpConstructBVec2: case EOpConstructBVec3: case EOpConstructBVec4: + case EOpConstructIVec2: + case EOpConstructIVec3: + case EOpConstructIVec4: + case EOpConstructUVec2: + case EOpConstructUVec3: + case EOpConstructUVec4: +#ifndef GLSLANG_WEB + case EOpConstructUint8: + case EOpConstructInt16: + case EOpConstructUint16: + case EOpConstructInt64: + case EOpConstructUint64: case EOpConstructI8Vec2: case EOpConstructI8Vec3: case EOpConstructI8Vec4: @@ -2857,18 +2971,13 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T case EOpConstructU16Vec2: case EOpConstructU16Vec3: case EOpConstructU16Vec4: - case EOpConstructIVec2: - case EOpConstructIVec3: - case EOpConstructIVec4: - case EOpConstructUVec2: - case EOpConstructUVec3: - case EOpConstructUVec4: case EOpConstructI64Vec2: case EOpConstructI64Vec3: case EOpConstructI64Vec4: case EOpConstructU64Vec2: case EOpConstructU64Vec3: case EOpConstructU64Vec4: +#endif // This was the list of valid ones, if they aren't converting from float // and aren't making an array. makeSpecConst = ! floatArgument && ! type.isArray(); @@ -2978,7 +3087,7 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T error(loc, "cannot convert a sampler", "constructor", ""); return true; } - if (op != EOpConstructStruct && typed->getBasicType() == EbtAtomicUint) { + if (op != EOpConstructStruct && typed->isAtomic()) { error(loc, "cannot convert an atomic_uint", "constructor", ""); return true; } @@ -3024,7 +3133,7 @@ bool TParseContext::constructorTextureSamplerError(const TSourceLoc& loc, const } // simulate the first argument's impact on the result type, so it can be compared with the encapsulated operator!=() TSampler texture = function.getType().getSampler(); - texture.combined = false; + texture.setCombined(false); texture.shadow = false; if (texture != function[0].type->getSampler()) { error(loc, "sampler-constructor first argument must match type and dimensionality of constructor type", token, ""); @@ -3076,14 +3185,14 @@ void TParseContext::samplerCheck(const TSourceLoc& loc, const TType& type, const { // Check that the appropriate extension is enabled if external sampler is used. // There are two extensions. The correct one must be used based on GLSL version. - if (type.getBasicType() == EbtSampler && type.getSampler().external) { + if (type.getBasicType() == EbtSampler && type.getSampler().isExternal()) { if (version < 300) { requireExtensions(loc, 1, &E_GL_OES_EGL_image_external, "samplerExternalOES"); } else { requireExtensions(loc, 1, &E_GL_OES_EGL_image_external_essl3, "samplerExternalOES"); } } - if (type.getSampler().yuv) { + if (type.getSampler().isYuv()) { requireExtensions(loc, 1, &E_GL_EXT_YUV_target, "__samplerExternal2DY2YEXT"); } @@ -3100,6 +3209,8 @@ void TParseContext::samplerCheck(const TSourceLoc& loc, const TType& type, const } } +#ifndef GLSLANG_WEB + void TParseContext::atomicUintCheck(const TSourceLoc& loc, const TType& type, const TString& identifier) { if (type.getQualifier().storage == EvqUniform) @@ -3110,7 +3221,7 @@ void TParseContext::atomicUintCheck(const TSourceLoc& loc, const TType& type, co else if (type.getBasicType() == EbtAtomicUint && type.getQualifier().storage != EvqUniform) error(loc, "atomic_uints can only be used in uniform variables or function parameters:", type.getBasicTypeString().c_str(), identifier.c_str()); } -#ifdef NV_EXTENSIONS + void TParseContext::accStructNVCheck(const TSourceLoc& loc, const TType& type, const TString& identifier) { if (type.getQualifier().storage == EvqUniform) @@ -3123,7 +3234,8 @@ void TParseContext::accStructNVCheck(const TSourceLoc& loc, const TType& type, c type.getBasicTypeString().c_str(), identifier.c_str()); } -#endif + +#endif // GLSLANG_WEB void TParseContext::transparentOpaqueCheck(const TSourceLoc& loc, const TType& type, const TString& identifier) { @@ -3188,7 +3300,7 @@ void TParseContext::globalQualifierFixCheck(const TSourceLoc& loc, TQualifier& q break; } - if (!nonuniformOkay && qualifier.nonUniform) + if (!nonuniformOkay && qualifier.isNonUniform()) error(loc, "for non-parameter, can only apply to 'in' or no storage qualifier", "nonuniformEXT", ""); invariantCheck(loc, qualifier); @@ -3202,7 +3314,7 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali if (! symbolTable.atGlobalLevel()) return; - if (!(publicType.userDef && publicType.userDef->getBasicType() == EbtReference)) { + if (!(publicType.userDef && publicType.userDef->isReference())) { if (qualifier.isMemoryQualifierImageAndSSBOOnly() && ! publicType.isImage() && publicType.qualifier.storage != EvqBuffer) { error(loc, "memory qualifiers cannot be used on this type", "", ""); } else if (qualifier.isMemory() && (publicType.basicType != EbtSampler) && !publicType.qualifier.isUniformOrBuffer()) { @@ -3212,13 +3324,13 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali if (qualifier.storage == EvqBuffer && publicType.basicType != EbtBlock && - !qualifier.layoutBufferReference) + !qualifier.hasBufferReference()) error(loc, "buffers can be declared only as blocks", "buffer", ""); if (qualifier.storage != EvqVaryingIn && qualifier.storage != EvqVaryingOut) return; - if (publicType.shaderQualifiers.blendEquation) + if (publicType.shaderQualifiers.hasBlendEquation()) error(loc, "can only be applied to a standalone 'out'", "blend equation", ""); // now, knowing it is a shader in/out, do all the in/out semantic checks @@ -3231,25 +3343,15 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali if (isTypeInt(publicType.basicType) || publicType.basicType == EbtDouble) profileRequires(loc, EEsProfile, 300, nullptr, "shader input/output"); - if (!qualifier.flat -#ifdef AMD_EXTENSIONS - && !qualifier.explicitInterp -#endif -#ifdef NV_EXTENSIONS - && !qualifier.pervertexNV -#endif - ) { + if (!qualifier.flat && !qualifier.isExplicitInterpolation() && !qualifier.isPervertexNV()) { if (isTypeInt(publicType.basicType) || publicType.basicType == EbtDouble || - (publicType.userDef && (publicType.userDef->containsBasicType(EbtInt8) || - publicType.userDef->containsBasicType(EbtUint8) || - publicType.userDef->containsBasicType(EbtInt16) || - publicType.userDef->containsBasicType(EbtUint16) || - publicType.userDef->containsBasicType(EbtInt) || - publicType.userDef->containsBasicType(EbtUint) || - publicType.userDef->containsBasicType(EbtInt64) || - publicType.userDef->containsBasicType(EbtUint64) || - publicType.userDef->containsBasicType(EbtDouble)))) { + (publicType.userDef && ( publicType.userDef->containsBasicType(EbtInt) + || publicType.userDef->containsBasicType(EbtUint) + || publicType.userDef->contains16BitInt() + || publicType.userDef->contains8BitInt() + || publicType.userDef->contains64BitInt() + || publicType.userDef->containsDouble()))) { if (qualifier.storage == EvqVaryingIn && language == EShLangFragment) error(loc, "must be qualified as flat", TType::getBasicString(publicType.basicType), GetStorageQualifierString(qualifier.storage)); else if (qualifier.storage == EvqVaryingOut && language == EShLangVertex && version == 300) @@ -3257,13 +3359,11 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali } } - if (qualifier.patch && qualifier.isInterpolation()) + if (qualifier.isPatch() && qualifier.isInterpolation()) error(loc, "cannot use interpolation qualifiers with patch", "patch", ""); -#ifdef NV_EXTENSIONS - if (qualifier.perTaskNV && publicType.basicType != EbtBlock) + if (qualifier.isTaskMemory() && publicType.basicType != EbtBlock) error(loc, "taskNV variables can be declared only as blocks", "taskNV", ""); -#endif if (qualifier.storage == EvqVaryingIn) { switch (language) { @@ -3281,18 +3381,6 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali if (qualifier.isAuxiliary() || qualifier.isInterpolation() || qualifier.isMemory() || qualifier.invariant) error(loc, "vertex input cannot be further qualified", "", ""); break; - - case EShLangTessControl: - if (qualifier.patch) - error(loc, "can only use on output in tessellation-control shader", "patch", ""); - break; - - case EShLangTessEvaluation: - break; - - case EShLangGeometry: - break; - case EShLangFragment: if (publicType.userDef) { profileRequires(loc, EEsProfile, 300, nullptr, "fragment-shader struct input"); @@ -3303,12 +3391,16 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali requireProfile(loc, ~EEsProfile, "fragment-shader struct input containing an array"); } break; - - case EShLangCompute: + case EShLangCompute: if (! symbolTable.atBuiltInLevel()) error(loc, "global storage input qualifier cannot be used in a compute shader", "in", ""); break; - +#ifndef GLSLANG_WEB + case EShLangTessControl: + if (qualifier.patch) + error(loc, "can only use on output in tessellation-control shader", "patch", ""); + break; +#endif default: break; } @@ -3326,18 +3418,6 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali } break; - - case EShLangTessControl: - break; - - case EShLangTessEvaluation: - if (qualifier.patch) - error(loc, "can only use on input in tessellation-evaluation shader", "patch", ""); - break; - - case EShLangGeometry: - break; - case EShLangFragment: profileRequires(loc, EEsProfile, 300, nullptr, "fragment shader output"); if (publicType.basicType == EbtStruct) { @@ -3359,7 +3439,12 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali case EShLangCompute: error(loc, "global storage output qualifier cannot be used in a compute shader", "out", ""); break; - +#ifndef GLSLANG_WEB + case EShLangTessEvaluation: + if (qualifier.patch) + error(loc, "can only use on input in tessellation-evaluation shader", "patch", ""); + break; +#endif default: break; } @@ -3383,18 +3468,14 @@ void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, cons // Multiple interpolation qualifiers (mostly done later by 'individual qualifiers') if (src.isInterpolation() && dst.isInterpolation()) -#ifdef AMD_EXTENSIONS error(loc, "can only have one interpolation qualifier (flat, smooth, noperspective, __explicitInterpAMD)", "", ""); -#else - error(loc, "can only have one interpolation qualifier (flat, smooth, noperspective)", "", ""); -#endif // Ordering - if (! force && ((profile != EEsProfile && version < 420) || - (profile == EEsProfile && version < 310)) + if (! force && ((!isEsProfile() && version < 420) || + (isEsProfile() && version < 310)) && ! extensionTurnedOn(E_GL_ARB_shading_language_420pack)) { // non-function parameters - if (src.noContraction && (dst.invariant || dst.isInterpolation() || dst.isAuxiliary() || dst.storage != EvqTemporary || dst.precision != EpqNone)) + if (src.isNoContraction() && (dst.invariant || dst.isInterpolation() || dst.isAuxiliary() || dst.storage != EvqTemporary || dst.precision != EpqNone)) error(loc, "precise qualifier must appear first", "", ""); if (src.invariant && (dst.isInterpolation() || dst.isAuxiliary() || dst.storage != EvqTemporary || dst.precision != EpqNone)) error(loc, "invariant qualifier must appear before interpolation, storage, and precision qualifiers ", "", ""); @@ -3406,7 +3487,7 @@ void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, cons error(loc, "precision qualifier must appear as last qualifier", "", ""); // function parameters - if (src.noContraction && (dst.storage == EvqConst || dst.storage == EvqIn || dst.storage == EvqOut)) + if (src.isNoContraction() && (dst.storage == EvqConst || dst.storage == EvqIn || dst.storage == EvqOut)) error(loc, "precise qualifier must appear first", "", ""); if (src.storage == EvqConst && (dst.storage == EvqIn || dst.storage == EvqOut)) error(loc, "in/out must appear before const", "", ""); @@ -3431,6 +3512,7 @@ void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, cons if (dst.precision == EpqNone || (force && src.precision != EpqNone)) dst.precision = src.precision; +#ifndef GLSLANG_WEB if (!force && ((src.coherent && (dst.devicecoherent || dst.queuefamilycoherent || dst.workgroupcoherent || dst.subgroupcoherent)) || (src.devicecoherent && (dst.coherent || dst.queuefamilycoherent || dst.workgroupcoherent || dst.subgroupcoherent)) || (src.queuefamilycoherent && (dst.coherent || dst.devicecoherent || dst.workgroupcoherent || dst.subgroupcoherent)) || @@ -3438,6 +3520,7 @@ void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, cons (src.subgroupcoherent && (dst.coherent || dst.devicecoherent || dst.queuefamilycoherent || dst.workgroupcoherent)))) { error(loc, "only one coherent/devicecoherent/queuefamilycoherent/workgroupcoherent/subgroupcoherent qualifier allowed", GetPrecisionQualifierString(src.precision), ""); } +#endif // Layout qualifiers mergeObjectLayoutQualifiers(dst, src, false); @@ -3445,19 +3528,17 @@ void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, cons bool repeated = false; #define MERGE_SINGLETON(field) repeated |= dst.field && src.field; dst.field |= src.field; MERGE_SINGLETON(invariant); - MERGE_SINGLETON(noContraction); MERGE_SINGLETON(centroid); MERGE_SINGLETON(smooth); MERGE_SINGLETON(flat); + MERGE_SINGLETON(specConstant); +#ifndef GLSLANG_WEB + MERGE_SINGLETON(noContraction); MERGE_SINGLETON(nopersp); -#ifdef AMD_EXTENSIONS MERGE_SINGLETON(explicitInterp); -#endif -#ifdef NV_EXTENSIONS MERGE_SINGLETON(perPrimitiveNV); MERGE_SINGLETON(perViewNV); MERGE_SINGLETON(perTaskNV); -#endif MERGE_SINGLETON(patch); MERGE_SINGLETON(sample); MERGE_SINGLETON(coherent); @@ -3470,8 +3551,8 @@ void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, cons MERGE_SINGLETON(restrict); MERGE_SINGLETON(readonly); MERGE_SINGLETON(writeonly); - MERGE_SINGLETON(specConstant); MERGE_SINGLETON(nonUniform); +#endif if (repeated) error(loc, "replicated qualifiers", "", ""); @@ -3514,11 +3595,11 @@ void TParseContext::setDefaultPrecision(const TSourceLoc& loc, TPublicType& publ // correlates with the declaration of defaultSamplerPrecision[] int TParseContext::computeSamplerTypeIndex(TSampler& sampler) { - int arrayIndex = sampler.arrayed ? 1 : 0; - int shadowIndex = sampler.shadow ? 1 : 0; - int externalIndex = sampler.external? 1 : 0; - int imageIndex = sampler.image ? 1 : 0; - int msIndex = sampler.ms ? 1 : 0; + int arrayIndex = sampler.arrayed ? 1 : 0; + int shadowIndex = sampler.shadow ? 1 : 0; + int externalIndex = sampler.isExternal() ? 1 : 0; + int imageIndex = sampler.isImageClass() ? 1 : 0; + int msIndex = sampler.isMultiSample() ? 1 : 0; int flattened = EsdNumDims * (EbtNumTypes * (2 * (2 * (2 * (2 * arrayIndex + msIndex) + imageIndex) + shadowIndex) + externalIndex) + sampler.type) + sampler.dim; @@ -3542,8 +3623,10 @@ void TParseContext::precisionQualifierCheck(const TSourceLoc& loc, TBasicType ba if (! obeyPrecisionQualifiers() || parsingBuiltins) return; +#ifndef GLSLANG_WEB if (baseType == EbtAtomicUint && qualifier.precision != EpqNone && qualifier.precision != EpqHigh) error(loc, "atomic counters can only be highp", "atomic_uint", ""); +#endif if (baseType == EbtFloat || baseType == EbtUint || baseType == EbtInt || baseType == EbtSampler || baseType == EbtAtomicUint) { if (qualifier.precision == EpqNone) { @@ -3562,8 +3645,7 @@ void TParseContext::parameterTypeCheck(const TSourceLoc& loc, TStorageQualifier { if ((qualifier == EvqOut || qualifier == EvqInOut) && type.isOpaque()) error(loc, "samplers and atomic_uints cannot be output parameters", type.getBasicTypeString().c_str(), ""); - - if (!parsingBuiltins && type.containsBasicType(EbtFloat16)) + if (!parsingBuiltins && type.contains16BitFloat()) requireFloat16Arithmetic(loc, type.getBasicTypeString().c_str(), "float16 types can only be in uniform block or buffer storage"); if (!parsingBuiltins && type.contains16BitInt()) requireInt16Arithmetic(loc, type.getBasicTypeString().c_str(), "(u)int16 types can only be in uniform block or buffer storage"); @@ -3726,51 +3808,53 @@ void TParseContext::arraySizesCheck(const TSourceLoc& loc, const TQualifier& qua (qualifier.storage != EvqTemporary && qualifier.storage != EvqGlobal && qualifier.storage != EvqShared && qualifier.storage != EvqConst)) error(loc, "only outermost dimension of an array of arrays can be a specialization constant", "[]", ""); +#ifndef GLSLANG_WEB + // desktop always allows outer-dimension-unsized variable arrays, - if (profile != EEsProfile) + if (!isEsProfile()) return; // for ES, if size isn't coming from an initializer, it has to be explicitly declared now, // with very few exceptions - // last member of ssbo block exception: - if (qualifier.storage == EvqBuffer && lastMember) - return; - // implicitly-sized io exceptions: switch (language) { case EShLangGeometry: if (qualifier.storage == EvqVaryingIn) - if ((profile == EEsProfile && version >= 320) || + if ((isEsProfile() && version >= 320) || extensionsTurnedOn(Num_AEP_geometry_shader, AEP_geometry_shader)) return; break; case EShLangTessControl: if ( qualifier.storage == EvqVaryingIn || - (qualifier.storage == EvqVaryingOut && ! qualifier.patch)) - if ((profile == EEsProfile && version >= 320) || + (qualifier.storage == EvqVaryingOut && ! qualifier.isPatch())) + if ((isEsProfile() && version >= 320) || extensionsTurnedOn(Num_AEP_tessellation_shader, AEP_tessellation_shader)) return; break; case EShLangTessEvaluation: - if ((qualifier.storage == EvqVaryingIn && ! qualifier.patch) || + if ((qualifier.storage == EvqVaryingIn && ! qualifier.isPatch()) || qualifier.storage == EvqVaryingOut) - if ((profile == EEsProfile && version >= 320) || + if ((isEsProfile() && version >= 320) || extensionsTurnedOn(Num_AEP_tessellation_shader, AEP_tessellation_shader)) return; break; -#ifdef NV_EXTENSIONS case EShLangMeshNV: if (qualifier.storage == EvqVaryingOut) - if ((profile == EEsProfile && version >= 320) || + if ((isEsProfile() && version >= 320) || extensionTurnedOn(E_GL_NV_mesh_shader)) return; break; -#endif default: break; } +#endif + + // last member of ssbo block exception: + if (qualifier.storage == EvqBuffer && lastMember) + return; + arraySizeRequiredCheck(loc, *arraySizes); } @@ -3811,6 +3895,7 @@ void TParseContext::declareArray(const TSourceLoc& loc, const TString& identifie if (symbolTable.atGlobalLevel()) trackLinkage(*symbol); +#ifndef GLSLANG_WEB if (! symbolTable.atBuiltInLevel()) { if (isIoResizeArray(type)) { ioArraySymbolResizeList.push_back(symbol); @@ -3818,6 +3903,7 @@ void TParseContext::declareArray(const TSourceLoc& loc, const TString& identifie } else fixIoArraySize(loc, symbol->getWritableType()); } +#endif return; } @@ -3855,6 +3941,7 @@ void TParseContext::declareArray(const TSourceLoc& loc, const TString& identifie return; } +#ifndef GLSLANG_WEB if (existingType.isSizedArray()) { // be more leniant for input arrays to geometry shaders and tessellation control outputs, where the redeclaration is the same size if (! (isIoResizeArray(type) && existingType.getOuterArraySize() == type.getOuterArraySize())) @@ -3868,8 +3955,11 @@ void TParseContext::declareArray(const TSourceLoc& loc, const TString& identifie if (isIoResizeArray(type)) checkIoArraysConsistency(loc); +#endif } +#ifndef GLSLANG_WEB + // Policy and error check for needing a runtime sized array. void TParseContext::checkRuntimeSizable(const TSourceLoc& loc, const TIntermTyped& base) { @@ -3883,7 +3973,7 @@ void TParseContext::checkRuntimeSizable(const TSourceLoc& loc, const TIntermType const TIntermBinary* binary = base.getAsBinaryNode(); if (binary != nullptr && binary->getOp() == EOpIndexDirectStruct && - binary->getLeft()->getBasicType() == EbtReference) { + binary->getLeft()->isReference()) { const int index = binary->getRight()->getAsConstantUnion()->getConstArray()[0].getIConst(); const int memberCount = (int)binary->getLeft()->getType().getReferentType()->getStruct()->size(); @@ -3893,8 +3983,8 @@ void TParseContext::checkRuntimeSizable(const TSourceLoc& loc, const TIntermType } // check for additional things allowed by GL_EXT_nonuniform_qualifier - if (base.getBasicType() == EbtSampler || - (base.getBasicType() == EbtBlock && base.getType().getQualifier().isUniformOrBuffer())) + if (base.getBasicType() == EbtSampler || base.getBasicType() == EbtAccStructNV || + (base.getBasicType() == EbtBlock && base.getType().getQualifier().isUniformOrBuffer())) requireExtensions(loc, 1, &E_GL_EXT_nonuniform_qualifier, "variable index"); else error(loc, "", "[", "array must be redeclared with a size before being indexed with a variable"); @@ -3910,7 +4000,7 @@ bool TParseContext::isRuntimeLength(const TIntermTyped& base) const // is it the last member? const int index = binary->getRight()->getAsConstantUnion()->getConstArray()[0].getIConst(); - if (binary->getLeft()->getBasicType() == EbtReference) + if (binary->getLeft()->isReference()) return false; const int memberCount = (int)binary->getLeft()->getType().getStruct()->size(); @@ -3922,27 +4012,34 @@ bool TParseContext::isRuntimeLength(const TIntermTyped& base) const return false; } -#ifdef NV_EXTENSIONS -// Fix mesh view output array dimension -void TParseContext::resizeMeshViewDimension(const TSourceLoc& loc, TType& type) +// Check if mesh perviewNV attributes have a view dimension +// and resize it to gl_MaxMeshViewCountNV when implicitly sized. +void TParseContext::checkAndResizeMeshViewDim(const TSourceLoc& loc, TType& type, bool isBlockMember) { // see if member is a per-view attribute - if (type.getQualifier().isPerView()) { - // since we don't have the maxMeshViewCountNV set during parsing builtins, we hardcode the value + if (!type.getQualifier().isPerView()) + return; + + if ((isBlockMember && type.isArray()) || (!isBlockMember && type.isArrayOfArrays())) { + // since we don't have the maxMeshViewCountNV set during parsing builtins, we hardcode the value. int maxViewCount = parsingBuiltins ? 4 : resources.maxMeshViewCountNV; + // For block members, outermost array dimension is the view dimension. + // For non-block members, outermost array dimension is the vertex/primitive dimension + // and 2nd outermost is the view dimension. + int viewDim = isBlockMember ? 0 : 1; + int viewDimSize = type.getArraySizes()->getDimSize(viewDim); - if (! type.isArray()) { - error(loc, "requires an view array dimension", "perviewNV", ""); - } - else if (!type.isUnsizedArray() && type.getOuterArraySize() != maxViewCount) { + if (viewDimSize != UnsizedArraySize && viewDimSize != maxViewCount) error(loc, "mesh view output array size must be gl_MaxMeshViewCountNV or implicitly sized", "[]", ""); - } - else if (type.isUnsizedArray()) { - type.changeOuterArraySize(maxViewCount); - } + else if (viewDimSize == UnsizedArraySize) + type.getArraySizes()->setDimSize(viewDim, maxViewCount); + } + else { + error(loc, "requires a view array dimension", "perviewNV", ""); } } -#endif + +#endif // GLSLANG_WEB // Returns true if the first argument to the #line directive is the line number for the next line. // @@ -3955,7 +4052,7 @@ void TParseContext::resizeMeshViewDimension(const TSourceLoc& loc, TType& type) // source string number source-string-number. bool TParseContext::lineDirectiveShouldSetNextLine() const { - return profile == EEsProfile || version >= 330; + return isEsProfile() || version >= 330; } // @@ -3986,18 +4083,19 @@ void TParseContext::nonInitConstCheck(const TSourceLoc& loc, TString& identifier TSymbol* TParseContext::redeclareBuiltinVariable(const TSourceLoc& loc, const TString& identifier, const TQualifier& qualifier, const TShaderQualifiers& publicType) { +#ifndef GLSLANG_WEB if (! builtInName(identifier) || symbolTable.atBuiltInLevel() || ! symbolTable.atGlobalLevel()) return nullptr; - bool nonEsRedecls = (profile != EEsProfile && (version >= 130 || identifier == "gl_TexCoord")); - bool esRedecls = (profile == EEsProfile && + bool nonEsRedecls = (!isEsProfile() && (version >= 130 || identifier == "gl_TexCoord")); + bool esRedecls = (isEsProfile() && (version >= 320 || extensionsTurnedOn(Num_AEP_shader_io_blocks, AEP_shader_io_blocks))); if (! esRedecls && ! nonEsRedecls) return nullptr; // Special case when using GL_ARB_separate_shader_objects bool ssoPre150 = false; // means the only reason this variable is redeclared is due to this combination - if (profile != EEsProfile && version <= 140 && extensionTurnedOn(E_GL_ARB_separate_shader_objects)) { + if (!isEsProfile() && version <= 140 && extensionTurnedOn(E_GL_ARB_separate_shader_objects)) { if (identifier == "gl_Position" || identifier == "gl_PointSize" || identifier == "gl_ClipVertex" || @@ -4020,11 +4118,9 @@ TSymbol* TParseContext::redeclareBuiltinVariable(const TSourceLoc& loc, const TS (identifier == "gl_Color" && language == EShLangFragment) || (identifier == "gl_FragStencilRefARB" && (nonEsRedecls && version >= 140) && language == EShLangFragment) || -#ifdef NV_EXTENSIONS identifier == "gl_SampleMask" || identifier == "gl_Layer" || identifier == "gl_PrimitiveIndicesNV" || -#endif identifier == "gl_TexCoord") { // Find the existing symbol, if any. @@ -4104,16 +4200,13 @@ TSymbol* TParseContext::redeclareBuiltinVariable(const TSourceLoc& loc, const TS } } else if ( -#ifdef NV_EXTENSIONS identifier == "gl_PrimitiveIndicesNV" || -#endif identifier == "gl_FragStencilRefARB") { if (qualifier.hasLayout()) error(loc, "cannot apply layout qualifier to", "redeclaration", symbol->getName().c_str()); if (qualifier.storage != EvqVaryingOut) error(loc, "cannot change output storage qualification of", "redeclaration", symbol->getName().c_str()); } -#ifdef NV_EXTENSIONS else if (identifier == "gl_SampleMask") { if (!publicType.layoutOverrideCoverage) { error(loc, "redeclaration only allowed for override_coverage layout", "redeclaration", symbol->getName().c_str()); @@ -4126,12 +4219,12 @@ TSymbol* TParseContext::redeclareBuiltinVariable(const TSourceLoc& loc, const TS symbolQualifier.layoutViewportRelative = qualifier.layoutViewportRelative; symbolQualifier.layoutSecondaryViewportRelativeOffset = qualifier.layoutSecondaryViewportRelativeOffset; } -#endif // TODO: semantics quality: separate smooth from nothing declared, then use IsInterpolation for several tests above return symbol; } +#endif return nullptr; } @@ -4143,16 +4236,13 @@ TSymbol* TParseContext::redeclareBuiltinVariable(const TSourceLoc& loc, const TS void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newTypeList, const TString& blockName, const TString* instanceName, TArraySizes* arraySizes) { +#ifndef GLSLANG_WEB const char* feature = "built-in block redeclaration"; profileRequires(loc, EEsProfile, 320, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, feature); profileRequires(loc, ~EEsProfile, 410, E_GL_ARB_separate_shader_objects, feature); - if (blockName != "gl_PerVertex" && blockName != "gl_PerFragment" -#ifdef NV_EXTENSIONS - && blockName != "gl_MeshPerVertexNV" && blockName != "gl_MeshPerPrimitiveNV" -#endif - ) - { + if (blockName != "gl_PerVertex" && blockName != "gl_PerFragment" && + blockName != "gl_MeshPerVertexNV" && blockName != "gl_MeshPerPrimitiveNV") { error(loc, "cannot redeclare block: ", "block declaration", blockName.c_str()); return; } @@ -4211,7 +4301,6 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT TType& type = block->getWritableType(); -#ifdef NV_EXTENSIONS // if gl_PerVertex is redeclared for the purpose of passing through "gl_Position" // for passthrough purpose, the redeclared block should have the same qualifers as // the current one @@ -4221,7 +4310,6 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT type.getQualifier().layoutStream = currentBlockQualifier.layoutStream; type.getQualifier().layoutXfbBuffer = currentBlockQualifier.layoutXfbBuffer; } -#endif TTypeList::iterator member = type.getWritableStruct()->begin(); size_t numOriginalMembersFound = 0; @@ -4254,7 +4342,6 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT error(memberLoc, "cannot change array size of redeclared block member", member->type->getFieldName().c_str(), ""); else if (! oldType.getQualifier().isPerView() && newType.isArray()) arrayLimitCheck(loc, member->type->getFieldName(), newType.getOuterArraySize()); -#ifdef NV_EXTENSIONS if (oldType.getQualifier().isPerView() && ! newType.getQualifier().isPerView()) error(memberLoc, "missing perviewNV qualifier to redeclared block member", member->type->getFieldName().c_str(), ""); else if (! oldType.getQualifier().isPerView() && newType.getQualifier().isPerView()) @@ -4274,7 +4361,6 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT error(memberLoc, "missing perprimitiveNV qualifier to redeclared block member", member->type->getFieldName().c_str(), ""); else if (! oldType.getQualifier().isPerPrimitive() && newType.getQualifier().isPerPrimitive()) error(memberLoc, "cannot add perprimitiveNV qualifier to redeclared block member", member->type->getFieldName().c_str(), ""); -#endif if (newType.getQualifier().isMemory()) error(memberLoc, "cannot add memory qualifier to redeclared block member", member->type->getFieldName().c_str(), ""); if (newType.getQualifier().hasNonXfbLayout()) @@ -4365,6 +4451,7 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT // Save it in the AST for linker use. trackLinkage(*block); +#endif // GLSLANG_WEB } void TParseContext::paramCheckFixStorage(const TSourceLoc& loc, const TStorageQualifier& qualifier, TType& type) @@ -4392,6 +4479,7 @@ void TParseContext::paramCheckFixStorage(const TSourceLoc& loc, const TStorageQu void TParseContext::paramCheckFix(const TSourceLoc& loc, const TQualifier& qualifier, TType& type) { +#ifndef GLSLANG_WEB if (qualifier.isMemory()) { type.getQualifier().volatil = qualifier.volatil; type.getQualifier().coherent = qualifier.coherent; @@ -4404,6 +4492,7 @@ void TParseContext::paramCheckFix(const TSourceLoc& loc, const TQualifier& quali type.getQualifier().writeonly = qualifier.writeonly; type.getQualifier().restrict = qualifier.restrict; } +#endif if (qualifier.isAuxiliary() || qualifier.isInterpolation()) @@ -4412,9 +4501,9 @@ void TParseContext::paramCheckFix(const TSourceLoc& loc, const TQualifier& quali error(loc, "cannot use layout qualifiers on a function parameter", "", ""); if (qualifier.invariant) error(loc, "cannot use invariant qualifier on a function parameter", "", ""); - if (qualifier.noContraction) { + if (qualifier.isNoContraction()) { if (qualifier.isParamOutput()) - type.getQualifier().noContraction = true; + type.getQualifier().setNoContraction(); else warn(loc, "qualifier has no effect on non-output parameters", "precise", ""); } @@ -4455,12 +4544,15 @@ void TParseContext::opaqueCheck(const TSourceLoc& loc, const TType& type, const void TParseContext::referenceCheck(const TSourceLoc& loc, const TType& type, const char* op) { +#ifndef GLSLANG_WEB if (containsFieldWithBasicType(type, EbtReference)) error(loc, "can't use with reference types", op, ""); +#endif } void TParseContext::storage16BitAssignmentCheck(const TSourceLoc& loc, const TType& type, const char* op) { +#ifndef GLSLANG_WEB if (type.getBasicType() == EbtStruct && containsFieldWithBasicType(type, EbtFloat16)) requireFloat16Arithmetic(loc, op, "can't use with structs containing float16"); @@ -4490,6 +4582,7 @@ void TParseContext::storage16BitAssignmentCheck(const TSourceLoc& loc, const TTy if (type.isArray() && type.getBasicType() == EbtUint8) requireInt8Arithmetic(loc, op, "can't use with arrays containing uint8"); +#endif } void TParseContext::specializationCheck(const TSourceLoc& loc, const TType& type, const char* op) @@ -4541,6 +4634,7 @@ void TParseContext::structTypeCheck(const TSourceLoc& /*loc*/, TPublicType& publ // void TParseContext::inductiveLoopCheck(const TSourceLoc& loc, TIntermNode* init, TIntermLoop* loop) { +#ifndef GLSLANG_WEB // loop index init must exist and be a declaration, which shows up in the AST as an aggregate of size 1 of the declaration bool badInit = false; if (! init || ! init->getAsAggregate() || init->getAsAggregate()->getSequence().size() != 1) @@ -4636,8 +4730,10 @@ void TParseContext::inductiveLoopCheck(const TSourceLoc& loc, TIntermNode* init, // the body inductiveLoopBodyCheck(loop->getBody(), loopIndex, symbolTable); +#endif } +#ifndef GLSLANG_WEB // Do limit checks for built-in arrays. void TParseContext::arrayLimitCheck(const TSourceLoc& loc, const TString& identifier, int size) { @@ -4647,13 +4743,12 @@ void TParseContext::arrayLimitCheck(const TSourceLoc& loc, const TString& identi limitCheck(loc, size, "gl_MaxClipDistances", "gl_ClipDistance array size"); else if (identifier.compare("gl_CullDistance") == 0) limitCheck(loc, size, "gl_MaxCullDistances", "gl_CullDistance array size"); -#ifdef NV_EXTENSIONS else if (identifier.compare("gl_ClipDistancePerViewNV") == 0) limitCheck(loc, size, "gl_MaxClipDistances", "gl_ClipDistancePerViewNV array size"); else if (identifier.compare("gl_CullDistancePerViewNV") == 0) limitCheck(loc, size, "gl_MaxCullDistances", "gl_CullDistancePerViewNV array size"); -#endif } +#endif // GLSLANG_WEB // See if the provided value is less than or equal to the symbol indicated by limit, // which should be a constant in the symbol table. @@ -4667,6 +4762,8 @@ void TParseContext::limitCheck(const TSourceLoc& loc, int value, const char* lim error(loc, "must be less than or equal to", feature, "%s (%d)", limit, constArray[0].getIConst()); } +#ifndef GLSLANG_WEB + // // Do any additional error checking, etc., once we know the parsing is done. // @@ -4688,33 +4785,30 @@ void TParseContext::finish() // about the stage itself. switch (language) { case EShLangGeometry: - if (profile == EEsProfile && version == 310) + if (isEsProfile() && version == 310) requireExtensions(getCurrentLoc(), Num_AEP_geometry_shader, AEP_geometry_shader, "geometry shaders"); break; case EShLangTessControl: case EShLangTessEvaluation: - if (profile == EEsProfile && version == 310) + if (isEsProfile() && version == 310) requireExtensions(getCurrentLoc(), Num_AEP_tessellation_shader, AEP_tessellation_shader, "tessellation shaders"); - else if (profile != EEsProfile && version < 400) + else if (!isEsProfile() && version < 400) requireExtensions(getCurrentLoc(), 1, &E_GL_ARB_tessellation_shader, "tessellation shaders"); break; case EShLangCompute: - if (profile != EEsProfile && version < 430) + if (!isEsProfile() && version < 430) requireExtensions(getCurrentLoc(), 1, &E_GL_ARB_compute_shader, "compute shaders"); break; -#ifdef NV_EXTENSIONS case EShLangTaskNV: requireExtensions(getCurrentLoc(), 1, &E_GL_NV_mesh_shader, "task shaders"); break; case EShLangMeshNV: requireExtensions(getCurrentLoc(), 1, &E_GL_NV_mesh_shader, "mesh shaders"); break; -#endif default: break; } -#ifdef NV_EXTENSIONS // Set default outputs for GL_NV_geometry_shader_passthrough if (language == EShLangGeometry && extensionTurnedOn(E_SPV_NV_geometry_shader_passthrough)) { if (intermediate.getOutputPrimitive() == ElgNone) { @@ -4734,8 +4828,8 @@ void TParseContext::finish() } } } -#endif } +#endif // GLSLANG_WEB // // Layout qualifier stuff. @@ -4771,6 +4865,7 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi publicType.qualifier.layoutPacking = ElpStd140; return; } +#ifndef GLSLANG_WEB if (id == TQualifier::getLayoutPackingString(ElpStd430)) { requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, "std430"); profileRequires(loc, ECoreProfile | ECompatibilityProfile, 430, nullptr, "std430"); @@ -4810,20 +4905,12 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi intermediate.setUsePhysicalStorageBuffer(); return; } - if (language == EShLangGeometry || language == EShLangTessEvaluation -#ifdef NV_EXTENSIONS - || language == EShLangMeshNV -#endif - ) { + if (language == EShLangGeometry || language == EShLangTessEvaluation || language == EShLangMeshNV) { if (id == TQualifier::getGeometryString(ElgTriangles)) { publicType.shaderQualifiers.geometry = ElgTriangles; return; } - if (language == EShLangGeometry -#ifdef NV_EXTENSIONS - || language == EShLangMeshNV -#endif - ) { + if (language == EShLangGeometry || language == EShLangMeshNV) { if (id == TQualifier::getGeometryString(ElgPoints)) { publicType.shaderQualifiers.geometry = ElgPoints; return; @@ -4832,10 +4919,7 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi publicType.shaderQualifiers.geometry = ElgLines; return; } -#ifdef NV_EXTENSIONS - if (language == EShLangGeometry) -#endif - { + if (language == EShLangGeometry) { if (id == TQualifier::getGeometryString(ElgLineStrip)) { publicType.shaderQualifiers.geometry = ElgLineStrip; return; @@ -4852,14 +4936,12 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi publicType.shaderQualifiers.geometry = ElgTriangleStrip; return; } -#ifdef NV_EXTENSIONS if (id == "passthrough") { requireExtensions(loc, 1, &E_SPV_NV_geometry_shader_passthrough, "geometry shader passthrough"); publicType.qualifier.layoutPassthrough = true; intermediate.setGeoPassthroughEXT(); return; } -#endif } } else { assert(language == EShLangTessEvaluation); @@ -4942,6 +5024,17 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi return; } } + for (TInterlockOrdering order = (TInterlockOrdering)(EioNone + 1); order < EioCount; order = (TInterlockOrdering)(order+1)) { + if (id == TQualifier::getInterlockOrderingString(order)) { + requireProfile(loc, ECoreProfile | ECompatibilityProfile, "fragment shader interlock layout qualifier"); + profileRequires(loc, ECoreProfile | ECompatibilityProfile, 450, nullptr, "fragment shader interlock layout qualifier"); + requireExtensions(loc, 1, &E_GL_ARB_fragment_shader_interlock, TQualifier::getInterlockOrderingString(order)); + if (order == EioShadingRateInterlockOrdered || order == EioShadingRateInterlockUnordered) + requireExtensions(loc, 1, &E_GL_NV_shading_rate_image, TQualifier::getInterlockOrderingString(order)); + publicType.shaderQualifiers.interlockOrdering = order; + return; + } + } if (id.compare(0, 13, "blend_support") == 0) { bool found = false; for (TBlendEquationShift be = (TBlendEquationShift)0; be < EBlendCount; be = (TBlendEquationShift)(be + 1)) { @@ -4958,7 +5051,6 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi error(loc, "unknown blend equation", "blend_support", ""); return; } -#ifdef NV_EXTENSIONS if (id == "override_coverage") { requireExtensions(loc, 1, &E_GL_NV_sample_mask_override_coverage, "sample mask override coverage"); publicType.shaderQualifiers.layoutOverrideCoverage = true; @@ -4996,9 +5088,8 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi } } } -#else - } #endif + error(loc, "unrecognized layout identifier, or qualifier requires assignment (e.g., binding = 4)", id.c_str(), ""); } @@ -5063,7 +5154,8 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi return; } else if (id == "location") { profileRequires(loc, EEsProfile, 300, nullptr, "location"); - const char* exts[2] = { E_GL_ARB_separate_shader_objects, E_GL_ARB_explicit_attrib_location }; + const char* exts[2] = { E_GL_ARB_separate_shader_objects, E_GL_ARB_explicit_attrib_location }; + // GL_ARB_explicit_uniform_location requires 330 or GL_ARB_explicit_attrib_location we do not need to add it here profileRequires(loc, ~EEsProfile, 330, 2, exts, "location"); if ((unsigned int)value >= TQualifier::layoutLocationEnd) error(loc, "location is too large", id.c_str(), ""); @@ -5083,8 +5175,10 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi error(loc, "needs a literal integer", "set", ""); return; } else if (id == "binding") { +#ifndef GLSLANG_WEB profileRequires(loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, "binding"); profileRequires(loc, EEsProfile, 310, nullptr, "binding"); +#endif if ((unsigned int)value >= TQualifier::layoutBindingEnd) error(loc, "binding is too large", id.c_str(), ""); else @@ -5092,7 +5186,23 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi if (nonLiteral) error(loc, "needs a literal integer", "binding", ""); return; - } else if (id == "component") { + } + if (id == "constant_id") { + requireSpv(loc, "constant_id"); + if (value >= (int)TQualifier::layoutSpecConstantIdEnd) { + error(loc, "specialization-constant id is too large", id.c_str(), ""); + } else { + publicType.qualifier.layoutSpecConstantId = value; + publicType.qualifier.specConstant = true; + if (! intermediate.addUsedConstantId(value)) + error(loc, "specialization-constant id already used", id.c_str(), ""); + } + if (nonLiteral) + error(loc, "needs a literal integer", "constant_id", ""); + return; + } +#ifndef GLSLANG_WEB + if (id == "component") { requireProfile(loc, ECoreProfile | ECompatibilityProfile, "component"); profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, E_GL_ARB_enhanced_layouts, "component"); if ((unsigned)value >= TQualifier::layoutComponentEnd) @@ -5102,7 +5212,8 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi if (nonLiteral) error(loc, "needs a literal integer", "component", ""); return; - } else if (id.compare(0, 4, "xfb_") == 0) { + } + if (id.compare(0, 4, "xfb_") == 0) { // "Any shader making any static use (after preprocessing) of any of these // *xfb_* qualifiers will cause the shader to be in a transform feedback // capturing mode and hence responsible for describing the transform feedback @@ -5148,7 +5259,6 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi return; } } - if (id == "input_attachment_index") { requireVulkan(loc, "input_attachment_index"); if (value >= (int)TQualifier::layoutAttachmentEnd) @@ -5159,20 +5269,6 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi error(loc, "needs a literal integer", "input_attachment_index", ""); return; } - if (id == "constant_id") { - requireSpv(loc, "constant_id"); - if (value >= (int)TQualifier::layoutSpecConstantIdEnd) { - error(loc, "specialization-constant id is too large", id.c_str(), ""); - } else { - publicType.qualifier.layoutSpecConstantId = value; - publicType.qualifier.specConstant = true; - if (! intermediate.addUsedConstantId(value)) - error(loc, "specialization-constant id already used", id.c_str(), ""); - } - if (nonLiteral) - error(loc, "needs a literal integer", "constant_id", ""); - return; - } if (id == "num_views") { requireExtensions(loc, Num_OVR_multiview_EXTs, OVR_multiview_EXTs, "num_views"); publicType.shaderQualifiers.numViews = value; @@ -5180,8 +5276,6 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi error(loc, "needs a literal integer", "num_views", ""); return; } - -#if NV_EXTENSIONS if (language == EShLangVertex || language == EShLangTessControl || language == EShLangTessEvaluation || @@ -5194,7 +5288,6 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi return; } } -#endif if (id == "buffer_reference_align") { requireExtensions(loc, 1, &E_GL_EXT_buffer_reference, "buffer_reference_align"); @@ -5206,11 +5299,10 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi error(loc, "needs a literal integer", "buffer_reference_align", ""); return; } +#endif switch (language) { - case EShLangVertex: - break; - +#ifndef GLSLANG_WEB case EShLangTessControl: if (id == "vertices") { if (value == 0) @@ -5223,9 +5315,6 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi } break; - case EShLangTessEvaluation: - break; - case EShLangGeometry: if (id == "invocations") { profileRequires(loc, ECompatibilityProfile | ECoreProfile, 400, nullptr, "invocations"); @@ -5275,7 +5364,6 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi } break; -#ifdef NV_EXTENSIONS case EShLangMeshNV: if (id == "max_vertices") { requireExtensions(loc, 1, &E_GL_NV_mesh_shader, "max_vertices"); @@ -5302,16 +5390,14 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi #endif case EShLangCompute: if (id.compare(0, 11, "local_size_") == 0) { -#ifdef NV_EXTENSIONS +#ifndef GLSLANG_WEB if (language == EShLangMeshNV || language == EShLangTaskNV) { requireExtensions(loc, 1, &E_GL_NV_mesh_shader, "gl_WorkGroupSize"); - } - else -#endif - { + } else { profileRequires(loc, EEsProfile, 310, 0, "gl_WorkGroupSize"); profileRequires(loc, ~EEsProfile, 430, E_GL_ARB_compute_shader, "gl_WorkGroupSize"); } +#endif if (nonLiteral) error(loc, "needs a literal integer", "local_size", ""); if (id.size() == 12 && value == 0) { @@ -5320,14 +5406,17 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi } if (id == "local_size_x") { publicType.shaderQualifiers.localSize[0] = value; + publicType.shaderQualifiers.localSizeNotDefault[0] = true; return; } if (id == "local_size_y") { publicType.shaderQualifiers.localSize[1] = value; + publicType.shaderQualifiers.localSizeNotDefault[1] = true; return; } if (id == "local_size_z") { publicType.shaderQualifiers.localSize[2] = value; + publicType.shaderQualifiers.localSizeNotDefault[2] = true; return; } if (spvVersion.spv != 0) { @@ -5375,53 +5464,50 @@ void TParseContext::mergeObjectLayoutQualifiers(TQualifier& dst, const TQualifie if (src.hasPacking()) dst.layoutPacking = src.layoutPacking; +#ifndef GLSLANG_WEB if (src.hasStream()) dst.layoutStream = src.layoutStream; - if (src.hasFormat()) dst.layoutFormat = src.layoutFormat; - if (src.hasXfbBuffer()) dst.layoutXfbBuffer = src.layoutXfbBuffer; + if (src.hasBufferReferenceAlign()) + dst.layoutBufferReferenceAlign = src.layoutBufferReferenceAlign; +#endif if (src.hasAlign()) dst.layoutAlign = src.layoutAlign; - if (src.hasBufferReferenceAlign()) - dst.layoutBufferReferenceAlign = src.layoutBufferReferenceAlign; - if (! inheritOnly) { if (src.hasLocation()) dst.layoutLocation = src.layoutLocation; - if (src.hasComponent()) - dst.layoutComponent = src.layoutComponent; - if (src.hasIndex()) - dst.layoutIndex = src.layoutIndex; - if (src.hasOffset()) dst.layoutOffset = src.layoutOffset; - if (src.hasSet()) dst.layoutSet = src.layoutSet; if (src.layoutBinding != TQualifier::layoutBindingEnd) dst.layoutBinding = src.layoutBinding; + if (src.hasSpecConstantId()) + dst.layoutSpecConstantId = src.layoutSpecConstantId; + +#ifndef GLSLANG_WEB + if (src.hasComponent()) + dst.layoutComponent = src.layoutComponent; + if (src.hasIndex()) + dst.layoutIndex = src.layoutIndex; if (src.hasXfbStride()) dst.layoutXfbStride = src.layoutXfbStride; if (src.hasXfbOffset()) dst.layoutXfbOffset = src.layoutXfbOffset; if (src.hasAttachment()) dst.layoutAttachment = src.layoutAttachment; - if (src.hasSpecConstantId()) - dst.layoutSpecConstantId = src.layoutSpecConstantId; - if (src.layoutPushConstant) dst.layoutPushConstant = true; if (src.layoutBufferReference) dst.layoutBufferReference = true; -#ifdef NV_EXTENSIONS if (src.layoutPassthrough) dst.layoutPassthrough = true; if (src.layoutViewportRelative) @@ -5490,17 +5576,15 @@ void TParseContext::layoutObjectCheck(const TSourceLoc& loc, const TSymbol& symb if (qualifier.hasPacking()) error(loc, "cannot specify packing on a variable declaration", "layout", ""); // "The offset qualifier can only be used on block members of blocks..." - if (qualifier.hasOffset() && type.getBasicType() != EbtAtomicUint) + if (qualifier.hasOffset() && !type.isAtomic()) error(loc, "cannot specify on a variable declaration", "offset", ""); // "The align qualifier can only be used on blocks or block members..." if (qualifier.hasAlign()) error(loc, "cannot specify on a variable declaration", "align", ""); - if (qualifier.layoutPushConstant) + if (qualifier.isPushConstant()) error(loc, "can only specify on a uniform block", "push_constant", ""); -#ifdef NV_EXTENSIONS - if (qualifier.layoutShaderRecordNV) + if (qualifier.isShaderRecordNV()) error(loc, "can only specify on a buffer block", "shaderRecordNV", ""); -#endif } break; default: @@ -5564,17 +5648,15 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type) case EvqVaryingOut: if (type.getBasicType() == EbtBlock) profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, E_GL_ARB_enhanced_layouts, "location qualifier on in/out block"); -#ifdef NV_EXTENSIONS if (type.getQualifier().isTaskMemory()) error(loc, "cannot apply to taskNV in/out blocks", "location", ""); -#endif break; case EvqUniform: case EvqBuffer: if (type.getBasicType() == EbtBlock) error(loc, "cannot apply to uniform or buffer block", "location", ""); break; -#ifdef NV_EXTENSIONS +#ifndef GLSLANG_WEB case EvqPayloadNV: case EvqPayloadInNV: case EvqHitAttrNV: @@ -5597,6 +5679,7 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type) error(loc, "fragment outputs sharing the same location must be the same basic type", "location", "%d", repeated); } +#ifndef GLSLANG_WEB if (qualifier.hasXfbOffset() && qualifier.hasXfbBuffer()) { int repeated = intermediate.addXfbBufferOffset(type); if (repeated >= 0) @@ -5608,25 +5691,20 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type) if ((type.containsBasicType(EbtDouble) || type.containsBasicType(EbtInt64) || type.containsBasicType(EbtUint64)) && ! IsMultipleOfPow2(qualifier.layoutXfbOffset, 8)) error(loc, "type contains double or 64-bit integer; xfb_offset must be a multiple of 8", "xfb_offset", ""); -#ifdef AMD_EXTENSIONS else if ((type.containsBasicType(EbtBool) || type.containsBasicType(EbtFloat) || type.containsBasicType(EbtInt) || type.containsBasicType(EbtUint)) && ! IsMultipleOfPow2(qualifier.layoutXfbOffset, 4)) error(loc, "must be a multiple of size of first component", "xfb_offset", ""); // ..., if applied to an aggregate containing a half float or 16-bit integer, the offset must also be a multiple of 2..." - else if ((type.containsBasicType(EbtFloat16) || type.containsBasicType(EbtInt16) || type.containsBasicType(EbtUint16)) && + else if ((type.contains16BitFloat() || type.containsBasicType(EbtInt16) || type.containsBasicType(EbtUint16)) && !IsMultipleOfPow2(qualifier.layoutXfbOffset, 2)) error(loc, "type contains half float or 16-bit integer; xfb_offset must be a multiple of 2", "xfb_offset", ""); -#else - else if (! IsMultipleOfPow2(qualifier.layoutXfbOffset, 4)) - error(loc, "must be a multiple of size of first component", "xfb_offset", ""); -#endif } - if (qualifier.hasXfbStride() && qualifier.hasXfbBuffer()) { if (! intermediate.setXfbBufferStride(qualifier.layoutXfbBuffer, qualifier.layoutXfbStride)) error(loc, "all stride settings must match for xfb buffer", "xfb_stride", "%d", qualifier.layoutXfbBuffer); } +#endif if (qualifier.hasBinding()) { // Binding checking, from the spec: @@ -5649,15 +5727,19 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type) lastBinding += type.getCumulativeArraySize(); else { lastBinding += 1; +#ifndef GLSLANG_WEB if (spvVersion.vulkan == 0) warn(loc, "assuming binding count of one for compile-time checking of binding numbers for unsized array", "[]", ""); +#endif } } } +#ifndef GLSLANG_WEB if (spvVersion.vulkan == 0 && lastBinding >= resources.maxCombinedTextureImageUnits) error(loc, "sampler binding not less than gl_MaxCombinedTextureImageUnits", "binding", type.isArray() ? "(using array)" : ""); +#endif } - if (type.getBasicType() == EbtAtomicUint) { + if (type.isAtomic()) { if (qualifier.layoutBinding >= (unsigned int)resources.maxAtomicCounterBindings) { error(loc, "atomic_uint binding is too large; see gl_MaxAtomicCounterBindings", "binding", ""); return; @@ -5667,18 +5749,16 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type) // some types require bindings // atomic_uint - if (type.getBasicType() == EbtAtomicUint) + if (type.isAtomic()) error(loc, "layout(binding=X) is required", "atomic_uint", ""); // SPIR-V if (spvVersion.spv > 0) { if (qualifier.isUniformOrBuffer()) { - if (type.getBasicType() == EbtBlock && !qualifier.layoutPushConstant && -#ifdef NV_EXTENSIONS - !qualifier.layoutShaderRecordNV && -#endif - !qualifier.layoutAttachment && - !qualifier.layoutBufferReference) + if (type.getBasicType() == EbtBlock && !qualifier.isPushConstant() && + !qualifier.isShaderRecordNV() && + !qualifier.hasAttachment() && + !qualifier.hasBufferReference()) error(loc, "uniform/buffer blocks require layout(binding=X)", "binding", ""); else if (spvVersion.vulkan > 0 && type.getBasicType() == EbtSampler) error(loc, "sampler/texture/image requires layout(binding=X)", "binding", ""); @@ -5703,40 +5783,38 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type) // Image format if (qualifier.hasFormat()) { if (! type.isImage()) - error(loc, "only apply to images", TQualifier::getLayoutFormatString(qualifier.layoutFormat), ""); + error(loc, "only apply to images", TQualifier::getLayoutFormatString(qualifier.getFormat()), ""); else { - if (type.getSampler().type == EbtFloat && qualifier.layoutFormat > ElfFloatGuard) - error(loc, "does not apply to floating point images", TQualifier::getLayoutFormatString(qualifier.layoutFormat), ""); - if (type.getSampler().type == EbtInt && (qualifier.layoutFormat < ElfFloatGuard || qualifier.layoutFormat > ElfIntGuard)) - error(loc, "does not apply to signed integer images", TQualifier::getLayoutFormatString(qualifier.layoutFormat), ""); - if (type.getSampler().type == EbtUint && qualifier.layoutFormat < ElfIntGuard) - error(loc, "does not apply to unsigned integer images", TQualifier::getLayoutFormatString(qualifier.layoutFormat), ""); - - if (profile == EEsProfile) { + if (type.getSampler().type == EbtFloat && qualifier.getFormat() > ElfFloatGuard) + error(loc, "does not apply to floating point images", TQualifier::getLayoutFormatString(qualifier.getFormat()), ""); + if (type.getSampler().type == EbtInt && (qualifier.getFormat() < ElfFloatGuard || qualifier.getFormat() > ElfIntGuard)) + error(loc, "does not apply to signed integer images", TQualifier::getLayoutFormatString(qualifier.getFormat()), ""); + if (type.getSampler().type == EbtUint && qualifier.getFormat() < ElfIntGuard) + error(loc, "does not apply to unsigned integer images", TQualifier::getLayoutFormatString(qualifier.getFormat()), ""); + + if (isEsProfile()) { // "Except for image variables qualified with the format qualifiers r32f, r32i, and r32ui, image variables must // specify either memory qualifier readonly or the memory qualifier writeonly." - if (! (qualifier.layoutFormat == ElfR32f || qualifier.layoutFormat == ElfR32i || qualifier.layoutFormat == ElfR32ui)) { - if (! qualifier.readonly && ! qualifier.writeonly) - error(loc, "format requires readonly or writeonly memory qualifier", TQualifier::getLayoutFormatString(qualifier.layoutFormat), ""); + if (! (qualifier.getFormat() == ElfR32f || qualifier.getFormat() == ElfR32i || qualifier.getFormat() == ElfR32ui)) { + if (! qualifier.isReadOnly() && ! qualifier.isWriteOnly()) + error(loc, "format requires readonly or writeonly memory qualifier", TQualifier::getLayoutFormatString(qualifier.getFormat()), ""); } } } - } else if (type.isImage() && ! qualifier.writeonly) { + } else if (type.isImage() && ! qualifier.isWriteOnly()) { const char *explanation = "image variables not declared 'writeonly' and without a format layout qualifier"; requireProfile(loc, ECoreProfile | ECompatibilityProfile, explanation); profileRequires(loc, ECoreProfile | ECompatibilityProfile, 0, E_GL_EXT_shader_image_load_formatted, explanation); } - if (qualifier.layoutPushConstant && type.getBasicType() != EbtBlock) + if (qualifier.isPushConstant() && type.getBasicType() != EbtBlock) error(loc, "can only be used with a block", "push_constant", ""); - if (qualifier.layoutBufferReference && type.getBasicType() != EbtBlock) + if (qualifier.hasBufferReference() && type.getBasicType() != EbtBlock) error(loc, "can only be used with a block", "buffer_reference", ""); -#ifdef NV_EXTENSIONS - if (qualifier.layoutShaderRecordNV && type.getBasicType() != EbtBlock) + if (qualifier.isShaderRecordNV() && type.getBasicType() != EbtBlock) error(loc, "can only be used with a block", "shaderRecordNV", ""); -#endif // input attachment if (type.isSubpass()) { @@ -5793,10 +5871,11 @@ void TParseContext::layoutQualifierCheck(const TSourceLoc& loc, const TQualifier // output block declarations, and output block member declarations." switch (qualifier.storage) { +#ifndef GLSLANG_WEB case EvqVaryingIn: { const char* feature = "location qualifier on input"; - if (profile == EEsProfile && version < 310) + if (isEsProfile() && version < 310) requireStage(loc, EShLangVertex, feature); else requireStage(loc, (EShLanguageMask)~EShLangComputeMask, feature); @@ -5813,7 +5892,7 @@ void TParseContext::layoutQualifierCheck(const TSourceLoc& loc, const TQualifier case EvqVaryingOut: { const char* feature = "location qualifier on output"; - if (profile == EEsProfile && version < 310) + if (isEsProfile() && version < 310) requireStage(loc, EShLangFragment, feature); else requireStage(loc, (EShLanguageMask)~EShLangComputeMask, feature); @@ -5827,12 +5906,14 @@ void TParseContext::layoutQualifierCheck(const TSourceLoc& loc, const TQualifier } break; } +#endif case EvqUniform: case EvqBuffer: { const char* feature = "location qualifier on uniform or buffer"; - requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, feature); - profileRequires(loc, ECoreProfile | ECompatibilityProfile, 430, nullptr, feature); + requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile | ENoProfile, feature); + profileRequires(loc, ~EEsProfile, 330, E_GL_ARB_explicit_attrib_location, feature); + profileRequires(loc, ~EEsProfile, 430, E_GL_ARB_explicit_uniform_location, feature); profileRequires(loc, EEsProfile, 310, nullptr, feature); break; } @@ -5867,18 +5948,17 @@ void TParseContext::layoutQualifierCheck(const TSourceLoc& loc, const TQualifier error(loc, "offset/align can only be used on a uniform or buffer", "layout", ""); } } - if (qualifier.layoutPushConstant) { + if (qualifier.isPushConstant()) { if (qualifier.storage != EvqUniform) error(loc, "can only be used with a uniform", "push_constant", ""); if (qualifier.hasSet()) error(loc, "cannot be used with push_constant", "set", ""); } - if (qualifier.layoutBufferReference) { + if (qualifier.hasBufferReference()) { if (qualifier.storage != EvqBuffer) error(loc, "can only be used with buffer", "buffer_reference", ""); } -#ifdef NV_EXTENSIONS - if (qualifier.layoutShaderRecordNV) { + if (qualifier.isShaderRecordNV()) { if (qualifier.storage != EvqBuffer) error(loc, "can only be used with a buffer", "shaderRecordNV", ""); if (qualifier.hasBinding()) @@ -5890,12 +5970,12 @@ void TParseContext::layoutQualifierCheck(const TSourceLoc& loc, const TQualifier if (qualifier.storage == EvqHitAttrNV && qualifier.hasLayout()) { error(loc, "cannot apply layout qualifiers to hitAttributeNV variable", "hitAttributeNV", ""); } -#endif } // For places that can't have shader-level layout qualifiers void TParseContext::checkNoShaderLayouts(const TSourceLoc& loc, const TShaderQualifiers& shaderQualifiers) { +#ifndef GLSLANG_WEB const char* message = "can only apply to a standalone qualifier"; if (shaderQualifiers.geometry != ElgNone) @@ -5908,10 +5988,6 @@ void TParseContext::checkNoShaderLayouts(const TSourceLoc& loc, const TShaderQua error(loc, message, "point_mode", ""); if (shaderQualifiers.invocations != TQualifier::layoutNotSet) error(loc, message, "invocations", ""); - if (shaderQualifiers.earlyFragmentTests) - error(loc, message, "early_fragment_tests", ""); - if (shaderQualifiers.postDepthCoverage) - error(loc, message, "post_depth_coverage", ""); for (int i = 0; i < 3; ++i) { if (shaderQualifiers.localSize[i] > 1) error(loc, message, "local_size", ""); @@ -5919,36 +5995,38 @@ void TParseContext::checkNoShaderLayouts(const TSourceLoc& loc, const TShaderQua error(loc, message, "local_size id", ""); } if (shaderQualifiers.vertices != TQualifier::layoutNotSet) { - if (language == EShLangGeometry -#ifdef NV_EXTENSIONS - || language == EShLangMeshNV -#endif - ) + if (language == EShLangGeometry || language == EShLangMeshNV) error(loc, message, "max_vertices", ""); else if (language == EShLangTessControl) error(loc, message, "vertices", ""); else assert(0); } -#ifdef NV_EXTENSIONS + if (shaderQualifiers.earlyFragmentTests) + error(loc, message, "early_fragment_tests", ""); + if (shaderQualifiers.postDepthCoverage) + error(loc, message, "post_depth_coverage", ""); if (shaderQualifiers.primitives != TQualifier::layoutNotSet) { if (language == EShLangMeshNV) error(loc, message, "max_primitives", ""); else assert(0); } -#endif - if (shaderQualifiers.blendEquation) + if (shaderQualifiers.hasBlendEquation()) error(loc, message, "blend equation", ""); if (shaderQualifiers.numViews != TQualifier::layoutNotSet) error(loc, message, "num_views", ""); + if (shaderQualifiers.interlockOrdering != EioNone) + error(loc, message, TQualifier::getInterlockOrderingString(shaderQualifiers.interlockOrdering), ""); +#endif } // Correct and/or advance an object's offset layout qualifier. void TParseContext::fixOffset(const TSourceLoc& loc, TSymbol& symbol) { const TQualifier& qualifier = symbol.getType().getQualifier(); - if (symbol.getType().getBasicType() == EbtAtomicUint) { +#ifndef GLSLANG_WEB + if (symbol.getType().isAtomic()) { if (qualifier.hasBinding() && (int)qualifier.layoutBinding < resources.maxAtomicCounterBindings) { // Set the offset @@ -5957,6 +6035,10 @@ void TParseContext::fixOffset(const TSourceLoc& loc, TSymbol& symbol) offset = qualifier.layoutOffset; else offset = atomicUintOffsets[qualifier.layoutBinding]; + + if (offset % 4 != 0) + error(loc, "atomic counters offset should align based on 4:", "offset", "%d", offset); + symbol.getWritableType().getQualifier().layoutOffset = offset; // Check for overlap @@ -5977,6 +6059,7 @@ void TParseContext::fixOffset(const TSourceLoc& loc, TSymbol& symbol) atomicUintOffsets[qualifier.layoutBinding] = offset + numOffsets; } } +#endif } // @@ -5986,13 +6069,16 @@ void TParseContext::fixOffset(const TSourceLoc& loc, TSymbol& symbol) // const TFunction* TParseContext::findFunction(const TSourceLoc& loc, const TFunction& call, bool& builtIn) { - const TFunction* function = nullptr; - if (symbolTable.isFunctionNameVariable(call.getName())) { error(loc, "can't use function syntax on variable", call.getName().c_str(), ""); return nullptr; } +#ifdef GLSLANG_WEB + return findFunctionExact(loc, call, builtIn); +#endif + + const TFunction* function = nullptr; bool explicitTypesEnabled = extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) || extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int8) || extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int16) || @@ -6002,10 +6088,10 @@ const TFunction* TParseContext::findFunction(const TSourceLoc& loc, const TFunct extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float32) || extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float64); - if (profile == EEsProfile || version < 120) + if (isEsProfile() || version < 120) function = findFunctionExact(loc, call, builtIn); else if (version < 400) - function = findFunction120(loc, call, builtIn); + function = extensionTurnedOn(E_GL_ARB_gpu_shader_fp64) ? findFunction400(loc, call, builtIn) : findFunction120(loc, call, builtIn); else if (explicitTypesEnabled) function = findFunctionExplicitTypes(loc, call, builtIn); else @@ -6164,6 +6250,8 @@ const TFunction* TParseContext::findFunction400(const TSourceLoc& loc, const TFu } if (from.isArray() || to.isArray() || ! from.sameElementShape(to)) return false; + if (from.isCoopMat() && to.isCoopMat()) + return from.sameCoopMatBaseType(to); return intermediate.canImplicitlyPromote(from.getBasicType(), to.getBasicType()); }; @@ -6238,6 +6326,8 @@ const TFunction* TParseContext::findFunctionExplicitTypes(const TSourceLoc& loc, } if (from.isArray() || to.isArray() || ! from.sameElementShape(to)) return false; + if (from.isCoopMat() && to.isCoopMat()) + return from.sameCoopMatBaseType(to); return intermediate.canImplicitlyPromote(from.getBasicType(), to.getBasicType()); }; @@ -6289,21 +6379,26 @@ const TFunction* TParseContext::findFunctionExplicitTypes(const TSourceLoc& loc, return bestMatch; } -// When a declaration includes a type, but not a variable name, it can be +// When a declaration includes a type, but not a variable name, it can be used // to establish defaults. void TParseContext::declareTypeDefaults(const TSourceLoc& loc, const TPublicType& publicType) { - if (publicType.basicType == EbtAtomicUint && publicType.qualifier.hasBinding() && publicType.qualifier.hasOffset()) { +#ifndef GLSLANG_WEB + if (publicType.basicType == EbtAtomicUint && publicType.qualifier.hasBinding()) { if (publicType.qualifier.layoutBinding >= (unsigned int)resources.maxAtomicCounterBindings) { error(loc, "atomic_uint binding is too large", "binding", ""); return; } - atomicUintOffsets[publicType.qualifier.layoutBinding] = publicType.qualifier.layoutOffset; + + if(publicType.qualifier.hasOffset()) { + atomicUintOffsets[publicType.qualifier.layoutBinding] = publicType.qualifier.layoutOffset; + } return; } - if (publicType.qualifier.hasLayout() && !publicType.qualifier.layoutBufferReference) + if (publicType.qualifier.hasLayout() && !publicType.qualifier.hasBufferReference()) warn(loc, "useless application of layout qualifier", "layout", ""); +#endif } // @@ -6334,12 +6429,20 @@ TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& iden if (!publicType.typeParameters || publicType.typeParameters->getNumDims() != 4) { error(loc, "expected four type parameters", identifier.c_str(), ""); } - if (publicType.typeParameters && - publicType.typeParameters->getDimSize(0) != 16 && - publicType.typeParameters->getDimSize(0) != 32 && - publicType.typeParameters->getDimSize(0) != 64) { - error(loc, "expected 16, 32, or 64 bits for first type parameter", identifier.c_str(), ""); + if (publicType.typeParameters) { + if (isTypeFloat(publicType.basicType) && + publicType.typeParameters->getDimSize(0) != 16 && + publicType.typeParameters->getDimSize(0) != 32 && + publicType.typeParameters->getDimSize(0) != 64) { + error(loc, "expected 16, 32, or 64 bits for first type parameter", identifier.c_str(), ""); + } + if (isTypeInt(publicType.basicType) && + publicType.typeParameters->getDimSize(0) != 8 && + publicType.typeParameters->getDimSize(0) != 32) { + error(loc, "expected 8 or 32 bits for first type parameter", identifier.c_str(), ""); + } } + } else { if (publicType.typeParameters && publicType.typeParameters->getNumDims() != 0) { error(loc, "unexpected type parameters", identifier.c_str(), ""); @@ -6355,17 +6458,18 @@ TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& iden nonInitConstCheck(loc, identifier, type); samplerCheck(loc, type, identifier, initializer); - atomicUintCheck(loc, type, identifier); transparentOpaqueCheck(loc, type, identifier); -#ifdef NV_EXTENSIONS +#ifndef GLSLANG_WEB + atomicUintCheck(loc, type, identifier); accStructNVCheck(loc, type, identifier); + checkAndResizeMeshViewDim(loc, type, /*isBlockMember*/ false); #endif - if (type.getQualifier().storage == EvqConst && type.containsBasicType(EbtReference)) { + if (type.getQualifier().storage == EvqConst && type.containsReference()) { error(loc, "variables with reference type can't have qualifier 'const'", "qualifier", ""); } if (type.getQualifier().storage != EvqUniform && type.getQualifier().storage != EvqBuffer) { - if (type.containsBasicType(EbtFloat16)) + if (type.contains16BitFloat()) requireFloat16Arithmetic(loc, "qualifier", "float16 types can only be in uniform block or buffer storage"); if (type.contains16BitInt()) requireInt16Arithmetic(loc, "qualifier", "(u)int16 types can only be in uniform block or buffer storage"); @@ -6373,13 +6477,12 @@ TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& iden requireInt8Arithmetic(loc, "qualifier", "(u)int8 types can only be in uniform block or buffer storage"); } - if (type.getQualifier().storage == EvqShared && - type.containsCoopMat()) + if (type.getQualifier().storage == EvqShared && type.containsCoopMat()) error(loc, "qualifier", "Cooperative matrix types must not be used in shared memory", ""); if (identifier != "gl_FragCoord" && (publicType.shaderQualifiers.originUpperLeft || publicType.shaderQualifiers.pixelCenterInteger)) error(loc, "can only apply origin_upper_left and pixel_center_origin to gl_FragCoord", "layout qualifier", ""); - if (identifier != "gl_FragDepth" && publicType.shaderQualifiers.layoutDepth != EldNone) + if (identifier != "gl_FragDepth" && publicType.shaderQualifiers.getDepth() != EldNone) error(loc, "can only apply depth layout to gl_FragDepth", "layout qualifier", ""); // Check for redeclaration of built-ins and/or attempting to declare a reserved name @@ -6435,12 +6538,14 @@ TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& iden // Pick up global defaults from the provide global defaults into dst. void TParseContext::inheritGlobalDefaults(TQualifier& dst) const { +#ifndef GLSLANG_WEB if (dst.storage == EvqVaryingOut) { if (! dst.hasStream() && language == EShLangGeometry) dst.layoutStream = globalOutputDefaults.layoutStream; if (! dst.hasXfbBuffer()) dst.layoutXfbBuffer = globalOutputDefaults.layoutXfbBuffer; } +#endif } // @@ -6469,7 +6574,9 @@ TVariable* TParseContext::declareNonArray(const TSourceLoc& loc, const TString& // make a new variable TVariable* variable = new TVariable(&identifier, type); +#ifndef GLSLANG_WEB ioArrayCheck(loc, type, identifier); +#endif // add variable to symbol table if (symbolTable.insert(*variable)) { @@ -6496,7 +6603,7 @@ TIntermNode* TParseContext::executeInitializer(const TSourceLoc& loc, TIntermTyp // TStorageQualifier qualifier = variable->getType().getQualifier().storage; if (! (qualifier == EvqTemporary || qualifier == EvqGlobal || qualifier == EvqConst || - (qualifier == EvqUniform && profile != EEsProfile && version >= 120))) { + (qualifier == EvqUniform && !isEsProfile() && version >= 120))) { error(loc, " cannot initialize this type of qualifier ", variable->getType().getStorageQualifierString(), ""); return nullptr; } @@ -6514,7 +6621,9 @@ TIntermNode* TParseContext::executeInitializer(const TSourceLoc& loc, TIntermTyp TType skeletalType; skeletalType.shallowCopy(variable->getType()); skeletalType.getQualifier().makeTemporary(); +#ifndef GLSLANG_WEB initializer = convertInitializerList(loc, skeletalType, initializer); +#endif if (! initializer) { // error recovery; don't leave const without constant values if (qualifier == EvqConst) @@ -6568,7 +6677,7 @@ TIntermNode* TParseContext::executeInitializer(const TSourceLoc& loc, TIntermTyp // qualifier any initializer must be a constant expression." if (symbolTable.atGlobalLevel() && ! initializer->getType().getQualifier().isConstant()) { const char* initFeature = "non-constant global initializer (needs GL_EXT_shader_non_constant_global_initializers)"; - if (profile == EEsProfile) { + if (isEsProfile()) { if (relaxedErrors() && ! extensionTurnedOn(E_GL_EXT_shader_non_constant_global_initializers)) warn(loc, "not allowed in this version", initFeature, ""); else @@ -6819,7 +6928,7 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T // This avoids requesting a matrix of a new type that is going to be discarded anyway. // TODO: This could be generalized to more type combinations, but that would require // more extensive testing and full algorithm rework. For now, the need to do two changes makes - // the recursive call work, and avoids the most aggregious case of creating integer matrices. + // the recursive call work, and avoids the most egregious case of creating integer matrices. if (node->getType().isMatrix() && (type.isScalar() || type.isVector()) && type.isFloatingDomain() != node->getType().isFloatingDomain()) { TType transitionType(node->getBasicType(), glslang::EvqTemporary, type.getVectorSize(), 0, 0, node->isVector()); @@ -6850,6 +6959,35 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T basicOp = EOpConstructFloat; break; + case EOpConstructIVec2: + case EOpConstructIVec3: + case EOpConstructIVec4: + case EOpConstructInt: + basicOp = EOpConstructInt; + break; + + case EOpConstructUVec2: + if (node->getType().getBasicType() == EbtReference) { + requireExtensions(loc, 1, &E_GL_EXT_buffer_reference_uvec2, "reference conversion to uvec2"); + TIntermTyped* newNode = intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConvPtrToUvec2, true, node, + type); + return newNode; + } + case EOpConstructUVec3: + case EOpConstructUVec4: + case EOpConstructUint: + basicOp = EOpConstructUint; + break; + + case EOpConstructBVec2: + case EOpConstructBVec3: + case EOpConstructBVec4: + case EOpConstructBool: + basicOp = EOpConstructBool; + break; + +#ifndef GLSLANG_WEB + case EOpConstructDVec2: case EOpConstructDVec3: case EOpConstructDVec4: @@ -6880,6 +7018,22 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T case EOpConstructF16Mat4x4: case EOpConstructFloat16: basicOp = EOpConstructFloat16; + // 8/16-bit storage extensions don't support constructing composites of 8/16-bit types, + // so construct a 32-bit type and convert + if (!intermediate.getArithemeticFloat16Enabled()) { + TType tempType(EbtFloat, EvqTemporary, type.getVectorSize()); + newNode = node; + if (tempType != newNode->getType()) { + TOperator aggregateOp; + if (op == EOpConstructFloat16) + aggregateOp = EOpConstructFloat; + else + aggregateOp = (TOperator)(EOpConstructVec2 + op - EOpConstructF16Vec2); + newNode = intermediate.setAggregateOperator(newNode, aggregateOp, tempType, node->getLoc()); + } + newNode = intermediate.addConversion(EbtFloat16, newNode); + return newNode; + } break; case EOpConstructI8Vec2: @@ -6887,6 +7041,22 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T case EOpConstructI8Vec4: case EOpConstructInt8: basicOp = EOpConstructInt8; + // 8/16-bit storage extensions don't support constructing composites of 8/16-bit types, + // so construct a 32-bit type and convert + if (!intermediate.getArithemeticInt8Enabled()) { + TType tempType(EbtInt, EvqTemporary, type.getVectorSize()); + newNode = node; + if (tempType != newNode->getType()) { + TOperator aggregateOp; + if (op == EOpConstructInt8) + aggregateOp = EOpConstructInt; + else + aggregateOp = (TOperator)(EOpConstructIVec2 + op - EOpConstructI8Vec2); + newNode = intermediate.setAggregateOperator(newNode, aggregateOp, tempType, node->getLoc()); + } + newNode = intermediate.addConversion(EbtInt8, newNode); + return newNode; + } break; case EOpConstructU8Vec2: @@ -6894,6 +7064,22 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T case EOpConstructU8Vec4: case EOpConstructUint8: basicOp = EOpConstructUint8; + // 8/16-bit storage extensions don't support constructing composites of 8/16-bit types, + // so construct a 32-bit type and convert + if (!intermediate.getArithemeticInt8Enabled()) { + TType tempType(EbtUint, EvqTemporary, type.getVectorSize()); + newNode = node; + if (tempType != newNode->getType()) { + TOperator aggregateOp; + if (op == EOpConstructUint8) + aggregateOp = EOpConstructUint; + else + aggregateOp = (TOperator)(EOpConstructUVec2 + op - EOpConstructU8Vec2); + newNode = intermediate.setAggregateOperator(newNode, aggregateOp, tempType, node->getLoc()); + } + newNode = intermediate.addConversion(EbtUint8, newNode); + return newNode; + } break; case EOpConstructI16Vec2: @@ -6901,6 +7087,22 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T case EOpConstructI16Vec4: case EOpConstructInt16: basicOp = EOpConstructInt16; + // 8/16-bit storage extensions don't support constructing composites of 8/16-bit types, + // so construct a 32-bit type and convert + if (!intermediate.getArithemeticInt16Enabled()) { + TType tempType(EbtInt, EvqTemporary, type.getVectorSize()); + newNode = node; + if (tempType != newNode->getType()) { + TOperator aggregateOp; + if (op == EOpConstructInt16) + aggregateOp = EOpConstructInt; + else + aggregateOp = (TOperator)(EOpConstructIVec2 + op - EOpConstructI16Vec2); + newNode = intermediate.setAggregateOperator(newNode, aggregateOp, tempType, node->getLoc()); + } + newNode = intermediate.addConversion(EbtInt16, newNode); + return newNode; + } break; case EOpConstructU16Vec2: @@ -6908,20 +7110,22 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T case EOpConstructU16Vec4: case EOpConstructUint16: basicOp = EOpConstructUint16; - break; - - case EOpConstructIVec2: - case EOpConstructIVec3: - case EOpConstructIVec4: - case EOpConstructInt: - basicOp = EOpConstructInt; - break; - - case EOpConstructUVec2: - case EOpConstructUVec3: - case EOpConstructUVec4: - case EOpConstructUint: - basicOp = EOpConstructUint; + // 8/16-bit storage extensions don't support constructing composites of 8/16-bit types, + // so construct a 32-bit type and convert + if (!intermediate.getArithemeticInt16Enabled()) { + TType tempType(EbtUint, EvqTemporary, type.getVectorSize()); + newNode = node; + if (tempType != newNode->getType()) { + TOperator aggregateOp; + if (op == EOpConstructUint16) + aggregateOp = EOpConstructUint; + else + aggregateOp = (TOperator)(EOpConstructUVec2 + op - EOpConstructU16Vec2); + newNode = intermediate.setAggregateOperator(newNode, aggregateOp, tempType, node->getLoc()); + } + newNode = intermediate.addConversion(EbtUint16, newNode); + return newNode; + } break; case EOpConstructI64Vec2: @@ -6932,7 +7136,7 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T break; case EOpConstructUint64: - if (type.isScalar() && node->getType().getBasicType() == EbtReference) { + if (type.isScalar() && node->getType().isReference()) { TIntermTyped* newNode = intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConvPtrToUint64, true, node, type); return newNode; } @@ -6943,27 +7147,27 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T basicOp = EOpConstructUint64; break; - case EOpConstructBVec2: - case EOpConstructBVec3: - case EOpConstructBVec4: - case EOpConstructBool: - basicOp = EOpConstructBool; - break; - case EOpConstructNonuniform: // Make a nonuniform copy of node - newNode = intermediate.addBuiltInFunctionCall(node->getLoc(), EOpCopyObject, true, node, node->getType()); - newNode->getWritableType().getQualifier().nonUniform = true; + newNode = intermediate.addBuiltInFunctionCall(node->getLoc(), EOpCopyObject, true, node, type); return newNode; case EOpConstructReference: // construct reference from reference - if (node->getType().getBasicType() == EbtReference) { + if (node->getType().isReference()) { newNode = intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConstructReference, true, node, type); return newNode; // construct reference from uint64 } else if (node->getType().isScalar() && node->getType().getBasicType() == EbtUint64) { - TIntermTyped* newNode = intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConvUint64ToPtr, true, node, type); + TIntermTyped* newNode = intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConvUint64ToPtr, true, node, + type); + return newNode; + // construct reference from uvec2 + } else if (node->getType().isVector() && node->getType().getBasicType() == EbtUint && + node->getVectorSize() == 2) { + requireExtensions(loc, 1, &E_GL_EXT_buffer_reference_uvec2, "uvec2 conversion to reference"); + TIntermTyped* newNode = intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConvUvec2ToPtr, true, node, + type); return newNode; } else { return nullptr; @@ -6976,19 +7180,75 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T } node = intermediate.setAggregateOperator(node, EOpConstructCooperativeMatrix, type, node->getLoc()); } else { + TOperator op = EOpNull; switch (type.getBasicType()) { default: assert(0); break; + case EbtInt: + switch (node->getType().getBasicType()) { + case EbtFloat: op = EOpConvFloatToInt; break; + case EbtFloat16: op = EOpConvFloat16ToInt; break; + case EbtUint8: op = EOpConvUint8ToInt; break; + case EbtInt8: op = EOpConvInt8ToInt; break; + case EbtUint: op = EOpConvUintToInt; break; + default: assert(0); + } + break; + case EbtUint: + switch (node->getType().getBasicType()) { + case EbtFloat: op = EOpConvFloatToUint; break; + case EbtFloat16: op = EOpConvFloat16ToUint; break; + case EbtUint8: op = EOpConvUint8ToUint; break; + case EbtInt8: op = EOpConvInt8ToUint; break; + case EbtInt: op = EOpConvIntToUint; break; + case EbtUint: op = EOpConvUintToInt8; break; + default: assert(0); + } + break; + case EbtInt8: + switch (node->getType().getBasicType()) { + case EbtFloat: op = EOpConvFloatToInt8; break; + case EbtFloat16: op = EOpConvFloat16ToInt8; break; + case EbtUint8: op = EOpConvUint8ToInt8; break; + case EbtInt: op = EOpConvIntToInt8; break; + case EbtUint: op = EOpConvUintToInt8; break; + default: assert(0); + } + break; + case EbtUint8: + switch (node->getType().getBasicType()) { + case EbtFloat: op = EOpConvFloatToUint8; break; + case EbtFloat16: op = EOpConvFloat16ToUint8; break; + case EbtInt8: op = EOpConvInt8ToUint8; break; + case EbtInt: op = EOpConvIntToUint8; break; + case EbtUint: op = EOpConvUintToUint8; break; + default: assert(0); + } + break; case EbtFloat: - assert(node->getType().getBasicType() == EbtFloat16); - node = intermediate.addUnaryNode(EOpConvFloat16ToFloat, node, node->getLoc(), type); + switch (node->getType().getBasicType()) { + case EbtFloat16: op = EOpConvFloat16ToFloat; break; + case EbtInt8: op = EOpConvInt8ToFloat; break; + case EbtUint8: op = EOpConvUint8ToFloat; break; + case EbtInt: op = EOpConvIntToFloat; break; + case EbtUint: op = EOpConvUintToFloat; break; + default: assert(0); + } break; case EbtFloat16: - assert(node->getType().getBasicType() == EbtFloat); - node = intermediate.addUnaryNode(EOpConvFloatToFloat16, node, node->getLoc(), type); + switch (node->getType().getBasicType()) { + case EbtFloat: op = EOpConvFloatToFloat16; break; + case EbtInt8: op = EOpConvInt8ToFloat16; break; + case EbtUint8: op = EOpConvUint8ToFloat16; break; + case EbtInt: op = EOpConvIntToFloat16; break; + case EbtUint: op = EOpConvUintToFloat16; break; + default: assert(0); + } break; } + + node = intermediate.addUnaryNode(op, node, node->getLoc(), type); // If it's a (non-specialization) constant, it must be folded. if (node->getAsUnaryNode()->getOperand()->getAsConstantUnion()) return node->getAsUnaryNode()->getOperand()->getAsConstantUnion()->fold(op, node->getType()); @@ -6996,6 +7256,8 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T return node; +#endif // GLSLANG_WEB + default: error(loc, "unsupported construction", "", ""); @@ -7037,6 +7299,23 @@ TIntermTyped* TParseContext::constructAggregate(TIntermNode* node, const TType& return converted; } +// If a memory qualifier is present in 'to', also make it present in 'from'. +void TParseContext::inheritMemoryQualifiers(const TQualifier& from, TQualifier& to) +{ +#ifndef GLSLANG_WEB + if (from.isReadOnly()) + to.readonly = from.readonly; + if (from.isWriteOnly()) + to.writeonly = from.writeonly; + if (from.coherent) + to.coherent = from.coherent; + if (from.volatil) + to.volatil = from.volatil; + if (from.restrict) + to.restrict = from.restrict; +#endif +} + // // Do everything needed to add an interface block. // @@ -7052,7 +7331,7 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con requireProfile(loc, ~EEsProfile, "array-of-array of block"); } - // fix and check for member storage qualifiers and types that don't belong within a block + // Inherit and check member storage qualifiers WRT to the block-level qualifier. for (unsigned int member = 0; member < typeList.size(); ++member) { TType& memberType = *typeList[member].type; TQualifier& memberQualifier = memberType.getQualifier(); @@ -7061,7 +7340,8 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con if (memberQualifier.storage != EvqTemporary && memberQualifier.storage != EvqGlobal && memberQualifier.storage != currentBlockQualifier.storage) error(memberLoc, "member storage qualifier cannot contradict block storage qualifier", memberType.getFieldName().c_str(), ""); memberQualifier.storage = currentBlockQualifier.storage; -#ifdef NV_EXTENSIONS +#ifndef GLSLANG_WEB + inheritMemoryQualifiers(currentBlockQualifier, memberQualifier); if (currentBlockQualifier.perPrimitiveNV) memberQualifier.perPrimitiveNV = currentBlockQualifier.perPrimitiveNV; if (currentBlockQualifier.perViewNV) @@ -7114,18 +7394,13 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con // Special case for "push_constant uniform", which has a default of std430, // contrary to normal uniform defaults, and can't have a default tracked for it. - if ((currentBlockQualifier.layoutPushConstant && !currentBlockQualifier.hasPacking()) -#ifdef NV_EXTENSIONS - || (currentBlockQualifier.layoutShaderRecordNV && !currentBlockQualifier.hasPacking()) -#endif - ) + if ((currentBlockQualifier.isPushConstant() && !currentBlockQualifier.hasPacking()) || + (currentBlockQualifier.isShaderRecordNV() && !currentBlockQualifier.hasPacking())) currentBlockQualifier.layoutPacking = ElpStd430; -#ifdef NV_EXTENSIONS // Special case for "taskNV in/out", which has a default of std430, - if (currentBlockQualifier.perTaskNV && !currentBlockQualifier.hasPacking()) + if (currentBlockQualifier.isTaskMemory() && !currentBlockQualifier.hasPacking()) currentBlockQualifier.layoutPacking = ElpStd430; -#endif // fix and check for member layout qualifiers @@ -7143,12 +7418,11 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con bool memberWithLocation = false; bool memberWithoutLocation = false; -#ifdef NV_EXTENSIONS bool memberWithPerViewQualifier = false; -#endif for (unsigned int member = 0; member < typeList.size(); ++member) { TQualifier& memberQualifier = typeList[member].type->getQualifier(); const TSourceLoc& memberLoc = typeList[member].loc; +#ifndef GLSLANG_WEB if (memberQualifier.hasStream()) { if (defaultQualification.layoutStream != memberQualifier.layoutStream) error(memberLoc, "member cannot contradict block", "stream", ""); @@ -7162,12 +7436,14 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con if (defaultQualification.layoutXfbBuffer != memberQualifier.layoutXfbBuffer) error(memberLoc, "member cannot contradict block (or what block inherited from global)", "xfb_buffer", ""); } +#endif if (memberQualifier.hasPacking()) error(memberLoc, "member of block cannot have a packing layout qualifier", typeList[member].type->getFieldName().c_str(), ""); if (memberQualifier.hasLocation()) { const char* feature = "location on block member"; switch (currentBlockQualifier.storage) { +#ifndef GLSLANG_WEB case EvqVaryingIn: case EvqVaryingOut: requireProfile(memberLoc, ECoreProfile | ECompatibilityProfile | EEsProfile, feature); @@ -7175,6 +7451,7 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con profileRequires(memberLoc, EEsProfile, 320, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, feature); memberWithLocation = true; break; +#endif default: error(memberLoc, "can only use in an in/out block", feature, ""); break; @@ -7191,11 +7468,9 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con error(memberLoc, "can only be used with std140, std430, or scalar layout packing", "offset/align", ""); } -#ifdef NV_EXTENSIONS if (memberQualifier.isPerView()) { memberWithPerViewQualifier = true; } -#endif TQualifier newMemberQualification = defaultQualification; mergeQualifiers(memberLoc, newMemberQualification, memberQualifier, false); @@ -7204,6 +7479,7 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con layoutMemberLocationArrayCheck(loc, memberWithLocation, arraySizes); +#ifndef GLSLANG_WEB // Ensure that the block has an XfbBuffer assigned. This is needed // because if the block has a XfbOffset assigned, then it is // assumed that it has implicitly assigned the current global @@ -7213,6 +7489,7 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con if (!currentBlockQualifier.hasXfbBuffer() && currentBlockQualifier.hasXfbOffset()) currentBlockQualifier.layoutXfbBuffer = globalOutputDefaults.layoutXfbBuffer; } +#endif // Process the members fixBlockLocations(loc, currentBlockQualifier, typeList, memberWithLocation, memberWithoutLocation); @@ -7221,10 +7498,10 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con for (unsigned int member = 0; member < typeList.size(); ++member) layoutTypeCheck(typeList[member].loc, *typeList[member].type); -#ifdef NV_EXTENSIONS +#ifndef GLSLANG_WEB if (memberWithPerViewQualifier) { for (unsigned int member = 0; member < typeList.size(); ++member) { - resizeMeshViewDimension(typeList[member].loc, *typeList[member].type); + checkAndResizeMeshViewDim(typeList[member].loc, *typeList[member].type, /*isBlockMember*/ true); } } #endif @@ -7240,10 +7517,11 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con TType blockType(&typeList, *blockName, currentBlockQualifier); if (arraySizes != nullptr) blockType.transferArraySizes(arraySizes); - else - ioArrayCheck(loc, blockType, instanceName ? *instanceName : *blockName); - if (currentBlockQualifier.layoutBufferReference) { +#ifndef GLSLANG_WEB + if (arraySizes == nullptr) + ioArrayCheck(loc, blockType, instanceName ? *instanceName : *blockName); + if (currentBlockQualifier.hasBufferReference()) { if (currentBlockQualifier.storage != EvqBuffer) error(loc, "can only be used with buffer", "buffer_reference", ""); @@ -7255,7 +7533,7 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con TVariable* blockNameVar = new TVariable(blockName, blockNameType, true); if (! symbolTable.insert(*blockNameVar)) { TSymbol* existingName = symbolTable.find(*blockName); - if (existingName->getType().getBasicType() == EbtReference && + if (existingName->getType().isReference() && existingName->getType().getReferentType()->getStruct() && existingName->getType().getReferentType()->getStruct()->size() == 0 && existingName->getType().getQualifier().storage == blockType.getQualifier().storage) { @@ -7267,7 +7545,9 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con if (!instanceName) { return; } - } else { + } else +#endif + { // // Don't make a user-defined type out of block name; that will cause an error // if the same block name gets reused in a different interface. @@ -7315,12 +7595,14 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con // Check for general layout qualifier errors layoutObjectCheck(loc, variable); +#ifndef GLSLANG_WEB // fix up if (isIoResizeArray(blockType)) { ioArraySymbolResizeList.push_back(&variable); checkIoArraysConsistency(loc, true); } else fixIoArraySize(loc, variable.getWritableType()); +#endif // Save it in the AST for linker use. trackLinkage(variable); @@ -7333,8 +7615,8 @@ void TParseContext::blockStageIoCheck(const TSourceLoc& loc, const TQualifier& q switch (qualifier.storage) { case EvqUniform: profileRequires(loc, EEsProfile, 300, nullptr, "uniform block"); - profileRequires(loc, ENoProfile, 140, nullptr, "uniform block"); - if (currentBlockQualifier.layoutPacking == ElpStd430 && ! currentBlockQualifier.layoutPushConstant) + profileRequires(loc, ENoProfile, 140, E_GL_ARB_uniform_buffer_object, "uniform block"); + if (currentBlockQualifier.layoutPacking == ElpStd430 && ! currentBlockQualifier.isPushConstant()) requireExtensions(loc, 1, &E_GL_EXT_scalar_block_layout, "std430 requires the buffer storage qualifier"); break; case EvqBuffer: @@ -7346,41 +7628,28 @@ void TParseContext::blockStageIoCheck(const TSourceLoc& loc, const TQualifier& q profileRequires(loc, ~EEsProfile, 150, E_GL_ARB_separate_shader_objects, "input block"); // It is a compile-time error to have an input block in a vertex shader or an output block in a fragment shader // "Compute shaders do not permit user-defined input variables..." - requireStage(loc, (EShLanguageMask)(EShLangTessControlMask|EShLangTessEvaluationMask|EShLangGeometryMask|EShLangFragmentMask -#ifdef NV_EXTENSIONS - |EShLangMeshNVMask -#endif - ), "input block"); + requireStage(loc, (EShLanguageMask)(EShLangTessControlMask|EShLangTessEvaluationMask|EShLangGeometryMask| + EShLangFragmentMask|EShLangMeshNVMask), "input block"); if (language == EShLangFragment) { profileRequires(loc, EEsProfile, 320, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, "fragment input block"); - } -#ifdef NV_EXTENSIONS - else if (language == EShLangMeshNV && ! qualifier.isTaskMemory()) { + } else if (language == EShLangMeshNV && ! qualifier.isTaskMemory()) { error(loc, "input blocks cannot be used in a mesh shader", "out", ""); } -#endif break; case EvqVaryingOut: profileRequires(loc, ~EEsProfile, 150, E_GL_ARB_separate_shader_objects, "output block"); - requireStage(loc, (EShLanguageMask)(EShLangVertexMask|EShLangTessControlMask|EShLangTessEvaluationMask|EShLangGeometryMask -#ifdef NV_EXTENSIONS - |EShLangMeshNVMask|EShLangTaskNVMask -#endif - ), "output block"); + requireStage(loc, (EShLanguageMask)(EShLangVertexMask|EShLangTessControlMask|EShLangTessEvaluationMask| + EShLangGeometryMask|EShLangMeshNVMask|EShLangTaskNVMask), "output block"); // ES 310 can have a block before shader_io is turned on, so skip this test for built-ins if (language == EShLangVertex && ! parsingBuiltins) { profileRequires(loc, EEsProfile, 320, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, "vertex output block"); - } -#ifdef NV_EXTENSIONS - else if (language == EShLangMeshNV && qualifier.isTaskMemory()) { + } else if (language == EShLangMeshNV && qualifier.isTaskMemory()) { error(loc, "can only use on input blocks in mesh shader", "taskNV", ""); - } - else if (language == EShLangTaskNV && ! qualifier.isTaskMemory()) { + } else if (language == EShLangTaskNV && ! qualifier.isTaskMemory()) { error(loc, "output blocks cannot be used in a task shader", "out", ""); } -#endif break; -#ifdef NV_EXTENSIONS +#ifndef GLSLANG_WEB case EvqPayloadNV: profileRequires(loc, ~EEsProfile, 460, E_GL_NV_ray_tracing, "rayPayloadNV block"); requireStage(loc, (EShLanguageMask)(EShLangRayGenNVMask | EShLangAnyHitNVMask | EShLangClosestHitNVMask | EShLangMissNVMask), @@ -7435,18 +7704,16 @@ void TParseContext::blockQualifierCheck(const TSourceLoc& loc, const TQualifier& error(loc, "cannot use interpolation qualifiers on an interface block", "flat/smooth/noperspective", ""); if (qualifier.centroid) error(loc, "cannot use centroid qualifier on an interface block", "centroid", ""); - if (qualifier.sample) + if (qualifier.isSample()) error(loc, "cannot use sample qualifier on an interface block", "sample", ""); if (qualifier.invariant) error(loc, "cannot use invariant qualifier on an interface block", "invariant", ""); - if (qualifier.layoutPushConstant) + if (qualifier.isPushConstant()) intermediate.addPushConstantCount(); -#ifdef NV_EXTENSIONS - if (qualifier.layoutShaderRecordNV) + if (qualifier.isShaderRecordNV()) intermediate.addShaderRecordNVCount(); - if (qualifier.perTaskNV) + if (qualifier.isTaskMemory()) intermediate.addTaskNVCount(); -#endif } // @@ -7495,6 +7762,7 @@ void TParseContext::fixBlockLocations(const TSourceLoc& loc, TQualifier& qualifi void TParseContext::fixXfbOffsets(TQualifier& qualifier, TTypeList& typeList) { +#ifndef GLSLANG_WEB // "If a block is qualified with xfb_offset, all its // members are assigned transform feedback buffer offsets. If a block is not qualified with xfb_offset, any // members of that block not qualified with an xfb_offset will not be assigned transform feedback buffer @@ -7507,24 +7775,18 @@ void TParseContext::fixXfbOffsets(TQualifier& qualifier, TTypeList& typeList) for (unsigned int member = 0; member < typeList.size(); ++member) { TQualifier& memberQualifier = typeList[member].type->getQualifier(); bool contains64BitType = false; -#ifdef AMD_EXTENSIONS bool contains32BitType = false; bool contains16BitType = false; int memberSize = intermediate.computeTypeXfbSize(*typeList[member].type, contains64BitType, contains32BitType, contains16BitType); -#else - int memberSize = intermediate.computeTypeXfbSize(*typeList[member].type, contains64BitType); -#endif // see if we need to auto-assign an offset to this member if (! memberQualifier.hasXfbOffset()) { // "if applied to an aggregate containing a double or 64-bit integer, the offset must also be a multiple of 8" if (contains64BitType) RoundToPow2(nextOffset, 8); -#ifdef AMD_EXTENSIONS else if (contains32BitType) RoundToPow2(nextOffset, 4); else if (contains16BitType) RoundToPow2(nextOffset, 2); -#endif memberQualifier.layoutXfbOffset = nextOffset; } else nextOffset = memberQualifier.layoutXfbOffset; @@ -7534,6 +7796,7 @@ void TParseContext::fixXfbOffsets(TQualifier& qualifier, TTypeList& typeList) // The above gave all block members an offset, so we can take it off the block now, // which will avoid double counting the offset usage. qualifier.layoutXfbOffset = TQualifier::layoutXfbOffsetEnd; +#endif } // Calculate and save the offset of each block member, using the recursively @@ -7610,7 +7873,7 @@ void TParseContext::addQualifierToExisting(const TSourceLoc& loc, TQualifier qua // a qualifier to an existing symbol. Detect this and create the block reference // type with an empty type list, which will be filled in later in // TParseContext::declareBlock. - if (!symbol && qualifier.layoutBufferReference) { + if (!symbol && qualifier.hasBufferReference()) { TTypeList typeList; TType blockType(&typeList, identifier, qualifier);; TType blockNameType(EbtReference, blockType, identifier); @@ -7650,10 +7913,10 @@ void TParseContext::addQualifierToExisting(const TSourceLoc& loc, TQualifier qua error(loc, "cannot change qualification after use", "invariant", ""); symbol->getWritableType().getQualifier().invariant = true; invariantCheck(loc, symbol->getType().getQualifier()); - } else if (qualifier.noContraction) { + } else if (qualifier.isNoContraction()) { if (intermediate.inIoAccessed(identifier)) error(loc, "cannot change qualification after use", "precise", ""); - symbol->getWritableType().getQualifier().noContraction = true; + symbol->getWritableType().getQualifier().setNoContraction(); } else if (qualifier.specConstant) { symbol->getWritableType().getQualifier().makeSpecConstant(); if (qualifier.hasSpecConstantId()) @@ -7676,7 +7939,7 @@ void TParseContext::invariantCheck(const TSourceLoc& loc, const TQualifier& qual bool pipeOut = qualifier.isPipeOutput(); bool pipeIn = qualifier.isPipeInput(); - if (version >= 300 || (profile != EEsProfile && version >= 420)) { + if (version >= 300 || (!isEsProfile() && version >= 420)) { if (! pipeOut) error(loc, "can only apply to an output", "invariant", ""); } else { @@ -7691,12 +7954,9 @@ void TParseContext::invariantCheck(const TSourceLoc& loc, const TQualifier& qual // void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, const TPublicType& publicType) { +#ifndef GLSLANG_WEB if (publicType.shaderQualifiers.vertices != TQualifier::layoutNotSet) { -#ifdef NV_EXTENSIONS assert(language == EShLangTessControl || language == EShLangGeometry || language == EShLangMeshNV); -#else - assert(language == EShLangTessControl || language == EShLangGeometry); -#endif const char* id = (language == EShLangTessControl) ? "vertices" : "max_vertices"; if (publicType.qualifier.storage != EvqVaryingOut) @@ -7707,7 +7967,6 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con if (language == EShLangTessControl) checkIoArraysConsistency(loc); } -#ifdef NV_EXTENSIONS if (publicType.shaderQualifiers.primitives != TQualifier::layoutNotSet) { assert(language == EShLangMeshNV); const char* id = "max_primitives"; @@ -7717,7 +7976,6 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con if (! intermediate.setPrimitives(publicType.shaderQualifiers.primitives)) error(loc, "cannot change previously set layout value", id, ""); } -#endif if (publicType.shaderQualifiers.invocations != TQualifier::layoutNotSet) { if (publicType.qualifier.storage != EvqVaryingIn) error(loc, "can only apply to 'in'", "invocations", ""); @@ -7734,12 +7992,10 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con case ElgTrianglesAdjacency: case ElgQuads: case ElgIsolines: -#ifdef NV_EXTENSIONS if (language == EShLangMeshNV) { error(loc, "cannot apply to input", TQualifier::getGeometryString(publicType.shaderQualifiers.geometry), ""); break; } -#endif if (intermediate.setInputPrimitive(publicType.shaderQualifiers.geometry)) { if (language == EShLangGeometry) checkIoArraysConsistency(loc); @@ -7751,14 +8007,12 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con } } else if (publicType.qualifier.storage == EvqVaryingOut) { switch (publicType.shaderQualifiers.geometry) { -#ifdef NV_EXTENSIONS case ElgLines: case ElgTriangles: if (language != EShLangMeshNV) { error(loc, "cannot apply to 'out'", TQualifier::getGeometryString(publicType.shaderQualifiers.geometry), ""); break; } -#endif // Fall through case ElgPoints: case ElgLineStrip: @@ -7792,8 +8046,9 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con else error(loc, "can only apply to 'in'", "point_mode", ""); } +#endif for (int i = 0; i < 3; ++i) { - if (publicType.shaderQualifiers.localSize[i] > 1) { + if (publicType.shaderQualifiers.localSizeNotDefault[i]) { if (publicType.qualifier.storage == EvqVaryingIn) { if (! intermediate.setLocalSize(i, publicType.shaderQualifiers.localSize[i])) error(loc, "cannot change previously set size", "local_size", ""); @@ -7809,7 +8064,7 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con if (intermediate.getLocalSize(i) > (unsigned int)max) error(loc, "too large; see gl_MaxComputeWorkGroupSize", "local_size", ""); } -#ifdef NV_EXTENSIONS +#ifndef GLSLANG_WEB else if (language == EShLangMeshNV) { switch (i) { case 0: max = resources.maxMeshWorkGroupSizeX_NV; break; @@ -7819,8 +8074,7 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con } if (intermediate.getLocalSize(i) > (unsigned int)max) error(loc, "too large; see gl_MaxMeshWorkGroupSizeNV", "local_size", ""); - } - else if (language == EShLangTaskNV) { + } else if (language == EShLangTaskNV) { switch (i) { case 0: max = resources.maxTaskWorkGroupSizeX_NV; break; case 1: max = resources.maxTaskWorkGroupSizeY_NV; break; @@ -7855,6 +8109,8 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con workGroupSize->getWritableType().getQualifier().specConstant = true; } } + +#ifndef GLSLANG_WEB if (publicType.shaderQualifiers.earlyFragmentTests) { if (publicType.qualifier.storage == EvqVaryingIn) intermediate.setEarlyFragmentTests(); @@ -7867,12 +8123,19 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con else error(loc, "can only apply to 'in'", "post_coverage_coverage", ""); } - if (publicType.shaderQualifiers.blendEquation) { + if (publicType.shaderQualifiers.hasBlendEquation()) { if (publicType.qualifier.storage != EvqVaryingOut) error(loc, "can only apply to 'out'", "blend equation", ""); } + if (publicType.shaderQualifiers.interlockOrdering) { + if (publicType.qualifier.storage == EvqVaryingIn) { + if (!intermediate.setInterlockOrdering(publicType.shaderQualifiers.interlockOrdering)) + error(loc, "cannot change previously set fragment shader interlock ordering", TQualifier::getInterlockOrderingString(publicType.shaderQualifiers.interlockOrdering), ""); + } + else + error(loc, "can only apply to 'in'", TQualifier::getInterlockOrderingString(publicType.shaderQualifiers.interlockOrdering), ""); + } -#ifdef NV_EXTENSIONS if (publicType.shaderQualifiers.layoutDerivativeGroupQuads && publicType.shaderQualifiers.layoutDerivativeGroupLinear) { error(loc, "cannot be both specified", "derivative_group_quadsNV and derivative_group_linearNV", ""); @@ -7917,6 +8180,7 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con qualifier.isInterpolation() || qualifier.precision != EpqNone) error(loc, "cannot use auxiliary, memory, interpolation, or precision qualifier in a default qualifier declaration (declaration with no type)", "qualifier", ""); + // "The offset qualifier can only be used on block members of blocks..." // "The align qualifier can only be used on blocks or block members..." if (qualifier.hasOffset() || @@ -7941,6 +8205,7 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con case EvqVaryingIn: break; case EvqVaryingOut: +#ifndef GLSLANG_WEB if (qualifier.hasStream()) globalOutputDefaults.layoutStream = qualifier.layoutStream; if (qualifier.hasXfbBuffer()) @@ -7949,6 +8214,7 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con if (! intermediate.setXfbBufferStride(globalOutputDefaults.layoutXfbBuffer, qualifier.layoutXfbStride)) error(loc, "all stride settings must match for xfb buffer", "xfb_stride", "%d", qualifier.layoutXfbBuffer); } +#endif break; default: error(loc, "default qualifier requires 'uniform', 'buffer', 'in', or 'out' storage qualification", "", ""); @@ -7961,16 +8227,14 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con error(loc, "cannot declare a default, use a full declaration", "location/component/index", ""); if (qualifier.hasXfbOffset()) error(loc, "cannot declare a default, use a full declaration", "xfb_offset", ""); - if (qualifier.layoutPushConstant) + if (qualifier.isPushConstant()) error(loc, "cannot declare a default, can only be used on a block", "push_constant", ""); - if (qualifier.layoutBufferReference) + if (qualifier.hasBufferReference()) error(loc, "cannot declare a default, can only be used on a block", "buffer_reference", ""); if (qualifier.hasSpecConstantId()) error(loc, "cannot declare a default, can only be used on a scalar", "constant_id", ""); -#ifdef NV_EXTENSIONS - if (qualifier.layoutShaderRecordNV) + if (qualifier.isShaderRecordNV()) error(loc, "cannot declare a default, can only be used on a block", "shaderRecordNV", ""); -#endif } // @@ -8037,7 +8301,7 @@ TIntermNode* TParseContext::addSwitch(const TSourceLoc& loc, TIntermTyped* expre // "it is an error to have no statement between a label and the end of the switch statement." // The specifications were updated to remove this (being ill-defined what a "statement" was), // so, this became a warning. However, 3.0 tests still check for the error. - if (profile == EEsProfile && version <= 300 && ! relaxedErrors()) + if (isEsProfile() && version <= 300 && ! relaxedErrors()) error(loc, "last case/default label not followed by statements", "switch", ""); else warn(loc, "last case/default label not followed by statements", "switch", ""); diff --git a/thirdparty/glslang/glslang/MachineIndependent/ParseHelper.h b/thirdparty/glslang/glslang/MachineIndependent/ParseHelper.h index a1ffe64dbf..39363f1a2a 100644 --- a/thirdparty/glslang/glslang/MachineIndependent/ParseHelper.h +++ b/thirdparty/glslang/glslang/MachineIndependent/ParseHelper.h @@ -85,6 +85,7 @@ public: statementNestingLevel(0), loopNestingLevel(0), structNestingLevel(0), controlFlowNestingLevel(0), postEntryPointReturn(false), contextPragma(true, false), + beginInvocationInterlockCount(0), endInvocationInterlockCount(0), parsingBuiltins(parsingBuiltins), scanContext(nullptr), ppContext(nullptr), limits(resources.limits), globalUniformBlock(nullptr), @@ -96,6 +97,7 @@ public: } virtual ~TParseContextBase() { } +#if !defined(GLSLANG_WEB) || defined(GLSLANG_WEB_DEVEL) virtual void C_DECL error(const TSourceLoc&, const char* szReason, const char* szToken, const char* szExtraInfoFormat, ...); virtual void C_DECL warn(const TSourceLoc&, const char* szReason, const char* szToken, @@ -104,6 +106,7 @@ public: const char* szExtraInfoFormat, ...); virtual void C_DECL ppWarn(const TSourceLoc&, const char* szReason, const char* szToken, const char* szExtraInfoFormat, ...); +#endif virtual void setLimits(const TBuiltInResource&) = 0; @@ -149,8 +152,10 @@ public: extensionCallback(line, extension, behavior); } +#ifdef ENABLE_HLSL // Manage the global uniform block (default uniforms in GLSL, $Global in HLSL) virtual void growGlobalUniformBlock(const TSourceLoc&, TType&, const TString& memberName, TTypeList* typeList = nullptr); +#endif // Potentially rename shader entry point function void renameShaderFunction(TString*& name) const @@ -182,6 +187,8 @@ public: // the statementNestingLevel the current switch statement is at, which must match the level of its case statements TList<int> switchLevel; struct TPragma contextPragma; + int beginInvocationInterlockCount; + int endInvocationInterlockCount; protected: TParseContextBase(TParseContextBase&); @@ -276,7 +283,7 @@ public: const TString* entryPoint = nullptr); virtual ~TParseContext(); - bool obeyPrecisionQualifiers() const { return precisionManager.respectingPrecisionQualifiers(); }; + bool obeyPrecisionQualifiers() const { return precisionManager.respectingPrecisionQualifiers(); } void setPrecisionDefaults(); void setLimits(const TBuiltInResource&) override; @@ -294,10 +301,12 @@ public: TIntermTyped* handleBracketDereference(const TSourceLoc&, TIntermTyped* base, TIntermTyped* index); void handleIndexLimits(const TSourceLoc&, TIntermTyped* base, TIntermTyped* index); +#ifndef GLSLANG_WEB void makeEditable(TSymbol*&) override; + void ioArrayCheck(const TSourceLoc&, const TType&, const TString& identifier); +#endif bool isIoResizeArray(const TType&) const; void fixIoArraySize(const TSourceLoc&, TType&); - void ioArrayCheck(const TSourceLoc&, const TType&, const TString& identifier); void handleIoResizeArrayAccess(const TSourceLoc&, TIntermTyped* base); void checkIoArraysConsistency(const TSourceLoc&, bool tailOnly = false); int getIoArrayImplicitSize(const TQualifier&, TString* featureString = nullptr) const; @@ -401,6 +410,7 @@ public: TIntermTyped* addConstructor(const TSourceLoc&, TIntermNode*, const TType&); TIntermTyped* constructAggregate(TIntermNode*, const TType&, int, const TSourceLoc&); TIntermTyped* constructBuiltIn(const TType&, TOperator, TIntermTyped*, const TSourceLoc&, bool subset); + void inheritMemoryQualifiers(const TQualifier& from, TQualifier& to); void declareBlock(const TSourceLoc&, TTypeList& typeList, const TString* instanceName = 0, TArraySizes* arraySizes = 0); void blockStageIoCheck(const TSourceLoc&, const TQualifier&); void blockQualifierCheck(const TSourceLoc&, const TQualifier&, bool instanceName); @@ -414,6 +424,7 @@ public: void wrapupSwitchSubsequence(TIntermAggregate* statements, TIntermNode* branchNode); TIntermNode* addSwitch(const TSourceLoc&, TIntermTyped* expression, TIntermAggregate* body); +#ifndef GLSLANG_WEB TAttributeType attributeFromName(const TString& name) const; TAttributes* makeAttributes(const TString& identifier) const; TAttributes* makeAttributes(const TString& identifier, TIntermNode* node) const; @@ -422,11 +433,11 @@ public: // Determine selection control from attributes void handleSelectionAttributes(const TAttributes& attributes, TIntermNode*); void handleSwitchAttributes(const TAttributes& attributes, TIntermNode*); - // Determine loop control from attributes void handleLoopAttributes(const TAttributes& attributes, TIntermNode*); +#endif - void resizeMeshViewDimension(const TSourceLoc&, TType&); + void checkAndResizeMeshViewDim(const TSourceLoc&, TType&, bool isBlockMember); protected: void nonInitConstCheck(const TSourceLoc&, TString& identifier, TType& type); @@ -438,7 +449,9 @@ protected: bool isRuntimeLength(const TIntermTyped&) const; TIntermNode* executeInitializer(const TSourceLoc&, TIntermTyped* initializer, TVariable* variable); TIntermTyped* convertInitializerList(const TSourceLoc&, const TType&, TIntermTyped* initializer); +#ifndef GLSLANG_WEB void finish() override; +#endif public: // @@ -464,10 +477,11 @@ protected: TQualifier globalUniformDefaults; TQualifier globalInputDefaults; TQualifier globalOutputDefaults; - int* atomicUintOffsets; // to become an array of the right size to hold an offset per binding point TString currentCaller; // name of last function body entered (not valid when at global scope) - TIdSetType inductiveLoopIds; +#ifndef GLSLANG_WEB + int* atomicUintOffsets; // to become an array of the right size to hold an offset per binding point bool anyIndexLimits; + TIdSetType inductiveLoopIds; TVector<TIntermTyped*> needsIndexLimitationChecking; // @@ -503,6 +517,7 @@ protected: // array-sizing declarations // TVector<TSymbol*> ioArraySymbolResizeList; +#endif }; } // end namespace glslang diff --git a/thirdparty/glslang/glslang/MachineIndependent/Scan.cpp b/thirdparty/glslang/glslang/MachineIndependent/Scan.cpp index 482f6ba271..fd18fd4d7d 100644 --- a/thirdparty/glslang/glslang/MachineIndependent/Scan.cpp +++ b/thirdparty/glslang/glslang/MachineIndependent/Scan.cpp @@ -324,7 +324,9 @@ struct str_hash // A single global usable by all threads, by all versions, by all languages. // After a single process-level initialization, this is read only and thread safe std::unordered_map<const char*, int, str_hash, str_eq>* KeywordMap = nullptr; +#ifndef GLSLANG_WEB std::unordered_set<const char*, str_hash, str_eq>* ReservedSet = nullptr; +#endif }; @@ -341,9 +343,15 @@ void TScanContext::fillInKeywordMap() (*KeywordMap)["const"] = CONST; (*KeywordMap)["uniform"] = UNIFORM; - (*KeywordMap)["nonuniformEXT"] = NONUNIFORM; + (*KeywordMap)["buffer"] = BUFFER; (*KeywordMap)["in"] = IN; (*KeywordMap)["out"] = OUT; + (*KeywordMap)["smooth"] = SMOOTH; + (*KeywordMap)["flat"] = FLAT; + (*KeywordMap)["centroid"] = CENTROID; + (*KeywordMap)["invariant"] = INVARIANT; + (*KeywordMap)["packed"] = PACKED; + (*KeywordMap)["resource"] = RESOURCE; (*KeywordMap)["inout"] = INOUT; (*KeywordMap)["struct"] = STRUCT; (*KeywordMap)["break"] = BREAK; @@ -376,9 +384,33 @@ void TScanContext::fillInKeywordMap() (*KeywordMap)["mat4"] = MAT4; (*KeywordMap)["true"] = BOOLCONSTANT; (*KeywordMap)["false"] = BOOLCONSTANT; + (*KeywordMap)["layout"] = LAYOUT; + (*KeywordMap)["shared"] = SHARED; + (*KeywordMap)["highp"] = HIGH_PRECISION; + (*KeywordMap)["mediump"] = MEDIUM_PRECISION; + (*KeywordMap)["lowp"] = LOW_PRECISION; + (*KeywordMap)["superp"] = SUPERP; + (*KeywordMap)["precision"] = PRECISION; + (*KeywordMap)["mat2x2"] = MAT2X2; + (*KeywordMap)["mat2x3"] = MAT2X3; + (*KeywordMap)["mat2x4"] = MAT2X4; + (*KeywordMap)["mat3x2"] = MAT3X2; + (*KeywordMap)["mat3x3"] = MAT3X3; + (*KeywordMap)["mat3x4"] = MAT3X4; + (*KeywordMap)["mat4x2"] = MAT4X2; + (*KeywordMap)["mat4x3"] = MAT4X3; + (*KeywordMap)["mat4x4"] = MAT4X4; + (*KeywordMap)["uint"] = UINT; + (*KeywordMap)["uvec2"] = UVEC2; + (*KeywordMap)["uvec3"] = UVEC3; + (*KeywordMap)["uvec4"] = UVEC4; + +#ifndef GLSLANG_WEB + (*KeywordMap)["nonuniformEXT"] = NONUNIFORM; + (*KeywordMap)["demote"] = DEMOTE; (*KeywordMap)["attribute"] = ATTRIBUTE; (*KeywordMap)["varying"] = VARYING; - (*KeywordMap)["buffer"] = BUFFER; + (*KeywordMap)["noperspective"] = NOPERSPECTIVE; (*KeywordMap)["coherent"] = COHERENT; (*KeywordMap)["devicecoherent"] = DEVICECOHERENT; (*KeywordMap)["queuefamilycoherent"] = QUEUEFAMILYCOHERENT; @@ -390,24 +422,9 @@ void TScanContext::fillInKeywordMap() (*KeywordMap)["writeonly"] = WRITEONLY; (*KeywordMap)["atomic_uint"] = ATOMIC_UINT; (*KeywordMap)["volatile"] = VOLATILE; - (*KeywordMap)["layout"] = LAYOUT; - (*KeywordMap)["shared"] = SHARED; (*KeywordMap)["patch"] = PATCH; (*KeywordMap)["sample"] = SAMPLE; (*KeywordMap)["subroutine"] = SUBROUTINE; - (*KeywordMap)["highp"] = HIGH_PRECISION; - (*KeywordMap)["mediump"] = MEDIUM_PRECISION; - (*KeywordMap)["lowp"] = LOW_PRECISION; - (*KeywordMap)["precision"] = PRECISION; - (*KeywordMap)["mat2x2"] = MAT2X2; - (*KeywordMap)["mat2x3"] = MAT2X3; - (*KeywordMap)["mat2x4"] = MAT2X4; - (*KeywordMap)["mat3x2"] = MAT3X2; - (*KeywordMap)["mat3x3"] = MAT3X3; - (*KeywordMap)["mat3x4"] = MAT3X4; - (*KeywordMap)["mat4x2"] = MAT4X2; - (*KeywordMap)["mat4x3"] = MAT4X3; - (*KeywordMap)["mat4x4"] = MAT4X4; (*KeywordMap)["dmat2"] = DMAT2; (*KeywordMap)["dmat3"] = DMAT3; (*KeywordMap)["dmat4"] = DMAT4; @@ -457,11 +474,6 @@ void TScanContext::fillInKeywordMap() (*KeywordMap)["dvec2"] = DVEC2; (*KeywordMap)["dvec3"] = DVEC3; (*KeywordMap)["dvec4"] = DVEC4; - (*KeywordMap)["uint"] = UINT; - (*KeywordMap)["uvec2"] = UVEC2; - (*KeywordMap)["uvec3"] = UVEC3; - (*KeywordMap)["uvec4"] = UVEC4; - (*KeywordMap)["int64_t"] = INT64_T; (*KeywordMap)["uint64_t"] = UINT64_T; (*KeywordMap)["i64vec2"] = I64VEC2; @@ -548,19 +560,10 @@ void TScanContext::fillInKeywordMap() (*KeywordMap)["f64mat4x2"] = F64MAT4X2; (*KeywordMap)["f64mat4x3"] = F64MAT4X3; (*KeywordMap)["f64mat4x4"] = F64MAT4X4; +#endif (*KeywordMap)["sampler2D"] = SAMPLER2D; (*KeywordMap)["samplerCube"] = SAMPLERCUBE; - (*KeywordMap)["samplerCubeArray"] = SAMPLERCUBEARRAY; - (*KeywordMap)["samplerCubeArrayShadow"] = SAMPLERCUBEARRAYSHADOW; - (*KeywordMap)["isamplerCubeArray"] = ISAMPLERCUBEARRAY; - (*KeywordMap)["usamplerCubeArray"] = USAMPLERCUBEARRAY; - (*KeywordMap)["sampler1DArrayShadow"] = SAMPLER1DARRAYSHADOW; - (*KeywordMap)["isampler1DArray"] = ISAMPLER1DARRAY; - (*KeywordMap)["usampler1D"] = USAMPLER1D; - (*KeywordMap)["isampler1D"] = ISAMPLER1D; - (*KeywordMap)["usampler1DArray"] = USAMPLER1DARRAY; - (*KeywordMap)["samplerBuffer"] = SAMPLERBUFFER; (*KeywordMap)["samplerCubeShadow"] = SAMPLERCUBESHADOW; (*KeywordMap)["sampler2DArray"] = SAMPLER2DARRAY; (*KeywordMap)["sampler2DArrayShadow"] = SAMPLER2DARRAYSHADOW; @@ -572,6 +575,39 @@ void TScanContext::fillInKeywordMap() (*KeywordMap)["usampler3D"] = USAMPLER3D; (*KeywordMap)["usamplerCube"] = USAMPLERCUBE; (*KeywordMap)["usampler2DArray"] = USAMPLER2DARRAY; + (*KeywordMap)["sampler3D"] = SAMPLER3D; + (*KeywordMap)["sampler2DShadow"] = SAMPLER2DSHADOW; + + (*KeywordMap)["texture2D"] = TEXTURE2D; + (*KeywordMap)["textureCube"] = TEXTURECUBE; + (*KeywordMap)["texture2DArray"] = TEXTURE2DARRAY; + (*KeywordMap)["itexture2D"] = ITEXTURE2D; + (*KeywordMap)["itexture3D"] = ITEXTURE3D; + (*KeywordMap)["itextureCube"] = ITEXTURECUBE; + (*KeywordMap)["itexture2DArray"] = ITEXTURE2DARRAY; + (*KeywordMap)["utexture2D"] = UTEXTURE2D; + (*KeywordMap)["utexture3D"] = UTEXTURE3D; + (*KeywordMap)["utextureCube"] = UTEXTURECUBE; + (*KeywordMap)["utexture2DArray"] = UTEXTURE2DARRAY; + (*KeywordMap)["texture3D"] = TEXTURE3D; + + (*KeywordMap)["sampler"] = SAMPLER; + (*KeywordMap)["samplerShadow"] = SAMPLERSHADOW; + +#ifndef GLSLANG_WEB + (*KeywordMap)["textureCubeArray"] = TEXTURECUBEARRAY; + (*KeywordMap)["itextureCubeArray"] = ITEXTURECUBEARRAY; + (*KeywordMap)["utextureCubeArray"] = UTEXTURECUBEARRAY; + (*KeywordMap)["samplerCubeArray"] = SAMPLERCUBEARRAY; + (*KeywordMap)["samplerCubeArrayShadow"] = SAMPLERCUBEARRAYSHADOW; + (*KeywordMap)["isamplerCubeArray"] = ISAMPLERCUBEARRAY; + (*KeywordMap)["usamplerCubeArray"] = USAMPLERCUBEARRAY; + (*KeywordMap)["sampler1DArrayShadow"] = SAMPLER1DARRAYSHADOW; + (*KeywordMap)["isampler1DArray"] = ISAMPLER1DARRAY; + (*KeywordMap)["usampler1D"] = USAMPLER1D; + (*KeywordMap)["isampler1D"] = ISAMPLER1D; + (*KeywordMap)["usampler1DArray"] = USAMPLER1DARRAY; + (*KeywordMap)["samplerBuffer"] = SAMPLERBUFFER; (*KeywordMap)["isampler2DRect"] = ISAMPLER2DRECT; (*KeywordMap)["usampler2DRect"] = USAMPLER2DRECT; (*KeywordMap)["isamplerBuffer"] = ISAMPLERBUFFER; @@ -584,8 +620,6 @@ void TScanContext::fillInKeywordMap() (*KeywordMap)["usampler2DMSArray"] = USAMPLER2DMSARRAY; (*KeywordMap)["sampler1D"] = SAMPLER1D; (*KeywordMap)["sampler1DShadow"] = SAMPLER1DSHADOW; - (*KeywordMap)["sampler3D"] = SAMPLER3D; - (*KeywordMap)["sampler2DShadow"] = SAMPLER2DSHADOW; (*KeywordMap)["sampler2DRect"] = SAMPLER2DRECT; (*KeywordMap)["sampler2DRectShadow"] = SAMPLER2DRECTSHADOW; (*KeywordMap)["sampler1DArray"] = SAMPLER1DARRAY; @@ -594,28 +628,11 @@ void TScanContext::fillInKeywordMap() (*KeywordMap)["__samplerExternal2DY2YEXT"] = SAMPLEREXTERNAL2DY2YEXT; // GL_EXT_YUV_target - (*KeywordMap)["sampler"] = SAMPLER; - (*KeywordMap)["samplerShadow"] = SAMPLERSHADOW; - - (*KeywordMap)["texture2D"] = TEXTURE2D; - (*KeywordMap)["textureCube"] = TEXTURECUBE; - (*KeywordMap)["textureCubeArray"] = TEXTURECUBEARRAY; - (*KeywordMap)["itextureCubeArray"] = ITEXTURECUBEARRAY; - (*KeywordMap)["utextureCubeArray"] = UTEXTURECUBEARRAY; (*KeywordMap)["itexture1DArray"] = ITEXTURE1DARRAY; (*KeywordMap)["utexture1D"] = UTEXTURE1D; (*KeywordMap)["itexture1D"] = ITEXTURE1D; (*KeywordMap)["utexture1DArray"] = UTEXTURE1DARRAY; (*KeywordMap)["textureBuffer"] = TEXTUREBUFFER; - (*KeywordMap)["texture2DArray"] = TEXTURE2DARRAY; - (*KeywordMap)["itexture2D"] = ITEXTURE2D; - (*KeywordMap)["itexture3D"] = ITEXTURE3D; - (*KeywordMap)["itextureCube"] = ITEXTURECUBE; - (*KeywordMap)["itexture2DArray"] = ITEXTURE2DARRAY; - (*KeywordMap)["utexture2D"] = UTEXTURE2D; - (*KeywordMap)["utexture3D"] = UTEXTURE3D; - (*KeywordMap)["utextureCube"] = UTEXTURECUBE; - (*KeywordMap)["utexture2DArray"] = UTEXTURE2DARRAY; (*KeywordMap)["itexture2DRect"] = ITEXTURE2DRECT; (*KeywordMap)["utexture2DRect"] = UTEXTURE2DRECT; (*KeywordMap)["itextureBuffer"] = ITEXTUREBUFFER; @@ -627,7 +644,6 @@ void TScanContext::fillInKeywordMap() (*KeywordMap)["itexture2DMSArray"] = ITEXTURE2DMSARRAY; (*KeywordMap)["utexture2DMSArray"] = UTEXTURE2DMSARRAY; (*KeywordMap)["texture1D"] = TEXTURE1D; - (*KeywordMap)["texture3D"] = TEXTURE3D; (*KeywordMap)["texture2DRect"] = TEXTURE2DRECT; (*KeywordMap)["texture1DArray"] = TEXTURE1DARRAY; @@ -638,7 +654,6 @@ void TScanContext::fillInKeywordMap() (*KeywordMap)["usubpassInput"] = USUBPASSINPUT; (*KeywordMap)["usubpassInputMS"] = USUBPASSINPUTMS; -#ifdef AMD_EXTENSIONS (*KeywordMap)["f16sampler1D"] = F16SAMPLER1D; (*KeywordMap)["f16sampler2D"] = F16SAMPLER2D; (*KeywordMap)["f16sampler3D"] = F16SAMPLER3D; @@ -684,25 +699,10 @@ void TScanContext::fillInKeywordMap() (*KeywordMap)["f16subpassInput"] = F16SUBPASSINPUT; (*KeywordMap)["f16subpassInputMS"] = F16SUBPASSINPUTMS; -#endif - - (*KeywordMap)["noperspective"] = NOPERSPECTIVE; - (*KeywordMap)["smooth"] = SMOOTH; - (*KeywordMap)["flat"] = FLAT; -#ifdef AMD_EXTENSIONS (*KeywordMap)["__explicitInterpAMD"] = EXPLICITINTERPAMD; -#endif - (*KeywordMap)["centroid"] = CENTROID; -#ifdef NV_EXTENSIONS (*KeywordMap)["pervertexNV"] = PERVERTEXNV; -#endif (*KeywordMap)["precise"] = PRECISE; - (*KeywordMap)["invariant"] = INVARIANT; - (*KeywordMap)["packed"] = PACKED; - (*KeywordMap)["resource"] = RESOURCE; - (*KeywordMap)["superp"] = SUPERP; -#ifdef NV_EXTENSIONS (*KeywordMap)["rayPayloadNV"] = PAYLOADNV; (*KeywordMap)["rayPayloadInNV"] = PAYLOADINNV; (*KeywordMap)["hitAttributeNV"] = HITATTRNV; @@ -712,9 +712,10 @@ void TScanContext::fillInKeywordMap() (*KeywordMap)["perprimitiveNV"] = PERPRIMITIVENV; (*KeywordMap)["perviewNV"] = PERVIEWNV; (*KeywordMap)["taskNV"] = PERTASKNV; -#endif (*KeywordMap)["fcoopmatNV"] = FCOOPMATNV; + (*KeywordMap)["icoopmatNV"] = ICOOPMATNV; + (*KeywordMap)["ucoopmatNV"] = UCOOPMATNV; ReservedSet = new std::unordered_set<const char*, str_hash, str_eq>; @@ -755,14 +756,17 @@ void TScanContext::fillInKeywordMap() ReservedSet->insert("cast"); ReservedSet->insert("namespace"); ReservedSet->insert("using"); +#endif } void TScanContext::deleteKeywordMap() { delete KeywordMap; KeywordMap = nullptr; +#ifndef GLSLANG_WEB delete ReservedSet; ReservedSet = nullptr; +#endif } // Called by yylex to get the next token. @@ -841,13 +845,15 @@ int TScanContext::tokenize(TPpContext* pp, TParserToken& token) case PpAtomConstInt: parserToken->sType.lex.i = ppToken.ival; return INTCONSTANT; case PpAtomConstUint: parserToken->sType.lex.i = ppToken.ival; return UINTCONSTANT; + case PpAtomConstFloat: parserToken->sType.lex.d = ppToken.dval; return FLOATCONSTANT; +#ifndef GLSLANG_WEB case PpAtomConstInt16: parserToken->sType.lex.i = ppToken.ival; return INT16CONSTANT; case PpAtomConstUint16: parserToken->sType.lex.i = ppToken.ival; return UINT16CONSTANT; case PpAtomConstInt64: parserToken->sType.lex.i64 = ppToken.i64val; return INT64CONSTANT; case PpAtomConstUint64: parserToken->sType.lex.i64 = ppToken.i64val; return UINT64CONSTANT; - case PpAtomConstFloat: parserToken->sType.lex.d = ppToken.dval; return FLOATCONSTANT; case PpAtomConstDouble: parserToken->sType.lex.d = ppToken.dval; return DOUBLECONSTANT; case PpAtomConstFloat16: parserToken->sType.lex.d = ppToken.dval; return FLOAT16CONSTANT; +#endif case PpAtomIdentifier: { int token = tokenizeIdentifier(); @@ -869,8 +875,10 @@ int TScanContext::tokenize(TPpContext* pp, TParserToken& token) int TScanContext::tokenizeIdentifier() { +#ifndef GLSLANG_WEB if (ReservedSet->find(tokenText) != ReservedSet->end()) return reservedWord(); +#endif auto it = KeywordMap->find(tokenText); if (it == KeywordMap->end()) { @@ -897,20 +905,21 @@ int TScanContext::tokenizeIdentifier() case CASE: return keyword; + case BUFFER: + afterBuffer = true; + if ((parseContext.isEsProfile() && parseContext.version < 310) || + (!parseContext.isEsProfile() && parseContext.version < 430)) + return identifierOrType(); + return keyword; + case STRUCT: afterStruct = true; return keyword; - case NONUNIFORM: - if (parseContext.extensionTurnedOn(E_GL_EXT_nonuniform_qualifier)) - return keyword; - else - return identifierOrType(); - case SWITCH: case DEFAULT: - if ((parseContext.profile == EEsProfile && parseContext.version < 300) || - (parseContext.profile != EEsProfile && parseContext.version < 130)) + if ((parseContext.isEsProfile() && parseContext.version < 300) || + (!parseContext.isEsProfile() && parseContext.version < 130)) reservedWord(); return keyword; @@ -942,20 +951,59 @@ int TScanContext::tokenizeIdentifier() parserToken->sType.lex.b = false; return keyword; - case ATTRIBUTE: - case VARYING: - if (parseContext.profile == EEsProfile && parseContext.version >= 300) + case SMOOTH: + if ((parseContext.isEsProfile() && parseContext.version < 300) || + (!parseContext.isEsProfile() && parseContext.version < 130)) + return identifierOrType(); + return keyword; + case FLAT: + if (parseContext.isEsProfile() && parseContext.version < 300) reservedWord(); + else if (!parseContext.isEsProfile() && parseContext.version < 130) + return identifierOrType(); return keyword; - - case BUFFER: - afterBuffer = true; - if ((parseContext.profile == EEsProfile && parseContext.version < 310) || - (parseContext.profile != EEsProfile && parseContext.version < 430)) + case CENTROID: + if (parseContext.version < 120) + return identifierOrType(); + return keyword; + case INVARIANT: + if (!parseContext.isEsProfile() && parseContext.version < 120) return identifierOrType(); return keyword; + case PACKED: + if ((parseContext.isEsProfile() && parseContext.version < 300) || + (!parseContext.isEsProfile() && parseContext.version < 330)) + return reservedWord(); + return identifierOrType(); + + case RESOURCE: + { + bool reserved = (parseContext.isEsProfile() && parseContext.version >= 300) || + (!parseContext.isEsProfile() && parseContext.version >= 420); + return identifierOrReserved(reserved); + } + case SUPERP: + { + bool reserved = parseContext.isEsProfile() || parseContext.version >= 130; + return identifierOrReserved(reserved); + } -#ifdef NV_EXTENSIONS +#ifndef GLSLANG_WEB + case NOPERSPECTIVE: + if (parseContext.extensionTurnedOn(E_GL_NV_shader_noperspective_interpolation)) + return keyword; + return es30ReservedFromGLSL(130); + + case NONUNIFORM: + if (parseContext.extensionTurnedOn(E_GL_EXT_nonuniform_qualifier)) + return keyword; + else + return identifierOrType(); + case ATTRIBUTE: + case VARYING: + if (parseContext.isEsProfile() && parseContext.version >= 300) + reservedWord(); + return keyword; case PAYLOADNV: case PAYLOADINNV: case HITATTRNV: @@ -963,14 +1011,11 @@ int TScanContext::tokenizeIdentifier() case CALLDATAINNV: case ACCSTRUCTNV: if (parseContext.symbolTable.atBuiltInLevel() || - (parseContext.profile != EEsProfile && parseContext.version >= 460 - && parseContext.extensionTurnedOn(E_GL_NV_ray_tracing))) + parseContext.extensionTurnedOn(E_GL_NV_ray_tracing)) return keyword; return identifierOrType(); -#endif - case ATOMIC_UINT: - if ((parseContext.profile == EEsProfile && parseContext.version >= 310) || + if ((parseContext.isEsProfile() && parseContext.version >= 310) || parseContext.extensionTurnedOn(E_GL_ARB_shader_atomic_counters)) return keyword; return es30ReservedFromGLSL(420); @@ -984,53 +1029,51 @@ int TScanContext::tokenizeIdentifier() case RESTRICT: case READONLY: case WRITEONLY: - if (parseContext.profile == EEsProfile && parseContext.version >= 310) + if (parseContext.isEsProfile() && parseContext.version >= 310) return keyword; return es30ReservedFromGLSL(parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store) ? 130 : 420); - case VOLATILE: - if (parseContext.profile == EEsProfile && parseContext.version >= 310) + if (parseContext.isEsProfile() && parseContext.version >= 310) return keyword; - if (! parseContext.symbolTable.atBuiltInLevel() && (parseContext.profile == EEsProfile || + if (! parseContext.symbolTable.atBuiltInLevel() && (parseContext.isEsProfile() || (parseContext.version < 420 && ! parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store)))) reservedWord(); return keyword; - - case LAYOUT: - { - const int numLayoutExts = 2; - const char* layoutExts[numLayoutExts] = { E_GL_ARB_shading_language_420pack, - E_GL_ARB_explicit_attrib_location }; - if ((parseContext.profile == EEsProfile && parseContext.version < 300) || - (parseContext.profile != EEsProfile && parseContext.version < 140 && - ! parseContext.extensionsTurnedOn(numLayoutExts, layoutExts))) - return identifierOrType(); - return keyword; - } - case SHARED: - if ((parseContext.profile == EEsProfile && parseContext.version < 300) || - (parseContext.profile != EEsProfile && parseContext.version < 140)) - return identifierOrType(); - return keyword; - case PATCH: if (parseContext.symbolTable.atBuiltInLevel() || - (parseContext.profile == EEsProfile && + (parseContext.isEsProfile() && (parseContext.version >= 320 || parseContext.extensionsTurnedOn(Num_AEP_tessellation_shader, AEP_tessellation_shader))) || - (parseContext.profile != EEsProfile && parseContext.extensionTurnedOn(E_GL_ARB_tessellation_shader))) + (!parseContext.isEsProfile() && parseContext.extensionTurnedOn(E_GL_ARB_tessellation_shader))) return keyword; return es30ReservedFromGLSL(400); case SAMPLE: - if ((parseContext.profile == EEsProfile && parseContext.version >= 320) || + if ((parseContext.isEsProfile() && parseContext.version >= 320) || parseContext.extensionsTurnedOn(1, &E_GL_OES_shader_multisample_interpolation)) return keyword; return es30ReservedFromGLSL(400); case SUBROUTINE: return es30ReservedFromGLSL(400); +#endif + case SHARED: + if ((parseContext.isEsProfile() && parseContext.version < 300) || + (!parseContext.isEsProfile() && parseContext.version < 140)) + return identifierOrType(); + return keyword; + case LAYOUT: + { + const int numLayoutExts = 2; + const char* layoutExts[numLayoutExts] = { E_GL_ARB_shading_language_420pack, + E_GL_ARB_explicit_attrib_location }; + if ((parseContext.isEsProfile() && parseContext.version < 300) || + (!parseContext.isEsProfile() && parseContext.version < 140 && + ! parseContext.extensionsTurnedOn(numLayoutExts, layoutExts))) + return identifierOrType(); + return keyword; + } case HIGH_PRECISION: case MEDIUM_PRECISION: @@ -1049,6 +1092,7 @@ int TScanContext::tokenizeIdentifier() case MAT4X4: return matNxM(); +#ifndef GLSLANG_WEB case DMAT2: case DMAT3: case DMAT4: @@ -1079,7 +1123,7 @@ int TScanContext::tokenizeIdentifier() case IIMAGEBUFFER: case UIMAGEBUFFER: afterType = true; - if ((parseContext.profile == EEsProfile && parseContext.version >= 320) || + if ((parseContext.isEsProfile() && parseContext.version >= 320) || parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer)) return keyword; return firstGenerationImage(false); @@ -1103,7 +1147,7 @@ int TScanContext::tokenizeIdentifier() case IIMAGECUBEARRAY: case UIMAGECUBEARRAY: afterType = true; - if ((parseContext.profile == EEsProfile && parseContext.version >= 320) || + if ((parseContext.isEsProfile() && parseContext.version >= 320) || parseContext.extensionsTurnedOn(Num_AEP_texture_cube_map_array, AEP_texture_cube_map_array)) return keyword; return secondGenerationImage(); @@ -1122,7 +1166,10 @@ int TScanContext::tokenizeIdentifier() case DVEC3: case DVEC4: afterType = true; - if (parseContext.profile == EEsProfile || parseContext.version < 400) + if (parseContext.isEsProfile() || parseContext.version < 150 || + (!parseContext.symbolTable.atBuiltInLevel() && + parseContext.version < 400 && + !parseContext.extensionTurnedOn(E_GL_ARB_gpu_shader_fp64))) reservedWord(); return keyword; @@ -1136,10 +1183,9 @@ int TScanContext::tokenizeIdentifier() case U64VEC4: afterType = true; if (parseContext.symbolTable.atBuiltInLevel() || - (parseContext.profile != EEsProfile && parseContext.version >= 450 && - (parseContext.extensionTurnedOn(E_GL_ARB_gpu_shader_int64) || - parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) || - parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int64)))) + parseContext.extensionTurnedOn(E_GL_ARB_gpu_shader_int64) || + parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) || + parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int64)) return keyword; return identifierOrType(); @@ -1153,10 +1199,9 @@ int TScanContext::tokenizeIdentifier() case U8VEC4: afterType = true; if (parseContext.symbolTable.atBuiltInLevel() || - ((parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) || - parseContext.extensionTurnedOn(E_GL_EXT_shader_8bit_storage) || - parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int8)) && - parseContext.profile != EEsProfile && parseContext.version >= 450)) + parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) || + parseContext.extensionTurnedOn(E_GL_EXT_shader_8bit_storage) || + parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int8)) return keyword; return identifierOrType(); @@ -1170,14 +1215,10 @@ int TScanContext::tokenizeIdentifier() case U16VEC4: afterType = true; if (parseContext.symbolTable.atBuiltInLevel() || - (parseContext.profile != EEsProfile && parseContext.version >= 450 && - ( -#ifdef AMD_EXTENSIONS - parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_int16) || -#endif - parseContext.extensionTurnedOn(E_GL_EXT_shader_16bit_storage) || - parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) || - parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int16)))) + parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_int16) || + parseContext.extensionTurnedOn(E_GL_EXT_shader_16bit_storage) || + parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) || + parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int16)) return keyword; return identifierOrType(); case INT32_T: @@ -1190,9 +1231,8 @@ int TScanContext::tokenizeIdentifier() case U32VEC4: afterType = true; if (parseContext.symbolTable.atBuiltInLevel() || - ((parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) || - parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int32)) && - parseContext.profile != EEsProfile && parseContext.version >= 450)) + parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) || + parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int32)) return keyword; return identifierOrType(); case FLOAT32_T: @@ -1213,9 +1253,8 @@ int TScanContext::tokenizeIdentifier() case F32MAT4X4: afterType = true; if (parseContext.symbolTable.atBuiltInLevel() || - ((parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) || - parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float32)) && - parseContext.profile != EEsProfile && parseContext.version >= 450)) + parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) || + parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float32)) return keyword; return identifierOrType(); @@ -1237,9 +1276,8 @@ int TScanContext::tokenizeIdentifier() case F64MAT4X4: afterType = true; if (parseContext.symbolTable.atBuiltInLevel() || - ((parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) || - parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float64)) && - parseContext.profile != EEsProfile && parseContext.version >= 450)) + parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) || + parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float64)) return keyword; return identifierOrType(); @@ -1249,14 +1287,10 @@ int TScanContext::tokenizeIdentifier() case F16VEC4: afterType = true; if (parseContext.symbolTable.atBuiltInLevel() || - (parseContext.profile != EEsProfile && parseContext.version >= 450 && - ( -#ifdef AMD_EXTENSIONS - parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float) || -#endif - parseContext.extensionTurnedOn(E_GL_EXT_shader_16bit_storage) || - parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) || - parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float16)))) + parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float) || + parseContext.extensionTurnedOn(E_GL_EXT_shader_16bit_storage) || + parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) || + parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float16)) return keyword; return identifierOrType(); @@ -1275,13 +1309,9 @@ int TScanContext::tokenizeIdentifier() case F16MAT4X4: afterType = true; if (parseContext.symbolTable.atBuiltInLevel() || - (parseContext.profile != EEsProfile && parseContext.version >= 450 && - ( -#ifdef AMD_EXTENSIONS - parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float) || -#endif - parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) || - parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float16)))) + parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float) || + parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) || + parseContext.extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_float16)) return keyword; return identifierOrType(); @@ -1291,20 +1321,21 @@ int TScanContext::tokenizeIdentifier() case ISAMPLERCUBEARRAY: case USAMPLERCUBEARRAY: afterType = true; - if ((parseContext.profile == EEsProfile && parseContext.version >= 320) || + if ((parseContext.isEsProfile() && parseContext.version >= 320) || parseContext.extensionsTurnedOn(Num_AEP_texture_cube_map_array, AEP_texture_cube_map_array)) return keyword; - if (parseContext.profile == EEsProfile || (parseContext.version < 400 && ! parseContext.extensionTurnedOn(E_GL_ARB_texture_cube_map_array))) + if (parseContext.isEsProfile() || (parseContext.version < 400 && ! parseContext.extensionTurnedOn(E_GL_ARB_texture_cube_map_array))) reservedWord(); return keyword; - case ISAMPLER1D: - case ISAMPLER1DARRAY: - case SAMPLER1DARRAYSHADOW: - case USAMPLER1D: - case USAMPLER1DARRAY: - afterType = true; - return es30ReservedFromGLSL(130); + case TEXTURECUBEARRAY: + case ITEXTURECUBEARRAY: + case UTEXTURECUBEARRAY: + if (parseContext.spvVersion.vulkan > 0) + return keyword; + else + return identifierOrType(); +#endif case UINT: case UVEC2: @@ -1324,6 +1355,49 @@ int TScanContext::tokenizeIdentifier() afterType = true; return nonreservedKeyword(300, 130); + case SAMPLER3D: + afterType = true; + if (parseContext.isEsProfile() && parseContext.version < 300) { + if (!parseContext.extensionTurnedOn(E_GL_OES_texture_3D)) + reservedWord(); + } + return keyword; + + case SAMPLER2DSHADOW: + afterType = true; + if (parseContext.isEsProfile() && parseContext.version < 300) { + if (!parseContext.extensionTurnedOn(E_GL_EXT_shadow_samplers)) + reservedWord(); + } + return keyword; + + case TEXTURE2D: + case TEXTURECUBE: + case TEXTURE2DARRAY: + case ITEXTURE2D: + case ITEXTURE3D: + case ITEXTURECUBE: + case ITEXTURE2DARRAY: + case UTEXTURE2D: + case UTEXTURE3D: + case UTEXTURECUBE: + case UTEXTURE2DARRAY: + case TEXTURE3D: + case SAMPLER: + case SAMPLERSHADOW: + if (parseContext.spvVersion.vulkan > 0) + return keyword; + else + return identifierOrType(); + +#ifndef GLSLANG_WEB + case ISAMPLER1D: + case ISAMPLER1DARRAY: + case SAMPLER1DARRAYSHADOW: + case USAMPLER1D: + case USAMPLER1DARRAY: + afterType = true; + return es30ReservedFromGLSL(130); case ISAMPLER2DRECT: case USAMPLER2DRECT: afterType = true; @@ -1331,7 +1405,7 @@ int TScanContext::tokenizeIdentifier() case SAMPLERBUFFER: afterType = true; - if ((parseContext.profile == EEsProfile && parseContext.version >= 320) || + if ((parseContext.isEsProfile() && parseContext.version >= 320) || parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer)) return keyword; return es30ReservedFromGLSL(130); @@ -1339,7 +1413,7 @@ int TScanContext::tokenizeIdentifier() case ISAMPLERBUFFER: case USAMPLERBUFFER: afterType = true; - if ((parseContext.profile == EEsProfile && parseContext.version >= 320) || + if ((parseContext.isEsProfile() && parseContext.version >= 320) || parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer)) return keyword; return es30ReservedFromGLSL(140); @@ -1348,7 +1422,10 @@ int TScanContext::tokenizeIdentifier() case ISAMPLER2DMS: case USAMPLER2DMS: afterType = true; - if (parseContext.profile == EEsProfile && parseContext.version >= 310) + if (parseContext.isEsProfile() && parseContext.version >= 310) + return keyword; + if (!parseContext.isEsProfile() && (parseContext.version > 140 || + (parseContext.version == 140 && parseContext.extensionsTurnedOn(1, &E_GL_ARB_texture_multisample)))) return keyword; return es30ReservedFromGLSL(150); @@ -1356,38 +1433,25 @@ int TScanContext::tokenizeIdentifier() case ISAMPLER2DMSARRAY: case USAMPLER2DMSARRAY: afterType = true; - if ((parseContext.profile == EEsProfile && parseContext.version >= 320) || + if ((parseContext.isEsProfile() && parseContext.version >= 320) || parseContext.extensionsTurnedOn(1, &E_GL_OES_texture_storage_multisample_2d_array)) return keyword; + if (!parseContext.isEsProfile() && (parseContext.version > 140 || + (parseContext.version == 140 && parseContext.extensionsTurnedOn(1, &E_GL_ARB_texture_multisample)))) + return keyword; return es30ReservedFromGLSL(150); case SAMPLER1D: case SAMPLER1DSHADOW: afterType = true; - if (parseContext.profile == EEsProfile) + if (parseContext.isEsProfile()) reservedWord(); return keyword; - case SAMPLER3D: - afterType = true; - if (parseContext.profile == EEsProfile && parseContext.version < 300) { - if (!parseContext.extensionTurnedOn(E_GL_OES_texture_3D)) - reservedWord(); - } - return keyword; - - case SAMPLER2DSHADOW: - afterType = true; - if (parseContext.profile == EEsProfile && parseContext.version < 300) { - if (!parseContext.extensionTurnedOn(E_GL_EXT_shadow_samplers)) - reservedWord(); - } - return keyword; - case SAMPLER2DRECT: case SAMPLER2DRECTSHADOW: afterType = true; - if (parseContext.profile == EEsProfile) + if (parseContext.isEsProfile()) reservedWord(); else if (parseContext.version < 140 && ! parseContext.symbolTable.atBuiltInLevel() && ! parseContext.extensionTurnedOn(E_GL_ARB_texture_rectangle)) { if (parseContext.relaxedErrors()) @@ -1399,10 +1463,10 @@ int TScanContext::tokenizeIdentifier() case SAMPLER1DARRAY: afterType = true; - if (parseContext.profile == EEsProfile && parseContext.version == 300) + if (parseContext.isEsProfile() && parseContext.version == 300) reservedWord(); - else if ((parseContext.profile == EEsProfile && parseContext.version < 300) || - (parseContext.profile != EEsProfile && parseContext.version < 130)) + else if ((parseContext.isEsProfile() && parseContext.version < 300) || + (!parseContext.isEsProfile() && parseContext.version < 130)) return identifierOrType(); return keyword; @@ -1421,25 +1485,11 @@ int TScanContext::tokenizeIdentifier() return keyword; return identifierOrType(); - case TEXTURE2D: - case TEXTURECUBE: - case TEXTURECUBEARRAY: - case ITEXTURECUBEARRAY: - case UTEXTURECUBEARRAY: case ITEXTURE1DARRAY: case UTEXTURE1D: case ITEXTURE1D: case UTEXTURE1DARRAY: case TEXTUREBUFFER: - case TEXTURE2DARRAY: - case ITEXTURE2D: - case ITEXTURE3D: - case ITEXTURECUBE: - case ITEXTURE2DARRAY: - case UTEXTURE2D: - case UTEXTURE3D: - case UTEXTURECUBE: - case UTEXTURE2DARRAY: case ITEXTURE2DRECT: case UTEXTURE2DRECT: case ITEXTUREBUFFER: @@ -1451,11 +1501,8 @@ int TScanContext::tokenizeIdentifier() case ITEXTURE2DMSARRAY: case UTEXTURE2DMSARRAY: case TEXTURE1D: - case TEXTURE3D: case TEXTURE2DRECT: case TEXTURE1DARRAY: - case SAMPLER: - case SAMPLERSHADOW: if (parseContext.spvVersion.vulkan > 0) return keyword; else @@ -1472,7 +1519,6 @@ int TScanContext::tokenizeIdentifier() else return identifierOrType(); -#ifdef AMD_EXTENSIONS case F16SAMPLER1D: case F16SAMPLER2D: case F16SAMPLER3D: @@ -1520,99 +1566,40 @@ int TScanContext::tokenizeIdentifier() case F16SUBPASSINPUTMS: afterType = true; if (parseContext.symbolTable.atBuiltInLevel() || - (parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float_fetch) && - parseContext.profile != EEsProfile && parseContext.version >= 450)) + parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float_fetch)) return keyword; return identifierOrType(); -#endif - - case NOPERSPECTIVE: -#ifdef NV_EXTENSIONS - if (parseContext.profile == EEsProfile && parseContext.version >= 300 && - parseContext.extensionTurnedOn(E_GL_NV_shader_noperspective_interpolation)) - return keyword; -#endif - return es30ReservedFromGLSL(130); - case SMOOTH: - if ((parseContext.profile == EEsProfile && parseContext.version < 300) || - (parseContext.profile != EEsProfile && parseContext.version < 130)) - return identifierOrType(); - return keyword; - -#ifdef AMD_EXTENSIONS case EXPLICITINTERPAMD: - if (parseContext.profile != EEsProfile && parseContext.version >= 450 && - parseContext.extensionTurnedOn(E_GL_AMD_shader_explicit_vertex_parameter)) + if (parseContext.extensionTurnedOn(E_GL_AMD_shader_explicit_vertex_parameter)) return keyword; return identifierOrType(); -#endif -#ifdef NV_EXTENSIONS case PERVERTEXNV: - if (((parseContext.profile != EEsProfile && parseContext.version >= 450) || - (parseContext.profile == EEsProfile && parseContext.version >= 320)) && + if ((!parseContext.isEsProfile() && parseContext.version >= 450) || parseContext.extensionTurnedOn(E_GL_NV_fragment_shader_barycentric)) return keyword; return identifierOrType(); -#endif - - case FLAT: - if (parseContext.profile == EEsProfile && parseContext.version < 300) - reservedWord(); - else if (parseContext.profile != EEsProfile && parseContext.version < 130) - return identifierOrType(); - return keyword; - - case CENTROID: - if (parseContext.version < 120) - return identifierOrType(); - return keyword; case PRECISE: - if ((parseContext.profile == EEsProfile && + if ((parseContext.isEsProfile() && (parseContext.version >= 320 || parseContext.extensionsTurnedOn(Num_AEP_gpu_shader5, AEP_gpu_shader5))) || - (parseContext.profile != EEsProfile && parseContext.version >= 400)) + (!parseContext.isEsProfile() && parseContext.version >= 400)) return keyword; - if (parseContext.profile == EEsProfile && parseContext.version == 310) { + if (parseContext.isEsProfile() && parseContext.version == 310) { reservedWord(); return keyword; } return identifierOrType(); - case INVARIANT: - if (parseContext.profile != EEsProfile && parseContext.version < 120) - return identifierOrType(); - return keyword; - - case PACKED: - if ((parseContext.profile == EEsProfile && parseContext.version < 300) || - (parseContext.profile != EEsProfile && parseContext.version < 330)) - return reservedWord(); - return identifierOrType(); - - case RESOURCE: - { - bool reserved = (parseContext.profile == EEsProfile && parseContext.version >= 300) || - (parseContext.profile != EEsProfile && parseContext.version >= 420); - return identifierOrReserved(reserved); - } - case SUPERP: - { - bool reserved = parseContext.profile == EEsProfile || parseContext.version >= 130; - return identifierOrReserved(reserved); - } - -#ifdef NV_EXTENSIONS case PERPRIMITIVENV: case PERVIEWNV: case PERTASKNV: - if ((parseContext.profile != EEsProfile && parseContext.version >= 450) || - (parseContext.profile == EEsProfile && parseContext.version >= 320) || + if ((!parseContext.isEsProfile() && parseContext.version >= 450) || + (parseContext.isEsProfile() && parseContext.version >= 320) || parseContext.extensionTurnedOn(E_GL_NV_mesh_shader)) return keyword; return identifierOrType(); -#endif case FCOOPMATNV: afterType = true; @@ -1621,6 +1608,21 @@ int TScanContext::tokenizeIdentifier() return keyword; return identifierOrType(); + case UCOOPMATNV: + case ICOOPMATNV: + afterType = true; + if (parseContext.symbolTable.atBuiltInLevel() || + parseContext.extensionTurnedOn(E_GL_NV_integer_cooperative_matrix)) + return keyword; + return identifierOrType(); + + case DEMOTE: + if (parseContext.extensionTurnedOn(E_GL_EXT_demote_to_helper_invocation)) + return keyword; + else + return identifierOrType(); +#endif + default: parseContext.infoSink.info.message(EPrefixInternalError, "Unknown glslang keyword", loc); return 0; @@ -1638,7 +1640,7 @@ int TScanContext::identifierOrType() if (const TVariable* variable = parserToken->sType.lex.symbol->getAsVariable()) { if (variable->isUserType() && // treat redeclaration of forward-declared buffer/uniform reference as an identifier - !(variable->getType().getBasicType() == EbtReference && afterBuffer)) { + !(variable->getType().isReference() && afterBuffer)) { afterType = true; return TYPE_NAME; @@ -1668,7 +1670,7 @@ int TScanContext::identifierOrReserved(bool reserved) return 0; } - if (parseContext.forwardCompatible) + if (parseContext.isForwardCompatible()) parseContext.warn(loc, "using future reserved keyword", tokenText, ""); return identifierOrType(); @@ -1681,13 +1683,13 @@ int TScanContext::es30ReservedFromGLSL(int version) if (parseContext.symbolTable.atBuiltInLevel()) return keyword; - if ((parseContext.profile == EEsProfile && parseContext.version < 300) || - (parseContext.profile != EEsProfile && parseContext.version < version)) { - if (parseContext.forwardCompatible) + if ((parseContext.isEsProfile() && parseContext.version < 300) || + (!parseContext.isEsProfile() && parseContext.version < version)) { + if (parseContext.isForwardCompatible()) parseContext.warn(loc, "future reserved word in ES 300 and keyword in GLSL", tokenText, ""); return identifierOrType(); - } else if (parseContext.profile == EEsProfile && parseContext.version >= 300) + } else if (parseContext.isEsProfile() && parseContext.version >= 300) reservedWord(); return keyword; @@ -1697,9 +1699,9 @@ int TScanContext::es30ReservedFromGLSL(int version) // showed up, both in an es version and a non-ES version. int TScanContext::nonreservedKeyword(int esVersion, int nonEsVersion) { - if ((parseContext.profile == EEsProfile && parseContext.version < esVersion) || - (parseContext.profile != EEsProfile && parseContext.version < nonEsVersion)) { - if (parseContext.forwardCompatible) + if ((parseContext.isEsProfile() && parseContext.version < esVersion) || + (!parseContext.isEsProfile() && parseContext.version < nonEsVersion)) { + if (parseContext.isForwardCompatible()) parseContext.warn(loc, "using future keyword", tokenText, ""); return identifierOrType(); @@ -1710,10 +1712,10 @@ int TScanContext::nonreservedKeyword(int esVersion, int nonEsVersion) int TScanContext::precisionKeyword() { - if (parseContext.profile == EEsProfile || parseContext.version >= 130) + if (parseContext.isEsProfile() || parseContext.version >= 130) return keyword; - if (parseContext.forwardCompatible) + if (parseContext.isForwardCompatible()) parseContext.warn(loc, "using ES precision qualifier keyword", tokenText, ""); return identifierOrType(); @@ -1726,7 +1728,7 @@ int TScanContext::matNxM() if (parseContext.version > 110) return keyword; - if (parseContext.forwardCompatible) + if (parseContext.isForwardCompatible()) parseContext.warn(loc, "using future non-square matrix type keyword", tokenText, ""); return identifierOrType(); @@ -1736,16 +1738,18 @@ int TScanContext::dMat() { afterType = true; - if (parseContext.profile == EEsProfile && parseContext.version >= 300) { + if (parseContext.isEsProfile() && parseContext.version >= 300) { reservedWord(); return keyword; } - if (parseContext.profile != EEsProfile && parseContext.version >= 400) + if (!parseContext.isEsProfile() && (parseContext.version >= 400 || + parseContext.symbolTable.atBuiltInLevel() || + (parseContext.version >= 150 && parseContext.extensionTurnedOn(E_GL_ARB_gpu_shader_fp64)))) return keyword; - if (parseContext.forwardCompatible) + if (parseContext.isForwardCompatible()) parseContext.warn(loc, "using future type keyword", tokenText, ""); return identifierOrType(); @@ -1754,19 +1758,19 @@ int TScanContext::dMat() int TScanContext::firstGenerationImage(bool inEs310) { if (parseContext.symbolTable.atBuiltInLevel() || - (parseContext.profile != EEsProfile && (parseContext.version >= 420 || + (!parseContext.isEsProfile() && (parseContext.version >= 420 || parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store))) || - (inEs310 && parseContext.profile == EEsProfile && parseContext.version >= 310)) + (inEs310 && parseContext.isEsProfile() && parseContext.version >= 310)) return keyword; - if ((parseContext.profile == EEsProfile && parseContext.version >= 300) || - (parseContext.profile != EEsProfile && parseContext.version >= 130)) { + if ((parseContext.isEsProfile() && parseContext.version >= 300) || + (!parseContext.isEsProfile() && parseContext.version >= 130)) { reservedWord(); return keyword; } - if (parseContext.forwardCompatible) + if (parseContext.isForwardCompatible()) parseContext.warn(loc, "using future type keyword", tokenText, ""); return identifierOrType(); @@ -1774,17 +1778,17 @@ int TScanContext::firstGenerationImage(bool inEs310) int TScanContext::secondGenerationImage() { - if (parseContext.profile == EEsProfile && parseContext.version >= 310) { + if (parseContext.isEsProfile() && parseContext.version >= 310) { reservedWord(); return keyword; } if (parseContext.symbolTable.atBuiltInLevel() || - (parseContext.profile != EEsProfile && + (!parseContext.isEsProfile() && (parseContext.version >= 420 || parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store)))) return keyword; - if (parseContext.forwardCompatible) + if (parseContext.isForwardCompatible()) parseContext.warn(loc, "using future type keyword", tokenText, ""); return identifierOrType(); diff --git a/thirdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp b/thirdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp index 6f9db0195c..44ce1c19d1 100644 --- a/thirdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp +++ b/thirdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp @@ -288,6 +288,11 @@ void InitializeStageSymbolTable(TBuiltInParseables& builtInParseables, int versi EShLanguage language, EShSource source, TInfoSink& infoSink, TSymbolTable** commonTable, TSymbolTable** symbolTables) { +#ifdef GLSLANG_WEB + profile = EEsProfile; + version = 310; +#endif + (*symbolTables[language]).adoptLevels(*commonTable[CommonIndex(profile, language)]); InitializeSymbolTable(builtInParseables.getStageString(language), version, profile, spvVersion, language, source, infoSink, *symbolTables[language]); @@ -304,6 +309,11 @@ void InitializeStageSymbolTable(TBuiltInParseables& builtInParseables, int versi // bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TSymbolTable** symbolTables, int version, EProfile profile, const SpvVersion& spvVersion, EShSource source) { +#ifdef GLSLANG_WEB + profile = EEsProfile; + version = 310; +#endif + std::unique_ptr<TBuiltInParseables> builtInParseables(CreateBuiltInParseables(infoSink, source)); if (builtInParseables == nullptr) @@ -326,6 +336,7 @@ bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TS InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangFragment, source, infoSink, commonTable, symbolTables); +#ifndef GLSLANG_WEB // check for tessellation if ((profile != EEsProfile && version >= 150) || (profile == EEsProfile && version >= 310)) { @@ -340,6 +351,7 @@ bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TS (profile == EEsProfile && version >= 310)) InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangGeometry, source, infoSink, commonTable, symbolTables); +#endif // check for compute if ((profile != EEsProfile && version >= 420) || @@ -347,7 +359,6 @@ bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TS InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangCompute, source, infoSink, commonTable, symbolTables); -#ifdef NV_EXTENSIONS // check for ray tracing stages if (profile != EEsProfile && version >= 450) { InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangRayGenNV, source, @@ -375,9 +386,6 @@ bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TS (profile == EEsProfile && version >= 320)) InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangTaskNV, source, infoSink, commonTable, symbolTables); -#endif - - return true; } @@ -479,11 +487,13 @@ void SetupBuiltinSymbolTable(int version, EProfile profile, const SpvVersion& sp // Function to Print all builtins void DumpBuiltinSymbolTable(TInfoSink& infoSink, const TSymbolTable& symbolTable) { +#ifndef GLSLANG_WEB infoSink.debug << "BuiltinSymbolTable {\n"; symbolTable.dump(infoSink, true); infoSink.debug << "}\n"; +#endif } // Return true if the shader was correctly specified for version/profile/stage. @@ -581,6 +591,7 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo break; } +#ifndef GLSLANG_WEB // Correct for stage type... switch (stage) { case EShLangGeometry: @@ -612,7 +623,6 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo version = profile == EEsProfile ? 310 : 420; } break; -#ifdef NV_EXTENSIONS case EShLangRayGenNV: case EShLangIntersectNV: case EShLangAnyHitNV: @@ -633,7 +643,6 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo infoSink.info.message(EPrefixError, "#version: mesh/task shaders require es profile with version 320 or above, or non-es profile with version 450 or above"); version = profile == EEsProfile ? 320 : 450; } -#endif default: break; } @@ -646,15 +655,10 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo // Check for SPIR-V compatibility if (spvVersion.spv != 0) { switch (profile) { - case EEsProfile: - if (spvVersion.vulkan > 0 && version < 310) { + case EEsProfile: + if (version < 310) { correct = false; - infoSink.info.message(EPrefixError, "#version: ES shaders for Vulkan SPIR-V require version 310 or higher"); - version = 310; - } - if (spvVersion.openGl >= 100) { - correct = false; - infoSink.info.message(EPrefixError, "#version: ES shaders for OpenGL SPIR-V are not supported"); + infoSink.info.message(EPrefixError, "#version: ES shaders for SPIR-V require version 310 or higher"); version = 310; } break; @@ -675,6 +679,7 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo break; } } +#endif return correct; } @@ -833,13 +838,17 @@ bool ProcessDeferred( // Get all the stages, languages, clients, and other environment // stuff sorted out. - EShSource source = (messages & EShMsgReadHlsl) != 0 ? EShSourceHlsl : EShSourceGlsl; + EShSource sourceGuess = (messages & EShMsgReadHlsl) != 0 ? EShSourceHlsl : EShSourceGlsl; SpvVersion spvVersion; EShLanguage stage = compiler->getLanguage(); - TranslateEnvironment(environment, messages, source, stage, spvVersion); + TranslateEnvironment(environment, messages, sourceGuess, stage, spvVersion); +#ifdef ENABLE_HLSL + EShSource source = sourceGuess; if (environment != nullptr && environment->target.hlslFunctionality1) intermediate.setHlslFunctionality1(); - +#else + const EShSource source = EShSourceGlsl; +#endif // First, without using the preprocessor or parser, find the #version, so we know what // symbol tables, processing rules, etc. to set up. This does not need the extra strings // outlined above, just the user shader, after the system and user preambles. @@ -852,6 +861,7 @@ bool ProcessDeferred( : userInput.scanVersion(version, profile, versionNotFirstToken); bool versionNotFound = version == 0; if (forceDefaultVersionAndProfile && source == EShSourceGlsl) { +#ifndef GLSLANG_WEB if (! (messages & EShMsgSuppressWarnings) && ! versionNotFound && (version != defaultVersion || profile != defaultProfile)) { compiler->infoSink.info << "Warning, (version, profile) forced to be (" @@ -859,7 +869,7 @@ bool ProcessDeferred( << "), while in source code it is (" << version << ", " << ProfileName(profile) << ")\n"; } - +#endif if (versionNotFound) { versionNotFirstToken = false; versionNotFirst = false; @@ -871,7 +881,13 @@ bool ProcessDeferred( bool goodVersion = DeduceVersionProfile(compiler->infoSink, stage, versionNotFirst, defaultVersion, source, version, profile, spvVersion); +#ifdef GLSLANG_WEB + profile = EEsProfile; + version = 310; +#endif + bool versionWillBeError = (versionNotFound || (profile == EEsProfile && version >= 300 && versionNotFirst)); +#ifndef GLSLANG_WEB bool warnVersionNotFirst = false; if (! versionWillBeError && versionNotFirstToken) { if (messages & EShMsgRelaxedErrors) @@ -879,6 +895,7 @@ bool ProcessDeferred( else versionWillBeError = true; } +#endif intermediate.setSource(source); intermediate.setVersion(version); @@ -887,8 +904,10 @@ bool ProcessDeferred( RecordProcesses(intermediate, messages, sourceEntryPointName); if (spvVersion.vulkan > 0) intermediate.setOriginUpperLeft(); +#ifdef ENABLE_HLSL if ((messages & EShMsgHlslOffsets) || source == EShSourceHlsl) intermediate.setHlslOffsets(); +#endif if (messages & EShMsgDebugInfo) { intermediate.setSourceFile(names[numPre]); for (int s = 0; s < numStrings; ++s) { @@ -938,11 +957,13 @@ bool ProcessDeferred( parseContext->setLimits(*resources); if (! goodVersion) parseContext->addError(); +#ifndef GLSLANG_WEB if (warnVersionNotFirst) { TSourceLoc loc; loc.init(); parseContext->warn(loc, "Illegal to have non-comment, non-whitespace tokens before #version", "#version", ""); } +#endif parseContext->initializeExtensionBehavior(); @@ -973,6 +994,8 @@ bool ProcessDeferred( return success; } +#ifndef GLSLANG_WEB + // Responsible for keeping track of the most recent source string and line in // the preprocessor and outputting newlines appropriately if the source string // or line changes. @@ -1169,6 +1192,8 @@ struct DoPreprocessing { std::string* outputString; }; +#endif + // DoFullParse is a valid ProcessingConext template argument for fully // parsing the shader. It populates the "intermediate" with the AST. struct DoFullParse{ @@ -1199,6 +1224,7 @@ struct DoFullParse{ } }; +#ifndef GLSLANG_WEB // Take a single compilation unit, and run the preprocessor on it. // Return: True if there were no issues found in preprocessing, // False if during preprocessing any unknown version, pragmas or @@ -1231,6 +1257,7 @@ bool PreprocessDeferred( forwardCompatible, messages, intermediate, parser, false, includer); } +#endif // // do a partial compile on the given strings for a single compilation unit @@ -1749,6 +1776,11 @@ void TShader::addProcesses(const std::vector<std::string>& p) intermediate->addProcesses(p); } +void TShader::setInvertY(bool invert) { intermediate->setInvertY(invert); } +void TShader::setNanMinMaxClamp(bool useNonNan) { intermediate->setNanMinMaxClamp(useNonNan); } + +#ifndef GLSLANG_WEB + // Set binding base for given resource type void TShader::setShiftBinding(TResourceType res, unsigned int base) { intermediate->setShiftBinding(res, base); @@ -1776,7 +1808,7 @@ void TShader::setShiftSsboBinding(unsigned int base) { setShiftBinding(EResSs // Enables binding automapping using TIoMapper void TShader::setAutoMapBindings(bool map) { intermediate->setAutoMapBindings(map); } // Enables position.Y output negation in vertex shader -void TShader::setInvertY(bool invert) { intermediate->setInvertY(invert); } + // Fragile: currently within one stage: simple auto-assignment of location void TShader::setAutoMapLocations(bool map) { intermediate->setAutoMapLocations(map); } void TShader::addUniformLocationOverride(const char* name, int loc) @@ -1787,12 +1819,16 @@ void TShader::setUniformLocationBase(int base) { intermediate->setUniformLocationBase(base); } -// See comment above TDefaultHlslIoMapper in iomapper.cpp: -void TShader::setHlslIoMapping(bool hlslIoMap) { intermediate->setHlslIoMapping(hlslIoMap); } -void TShader::setFlattenUniformArrays(bool flatten) { intermediate->setFlattenUniformArrays(flatten); } void TShader::setNoStorageFormat(bool useUnknownFormat) { intermediate->setNoStorageFormat(useUnknownFormat); } void TShader::setResourceSetBinding(const std::vector<std::string>& base) { intermediate->setResourceSetBinding(base); } void TShader::setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode) { intermediate->setTextureSamplerTransformMode(mode); } +#endif + +#ifdef ENABLE_HLSL +// See comment above TDefaultHlslIoMapper in iomapper.cpp: +void TShader::setHlslIoMapping(bool hlslIoMap) { intermediate->setHlslIoMapping(hlslIoMap); } +void TShader::setFlattenUniformArrays(bool flatten) { intermediate->setFlattenUniformArrays(flatten); } +#endif // // Turn the shader strings into a parse tree in the TIntermediate. @@ -1816,6 +1852,7 @@ bool TShader::parse(const TBuiltInResource* builtInResources, int defaultVersion &environment); } +#ifndef GLSLANG_WEB // Fill in a string with the result of preprocessing ShaderStrings // Returns true if all extensions, pragmas and version strings were valid. // @@ -1840,6 +1877,7 @@ bool TShader::preprocess(const TBuiltInResource* builtInResources, defaultProfile, forceDefaultVersionAndProfile, forwardCompatible, message, includer, *intermediate, output_string); } +#endif const char* TShader::getInfoLog() { @@ -1851,7 +1889,11 @@ const char* TShader::getInfoDebugLog() return infoSink->debug.c_str(); } -TProgram::TProgram() : reflection(0), ioMapper(nullptr), linked(false) +TProgram::TProgram() : +#ifndef GLSLANG_WEB + reflection(0), +#endif + linked(false) { pool = new TPoolAllocator; infoSink = new TInfoSink; @@ -1863,9 +1905,10 @@ TProgram::TProgram() : reflection(0), ioMapper(nullptr), linked(false) TProgram::~TProgram() { - delete ioMapper; delete infoSink; +#ifndef GLSLANG_WEB delete reflection; +#endif for (int s = 0; s < EShLangCount; ++s) if (newedIntermediate[s]) @@ -1910,6 +1953,7 @@ bool TProgram::linkStage(EShLanguage stage, EShMessages messages) if (stages[stage].size() == 0) return true; +#ifndef GLSLANG_WEB int numEsShaders = 0, numNonEsShaders = 0; for (auto it = stages[stage].begin(); it != stages[stage].end(); ++it) { if ((*it)->intermediate->getProfile() == EEsProfile) { @@ -1958,7 +2002,9 @@ bool TProgram::linkStage(EShLanguage stage, EShMessages messages) for (it = stages[stage].begin(); it != stages[stage].end(); ++it) intermediate[stage]->merge(*infoSink, *(*it)->intermediate); } - +#else + intermediate[stage] = stages[stage].front()->intermediate; +#endif intermediate[stage]->finalCheck(*infoSink, (messages & EShMsgKeepUncalled) != 0); if (messages & EShMsgAST) @@ -1977,13 +2023,15 @@ const char* TProgram::getInfoDebugLog() return infoSink->debug.c_str(); } +#ifndef GLSLANG_WEB + // // Reflection implementation. // bool TProgram::buildReflection(int opts) { - if (! linked || reflection) + if (! linked || reflection != nullptr) return false; int firstStage = EShLangVertex, lastStage = EShLangFragment; @@ -2013,8 +2061,10 @@ bool TProgram::buildReflection(int opts) return true; } -unsigned TProgram::getLocalSize(int dim) const { return reflection->getLocalSize(dim); } -int TProgram::getReflectionIndex(const char* name) const { return reflection->getIndex(name); } +unsigned TProgram::getLocalSize(int dim) const { return reflection->getLocalSize(dim); } +int TProgram::getReflectionIndex(const char* name) const { return reflection->getIndex(name); } +int TProgram::getReflectionPipeIOIndex(const char* name, const bool inOrOut) const + { return reflection->getPipeIOIndex(name, inOrOut); } int TProgram::getNumUniformVariables() const { return reflection->getNumUniforms(); } const TObjectReflection& TProgram::getUniform(int index) const { return reflection->getUniform(index); } @@ -2030,27 +2080,31 @@ int TProgram::getNumBufferBlocks() const { return r const TObjectReflection& TProgram::getBufferBlock(int index) const { return reflection->getStorageBufferBlock(index); } int TProgram::getNumAtomicCounters() const { return reflection->getNumAtomicCounters(); } const TObjectReflection& TProgram::getAtomicCounter(int index) const { return reflection->getAtomicCounter(index); } - -void TProgram::dumpReflection() { reflection->dump(); } +void TProgram::dumpReflection() { if (reflection != nullptr) reflection->dump(); } // // I/O mapping implementation. // -bool TProgram::mapIO(TIoMapResolver* resolver) +bool TProgram::mapIO(TIoMapResolver* pResolver, TIoMapper* pIoMapper) { - if (! linked || ioMapper) + if (! linked) return false; - - ioMapper = new TIoMapper; - + TIoMapper* ioMapper = nullptr; + TIoMapper defaultIOMapper; + if (pIoMapper == nullptr) + ioMapper = &defaultIOMapper; + else + ioMapper = pIoMapper; for (int s = 0; s < EShLangCount; ++s) { if (intermediate[s]) { - if (! ioMapper->addStage((EShLanguage)s, *intermediate[s], *infoSink, resolver)) + if (! ioMapper->addStage((EShLanguage)s, *intermediate[s], *infoSink, pResolver)) return false; } } - return true; + return ioMapper->doMap(pResolver, *infoSink); } +#endif // GLSLANG_WEB + } // end namespace glslang diff --git a/thirdparty/glslang/glslang/MachineIndependent/SymbolTable.cpp b/thirdparty/glslang/glslang/MachineIndependent/SymbolTable.cpp index c0a02e68a7..44682379f7 100644 --- a/thirdparty/glslang/glslang/MachineIndependent/SymbolTable.cpp +++ b/thirdparty/glslang/glslang/MachineIndependent/SymbolTable.cpp @@ -61,63 +61,66 @@ void TType::buildMangledName(TString& mangledName) const switch (basicType) { case EbtFloat: mangledName += 'f'; break; - case EbtDouble: mangledName += 'd'; break; - case EbtFloat16: mangledName += "f16"; break; case EbtInt: mangledName += 'i'; break; case EbtUint: mangledName += 'u'; break; + case EbtBool: mangledName += 'b'; break; +#ifndef GLSLANG_WEB + case EbtDouble: mangledName += 'd'; break; + case EbtFloat16: mangledName += "f16"; break; case EbtInt8: mangledName += "i8"; break; case EbtUint8: mangledName += "u8"; break; case EbtInt16: mangledName += "i16"; break; case EbtUint16: mangledName += "u16"; break; case EbtInt64: mangledName += "i64"; break; case EbtUint64: mangledName += "u64"; break; - case EbtBool: mangledName += 'b'; break; case EbtAtomicUint: mangledName += "au"; break; -#ifdef NV_EXTENSIONS case EbtAccStructNV: mangledName += "asnv"; break; #endif case EbtSampler: switch (sampler.type) { -#ifdef AMD_EXTENSIONS +#ifndef GLSLANG_WEB case EbtFloat16: mangledName += "f16"; break; #endif case EbtInt: mangledName += "i"; break; case EbtUint: mangledName += "u"; break; default: break; // some compilers want this } - if (sampler.image) - mangledName += "I"; // a normal image - else if (sampler.sampler) + if (sampler.isImageClass()) + mangledName += "I"; // a normal image or subpass + else if (sampler.isPureSampler()) mangledName += "p"; // a "pure" sampler - else if (!sampler.combined) + else if (!sampler.isCombined()) mangledName += "t"; // a "pure" texture else mangledName += "s"; // traditional combined sampler - if (sampler.arrayed) + if (sampler.isArrayed()) mangledName += "A"; - if (sampler.shadow) + if (sampler.isShadow()) mangledName += "S"; - if (sampler.external) + if (sampler.isExternal()) mangledName += "E"; - if (sampler.yuv) + if (sampler.isYuv()) mangledName += "Y"; switch (sampler.dim) { - case Esd1D: mangledName += "1"; break; case Esd2D: mangledName += "2"; break; case Esd3D: mangledName += "3"; break; case EsdCube: mangledName += "C"; break; +#ifndef GLSLANG_WEB + case Esd1D: mangledName += "1"; break; case EsdRect: mangledName += "R2"; break; case EsdBuffer: mangledName += "B"; break; case EsdSubpass: mangledName += "P"; break; +#endif default: break; // some compilers want this } +#ifdef ENABLE_HLSL if (sampler.hasReturnStruct()) { // Name mangle for sampler return struct uses struct table index. mangledName += "-tx-struct"; char text[16]; // plenty enough space for the small integers. - snprintf(text, sizeof(text), "%d-", sampler.structReturnIndex); + snprintf(text, sizeof(text), "%d-", sampler.getStructReturnIndex()); mangledName += text; } else { switch (sampler.getVectorSize()) { @@ -127,8 +130,9 @@ void TType::buildMangledName(TString& mangledName) const case 4: break; // default to prior name mangle behavior } } +#endif - if (sampler.ms) + if (sampler.isMultiSample()) mangledName += "M"; break; case EbtStruct: @@ -172,6 +176,8 @@ void TType::buildMangledName(TString& mangledName) const } } +#ifndef GLSLANG_WEB + // // Dump functions. // @@ -184,7 +190,7 @@ void TSymbol::dumpExtensions(TInfoSink& infoSink) const for (int i = 0; i < numExtensions; i++) infoSink.debug << getExtensions()[i] << ","; - + infoSink.debug << ">"; } } @@ -229,7 +235,7 @@ void TFunction::dump(TInfoSink& infoSink, bool complete) const infoSink.debug << "\n"; } -void TAnonMember::dump(TInfoSink& TInfoSink, bool complete) const +void TAnonMember::dump(TInfoSink& TInfoSink, bool) const { TInfoSink.debug << "anonymous member " << getMemberNumber() << " of " << getAnonContainer().getName().c_str() << "\n"; @@ -250,6 +256,8 @@ void TSymbolTable::dump(TInfoSink& infoSink, bool complete) const } } +#endif + // // Functions have buried pointers to delete. // diff --git a/thirdparty/glslang/glslang/MachineIndependent/SymbolTable.h b/thirdparty/glslang/glslang/MachineIndependent/SymbolTable.h index f3873cff02..40ca3da532 100644 --- a/thirdparty/glslang/glslang/MachineIndependent/SymbolTable.h +++ b/thirdparty/glslang/glslang/MachineIndependent/SymbolTable.h @@ -116,8 +116,11 @@ public: } virtual int getNumExtensions() const { return extensions == nullptr ? 0 : (int)extensions->size(); } virtual const char** getExtensions() const { return extensions->data(); } + +#ifndef GLSLANG_WEB virtual void dump(TInfoSink& infoSink, bool complete = false) const = 0; void dumpExtensions(TInfoSink& infoSink) const; +#endif virtual bool isReadOnly() const { return ! writable; } virtual void makeReadOnly() { writable = false; } @@ -193,7 +196,9 @@ public: } virtual const char** getMemberExtensions(int member) const { return (*memberExtensions)[member].data(); } +#ifndef GLSLANG_WEB virtual void dump(TInfoSink& infoSink, bool complete = false) const; +#endif protected: explicit TVariable(const TVariable&); @@ -314,7 +319,9 @@ public: virtual TParameter& operator[](int i) { assert(writable); return parameters[i]; } virtual const TParameter& operator[](int i) const { return parameters[i]; } +#ifndef GLSLANG_WEB virtual void dump(TInfoSink& infoSink, bool complete = false) const override; +#endif protected: explicit TFunction(const TFunction&); @@ -374,7 +381,9 @@ public: virtual const char** getExtensions() const override { return anonContainer.getMemberExtensions(memberNumber); } virtual int getAnonId() const { return anonId; } +#ifndef GLSLANG_WEB virtual void dump(TInfoSink& infoSink, bool complete = false) const override; +#endif protected: explicit TAnonMember(const TAnonMember&); @@ -542,7 +551,9 @@ public: void relateToOperator(const char* name, TOperator op); void setFunctionExtensions(const char* name, int num, const char* const extensions[]); +#ifndef GLSLANG_WEB void dump(TInfoSink& infoSink, bool complete = false) const; +#endif TSymbolTableLevel* clone() const; void readOnly(); @@ -843,7 +854,9 @@ public: } int getMaxSymbolId() { return uniqueId; } +#ifndef GLSLANG_WEB void dump(TInfoSink& infoSink, bool complete = false) const; +#endif void copyTable(const TSymbolTable& copyOf); void setPreviousDefaultPrecisions(TPrecisionQualifier *p) { table[currentLevel()]->setPreviousDefaultPrecisions(p); } diff --git a/thirdparty/glslang/glslang/MachineIndependent/Versions.cpp b/thirdparty/glslang/glslang/MachineIndependent/Versions.cpp index f19c38502d..e549074df8 100644 --- a/thirdparty/glslang/glslang/MachineIndependent/Versions.cpp +++ b/thirdparty/glslang/glslang/MachineIndependent/Versions.cpp @@ -145,6 +145,8 @@ namespace glslang { +#ifndef GLSLANG_WEB + // // Initialize all extensions, almost always to 'disable', as once their features // are incorporated into a core version, their features are supported through allowing that @@ -170,8 +172,10 @@ void TParseVersions::initializeExtensionBehavior() extensionBehavior[E_GL_ARB_tessellation_shader] = EBhDisable; extensionBehavior[E_GL_ARB_enhanced_layouts] = EBhDisable; extensionBehavior[E_GL_ARB_texture_cube_map_array] = EBhDisable; + extensionBehavior[E_GL_ARB_texture_multisample] = EBhDisable; extensionBehavior[E_GL_ARB_shader_texture_lod] = EBhDisable; extensionBehavior[E_GL_ARB_explicit_attrib_location] = EBhDisable; + extensionBehavior[E_GL_ARB_explicit_uniform_location] = EBhDisable; extensionBehavior[E_GL_ARB_shader_image_load_store] = EBhDisable; extensionBehavior[E_GL_ARB_shader_atomic_counters] = EBhDisable; extensionBehavior[E_GL_ARB_shader_draw_parameters] = EBhDisable; @@ -180,6 +184,7 @@ void TParseVersions::initializeExtensionBehavior() extensionBehavior[E_GL_ARB_shader_texture_image_samples] = EBhDisable; extensionBehavior[E_GL_ARB_viewport_array] = EBhDisable; extensionBehavior[E_GL_ARB_gpu_shader_int64] = EBhDisable; + extensionBehavior[E_GL_ARB_gpu_shader_fp64] = EBhDisable; extensionBehavior[E_GL_ARB_shader_ballot] = EBhDisable; extensionBehavior[E_GL_ARB_sparse_texture2] = EBhDisable; extensionBehavior[E_GL_ARB_sparse_texture_clamp] = EBhDisable; @@ -187,6 +192,10 @@ void TParseVersions::initializeExtensionBehavior() // extensionBehavior[E_GL_ARB_cull_distance] = EBhDisable; // present for 4.5, but need extension control over block members extensionBehavior[E_GL_ARB_post_depth_coverage] = EBhDisable; extensionBehavior[E_GL_ARB_shader_viewport_layer_array] = EBhDisable; + extensionBehavior[E_GL_ARB_fragment_shader_interlock] = EBhDisable; + extensionBehavior[E_GL_ARB_shader_clock] = EBhDisable; + extensionBehavior[E_GL_ARB_uniform_buffer_object] = EBhDisable; + extensionBehavior[E_GL_ARB_sample_shading] = EBhDisable; extensionBehavior[E_GL_KHR_shader_subgroup_basic] = EBhDisable; extensionBehavior[E_GL_KHR_shader_subgroup_vote] = EBhDisable; @@ -210,6 +219,8 @@ void TParseVersions::initializeExtensionBehavior() extensionBehavior[E_GL_EXT_fragment_invocation_density] = EBhDisable; extensionBehavior[E_GL_EXT_buffer_reference] = EBhDisable; extensionBehavior[E_GL_EXT_buffer_reference2] = EBhDisable; + extensionBehavior[E_GL_EXT_buffer_reference_uvec2] = EBhDisable; + extensionBehavior[E_GL_EXT_demote_to_helper_invocation] = EBhDisable; extensionBehavior[E_GL_EXT_shader_16bit_storage] = EBhDisable; extensionBehavior[E_GL_EXT_shader_8bit_storage] = EBhDisable; @@ -218,7 +229,6 @@ void TParseVersions::initializeExtensionBehavior() extensionBehavior[E_GL_GOOGLE_cpp_style_line_directive] = EBhDisable; extensionBehavior[E_GL_GOOGLE_include_directive] = EBhDisable; -#ifdef AMD_EXTENSIONS extensionBehavior[E_GL_AMD_shader_ballot] = EBhDisable; extensionBehavior[E_GL_AMD_shader_trinary_minmax] = EBhDisable; extensionBehavior[E_GL_AMD_shader_explicit_vertex_parameter] = EBhDisable; @@ -229,9 +239,9 @@ void TParseVersions::initializeExtensionBehavior() extensionBehavior[E_GL_AMD_shader_image_load_store_lod] = EBhDisable; extensionBehavior[E_GL_AMD_shader_fragment_mask] = EBhDisable; extensionBehavior[E_GL_AMD_gpu_shader_half_float_fetch] = EBhDisable; -#endif -#ifdef NV_EXTENSIONS + extensionBehavior[E_GL_INTEL_shader_integer_functions2] = EBhDisable; + extensionBehavior[E_GL_NV_sample_mask_override_coverage] = EBhDisable; extensionBehavior[E_SPV_NV_geometry_shader_passthrough] = EBhDisable; extensionBehavior[E_GL_NV_viewport_array2] = EBhDisable; @@ -247,9 +257,10 @@ void TParseVersions::initializeExtensionBehavior() extensionBehavior[E_GL_NV_compute_shader_derivatives] = EBhDisable; extensionBehavior[E_GL_NV_shader_texture_footprint] = EBhDisable; extensionBehavior[E_GL_NV_mesh_shader] = EBhDisable; -#endif extensionBehavior[E_GL_NV_cooperative_matrix] = EBhDisable; + extensionBehavior[E_GL_NV_shader_sm_builtins] = EBhDisable; + extensionBehavior[E_GL_NV_integer_cooperative_matrix] = EBhDisable; // AEP extensionBehavior[E_GL_ANDROID_extension_pack_es31a] = EBhDisable; @@ -282,6 +293,7 @@ void TParseVersions::initializeExtensionBehavior() // EXT extensions extensionBehavior[E_GL_EXT_device_group] = EBhDisable; extensionBehavior[E_GL_EXT_multiview] = EBhDisable; + extensionBehavior[E_GL_EXT_shader_realtime_clock] = EBhDisable; // OVR extensions extensionBehavior[E_GL_OVR_multiview] = EBhDisable; @@ -296,16 +308,26 @@ void TParseVersions::initializeExtensionBehavior() extensionBehavior[E_GL_EXT_shader_explicit_arithmetic_types_float16] = EBhDisable; extensionBehavior[E_GL_EXT_shader_explicit_arithmetic_types_float32] = EBhDisable; extensionBehavior[E_GL_EXT_shader_explicit_arithmetic_types_float64] = EBhDisable; + + // subgroup extended types + extensionBehavior[E_GL_EXT_shader_subgroup_extended_types_int8] = EBhDisable; + extensionBehavior[E_GL_EXT_shader_subgroup_extended_types_int16] = EBhDisable; + extensionBehavior[E_GL_EXT_shader_subgroup_extended_types_int64] = EBhDisable; + extensionBehavior[E_GL_EXT_shader_subgroup_extended_types_float16] = EBhDisable; } +#endif // GLSLANG_WEB // Get code that is not part of a shared symbol table, is specific to this shader, // or needed by the preprocessor (which does not use a shared symbol table). void TParseVersions::getPreamble(std::string& preamble) { - if (profile == EEsProfile) { + if (isEsProfile()) { preamble = "#define GL_ES 1\n" "#define GL_FRAGMENT_PRECISION_HIGH 1\n" +#ifdef GLSLANG_WEB + ; +#else "#define GL_OES_texture_3D 1\n" "#define GL_OES_standard_derivatives 1\n" "#define GL_EXT_frag_depth 1\n" @@ -317,7 +339,6 @@ void TParseVersions::getPreamble(std::string& preamble) // AEP "#define GL_ANDROID_extension_pack_es31a 1\n" - "#define GL_KHR_blend_equation_advanced 1\n" "#define GL_OES_sample_variables 1\n" "#define GL_OES_shader_image_atomic 1\n" "#define GL_OES_shader_multisample_interpolation 1\n" @@ -345,11 +366,9 @@ void TParseVersions::getPreamble(std::string& preamble) "#define GL_EXT_shader_non_constant_global_initializers 1\n" ; -#ifdef NV_EXTENSIONS - if (profile == EEsProfile && version >= 300) { + if (isEsProfile() && version >= 300) { preamble += "#define GL_NV_shader_noperspective_interpolation 1\n"; } -#endif } else { preamble = @@ -363,8 +382,10 @@ void TParseVersions::getPreamble(std::string& preamble) "#define GL_ARB_tessellation_shader 1\n" "#define GL_ARB_enhanced_layouts 1\n" "#define GL_ARB_texture_cube_map_array 1\n" + "#define GL_ARB_texture_multisample 1\n" "#define GL_ARB_shader_texture_lod 1\n" "#define GL_ARB_explicit_attrib_location 1\n" + "#define GL_ARB_explicit_uniform_location 1\n" "#define GL_ARB_shader_image_load_store 1\n" "#define GL_ARB_shader_atomic_counters 1\n" "#define GL_ARB_shader_draw_parameters 1\n" @@ -373,12 +394,16 @@ void TParseVersions::getPreamble(std::string& preamble) "#define GL_ARB_shader_texture_image_samples 1\n" "#define GL_ARB_viewport_array 1\n" "#define GL_ARB_gpu_shader_int64 1\n" + "#define GL_ARB_gpu_shader_fp64 1\n" "#define GL_ARB_shader_ballot 1\n" "#define GL_ARB_sparse_texture2 1\n" "#define GL_ARB_sparse_texture_clamp 1\n" "#define GL_ARB_shader_stencil_export 1\n" + "#define GL_ARB_sample_shading 1\n" // "#define GL_ARB_cull_distance 1\n" // present for 4.5, but need extension control over block members "#define GL_ARB_post_depth_coverage 1\n" + "#define GL_ARB_fragment_shader_interlock 1\n" + "#define GL_ARB_uniform_buffer_object 1\n" "#define GL_EXT_shader_non_constant_global_initializers 1\n" "#define GL_EXT_shader_image_load_formatted 1\n" "#define GL_EXT_post_depth_coverage 1\n" @@ -391,6 +416,8 @@ void TParseVersions::getPreamble(std::string& preamble) "#define GL_EXT_fragment_invocation_density 1\n" "#define GL_EXT_buffer_reference 1\n" "#define GL_EXT_buffer_reference2 1\n" + "#define GL_EXT_buffer_reference_uvec2 1\n" + "#define GL_EXT_demote_to_helper_invocation 1\n" // GL_KHR_shader_subgroup "#define GL_KHR_shader_subgroup_basic 1\n" @@ -403,8 +430,8 @@ void TParseVersions::getPreamble(std::string& preamble) "#define GL_KHR_shader_subgroup_quad 1\n" "#define E_GL_EXT_shader_atomic_int64 1\n" + "#define E_GL_EXT_shader_realtime_clock 1\n" -#ifdef AMD_EXTENSIONS "#define GL_AMD_shader_ballot 1\n" "#define GL_AMD_shader_trinary_minmax 1\n" "#define GL_AMD_shader_explicit_vertex_parameter 1\n" @@ -415,9 +442,9 @@ void TParseVersions::getPreamble(std::string& preamble) "#define GL_AMD_shader_image_load_store_lod 1\n" "#define GL_AMD_shader_fragment_mask 1\n" "#define GL_AMD_gpu_shader_half_float_fetch 1\n" -#endif -#ifdef NV_EXTENSIONS + "#define GL_INTEL_shader_integer_functions2 1\n" + "#define GL_NV_sample_mask_override_coverage 1\n" "#define GL_NV_geometry_shader_passthrough 1\n" "#define GL_NV_viewport_array2 1\n" @@ -430,8 +457,8 @@ void TParseVersions::getPreamble(std::string& preamble) "#define GL_NV_compute_shader_derivatives 1\n" "#define GL_NV_shader_texture_footprint 1\n" "#define GL_NV_mesh_shader 1\n" -#endif "#define GL_NV_cooperative_matrix 1\n" + "#define GL_NV_integer_cooperative_matrix 1\n" "#define GL_EXT_shader_explicit_arithmetic_types 1\n" "#define GL_EXT_shader_explicit_arithmetic_types_int8 1\n" @@ -441,6 +468,11 @@ void TParseVersions::getPreamble(std::string& preamble) "#define GL_EXT_shader_explicit_arithmetic_types_float16 1\n" "#define GL_EXT_shader_explicit_arithmetic_types_float32 1\n" "#define GL_EXT_shader_explicit_arithmetic_types_float64 1\n" + + "#define GL_EXT_shader_subgroup_extended_types_int8 1\n" + "#define GL_EXT_shader_subgroup_extended_types_int16 1\n" + "#define GL_EXT_shader_subgroup_extended_types_int64 1\n" + "#define GL_EXT_shader_subgroup_extended_types_float16 1\n" ; if (version >= 150) { @@ -450,13 +482,16 @@ void TParseVersions::getPreamble(std::string& preamble) if (profile == ECompatibilityProfile) preamble += "#define GL_compatibility_profile 1\n"; } +#endif // GLSLANG_WEB } - if ((profile != EEsProfile && version >= 140) || - (profile == EEsProfile && version >= 310)) { +#ifndef GLSLANG_WEB + if ((!isEsProfile() && version >= 140) || + (isEsProfile() && version >= 310)) { preamble += "#define GL_EXT_device_group 1\n" "#define GL_EXT_multiview 1\n" + "#define GL_NV_shader_sm_builtins 1\n" ; } @@ -471,7 +506,9 @@ void TParseVersions::getPreamble(std::string& preamble) preamble += "#define GL_GOOGLE_cpp_style_line_directive 1\n" "#define GL_GOOGLE_include_directive 1\n" + "#define GL_KHR_blend_equation_advanced 1\n" ; +#endif // #define VULKAN XXXX const int numberBufSize = 12; @@ -482,6 +519,8 @@ void TParseVersions::getPreamble(std::string& preamble) preamble += numberBuf; preamble += "\n"; } + +#ifndef GLSLANG_WEB // #define GL_SPIRV XXXX if (spvVersion.openGl > 0) { preamble += "#define GL_SPIRV "; @@ -489,22 +528,7 @@ void TParseVersions::getPreamble(std::string& preamble) preamble += numberBuf; preamble += "\n"; } - -} - -// -// When to use requireProfile(): -// -// Use if only some profiles support a feature. However, if within a profile the feature -// is version or extension specific, follow this call with calls to profileRequires(). -// -// Operation: If the current profile is not one of the profileMask, -// give an error message. -// -void TParseVersions::requireProfile(const TSourceLoc& loc, int profileMask, const char* featureDesc) -{ - if (! (profile & profileMask)) - error(loc, "not supported with this profile:", featureDesc, ProfileName(profile)); +#endif } // @@ -514,12 +538,12 @@ const char* StageName(EShLanguage stage) { switch(stage) { case EShLangVertex: return "vertex"; + case EShLangFragment: return "fragment"; + case EShLangCompute: return "compute"; +#ifndef GLSLANG_WEB case EShLangTessControl: return "tessellation control"; case EShLangTessEvaluation: return "tessellation evaluation"; case EShLangGeometry: return "geometry"; - case EShLangFragment: return "fragment"; - case EShLangCompute: return "compute"; -#ifdef NV_EXTENSIONS case EShLangRayGenNV: return "ray-generation"; case EShLangIntersectNV: return "intersection"; case EShLangAnyHitNV: return "any-hit"; @@ -534,6 +558,42 @@ const char* StageName(EShLanguage stage) } // +// When to use requireStage() +// +// If only some stages support a feature. +// +// Operation: If the current stage is not present, give an error message. +// +void TParseVersions::requireStage(const TSourceLoc& loc, EShLanguageMask languageMask, const char* featureDesc) +{ + if (((1 << language) & languageMask) == 0) + error(loc, "not supported in this stage:", featureDesc, StageName(language)); +} + +// If only one stage supports a feature, this can be called. But, all supporting stages +// must be specified with one call. +void TParseVersions::requireStage(const TSourceLoc& loc, EShLanguage stage, const char* featureDesc) +{ + requireStage(loc, static_cast<EShLanguageMask>(1 << stage), featureDesc); +} + +#ifndef GLSLANG_WEB +// +// When to use requireProfile(): +// +// Use if only some profiles support a feature. However, if within a profile the feature +// is version or extension specific, follow this call with calls to profileRequires(). +// +// Operation: If the current profile is not one of the profileMask, +// give an error message. +// +void TParseVersions::requireProfile(const TSourceLoc& loc, int profileMask, const char* featureDesc) +{ + if (! (profile & profileMask)) + error(loc, "not supported with this profile:", featureDesc, ProfileName(profile)); +} + +// // When to use profileRequires(): // // If a set of profiles have the same requirements for what version or extensions @@ -550,12 +610,12 @@ const char* StageName(EShLanguage stage) // // entry point that takes multiple extensions -void TParseVersions::profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, int numExtensions, const char* const extensions[], const char* featureDesc) +void TParseVersions::profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, int numExtensions, + const char* const extensions[], const char* featureDesc) { if (profile & profileMask) { - bool okay = false; - if (minVersion > 0 && version >= minVersion) - okay = true; + bool okay = minVersion > 0 && version >= minVersion; +#ifndef GLSLANG_WEB for (int i = 0; i < numExtensions; ++i) { switch (getExtensionBehavior(extensions[i])) { case EBhWarn: @@ -568,36 +628,22 @@ void TParseVersions::profileRequires(const TSourceLoc& loc, int profileMask, int default: break; // some compilers want this } } - +#endif if (! okay) error(loc, "not supported for this version or the enabled extensions", featureDesc, ""); } } // entry point for the above that takes a single extension -void TParseVersions::profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, const char* extension, const char* featureDesc) +void TParseVersions::profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, const char* extension, + const char* featureDesc) { profileRequires(loc, profileMask, minVersion, extension ? 1 : 0, &extension, featureDesc); } -// -// When to use requireStage() -// -// If only some stages support a feature. -// -// Operation: If the current stage is not present, give an error message. -// -void TParseVersions::requireStage(const TSourceLoc& loc, EShLanguageMask languageMask, const char* featureDesc) -{ - if (((1 << language) & languageMask) == 0) - error(loc, "not supported in this stage:", featureDesc, StageName(language)); -} - -// If only one stage supports a feature, this can be called. But, all supporting stages -// must be specified with one call. -void TParseVersions::requireStage(const TSourceLoc& loc, EShLanguage stage, const char* featureDesc) +void TParseVersions::unimplemented(const TSourceLoc& loc, const char* featureDesc) { - requireStage(loc, static_cast<EShLanguageMask>(1 << stage), featureDesc); + error(loc, "feature not yet implemented", featureDesc, ""); } // @@ -633,11 +679,6 @@ void TParseVersions::requireNotRemoved(const TSourceLoc& loc, int profileMask, i } } -void TParseVersions::unimplemented(const TSourceLoc& loc, const char* featureDesc) -{ - error(loc, "feature not yet implemented", featureDesc, ""); -} - // Returns true if at least one of the extensions in the extensions parameter is requested. Otherwise, returns false. // Warns appropriately if the requested behavior of an extension is "warn". bool TParseVersions::checkExtensionsRequested(const TSourceLoc& loc, int numExtensions, const char* const extensions[], const char* featureDesc) @@ -806,12 +847,22 @@ void TParseVersions::updateExtensionBehavior(int line, const char* extension, co updateExtensionBehavior(line, "GL_KHR_shader_subgroup_basic", behaviorString); else if (strcmp(extension, "GL_KHR_shader_subgroup_quad") == 0) updateExtensionBehavior(line, "GL_KHR_shader_subgroup_basic", behaviorString); -#ifdef NV_EXTENSIONS else if (strcmp(extension, "GL_NV_shader_subgroup_partitioned") == 0) updateExtensionBehavior(line, "GL_KHR_shader_subgroup_basic", behaviorString); -#endif - else if (strcmp(extension, "GL_EXT_buffer_reference2") == 0) + else if (strcmp(extension, "GL_EXT_buffer_reference2") == 0 || + strcmp(extension, "GL_EXT_buffer_reference_uvec2") == 0) updateExtensionBehavior(line, "GL_EXT_buffer_reference", behaviorString); + else if (strcmp(extension, "GL_NV_integer_cooperative_matrix") == 0) + updateExtensionBehavior(line, "GL_NV_cooperative_matrix", behaviorString); + // subgroup extended types to explicit types + else if (strcmp(extension, "GL_EXT_shader_subgroup_extended_types_int8") == 0) + updateExtensionBehavior(line, "GL_EXT_shader_explicit_arithmetic_types_int8", behaviorString); + else if (strcmp(extension, "GL_EXT_shader_subgroup_extended_types_int16") == 0) + updateExtensionBehavior(line, "GL_EXT_shader_explicit_arithmetic_types_int16", behaviorString); + else if (strcmp(extension, "GL_EXT_shader_subgroup_extended_types_int64") == 0) + updateExtensionBehavior(line, "GL_EXT_shader_explicit_arithmetic_types_int64", behaviorString); + else if (strcmp(extension, "GL_EXT_shader_subgroup_extended_types_float16") == 0) + updateExtensionBehavior(line, "GL_EXT_shader_explicit_arithmetic_types_float16", behaviorString); } void TParseVersions::updateExtensionBehavior(const char* extension, TExtensionBehavior behavior) @@ -857,7 +908,6 @@ void TParseVersions::updateExtensionBehavior(const char* extension, TExtensionBe // Check if extension is used with correct shader stage. void TParseVersions::checkExtensionStage(const TSourceLoc& loc, const char * const extension) { -#ifdef NV_EXTENSIONS // GL_NV_mesh_shader extension is only allowed in task/mesh shaders if (strcmp(extension, "GL_NV_mesh_shader") == 0) { requireStage(loc, (EShLanguageMask)(EShLangTaskNVMask | EShLangMeshNVMask | EShLangFragmentMask), @@ -865,7 +915,6 @@ void TParseVersions::checkExtensionStage(const TSourceLoc& loc, const char * con profileRequires(loc, ECoreProfile, 450, 0, "#extension GL_NV_mesh_shader"); profileRequires(loc, EEsProfile, 320, 0, "#extension GL_NV_mesh_shader"); } -#endif } // Call for any operation needing full GLSL integer data-type support. @@ -878,8 +927,8 @@ void TParseVersions::fullIntegerCheck(const TSourceLoc& loc, const char* op) // Call for any operation needing GLSL double data-type support. void TParseVersions::doubleCheck(const TSourceLoc& loc, const char* op) { - requireProfile(loc, ECoreProfile | ECompatibilityProfile, op); - profileRequires(loc, ECoreProfile | ECompatibilityProfile, 400, nullptr, op); + //requireProfile(loc, ECoreProfile | ECompatibilityProfile, op); + profileRequires(loc, ECoreProfile | ECompatibilityProfile, 400, E_GL_ARB_gpu_shader_fp64, op); } // Call for any operation needing GLSL float16 data-type support. @@ -887,9 +936,7 @@ void TParseVersions::float16Check(const TSourceLoc& loc, const char* op, bool bu { if (!builtIn) { const char* const extensions[] = { -#if AMD_EXTENSIONS E_GL_AMD_gpu_shader_half_float, -#endif E_GL_EXT_shader_explicit_arithmetic_types, E_GL_EXT_shader_explicit_arithmetic_types_float16}; requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, op); @@ -899,9 +946,7 @@ void TParseVersions::float16Check(const TSourceLoc& loc, const char* op, bool bu bool TParseVersions::float16Arithmetic() { const char* const extensions[] = { -#if AMD_EXTENSIONS E_GL_AMD_gpu_shader_half_float, -#endif E_GL_EXT_shader_explicit_arithmetic_types, E_GL_EXT_shader_explicit_arithmetic_types_float16}; return extensionsTurnedOn(sizeof(extensions)/sizeof(extensions[0]), extensions); @@ -910,9 +955,7 @@ bool TParseVersions::float16Arithmetic() bool TParseVersions::int16Arithmetic() { const char* const extensions[] = { -#if AMD_EXTENSIONS E_GL_AMD_gpu_shader_int16, -#endif E_GL_EXT_shader_explicit_arithmetic_types, E_GL_EXT_shader_explicit_arithmetic_types_int16}; return extensionsTurnedOn(sizeof(extensions)/sizeof(extensions[0]), extensions); @@ -934,9 +977,7 @@ void TParseVersions::requireFloat16Arithmetic(const TSourceLoc& loc, const char* combined += featureDesc; const char* const extensions[] = { -#if AMD_EXTENSIONS E_GL_AMD_gpu_shader_half_float, -#endif E_GL_EXT_shader_explicit_arithmetic_types, E_GL_EXT_shader_explicit_arithmetic_types_float16}; requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, combined.c_str()); @@ -950,9 +991,7 @@ void TParseVersions::requireInt16Arithmetic(const TSourceLoc& loc, const char* o combined += featureDesc; const char* const extensions[] = { -#if AMD_EXTENSIONS E_GL_AMD_gpu_shader_int16, -#endif E_GL_EXT_shader_explicit_arithmetic_types, E_GL_EXT_shader_explicit_arithmetic_types_int16}; requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, combined.c_str()); @@ -975,9 +1014,7 @@ void TParseVersions::float16ScalarVectorCheck(const TSourceLoc& loc, const char* { if (!builtIn) { const char* const extensions[] = { -#if AMD_EXTENSIONS E_GL_AMD_gpu_shader_half_float, -#endif E_GL_EXT_shader_16bit_storage, E_GL_EXT_shader_explicit_arithmetic_types, E_GL_EXT_shader_explicit_arithmetic_types_float16}; @@ -1017,7 +1054,6 @@ 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) { @@ -1027,16 +1063,13 @@ void TParseVersions::float16OpaqueCheck(const TSourceLoc& loc, const char* op, b profileRequires(loc, ECoreProfile | ECompatibilityProfile, 400, nullptr, op); } } -#endif // Call for any operation needing GLSL explicit int16 data-type support. void TParseVersions::explicitInt16Check(const TSourceLoc& loc, const char* op, bool builtIn) { if (! builtIn) { const char* const extensions[] = { -#if AMD_EXTENSIONS E_GL_AMD_gpu_shader_int16, -#endif E_GL_EXT_shader_explicit_arithmetic_types, E_GL_EXT_shader_explicit_arithmetic_types_int16}; requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, op); @@ -1047,9 +1080,7 @@ void TParseVersions::int16ScalarVectorCheck(const TSourceLoc& loc, const char* o { if (! builtIn) { const char* const extensions[] = { -#if AMD_EXTENSIONS E_GL_AMD_gpu_shader_int16, -#endif E_GL_EXT_shader_16bit_storage, E_GL_EXT_shader_explicit_arithmetic_types, E_GL_EXT_shader_explicit_arithmetic_types_int16}; @@ -1099,6 +1130,14 @@ void TParseVersions::fcoopmatCheck(const TSourceLoc& loc, const char* op, bool b } } +void TParseVersions::intcoopmatCheck(const TSourceLoc& loc, const char* op, bool builtIn) +{ + if (!builtIn) { + const char* const extensions[] = {E_GL_NV_integer_cooperative_matrix}; + requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, op); + } +} +#endif // GLSLANG_WEB // Call for any operation removed because SPIR-V is in use. void TParseVersions::spvRemoved(const TSourceLoc& loc, const char* op) { @@ -1116,15 +1155,19 @@ void TParseVersions::vulkanRemoved(const TSourceLoc& loc, const char* op) // Call for any operation that requires Vulkan. void TParseVersions::requireVulkan(const TSourceLoc& loc, const char* op) { +#ifndef GLSLANG_WEB if (spvVersion.vulkan == 0) error(loc, "only allowed when using GLSL for Vulkan", op, ""); +#endif } // Call for any operation that requires SPIR-V. void TParseVersions::requireSpv(const TSourceLoc& loc, const char* op) { +#ifndef GLSLANG_WEB if (spvVersion.spv == 0) error(loc, "only allowed when generating SPIR-V", op, ""); +#endif } } // end namespace glslang diff --git a/thirdparty/glslang/glslang/MachineIndependent/Versions.h b/thirdparty/glslang/glslang/MachineIndependent/Versions.h index bff082709f..58558e595a 100644 --- a/thirdparty/glslang/glslang/MachineIndependent/Versions.h +++ b/thirdparty/glslang/glslang/MachineIndependent/Versions.h @@ -124,8 +124,10 @@ const char* const E_GL_ARB_compute_shader = "GL_ARB_compute_shader const char* const E_GL_ARB_tessellation_shader = "GL_ARB_tessellation_shader"; const char* const E_GL_ARB_enhanced_layouts = "GL_ARB_enhanced_layouts"; const char* const E_GL_ARB_texture_cube_map_array = "GL_ARB_texture_cube_map_array"; +const char* const E_GL_ARB_texture_multisample = "GL_ARB_texture_multisample"; const char* const E_GL_ARB_shader_texture_lod = "GL_ARB_shader_texture_lod"; const char* const E_GL_ARB_explicit_attrib_location = "GL_ARB_explicit_attrib_location"; +const char* const E_GL_ARB_explicit_uniform_location = "GL_ARB_explicit_uniform_location"; const char* const E_GL_ARB_shader_image_load_store = "GL_ARB_shader_image_load_store"; const char* const E_GL_ARB_shader_atomic_counters = "GL_ARB_shader_atomic_counters"; const char* const E_GL_ARB_shader_draw_parameters = "GL_ARB_shader_draw_parameters"; @@ -134,6 +136,7 @@ const char* const E_GL_ARB_derivative_control = "GL_ARB_derivative_con const char* const E_GL_ARB_shader_texture_image_samples = "GL_ARB_shader_texture_image_samples"; const char* const E_GL_ARB_viewport_array = "GL_ARB_viewport_array"; const char* const E_GL_ARB_gpu_shader_int64 = "GL_ARB_gpu_shader_int64"; +const char* const E_GL_ARB_gpu_shader_fp64 = "GL_ARB_gpu_shader_fp64"; const char* const E_GL_ARB_shader_ballot = "GL_ARB_shader_ballot"; const char* const E_GL_ARB_sparse_texture2 = "GL_ARB_sparse_texture2"; const char* const E_GL_ARB_sparse_texture_clamp = "GL_ARB_sparse_texture_clamp"; @@ -141,6 +144,10 @@ const char* const E_GL_ARB_shader_stencil_export = "GL_ARB_shader_stencil // const char* const E_GL_ARB_cull_distance = "GL_ARB_cull_distance"; // present for 4.5, but need extension control over block members const char* const E_GL_ARB_post_depth_coverage = "GL_ARB_post_depth_coverage"; const char* const E_GL_ARB_shader_viewport_layer_array = "GL_ARB_shader_viewport_layer_array"; +const char* const E_GL_ARB_fragment_shader_interlock = "GL_ARB_fragment_shader_interlock"; +const char* const E_GL_ARB_shader_clock = "GL_ARB_shader_clock"; +const char* const E_GL_ARB_uniform_buffer_object = "GL_ARB_uniform_buffer_object"; +const char* const E_GL_ARB_sample_shading = "GL_ARB_sample_shading"; const char* const E_GL_KHR_shader_subgroup_basic = "GL_KHR_shader_subgroup_basic"; const char* const E_GL_KHR_shader_subgroup_vote = "GL_KHR_shader_subgroup_vote"; @@ -172,6 +179,9 @@ const char* const E_GL_EXT_scalar_block_layout = "GL_EXT_scalar_blo const char* const E_GL_EXT_fragment_invocation_density = "GL_EXT_fragment_invocation_density"; const char* const E_GL_EXT_buffer_reference = "GL_EXT_buffer_reference"; const char* const E_GL_EXT_buffer_reference2 = "GL_EXT_buffer_reference2"; +const char* const E_GL_EXT_buffer_reference_uvec2 = "GL_EXT_buffer_reference_uvec2"; +const char* const E_GL_EXT_demote_to_helper_invocation = "GL_EXT_demote_to_helper_invocation"; +const char* const E_GL_EXT_shader_realtime_clock = "GL_EXT_shader_realtime_clock"; // Arrays of extensions for the above viewportEXTs duplications @@ -189,7 +199,6 @@ const int Num_OVR_multiview_EXTs = sizeof(OVR_multiview_EXTs) / sizeof(OVR_multi const char* const E_GL_GOOGLE_cpp_style_line_directive = "GL_GOOGLE_cpp_style_line_directive"; const char* const E_GL_GOOGLE_include_directive = "GL_GOOGLE_include_directive"; -#ifdef AMD_EXTENSIONS const char* const E_GL_AMD_shader_ballot = "GL_AMD_shader_ballot"; const char* const E_GL_AMD_shader_trinary_minmax = "GL_AMD_shader_trinary_minmax"; const char* const E_GL_AMD_shader_explicit_vertex_parameter = "GL_AMD_shader_explicit_vertex_parameter"; @@ -200,9 +209,8 @@ const char* const E_GL_AMD_gpu_shader_int16 = "GL_AMD_gpu_sh 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_gpu_shader_half_float_fetch = "GL_AMD_gpu_shader_half_float_fetch"; -#endif -#ifdef NV_EXTENSIONS +const char* const E_GL_INTEL_shader_integer_functions2 = "GL_INTEL_shader_integer_functions2"; const char* const E_GL_NV_sample_mask_override_coverage = "GL_NV_sample_mask_override_coverage"; const char* const E_SPV_NV_geometry_shader_passthrough = "GL_NV_geometry_shader_passthrough"; @@ -224,9 +232,10 @@ const char* const E_GL_NV_mesh_shader = "GL_NV_mesh_sh const char* const viewportEXTs[] = { E_GL_ARB_shader_viewport_layer_array, E_GL_NV_viewport_array2 }; const int Num_viewportEXTs = sizeof(viewportEXTs) / sizeof(viewportEXTs[0]); -#endif const char* const E_GL_NV_cooperative_matrix = "GL_NV_cooperative_matrix"; +const char* const E_GL_NV_shader_sm_builtins = "GL_NV_shader_sm_builtins"; +const char* const E_GL_NV_integer_cooperative_matrix = "GL_NV_integer_cooperative_matrix"; // AEP const char* const E_GL_ANDROID_extension_pack_es31a = "GL_ANDROID_extension_pack_es31a"; @@ -256,7 +265,7 @@ const char* const E_GL_OES_tessellation_point_size = "GL_OES_tessel const char* const E_GL_OES_texture_buffer = "GL_OES_texture_buffer"; const char* const E_GL_OES_texture_cube_map_array = "GL_OES_texture_cube_map_array"; -// KHX +// EXT const char* const E_GL_EXT_shader_explicit_arithmetic_types = "GL_EXT_shader_explicit_arithmetic_types"; const char* const E_GL_EXT_shader_explicit_arithmetic_types_int8 = "GL_EXT_shader_explicit_arithmetic_types_int8"; const char* const E_GL_EXT_shader_explicit_arithmetic_types_int16 = "GL_EXT_shader_explicit_arithmetic_types_int16"; @@ -266,6 +275,11 @@ const char* const E_GL_EXT_shader_explicit_arithmetic_types_float16 = "GL_EXT_s const char* const E_GL_EXT_shader_explicit_arithmetic_types_float32 = "GL_EXT_shader_explicit_arithmetic_types_float32"; const char* const E_GL_EXT_shader_explicit_arithmetic_types_float64 = "GL_EXT_shader_explicit_arithmetic_types_float64"; +const char* const E_GL_EXT_shader_subgroup_extended_types_int8 = "GL_EXT_shader_subgroup_extended_types_int8"; +const char* const E_GL_EXT_shader_subgroup_extended_types_int16 = "GL_EXT_shader_subgroup_extended_types_int16"; +const char* const E_GL_EXT_shader_subgroup_extended_types_int64 = "GL_EXT_shader_subgroup_extended_types_int64"; +const char* const E_GL_EXT_shader_subgroup_extended_types_float16 = "GL_EXT_shader_subgroup_extended_types_float16"; + // Arrays of extensions for the above AEP duplications const char* const AEP_geometry_shader[] = { E_GL_EXT_geometry_shader, E_GL_OES_geometry_shader }; diff --git a/thirdparty/glslang/glslang/MachineIndependent/attribute.cpp b/thirdparty/glslang/glslang/MachineIndependent/attribute.cpp index d4a23f39de..9585518349 100644 --- a/thirdparty/glslang/glslang/MachineIndependent/attribute.cpp +++ b/thirdparty/glslang/glslang/MachineIndependent/attribute.cpp @@ -34,6 +34,8 @@ // POSSIBILITY OF SUCH DAMAGE. // +#ifndef GLSLANG_WEB + #include "attribute.h" #include "../Include/intermediate.h" #include "ParseHelper.h" @@ -339,5 +341,6 @@ void TParseContext::handleLoopAttributes(const TAttributes& attributes, TIntermN } } - } // end namespace glslang + +#endif // GLSLANG_WEB diff --git a/thirdparty/glslang/glslang/MachineIndependent/attribute.h b/thirdparty/glslang/glslang/MachineIndependent/attribute.h index 844ce45806..38a943d283 100644 --- a/thirdparty/glslang/glslang/MachineIndependent/attribute.h +++ b/thirdparty/glslang/glslang/MachineIndependent/attribute.h @@ -76,7 +76,49 @@ namespace glslang { EatMaxIterations, EatIterationMultiple, EatPeelCount, - EatPartialCount + EatPartialCount, + EatFormatRgba32f, + EatFormatRgba16f, + EatFormatR32f, + EatFormatRgba8, + EatFormatRgba8Snorm, + EatFormatRg32f, + EatFormatRg16f, + EatFormatR11fG11fB10f, + EatFormatR16f, + EatFormatRgba16, + EatFormatRgb10A2, + EatFormatRg16, + EatFormatRg8, + EatFormatR16, + EatFormatR8, + EatFormatRgba16Snorm, + EatFormatRg16Snorm, + EatFormatRg8Snorm, + EatFormatR16Snorm, + EatFormatR8Snorm, + EatFormatRgba32i, + EatFormatRgba16i, + EatFormatRgba8i, + EatFormatR32i, + EatFormatRg32i, + EatFormatRg16i, + EatFormatRg8i, + EatFormatR16i, + EatFormatR8i, + EatFormatRgba32ui, + EatFormatRgba16ui, + EatFormatRgba8ui, + EatFormatR32ui, + EatFormatRgb10a2ui, + EatFormatRg32ui, + EatFormatRg16ui, + EatFormatRg8ui, + EatFormatR16ui, + EatFormatR8ui, + EatFormatUnknown, + EatNonWritable, + EatNonReadable }; class TIntermAggregate; diff --git a/thirdparty/glslang/glslang/MachineIndependent/gl_types.h b/thirdparty/glslang/glslang/MachineIndependent/gl_types.h index c9fee9ecce..b6f613bced 100644 --- a/thirdparty/glslang/glslang/MachineIndependent/gl_types.h +++ b/thirdparty/glslang/glslang/MachineIndependent/gl_types.h @@ -78,7 +78,6 @@ #define GL_DOUBLE_MAT4x2 0x8F4D #define GL_DOUBLE_MAT4x3 0x8F4E -#ifdef AMD_EXTENSIONS // Those constants are borrowed from extension NV_gpu_shader5 #define GL_FLOAT16_NV 0x8FF8 #define GL_FLOAT16_VEC2_NV 0x8FF9 @@ -94,7 +93,6 @@ #define GL_FLOAT16_MAT3x4_AMD 0x91CB #define GL_FLOAT16_MAT4x2_AMD 0x91CC #define GL_FLOAT16_MAT4x3_AMD 0x91CD -#endif #define GL_SAMPLER_1D 0x8B5D #define GL_SAMPLER_2D 0x8B5E @@ -117,7 +115,6 @@ #define GL_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900C #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 @@ -149,7 +146,6 @@ #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_2D 0x8DCA diff --git a/thirdparty/glslang/glslang/MachineIndependent/glslang.y b/thirdparty/glslang/glslang/MachineIndependent/glslang.y index b5691a29fd..9f30fdb2ab 100644 --- a/thirdparty/glslang/glslang/MachineIndependent/glslang.y +++ b/thirdparty/glslang/glslang/MachineIndependent/glslang.y @@ -36,6 +36,31 @@ // POSSIBILITY OF SUCH DAMAGE. // +// +// Do not edit the .y file, only edit the .m4 file. +// The .y bison file is not a source file, it is a derivative of the .m4 file. +// The m4 file needs to be processed by m4 to generate the .y bison file. +// +// Code sandwiched between a pair: +// +// GLSLANG_WEB_EXCLUDE_ON +// ... +// ... +// ... +// GLSLANG_WEB_EXCLUDE_OFF +// +// Will be excluded from the grammar when m4 is executed as: +// +// m4 -P -DGLSLANG_WEB +// +// It will be included when m4 is executed as: +// +// m4 -P +// + + + + /** * This is bison grammar and productions for parsing all versions of the * GLSL shading languages. @@ -125,13 +150,34 @@ extern int yylex(YYSTYPE*, TParseContext&); %pure-parser // enable thread safety %expect 1 // One shift reduce conflict because of if | else -%token <lex> ATTRIBUTE VARYING -%token <lex> FLOAT16_T FLOAT FLOAT32_T DOUBLE FLOAT64_T -%token <lex> CONST BOOL INT UINT INT64_T UINT64_T INT32_T UINT32_T INT16_T UINT16_T INT8_T UINT8_T -%token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT SUBROUTINE +%token <lex> CONST BOOL INT UINT FLOAT %token <lex> BVEC2 BVEC3 BVEC4 %token <lex> IVEC2 IVEC3 IVEC4 %token <lex> UVEC2 UVEC3 UVEC4 +%token <lex> VEC2 VEC3 VEC4 +%token <lex> MAT2 MAT3 MAT4 +%token <lex> MAT2X2 MAT2X3 MAT2X4 +%token <lex> MAT3X2 MAT3X3 MAT3X4 +%token <lex> MAT4X2 MAT4X3 MAT4X4 + +// combined image/sampler +%token <lex> SAMPLER2D SAMPLER3D SAMPLERCUBE SAMPLER2DSHADOW +%token <lex> SAMPLERCUBESHADOW SAMPLER2DARRAY +%token <lex> SAMPLER2DARRAYSHADOW ISAMPLER2D ISAMPLER3D ISAMPLERCUBE +%token <lex> ISAMPLER2DARRAY USAMPLER2D USAMPLER3D +%token <lex> USAMPLERCUBE USAMPLER2DARRAY + +// separate image/sampler +%token <lex> SAMPLER SAMPLERSHADOW +%token <lex> TEXTURE2D TEXTURE3D TEXTURECUBE TEXTURE2DARRAY +%token <lex> ITEXTURE2D ITEXTURE3D ITEXTURECUBE ITEXTURE2DARRAY +%token <lex> UTEXTURE2D UTEXTURE3D UTEXTURECUBE UTEXTURE2DARRAY + + + +%token <lex> ATTRIBUTE VARYING +%token <lex> FLOAT16_T FLOAT32_T DOUBLE FLOAT64_T +%token <lex> INT64_T UINT64_T INT32_T UINT32_T INT16_T UINT16_T INT8_T UINT8_T %token <lex> I64VEC2 I64VEC3 I64VEC4 %token <lex> U64VEC2 U64VEC3 U64VEC4 %token <lex> I32VEC2 I32VEC3 I32VEC4 @@ -140,19 +186,10 @@ extern int yylex(YYSTYPE*, TParseContext&); %token <lex> U16VEC2 U16VEC3 U16VEC4 %token <lex> I8VEC2 I8VEC3 I8VEC4 %token <lex> U8VEC2 U8VEC3 U8VEC4 -%token <lex> VEC2 VEC3 VEC4 -%token <lex> MAT2 MAT3 MAT4 CENTROID IN OUT INOUT -%token <lex> UNIFORM PATCH SAMPLE BUFFER SHARED NONUNIFORM PAYLOADNV PAYLOADINNV HITATTRNV CALLDATANV CALLDATAINNV -%token <lex> COHERENT VOLATILE RESTRICT READONLY WRITEONLY DEVICECOHERENT QUEUEFAMILYCOHERENT WORKGROUPCOHERENT SUBGROUPCOHERENT NONPRIVATE %token <lex> DVEC2 DVEC3 DVEC4 DMAT2 DMAT3 DMAT4 %token <lex> F16VEC2 F16VEC3 F16VEC4 F16MAT2 F16MAT3 F16MAT4 %token <lex> F32VEC2 F32VEC3 F32VEC4 F32MAT2 F32MAT3 F32MAT4 %token <lex> F64VEC2 F64VEC3 F64VEC4 F64MAT2 F64MAT3 F64MAT4 -%token <lex> NOPERSPECTIVE FLAT SMOOTH LAYOUT EXPLICITINTERPAMD PERVERTEXNV PERPRIMITIVENV PERVIEWNV PERTASKNV - -%token <lex> MAT2X2 MAT2X3 MAT2X4 -%token <lex> MAT3X2 MAT3X3 MAT3X4 -%token <lex> MAT4X2 MAT4X3 MAT4X4 %token <lex> DMAT2X2 DMAT2X3 DMAT2X4 %token <lex> DMAT3X2 DMAT3X3 DMAT3X4 %token <lex> DMAT4X2 DMAT4X3 DMAT4X4 @@ -167,41 +204,47 @@ extern int yylex(YYSTYPE*, TParseContext&); %token <lex> F64MAT4X2 F64MAT4X3 F64MAT4X4 %token <lex> ATOMIC_UINT %token <lex> ACCSTRUCTNV -%token <lex> FCOOPMATNV +%token <lex> FCOOPMATNV ICOOPMATNV UCOOPMATNV // combined image/sampler -%token <lex> SAMPLER1D SAMPLER2D SAMPLER3D SAMPLERCUBE SAMPLER1DSHADOW SAMPLER2DSHADOW -%token <lex> SAMPLERCUBESHADOW SAMPLER1DARRAY SAMPLER2DARRAY SAMPLER1DARRAYSHADOW -%token <lex> SAMPLER2DARRAYSHADOW ISAMPLER1D ISAMPLER2D ISAMPLER3D ISAMPLERCUBE -%token <lex> ISAMPLER1DARRAY ISAMPLER2DARRAY USAMPLER1D USAMPLER2D USAMPLER3D -%token <lex> USAMPLERCUBE USAMPLER1DARRAY USAMPLER2DARRAY -%token <lex> SAMPLER2DRECT SAMPLER2DRECTSHADOW ISAMPLER2DRECT USAMPLER2DRECT -%token <lex> SAMPLERBUFFER ISAMPLERBUFFER USAMPLERBUFFER %token <lex> SAMPLERCUBEARRAY SAMPLERCUBEARRAYSHADOW %token <lex> ISAMPLERCUBEARRAY USAMPLERCUBEARRAY +%token <lex> SAMPLER1D SAMPLER1DARRAY SAMPLER1DARRAYSHADOW ISAMPLER1D SAMPLER1DSHADOW +%token <lex> SAMPLER2DRECT SAMPLER2DRECTSHADOW ISAMPLER2DRECT USAMPLER2DRECT +%token <lex> SAMPLERBUFFER ISAMPLERBUFFER USAMPLERBUFFER %token <lex> SAMPLER2DMS ISAMPLER2DMS USAMPLER2DMS %token <lex> SAMPLER2DMSARRAY ISAMPLER2DMSARRAY USAMPLER2DMSARRAY %token <lex> SAMPLEREXTERNALOES %token <lex> SAMPLEREXTERNAL2DY2YEXT - +%token <lex> ISAMPLER1DARRAY USAMPLER1D USAMPLER1DARRAY %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 -%token <lex> SAMPLER SAMPLERSHADOW +// images +%token <lex> IMAGE1D IIMAGE1D UIMAGE1D IMAGE2D IIMAGE2D +%token <lex> UIMAGE2D IMAGE3D IIMAGE3D UIMAGE3D +%token <lex> IMAGE2DRECT IIMAGE2DRECT UIMAGE2DRECT +%token <lex> IMAGECUBE IIMAGECUBE UIMAGECUBE +%token <lex> IMAGEBUFFER IIMAGEBUFFER UIMAGEBUFFER +%token <lex> IMAGE1DARRAY IIMAGE1DARRAY UIMAGE1DARRAY +%token <lex> IMAGE2DARRAY IIMAGE2DARRAY UIMAGE2DARRAY +%token <lex> IMAGECUBEARRAY IIMAGECUBEARRAY UIMAGECUBEARRAY +%token <lex> IMAGE2DMS IIMAGE2DMS UIMAGE2DMS +%token <lex> IMAGE2DMSARRAY IIMAGE2DMSARRAY UIMAGE2DMSARRAY + +%token <lex> F16IMAGE1D F16IMAGE2D F16IMAGE3D F16IMAGE2DRECT +%token <lex> F16IMAGECUBE F16IMAGE1DARRAY F16IMAGE2DARRAY F16IMAGECUBEARRAY +%token <lex> F16IMAGEBUFFER F16IMAGE2DMS F16IMAGE2DMSARRAY // texture without sampler -%token <lex> TEXTURE1D TEXTURE2D TEXTURE3D TEXTURECUBE -%token <lex> TEXTURE1DARRAY TEXTURE2DARRAY -%token <lex> ITEXTURE1D ITEXTURE2D ITEXTURE3D ITEXTURECUBE -%token <lex> ITEXTURE1DARRAY ITEXTURE2DARRAY UTEXTURE1D UTEXTURE2D UTEXTURE3D -%token <lex> UTEXTURECUBE UTEXTURE1DARRAY UTEXTURE2DARRAY +%token <lex> TEXTURECUBEARRAY ITEXTURECUBEARRAY UTEXTURECUBEARRAY +%token <lex> TEXTURE1D ITEXTURE1D UTEXTURE1D +%token <lex> TEXTURE1DARRAY ITEXTURE1DARRAY UTEXTURE1DARRAY %token <lex> TEXTURE2DRECT ITEXTURE2DRECT UTEXTURE2DRECT %token <lex> TEXTUREBUFFER ITEXTUREBUFFER UTEXTUREBUFFER -%token <lex> TEXTURECUBEARRAY ITEXTURECUBEARRAY UTEXTURECUBEARRAY %token <lex> TEXTURE2DMS ITEXTURE2DMS UTEXTURE2DMS %token <lex> TEXTURE2DMSARRAY ITEXTURE2DMSARRAY UTEXTURE2DMSARRAY @@ -213,25 +256,8 @@ extern int yylex(YYSTYPE*, TParseContext&); %token <lex> SUBPASSINPUT SUBPASSINPUTMS ISUBPASSINPUT ISUBPASSINPUTMS USUBPASSINPUT USUBPASSINPUTMS %token <lex> F16SUBPASSINPUT F16SUBPASSINPUTMS -%token <lex> IMAGE1D IIMAGE1D UIMAGE1D IMAGE2D IIMAGE2D -%token <lex> UIMAGE2D IMAGE3D IIMAGE3D UIMAGE3D -%token <lex> IMAGE2DRECT IIMAGE2DRECT UIMAGE2DRECT -%token <lex> IMAGECUBE IIMAGECUBE UIMAGECUBE -%token <lex> IMAGEBUFFER IIMAGEBUFFER UIMAGEBUFFER -%token <lex> IMAGE1DARRAY IIMAGE1DARRAY UIMAGE1DARRAY -%token <lex> IMAGE2DARRAY IIMAGE2DARRAY UIMAGE2DARRAY -%token <lex> IMAGECUBEARRAY IIMAGECUBEARRAY UIMAGECUBEARRAY -%token <lex> IMAGE2DMS IIMAGE2DMS UIMAGE2DMS -%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> IDENTIFIER TYPE_NAME -%token <lex> FLOATCONSTANT DOUBLECONSTANT INT16CONSTANT UINT16CONSTANT INT32CONSTANT UINT32CONSTANT INTCONSTANT UINTCONSTANT INT64CONSTANT UINT64CONSTANT BOOLCONSTANT FLOAT16CONSTANT %token <lex> LEFT_OP RIGHT_OP %token <lex> INC_OP DEC_OP LE_OP GE_OP EQ_OP NE_OP %token <lex> AND_OP OR_OP XOR_OP MUL_ASSIGN DIV_ASSIGN ADD_ASSIGN @@ -242,11 +268,30 @@ extern int yylex(YYSTYPE*, TParseContext&); %token <lex> COMMA COLON EQUAL SEMICOLON BANG DASH TILDE PLUS STAR SLASH PERCENT %token <lex> LEFT_ANGLE RIGHT_ANGLE VERTICAL_BAR CARET AMPERSAND QUESTION -%token <lex> INVARIANT PRECISE +%token <lex> INVARIANT %token <lex> HIGH_PRECISION MEDIUM_PRECISION LOW_PRECISION PRECISION - %token <lex> PACKED RESOURCE SUPERP +%token <lex> FLOATCONSTANT INTCONSTANT UINTCONSTANT BOOLCONSTANT +%token <lex> IDENTIFIER TYPE_NAME +%token <lex> CENTROID IN OUT INOUT +%token <lex> STRUCT VOID WHILE +%token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT +%token <lex> UNIFORM SHARED BUFFER +%token <lex> FLAT SMOOTH LAYOUT + + +%token <lex> DOUBLECONSTANT INT16CONSTANT UINT16CONSTANT FLOAT16CONSTANT INT32CONSTANT UINT32CONSTANT +%token <lex> INT64CONSTANT UINT64CONSTANT +%token <lex> SUBROUTINE DEMOTE +%token <lex> PAYLOADNV PAYLOADINNV HITATTRNV CALLDATANV CALLDATAINNV +%token <lex> PATCH SAMPLE NONUNIFORM +%token <lex> COHERENT VOLATILE RESTRICT READONLY WRITEONLY DEVICECOHERENT QUEUEFAMILYCOHERENT WORKGROUPCOHERENT +%token <lex> SUBGROUPCOHERENT NONPRIVATE +%token <lex> NOPERSPECTIVE EXPLICITINTERPAMD PERVERTEXNV PERPRIMITIVENV PERVIEWNV PERTASKNV +%token <lex> PRECISE + + %type <interm> assignment_operator unary_operator %type <interm.intermTypedNode> variable_identifier primary_expression postfix_expression %type <interm.intermTypedNode> expression integer_expression assignment_expression @@ -255,7 +300,7 @@ extern int yylex(YYSTYPE*, TParseContext&); %type <interm.intermTypedNode> conditional_expression constant_expression %type <interm.intermTypedNode> logical_or_expression logical_xor_expression logical_and_expression %type <interm.intermTypedNode> shift_expression and_expression exclusive_or_expression inclusive_or_expression -%type <interm.intermTypedNode> function_call initializer initializer_list condition conditionopt +%type <interm.intermTypedNode> function_call initializer condition conditionopt %type <interm.intermNode> translation_unit function_definition %type <interm.intermNode> statement simple_statement @@ -271,9 +316,8 @@ extern int yylex(YYSTYPE*, TParseContext&); %type <interm> parameter_declaration parameter_declarator parameter_type_specifier %type <interm> array_specifier -%type <interm.type> precise_qualifier invariant_qualifier interpolation_qualifier storage_qualifier precision_qualifier +%type <interm.type> invariant_qualifier interpolation_qualifier storage_qualifier precision_qualifier %type <interm.type> layout_qualifier layout_qualifier_id_list layout_qualifier_id -%type <interm.type> non_uniform_qualifier %type <interm.typeParameters> type_parameter_specifier %type <interm.typeParameters> type_parameter_specifier_opt @@ -284,7 +328,7 @@ extern int yylex(YYSTYPE*, TParseContext&); %type <interm.type> type_specifier_nonarray %type <interm.type> struct_specifier %type <interm.typeLine> struct_declarator -%type <interm.typeList> struct_declarator_list struct_declaration struct_declaration_list type_name_list +%type <interm.typeList> struct_declarator_list struct_declaration struct_declaration_list %type <interm> block_structure %type <interm.function> function_header function_declarator %type <interm.function> function_header_with_parameters @@ -293,7 +337,13 @@ extern int yylex(YYSTYPE*, TParseContext&); %type <interm.identifierList> identifier_list + +%type <interm.type> precise_qualifier non_uniform_qualifier +%type <interm.typeList> type_name_list %type <interm.attributes> attribute attribute_list single_attribute +%type <interm.intermNode> demote_statement +%type <interm.intermTypedNode> initializer_list + %start translation_unit %% @@ -308,13 +358,13 @@ primary_expression : variable_identifier { $$ = $1; } - | INT32CONSTANT { - parseContext.explicitInt32Check($1.loc, "32-bit signed literal"); - $$ = parseContext.intermediate.addConstantUnion($1.i, $1.loc, true); + | LEFT_PAREN expression RIGHT_PAREN { + $$ = $2; + if ($$->getAsConstantUnion()) + $$->getAsConstantUnion()->setExpression(); } - | UINT32CONSTANT { - parseContext.explicitInt32Check($1.loc, "32-bit signed literal"); - $$ = parseContext.intermediate.addConstantUnion($1.u, $1.loc, true); + | FLOATCONSTANT { + $$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat, $1.loc, true); } | INTCONSTANT { $$ = parseContext.intermediate.addConstantUnion($1.i, $1.loc, true); @@ -323,6 +373,18 @@ primary_expression parseContext.fullIntegerCheck($1.loc, "unsigned literal"); $$ = parseContext.intermediate.addConstantUnion($1.u, $1.loc, true); } + | BOOLCONSTANT { + $$ = parseContext.intermediate.addConstantUnion($1.b, $1.loc, true); + } + + | INT32CONSTANT { + parseContext.explicitInt32Check($1.loc, "32-bit signed literal"); + $$ = parseContext.intermediate.addConstantUnion($1.i, $1.loc, true); + } + | UINT32CONSTANT { + parseContext.explicitInt32Check($1.loc, "32-bit signed literal"); + $$ = parseContext.intermediate.addConstantUnion($1.u, $1.loc, true); + } | INT64CONSTANT { parseContext.int64Check($1.loc, "64-bit integer literal"); $$ = parseContext.intermediate.addConstantUnion($1.i64, $1.loc, true); @@ -339,25 +401,17 @@ primary_expression parseContext.explicitInt16Check($1.loc, "16-bit unsigned integer literal"); $$ = parseContext.intermediate.addConstantUnion((unsigned short)$1.u, $1.loc, true); } - | FLOATCONSTANT { - $$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat, $1.loc, true); - } | DOUBLECONSTANT { - parseContext.doubleCheck($1.loc, "double literal"); + parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double literal"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck($1.loc, "double literal"); $$ = parseContext.intermediate.addConstantUnion($1.d, EbtDouble, $1.loc, true); } | FLOAT16CONSTANT { parseContext.float16Check($1.loc, "half float literal"); $$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat16, $1.loc, true); } - | BOOLCONSTANT { - $$ = parseContext.intermediate.addConstantUnion($1.b, $1.loc, true); - } - | LEFT_PAREN expression RIGHT_PAREN { - $$ = $2; - if ($$->getAsConstantUnion()) - $$->getAsConstantUnion()->setExpression(); - } + ; postfix_expression @@ -483,11 +537,13 @@ function_identifier $$.function = new TFunction(empty, TType(EbtVoid), EOpNull); } } + | non_uniform_qualifier { // Constructor $$.intermNode = 0; $$.function = parseContext.handleConstructorCall($1.loc, $1); } + ; unary_expression @@ -804,7 +860,6 @@ declaration } | PRECISION precision_qualifier type_specifier SEMICOLON { parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "precision statement"); - // lazy setting of the previous scope's defaults, has effect only the first time it is called in a particular scope parseContext.symbolTable.setPreviousDefaultPrecisions(&parseContext.defaultPrecision[0]); parseContext.setDefaultPrecision($1.loc, $3, $2.qualifier.precision); @@ -1048,7 +1103,9 @@ single_declaration : fully_specified_type { $$.type = $1; $$.intermNode = 0; + parseContext.declareTypeDefaults($$.loc, $$.type); + } | fully_specified_type IDENTIFIER { $$.type = $1; @@ -1082,7 +1139,6 @@ fully_specified_type parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type"); } - parseContext.precisionQualifierCheck($$.loc, $$.basicType, $$.qualifier); } | type_qualifier type_specifier { @@ -1135,38 +1191,30 @@ interpolation_qualifier $$.init($1.loc); $$.qualifier.flat = true; } + | NOPERSPECTIVE { parseContext.globalCheck($1.loc, "noperspective"); -#ifdef NV_EXTENSIONS parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_NV_shader_noperspective_interpolation, "noperspective"); -#else - parseContext.requireProfile($1.loc, ~EEsProfile, "noperspective"); -#endif parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "noperspective"); $$.init($1.loc); $$.qualifier.nopersp = true; } | EXPLICITINTERPAMD { -#ifdef AMD_EXTENSIONS parseContext.globalCheck($1.loc, "__explicitInterpAMD"); parseContext.profileRequires($1.loc, ECoreProfile, 450, E_GL_AMD_shader_explicit_vertex_parameter, "explicit interpolation"); parseContext.profileRequires($1.loc, ECompatibilityProfile, 450, E_GL_AMD_shader_explicit_vertex_parameter, "explicit interpolation"); $$.init($1.loc); $$.qualifier.explicitInterp = true; -#endif } | PERVERTEXNV { -#ifdef NV_EXTENSIONS parseContext.globalCheck($1.loc, "pervertexNV"); parseContext.profileRequires($1.loc, ECoreProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric"); parseContext.profileRequires($1.loc, ECompatibilityProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric"); parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric"); $$.init($1.loc); $$.qualifier.pervertexNV = true; -#endif } | PERPRIMITIVENV { -#ifdef NV_EXTENSIONS // No need for profile version or extension check. Shader stage already checks both. parseContext.globalCheck($1.loc, "perprimitiveNV"); parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangFragmentMask | EShLangMeshNVMask), "perprimitiveNV"); @@ -1175,26 +1223,22 @@ interpolation_qualifier parseContext.requireExtensions($1.loc, 1, &E_GL_NV_mesh_shader, "perprimitiveNV"); $$.init($1.loc); $$.qualifier.perPrimitiveNV = true; -#endif } | PERVIEWNV { -#ifdef NV_EXTENSIONS // No need for profile version or extension check. Shader stage already checks both. parseContext.globalCheck($1.loc, "perviewNV"); parseContext.requireStage($1.loc, EShLangMeshNV, "perviewNV"); $$.init($1.loc); $$.qualifier.perViewNV = true; -#endif } | PERTASKNV { -#ifdef NV_EXTENSIONS // No need for profile version or extension check. Shader stage already checks both. parseContext.globalCheck($1.loc, "taskNV"); parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangTaskNVMask | EShLangMeshNVMask), "taskNV"); $$.init($1.loc); $$.qualifier.perTaskNV = true; -#endif } + ; layout_qualifier @@ -1229,6 +1273,7 @@ layout_qualifier_id } ; + precise_qualifier : PRECISE { parseContext.profileRequires($$.loc, ECoreProfile | ECompatibilityProfile, 400, E_GL_ARB_gpu_shader5, "precise"); @@ -1238,6 +1283,7 @@ precise_qualifier } ; + type_qualifier : single_type_qualifier { $$ = $1; @@ -1271,6 +1317,7 @@ single_type_qualifier // allow inheritance of storage qualifier from block declaration $$ = $1; } + | precise_qualifier { // allow inheritance of storage qualifier from block declaration $$ = $1; @@ -1278,6 +1325,7 @@ single_type_qualifier | non_uniform_qualifier { $$ = $1; } + ; storage_qualifier @@ -1285,6 +1333,49 @@ storage_qualifier $$.init($1.loc); $$.qualifier.storage = EvqConst; // will later turn into EvqConstReadOnly, if the initializer is not constant } + | INOUT { + parseContext.globalCheck($1.loc, "inout"); + $$.init($1.loc); + $$.qualifier.storage = EvqInOut; + } + | IN { + parseContext.globalCheck($1.loc, "in"); + $$.init($1.loc); + // whether this is a parameter "in" or a pipeline "in" will get sorted out a bit later + $$.qualifier.storage = EvqIn; + } + | OUT { + parseContext.globalCheck($1.loc, "out"); + $$.init($1.loc); + // whether this is a parameter "out" or a pipeline "out" will get sorted out a bit later + $$.qualifier.storage = EvqOut; + } + | CENTROID { + parseContext.profileRequires($1.loc, ENoProfile, 120, 0, "centroid"); + parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "centroid"); + parseContext.globalCheck($1.loc, "centroid"); + $$.init($1.loc); + $$.qualifier.centroid = true; + } + | UNIFORM { + parseContext.globalCheck($1.loc, "uniform"); + $$.init($1.loc); + $$.qualifier.storage = EvqUniform; + } + | SHARED { + parseContext.globalCheck($1.loc, "shared"); + parseContext.profileRequires($1.loc, ECoreProfile | ECompatibilityProfile, 430, E_GL_ARB_compute_shader, "shared"); + parseContext.profileRequires($1.loc, EEsProfile, 310, 0, "shared"); + parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangComputeMask | EShLangMeshNVMask | EShLangTaskNVMask), "shared"); + $$.init($1.loc); + $$.qualifier.storage = EvqShared; + } + | BUFFER { + parseContext.globalCheck($1.loc, "buffer"); + $$.init($1.loc); + $$.qualifier.storage = EvqBuffer; + } + | ATTRIBUTE { parseContext.requireStage($1.loc, EShLangVertex, "attribute"); parseContext.checkDeprecated($1.loc, ECoreProfile, 130, "attribute"); @@ -1311,30 +1402,6 @@ storage_qualifier else $$.qualifier.storage = EvqVaryingIn; } - | INOUT { - parseContext.globalCheck($1.loc, "inout"); - $$.init($1.loc); - $$.qualifier.storage = EvqInOut; - } - | IN { - parseContext.globalCheck($1.loc, "in"); - $$.init($1.loc); - // whether this is a parameter "in" or a pipeline "in" will get sorted out a bit later - $$.qualifier.storage = EvqIn; - } - | OUT { - parseContext.globalCheck($1.loc, "out"); - $$.init($1.loc); - // whether this is a parameter "out" or a pipeline "out" will get sorted out a bit later - $$.qualifier.storage = EvqOut; - } - | CENTROID { - parseContext.profileRequires($1.loc, ENoProfile, 120, 0, "centroid"); - parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "centroid"); - parseContext.globalCheck($1.loc, "centroid"); - $$.init($1.loc); - $$.qualifier.centroid = true; - } | PATCH { parseContext.globalCheck($1.loc, "patch"); parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangTessControlMask | EShLangTessEvaluationMask), "patch"); @@ -1346,76 +1413,44 @@ storage_qualifier $$.init($1.loc); $$.qualifier.sample = true; } - | UNIFORM { - parseContext.globalCheck($1.loc, "uniform"); - $$.init($1.loc); - $$.qualifier.storage = EvqUniform; - } - | BUFFER { - parseContext.globalCheck($1.loc, "buffer"); - $$.init($1.loc); - $$.qualifier.storage = EvqBuffer; - } | HITATTRNV { -#ifdef NV_EXTENSIONS parseContext.globalCheck($1.loc, "hitAttributeNV"); parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangIntersectNVMask | EShLangClosestHitNVMask | EShLangAnyHitNVMask), "hitAttributeNV"); parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "hitAttributeNV"); $$.init($1.loc); $$.qualifier.storage = EvqHitAttrNV; -#endif } | PAYLOADNV { -#ifdef NV_EXTENSIONS parseContext.globalCheck($1.loc, "rayPayloadNV"); parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangRayGenNVMask | EShLangClosestHitNVMask | EShLangAnyHitNVMask | EShLangMissNVMask), "rayPayloadNV"); parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "rayPayloadNV"); $$.init($1.loc); $$.qualifier.storage = EvqPayloadNV; -#endif } | PAYLOADINNV { -#ifdef NV_EXTENSIONS parseContext.globalCheck($1.loc, "rayPayloadInNV"); parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangClosestHitNVMask | EShLangAnyHitNVMask | EShLangMissNVMask), "rayPayloadInNV"); parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "rayPayloadInNV"); $$.init($1.loc); $$.qualifier.storage = EvqPayloadInNV; -#endif } | CALLDATANV { -#ifdef NV_EXTENSIONS parseContext.globalCheck($1.loc, "callableDataNV"); parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangRayGenNVMask | EShLangClosestHitNVMask | EShLangMissNVMask | EShLangCallableNVMask), "callableDataNV"); parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "callableDataNV"); $$.init($1.loc); $$.qualifier.storage = EvqCallableDataNV; -#endif } | CALLDATAINNV { -#ifdef NV_EXTENSIONS parseContext.globalCheck($1.loc, "callableDataInNV"); parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangCallableNVMask), "callableDataInNV"); parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "callableDataInNV"); $$.init($1.loc); $$.qualifier.storage = EvqCallableDataInNV; -#endif - } - | SHARED { - parseContext.globalCheck($1.loc, "shared"); - parseContext.profileRequires($1.loc, ECoreProfile | ECompatibilityProfile, 430, E_GL_ARB_compute_shader, "shared"); - parseContext.profileRequires($1.loc, EEsProfile, 310, 0, "shared"); -#ifdef NV_EXTENSIONS - parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangComputeMask | EShLangMeshNVMask | EShLangTaskNVMask), "shared"); -#else - parseContext.requireStage($1.loc, EShLangCompute, "shared"); -#endif - $$.init($1.loc); - $$.qualifier.storage = EvqShared; } | COHERENT { $$.init($1.loc); @@ -1474,8 +1509,10 @@ storage_qualifier parseContext.unimplemented($1.loc, "subroutine"); $$.init($1.loc); } + ; + non_uniform_qualifier : NONUNIFORM { $$.init($1.loc); @@ -1494,6 +1531,7 @@ type_name_list } ; + type_specifier : type_specifier_nonarray type_parameter_specifier_opt { $$ = $1; @@ -1577,8 +1615,147 @@ type_specifier_nonarray $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtFloat; } + | INT { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtInt; + } + | UINT { + parseContext.fullIntegerCheck($1.loc, "unsigned integer"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtUint; + } + | BOOL { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtBool; + } + | VEC2 { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setVector(2); + } + | VEC3 { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setVector(3); + } + | VEC4 { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setVector(4); + } + | BVEC2 { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtBool; + $$.setVector(2); + } + | BVEC3 { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtBool; + $$.setVector(3); + } + | BVEC4 { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtBool; + $$.setVector(4); + } + | IVEC2 { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtInt; + $$.setVector(2); + } + | IVEC3 { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtInt; + $$.setVector(3); + } + | IVEC4 { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtInt; + $$.setVector(4); + } + | UVEC2 { + parseContext.fullIntegerCheck($1.loc, "unsigned integer vector"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtUint; + $$.setVector(2); + } + | UVEC3 { + parseContext.fullIntegerCheck($1.loc, "unsigned integer vector"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtUint; + $$.setVector(3); + } + | UVEC4 { + parseContext.fullIntegerCheck($1.loc, "unsigned integer vector"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtUint; + $$.setVector(4); + } + | MAT2 { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(2, 2); + } + | MAT3 { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(3, 3); + } + | MAT4 { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(4, 4); + } + | MAT2X2 { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(2, 2); + } + | MAT2X3 { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(2, 3); + } + | MAT2X4 { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(2, 4); + } + | MAT3X2 { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(3, 2); + } + | MAT3X3 { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(3, 3); + } + | MAT3X4 { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(3, 4); + } + | MAT4X2 { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(4, 2); + } + | MAT4X3 { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(4, 3); + } + | MAT4X4 { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(4, 4); + } + | DOUBLE { - parseContext.doubleCheck($1.loc, "double"); + parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck($1.loc, "double"); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtDouble; } @@ -1597,15 +1774,6 @@ type_specifier_nonarray $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtDouble; } - | INT { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtInt; - } - | UINT { - parseContext.fullIntegerCheck($1.loc, "unsigned integer"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtUint; - } | INT8_T { parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer", parseContext.symbolTable.atBuiltInLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -1646,39 +1814,26 @@ type_specifier_nonarray $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtUint64; } - | BOOL { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtBool; - } - | VEC2 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setVector(2); - } - | VEC3 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setVector(3); - } - | VEC4 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setVector(4); - } | DVEC2 { - parseContext.doubleCheck($1.loc, "double vector"); + parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double vector"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck($1.loc, "double vector"); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtDouble; $$.setVector(2); } | DVEC3 { - parseContext.doubleCheck($1.loc, "double vector"); + parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double vector"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck($1.loc, "double vector"); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtDouble; $$.setVector(3); } | DVEC4 { - parseContext.doubleCheck($1.loc, "double vector"); + parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double vector"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck($1.loc, "double vector"); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtDouble; $$.setVector(4); @@ -1737,36 +1892,6 @@ type_specifier_nonarray $$.basicType = EbtDouble; $$.setVector(4); } - | BVEC2 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtBool; - $$.setVector(2); - } - | BVEC3 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtBool; - $$.setVector(3); - } - | BVEC4 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtBool; - $$.setVector(4); - } - | IVEC2 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtInt; - $$.setVector(2); - } - | IVEC3 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtInt; - $$.setVector(3); - } - | IVEC4 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtInt; - $$.setVector(4); - } | I8VEC2 { parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -1839,24 +1964,6 @@ type_specifier_nonarray $$.basicType = EbtInt64; $$.setVector(4); } - | UVEC2 { - parseContext.fullIntegerCheck($1.loc, "unsigned integer vector"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtUint; - $$.setVector(2); - } - | UVEC3 { - parseContext.fullIntegerCheck($1.loc, "unsigned integer vector"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtUint; - $$.setVector(3); - } - | UVEC4 { - parseContext.fullIntegerCheck($1.loc, "unsigned integer vector"); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtUint; - $$.setVector(4); - } | U8VEC2 { parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -1929,134 +2036,98 @@ type_specifier_nonarray $$.basicType = EbtUint64; $$.setVector(4); } - | MAT2 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(2, 2); - } - | MAT3 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(3, 3); - } - | MAT4 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(4, 4); - } - | MAT2X2 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(2, 2); - } - | MAT2X3 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(2, 3); - } - | MAT2X4 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(2, 4); - } - | MAT3X2 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(3, 2); - } - | MAT3X3 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(3, 3); - } - | MAT3X4 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(3, 4); - } - | MAT4X2 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(4, 2); - } - | MAT4X3 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(4, 3); - } - | MAT4X4 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtFloat; - $$.setMatrix(4, 4); - } | DMAT2 { - parseContext.doubleCheck($1.loc, "double matrix"); + parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck($1.loc, "double matrix"); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtDouble; $$.setMatrix(2, 2); } | DMAT3 { - parseContext.doubleCheck($1.loc, "double matrix"); + parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck($1.loc, "double matrix"); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtDouble; $$.setMatrix(3, 3); } | DMAT4 { - parseContext.doubleCheck($1.loc, "double matrix"); + parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck($1.loc, "double matrix"); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtDouble; $$.setMatrix(4, 4); } | DMAT2X2 { - parseContext.doubleCheck($1.loc, "double matrix"); + parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck($1.loc, "double matrix"); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtDouble; $$.setMatrix(2, 2); } | DMAT2X3 { - parseContext.doubleCheck($1.loc, "double matrix"); + parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck($1.loc, "double matrix"); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtDouble; $$.setMatrix(2, 3); } | DMAT2X4 { - parseContext.doubleCheck($1.loc, "double matrix"); + parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck($1.loc, "double matrix"); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtDouble; $$.setMatrix(2, 4); } | DMAT3X2 { - parseContext.doubleCheck($1.loc, "double matrix"); + parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck($1.loc, "double matrix"); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtDouble; $$.setMatrix(3, 2); } | DMAT3X3 { - parseContext.doubleCheck($1.loc, "double matrix"); + parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck($1.loc, "double matrix"); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtDouble; $$.setMatrix(3, 3); } | DMAT3X4 { - parseContext.doubleCheck($1.loc, "double matrix"); + parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck($1.loc, "double matrix"); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtDouble; $$.setMatrix(3, 4); } | DMAT4X2 { - parseContext.doubleCheck($1.loc, "double matrix"); + parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck($1.loc, "double matrix"); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtDouble; $$.setMatrix(4, 2); } | DMAT4X3 { - parseContext.doubleCheck($1.loc, "double matrix"); + parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck($1.loc, "double matrix"); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtDouble; $$.setMatrix(4, 3); } | DMAT4X4 { - parseContext.doubleCheck($1.loc, "double matrix"); + parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck($1.loc, "double matrix"); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtDouble; $$.setMatrix(4, 4); @@ -2278,10 +2349,8 @@ type_specifier_nonarray $$.setMatrix(4, 4); } | ACCSTRUCTNV { -#ifdef NV_EXTENSIONS $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtAccStructNV; -#endif } | ATOMIC_UINT { parseContext.vulkanRemoved($1.loc, "atomic counter types"); @@ -2293,6 +2362,7 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.set(EbtFloat, Esd1D); } + | SAMPLER2D { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -2308,11 +2378,6 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.set(EbtFloat, EsdCube); } - | SAMPLER1DSHADOW { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat, Esd1D, false, true); - } | SAMPLER2DSHADOW { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -2323,25 +2388,31 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.set(EbtFloat, EsdCube, false, true); } - | SAMPLER1DARRAY { + | SAMPLER2DARRAY { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat, Esd1D, true); + $$.sampler.set(EbtFloat, Esd2D, true); } - | SAMPLER2DARRAY { + | SAMPLER2DARRAYSHADOW { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat, Esd2D, true); + $$.sampler.set(EbtFloat, Esd2D, true, true); } - | SAMPLER1DARRAYSHADOW { + + | SAMPLER1DSHADOW { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat, Esd1D, true, true); + $$.sampler.set(EbtFloat, Esd1D, false, true); } - | SAMPLER2DARRAYSHADOW { + | SAMPLER1DARRAY { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat, Esd2D, true, true); + $$.sampler.set(EbtFloat, Esd1D, true); + } + | SAMPLER1DARRAYSHADOW { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat, Esd1D, true, true); } | SAMPLERCUBEARRAY { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -2354,114 +2425,89 @@ type_specifier_nonarray $$.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 { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; $$.sampler.set(EbtInt, Esd1D); } + | ISAMPLER2D { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -2477,15 +2523,31 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.set(EbtInt, EsdCube); } - | ISAMPLER1DARRAY { + | ISAMPLER2DARRAY { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; - $$.sampler.set(EbtInt, Esd1D, true); + $$.sampler.set(EbtInt, Esd2D, true); } - | ISAMPLER2DARRAY { + | USAMPLER2D { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; - $$.sampler.set(EbtInt, Esd2D, true); + $$.sampler.set(EbtUint, Esd2D); + } + | USAMPLER3D { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtUint, Esd3D); + } + | USAMPLERCUBE { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtUint, EsdCube); + } + + | ISAMPLER1DARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtInt, Esd1D, true); } | ISAMPLERCUBEARRAY { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -2497,36 +2559,108 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.set(EbtUint, Esd1D); } - | USAMPLER2D { + | USAMPLER1DARRAY { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; - $$.sampler.set(EbtUint, Esd2D); + $$.sampler.set(EbtUint, Esd1D, true); } - | USAMPLER3D { + | USAMPLERCUBEARRAY { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; - $$.sampler.set(EbtUint, Esd3D); + $$.sampler.set(EbtUint, EsdCube, true); } - | USAMPLERCUBE { + | TEXTURECUBEARRAY { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; - $$.sampler.set(EbtUint, EsdCube); + $$.sampler.setTexture(EbtFloat, EsdCube, true); } - | USAMPLER1DARRAY { + | ITEXTURECUBEARRAY { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; - $$.sampler.set(EbtUint, Esd1D, true); + $$.sampler.setTexture(EbtInt, EsdCube, true); } + | UTEXTURECUBEARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtUint, EsdCube, true); + } + | USAMPLER2DARRAY { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; $$.sampler.set(EbtUint, Esd2D, true); } - | USAMPLERCUBEARRAY { + | TEXTURE2D { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; - $$.sampler.set(EbtUint, EsdCube, true); + $$.sampler.setTexture(EbtFloat, Esd2D); + } + | TEXTURE3D { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtFloat, Esd3D); + } + | TEXTURE2DARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtFloat, Esd2D, true); } + | TEXTURECUBE { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtFloat, EsdCube); + } + | ITEXTURE2D { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtInt, Esd2D); + } + | ITEXTURE3D { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtInt, Esd3D); + } + | ITEXTURECUBE { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtInt, EsdCube); + } + | ITEXTURE2DARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtInt, Esd2D, true); + } + | UTEXTURE2D { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtUint, Esd2D); + } + | UTEXTURE3D { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtUint, Esd3D); + } + | UTEXTURECUBE { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtUint, EsdCube); + } + | UTEXTURE2DARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtUint, Esd2D, true); + } + | SAMPLER { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setPureSampler(false); + } + | SAMPLERSHADOW { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setPureSampler(true); + } + | SAMPLER2DRECT { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -2538,20 +2672,16 @@ type_specifier_nonarray $$.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 { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -2569,12 +2699,10 @@ type_specifier_nonarray $$.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 { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -2592,12 +2720,10 @@ type_specifier_nonarray $$.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 { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -2615,12 +2741,10 @@ type_specifier_nonarray $$.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 { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -2632,67 +2756,34 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.set(EbtUint, Esd2D, true, false, true); } - | SAMPLER { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setPureSampler(false); - } - | SAMPLERSHADOW { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setPureSampler(true); - } | TEXTURE1D { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; $$.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 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.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 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.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 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.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 { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -2700,121 +2791,53 @@ type_specifier_nonarray $$.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 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.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 { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.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 { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; $$.sampler.setTexture(EbtInt, Esd1D); } - | ITEXTURE2D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtInt, Esd2D); - } - | ITEXTURE3D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtInt, Esd3D); - } - | ITEXTURECUBE { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtInt, EsdCube); - } | ITEXTURE1DARRAY { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; $$.sampler.setTexture(EbtInt, Esd1D, true); } - | ITEXTURE2DARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtInt, Esd2D, true); - } - | ITEXTURECUBEARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtInt, EsdCube, true); - } | UTEXTURE1D { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; $$.sampler.setTexture(EbtUint, Esd1D); } - | UTEXTURE2D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtUint, Esd2D); - } - | UTEXTURE3D { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtUint, Esd3D); - } - | UTEXTURECUBE { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtUint, EsdCube); - } | UTEXTURE1DARRAY { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; $$.sampler.setTexture(EbtUint, Esd1D, true); } - | UTEXTURE2DARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtUint, Esd2D, true); - } - | UTEXTURECUBEARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.setTexture(EbtUint, EsdCube, true); - } | TEXTURE2DRECT { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; $$.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 { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -2832,12 +2855,10 @@ type_specifier_nonarray $$.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 { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -2855,12 +2876,10 @@ type_specifier_nonarray $$.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 { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -2878,12 +2897,10 @@ type_specifier_nonarray $$.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 { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -2901,12 +2918,10 @@ type_specifier_nonarray $$.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 { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -2924,12 +2939,10 @@ type_specifier_nonarray $$.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 { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -2947,12 +2960,10 @@ type_specifier_nonarray $$.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 { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -2970,12 +2981,10 @@ type_specifier_nonarray $$.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 { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -2993,12 +3002,10 @@ type_specifier_nonarray $$.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 { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -3016,12 +3023,10 @@ type_specifier_nonarray $$.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 { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -3039,12 +3044,10 @@ type_specifier_nonarray $$.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 { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -3062,12 +3065,10 @@ type_specifier_nonarray $$.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 { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -3085,12 +3086,10 @@ type_specifier_nonarray $$.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 { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -3108,12 +3107,10 @@ type_specifier_nonarray $$.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 { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -3131,12 +3128,10 @@ type_specifier_nonarray $$.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 { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -3173,22 +3168,18 @@ type_specifier_nonarray $$.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 { parseContext.requireStage($1.loc, EShLangFragment, "subpass input"); @@ -3220,6 +3211,19 @@ type_specifier_nonarray $$.basicType = EbtFloat; $$.coopmat = true; } + | ICOOPMATNV { + parseContext.intcoopmatCheck($1.loc, "icoopmatNV", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtInt; + $$.coopmat = true; + } + | UCOOPMATNV { + parseContext.intcoopmatCheck($1.loc, "ucoopmatNV", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtUint; + $$.coopmat = true; + } + | struct_specifier { $$ = $1; $$.qualifier.storage = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; @@ -3300,7 +3304,7 @@ struct_declaration if ($1.arraySizes) { parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type"); - if (parseContext.profile == EEsProfile) + if (parseContext.isEsProfile()) parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes); } @@ -3322,7 +3326,7 @@ struct_declaration if ($2.arraySizes) { parseContext.profileRequires($2.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); parseContext.profileRequires($2.loc, EEsProfile, 300, 0, "arrayed type"); - if (parseContext.profile == EEsProfile) + if (parseContext.isEsProfile()) parseContext.arraySizeRequiredCheck($2.loc, *$2.arraySizes); } @@ -3374,6 +3378,7 @@ initializer : assignment_expression { $$ = $1; } + | LEFT_BRACE initializer_list RIGHT_BRACE { const char* initFeature = "{ } style initializers"; parseContext.requireProfile($1.loc, ~EEsProfile, initFeature); @@ -3386,8 +3391,10 @@ initializer parseContext.profileRequires($1.loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, initFeature); $$ = $2; } + ; + initializer_list : initializer { $$ = parseContext.intermediate.growAggregate(0, $1, $1->getLoc()); @@ -3397,6 +3404,7 @@ initializer_list } ; + declaration_statement : declaration { $$ = $1; } ; @@ -3416,8 +3424,21 @@ simple_statement | case_label { $$ = $1; } | iteration_statement { $$ = $1; } | jump_statement { $$ = $1; } + + | demote_statement { $$ = $1; } + ; + +demote_statement + : DEMOTE SEMICOLON { + parseContext.requireStage($1.loc, EShLangFragment, "demote"); + parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_demote_to_helper_invocation, "demote"); + $$ = parseContext.intermediate.addBranch(EOpDemote, $1.loc); + } + ; + + compound_statement : LEFT_BRACE RIGHT_BRACE { $$ = 0; } | LEFT_BRACE { @@ -3500,11 +3521,13 @@ selection_statement : selection_statement_nonattributed { $$ = $1; } + | attribute selection_statement_nonattributed { parseContext.handleSelectionAttributes(*$1, $2); $$ = $2; } + selection_statement_nonattributed : IF LEFT_PAREN expression RIGHT_PAREN selection_rest_statement { parseContext.boolCheck($1.loc, $3); @@ -3545,11 +3568,13 @@ switch_statement : switch_statement_nonattributed { $$ = $1; } + | attribute switch_statement_nonattributed { parseContext.handleSwitchAttributes(*$1, $2); $$ = $2; } + switch_statement_nonattributed : SWITCH LEFT_PAREN expression RIGHT_PAREN { // start new switch sequence on the switch stack @@ -3607,11 +3632,13 @@ iteration_statement : iteration_statement_nonattributed { $$ = $1; } + | attribute iteration_statement_nonattributed { parseContext.handleLoopAttributes(*$1, $2); $$ = $2; } + iteration_statement_nonattributed : WHILE LEFT_PAREN { if (! parseContext.limits.whileLoops) @@ -3742,11 +3769,13 @@ external_declaration | declaration { $$ = $1; } + | SEMICOLON { parseContext.requireProfile($1.loc, ~EEsProfile, "extraneous semicolon"); parseContext.profileRequires($1.loc, ~EEsProfile, 460, nullptr, "extraneous semicolon"); $$ = nullptr; } + ; function_definition @@ -3771,6 +3800,7 @@ function_definition } ; + attribute : LEFT_BRACKET LEFT_BRACKET attribute_list RIGHT_BRACKET RIGHT_BRACKET { $$ = $3; @@ -3793,4 +3823,5 @@ single_attribute $$ = parseContext.makeAttributes(*$1.string, $3); } + %% diff --git a/thirdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp b/thirdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp index 07feffea60..2a47faada4 100644 --- a/thirdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp +++ b/thirdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp @@ -62,7 +62,7 @@ /* Copy the first part of user declarations. */ -#line 43 "MachineIndependent/glslang.y" /* yacc.c:339 */ +#line 68 "MachineIndependent/glslang.y" /* yacc.c:339 */ /* Based on: @@ -123,271 +123,271 @@ extern int yydebug; # define YYTOKENTYPE enum yytokentype { - ATTRIBUTE = 258, - VARYING = 259, - FLOAT16_T = 260, - FLOAT = 261, - FLOAT32_T = 262, - DOUBLE = 263, - FLOAT64_T = 264, - CONST = 265, - BOOL = 266, - INT = 267, - UINT = 268, - INT64_T = 269, - UINT64_T = 270, - INT32_T = 271, - UINT32_T = 272, - INT16_T = 273, - UINT16_T = 274, - INT8_T = 275, - UINT8_T = 276, - BREAK = 277, - CONTINUE = 278, - DO = 279, - ELSE = 280, - FOR = 281, - IF = 282, - DISCARD = 283, - RETURN = 284, - SWITCH = 285, - CASE = 286, - DEFAULT = 287, - SUBROUTINE = 288, - BVEC2 = 289, - BVEC3 = 290, - BVEC4 = 291, - IVEC2 = 292, - IVEC3 = 293, - IVEC4 = 294, - UVEC2 = 295, - UVEC3 = 296, - UVEC4 = 297, - I64VEC2 = 298, - I64VEC3 = 299, - I64VEC4 = 300, - U64VEC2 = 301, - U64VEC3 = 302, - U64VEC4 = 303, - I32VEC2 = 304, - I32VEC3 = 305, - I32VEC4 = 306, - U32VEC2 = 307, - U32VEC3 = 308, - U32VEC4 = 309, - I16VEC2 = 310, - I16VEC3 = 311, - I16VEC4 = 312, - U16VEC2 = 313, - U16VEC3 = 314, - U16VEC4 = 315, - I8VEC2 = 316, - I8VEC3 = 317, - I8VEC4 = 318, - U8VEC2 = 319, - U8VEC3 = 320, - U8VEC4 = 321, - VEC2 = 322, - VEC3 = 323, - VEC4 = 324, - MAT2 = 325, - MAT3 = 326, - MAT4 = 327, - CENTROID = 328, - IN = 329, - OUT = 330, - INOUT = 331, - UNIFORM = 332, - PATCH = 333, - SAMPLE = 334, - BUFFER = 335, - SHARED = 336, - NONUNIFORM = 337, - PAYLOADNV = 338, - PAYLOADINNV = 339, - HITATTRNV = 340, - CALLDATANV = 341, - CALLDATAINNV = 342, - COHERENT = 343, - VOLATILE = 344, - RESTRICT = 345, - READONLY = 346, - WRITEONLY = 347, - DEVICECOHERENT = 348, - QUEUEFAMILYCOHERENT = 349, - WORKGROUPCOHERENT = 350, - SUBGROUPCOHERENT = 351, - NONPRIVATE = 352, - DVEC2 = 353, - DVEC3 = 354, - DVEC4 = 355, - DMAT2 = 356, - DMAT3 = 357, - DMAT4 = 358, - F16VEC2 = 359, - F16VEC3 = 360, - F16VEC4 = 361, - F16MAT2 = 362, - F16MAT3 = 363, - F16MAT4 = 364, - F32VEC2 = 365, - F32VEC3 = 366, - F32VEC4 = 367, - F32MAT2 = 368, - F32MAT3 = 369, - F32MAT4 = 370, - F64VEC2 = 371, - F64VEC3 = 372, - F64VEC4 = 373, - F64MAT2 = 374, - F64MAT3 = 375, - F64MAT4 = 376, - NOPERSPECTIVE = 377, - FLAT = 378, - SMOOTH = 379, - LAYOUT = 380, - EXPLICITINTERPAMD = 381, - PERVERTEXNV = 382, - PERPRIMITIVENV = 383, - PERVIEWNV = 384, - PERTASKNV = 385, - MAT2X2 = 386, - MAT2X3 = 387, - MAT2X4 = 388, - MAT3X2 = 389, - MAT3X3 = 390, - MAT3X4 = 391, - MAT4X2 = 392, - MAT4X3 = 393, - MAT4X4 = 394, - DMAT2X2 = 395, - DMAT2X3 = 396, - DMAT2X4 = 397, - DMAT3X2 = 398, - DMAT3X3 = 399, - DMAT3X4 = 400, - DMAT4X2 = 401, - DMAT4X3 = 402, - DMAT4X4 = 403, - F16MAT2X2 = 404, - F16MAT2X3 = 405, - F16MAT2X4 = 406, - F16MAT3X2 = 407, - F16MAT3X3 = 408, - F16MAT3X4 = 409, - F16MAT4X2 = 410, - F16MAT4X3 = 411, - F16MAT4X4 = 412, - F32MAT2X2 = 413, - F32MAT2X3 = 414, - F32MAT2X4 = 415, - F32MAT3X2 = 416, - F32MAT3X3 = 417, - F32MAT3X4 = 418, - F32MAT4X2 = 419, - F32MAT4X3 = 420, - F32MAT4X4 = 421, - F64MAT2X2 = 422, - F64MAT2X3 = 423, - F64MAT2X4 = 424, - F64MAT3X2 = 425, - F64MAT3X3 = 426, - F64MAT3X4 = 427, - F64MAT4X2 = 428, - F64MAT4X3 = 429, - F64MAT4X4 = 430, - ATOMIC_UINT = 431, - ACCSTRUCTNV = 432, - FCOOPMATNV = 433, - SAMPLER1D = 434, - SAMPLER2D = 435, - SAMPLER3D = 436, - SAMPLERCUBE = 437, - SAMPLER1DSHADOW = 438, - SAMPLER2DSHADOW = 439, - SAMPLERCUBESHADOW = 440, - SAMPLER1DARRAY = 441, - SAMPLER2DARRAY = 442, - SAMPLER1DARRAYSHADOW = 443, - SAMPLER2DARRAYSHADOW = 444, - ISAMPLER1D = 445, - ISAMPLER2D = 446, - ISAMPLER3D = 447, - ISAMPLERCUBE = 448, - ISAMPLER1DARRAY = 449, - ISAMPLER2DARRAY = 450, - USAMPLER1D = 451, - USAMPLER2D = 452, - USAMPLER3D = 453, - USAMPLERCUBE = 454, - USAMPLER1DARRAY = 455, - USAMPLER2DARRAY = 456, - SAMPLER2DRECT = 457, - SAMPLER2DRECTSHADOW = 458, - ISAMPLER2DRECT = 459, - USAMPLER2DRECT = 460, - SAMPLERBUFFER = 461, - ISAMPLERBUFFER = 462, - USAMPLERBUFFER = 463, - SAMPLERCUBEARRAY = 464, - SAMPLERCUBEARRAYSHADOW = 465, - ISAMPLERCUBEARRAY = 466, - USAMPLERCUBEARRAY = 467, - SAMPLER2DMS = 468, - ISAMPLER2DMS = 469, - USAMPLER2DMS = 470, - SAMPLER2DMSARRAY = 471, - ISAMPLER2DMSARRAY = 472, - USAMPLER2DMSARRAY = 473, - SAMPLEREXTERNALOES = 474, - SAMPLEREXTERNAL2DY2YEXT = 475, - F16SAMPLER1D = 476, - F16SAMPLER2D = 477, - F16SAMPLER3D = 478, - F16SAMPLER2DRECT = 479, - F16SAMPLERCUBE = 480, - F16SAMPLER1DARRAY = 481, - F16SAMPLER2DARRAY = 482, - F16SAMPLERCUBEARRAY = 483, - F16SAMPLERBUFFER = 484, - F16SAMPLER2DMS = 485, - F16SAMPLER2DMSARRAY = 486, - F16SAMPLER1DSHADOW = 487, - F16SAMPLER2DSHADOW = 488, - F16SAMPLER1DARRAYSHADOW = 489, - F16SAMPLER2DARRAYSHADOW = 490, - F16SAMPLER2DRECTSHADOW = 491, - F16SAMPLERCUBESHADOW = 492, - F16SAMPLERCUBEARRAYSHADOW = 493, - SAMPLER = 494, - SAMPLERSHADOW = 495, - TEXTURE1D = 496, - TEXTURE2D = 497, - TEXTURE3D = 498, - TEXTURECUBE = 499, - TEXTURE1DARRAY = 500, - TEXTURE2DARRAY = 501, - ITEXTURE1D = 502, - ITEXTURE2D = 503, - ITEXTURE3D = 504, - ITEXTURECUBE = 505, - ITEXTURE1DARRAY = 506, - ITEXTURE2DARRAY = 507, - UTEXTURE1D = 508, - UTEXTURE2D = 509, - UTEXTURE3D = 510, - UTEXTURECUBE = 511, - UTEXTURE1DARRAY = 512, - UTEXTURE2DARRAY = 513, - TEXTURE2DRECT = 514, - ITEXTURE2DRECT = 515, - UTEXTURE2DRECT = 516, - TEXTUREBUFFER = 517, - ITEXTUREBUFFER = 518, - UTEXTUREBUFFER = 519, - TEXTURECUBEARRAY = 520, - ITEXTURECUBEARRAY = 521, - UTEXTURECUBEARRAY = 522, + CONST = 258, + BOOL = 259, + INT = 260, + UINT = 261, + FLOAT = 262, + BVEC2 = 263, + BVEC3 = 264, + BVEC4 = 265, + IVEC2 = 266, + IVEC3 = 267, + IVEC4 = 268, + UVEC2 = 269, + UVEC3 = 270, + UVEC4 = 271, + VEC2 = 272, + VEC3 = 273, + VEC4 = 274, + MAT2 = 275, + MAT3 = 276, + MAT4 = 277, + MAT2X2 = 278, + MAT2X3 = 279, + MAT2X4 = 280, + MAT3X2 = 281, + MAT3X3 = 282, + MAT3X4 = 283, + MAT4X2 = 284, + MAT4X3 = 285, + MAT4X4 = 286, + SAMPLER2D = 287, + SAMPLER3D = 288, + SAMPLERCUBE = 289, + SAMPLER2DSHADOW = 290, + SAMPLERCUBESHADOW = 291, + SAMPLER2DARRAY = 292, + SAMPLER2DARRAYSHADOW = 293, + ISAMPLER2D = 294, + ISAMPLER3D = 295, + ISAMPLERCUBE = 296, + ISAMPLER2DARRAY = 297, + USAMPLER2D = 298, + USAMPLER3D = 299, + USAMPLERCUBE = 300, + USAMPLER2DARRAY = 301, + SAMPLER = 302, + SAMPLERSHADOW = 303, + TEXTURE2D = 304, + TEXTURE3D = 305, + TEXTURECUBE = 306, + TEXTURE2DARRAY = 307, + ITEXTURE2D = 308, + ITEXTURE3D = 309, + ITEXTURECUBE = 310, + ITEXTURE2DARRAY = 311, + UTEXTURE2D = 312, + UTEXTURE3D = 313, + UTEXTURECUBE = 314, + UTEXTURE2DARRAY = 315, + ATTRIBUTE = 316, + VARYING = 317, + FLOAT16_T = 318, + FLOAT32_T = 319, + DOUBLE = 320, + FLOAT64_T = 321, + INT64_T = 322, + UINT64_T = 323, + INT32_T = 324, + UINT32_T = 325, + INT16_T = 326, + UINT16_T = 327, + INT8_T = 328, + UINT8_T = 329, + I64VEC2 = 330, + I64VEC3 = 331, + I64VEC4 = 332, + U64VEC2 = 333, + U64VEC3 = 334, + U64VEC4 = 335, + I32VEC2 = 336, + I32VEC3 = 337, + I32VEC4 = 338, + U32VEC2 = 339, + U32VEC3 = 340, + U32VEC4 = 341, + I16VEC2 = 342, + I16VEC3 = 343, + I16VEC4 = 344, + U16VEC2 = 345, + U16VEC3 = 346, + U16VEC4 = 347, + I8VEC2 = 348, + I8VEC3 = 349, + I8VEC4 = 350, + U8VEC2 = 351, + U8VEC3 = 352, + U8VEC4 = 353, + DVEC2 = 354, + DVEC3 = 355, + DVEC4 = 356, + DMAT2 = 357, + DMAT3 = 358, + DMAT4 = 359, + F16VEC2 = 360, + F16VEC3 = 361, + F16VEC4 = 362, + F16MAT2 = 363, + F16MAT3 = 364, + F16MAT4 = 365, + F32VEC2 = 366, + F32VEC3 = 367, + F32VEC4 = 368, + F32MAT2 = 369, + F32MAT3 = 370, + F32MAT4 = 371, + F64VEC2 = 372, + F64VEC3 = 373, + F64VEC4 = 374, + F64MAT2 = 375, + F64MAT3 = 376, + F64MAT4 = 377, + DMAT2X2 = 378, + DMAT2X3 = 379, + DMAT2X4 = 380, + DMAT3X2 = 381, + DMAT3X3 = 382, + DMAT3X4 = 383, + DMAT4X2 = 384, + DMAT4X3 = 385, + DMAT4X4 = 386, + F16MAT2X2 = 387, + F16MAT2X3 = 388, + F16MAT2X4 = 389, + F16MAT3X2 = 390, + F16MAT3X3 = 391, + F16MAT3X4 = 392, + F16MAT4X2 = 393, + F16MAT4X3 = 394, + F16MAT4X4 = 395, + F32MAT2X2 = 396, + F32MAT2X3 = 397, + F32MAT2X4 = 398, + F32MAT3X2 = 399, + F32MAT3X3 = 400, + F32MAT3X4 = 401, + F32MAT4X2 = 402, + F32MAT4X3 = 403, + F32MAT4X4 = 404, + F64MAT2X2 = 405, + F64MAT2X3 = 406, + F64MAT2X4 = 407, + F64MAT3X2 = 408, + F64MAT3X3 = 409, + F64MAT3X4 = 410, + F64MAT4X2 = 411, + F64MAT4X3 = 412, + F64MAT4X4 = 413, + ATOMIC_UINT = 414, + ACCSTRUCTNV = 415, + FCOOPMATNV = 416, + ICOOPMATNV = 417, + UCOOPMATNV = 418, + SAMPLERCUBEARRAY = 419, + SAMPLERCUBEARRAYSHADOW = 420, + ISAMPLERCUBEARRAY = 421, + USAMPLERCUBEARRAY = 422, + SAMPLER1D = 423, + SAMPLER1DARRAY = 424, + SAMPLER1DARRAYSHADOW = 425, + ISAMPLER1D = 426, + SAMPLER1DSHADOW = 427, + SAMPLER2DRECT = 428, + SAMPLER2DRECTSHADOW = 429, + ISAMPLER2DRECT = 430, + USAMPLER2DRECT = 431, + SAMPLERBUFFER = 432, + ISAMPLERBUFFER = 433, + USAMPLERBUFFER = 434, + SAMPLER2DMS = 435, + ISAMPLER2DMS = 436, + USAMPLER2DMS = 437, + SAMPLER2DMSARRAY = 438, + ISAMPLER2DMSARRAY = 439, + USAMPLER2DMSARRAY = 440, + SAMPLEREXTERNALOES = 441, + SAMPLEREXTERNAL2DY2YEXT = 442, + ISAMPLER1DARRAY = 443, + USAMPLER1D = 444, + USAMPLER1DARRAY = 445, + F16SAMPLER1D = 446, + F16SAMPLER2D = 447, + F16SAMPLER3D = 448, + F16SAMPLER2DRECT = 449, + F16SAMPLERCUBE = 450, + F16SAMPLER1DARRAY = 451, + F16SAMPLER2DARRAY = 452, + F16SAMPLERCUBEARRAY = 453, + F16SAMPLERBUFFER = 454, + F16SAMPLER2DMS = 455, + F16SAMPLER2DMSARRAY = 456, + F16SAMPLER1DSHADOW = 457, + F16SAMPLER2DSHADOW = 458, + F16SAMPLER1DARRAYSHADOW = 459, + F16SAMPLER2DARRAYSHADOW = 460, + F16SAMPLER2DRECTSHADOW = 461, + F16SAMPLERCUBESHADOW = 462, + F16SAMPLERCUBEARRAYSHADOW = 463, + IMAGE1D = 464, + IIMAGE1D = 465, + UIMAGE1D = 466, + IMAGE2D = 467, + IIMAGE2D = 468, + UIMAGE2D = 469, + IMAGE3D = 470, + IIMAGE3D = 471, + UIMAGE3D = 472, + IMAGE2DRECT = 473, + IIMAGE2DRECT = 474, + UIMAGE2DRECT = 475, + IMAGECUBE = 476, + IIMAGECUBE = 477, + UIMAGECUBE = 478, + IMAGEBUFFER = 479, + IIMAGEBUFFER = 480, + UIMAGEBUFFER = 481, + IMAGE1DARRAY = 482, + IIMAGE1DARRAY = 483, + UIMAGE1DARRAY = 484, + IMAGE2DARRAY = 485, + IIMAGE2DARRAY = 486, + UIMAGE2DARRAY = 487, + IMAGECUBEARRAY = 488, + IIMAGECUBEARRAY = 489, + UIMAGECUBEARRAY = 490, + IMAGE2DMS = 491, + IIMAGE2DMS = 492, + UIMAGE2DMS = 493, + IMAGE2DMSARRAY = 494, + IIMAGE2DMSARRAY = 495, + UIMAGE2DMSARRAY = 496, + F16IMAGE1D = 497, + F16IMAGE2D = 498, + F16IMAGE3D = 499, + F16IMAGE2DRECT = 500, + F16IMAGECUBE = 501, + F16IMAGE1DARRAY = 502, + F16IMAGE2DARRAY = 503, + F16IMAGECUBEARRAY = 504, + F16IMAGEBUFFER = 505, + F16IMAGE2DMS = 506, + F16IMAGE2DMSARRAY = 507, + TEXTURECUBEARRAY = 508, + ITEXTURECUBEARRAY = 509, + UTEXTURECUBEARRAY = 510, + TEXTURE1D = 511, + ITEXTURE1D = 512, + UTEXTURE1D = 513, + TEXTURE1DARRAY = 514, + ITEXTURE1DARRAY = 515, + UTEXTURE1DARRAY = 516, + TEXTURE2DRECT = 517, + ITEXTURE2DRECT = 518, + UTEXTURE2DRECT = 519, + TEXTUREBUFFER = 520, + ITEXTUREBUFFER = 521, + UTEXTUREBUFFER = 522, TEXTURE2DMS = 523, ITEXTURE2DMS = 524, UTEXTURE2DMS = 525, @@ -413,121 +413,124 @@ extern int yydebug; USUBPASSINPUTMS = 545, F16SUBPASSINPUT = 546, F16SUBPASSINPUTMS = 547, - IMAGE1D = 548, - IIMAGE1D = 549, - UIMAGE1D = 550, - IMAGE2D = 551, - IIMAGE2D = 552, - UIMAGE2D = 553, - IMAGE3D = 554, - IIMAGE3D = 555, - UIMAGE3D = 556, - IMAGE2DRECT = 557, - IIMAGE2DRECT = 558, - UIMAGE2DRECT = 559, - IMAGECUBE = 560, - IIMAGECUBE = 561, - UIMAGECUBE = 562, - IMAGEBUFFER = 563, - IIMAGEBUFFER = 564, - UIMAGEBUFFER = 565, - IMAGE1DARRAY = 566, - IIMAGE1DARRAY = 567, - UIMAGE1DARRAY = 568, - IMAGE2DARRAY = 569, - IIMAGE2DARRAY = 570, - UIMAGE2DARRAY = 571, - IMAGECUBEARRAY = 572, - IIMAGECUBEARRAY = 573, - UIMAGECUBEARRAY = 574, - IMAGE2DMS = 575, - IIMAGE2DMS = 576, - UIMAGE2DMS = 577, - IMAGE2DMSARRAY = 578, - IIMAGE2DMSARRAY = 579, - UIMAGE2DMSARRAY = 580, - F16IMAGE1D = 581, - F16IMAGE2D = 582, - F16IMAGE3D = 583, - F16IMAGE2DRECT = 584, - F16IMAGECUBE = 585, - F16IMAGE1DARRAY = 586, - F16IMAGE2DARRAY = 587, - F16IMAGECUBEARRAY = 588, - F16IMAGEBUFFER = 589, - F16IMAGE2DMS = 590, - F16IMAGE2DMSARRAY = 591, - STRUCT = 592, - VOID = 593, - WHILE = 594, - IDENTIFIER = 595, - TYPE_NAME = 596, - FLOATCONSTANT = 597, - DOUBLECONSTANT = 598, - INT16CONSTANT = 599, - UINT16CONSTANT = 600, - INT32CONSTANT = 601, - UINT32CONSTANT = 602, - INTCONSTANT = 603, - UINTCONSTANT = 604, - INT64CONSTANT = 605, - UINT64CONSTANT = 606, - BOOLCONSTANT = 607, - FLOAT16CONSTANT = 608, - LEFT_OP = 609, - RIGHT_OP = 610, - INC_OP = 611, - DEC_OP = 612, - LE_OP = 613, - GE_OP = 614, - EQ_OP = 615, - NE_OP = 616, - AND_OP = 617, - OR_OP = 618, - XOR_OP = 619, - MUL_ASSIGN = 620, - DIV_ASSIGN = 621, - ADD_ASSIGN = 622, - MOD_ASSIGN = 623, - LEFT_ASSIGN = 624, - RIGHT_ASSIGN = 625, - AND_ASSIGN = 626, - XOR_ASSIGN = 627, - OR_ASSIGN = 628, - SUB_ASSIGN = 629, - LEFT_PAREN = 630, - RIGHT_PAREN = 631, - LEFT_BRACKET = 632, - RIGHT_BRACKET = 633, - LEFT_BRACE = 634, - RIGHT_BRACE = 635, - DOT = 636, - COMMA = 637, - COLON = 638, - EQUAL = 639, - SEMICOLON = 640, - BANG = 641, - DASH = 642, - TILDE = 643, - PLUS = 644, - STAR = 645, - SLASH = 646, - PERCENT = 647, - LEFT_ANGLE = 648, - RIGHT_ANGLE = 649, - VERTICAL_BAR = 650, - CARET = 651, - AMPERSAND = 652, - QUESTION = 653, - INVARIANT = 654, - PRECISE = 655, - HIGH_PRECISION = 656, - MEDIUM_PRECISION = 657, - LOW_PRECISION = 658, - PRECISION = 659, - PACKED = 660, - RESOURCE = 661, - SUPERP = 662 + LEFT_OP = 548, + RIGHT_OP = 549, + INC_OP = 550, + DEC_OP = 551, + LE_OP = 552, + GE_OP = 553, + EQ_OP = 554, + NE_OP = 555, + AND_OP = 556, + OR_OP = 557, + XOR_OP = 558, + MUL_ASSIGN = 559, + DIV_ASSIGN = 560, + ADD_ASSIGN = 561, + MOD_ASSIGN = 562, + LEFT_ASSIGN = 563, + RIGHT_ASSIGN = 564, + AND_ASSIGN = 565, + XOR_ASSIGN = 566, + OR_ASSIGN = 567, + SUB_ASSIGN = 568, + LEFT_PAREN = 569, + RIGHT_PAREN = 570, + LEFT_BRACKET = 571, + RIGHT_BRACKET = 572, + LEFT_BRACE = 573, + RIGHT_BRACE = 574, + DOT = 575, + COMMA = 576, + COLON = 577, + EQUAL = 578, + SEMICOLON = 579, + BANG = 580, + DASH = 581, + TILDE = 582, + PLUS = 583, + STAR = 584, + SLASH = 585, + PERCENT = 586, + LEFT_ANGLE = 587, + RIGHT_ANGLE = 588, + VERTICAL_BAR = 589, + CARET = 590, + AMPERSAND = 591, + QUESTION = 592, + INVARIANT = 593, + HIGH_PRECISION = 594, + MEDIUM_PRECISION = 595, + LOW_PRECISION = 596, + PRECISION = 597, + PACKED = 598, + RESOURCE = 599, + SUPERP = 600, + FLOATCONSTANT = 601, + INTCONSTANT = 602, + UINTCONSTANT = 603, + BOOLCONSTANT = 604, + IDENTIFIER = 605, + TYPE_NAME = 606, + CENTROID = 607, + IN = 608, + OUT = 609, + INOUT = 610, + STRUCT = 611, + VOID = 612, + WHILE = 613, + BREAK = 614, + CONTINUE = 615, + DO = 616, + ELSE = 617, + FOR = 618, + IF = 619, + DISCARD = 620, + RETURN = 621, + SWITCH = 622, + CASE = 623, + DEFAULT = 624, + UNIFORM = 625, + SHARED = 626, + BUFFER = 627, + FLAT = 628, + SMOOTH = 629, + LAYOUT = 630, + DOUBLECONSTANT = 631, + INT16CONSTANT = 632, + UINT16CONSTANT = 633, + FLOAT16CONSTANT = 634, + INT32CONSTANT = 635, + UINT32CONSTANT = 636, + INT64CONSTANT = 637, + UINT64CONSTANT = 638, + SUBROUTINE = 639, + DEMOTE = 640, + PAYLOADNV = 641, + PAYLOADINNV = 642, + HITATTRNV = 643, + CALLDATANV = 644, + CALLDATAINNV = 645, + PATCH = 646, + SAMPLE = 647, + NONUNIFORM = 648, + COHERENT = 649, + VOLATILE = 650, + RESTRICT = 651, + READONLY = 652, + WRITEONLY = 653, + DEVICECOHERENT = 654, + QUEUEFAMILYCOHERENT = 655, + WORKGROUPCOHERENT = 656, + SUBGROUPCOHERENT = 657, + NONPRIVATE = 658, + NOPERSPECTIVE = 659, + EXPLICITINTERPAMD = 660, + PERVERTEXNV = 661, + PERPRIMITIVENV = 662, + PERVIEWNV = 663, + PERTASKNV = 664, + PRECISE = 665 }; #endif @@ -536,7 +539,7 @@ extern int yydebug; union YYSTYPE { -#line 71 "MachineIndependent/glslang.y" /* yacc.c:355 */ +#line 96 "MachineIndependent/glslang.y" /* yacc.c:355 */ struct { glslang::TSourceLoc loc; @@ -572,7 +575,7 @@ union YYSTYPE glslang::TArraySizes* typeParameters; } interm; -#line 576 "MachineIndependent/glslang_tab.cpp" /* yacc.c:355 */ +#line 579 "MachineIndependent/glslang_tab.cpp" /* yacc.c:355 */ }; typedef union YYSTYPE YYSTYPE; @@ -587,7 +590,7 @@ int yyparse (glslang::TParseContext* pParseContext); #endif /* !YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED */ /* Copy the second part of user declarations. */ -#line 107 "MachineIndependent/glslang.y" /* yacc.c:358 */ +#line 132 "MachineIndependent/glslang.y" /* yacc.c:358 */ /* windows only pragma */ @@ -603,7 +606,7 @@ int yyparse (glslang::TParseContext* pParseContext); extern int yylex(YYSTYPE*, TParseContext&); -#line 607 "MachineIndependent/glslang_tab.cpp" /* yacc.c:358 */ +#line 610 "MachineIndependent/glslang_tab.cpp" /* yacc.c:358 */ #ifdef short # undef short @@ -843,23 +846,23 @@ union yyalloc #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ -#define YYFINAL 384 +#define YYFINAL 386 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 9348 +#define YYLAST 9369 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 408 +#define YYNTOKENS 411 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 110 +#define YYNNTS 111 /* YYNRULES -- Number of rules. */ -#define YYNRULES 578 +#define YYNRULES 582 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 722 +#define YYNSTATES 727 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 662 +#define YYMAXUTOK 665 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -934,71 +937,72 @@ static const yytype_uint16 yytranslate[] = 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, - 405, 406, 407 + 405, 406, 407, 408, 409, 410 }; #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 302, 302, 308, 311, 315, 319, 322, 326, 330, - 334, 338, 342, 345, 349, 353, 356, 364, 367, 370, - 373, 376, 381, 389, 396, 403, 409, 413, 420, 423, - 429, 436, 446, 454, 459, 486, 494, 500, 504, 508, - 528, 529, 530, 531, 537, 538, 543, 548, 557, 558, - 563, 571, 572, 578, 587, 588, 593, 598, 603, 611, - 612, 621, 633, 634, 643, 644, 653, 654, 663, 664, - 672, 673, 681, 682, 690, 691, 691, 709, 710, 726, - 730, 734, 738, 743, 747, 751, 755, 759, 763, 767, - 774, 777, 788, 795, 800, 805, 813, 817, 821, 825, - 830, 835, 844, 844, 855, 859, 866, 873, 876, 883, - 891, 911, 934, 949, 974, 985, 995, 1005, 1015, 1024, - 1027, 1031, 1035, 1040, 1048, 1053, 1058, 1063, 1068, 1077, - 1088, 1115, 1124, 1131, 1138, 1149, 1158, 1168, 1180, 1189, - 1201, 1207, 1210, 1217, 1221, 1225, 1233, 1242, 1245, 1256, - 1259, 1262, 1266, 1270, 1274, 1278, 1284, 1288, 1300, 1314, - 1319, 1325, 1331, 1338, 1344, 1349, 1354, 1359, 1369, 1379, - 1389, 1399, 1408, 1420, 1424, 1429, 1434, 1439, 1444, 1449, - 1453, 1457, 1461, 1465, 1471, 1480, 1487, 1490, 1498, 1503, - 1513, 1518, 1526, 1530, 1540, 1543, 1549, 1555, 1562, 1572, - 1576, 1580, 1585, 1590, 1595, 1600, 1604, 1609, 1614, 1619, - 1624, 1629, 1634, 1639, 1644, 1649, 1653, 1658, 1663, 1668, - 1674, 1680, 1686, 1692, 1698, 1704, 1710, 1716, 1722, 1728, - 1734, 1740, 1745, 1750, 1755, 1760, 1765, 1770, 1776, 1782, - 1788, 1794, 1800, 1806, 1812, 1818, 1824, 1830, 1836, 1842, - 1848, 1854, 1860, 1866, 1872, 1878, 1884, 1890, 1896, 1902, - 1908, 1914, 1920, 1926, 1932, 1937, 1942, 1947, 1952, 1957, - 1962, 1967, 1972, 1977, 1982, 1987, 1992, 1998, 2004, 2010, - 2016, 2022, 2028, 2034, 2040, 2046, 2052, 2058, 2064, 2070, - 2076, 2082, 2088, 2094, 2100, 2106, 2112, 2118, 2124, 2130, - 2136, 2142, 2148, 2154, 2160, 2166, 2172, 2178, 2184, 2190, - 2196, 2202, 2208, 2214, 2220, 2226, 2232, 2238, 2244, 2250, - 2256, 2262, 2268, 2274, 2280, 2286, 2291, 2296, 2301, 2306, - 2311, 2316, 2321, 2326, 2331, 2336, 2341, 2346, 2351, 2356, - 2364, 2372, 2380, 2388, 2396, 2404, 2412, 2420, 2428, 2436, - 2444, 2452, 2460, 2465, 2470, 2475, 2480, 2485, 2490, 2495, - 2500, 2505, 2510, 2515, 2520, 2525, 2530, 2535, 2540, 2548, - 2556, 2561, 2566, 2571, 2579, 2584, 2589, 2594, 2602, 2607, - 2612, 2617, 2625, 2630, 2635, 2640, 2645, 2650, 2658, 2663, - 2671, 2676, 2684, 2689, 2697, 2702, 2710, 2715, 2723, 2728, - 2736, 2741, 2746, 2751, 2756, 2761, 2766, 2771, 2776, 2781, - 2786, 2791, 2796, 2801, 2806, 2811, 2819, 2824, 2829, 2834, - 2842, 2847, 2852, 2857, 2865, 2870, 2875, 2880, 2888, 2893, - 2898, 2903, 2911, 2916, 2921, 2926, 2934, 2939, 2944, 2949, - 2957, 2962, 2967, 2972, 2980, 2985, 2990, 2995, 3003, 3008, - 3013, 3018, 3026, 3031, 3036, 3041, 3049, 3054, 3059, 3064, - 3072, 3077, 3082, 3087, 3095, 3100, 3105, 3110, 3118, 3123, - 3128, 3133, 3141, 3146, 3151, 3157, 3163, 3169, 3175, 3184, - 3193, 3199, 3205, 3211, 3217, 3223, 3228, 3244, 3249, 3254, - 3262, 3262, 3273, 3273, 3283, 3286, 3299, 3321, 3348, 3352, - 3358, 3363, 3374, 3377, 3383, 3392, 3395, 3401, 3405, 3406, - 3412, 3413, 3414, 3415, 3416, 3417, 3418, 3422, 3423, 3427, - 3423, 3439, 3440, 3444, 3444, 3451, 3451, 3465, 3468, 3476, - 3484, 3495, 3496, 3500, 3503, 3509, 3516, 3520, 3528, 3532, - 3545, 3548, 3554, 3554, 3574, 3577, 3583, 3595, 3607, 3610, - 3616, 3616, 3631, 3631, 3647, 3647, 3668, 3671, 3677, 3680, - 3686, 3690, 3697, 3702, 3707, 3714, 3717, 3726, 3730, 3739, - 3742, 3745, 3753, 3753, 3775, 3781, 3784, 3789, 3792 + 0, 352, 352, 358, 361, 366, 369, 372, 376, 380, + 384, 388, 392, 396, 400, 404, 408, 416, 419, 422, + 425, 428, 433, 441, 448, 455, 461, 465, 472, 475, + 481, 488, 498, 506, 511, 539, 548, 554, 558, 562, + 582, 583, 584, 585, 591, 592, 597, 602, 611, 612, + 617, 625, 626, 632, 641, 642, 647, 652, 657, 665, + 666, 675, 687, 688, 697, 698, 707, 708, 717, 718, + 726, 727, 735, 736, 744, 745, 745, 763, 764, 780, + 784, 788, 792, 797, 801, 805, 809, 813, 817, 821, + 828, 831, 842, 849, 854, 859, 866, 870, 874, 878, + 883, 888, 897, 897, 908, 912, 919, 926, 929, 936, + 944, 964, 987, 1002, 1027, 1038, 1048, 1058, 1068, 1077, + 1080, 1084, 1088, 1093, 1101, 1108, 1113, 1118, 1123, 1132, + 1142, 1169, 1178, 1185, 1193, 1200, 1207, 1215, 1225, 1232, + 1243, 1249, 1252, 1259, 1263, 1267, 1276, 1286, 1289, 1300, + 1303, 1306, 1310, 1314, 1319, 1323, 1330, 1334, 1339, 1345, + 1351, 1358, 1363, 1371, 1377, 1389, 1403, 1409, 1414, 1422, + 1430, 1438, 1446, 1453, 1457, 1462, 1467, 1472, 1477, 1482, + 1486, 1490, 1494, 1498, 1504, 1515, 1522, 1525, 1534, 1539, + 1549, 1554, 1562, 1566, 1576, 1579, 1585, 1591, 1598, 1608, + 1612, 1616, 1620, 1625, 1629, 1634, 1639, 1644, 1649, 1654, + 1659, 1664, 1669, 1674, 1680, 1686, 1692, 1697, 1702, 1707, + 1712, 1717, 1722, 1727, 1732, 1737, 1742, 1747, 1753, 1758, + 1763, 1768, 1773, 1778, 1783, 1788, 1793, 1798, 1803, 1808, + 1813, 1819, 1825, 1831, 1837, 1843, 1849, 1855, 1861, 1867, + 1873, 1879, 1885, 1891, 1897, 1903, 1909, 1915, 1921, 1927, + 1933, 1939, 1945, 1951, 1957, 1963, 1969, 1975, 1981, 1987, + 1993, 1999, 2005, 2011, 2017, 2023, 2029, 2035, 2041, 2047, + 2053, 2059, 2065, 2071, 2077, 2083, 2089, 2095, 2101, 2107, + 2113, 2119, 2125, 2131, 2137, 2143, 2149, 2155, 2161, 2167, + 2173, 2179, 2185, 2191, 2197, 2203, 2209, 2215, 2221, 2227, + 2233, 2239, 2245, 2251, 2257, 2263, 2269, 2275, 2281, 2287, + 2293, 2299, 2305, 2311, 2317, 2321, 2326, 2332, 2337, 2342, + 2347, 2352, 2357, 2362, 2368, 2373, 2378, 2383, 2388, 2393, + 2399, 2405, 2411, 2417, 2423, 2429, 2435, 2441, 2447, 2453, + 2459, 2465, 2471, 2477, 2482, 2487, 2492, 2497, 2502, 2507, + 2513, 2518, 2523, 2528, 2533, 2538, 2543, 2548, 2554, 2559, + 2564, 2569, 2574, 2579, 2584, 2589, 2594, 2599, 2604, 2609, + 2614, 2619, 2624, 2630, 2635, 2640, 2646, 2652, 2657, 2662, + 2667, 2673, 2678, 2683, 2688, 2694, 2699, 2704, 2709, 2715, + 2720, 2725, 2730, 2736, 2742, 2748, 2754, 2759, 2765, 2771, + 2777, 2782, 2787, 2792, 2797, 2802, 2808, 2813, 2818, 2823, + 2829, 2834, 2839, 2844, 2850, 2855, 2860, 2865, 2871, 2876, + 2881, 2886, 2892, 2897, 2902, 2907, 2913, 2918, 2923, 2928, + 2934, 2939, 2944, 2949, 2955, 2960, 2965, 2970, 2976, 2981, + 2986, 2991, 2997, 3002, 3007, 3012, 3018, 3023, 3028, 3033, + 3039, 3044, 3049, 3054, 3060, 3065, 3070, 3075, 3081, 3086, + 3091, 3096, 3102, 3107, 3112, 3118, 3124, 3130, 3136, 3143, + 3150, 3156, 3162, 3168, 3174, 3180, 3186, 3193, 3198, 3214, + 3219, 3224, 3232, 3232, 3243, 3243, 3253, 3256, 3269, 3291, + 3318, 3322, 3328, 3333, 3344, 3348, 3354, 3365, 3368, 3375, + 3379, 3380, 3386, 3387, 3388, 3389, 3390, 3391, 3392, 3394, + 3400, 3409, 3410, 3414, 3410, 3426, 3427, 3431, 3431, 3438, + 3438, 3452, 3455, 3463, 3471, 3482, 3483, 3487, 3491, 3498, + 3505, 3509, 3517, 3521, 3534, 3538, 3545, 3545, 3565, 3568, + 3574, 3586, 3598, 3602, 3609, 3609, 3624, 3624, 3640, 3640, + 3661, 3664, 3670, 3673, 3679, 3683, 3690, 3695, 3700, 3707, + 3710, 3719, 3723, 3732, 3735, 3739, 3748, 3748, 3771, 3777, + 3780, 3785, 3788 }; #endif @@ -1007,69 +1011,49 @@ static const yytype_uint16 yyrline[] = First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { - "$end", "error", "$undefined", "ATTRIBUTE", "VARYING", "FLOAT16_T", - "FLOAT", "FLOAT32_T", "DOUBLE", "FLOAT64_T", "CONST", "BOOL", "INT", - "UINT", "INT64_T", "UINT64_T", "INT32_T", "UINT32_T", "INT16_T", - "UINT16_T", "INT8_T", "UINT8_T", "BREAK", "CONTINUE", "DO", "ELSE", - "FOR", "IF", "DISCARD", "RETURN", "SWITCH", "CASE", "DEFAULT", - "SUBROUTINE", "BVEC2", "BVEC3", "BVEC4", "IVEC2", "IVEC3", "IVEC4", - "UVEC2", "UVEC3", "UVEC4", "I64VEC2", "I64VEC3", "I64VEC4", "U64VEC2", - "U64VEC3", "U64VEC4", "I32VEC2", "I32VEC3", "I32VEC4", "U32VEC2", - "U32VEC3", "U32VEC4", "I16VEC2", "I16VEC3", "I16VEC4", "U16VEC2", - "U16VEC3", "U16VEC4", "I8VEC2", "I8VEC3", "I8VEC4", "U8VEC2", "U8VEC3", - "U8VEC4", "VEC2", "VEC3", "VEC4", "MAT2", "MAT3", "MAT4", "CENTROID", - "IN", "OUT", "INOUT", "UNIFORM", "PATCH", "SAMPLE", "BUFFER", "SHARED", - "NONUNIFORM", "PAYLOADNV", "PAYLOADINNV", "HITATTRNV", "CALLDATANV", - "CALLDATAINNV", "COHERENT", "VOLATILE", "RESTRICT", "READONLY", - "WRITEONLY", "DEVICECOHERENT", "QUEUEFAMILYCOHERENT", - "WORKGROUPCOHERENT", "SUBGROUPCOHERENT", "NONPRIVATE", "DVEC2", "DVEC3", - "DVEC4", "DMAT2", "DMAT3", "DMAT4", "F16VEC2", "F16VEC3", "F16VEC4", - "F16MAT2", "F16MAT3", "F16MAT4", "F32VEC2", "F32VEC3", "F32VEC4", - "F32MAT2", "F32MAT3", "F32MAT4", "F64VEC2", "F64VEC3", "F64VEC4", - "F64MAT2", "F64MAT3", "F64MAT4", "NOPERSPECTIVE", "FLAT", "SMOOTH", - "LAYOUT", "EXPLICITINTERPAMD", "PERVERTEXNV", "PERPRIMITIVENV", - "PERVIEWNV", "PERTASKNV", "MAT2X2", "MAT2X3", "MAT2X4", "MAT3X2", - "MAT3X3", "MAT3X4", "MAT4X2", "MAT4X3", "MAT4X4", "DMAT2X2", "DMAT2X3", - "DMAT2X4", "DMAT3X2", "DMAT3X3", "DMAT3X4", "DMAT4X2", "DMAT4X3", - "DMAT4X4", "F16MAT2X2", "F16MAT2X3", "F16MAT2X4", "F16MAT3X2", - "F16MAT3X3", "F16MAT3X4", "F16MAT4X2", "F16MAT4X3", "F16MAT4X4", - "F32MAT2X2", "F32MAT2X3", "F32MAT2X4", "F32MAT3X2", "F32MAT3X3", - "F32MAT3X4", "F32MAT4X2", "F32MAT4X3", "F32MAT4X4", "F64MAT2X2", - "F64MAT2X3", "F64MAT2X4", "F64MAT3X2", "F64MAT3X3", "F64MAT3X4", - "F64MAT4X2", "F64MAT4X3", "F64MAT4X4", "ATOMIC_UINT", "ACCSTRUCTNV", - "FCOOPMATNV", "SAMPLER1D", "SAMPLER2D", "SAMPLER3D", "SAMPLERCUBE", - "SAMPLER1DSHADOW", "SAMPLER2DSHADOW", "SAMPLERCUBESHADOW", - "SAMPLER1DARRAY", "SAMPLER2DARRAY", "SAMPLER1DARRAYSHADOW", - "SAMPLER2DARRAYSHADOW", "ISAMPLER1D", "ISAMPLER2D", "ISAMPLER3D", - "ISAMPLERCUBE", "ISAMPLER1DARRAY", "ISAMPLER2DARRAY", "USAMPLER1D", - "USAMPLER2D", "USAMPLER3D", "USAMPLERCUBE", "USAMPLER1DARRAY", - "USAMPLER2DARRAY", "SAMPLER2DRECT", "SAMPLER2DRECTSHADOW", - "ISAMPLER2DRECT", "USAMPLER2DRECT", "SAMPLERBUFFER", "ISAMPLERBUFFER", - "USAMPLERBUFFER", "SAMPLERCUBEARRAY", "SAMPLERCUBEARRAYSHADOW", - "ISAMPLERCUBEARRAY", "USAMPLERCUBEARRAY", "SAMPLER2DMS", "ISAMPLER2DMS", - "USAMPLER2DMS", "SAMPLER2DMSARRAY", "ISAMPLER2DMSARRAY", + "$end", "error", "$undefined", "CONST", "BOOL", "INT", "UINT", "FLOAT", + "BVEC2", "BVEC3", "BVEC4", "IVEC2", "IVEC3", "IVEC4", "UVEC2", "UVEC3", + "UVEC4", "VEC2", "VEC3", "VEC4", "MAT2", "MAT3", "MAT4", "MAT2X2", + "MAT2X3", "MAT2X4", "MAT3X2", "MAT3X3", "MAT3X4", "MAT4X2", "MAT4X3", + "MAT4X4", "SAMPLER2D", "SAMPLER3D", "SAMPLERCUBE", "SAMPLER2DSHADOW", + "SAMPLERCUBESHADOW", "SAMPLER2DARRAY", "SAMPLER2DARRAYSHADOW", + "ISAMPLER2D", "ISAMPLER3D", "ISAMPLERCUBE", "ISAMPLER2DARRAY", + "USAMPLER2D", "USAMPLER3D", "USAMPLERCUBE", "USAMPLER2DARRAY", "SAMPLER", + "SAMPLERSHADOW", "TEXTURE2D", "TEXTURE3D", "TEXTURECUBE", + "TEXTURE2DARRAY", "ITEXTURE2D", "ITEXTURE3D", "ITEXTURECUBE", + "ITEXTURE2DARRAY", "UTEXTURE2D", "UTEXTURE3D", "UTEXTURECUBE", + "UTEXTURE2DARRAY", "ATTRIBUTE", "VARYING", "FLOAT16_T", "FLOAT32_T", + "DOUBLE", "FLOAT64_T", "INT64_T", "UINT64_T", "INT32_T", "UINT32_T", + "INT16_T", "UINT16_T", "INT8_T", "UINT8_T", "I64VEC2", "I64VEC3", + "I64VEC4", "U64VEC2", "U64VEC3", "U64VEC4", "I32VEC2", "I32VEC3", + "I32VEC4", "U32VEC2", "U32VEC3", "U32VEC4", "I16VEC2", "I16VEC3", + "I16VEC4", "U16VEC2", "U16VEC3", "U16VEC4", "I8VEC2", "I8VEC3", "I8VEC4", + "U8VEC2", "U8VEC3", "U8VEC4", "DVEC2", "DVEC3", "DVEC4", "DMAT2", + "DMAT3", "DMAT4", "F16VEC2", "F16VEC3", "F16VEC4", "F16MAT2", "F16MAT3", + "F16MAT4", "F32VEC2", "F32VEC3", "F32VEC4", "F32MAT2", "F32MAT3", + "F32MAT4", "F64VEC2", "F64VEC3", "F64VEC4", "F64MAT2", "F64MAT3", + "F64MAT4", "DMAT2X2", "DMAT2X3", "DMAT2X4", "DMAT3X2", "DMAT3X3", + "DMAT3X4", "DMAT4X2", "DMAT4X3", "DMAT4X4", "F16MAT2X2", "F16MAT2X3", + "F16MAT2X4", "F16MAT3X2", "F16MAT3X3", "F16MAT3X4", "F16MAT4X2", + "F16MAT4X3", "F16MAT4X4", "F32MAT2X2", "F32MAT2X3", "F32MAT2X4", + "F32MAT3X2", "F32MAT3X3", "F32MAT3X4", "F32MAT4X2", "F32MAT4X3", + "F32MAT4X4", "F64MAT2X2", "F64MAT2X3", "F64MAT2X4", "F64MAT3X2", + "F64MAT3X3", "F64MAT3X4", "F64MAT4X2", "F64MAT4X3", "F64MAT4X4", + "ATOMIC_UINT", "ACCSTRUCTNV", "FCOOPMATNV", "ICOOPMATNV", "UCOOPMATNV", + "SAMPLERCUBEARRAY", "SAMPLERCUBEARRAYSHADOW", "ISAMPLERCUBEARRAY", + "USAMPLERCUBEARRAY", "SAMPLER1D", "SAMPLER1DARRAY", + "SAMPLER1DARRAYSHADOW", "ISAMPLER1D", "SAMPLER1DSHADOW", "SAMPLER2DRECT", + "SAMPLER2DRECTSHADOW", "ISAMPLER2DRECT", "USAMPLER2DRECT", + "SAMPLERBUFFER", "ISAMPLERBUFFER", "USAMPLERBUFFER", "SAMPLER2DMS", + "ISAMPLER2DMS", "USAMPLER2DMS", "SAMPLER2DMSARRAY", "ISAMPLER2DMSARRAY", "USAMPLER2DMSARRAY", "SAMPLEREXTERNALOES", "SAMPLEREXTERNAL2DY2YEXT", - "F16SAMPLER1D", "F16SAMPLER2D", "F16SAMPLER3D", "F16SAMPLER2DRECT", - "F16SAMPLERCUBE", "F16SAMPLER1DARRAY", "F16SAMPLER2DARRAY", - "F16SAMPLERCUBEARRAY", "F16SAMPLERBUFFER", "F16SAMPLER2DMS", - "F16SAMPLER2DMSARRAY", "F16SAMPLER1DSHADOW", "F16SAMPLER2DSHADOW", - "F16SAMPLER1DARRAYSHADOW", "F16SAMPLER2DARRAYSHADOW", - "F16SAMPLER2DRECTSHADOW", "F16SAMPLERCUBESHADOW", - "F16SAMPLERCUBEARRAYSHADOW", "SAMPLER", "SAMPLERSHADOW", "TEXTURE1D", - "TEXTURE2D", "TEXTURE3D", "TEXTURECUBE", "TEXTURE1DARRAY", - "TEXTURE2DARRAY", "ITEXTURE1D", "ITEXTURE2D", "ITEXTURE3D", - "ITEXTURECUBE", "ITEXTURE1DARRAY", "ITEXTURE2DARRAY", "UTEXTURE1D", - "UTEXTURE2D", "UTEXTURE3D", "UTEXTURECUBE", "UTEXTURE1DARRAY", - "UTEXTURE2DARRAY", "TEXTURE2DRECT", "ITEXTURE2DRECT", "UTEXTURE2DRECT", - "TEXTUREBUFFER", "ITEXTUREBUFFER", "UTEXTUREBUFFER", "TEXTURECUBEARRAY", - "ITEXTURECUBEARRAY", "UTEXTURECUBEARRAY", "TEXTURE2DMS", "ITEXTURE2DMS", - "UTEXTURE2DMS", "TEXTURE2DMSARRAY", "ITEXTURE2DMSARRAY", - "UTEXTURE2DMSARRAY", "F16TEXTURE1D", "F16TEXTURE2D", "F16TEXTURE3D", - "F16TEXTURE2DRECT", "F16TEXTURECUBE", "F16TEXTURE1DARRAY", - "F16TEXTURE2DARRAY", "F16TEXTURECUBEARRAY", "F16TEXTUREBUFFER", - "F16TEXTURE2DMS", "F16TEXTURE2DMSARRAY", "SUBPASSINPUT", - "SUBPASSINPUTMS", "ISUBPASSINPUT", "ISUBPASSINPUTMS", "USUBPASSINPUT", - "USUBPASSINPUTMS", "F16SUBPASSINPUT", "F16SUBPASSINPUTMS", "IMAGE1D", + "ISAMPLER1DARRAY", "USAMPLER1D", "USAMPLER1DARRAY", "F16SAMPLER1D", + "F16SAMPLER2D", "F16SAMPLER3D", "F16SAMPLER2DRECT", "F16SAMPLERCUBE", + "F16SAMPLER1DARRAY", "F16SAMPLER2DARRAY", "F16SAMPLERCUBEARRAY", + "F16SAMPLERBUFFER", "F16SAMPLER2DMS", "F16SAMPLER2DMSARRAY", + "F16SAMPLER1DSHADOW", "F16SAMPLER2DSHADOW", "F16SAMPLER1DARRAYSHADOW", + "F16SAMPLER2DARRAYSHADOW", "F16SAMPLER2DRECTSHADOW", + "F16SAMPLERCUBESHADOW", "F16SAMPLERCUBEARRAYSHADOW", "IMAGE1D", "IIMAGE1D", "UIMAGE1D", "IMAGE2D", "IIMAGE2D", "UIMAGE2D", "IMAGE3D", "IIMAGE3D", "UIMAGE3D", "IMAGE2DRECT", "IIMAGE2DRECT", "UIMAGE2DRECT", "IMAGECUBE", "IIMAGECUBE", "UIMAGECUBE", "IMAGEBUFFER", "IIMAGEBUFFER", @@ -1080,11 +1064,18 @@ static const char *const yytname[] = "F16IMAGE1D", "F16IMAGE2D", "F16IMAGE3D", "F16IMAGE2DRECT", "F16IMAGECUBE", "F16IMAGE1DARRAY", "F16IMAGE2DARRAY", "F16IMAGECUBEARRAY", "F16IMAGEBUFFER", "F16IMAGE2DMS", - "F16IMAGE2DMSARRAY", "STRUCT", "VOID", "WHILE", "IDENTIFIER", - "TYPE_NAME", "FLOATCONSTANT", "DOUBLECONSTANT", "INT16CONSTANT", - "UINT16CONSTANT", "INT32CONSTANT", "UINT32CONSTANT", "INTCONSTANT", - "UINTCONSTANT", "INT64CONSTANT", "UINT64CONSTANT", "BOOLCONSTANT", - "FLOAT16CONSTANT", "LEFT_OP", "RIGHT_OP", "INC_OP", "DEC_OP", "LE_OP", + "F16IMAGE2DMSARRAY", "TEXTURECUBEARRAY", "ITEXTURECUBEARRAY", + "UTEXTURECUBEARRAY", "TEXTURE1D", "ITEXTURE1D", "UTEXTURE1D", + "TEXTURE1DARRAY", "ITEXTURE1DARRAY", "UTEXTURE1DARRAY", "TEXTURE2DRECT", + "ITEXTURE2DRECT", "UTEXTURE2DRECT", "TEXTUREBUFFER", "ITEXTUREBUFFER", + "UTEXTUREBUFFER", "TEXTURE2DMS", "ITEXTURE2DMS", "UTEXTURE2DMS", + "TEXTURE2DMSARRAY", "ITEXTURE2DMSARRAY", "UTEXTURE2DMSARRAY", + "F16TEXTURE1D", "F16TEXTURE2D", "F16TEXTURE3D", "F16TEXTURE2DRECT", + "F16TEXTURECUBE", "F16TEXTURE1DARRAY", "F16TEXTURE2DARRAY", + "F16TEXTURECUBEARRAY", "F16TEXTUREBUFFER", "F16TEXTURE2DMS", + "F16TEXTURE2DMSARRAY", "SUBPASSINPUT", "SUBPASSINPUTMS", "ISUBPASSINPUT", + "ISUBPASSINPUTMS", "USUBPASSINPUT", "USUBPASSINPUTMS", "F16SUBPASSINPUT", + "F16SUBPASSINPUTMS", "LEFT_OP", "RIGHT_OP", "INC_OP", "DEC_OP", "LE_OP", "GE_OP", "EQ_OP", "NE_OP", "AND_OP", "OR_OP", "XOR_OP", "MUL_ASSIGN", "DIV_ASSIGN", "ADD_ASSIGN", "MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN", "XOR_ASSIGN", "OR_ASSIGN", "SUB_ASSIGN", "LEFT_PAREN", @@ -1092,11 +1083,24 @@ static const char *const yytname[] = "RIGHT_BRACE", "DOT", "COMMA", "COLON", "EQUAL", "SEMICOLON", "BANG", "DASH", "TILDE", "PLUS", "STAR", "SLASH", "PERCENT", "LEFT_ANGLE", "RIGHT_ANGLE", "VERTICAL_BAR", "CARET", "AMPERSAND", "QUESTION", - "INVARIANT", "PRECISE", "HIGH_PRECISION", "MEDIUM_PRECISION", - "LOW_PRECISION", "PRECISION", "PACKED", "RESOURCE", "SUPERP", "$accept", - "variable_identifier", "primary_expression", "postfix_expression", - "integer_expression", "function_call", "function_call_or_method", - "function_call_generic", "function_call_header_no_parameters", + "INVARIANT", "HIGH_PRECISION", "MEDIUM_PRECISION", "LOW_PRECISION", + "PRECISION", "PACKED", "RESOURCE", "SUPERP", "FLOATCONSTANT", + "INTCONSTANT", "UINTCONSTANT", "BOOLCONSTANT", "IDENTIFIER", "TYPE_NAME", + "CENTROID", "IN", "OUT", "INOUT", "STRUCT", "VOID", "WHILE", "BREAK", + "CONTINUE", "DO", "ELSE", "FOR", "IF", "DISCARD", "RETURN", "SWITCH", + "CASE", "DEFAULT", "UNIFORM", "SHARED", "BUFFER", "FLAT", "SMOOTH", + "LAYOUT", "DOUBLECONSTANT", "INT16CONSTANT", "UINT16CONSTANT", + "FLOAT16CONSTANT", "INT32CONSTANT", "UINT32CONSTANT", "INT64CONSTANT", + "UINT64CONSTANT", "SUBROUTINE", "DEMOTE", "PAYLOADNV", "PAYLOADINNV", + "HITATTRNV", "CALLDATANV", "CALLDATAINNV", "PATCH", "SAMPLE", + "NONUNIFORM", "COHERENT", "VOLATILE", "RESTRICT", "READONLY", + "WRITEONLY", "DEVICECOHERENT", "QUEUEFAMILYCOHERENT", + "WORKGROUPCOHERENT", "SUBGROUPCOHERENT", "NONPRIVATE", "NOPERSPECTIVE", + "EXPLICITINTERPAMD", "PERVERTEXNV", "PERPRIMITIVENV", "PERVIEWNV", + "PERTASKNV", "PRECISE", "$accept", "variable_identifier", + "primary_expression", "postfix_expression", "integer_expression", + "function_call", "function_call_or_method", "function_call_generic", + "function_call_header_no_parameters", "function_call_header_with_parameters", "function_call_header", "function_identifier", "unary_expression", "unary_operator", "multiplicative_expression", "additive_expression", "shift_expression", @@ -1120,8 +1124,8 @@ static const char *const yytname[] = "$@3", "$@4", "struct_declaration_list", "struct_declaration", "struct_declarator_list", "struct_declarator", "initializer", "initializer_list", "declaration_statement", "statement", - "simple_statement", "compound_statement", "$@5", "$@6", - "statement_no_new_scope", "statement_scoped", "$@7", "$@8", + "simple_statement", "demote_statement", "compound_statement", "$@5", + "$@6", "statement_no_new_scope", "statement_scoped", "$@7", "$@8", "compound_statement_no_new_scope", "statement_list", "expression_statement", "selection_statement", "selection_statement_nonattributed", "selection_rest_statement", @@ -1180,16 +1184,17 @@ static const yytype_uint16 yytoknum[] = 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, - 655, 656, 657, 658, 659, 660, 661, 662 + 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, + 665 }; # endif -#define YYPACT_NINF -659 +#define YYPACT_NINF -453 #define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-659))) + (!!((Yystate) == (-453))) -#define YYTABLE_NINF -524 +#define YYTABLE_NINF -528 #define yytable_value_is_error(Yytable_value) \ 0 @@ -1198,79 +1203,79 @@ static const yytype_uint16 yytoknum[] = STATE-NUM. */ static const yytype_int16 yypact[] = { - 3535, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -331, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -324, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -319, -659, -659, -659, -659, -659, - -659, -659, -659, -256, -659, -314, -351, -309, -306, 5942, - -257, -659, -217, -659, -659, -659, -659, 4338, -659, -659, - -659, -659, -241, -659, -659, 721, -659, -659, -204, -71, - -219, -659, 9007, -349, -659, -659, -215, -659, 5942, -659, - -659, -659, 5942, -178, -172, -659, -337, -267, -659, -659, - -659, 8237, -207, -659, -659, -659, -659, -341, -659, -211, - -330, -659, -659, 5942, -210, 6697, -659, -322, 1123, -659, - -659, -659, -659, -207, -328, -659, 7082, -304, -659, -163, - -659, -252, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -659, -659, -659, 8237, 8237, 8237, -659, -659, - -659, -659, -659, -659, -303, -659, -659, -659, -196, -299, - 8622, -194, -659, 8237, -659, -659, -355, -195, -659, -157, - 8237, -659, -71, 5942, 5942, -155, 4739, -659, -659, -659, - -659, -242, -236, -249, -335, -206, -191, -187, -209, -149, - -150, -333, -162, 7467, -659, -170, -168, -659, -154, -153, - -167, 7852, -152, 8237, -159, -148, -151, -160, -659, -659, - -274, -659, -659, -251, -659, -351, -147, -144, -659, -659, - -659, -659, 1525, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -19, -195, 7082, -302, 7082, -659, -659, 7082, - 5942, -659, -115, -659, -659, -659, -292, -659, -659, 8237, - -108, -659, -659, 8237, -143, -659, -659, -659, 8237, -659, - -659, -659, -659, -659, 5140, -155, -207, -250, -659, -659, - -659, 8237, 8237, 8237, 8237, 8237, 8237, 8237, 8237, 8237, - 8237, 8237, 8237, 8237, 8237, 8237, 8237, 8237, 8237, 8237, - -659, -659, -659, -142, -659, -659, 1927, -659, 8237, -659, - -659, -245, 8237, -226, -659, -659, -106, -659, 1927, -659, - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - 8237, 8237, -659, -659, -659, -659, -659, -659, -659, 7082, - -659, -238, -659, 5541, -659, -659, -141, -140, -659, -659, - -659, -659, -244, -195, -155, -659, -659, -659, -659, -242, - -242, -236, -236, -249, -249, -249, -249, -335, -335, -206, - -191, -187, -209, -149, -150, 8237, -659, -104, 3133, -263, - -659, -260, -659, 3937, -136, -297, -659, 1927, -659, -659, - -659, -659, 6312, -659, -659, -659, -659, -224, -135, -659, - -659, 3937, -138, -659, -140, -97, 5942, -132, 8237, -133, - -106, -134, -659, -659, 8237, 8237, -659, -137, -129, 224, - -128, 2731, -659, -127, -131, 2329, -126, -659, -659, -659, - -659, -255, 8237, 2329, -138, -659, -659, 1927, 7082, -659, - -659, -659, -659, -130, -140, -659, -659, 1927, -123, -659, - -659, -659 + 3994, -453, -453, -453, -453, -453, -453, -453, -453, -453, + -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, + -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, + -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, + -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, + -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, + -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, + -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, + -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, + -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, + -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, + -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, + -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, + -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, + -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, + -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, + -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, + -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, + -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, + -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, + -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, + -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, + -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, + -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, + -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, + -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, + -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, + -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, + -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, + -453, -453, -453, -453, -453, -453, 97, -453, -453, -453, + -453, -453, 6, -453, -453, -453, -453, -453, -453, -307, + -241, -453, -453, -453, -453, -453, -453, -453, -453, -453, + -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, + -453, -453, -453, -453, -453, -453, -453, -3, 95, 36, + 125, 6034, 82, -453, -22, -453, -453, -453, -453, 4402, + -453, -453, -453, -453, 131, -453, -453, 730, -453, -453, + 11, -453, 153, -28, 127, -453, 7, -453, 157, -453, + 6034, -453, -453, -453, 6034, 129, 134, -453, 13, -453, + 73, -453, -453, 8391, 162, -453, -453, -453, 161, 6034, + -453, 163, -453, -309, -453, -453, 27, 6831, -453, 16, + 1138, -453, -453, -453, -453, 162, 23, -453, 7221, 49, + -453, 138, -453, 87, 8391, 8391, 8391, -453, -453, -453, + -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, + -453, -453, -453, -453, -453, -453, 68, -453, -453, -453, + 174, 60, 8781, 176, -453, 8391, -453, -453, -320, 175, + -453, 6034, 142, 4810, -453, 6034, 8391, -453, -28, -453, + 143, -453, -453, 119, 128, 32, 21, 38, 158, 160, + 165, 195, 194, 18, 183, 7611, -453, 185, 184, -453, + -453, 188, 180, 181, -453, 196, 197, 190, 8001, 198, + 8391, 187, 193, 122, -453, -453, 91, -453, 95, 204, + 205, -453, -453, -453, -453, -453, 1546, -453, -453, -453, + -453, -453, -453, -453, -453, -453, -353, 175, 7221, 69, + 7221, -453, -453, 7221, 6034, -453, 170, -453, -453, -453, + 78, -453, -453, 8391, 171, -453, -453, 8391, 207, -453, + -453, -453, 8391, -453, 142, 162, 93, -453, -453, -453, + 5218, -453, -453, -453, -453, 8391, 8391, 8391, 8391, 8391, + 8391, 8391, 8391, 8391, 8391, 8391, 8391, 8391, 8391, 8391, + 8391, 8391, 8391, 8391, -453, -453, -453, 206, 177, -453, + 1954, -453, -453, -453, 1954, -453, 8391, -453, -453, 100, + 8391, 144, -453, -453, -453, -453, -453, -453, -453, -453, + -453, -453, -453, -453, -453, 8391, 8391, -453, -453, -453, + -453, -453, -453, -453, 7221, -453, 140, -453, 5626, -453, + -453, 209, 208, -453, -453, -453, 123, 175, 142, -453, + -453, -453, -453, -453, 119, 119, 128, 128, 32, 32, + 32, 32, 21, 21, 38, 158, 160, 165, 195, 194, + 8391, -453, 214, 56, -453, 1954, 3586, 172, 3178, 80, + -453, 81, -453, -453, -453, -453, -453, 6441, -453, -453, + -453, -453, 146, 8391, 215, 177, 212, 208, 186, 6034, + 219, 221, -453, -453, 3586, 220, -453, -453, -453, 8391, + 222, -453, -453, -453, 216, 2362, 8391, -453, 217, 227, + 182, 225, 2770, -453, 229, -453, -453, 7221, -453, -453, + -453, 89, 8391, 2362, 220, -453, -453, 1954, -453, 224, + 208, -453, -453, 1954, 226, -453, -453 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -1278,111 +1283,113 @@ static const yytype_int16 yypact[] = means the default is an error. */ static const yytype_uint16 yydefact[] = { - 0, 157, 158, 202, 200, 203, 201, 204, 156, 215, - 205, 206, 213, 214, 211, 212, 209, 210, 207, 208, - 183, 231, 232, 233, 234, 235, 236, 249, 250, 251, - 246, 247, 248, 261, 262, 263, 243, 244, 245, 258, - 259, 260, 240, 241, 242, 255, 256, 257, 237, 238, - 239, 252, 253, 254, 216, 217, 218, 264, 265, 266, - 162, 160, 161, 159, 165, 163, 164, 166, 172, 185, - 168, 169, 167, 170, 171, 173, 179, 180, 181, 182, - 174, 175, 176, 177, 178, 219, 220, 221, 276, 277, - 278, 222, 223, 224, 288, 289, 290, 225, 226, 227, - 300, 301, 302, 228, 229, 230, 312, 313, 314, 134, - 133, 132, 0, 135, 136, 137, 138, 139, 267, 268, - 269, 270, 271, 272, 273, 274, 275, 279, 280, 281, - 282, 283, 284, 285, 286, 287, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 303, 304, 305, 306, 307, - 308, 309, 310, 311, 315, 316, 317, 318, 319, 320, - 321, 322, 323, 325, 324, 484, 326, 327, 328, 329, - 330, 331, 332, 333, 334, 335, 336, 352, 353, 354, - 355, 356, 357, 359, 360, 361, 362, 363, 364, 366, - 367, 370, 371, 372, 374, 375, 337, 338, 358, 365, - 376, 378, 379, 380, 382, 383, 474, 475, 339, 340, - 341, 368, 342, 346, 347, 350, 373, 377, 381, 343, - 344, 348, 349, 369, 345, 351, 384, 385, 386, 388, - 390, 392, 394, 396, 400, 401, 402, 403, 404, 405, - 407, 408, 409, 410, 411, 412, 414, 416, 417, 418, - 420, 421, 398, 406, 413, 422, 424, 425, 426, 428, - 429, 387, 389, 391, 415, 393, 395, 397, 399, 419, - 423, 427, 476, 477, 480, 481, 482, 483, 478, 479, - 430, 432, 433, 434, 436, 437, 438, 440, 441, 442, - 444, 445, 446, 448, 449, 450, 452, 453, 454, 456, - 457, 458, 460, 461, 462, 464, 465, 466, 468, 469, - 470, 472, 473, 431, 435, 439, 443, 447, 455, 459, - 463, 451, 467, 471, 0, 199, 486, 571, 131, 146, - 487, 488, 489, 0, 570, 0, 572, 0, 108, 107, - 0, 119, 124, 153, 152, 150, 154, 0, 147, 149, - 155, 129, 195, 151, 485, 0, 567, 569, 0, 0, - 0, 492, 0, 0, 96, 93, 0, 106, 0, 115, - 109, 117, 0, 118, 0, 94, 125, 0, 99, 148, - 130, 0, 188, 194, 1, 568, 186, 0, 145, 143, - 0, 141, 490, 0, 0, 0, 97, 0, 0, 573, - 110, 114, 116, 112, 120, 111, 0, 126, 102, 0, - 100, 0, 2, 12, 13, 10, 11, 4, 5, 6, - 7, 8, 9, 15, 14, 0, 0, 0, 42, 41, - 43, 40, 3, 17, 36, 19, 24, 25, 0, 0, - 29, 0, 197, 0, 35, 33, 0, 189, 184, 0, - 0, 140, 0, 0, 0, 0, 0, 494, 95, 190, - 44, 48, 51, 54, 59, 62, 64, 66, 68, 70, - 72, 74, 0, 0, 98, 0, 0, 552, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 518, 527, 531, - 44, 77, 90, 0, 507, 0, 155, 129, 510, 529, - 509, 508, 0, 511, 512, 533, 513, 540, 514, 515, - 548, 516, 0, 113, 0, 121, 0, 502, 128, 0, - 0, 104, 0, 101, 37, 38, 0, 21, 22, 0, - 0, 27, 26, 0, 199, 30, 32, 39, 0, 196, - 187, 92, 144, 142, 0, 0, 500, 0, 498, 493, - 495, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 156, 203, 201, 202, 200, 207, 208, 209, 210, + 211, 212, 213, 214, 215, 204, 205, 206, 216, 217, + 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, + 327, 328, 329, 330, 331, 332, 333, 353, 354, 355, + 356, 357, 358, 359, 368, 381, 382, 369, 370, 372, + 371, 373, 374, 375, 376, 377, 378, 379, 380, 164, + 165, 229, 230, 228, 231, 238, 239, 236, 237, 234, + 235, 232, 233, 261, 262, 263, 273, 274, 275, 258, + 259, 260, 270, 271, 272, 255, 256, 257, 267, 268, + 269, 252, 253, 254, 264, 265, 266, 240, 241, 242, + 276, 277, 278, 243, 244, 245, 288, 289, 290, 246, + 247, 248, 300, 301, 302, 249, 250, 251, 312, 313, + 314, 279, 280, 281, 282, 283, 284, 285, 286, 287, + 291, 292, 293, 294, 295, 296, 297, 298, 299, 303, + 304, 305, 306, 307, 308, 309, 310, 311, 315, 316, + 317, 318, 319, 320, 321, 322, 323, 325, 324, 484, + 485, 486, 337, 338, 361, 364, 326, 335, 336, 352, + 334, 383, 384, 387, 388, 389, 391, 392, 393, 395, + 396, 397, 399, 400, 474, 475, 360, 362, 363, 339, + 340, 341, 385, 342, 346, 347, 350, 390, 394, 398, + 343, 344, 348, 349, 386, 345, 351, 430, 432, 433, + 434, 436, 437, 438, 440, 441, 442, 444, 445, 446, + 448, 449, 450, 452, 453, 454, 456, 457, 458, 460, + 461, 462, 464, 465, 466, 468, 469, 470, 472, 473, + 431, 435, 439, 443, 447, 455, 459, 463, 451, 467, + 471, 365, 366, 367, 401, 410, 412, 406, 411, 413, + 414, 416, 417, 418, 420, 421, 422, 424, 425, 426, + 428, 429, 402, 403, 404, 415, 405, 407, 408, 409, + 419, 423, 427, 476, 477, 480, 481, 482, 483, 478, + 479, 575, 131, 489, 490, 491, 0, 488, 160, 158, + 159, 157, 0, 199, 161, 162, 163, 133, 132, 0, + 183, 169, 170, 168, 171, 172, 166, 167, 185, 173, + 179, 180, 181, 182, 174, 175, 176, 177, 178, 134, + 135, 136, 137, 138, 139, 146, 574, 0, 576, 0, + 108, 107, 0, 119, 124, 153, 152, 150, 154, 0, + 147, 149, 155, 129, 195, 151, 487, 0, 571, 573, + 0, 494, 0, 0, 0, 96, 0, 93, 0, 106, + 0, 115, 109, 117, 0, 118, 0, 94, 125, 99, + 0, 148, 130, 0, 188, 194, 1, 572, 0, 0, + 492, 143, 145, 0, 141, 186, 0, 0, 97, 0, + 0, 577, 110, 114, 116, 112, 120, 111, 0, 126, + 102, 0, 100, 0, 0, 0, 0, 42, 41, 43, + 40, 5, 6, 7, 8, 2, 15, 13, 14, 16, + 9, 10, 11, 12, 3, 17, 36, 19, 24, 25, + 0, 0, 29, 0, 197, 0, 35, 33, 0, 189, + 95, 0, 0, 0, 496, 0, 0, 140, 0, 184, + 0, 190, 44, 48, 51, 54, 59, 62, 64, 66, + 68, 70, 72, 74, 0, 0, 98, 0, 522, 531, + 535, 0, 0, 0, 556, 0, 0, 0, 0, 0, + 0, 0, 0, 44, 77, 90, 0, 509, 0, 155, + 129, 512, 533, 511, 519, 510, 0, 513, 514, 537, + 515, 544, 516, 517, 552, 518, 0, 113, 0, 121, + 0, 504, 128, 0, 0, 104, 0, 101, 37, 38, + 0, 21, 22, 0, 0, 27, 26, 0, 199, 30, + 32, 39, 0, 196, 0, 502, 0, 500, 495, 497, + 0, 92, 144, 142, 187, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 75, 191, 192, 0, 563, 562, 0, 554, 0, 566, - 564, 0, 0, 0, 547, 550, 0, 517, 0, 80, - 81, 83, 82, 85, 86, 87, 88, 89, 84, 79, - 0, 0, 532, 528, 530, 534, 541, 549, 123, 0, - 505, 0, 127, 0, 105, 16, 0, 23, 20, 31, - 198, 491, 0, 501, 0, 496, 45, 46, 47, 50, - 49, 52, 53, 57, 58, 55, 56, 60, 61, 63, - 65, 67, 69, 71, 73, 0, 193, 0, 0, 0, - 565, 0, 546, 0, 577, 0, 575, 519, 78, 91, - 122, 503, 0, 103, 18, 497, 499, 0, 0, 557, - 556, 559, 525, 542, 538, 0, 0, 0, 0, 0, - 0, 0, 504, 506, 0, 0, 558, 0, 0, 537, - 0, 0, 535, 0, 0, 0, 0, 574, 576, 520, - 76, 0, 560, 0, 525, 524, 526, 544, 0, 522, - 551, 521, 578, 0, 561, 555, 536, 545, 0, 539, - 553, 543 + 0, 0, 0, 0, 75, 191, 192, 0, 0, 521, + 0, 554, 567, 566, 0, 558, 0, 570, 568, 0, + 0, 0, 551, 520, 80, 81, 83, 82, 85, 86, + 87, 88, 89, 84, 79, 0, 0, 536, 532, 534, + 538, 545, 553, 123, 0, 507, 0, 127, 0, 105, + 4, 0, 23, 20, 31, 198, 0, 503, 0, 498, + 493, 45, 46, 47, 50, 49, 52, 53, 57, 58, + 55, 56, 60, 61, 63, 65, 67, 69, 71, 73, + 0, 193, 581, 0, 579, 523, 0, 0, 0, 0, + 569, 0, 550, 78, 91, 122, 505, 0, 103, 18, + 499, 501, 0, 0, 0, 0, 0, 542, 0, 0, + 0, 0, 561, 560, 563, 529, 546, 506, 508, 0, + 0, 578, 580, 524, 0, 0, 0, 562, 0, 0, + 541, 0, 0, 539, 0, 76, 582, 0, 526, 555, + 525, 0, 564, 0, 529, 528, 530, 548, 543, 0, + 565, 559, 540, 549, 0, 557, 547 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, - -659, -659, -364, -659, -389, -385, -457, -384, -310, -307, - -305, -308, -301, -298, -659, -386, -659, -390, -659, -415, - -418, 1, -659, -659, -659, 2, -659, -659, -659, -110, - -105, -107, -659, -659, -628, -659, -659, -659, -659, -188, - -659, -336, -343, -659, 6, -659, 0, -334, -659, -659, - -659, -659, -67, -659, -659, -659, -431, -437, -277, -350, - -501, -659, -375, -488, -658, -414, -659, -659, -428, -426, - -659, -659, -87, -568, -368, -659, -231, -659, -388, -659, - -230, -659, -659, -659, -659, -228, -659, -659, -659, -659, - -659, -659, -659, -659, -70, -659, -659, -659, -659, -394 + -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, + -453, -453, 8696, -453, -89, -88, -122, -84, -19, -18, + -17, -16, -20, -15, -453, -85, -453, -98, -453, -110, + -119, 2, -453, -453, -453, 4, -453, -453, -453, 189, + 191, 192, -453, -453, -339, -453, -453, -453, -453, 98, + -453, -37, -44, -453, 9, -453, 0, -71, -453, -453, + -453, -453, 261, -453, -453, -453, -452, -137, 20, -68, + -209, -453, -96, -198, -326, -453, -136, -453, -453, -146, + -144, -453, -453, 200, -265, -87, -453, 57, -453, -112, + -453, 59, -453, -453, -453, -453, 61, -453, -453, -453, + -453, -453, -453, -453, -453, 228, -453, -453, -453, -453, + -99 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 432, 433, 434, 616, 435, 436, 437, 438, 439, - 440, 441, 490, 443, 461, 462, 463, 464, 465, 466, - 467, 468, 469, 470, 471, 491, 645, 492, 600, 493, - 542, 494, 335, 520, 411, 495, 337, 338, 339, 369, - 370, 371, 340, 341, 342, 343, 344, 345, 390, 391, - 346, 347, 348, 349, 444, 387, 445, 397, 382, 383, - 446, 352, 353, 354, 453, 393, 456, 457, 547, 548, - 518, 611, 498, 499, 500, 501, 588, 681, 710, 689, - 690, 691, 711, 502, 503, 504, 505, 692, 677, 506, - 507, 693, 718, 508, 509, 510, 653, 576, 648, 671, - 687, 688, 511, 355, 356, 357, 366, 512, 655, 656 + -1, 434, 435, 436, 621, 437, 438, 439, 440, 441, + 442, 443, 493, 445, 463, 464, 465, 466, 467, 468, + 469, 470, 471, 472, 473, 494, 650, 495, 605, 496, + 552, 497, 337, 524, 413, 498, 339, 340, 341, 371, + 372, 373, 342, 343, 344, 345, 346, 347, 393, 394, + 348, 349, 350, 351, 446, 396, 447, 399, 384, 385, + 448, 354, 355, 356, 455, 389, 453, 454, 546, 547, + 522, 616, 501, 502, 503, 504, 505, 580, 676, 709, + 700, 701, 702, 710, 506, 507, 508, 509, 703, 680, + 510, 511, 704, 724, 512, 513, 514, 656, 584, 658, + 684, 698, 699, 515, 357, 358, 359, 368, 516, 653, + 654 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -1390,82 +1397,245 @@ static const yytype_int16 yydefgoto[] = number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { - 351, 334, 336, 372, 379, 477, 350, 478, 479, 472, - 388, 482, 526, 608, 604, 610, 517, 442, 612, 550, - 657, 360, 544, 558, 559, 675, 363, 538, 395, 379, - 569, 460, 372, 706, 365, 448, 396, 709, 405, 539, - 395, 449, 407, 675, 358, 709, 451, 406, 447, 395, - 535, 359, 452, 527, 528, 473, 514, 454, 560, 561, - 361, 524, 525, 474, 541, 570, 581, 367, 583, 513, - 515, 364, -34, 473, 529, 473, 368, 532, 530, 537, - 519, 679, 609, 533, 615, 680, 460, 573, 647, 613, - 601, 589, 590, 591, 592, 593, 594, 595, 596, 597, - 598, 633, 634, 635, 636, 556, 557, 550, 660, 460, - 599, 379, 408, 672, 617, 409, 673, 454, 410, 601, - 454, 713, 601, 376, 517, 374, 517, 601, 375, 517, - 522, 601, 624, 523, 602, 625, 386, 601, 624, 717, - 650, 665, 661, 619, 662, 330, 331, 332, 551, 552, - 553, 554, 381, 555, 562, 563, 601, 652, 601, 684, - 392, 683, 403, 649, 398, 629, 630, 651, 404, 604, - 395, 631, 632, 450, 620, 458, 550, 521, 637, 638, - 531, 536, 473, 540, 454, 546, 566, 626, 627, 628, - 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, - 460, 460, 460, 460, 460, 460, 564, 719, 454, 565, - 658, 659, 623, 567, 568, 574, 571, 575, 579, 517, - 587, 577, 578, 582, 584, 614, 586, 585, -35, 604, - 667, -33, 618, -28, 654, 668, 646, 664, 674, 678, - 685, -523, 601, 694, 695, 697, 699, 703, 702, 704, - 712, 487, 707, 708, 639, 720, 674, 721, 640, 642, - 696, 641, 401, 400, 543, 402, 362, 643, 622, 389, - 701, 644, 517, 669, 666, 715, 705, 454, 716, 399, - 670, 605, 606, 686, 607, 385, 698, 714, 0, 0, - 0, 0, 541, 0, 700, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 460, 0, 0, 676, 517, 0, - 485, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 379, 0, 676, 0, 0, 0, 373, - 0, 0, 0, 0, 0, 350, 0, 380, 0, 0, - 0, 0, 0, 350, 0, 351, 334, 336, 0, 0, - 0, 350, 394, 0, 0, 0, 0, 0, 373, 0, - 0, 0, 373, 0, 350, 0, 0, 0, 350, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 455, 0, 0, 0, 0, 497, 350, - 0, 0, 0, 0, 496, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 455, 545, 0, 455, 0, 0, 350, - 350, 0, 350, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 497, 0, 0, 0, 0, 0, 496, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 455, 0, 0, 0, 0, 0, 350, 0, 0, 0, + 353, 542, 336, 550, 338, 481, 457, 363, 484, 352, + 485, 486, 458, 543, 489, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 618, 364, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 374, 381, 530, 409, 609, 613, + 521, 615, 474, 449, 617, 655, 549, 678, 562, 563, + 573, 365, 391, 397, 361, 560, 561, 407, 378, 397, + 381, 398, 475, 374, 517, 519, 408, 566, 567, 397, + 476, 375, 459, 392, 539, 678, 518, 366, 460, 382, + 352, 369, 451, 564, 565, 574, 362, 353, 352, 336, + 388, 338, 297, 531, 532, 475, 352, 302, 303, 708, + 375, 551, 523, 674, 375, 536, 716, 675, 589, 352, + 591, 537, -34, 352, 533, 475, 657, 708, 534, 452, + 577, 410, 614, 620, 411, 685, 686, 412, 352, 606, + 500, 606, 606, 376, 719, 665, 377, 381, 526, 499, + 606, 527, 606, 549, 628, 607, 451, 629, 451, 367, + 521, 606, 521, 622, 660, 521, 594, 595, 596, 597, + 598, 599, 600, 601, 602, 603, 293, 294, 295, 624, + 638, 639, 640, 641, 628, 604, 370, 670, 555, 556, + 557, 544, 723, 452, 558, 452, 559, 609, 688, 666, + 352, 667, 352, 383, 352, 606, 662, 606, 689, 634, + 635, 390, 636, 637, 627, 400, 659, 395, 397, 405, + 661, 549, 642, 643, 406, 450, 456, 451, 525, 535, + 540, 475, 545, 554, 568, 569, 571, 572, 718, 570, + 575, 578, 581, 579, 582, 583, 500, 663, 664, 592, + 585, 586, 590, 451, 587, 499, 521, 593, -35, -33, + 619, 623, -28, 651, 452, 609, 669, 652, 673, 606, + 681, 693, 691, 352, 695, 696, 694, 706, -527, 707, + 672, 712, 713, 478, 714, 726, 677, 717, 725, 644, + 452, 645, 648, 646, 690, 647, 553, 360, 649, 352, + 671, 402, 682, 403, 626, 715, 404, 721, 401, 521, + 722, 683, 697, 610, 677, 611, 692, 612, 0, 0, + 500, 451, 0, 0, 500, 387, 711, 0, 551, 499, + 0, 705, 0, 499, 0, 0, 0, 0, 0, 0, + 0, 0, 720, 0, 0, 0, 0, 0, 0, 521, + 0, 0, 0, 0, 0, 0, 0, 0, 452, 679, + 0, 0, 0, 0, 0, 0, 0, 352, 0, 0, + 0, 0, 0, 0, 0, 381, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 679, 0, 0, + 0, 0, 0, 0, 0, 500, 500, 0, 500, 0, + 0, 0, 0, 0, 499, 499, 0, 499, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 382, + 0, 0, 0, 0, 500, 0, 0, 0, 352, 0, + 0, 0, 0, 499, 0, 500, 0, 0, 0, 0, + 0, 0, 500, 0, 499, 0, 0, 0, 0, 0, + 0, 499, 0, 500, 0, 0, 0, 500, 0, 0, + 0, 0, 499, 500, 0, 0, 499, 0, 0, 0, + 386, 0, 499, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, + 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, + 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, + 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, + 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, + 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, + 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, + 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, + 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, + 288, 289, 290, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 455, 0, 0, 0, 0, 0, - 350, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 497, 0, 0, 0, - 0, 0, 496, 0, 0, 0, 0, 0, 497, 0, - 0, 0, 0, 0, 496, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 291, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 292, 293, + 294, 295, 296, 0, 0, 0, 0, 0, 0, 0, + 0, 297, 298, 299, 300, 301, 302, 303, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 455, 0, 0, 0, 0, 0, 350, + 304, 305, 306, 307, 308, 309, 0, 0, 0, 0, + 0, 0, 0, 0, 310, 0, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, + 335, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, + 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, + 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, + 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, + 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, + 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, + 290, 0, 0, 414, 415, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 416, 0, 477, 0, 478, 479, 0, 0, + 0, 0, 480, 417, 418, 419, 420, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 292, 293, 294, 295, + 296, 0, 0, 0, 421, 422, 423, 424, 425, 297, + 298, 299, 300, 301, 302, 303, 481, 482, 483, 484, + 0, 485, 486, 487, 488, 489, 490, 491, 304, 305, + 306, 307, 308, 309, 426, 427, 428, 429, 430, 431, + 432, 433, 310, 492, 311, 312, 313, 314, 315, 316, + 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, + 327, 328, 329, 330, 331, 332, 333, 334, 335, 1, + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, + 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, + 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, + 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, + 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, + 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, + 282, 283, 284, 285, 286, 287, 288, 289, 290, 0, + 0, 414, 415, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 497, 0, - 0, 0, 0, 497, 496, 0, 0, 497, 0, 496, - 0, 0, 0, 496, 0, 0, 0, 0, 0, 0, - 0, 497, 0, 0, 0, 0, 380, 496, 0, 0, - 0, 0, 350, 0, 0, 0, 0, 0, 0, 0, - 0, 497, 0, 0, 0, 497, 0, 496, 0, 0, - 0, 496, 0, 497, 0, 0, 0, 497, 0, 496, - 0, 0, 0, 496, 0, 0, 0, 497, 0, 0, - 0, 384, 0, 496, 1, 2, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, + 416, 0, 477, 0, 478, 608, 0, 0, 0, 0, + 480, 417, 418, 419, 420, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 292, 293, 294, 295, 296, 0, + 0, 0, 421, 422, 423, 424, 425, 297, 298, 299, + 300, 301, 302, 303, 481, 482, 483, 484, 0, 485, + 486, 487, 488, 489, 490, 491, 304, 305, 306, 307, + 308, 309, 426, 427, 428, 429, 430, 431, 432, 433, + 310, 492, 311, 312, 313, 314, 315, 316, 317, 318, + 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, + 329, 330, 331, 332, 333, 334, 335, 1, 2, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, + 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, + 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, + 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, + 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, + 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, + 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, + 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, + 284, 285, 286, 287, 288, 289, 290, 0, 0, 414, + 415, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 416, 0, + 477, 0, 478, 0, 0, 0, 0, 0, 480, 417, + 418, 419, 420, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 292, 293, 294, 295, 296, 0, 0, 0, + 421, 422, 423, 424, 425, 297, 298, 299, 300, 301, + 302, 303, 481, 482, 483, 484, 0, 485, 486, 487, + 488, 489, 490, 491, 304, 305, 306, 307, 308, 309, + 426, 427, 428, 429, 430, 431, 432, 433, 310, 492, + 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, + 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, + 331, 332, 333, 334, 335, 1, 2, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, @@ -1492,20 +1662,143 @@ static const yytype_int16 yytable[] = 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, - 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, - 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, - 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, - 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, - 0, 0, 326, 0, 0, 0, 0, 0, 0, 0, + 286, 287, 288, 289, 290, 0, 0, 414, 415, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 416, 0, 477, 0, + 400, 0, 0, 0, 0, 0, 480, 417, 418, 419, + 420, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 292, 293, 294, 295, 296, 0, 0, 0, 421, 422, + 423, 424, 425, 297, 298, 299, 300, 301, 302, 303, + 481, 482, 483, 484, 0, 485, 486, 487, 488, 489, + 490, 491, 304, 305, 306, 307, 308, 309, 426, 427, + 428, 429, 430, 431, 432, 433, 310, 492, 311, 312, + 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, + 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, + 333, 334, 335, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, + 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, + 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, + 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, + 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, + 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, + 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, + 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, + 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, + 288, 289, 290, 0, 0, 414, 415, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 416, 0, 477, 0, 0, 0, + 0, 0, 0, 0, 480, 417, 418, 419, 420, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 292, 293, + 294, 295, 296, 0, 0, 0, 421, 422, 423, 424, + 425, 297, 298, 299, 300, 301, 302, 303, 481, 482, + 483, 484, 0, 485, 486, 487, 488, 489, 490, 491, + 304, 305, 306, 307, 308, 309, 426, 427, 428, 429, + 430, 431, 432, 433, 310, 492, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, + 335, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, + 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, + 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, + 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, + 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, + 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, + 290, 0, 0, 414, 415, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 327, 0, 0, 0, + 0, 0, 416, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 480, 417, 418, 419, 420, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 292, 293, 294, 295, + 296, 0, 0, 0, 421, 422, 423, 424, 425, 297, + 298, 299, 300, 301, 302, 303, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 304, 305, + 306, 307, 308, 309, 426, 427, 428, 429, 430, 431, + 432, 433, 310, 0, 311, 312, 313, 314, 315, 316, + 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, + 327, 328, 329, 330, 331, 332, 333, 334, 335, 1, + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, + 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, + 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, + 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, + 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, + 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, + 282, 283, 284, 285, 286, 287, 288, 289, 290, 0, + 0, 414, 415, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 328, 329, 330, 331, 332, 333, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 475, 476, 477, 0, 478, - 479, 480, 481, 482, 483, 484, 20, 21, 22, 23, + 416, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 417, 418, 419, 420, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 292, 293, 294, 295, 0, 0, + 0, 0, 421, 422, 423, 424, 425, 297, 298, 299, + 300, 301, 302, 303, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 304, 305, 306, 307, + 308, 309, 426, 427, 428, 429, 430, 431, 432, 433, + 310, 0, 311, 312, 313, 314, 315, 316, 317, 318, + 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, + 329, 330, 331, 332, 333, 334, 335, 1, 2, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, @@ -1532,141 +1825,21 @@ static const yytype_int16 yytable[] = 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, - 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, - 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, - 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, - 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, - 324, 325, 485, 412, 326, 413, 414, 415, 416, 417, - 418, 419, 420, 421, 422, 423, 424, 0, 0, 425, - 426, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 427, 0, - 486, 0, 487, 488, 0, 0, 0, 0, 489, 428, - 429, 430, 431, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 328, 329, 330, 331, 332, 333, 1, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 475, 476, 477, - 0, 478, 479, 480, 481, 482, 483, 484, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, - 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, - 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, - 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, - 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, - 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, - 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, - 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, - 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, - 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, - 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, - 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, - 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, - 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, - 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, - 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, - 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, - 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, - 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, - 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, - 322, 323, 324, 325, 485, 412, 326, 413, 414, 415, - 416, 417, 418, 419, 420, 421, 422, 423, 424, 0, - 0, 425, 426, 0, 0, 0, 0, 0, 0, 0, + 284, 285, 286, 287, 288, 289, 290, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 427, 0, 486, 0, 487, 603, 0, 0, 0, 0, - 489, 428, 429, 430, 431, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 328, 329, 330, 331, 332, 333, - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 475, - 476, 477, 0, 478, 479, 480, 481, 482, 483, 484, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, - 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, - 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, - 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, - 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, - 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, - 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, - 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, - 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, - 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, - 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, - 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, - 320, 321, 322, 323, 324, 325, 485, 412, 326, 413, - 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, - 424, 0, 0, 425, 426, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 427, 0, 486, 0, 487, 0, 0, 0, - 0, 0, 489, 428, 429, 430, 431, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 328, 329, 330, 331, - 332, 333, 1, 2, 3, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 475, 476, 477, 0, 478, 479, 480, 481, 482, - 483, 484, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, - 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, - 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, - 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, - 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, - 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, - 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, - 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, - 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, - 318, 319, 320, 321, 322, 323, 324, 325, 485, 412, - 326, 413, 414, 415, 416, 417, 418, 419, 420, 421, - 422, 423, 424, 0, 0, 425, 426, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 291, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 427, 0, 486, 0, 398, 0, - 0, 0, 0, 0, 489, 428, 429, 430, 431, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 328, 329, - 330, 331, 332, 333, 1, 2, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 475, 476, 477, 0, 478, 479, 480, - 481, 482, 483, 484, 20, 21, 22, 23, 24, 25, + 0, 0, 292, 293, 294, 295, 296, 0, 0, 0, + 0, 0, 0, 0, 0, 297, 298, 299, 300, 301, + 302, 303, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 304, 305, 306, 307, 308, 309, + 0, 0, 0, 0, 0, 0, 0, 0, 310, 0, + 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, + 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, + 331, 332, 333, 334, 335, 1, 2, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, @@ -1693,100 +1866,61 @@ static const yytype_int16 yytable[] = 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, - 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, - 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, - 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, - 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, - 485, 412, 326, 413, 414, 415, 416, 417, 418, 419, - 420, 421, 422, 423, 424, 0, 0, 425, 426, 0, + 286, 287, 288, 289, 290, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 427, 0, 486, 0, - 0, 0, 0, 0, 0, 0, 489, 428, 429, 430, - 431, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 328, 329, 330, 331, 332, 333, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, - 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, - 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, - 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, - 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, - 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, - 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, - 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, - 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, - 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, - 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, - 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, - 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, - 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, - 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, - 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, - 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, - 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, - 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, - 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, - 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, - 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, - 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, - 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, - 324, 325, 0, 412, 326, 413, 414, 415, 416, 417, - 418, 419, 420, 421, 422, 423, 424, 0, 0, 425, - 426, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 427, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 489, 428, - 429, 430, 431, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 328, 329, 330, 331, 332, 333, 1, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, - 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, - 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, - 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, - 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, - 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, - 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, - 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, - 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, - 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, - 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, - 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, - 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, - 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, - 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, - 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, - 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, - 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, - 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, - 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, - 322, 323, 324, 325, 0, 0, 326, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 379, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 292, 293, 294, 295, 0, 0, 0, 0, 0, 0, + 0, 0, 380, 297, 298, 299, 300, 301, 302, 303, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 304, 305, 306, 307, 308, 309, 0, 0, + 0, 0, 0, 0, 0, 0, 310, 0, 311, 312, + 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, + 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, + 333, 334, 335, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, + 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, + 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, + 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, + 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, + 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, + 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, + 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, + 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, + 288, 289, 290, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 548, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 327, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 328, 329, 330, 331, 332, 333, - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 292, 293, + 294, 295, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 297, 298, 299, 300, 301, 302, 303, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 304, 305, 306, 307, 308, 309, 0, 0, 0, 0, + 0, 0, 0, 0, 310, 0, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, + 335, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, @@ -1814,104 +1948,106 @@ static const yytype_int16 yytable[] = 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, - 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, - 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, - 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, - 320, 321, 322, 323, 324, 325, 0, 412, 326, 413, - 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, - 424, 0, 0, 425, 426, 0, 0, 0, 0, 0, + 290, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 427, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 428, 429, 430, 431, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 328, 329, 330, 331, - 332, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 0, 0, 0, 0, 0, 0, 0, 630, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, - 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, - 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, - 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, - 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, - 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, - 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, - 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, - 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, - 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, - 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, - 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, - 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, - 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, - 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, - 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, - 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, - 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, - 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, - 319, 320, 321, 322, 323, 324, 325, 0, 377, 326, + 0, 0, 0, 0, 0, 0, 292, 293, 294, 295, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 297, + 298, 299, 300, 301, 302, 303, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 304, 305, + 306, 307, 308, 309, 0, 0, 0, 0, 0, 0, + 0, 0, 310, 0, 311, 312, 313, 314, 315, 316, + 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, + 327, 328, 329, 330, 331, 332, 333, 334, 335, 1, + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, + 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, + 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, + 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, + 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, + 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, + 282, 283, 284, 285, 286, 287, 288, 289, 290, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 668, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 292, 293, 294, 295, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 297, 298, 299, + 300, 301, 302, 303, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 304, 305, 306, 307, + 308, 309, 0, 0, 0, 0, 0, 0, 0, 0, + 310, 0, 311, 312, 313, 314, 315, 316, 317, 318, + 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, + 329, 330, 331, 332, 333, 334, 335, 1, 2, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, + 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, + 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, + 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, + 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, + 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, + 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, + 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, + 284, 285, 286, 287, 288, 289, 290, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 378, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 328, 329, 330, - 331, 332, 1, 2, 3, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, - 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, - 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, - 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, - 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, - 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, - 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, - 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, - 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, - 318, 319, 320, 321, 322, 323, 324, 325, 0, 0, - 326, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 549, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 328, 329, - 330, 331, 332, 1, 2, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 20, 21, 22, 23, 24, 25, 26, + 0, 0, 292, 293, 294, 295, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 297, 298, 299, 300, 301, + 302, 303, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 304, 305, 306, 307, 308, 309, + 0, 0, 0, 0, 0, 0, 0, 0, 310, 0, + 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, + 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, + 331, 332, 333, 334, 335, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 57, 58, 0, 0, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, @@ -1934,222 +2070,359 @@ static const yytype_int16 yytable[] = 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, - 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, - 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, - 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, - 317, 318, 319, 320, 321, 322, 323, 324, 325, 0, - 0, 326, 0, 0, 0, 0, 0, 0, 0, 0, + 287, 288, 289, 290, 0, 0, 414, 415, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 416, 0, 0, 0, 520, + 687, 0, 0, 0, 0, 0, 417, 418, 419, 420, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 421, 422, 423, + 424, 425, 297, 0, 0, 0, 0, 302, 303, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 621, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 328, - 329, 330, 331, 332, 1, 2, 3, 4, 5, 6, + 0, 0, 0, 0, 0, 0, 0, 426, 427, 428, + 429, 430, 431, 432, 433, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 318, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, - 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, - 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, - 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, - 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, - 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, - 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, - 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, - 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, - 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, - 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, - 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, - 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, - 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, - 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, - 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, - 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, - 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, - 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, - 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, - 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, - 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, - 0, 0, 326, 0, 0, 0, 0, 0, 0, 0, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 0, 0, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 0, 0, 414, 415, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 416, 0, 0, 461, 0, + 0, 0, 0, 0, 0, 0, 417, 418, 419, 420, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 421, 422, 423, + 424, 425, 297, 0, 0, 0, 0, 302, 303, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 663, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 426, 427, 428, + 429, 430, 431, 432, 433, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 318, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 0, 0, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 0, 0, 414, 415, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 328, 329, 330, 331, 332, 1, 2, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 0, 0, 326, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 416, 0, 0, 0, 520, + 0, 0, 0, 0, 0, 0, 417, 418, 419, 420, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 421, 422, 423, + 424, 425, 297, 0, 0, 0, 0, 302, 303, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 3, 4, 5, - 6, 7, 0, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 0, 0, 0, 0, 0, 0, - 0, 328, 329, 330, 331, 332, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 69, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 426, 427, 428, + 429, 430, 431, 432, 433, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 318, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 0, 0, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 0, 0, 414, 415, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 0, 412, 326, 413, 414, 415, 416, 417, 418, - 419, 420, 421, 422, 423, 424, 0, 0, 425, 426, + 0, 0, 0, 0, 0, 416, 0, 0, 576, 0, + 0, 0, 0, 0, 0, 0, 417, 418, 419, 420, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 427, 0, 0, - 0, 516, 682, 0, 0, 0, 0, 0, 428, 429, - 430, 431, 3, 4, 5, 6, 7, 0, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 0, + 0, 0, 0, 0, 0, 0, 0, 421, 422, 423, + 424, 425, 297, 0, 0, 0, 0, 302, 303, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 69, + 0, 0, 0, 0, 0, 0, 0, 426, 427, 428, + 429, 430, 431, 432, 433, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 318, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 0, 0, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 0, 0, 414, 415, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, - 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, - 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, - 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, - 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, - 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, - 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, - 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, - 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, - 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, - 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, - 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, - 320, 321, 322, 323, 324, 325, 0, 412, 326, 413, - 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, - 424, 0, 0, 425, 426, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 416, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 588, 417, 418, 419, 420, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 427, 0, 0, 459, 0, 0, 0, 0, - 0, 0, 0, 428, 429, 430, 431, 3, 4, 5, - 6, 7, 0, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 69, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 421, 422, 423, + 424, 425, 297, 0, 0, 0, 0, 302, 303, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 0, 412, 326, 413, 414, 415, 416, 417, 418, - 419, 420, 421, 422, 423, 424, 0, 0, 425, 426, + 0, 0, 0, 0, 0, 0, 0, 426, 427, 428, + 429, 430, 431, 432, 433, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 318, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 0, 0, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 0, 0, 414, 415, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 427, 0, 0, - 0, 516, 0, 0, 0, 0, 0, 0, 428, 429, - 430, 431, 3, 4, 5, 6, 7, 0, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 0, + 0, 0, 0, 0, 0, 416, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 417, 418, 419, 420, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 0, 0, 0, 0, 0, 0, 0, 421, 422, 423, + 424, 425, 297, 0, 0, 0, 0, 302, 303, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 426, 427, 428, + 429, 430, 431, 432, 433, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 318, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 0, 0, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 0, 0, 414, 415, 0, 444, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 462, 0, 416, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 417, 418, 419, 420, + 528, 529, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 421, 422, 423, + 424, 425, 297, 0, 0, 0, 0, 302, 538, 0, + 0, 541, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 462, 0, 0, 0, 0, 426, 427, 428, + 429, 430, 431, 432, 433, 0, 0, 0, 0, 0, + 0, 462, 0, 0, 318, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 625, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 631, 632, 633, 462, 462, 462, 462, 462, 462, + 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 462 +}; + +static const yytype_int16 yycheck[] = +{ + 0, 321, 0, 455, 0, 358, 315, 314, 361, 0, + 363, 364, 321, 333, 367, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 524, 314, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, + 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, + 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, + 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, + 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, + 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, + 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, + 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, + 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, + 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, + 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, + 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, + 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, + 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 290, 291, 292, 341, 349, 416, 378, 506, 518, + 408, 520, 397, 384, 523, 580, 453, 656, 297, 298, + 302, 324, 350, 316, 318, 293, 294, 314, 350, 316, + 374, 324, 316, 370, 405, 406, 323, 299, 300, 316, + 324, 341, 315, 371, 442, 684, 323, 350, 321, 349, + 341, 315, 389, 332, 333, 337, 350, 357, 349, 357, + 360, 357, 351, 295, 296, 316, 357, 356, 357, 695, + 370, 456, 323, 317, 374, 315, 702, 321, 488, 370, + 490, 321, 314, 374, 316, 316, 584, 713, 320, 389, + 475, 318, 323, 315, 321, 315, 315, 324, 389, 321, + 400, 321, 321, 321, 315, 614, 324, 451, 321, 400, + 321, 324, 321, 550, 321, 324, 453, 324, 455, 324, + 518, 321, 520, 533, 324, 523, 304, 305, 306, 307, + 308, 309, 310, 311, 312, 313, 339, 340, 341, 537, + 562, 563, 564, 565, 321, 323, 321, 324, 329, 330, + 331, 451, 717, 453, 326, 455, 328, 655, 667, 319, + 451, 321, 453, 332, 455, 321, 322, 321, 322, 558, + 559, 318, 560, 561, 545, 318, 586, 350, 316, 350, + 590, 618, 566, 567, 350, 324, 323, 524, 350, 315, + 314, 316, 350, 350, 336, 335, 301, 303, 707, 334, + 317, 316, 314, 319, 324, 324, 506, 605, 606, 322, + 314, 314, 314, 550, 324, 506, 614, 324, 314, 314, + 350, 350, 315, 317, 524, 723, 317, 350, 314, 321, + 358, 319, 317, 524, 315, 314, 350, 315, 318, 323, + 650, 324, 315, 318, 362, 319, 656, 318, 324, 568, + 550, 569, 572, 570, 673, 571, 458, 296, 573, 550, + 628, 370, 658, 374, 544, 701, 374, 713, 368, 667, + 714, 658, 684, 516, 684, 516, 675, 516, -1, -1, + 580, 618, -1, -1, 584, 357, 696, -1, 673, 580, + -1, 689, -1, 584, -1, -1, -1, -1, -1, -1, + -1, -1, 712, -1, -1, -1, -1, -1, -1, 707, + -1, -1, -1, -1, -1, -1, -1, -1, 618, 656, + -1, -1, -1, -1, -1, -1, -1, 618, -1, -1, + -1, -1, -1, -1, -1, 679, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 684, -1, -1, + -1, -1, -1, -1, -1, 655, 656, -1, 658, -1, + -1, -1, -1, -1, 655, 656, -1, 658, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 679, + -1, -1, -1, -1, 684, -1, -1, -1, 679, -1, + -1, -1, -1, 684, -1, 695, -1, -1, -1, -1, + -1, -1, 702, -1, 695, -1, -1, -1, -1, -1, + -1, 702, -1, 713, -1, -1, -1, 717, -1, -1, + -1, -1, 713, 723, -1, -1, 717, -1, -1, -1, + 0, -1, 723, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 69, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 85, 86, 87, 88, 89, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 118, 119, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, @@ -2167,66 +2440,193 @@ static const yytype_int16 yytable[] = 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, - 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, - 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, - 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, - 320, 321, 322, 323, 324, 325, 0, 412, 326, 413, - 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, - 424, 0, 0, 425, 426, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 427, 0, 0, 572, 0, 0, 0, 0, - 0, 0, 0, 428, 429, 430, 431, 3, 4, 5, - 6, 7, 0, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 69, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 0, 412, 326, 413, 414, 415, 416, 417, 418, - 419, 420, 421, 422, 423, 424, 0, 0, 425, 426, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 427, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 580, 428, 429, - 430, 431, 3, 4, 5, 6, 7, 0, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 290, 291, 292, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 324, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 338, 339, + 340, 341, 342, -1, -1, -1, -1, -1, -1, -1, + -1, 351, 352, 353, 354, 355, 356, 357, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 370, 371, 372, 373, 374, 375, -1, -1, -1, -1, + -1, -1, -1, -1, 384, -1, 386, 387, 388, 389, + 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, + 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, + 410, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, + 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, + 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, + 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, + 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, + 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, + 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, + 292, -1, -1, 295, 296, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 314, -1, 316, -1, 318, 319, -1, -1, + -1, -1, 324, 325, 326, 327, 328, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 338, 339, 340, 341, + 342, -1, -1, -1, 346, 347, 348, 349, 350, 351, + 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, + -1, 363, 364, 365, 366, 367, 368, 369, 370, 371, + 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, + 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, + 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, + 402, 403, 404, 405, 406, 407, 408, 409, 410, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, + 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, + 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, + 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, + 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, + 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, + 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, + 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, + 284, 285, 286, 287, 288, 289, 290, 291, 292, -1, + -1, 295, 296, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 314, -1, 316, -1, 318, 319, -1, -1, -1, -1, + 324, 325, 326, 327, 328, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 338, 339, 340, 341, 342, -1, + -1, -1, 346, 347, 348, 349, 350, 351, 352, 353, + 354, 355, 356, 357, 358, 359, 360, 361, -1, 363, + 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, + 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, + 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, + 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, + 404, 405, 406, 407, 408, 409, 410, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, + 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, + 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, + 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, + 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, + 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, + 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, + 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, + 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, + 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, + 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, + 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, + 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, + 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, + 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, + 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, + 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, + 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, + 286, 287, 288, 289, 290, 291, 292, -1, -1, 295, + 296, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 314, -1, + 316, -1, 318, -1, -1, -1, -1, -1, 324, 325, + 326, 327, 328, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 338, 339, 340, 341, 342, -1, -1, -1, + 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, + 356, 357, 358, 359, 360, 361, -1, 363, 364, 365, + 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, + 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, + 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 410, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, + 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, + 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, + 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, + 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, + 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, + 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, + 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, + 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, + 288, 289, 290, 291, 292, -1, -1, 295, 296, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 314, -1, 316, -1, + 318, -1, -1, -1, -1, -1, 324, 325, 326, 327, + 328, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 338, 339, 340, 341, 342, -1, -1, -1, 346, 347, + 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, + 358, 359, 360, 361, -1, 363, 364, 365, 366, 367, + 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, + 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, + 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, + 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, + 408, 409, 410, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 69, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 85, 86, 87, 88, 89, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 118, 119, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, @@ -2244,66 +2644,193 @@ static const yytype_int16 yytable[] = 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, - 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, - 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, - 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, - 320, 321, 322, 323, 324, 325, 0, 412, 326, 413, - 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, - 424, 0, 0, 425, 426, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 427, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 428, 429, 430, 431, 3, 4, 5, - 6, 7, 0, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 69, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 534, 0, 412, 326, 413, 414, 415, 416, 417, 418, - 419, 420, 421, 422, 423, 424, 0, 0, 425, 426, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 427, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 428, 429, - 430, 431, 3, 4, 5, 6, 7, 0, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 290, 291, 292, -1, -1, 295, 296, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 314, -1, 316, -1, -1, -1, + -1, -1, -1, -1, 324, 325, 326, 327, 328, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 338, 339, + 340, 341, 342, -1, -1, -1, 346, 347, 348, 349, + 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, + 360, 361, -1, 363, 364, 365, 366, 367, 368, 369, + 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, + 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, + 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, + 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, + 410, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, + 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, + 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, + 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, + 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, + 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, + 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, + 292, -1, -1, 295, 296, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 314, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 324, 325, 326, 327, 328, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 338, 339, 340, 341, + 342, -1, -1, -1, 346, 347, 348, 349, 350, 351, + 352, 353, 354, 355, 356, 357, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 370, 371, + 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, + 382, 383, 384, -1, 386, 387, 388, 389, 390, 391, + 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, + 402, 403, 404, 405, 406, 407, 408, 409, 410, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, + 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, + 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, + 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, + 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, + 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, + 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, + 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, + 284, 285, 286, 287, 288, 289, 290, 291, 292, -1, + -1, 295, 296, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 314, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 325, 326, 327, 328, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 338, 339, 340, 341, -1, -1, + -1, -1, 346, 347, 348, 349, 350, 351, 352, 353, + 354, 355, 356, 357, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 370, 371, 372, 373, + 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, + 384, -1, 386, 387, 388, 389, 390, 391, 392, 393, + 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, + 404, 405, 406, 407, 408, 409, 410, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, + 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, + 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, + 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, + 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, + 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, + 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, + 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, + 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, + 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, + 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, + 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, + 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, + 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, + 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, + 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, + 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, + 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, + 286, 287, 288, 289, 290, 291, 292, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 324, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 338, 339, 340, 341, 342, -1, -1, -1, + -1, -1, -1, -1, -1, 351, 352, 353, 354, 355, + 356, 357, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 370, 371, 372, 373, 374, 375, + -1, -1, -1, -1, -1, -1, -1, -1, 384, -1, + 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 410, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, + 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, + 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, + 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, + 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, + 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, + 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, + 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, + 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, + 288, 289, 290, 291, 292, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 324, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 338, 339, 340, 341, -1, -1, -1, -1, -1, -1, + -1, -1, 350, 351, 352, 353, 354, 355, 356, 357, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 370, 371, 372, 373, 374, 375, -1, -1, + -1, -1, -1, -1, -1, -1, 384, -1, 386, 387, + 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, + 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, + 408, 409, 410, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 85, 86, 87, 88, 89, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 118, 119, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, @@ -2321,93 +2848,147 @@ static const yytype_int16 yytable[] = 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, - 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, - 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, - 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, - 320, 321, 322, 323, 324, 325, 0, 0, 326 -}; - -static const yytype_int16 yycheck[] = -{ - 0, 0, 0, 339, 347, 24, 0, 26, 27, 395, - 81, 30, 427, 514, 502, 516, 406, 381, 519, 456, - 588, 340, 453, 358, 359, 653, 340, 382, 377, 372, - 363, 395, 368, 691, 385, 376, 385, 695, 375, 394, - 377, 382, 376, 671, 375, 703, 376, 384, 382, 377, - 440, 375, 382, 356, 357, 377, 384, 393, 393, 394, - 379, 425, 426, 385, 450, 398, 481, 376, 483, 403, - 404, 385, 375, 377, 377, 377, 382, 376, 381, 443, - 384, 378, 384, 382, 376, 382, 450, 473, 576, 520, - 382, 365, 366, 367, 368, 369, 370, 371, 372, 373, - 374, 558, 559, 560, 561, 354, 355, 544, 609, 473, - 384, 454, 379, 376, 529, 382, 376, 453, 385, 382, - 456, 376, 382, 340, 514, 382, 516, 382, 385, 519, - 382, 382, 382, 385, 385, 385, 340, 382, 382, 707, - 385, 385, 380, 533, 382, 401, 402, 403, 390, 391, - 392, 387, 393, 389, 360, 361, 382, 383, 382, 383, - 379, 662, 340, 578, 379, 554, 555, 582, 340, 657, - 377, 556, 557, 384, 538, 385, 613, 340, 562, 563, - 376, 375, 377, 340, 520, 340, 395, 551, 552, 553, - 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, - 564, 565, 566, 567, 568, 569, 397, 708, 544, 396, - 600, 601, 546, 362, 364, 385, 378, 385, 385, 609, - 380, 375, 375, 375, 383, 340, 377, 375, 375, 717, - 645, 375, 340, 376, 340, 339, 378, 378, 653, 375, - 375, 379, 382, 340, 376, 378, 380, 376, 385, 25, - 376, 379, 379, 384, 564, 385, 671, 380, 565, 567, - 678, 566, 372, 368, 452, 372, 333, 568, 545, 340, - 685, 569, 662, 648, 624, 703, 690, 613, 704, 366, - 648, 512, 512, 671, 512, 355, 680, 702, -1, -1, - -1, -1, 678, -1, 684, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 678, -1, -1, 653, 708, -1, - 339, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 676, -1, 671, -1, -1, -1, 339, - -1, -1, -1, -1, -1, 339, -1, 347, -1, -1, - -1, -1, -1, 347, -1, 355, 355, 355, -1, -1, - -1, 355, 362, -1, -1, -1, -1, -1, 368, -1, - -1, -1, 372, -1, 368, -1, -1, -1, 372, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 393, -1, -1, -1, -1, 398, 393, - -1, -1, -1, -1, 398, -1, -1, -1, -1, -1, + 290, 291, 292, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 319, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 338, 339, + 340, 341, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 351, 352, 353, 354, 355, 356, 357, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 370, 371, 372, 373, 374, 375, -1, -1, -1, -1, + -1, -1, -1, -1, 384, -1, 386, 387, 388, 389, + 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, + 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, + 410, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, + 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, + 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, + 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, + 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, + 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, + 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, + 292, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 453, 454, -1, 456, -1, -1, 453, - 454, -1, 456, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 319, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 338, 339, 340, 341, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 351, + 352, 353, 354, 355, 356, 357, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 370, 371, + 372, 373, 374, 375, -1, -1, -1, -1, -1, -1, + -1, -1, 384, -1, 386, 387, 388, 389, 390, 391, + 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, + 402, 403, 404, 405, 406, 407, 408, 409, 410, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, + 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, + 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, + 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, + 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, + 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, + 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, + 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, + 284, 285, 286, 287, 288, 289, 290, 291, 292, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 502, -1, -1, -1, -1, -1, 502, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 520, -1, -1, -1, -1, -1, 520, -1, -1, -1, + -1, -1, -1, -1, -1, 319, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 544, -1, -1, -1, -1, -1, - 544, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 338, 339, 340, 341, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 351, 352, 353, + 354, 355, 356, 357, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 370, 371, 372, 373, + 374, 375, -1, -1, -1, -1, -1, -1, -1, -1, + 384, -1, 386, 387, 388, 389, 390, 391, 392, 393, + 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, + 404, 405, 406, 407, 408, 409, 410, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, + 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, + 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, + 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, + 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, + 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, + 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, + 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, + 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, + 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, + 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, + 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, + 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, + 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, + 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, + 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, + 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, + 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, + 286, 287, 288, 289, 290, 291, 292, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 576, -1, -1, -1, - -1, -1, 576, -1, -1, -1, -1, -1, 588, -1, - -1, -1, -1, -1, 588, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 613, -1, -1, -1, -1, -1, 613, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 648, -1, - -1, -1, -1, 653, 648, -1, -1, 657, -1, 653, - -1, -1, -1, 657, -1, -1, -1, -1, -1, -1, - -1, 671, -1, -1, -1, -1, 676, 671, -1, -1, - -1, -1, 676, -1, -1, -1, -1, -1, -1, -1, - -1, 691, -1, -1, -1, 695, -1, 691, -1, -1, - -1, 695, -1, 703, -1, -1, -1, 707, -1, 703, - -1, -1, -1, 707, -1, -1, -1, 717, -1, -1, - -1, 0, -1, 717, 3, 4, 5, 6, 7, 8, + -1, -1, 338, 339, 340, 341, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 351, 352, 353, 354, 355, + 356, 357, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 370, 371, 372, 373, 374, 375, + -1, -1, -1, -1, -1, -1, -1, -1, 384, -1, + 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 410, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 33, 34, 35, 36, 37, 38, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 59, 60, -1, -1, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, @@ -2430,185 +3011,23 @@ static const yytype_int16 yycheck[] = 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, - 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, - 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, - 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, - 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, - 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, - -1, -1, 341, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 385, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 399, 400, 401, 402, 403, 404, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, -1, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, - 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, - 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, - 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, - 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, - 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, - 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, - 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, - 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, - 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, - 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, - 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, - 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, - 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, - 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, - 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, - 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, - 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, - 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, - 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, - 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, - 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, - 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, - 347, 348, 349, 350, 351, 352, 353, -1, -1, 356, - 357, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 375, -1, - 377, -1, 379, 380, -1, -1, -1, -1, 385, 386, - 387, 388, 389, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 399, 400, 401, 402, 403, 404, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, - 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, - 345, 346, 347, 348, 349, 350, 351, 352, 353, -1, - -1, 356, 357, -1, -1, -1, -1, -1, -1, -1, + 289, 290, 291, 292, -1, -1, 295, 296, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 375, -1, 377, -1, 379, 380, -1, -1, -1, -1, - 385, 386, 387, 388, 389, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 399, 400, 401, 402, 403, 404, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, -1, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, - 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, - 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, - 353, -1, -1, 356, 357, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 314, -1, -1, -1, 318, + 319, -1, -1, -1, -1, -1, 325, 326, 327, 328, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 375, -1, 377, -1, 379, -1, -1, -1, - -1, -1, 385, 386, 387, 388, 389, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 399, 400, 401, 402, - 403, 404, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, -1, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, - 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, - 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, - 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, - 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, - 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, - 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, - 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, - 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, - 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, - 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, - 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, - 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, - 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, - 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, - 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, - 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, - 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, - 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, - 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, - 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, - 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, - 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, - 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, - 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, - 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, - 351, 352, 353, -1, -1, 356, 357, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 346, 347, 348, + 349, 350, 351, -1, -1, -1, -1, 356, 357, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 375, -1, 377, -1, 379, -1, - -1, -1, -1, -1, 385, 386, 387, 388, 389, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 399, 400, - 401, 402, 403, 404, 3, 4, 5, 6, 7, 8, + -1, -1, -1, -1, -1, -1, -1, 376, 377, 378, + 379, 380, 381, 382, 383, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 393, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, -1, 26, 27, 28, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 59, 60, -1, -1, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, @@ -2631,265 +3050,62 @@ static const yytype_int16 yycheck[] = 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, - 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, - 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, - 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, - 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, - 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, - 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, - 349, 350, 351, 352, 353, -1, -1, 356, 357, -1, + 289, 290, 291, 292, -1, -1, 295, 296, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 375, -1, 377, -1, - -1, -1, -1, -1, -1, -1, 385, 386, 387, 388, - 389, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 399, 400, 401, 402, 403, 404, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, - 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, - 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, - 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, - 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, - 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, - 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, - 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, - 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, - 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, - 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, - 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, - 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, - 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, - 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, - 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, - 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, - 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, - 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, - 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, - 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, - 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, - 337, 338, -1, 340, 341, 342, 343, 344, 345, 346, - 347, 348, 349, 350, 351, 352, 353, -1, -1, 356, - 357, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 375, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 385, 386, - 387, 388, 389, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 399, 400, 401, 402, 403, 404, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, - 335, 336, 337, 338, -1, -1, 341, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 385, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 399, 400, 401, 402, 403, 404, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, -1, + -1, -1, -1, -1, -1, 314, -1, -1, 317, -1, + -1, -1, -1, -1, -1, -1, 325, 326, 327, 328, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, - 333, 334, 335, 336, 337, 338, -1, 340, 341, 342, - 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, - 353, -1, -1, 356, 357, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 346, 347, 348, + 349, 350, 351, -1, -1, -1, -1, 356, 357, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 375, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 386, 387, 388, 389, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 399, 400, 401, 402, - 403, 3, 4, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, - 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, - 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, - 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, - 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, - 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, - 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, - 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, - 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, - 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, - 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, - 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, - 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, - 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, - 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, - 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, - 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, - 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, - 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, - 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, - 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, - 332, 333, 334, 335, 336, 337, 338, -1, 340, 341, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 385, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 399, 400, 401, - 402, 403, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, - 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, - 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, - 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, - 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, - 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, - 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, - 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, - 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, - 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, - 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, - 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, - 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, - 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, - 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, - 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, - 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, - 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, - 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, - 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, - 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, - 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, - 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, - 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, - 331, 332, 333, 334, 335, 336, 337, 338, -1, -1, - 341, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 380, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 399, 400, - 401, 402, 403, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, - 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, - 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, - 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, - 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, - 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, - 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, - 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, - 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, - 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, - 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, - 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, - 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, - 330, 331, 332, 333, 334, 335, 336, 337, 338, -1, - -1, 341, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 376, 377, 378, + 379, 380, 381, 382, 383, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 393, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, -1, -1, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, + 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, + 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, + 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, + 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, + 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, + 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, + 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, + 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, + 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, + 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, + 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, + 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, + 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 290, 291, 292, -1, -1, 295, 296, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 314, -1, -1, -1, 318, + -1, -1, -1, -1, -1, -1, 325, 326, 327, 328, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 346, 347, 348, + 349, 350, 351, -1, -1, -1, -1, 356, 357, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 380, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 399, - 400, 401, 402, 403, 3, 4, 5, 6, 7, 8, + -1, -1, -1, -1, -1, -1, -1, 376, 377, 378, + 379, 380, 381, 382, 383, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 393, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 33, 34, 35, 36, 37, 38, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 59, 60, -1, -1, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, @@ -2912,358 +3128,153 @@ static const yytype_int16 yycheck[] = 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, - 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, - 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, - 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, - 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, - 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, - -1, -1, 341, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 289, 290, 291, 292, -1, -1, 295, 296, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 314, -1, -1, 317, -1, + -1, -1, -1, -1, -1, -1, 325, 326, 327, 328, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 380, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 346, 347, 348, + 349, 350, 351, -1, -1, -1, -1, 356, 357, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 399, 400, 401, 402, 403, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, - 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, - 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, - 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, - 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, - 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, - 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, - 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, - 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, - 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, - 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, - 338, -1, -1, 341, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 376, 377, 378, + 379, 380, 381, 382, 383, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 393, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, -1, -1, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, + 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, + 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, + 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, + 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, + 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, + 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, + 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, + 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, + 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, + 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, + 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, + 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, + 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 290, 291, 292, -1, -1, 295, 296, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 314, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 324, 325, 326, 327, 328, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 5, 6, 7, - 8, 9, -1, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, -1, -1, -1, -1, -1, -1, - -1, 399, 400, 401, 402, 403, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 82, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 346, 347, 348, + 349, 350, 351, -1, -1, -1, -1, 356, 357, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - 118, 119, 120, 121, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 131, 132, 133, 134, 135, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, - 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, - 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, - 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, - 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, - 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, - 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, - 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, - 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, - 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, - 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, - 338, -1, 340, 341, 342, 343, 344, 345, 346, 347, - 348, 349, 350, 351, 352, 353, -1, -1, 356, 357, + -1, -1, -1, -1, -1, -1, -1, 376, 377, 378, + 379, 380, 381, 382, 383, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 393, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, -1, -1, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, + 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, + 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, + 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, + 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, + 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, + 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, + 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, + 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, + 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, + 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, + 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, + 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, + 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 290, 291, 292, -1, -1, 295, 296, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 375, -1, -1, - -1, 379, 380, -1, -1, -1, -1, -1, 386, 387, - 388, 389, 5, 6, 7, 8, 9, -1, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, -1, + -1, -1, -1, -1, -1, 314, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 325, 326, 327, 328, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 82, + -1, -1, -1, -1, -1, -1, -1, 346, 347, 348, + 349, 350, 351, -1, -1, -1, -1, 356, 357, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, - 333, 334, 335, 336, 337, 338, -1, 340, 341, 342, - 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, - 353, -1, -1, 356, 357, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 376, 377, 378, + 379, 380, 381, 382, 383, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 393, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, -1, -1, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, + 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, + 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, + 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, + 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, + 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, + 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, + 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, + 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, + 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, + 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, + 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, + 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, + 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 290, 291, 292, -1, -1, 295, 296, -1, 383, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 375, -1, -1, 378, -1, -1, -1, -1, - -1, -1, -1, 386, 387, 388, 389, 5, 6, 7, - 8, 9, -1, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 82, -1, -1, -1, -1, -1, + -1, -1, -1, 397, -1, 314, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 325, 326, 327, 328, + 414, 415, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 346, 347, 348, + 349, 350, 351, -1, -1, -1, -1, 356, 357, -1, + -1, 445, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 456, -1, -1, -1, -1, 376, 377, 378, + 379, 380, 381, 382, 383, -1, -1, -1, -1, -1, + -1, 475, -1, -1, 393, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - 118, 119, 120, 121, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 131, 132, 133, 134, 135, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, - 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, - 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, - 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, - 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, - 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, - 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, - 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, - 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, - 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, - 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, - 338, -1, 340, 341, 342, 343, 344, 345, 346, 347, - 348, 349, 350, 351, 352, 353, -1, -1, 356, 357, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 375, -1, -1, - -1, 379, -1, -1, -1, -1, -1, -1, 386, 387, - 388, 389, 5, 6, 7, 8, 9, -1, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, - 333, 334, 335, 336, 337, 338, -1, 340, 341, 342, - 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, - 353, -1, -1, 356, 357, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 375, -1, -1, 378, -1, -1, -1, -1, - -1, -1, -1, 386, 387, 388, 389, 5, 6, 7, - 8, 9, -1, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 82, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 542, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - 118, 119, 120, 121, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 131, 132, 133, 134, 135, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, - 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, - 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, - 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, - 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, - 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, - 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, - 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, - 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, - 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, - 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, - 338, -1, 340, 341, 342, 343, 344, 345, 346, 347, - 348, 349, 350, 351, 352, 353, -1, -1, 356, 357, + -1, 555, 556, 557, 558, 559, 560, 561, 562, 563, + 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 375, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 385, 386, 387, - 388, 389, 5, 6, 7, 8, 9, -1, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, - 333, 334, 335, 336, 337, 338, -1, 340, 341, 342, - 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, - 353, -1, -1, 356, 357, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 375, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 386, 387, 388, 389, 5, 6, 7, - 8, 9, -1, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 82, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - 118, 119, 120, 121, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 131, 132, 133, 134, 135, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, - 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, - 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, - 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, - 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, - 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, - 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, - 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, - 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, - 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, - 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, - 338, -1, 340, 341, 342, 343, 344, 345, 346, 347, - 348, 349, 350, 351, 352, 353, -1, -1, 356, 357, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 375, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 386, 387, - 388, 389, 5, 6, 7, 8, 9, -1, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, - 333, 334, 335, 336, 337, 338, -1, -1, 341 + -1, -1, -1, -1, -1, -1, -1, -1, -1, 673 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -3272,147 +3283,148 @@ static const yytype_uint16 yystos[] = { 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, - 333, 334, 335, 336, 337, 338, 341, 385, 399, 400, - 401, 402, 403, 404, 439, 440, 443, 444, 445, 446, - 450, 451, 452, 453, 454, 455, 458, 459, 460, 461, - 462, 464, 469, 470, 471, 511, 512, 513, 375, 375, - 340, 379, 470, 340, 385, 385, 514, 376, 382, 447, - 448, 449, 459, 464, 382, 385, 340, 340, 385, 460, - 464, 393, 466, 467, 0, 512, 340, 463, 81, 340, - 456, 457, 379, 473, 464, 377, 385, 465, 379, 490, - 448, 447, 449, 340, 340, 375, 384, 465, 379, 382, - 385, 442, 340, 342, 343, 344, 345, 346, 347, 348, - 349, 350, 351, 352, 353, 356, 357, 375, 386, 387, - 388, 389, 409, 410, 411, 413, 414, 415, 416, 417, - 418, 419, 420, 421, 462, 464, 468, 465, 376, 382, - 384, 376, 382, 472, 459, 464, 474, 475, 385, 378, - 420, 422, 423, 424, 425, 426, 427, 428, 429, 430, - 431, 432, 433, 377, 385, 22, 23, 24, 26, 27, - 28, 29, 30, 31, 32, 339, 377, 379, 380, 385, - 420, 433, 435, 437, 439, 443, 462, 464, 480, 481, - 482, 483, 491, 492, 493, 494, 497, 498, 501, 502, - 503, 510, 515, 465, 384, 465, 379, 435, 478, 384, - 441, 340, 382, 385, 420, 420, 437, 356, 357, 377, - 381, 376, 376, 382, 338, 435, 375, 420, 382, 394, - 340, 433, 438, 457, 474, 464, 340, 476, 477, 380, - 475, 390, 391, 392, 387, 389, 354, 355, 358, 359, - 393, 394, 360, 361, 397, 396, 395, 362, 364, 363, - 398, 378, 378, 433, 385, 385, 505, 375, 375, 385, - 385, 437, 375, 437, 383, 375, 377, 380, 484, 365, - 366, 367, 368, 369, 370, 371, 372, 373, 374, 384, - 436, 382, 385, 380, 481, 494, 498, 503, 478, 384, - 478, 479, 478, 474, 340, 376, 412, 437, 340, 435, - 420, 380, 476, 465, 382, 385, 420, 420, 420, 422, - 422, 423, 423, 424, 424, 424, 424, 425, 425, 426, - 427, 428, 429, 430, 431, 434, 378, 481, 506, 437, - 385, 437, 383, 504, 340, 516, 517, 491, 435, 435, - 478, 380, 382, 380, 378, 385, 477, 437, 339, 480, - 492, 507, 376, 376, 437, 452, 459, 496, 375, 378, - 382, 485, 380, 478, 383, 375, 496, 508, 509, 487, - 488, 489, 495, 499, 340, 376, 438, 378, 517, 380, - 435, 437, 385, 376, 25, 483, 482, 379, 384, 482, - 486, 490, 376, 376, 437, 486, 487, 491, 500, 478, - 385, 380 + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, + 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, + 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, + 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, + 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, + 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, + 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, + 292, 324, 338, 339, 340, 341, 342, 351, 352, 353, + 354, 355, 356, 357, 370, 371, 372, 373, 374, 375, + 384, 386, 387, 388, 389, 390, 391, 392, 393, 394, + 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, + 405, 406, 407, 408, 409, 410, 442, 443, 446, 447, + 448, 449, 453, 454, 455, 456, 457, 458, 461, 462, + 463, 464, 465, 467, 472, 473, 474, 515, 516, 517, + 473, 318, 350, 314, 314, 324, 350, 324, 518, 315, + 321, 450, 451, 452, 462, 467, 321, 324, 350, 324, + 350, 463, 467, 332, 469, 470, 0, 516, 467, 476, + 318, 350, 371, 459, 460, 350, 466, 316, 324, 468, + 318, 494, 451, 450, 452, 350, 350, 314, 323, 468, + 318, 321, 324, 445, 295, 296, 314, 325, 326, 327, + 328, 346, 347, 348, 349, 350, 376, 377, 378, 379, + 380, 381, 382, 383, 412, 413, 414, 416, 417, 418, + 419, 420, 421, 422, 423, 424, 465, 467, 471, 468, + 324, 462, 467, 477, 478, 475, 323, 315, 321, 315, + 321, 317, 423, 425, 426, 427, 428, 429, 430, 431, + 432, 433, 434, 435, 436, 316, 324, 316, 318, 319, + 324, 358, 359, 360, 361, 363, 364, 365, 366, 367, + 368, 369, 385, 423, 436, 438, 440, 442, 446, 465, + 467, 483, 484, 485, 486, 487, 495, 496, 497, 498, + 501, 502, 505, 506, 507, 514, 519, 468, 323, 468, + 318, 438, 481, 323, 444, 350, 321, 324, 423, 423, + 440, 295, 296, 316, 320, 315, 315, 321, 357, 438, + 314, 423, 321, 333, 467, 350, 479, 480, 319, 478, + 477, 436, 441, 460, 350, 329, 330, 331, 326, 328, + 293, 294, 297, 298, 332, 333, 299, 300, 336, 335, + 334, 301, 303, 302, 337, 317, 317, 436, 316, 319, + 488, 314, 324, 324, 509, 314, 314, 324, 324, 440, + 314, 440, 322, 324, 304, 305, 306, 307, 308, 309, + 310, 311, 312, 313, 323, 439, 321, 324, 319, 484, + 498, 502, 507, 481, 323, 481, 482, 481, 477, 350, + 315, 415, 440, 350, 438, 423, 479, 468, 321, 324, + 319, 423, 423, 423, 425, 425, 426, 426, 427, 427, + 427, 427, 428, 428, 429, 430, 431, 432, 433, 434, + 437, 317, 350, 520, 521, 495, 508, 484, 510, 440, + 324, 440, 322, 438, 438, 481, 319, 321, 319, 317, + 324, 480, 440, 314, 317, 321, 489, 440, 455, 462, + 500, 358, 483, 496, 511, 315, 315, 319, 481, 322, + 441, 317, 521, 319, 350, 315, 314, 500, 512, 513, + 491, 492, 493, 499, 503, 438, 315, 323, 485, 490, + 494, 440, 324, 315, 362, 487, 485, 318, 481, 315, + 440, 490, 491, 495, 504, 324, 319 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint16 yyr1[] = { - 0, 408, 409, 410, 410, 410, 410, 410, 410, 410, - 410, 410, 410, 410, 410, 410, 410, 411, 411, 411, - 411, 411, 411, 412, 413, 414, 415, 415, 416, 416, - 417, 417, 418, 419, 419, 419, 420, 420, 420, 420, - 421, 421, 421, 421, 422, 422, 422, 422, 423, 423, - 423, 424, 424, 424, 425, 425, 425, 425, 425, 426, - 426, 426, 427, 427, 428, 428, 429, 429, 430, 430, - 431, 431, 432, 432, 433, 434, 433, 435, 435, 436, - 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, - 437, 437, 438, 439, 439, 439, 439, 439, 439, 439, - 439, 439, 441, 440, 442, 442, 443, 444, 444, 445, - 445, 446, 447, 447, 448, 448, 448, 448, 449, 450, - 450, 450, 450, 450, 451, 451, 451, 451, 451, 452, - 452, 453, 454, 454, 454, 454, 454, 454, 454, 454, - 455, 456, 456, 457, 457, 457, 458, 459, 459, 460, - 460, 460, 460, 460, 460, 460, 461, 461, 461, 461, - 461, 461, 461, 461, 461, 461, 461, 461, 461, 461, - 461, 461, 461, 461, 461, 461, 461, 461, 461, 461, - 461, 461, 461, 461, 461, 462, 463, 463, 464, 464, - 465, 465, 465, 465, 466, 466, 467, 468, 468, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - 469, 469, 469, 469, 469, 469, 469, 470, 470, 470, - 472, 471, 473, 471, 474, 474, 475, 475, 476, 476, - 477, 477, 478, 478, 478, 479, 479, 480, 481, 481, - 482, 482, 482, 482, 482, 482, 482, 483, 484, 485, - 483, 486, 486, 488, 487, 489, 487, 490, 490, 491, - 491, 492, 492, 493, 493, 494, 495, 495, 496, 496, - 497, 497, 499, 498, 500, 500, 501, 501, 502, 502, - 504, 503, 505, 503, 506, 503, 507, 507, 508, 508, - 509, 509, 510, 510, 510, 510, 510, 511, 511, 512, - 512, 512, 514, 513, 515, 516, 516, 517, 517 + 0, 411, 412, 413, 413, 413, 413, 413, 413, 413, + 413, 413, 413, 413, 413, 413, 413, 414, 414, 414, + 414, 414, 414, 415, 416, 417, 418, 418, 419, 419, + 420, 420, 421, 422, 422, 422, 423, 423, 423, 423, + 424, 424, 424, 424, 425, 425, 425, 425, 426, 426, + 426, 427, 427, 427, 428, 428, 428, 428, 428, 429, + 429, 429, 430, 430, 431, 431, 432, 432, 433, 433, + 434, 434, 435, 435, 436, 437, 436, 438, 438, 439, + 439, 439, 439, 439, 439, 439, 439, 439, 439, 439, + 440, 440, 441, 442, 442, 442, 442, 442, 442, 442, + 442, 442, 444, 443, 445, 445, 446, 447, 447, 448, + 448, 449, 450, 450, 451, 451, 451, 451, 452, 453, + 453, 453, 453, 453, 454, 454, 454, 454, 454, 455, + 455, 456, 457, 457, 457, 457, 457, 457, 457, 457, + 458, 459, 459, 460, 460, 460, 461, 462, 462, 463, + 463, 463, 463, 463, 463, 463, 464, 464, 464, 464, + 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, + 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, + 464, 464, 464, 464, 464, 465, 466, 466, 467, 467, + 468, 468, 468, 468, 469, 469, 470, 471, 471, 472, + 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, + 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, + 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, + 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, + 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, + 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, + 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, + 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, + 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, + 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, + 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, + 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, + 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, + 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, + 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, + 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, + 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, + 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, + 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, + 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, + 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, + 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, + 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, + 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, + 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, + 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, + 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, + 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, + 472, 472, 472, 472, 472, 472, 472, 472, 472, 473, + 473, 473, 475, 474, 476, 474, 477, 477, 478, 478, + 479, 479, 480, 480, 481, 481, 481, 482, 482, 483, + 484, 484, 485, 485, 485, 485, 485, 485, 485, 485, + 486, 487, 488, 489, 487, 490, 490, 492, 491, 493, + 491, 494, 494, 495, 495, 496, 496, 497, 497, 498, + 499, 499, 500, 500, 501, 501, 503, 502, 504, 504, + 505, 505, 506, 506, 508, 507, 509, 507, 510, 507, + 511, 511, 512, 512, 513, 513, 514, 514, 514, 514, + 514, 515, 515, 516, 516, 516, 518, 517, 519, 520, + 520, 521, 521 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { - 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 3, 1, 4, 1, + 0, 2, 1, 1, 3, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 3, 2, 2, 1, 1, 1, 2, 2, 2, 1, 2, 3, 2, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 3, 3, 3, 1, 3, @@ -3460,15 +3472,16 @@ static const yytype_uint8 yyr2[] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 0, 6, 0, 5, 1, 2, 3, 4, 1, 3, - 1, 2, 1, 3, 4, 1, 3, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 2, 0, 0, - 5, 1, 1, 0, 2, 0, 2, 2, 3, 1, - 2, 1, 2, 1, 2, 5, 3, 1, 1, 4, - 1, 2, 0, 8, 0, 1, 3, 2, 1, 2, - 0, 6, 0, 8, 0, 7, 1, 1, 1, 0, - 2, 3, 2, 2, 2, 3, 2, 1, 2, 1, - 1, 1, 0, 3, 5, 1, 3, 1, 4 + 1, 1, 0, 6, 0, 5, 1, 2, 3, 4, + 1, 3, 1, 2, 1, 3, 4, 1, 3, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 0, 0, 5, 1, 1, 0, 2, 0, + 2, 2, 3, 1, 2, 1, 2, 1, 2, 5, + 3, 1, 1, 4, 1, 2, 0, 8, 0, 1, + 3, 2, 1, 2, 0, 6, 0, 8, 0, 7, + 1, 1, 1, 0, 2, 3, 2, 2, 2, 3, + 2, 1, 2, 1, 1, 1, 0, 3, 5, 1, + 3, 1, 4 }; @@ -4151,250 +4164,252 @@ yyreduce: switch (yyn) { case 2: -#line 302 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 352 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.handleVariable((yyvsp[0].lex).loc, (yyvsp[0].lex).symbol, (yyvsp[0].lex).string); } -#line 4159 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4172 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 3: -#line 308 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 358 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 4167 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4180 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 4: -#line 311 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 361 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit signed literal"); - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).i, (yyvsp[0].lex).loc, true); + (yyval.interm.intermTypedNode) = (yyvsp[-1].interm.intermTypedNode); + if ((yyval.interm.intermTypedNode)->getAsConstantUnion()) + (yyval.interm.intermTypedNode)->getAsConstantUnion()->setExpression(); } -#line 4176 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4190 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 5: -#line 315 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 366 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit signed literal"); - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).u, (yyvsp[0].lex).loc, true); + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).d, EbtFloat, (yyvsp[0].lex).loc, true); } -#line 4185 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4198 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 6: -#line 319 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 369 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).i, (yyvsp[0].lex).loc, true); } -#line 4193 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4206 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 7: -#line 322 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 372 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned literal"); (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).u, (yyvsp[0].lex).loc, true); } -#line 4202 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4215 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 8: -#line 326 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 376 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int64Check((yyvsp[0].lex).loc, "64-bit integer literal"); - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).i64, (yyvsp[0].lex).loc, true); + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).b, (yyvsp[0].lex).loc, true); } -#line 4211 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4223 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 9: -#line 330 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 380 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer literal"); - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).u64, (yyvsp[0].lex).loc, true); + parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit signed literal"); + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).i, (yyvsp[0].lex).loc, true); } -#line 4220 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4232 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 10: -#line 334 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 384 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.explicitInt16Check((yyvsp[0].lex).loc, "16-bit integer literal"); - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((short)(yyvsp[0].lex).i, (yyvsp[0].lex).loc, true); + parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit signed literal"); + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).u, (yyvsp[0].lex).loc, true); } -#line 4229 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4241 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 11: -#line 338 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 388 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.explicitInt16Check((yyvsp[0].lex).loc, "16-bit unsigned integer literal"); - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((unsigned short)(yyvsp[0].lex).u, (yyvsp[0].lex).loc, true); + parseContext.int64Check((yyvsp[0].lex).loc, "64-bit integer literal"); + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).i64, (yyvsp[0].lex).loc, true); } -#line 4238 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4250 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 12: -#line 342 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 392 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).d, EbtFloat, (yyvsp[0].lex).loc, true); + parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer literal"); + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).u64, (yyvsp[0].lex).loc, true); } -#line 4246 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4259 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 13: -#line 345 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 396 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double literal"); - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).d, EbtDouble, (yyvsp[0].lex).loc, true); + parseContext.explicitInt16Check((yyvsp[0].lex).loc, "16-bit integer literal"); + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((short)(yyvsp[0].lex).i, (yyvsp[0].lex).loc, true); } -#line 4255 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4268 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 14: -#line 349 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 400 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.float16Check((yyvsp[0].lex).loc, "half float literal"); - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).d, EbtFloat16, (yyvsp[0].lex).loc, true); + parseContext.explicitInt16Check((yyvsp[0].lex).loc, "16-bit unsigned integer literal"); + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((unsigned short)(yyvsp[0].lex).u, (yyvsp[0].lex).loc, true); } -#line 4264 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4277 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 15: -#line 353 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 404 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).b, (yyvsp[0].lex).loc, true); + parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double literal"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck((yyvsp[0].lex).loc, "double literal"); + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).d, EbtDouble, (yyvsp[0].lex).loc, true); } -#line 4272 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4286 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 16: -#line 356 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 408 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = (yyvsp[-1].interm.intermTypedNode); - if ((yyval.interm.intermTypedNode)->getAsConstantUnion()) - (yyval.interm.intermTypedNode)->getAsConstantUnion()->setExpression(); + parseContext.float16Check((yyvsp[0].lex).loc, "half float literal"); + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).d, EbtFloat16, (yyvsp[0].lex).loc, true); } -#line 4282 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4295 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 17: -#line 364 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 416 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 4290 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4303 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 18: -#line 367 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 419 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.handleBracketDereference((yyvsp[-2].lex).loc, (yyvsp[-3].interm.intermTypedNode), (yyvsp[-1].interm.intermTypedNode)); } -#line 4298 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4311 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 19: -#line 370 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 422 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 4306 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4319 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 20: -#line 373 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 425 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.handleDotDereference((yyvsp[0].lex).loc, (yyvsp[-2].interm.intermTypedNode), *(yyvsp[0].lex).string); } -#line 4314 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4327 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 21: -#line 376 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 428 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.variableCheck((yyvsp[-1].interm.intermTypedNode)); parseContext.lValueErrorCheck((yyvsp[0].lex).loc, "++", (yyvsp[-1].interm.intermTypedNode)); (yyval.interm.intermTypedNode) = parseContext.handleUnaryMath((yyvsp[0].lex).loc, "++", EOpPostIncrement, (yyvsp[-1].interm.intermTypedNode)); } -#line 4324 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4337 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 22: -#line 381 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 433 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.variableCheck((yyvsp[-1].interm.intermTypedNode)); parseContext.lValueErrorCheck((yyvsp[0].lex).loc, "--", (yyvsp[-1].interm.intermTypedNode)); (yyval.interm.intermTypedNode) = parseContext.handleUnaryMath((yyvsp[0].lex).loc, "--", EOpPostDecrement, (yyvsp[-1].interm.intermTypedNode)); } -#line 4334 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4347 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 23: -#line 389 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 441 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.integerCheck((yyvsp[0].interm.intermTypedNode), "[]"); (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 4343 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4356 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 24: -#line 396 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 448 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.handleFunctionCall((yyvsp[0].interm).loc, (yyvsp[0].interm).function, (yyvsp[0].interm).intermNode); delete (yyvsp[0].interm).function; } -#line 4352 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4365 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 25: -#line 403 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 455 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm) = (yyvsp[0].interm); } -#line 4360 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4373 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 26: -#line 409 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 461 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm) = (yyvsp[-1].interm); (yyval.interm).loc = (yyvsp[0].lex).loc; } -#line 4369 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4382 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 27: -#line 413 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 465 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm) = (yyvsp[-1].interm); (yyval.interm).loc = (yyvsp[0].lex).loc; } -#line 4378 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4391 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 28: -#line 420 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 472 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm) = (yyvsp[-1].interm); } -#line 4386 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4399 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 29: -#line 423 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 475 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm) = (yyvsp[0].interm); } -#line 4394 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4407 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 30: -#line 429 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 481 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { TParameter param = { 0, new TType }; param.type->shallowCopy((yyvsp[0].interm.intermTypedNode)->getType()); @@ -4402,11 +4417,11 @@ yyreduce: (yyval.interm).function = (yyvsp[-1].interm).function; (yyval.interm).intermNode = (yyvsp[0].interm.intermTypedNode); } -#line 4406 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4419 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 31: -#line 436 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 488 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { TParameter param = { 0, new TType }; param.type->shallowCopy((yyvsp[0].interm.intermTypedNode)->getType()); @@ -4414,29 +4429,29 @@ yyreduce: (yyval.interm).function = (yyvsp[-2].interm).function; (yyval.interm).intermNode = parseContext.intermediate.growAggregate((yyvsp[-2].interm).intermNode, (yyvsp[0].interm.intermTypedNode), (yyvsp[-1].lex).loc); } -#line 4418 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4431 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 32: -#line 446 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 498 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm) = (yyvsp[-1].interm); } -#line 4426 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4439 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 33: -#line 454 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 506 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // Constructor (yyval.interm).intermNode = 0; (yyval.interm).function = parseContext.handleConstructorCall((yyvsp[0].interm.type).loc, (yyvsp[0].interm.type)); } -#line 4436 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4449 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 34: -#line 459 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 511 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // // Should be a method or subroutine call, but we haven't recognized the arguments yet. @@ -4464,50 +4479,50 @@ yyreduce: (yyval.interm).function = new TFunction(empty, TType(EbtVoid), EOpNull); } } -#line 4468 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4481 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 35: -#line 486 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 539 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // Constructor (yyval.interm).intermNode = 0; (yyval.interm).function = parseContext.handleConstructorCall((yyvsp[0].interm.type).loc, (yyvsp[0].interm.type)); } -#line 4478 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4491 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 36: -#line 494 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 548 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.variableCheck((yyvsp[0].interm.intermTypedNode)); (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); if (TIntermMethod* method = (yyvsp[0].interm.intermTypedNode)->getAsMethodNode()) parseContext.error((yyvsp[0].interm.intermTypedNode)->getLoc(), "incomplete method syntax", method->getMethodName().c_str(), ""); } -#line 4489 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4502 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 37: -#line 500 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 554 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.lValueErrorCheck((yyvsp[-1].lex).loc, "++", (yyvsp[0].interm.intermTypedNode)); (yyval.interm.intermTypedNode) = parseContext.handleUnaryMath((yyvsp[-1].lex).loc, "++", EOpPreIncrement, (yyvsp[0].interm.intermTypedNode)); } -#line 4498 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4511 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 38: -#line 504 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 558 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.lValueErrorCheck((yyvsp[-1].lex).loc, "--", (yyvsp[0].interm.intermTypedNode)); (yyval.interm.intermTypedNode) = parseContext.handleUnaryMath((yyvsp[-1].lex).loc, "--", EOpPreDecrement, (yyvsp[0].interm.intermTypedNode)); } -#line 4507 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4520 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 39: -#line 508 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 562 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if ((yyvsp[-1].interm).op != EOpNull) { char errorOp[2] = {0, 0}; @@ -4524,179 +4539,179 @@ yyreduce: (yyval.interm.intermTypedNode)->getAsConstantUnion()->setExpression(); } } -#line 4528 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4541 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 40: -#line 528 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 582 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpNull; } -#line 4534 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4547 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 41: -#line 529 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 583 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpNegative; } -#line 4540 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4553 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 42: -#line 530 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 584 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpLogicalNot; } -#line 4546 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4559 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 43: -#line 531 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 585 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpBitwiseNot; parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bitwise not"); } -#line 4553 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4566 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 44: -#line 537 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 591 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 4559 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4572 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 45: -#line 538 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 592 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "*", EOpMul, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 4569 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4582 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 46: -#line 543 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 597 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "/", EOpDiv, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 4579 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4592 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 47: -#line 548 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 602 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "%"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "%", EOpMod, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 4590 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4603 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 48: -#line 557 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 611 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 4596 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4609 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 49: -#line 558 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 612 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "+", EOpAdd, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 4606 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4619 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 50: -#line 563 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 617 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "-", EOpSub, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 4616 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4629 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 51: -#line 571 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 625 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 4622 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4635 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 52: -#line 572 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 626 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "bit shift left"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "<<", EOpLeftShift, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 4633 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4646 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 53: -#line 578 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 632 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "bit shift right"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, ">>", EOpRightShift, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 4644 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4657 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 54: -#line 587 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 641 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 4650 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4663 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 55: -#line 588 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 642 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "<", EOpLessThan, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 4660 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4673 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 56: -#line 593 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 647 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, ">", EOpGreaterThan, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 4670 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4683 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 57: -#line 598 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 652 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "<=", EOpLessThanEqual, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 4680 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4693 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 58: -#line 603 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 657 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, ">=", EOpGreaterThanEqual, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 4690 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4703 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 59: -#line 611 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 665 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 4696 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4709 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 60: -#line 612 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 666 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.arrayObjectCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "array comparison"); parseContext.opaqueCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "=="); @@ -4706,11 +4721,11 @@ yyreduce: if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 4710 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4723 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 61: -#line 621 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 675 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.arrayObjectCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "array comparison"); parseContext.opaqueCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "!="); @@ -4720,124 +4735,124 @@ yyreduce: if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 4724 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4737 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 62: -#line 633 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 687 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 4730 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4743 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 63: -#line 634 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 688 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "bitwise and"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "&", EOpAnd, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 4741 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4754 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 64: -#line 643 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 697 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 4747 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4760 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 65: -#line 644 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 698 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "bitwise exclusive or"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "^", EOpExclusiveOr, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 4758 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4771 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 66: -#line 653 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 707 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 4764 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4777 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 67: -#line 654 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 708 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "bitwise inclusive or"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "|", EOpInclusiveOr, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 4775 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4788 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 68: -#line 663 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 717 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 4781 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4794 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 69: -#line 664 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 718 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "&&", EOpLogicalAnd, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 4791 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4804 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 70: -#line 672 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 726 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 4797 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4810 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 71: -#line 673 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 727 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "^^", EOpLogicalXor, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 4807 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4820 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 72: -#line 681 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 735 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 4813 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4826 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 73: -#line 682 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 736 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "||", EOpLogicalOr, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 4823 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4836 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 74: -#line 690 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 744 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 4829 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4842 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 75: -#line 691 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 745 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { ++parseContext.controlFlowNestingLevel; } -#line 4837 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4850 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 76: -#line 694 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 748 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { --parseContext.controlFlowNestingLevel; parseContext.boolCheck((yyvsp[-4].lex).loc, (yyvsp[-5].interm.intermTypedNode)); @@ -4850,17 +4865,17 @@ yyreduce: (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } } -#line 4854 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4867 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 77: -#line 709 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 763 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 4860 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4873 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 78: -#line 710 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 764 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.arrayObjectCheck((yyvsp[-1].interm).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "array assignment"); parseContext.opaqueCheck((yyvsp[-1].interm).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "="); @@ -4874,119 +4889,119 @@ yyreduce: (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } } -#line 4878 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4891 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 79: -#line 726 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 780 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpAssign; } -#line 4887 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4900 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 80: -#line 730 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 784 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpMulAssign; } -#line 4896 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4909 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 81: -#line 734 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 788 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpDivAssign; } -#line 4905 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4918 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 82: -#line 738 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 792 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "%="); (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpModAssign; } -#line 4915 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4928 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 83: -#line 743 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 797 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpAddAssign; } -#line 4924 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4937 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 84: -#line 747 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 801 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpSubAssign; } -#line 4933 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4946 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 85: -#line 751 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 805 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bit-shift left assign"); (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpLeftShiftAssign; } -#line 4942 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4955 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 86: -#line 755 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 809 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bit-shift right assign"); (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpRightShiftAssign; } -#line 4951 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4964 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 87: -#line 759 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 813 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bitwise-and assign"); (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpAndAssign; } -#line 4960 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4973 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 88: -#line 763 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 817 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bitwise-xor assign"); (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpExclusiveOrAssign; } -#line 4969 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4982 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 89: -#line 767 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 821 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bitwise-or assign"); (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpInclusiveOrAssign; } -#line 4978 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4991 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 90: -#line 774 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 828 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 4986 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4999 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 91: -#line 777 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 831 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.samplerConstructorLocationCheck((yyvsp[-1].lex).loc, ",", (yyvsp[0].interm.intermTypedNode)); (yyval.interm.intermTypedNode) = parseContext.intermediate.addComma((yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yyvsp[-1].lex).loc); @@ -4995,117 +5010,116 @@ yyreduce: (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } } -#line 4999 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5012 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 92: -#line 788 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 842 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.constantValueCheck((yyvsp[0].interm.intermTypedNode), ""); (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 5008 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5021 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 93: -#line 795 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 849 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.handleFunctionDeclarator((yyvsp[-1].interm).loc, *(yyvsp[-1].interm).function, true /* prototype */); (yyval.interm.intermNode) = 0; // TODO: 4.0 functionality: subroutines: make the identifier a user type for this signature } -#line 5018 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5031 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 94: -#line 800 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 854 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if ((yyvsp[-1].interm).intermNode && (yyvsp[-1].interm).intermNode->getAsAggregate()) (yyvsp[-1].interm).intermNode->getAsAggregate()->setOperator(EOpSequence); (yyval.interm.intermNode) = (yyvsp[-1].interm).intermNode; } -#line 5028 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5041 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 95: -#line 805 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 859 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.profileRequires((yyvsp[-3].lex).loc, ENoProfile, 130, 0, "precision statement"); - // lazy setting of the previous scope's defaults, has effect only the first time it is called in a particular scope parseContext.symbolTable.setPreviousDefaultPrecisions(&parseContext.defaultPrecision[0]); parseContext.setDefaultPrecision((yyvsp[-3].lex).loc, (yyvsp[-1].interm.type), (yyvsp[-2].interm.type).qualifier.precision); (yyval.interm.intermNode) = 0; } -#line 5041 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5053 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 96: -#line 813 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 866 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.declareBlock((yyvsp[-1].interm).loc, *(yyvsp[-1].interm).typeList); (yyval.interm.intermNode) = 0; } -#line 5050 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5062 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 97: -#line 817 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 870 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.declareBlock((yyvsp[-2].interm).loc, *(yyvsp[-2].interm).typeList, (yyvsp[-1].lex).string); (yyval.interm.intermNode) = 0; } -#line 5059 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5071 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 98: -#line 821 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 874 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.declareBlock((yyvsp[-3].interm).loc, *(yyvsp[-3].interm).typeList, (yyvsp[-2].lex).string, (yyvsp[-1].interm).arraySizes); (yyval.interm.intermNode) = 0; } -#line 5068 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5080 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 99: -#line 825 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 878 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.globalQualifierFixCheck((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).qualifier); parseContext.updateStandaloneQualifierDefaults((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type)); (yyval.interm.intermNode) = 0; } -#line 5078 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5090 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 100: -#line 830 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 883 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.checkNoShaderLayouts((yyvsp[-2].interm.type).loc, (yyvsp[-2].interm.type).shaderQualifiers); parseContext.addQualifierToExisting((yyvsp[-2].interm.type).loc, (yyvsp[-2].interm.type).qualifier, *(yyvsp[-1].lex).string); (yyval.interm.intermNode) = 0; } -#line 5088 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5100 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 101: -#line 835 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 888 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.checkNoShaderLayouts((yyvsp[-3].interm.type).loc, (yyvsp[-3].interm.type).shaderQualifiers); (yyvsp[-1].interm.identifierList)->push_back((yyvsp[-2].lex).string); parseContext.addQualifierToExisting((yyvsp[-3].interm.type).loc, (yyvsp[-3].interm.type).qualifier, *(yyvsp[-1].interm.identifierList)); (yyval.interm.intermNode) = 0; } -#line 5099 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5111 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 102: -#line 844 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 897 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.nestedBlockCheck((yyvsp[-2].interm.type).loc); } -#line 5105 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5117 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 103: -#line 844 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 897 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { --parseContext.structNestingLevel; parseContext.blockName = (yyvsp[-4].lex).string; @@ -5115,54 +5129,54 @@ yyreduce: (yyval.interm).loc = (yyvsp[-5].interm.type).loc; (yyval.interm).typeList = (yyvsp[-1].interm.typeList); } -#line 5119 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5131 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 104: -#line 855 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 908 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.identifierList) = new TIdentifierList; (yyval.interm.identifierList)->push_back((yyvsp[0].lex).string); } -#line 5128 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5140 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 105: -#line 859 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 912 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.identifierList) = (yyvsp[-2].interm.identifierList); (yyval.interm.identifierList)->push_back((yyvsp[0].lex).string); } -#line 5137 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5149 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 106: -#line 866 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 919 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).function = (yyvsp[-1].interm.function); (yyval.interm).loc = (yyvsp[0].lex).loc; } -#line 5146 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5158 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 107: -#line 873 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 926 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.function) = (yyvsp[0].interm.function); } -#line 5154 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5166 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 108: -#line 876 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 929 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.function) = (yyvsp[0].interm.function); } -#line 5162 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5174 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 109: -#line 883 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 936 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // Add the parameter (yyval.interm.function) = (yyvsp[-1].interm.function); @@ -5171,11 +5185,11 @@ yyreduce: else delete (yyvsp[0].interm).param.type; } -#line 5175 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5187 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 110: -#line 891 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 944 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // // Only first parameter of one-parameter functions can be void @@ -5193,11 +5207,11 @@ yyreduce: (yyvsp[-2].interm.function)->addParameter((yyvsp[0].interm).param); } } -#line 5197 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5209 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 111: -#line 911 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 964 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if ((yyvsp[-2].interm.type).qualifier.storage != EvqGlobal && (yyvsp[-2].interm.type).qualifier.storage != EvqTemporary) { parseContext.error((yyvsp[-1].lex).loc, "no qualifiers allowed for function return", @@ -5217,11 +5231,11 @@ yyreduce: function = new TFunction((yyvsp[-1].lex).string, type); (yyval.interm.function) = function; } -#line 5221 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5233 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 112: -#line 934 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 987 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if ((yyvsp[-1].interm.type).arraySizes) { parseContext.profileRequires((yyvsp[-1].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); @@ -5237,11 +5251,11 @@ yyreduce: (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).param = param; } -#line 5241 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5253 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 113: -#line 949 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1002 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if ((yyvsp[-2].interm.type).arraySizes) { parseContext.profileRequires((yyvsp[-2].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); @@ -5261,11 +5275,11 @@ yyreduce: (yyval.interm).loc = (yyvsp[-1].lex).loc; (yyval.interm).param = param; } -#line 5265 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5277 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 114: -#line 974 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1027 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm) = (yyvsp[0].interm); if ((yyvsp[-1].interm.type).qualifier.precision != EpqNone) @@ -5277,11 +5291,11 @@ yyreduce: parseContext.paramCheckFix((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).qualifier, *(yyval.interm).param.type); } -#line 5281 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5293 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 115: -#line 985 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1038 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm) = (yyvsp[0].interm); @@ -5289,11 +5303,11 @@ yyreduce: parseContext.paramCheckFixStorage((yyvsp[0].interm).loc, EvqTemporary, *(yyval.interm).param.type); parseContext.precisionQualifierCheck((yyval.interm).loc, (yyval.interm).param.type->getBasicType(), (yyval.interm).param.type->getQualifier()); } -#line 5293 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5305 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 116: -#line 995 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1048 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm) = (yyvsp[0].interm); if ((yyvsp[-1].interm.type).qualifier.precision != EpqNone) @@ -5304,11 +5318,11 @@ yyreduce: parseContext.parameterTypeCheck((yyvsp[0].interm).loc, (yyvsp[-1].interm.type).qualifier.storage, *(yyval.interm).param.type); parseContext.paramCheckFix((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).qualifier, *(yyval.interm).param.type); } -#line 5308 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5320 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 117: -#line 1005 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1058 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm) = (yyvsp[0].interm); @@ -5316,118 +5330,120 @@ yyreduce: parseContext.paramCheckFixStorage((yyvsp[0].interm).loc, EvqTemporary, *(yyval.interm).param.type); parseContext.precisionQualifierCheck((yyval.interm).loc, (yyval.interm).param.type->getBasicType(), (yyval.interm).param.type->getQualifier()); } -#line 5320 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5332 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 118: -#line 1015 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1068 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { TParameter param = { 0, new TType((yyvsp[0].interm.type)) }; (yyval.interm).param = param; if ((yyvsp[0].interm.type).arraySizes) parseContext.arraySizeRequiredCheck((yyvsp[0].interm.type).loc, *(yyvsp[0].interm.type).arraySizes); } -#line 5331 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5343 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 119: -#line 1024 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1077 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm) = (yyvsp[0].interm); } -#line 5339 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5351 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 120: -#line 1027 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1080 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm) = (yyvsp[-2].interm); parseContext.declareVariable((yyvsp[0].lex).loc, *(yyvsp[0].lex).string, (yyvsp[-2].interm).type); } -#line 5348 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5360 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 121: -#line 1031 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1084 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm) = (yyvsp[-3].interm); parseContext.declareVariable((yyvsp[-1].lex).loc, *(yyvsp[-1].lex).string, (yyvsp[-3].interm).type, (yyvsp[0].interm).arraySizes); } -#line 5357 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5369 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 122: -#line 1035 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1088 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).type = (yyvsp[-5].interm).type; TIntermNode* initNode = parseContext.declareVariable((yyvsp[-3].lex).loc, *(yyvsp[-3].lex).string, (yyvsp[-5].interm).type, (yyvsp[-2].interm).arraySizes, (yyvsp[0].interm.intermTypedNode)); (yyval.interm).intermNode = parseContext.intermediate.growAggregate((yyvsp[-5].interm).intermNode, initNode, (yyvsp[-1].lex).loc); } -#line 5367 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5379 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 123: -#line 1040 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1093 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).type = (yyvsp[-4].interm).type; TIntermNode* initNode = parseContext.declareVariable((yyvsp[-2].lex).loc, *(yyvsp[-2].lex).string, (yyvsp[-4].interm).type, 0, (yyvsp[0].interm.intermTypedNode)); (yyval.interm).intermNode = parseContext.intermediate.growAggregate((yyvsp[-4].interm).intermNode, initNode, (yyvsp[-1].lex).loc); } -#line 5377 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5389 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 124: -#line 1048 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1101 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).type = (yyvsp[0].interm.type); (yyval.interm).intermNode = 0; + parseContext.declareTypeDefaults((yyval.interm).loc, (yyval.interm).type); + } -#line 5387 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5401 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 125: -#line 1053 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1108 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).type = (yyvsp[-1].interm.type); (yyval.interm).intermNode = 0; parseContext.declareVariable((yyvsp[0].lex).loc, *(yyvsp[0].lex).string, (yyvsp[-1].interm.type)); } -#line 5397 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5411 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 126: -#line 1058 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1113 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).type = (yyvsp[-2].interm.type); (yyval.interm).intermNode = 0; parseContext.declareVariable((yyvsp[-1].lex).loc, *(yyvsp[-1].lex).string, (yyvsp[-2].interm.type), (yyvsp[0].interm).arraySizes); } -#line 5407 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5421 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 127: -#line 1063 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1118 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).type = (yyvsp[-4].interm.type); TIntermNode* initNode = parseContext.declareVariable((yyvsp[-3].lex).loc, *(yyvsp[-3].lex).string, (yyvsp[-4].interm.type), (yyvsp[-2].interm).arraySizes, (yyvsp[0].interm.intermTypedNode)); (yyval.interm).intermNode = parseContext.intermediate.growAggregate(0, initNode, (yyvsp[-1].lex).loc); } -#line 5417 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5431 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 128: -#line 1068 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1123 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).type = (yyvsp[-3].interm.type); TIntermNode* initNode = parseContext.declareVariable((yyvsp[-2].lex).loc, *(yyvsp[-2].lex).string, (yyvsp[-3].interm.type), 0, (yyvsp[0].interm.intermTypedNode)); (yyval.interm).intermNode = parseContext.intermediate.growAggregate(0, initNode, (yyvsp[-1].lex).loc); } -#line 5427 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5441 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 129: -#line 1077 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1132 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type) = (yyvsp[0].interm.type); @@ -5436,14 +5452,13 @@ yyreduce: parseContext.profileRequires((yyvsp[0].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); parseContext.profileRequires((yyvsp[0].interm.type).loc, EEsProfile, 300, 0, "arrayed type"); } - parseContext.precisionQualifierCheck((yyval.interm.type).loc, (yyval.interm.type).basicType, (yyval.interm.type).qualifier); } -#line 5443 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5456 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 130: -#line 1088 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1142 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.globalQualifierFixCheck((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).qualifier); parseContext.globalQualifierTypeCheck((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).qualifier, (yyvsp[0].interm.type)); @@ -5468,22 +5483,22 @@ yyreduce: (parseContext.language == EShLangFragment && (yyval.interm.type).qualifier.storage == EvqVaryingIn))) (yyval.interm.type).qualifier.smooth = true; } -#line 5472 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5485 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 131: -#line 1115 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1169 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.globalCheck((yyvsp[0].lex).loc, "invariant"); parseContext.profileRequires((yyval.interm.type).loc, ENoProfile, 120, 0, "invariant"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.invariant = true; } -#line 5483 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5496 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 132: -#line 1124 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1178 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.globalCheck((yyvsp[0].lex).loc, "smooth"); parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "smooth"); @@ -5491,11 +5506,11 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.smooth = true; } -#line 5495 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5508 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 133: -#line 1131 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1185 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.globalCheck((yyvsp[0].lex).loc, "flat"); parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "flat"); @@ -5503,58 +5518,49 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.flat = true; } -#line 5507 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5520 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 134: -#line 1138 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1193 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.globalCheck((yyvsp[0].lex).loc, "noperspective"); -#ifdef NV_EXTENSIONS parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 0, E_GL_NV_shader_noperspective_interpolation, "noperspective"); -#else - parseContext.requireProfile((yyvsp[0].lex).loc, ~EEsProfile, "noperspective"); -#endif parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "noperspective"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.nopersp = true; } -#line 5523 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5532 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 135: -#line 1149 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1200 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.globalCheck((yyvsp[0].lex).loc, "__explicitInterpAMD"); parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile, 450, E_GL_AMD_shader_explicit_vertex_parameter, "explicit interpolation"); parseContext.profileRequires((yyvsp[0].lex).loc, ECompatibilityProfile, 450, E_GL_AMD_shader_explicit_vertex_parameter, "explicit interpolation"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.explicitInterp = true; -#endif } -#line 5537 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5544 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 136: -#line 1158 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1207 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef NV_EXTENSIONS parseContext.globalCheck((yyvsp[0].lex).loc, "pervertexNV"); parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric"); parseContext.profileRequires((yyvsp[0].lex).loc, ECompatibilityProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric"); parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.pervertexNV = true; -#endif } -#line 5552 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5557 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 137: -#line 1168 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1215 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef NV_EXTENSIONS // No need for profile version or extension check. Shader stage already checks both. parseContext.globalCheck((yyvsp[0].lex).loc, "perprimitiveNV"); parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangFragmentMask | EShLangMeshNVMask), "perprimitiveNV"); @@ -5563,114 +5569,109 @@ yyreduce: parseContext.requireExtensions((yyvsp[0].lex).loc, 1, &E_GL_NV_mesh_shader, "perprimitiveNV"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.perPrimitiveNV = true; -#endif } -#line 5569 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5572 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 138: -#line 1180 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1225 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef NV_EXTENSIONS // No need for profile version or extension check. Shader stage already checks both. parseContext.globalCheck((yyvsp[0].lex).loc, "perviewNV"); parseContext.requireStage((yyvsp[0].lex).loc, EShLangMeshNV, "perviewNV"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.perViewNV = true; -#endif } -#line 5583 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5584 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 139: -#line 1189 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1232 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef NV_EXTENSIONS // No need for profile version or extension check. Shader stage already checks both. parseContext.globalCheck((yyvsp[0].lex).loc, "taskNV"); parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangTaskNVMask | EShLangMeshNVMask), "taskNV"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.perTaskNV = true; -#endif } -#line 5597 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5596 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 140: -#line 1201 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1243 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type) = (yyvsp[-1].interm.type); } -#line 5605 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5604 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 141: -#line 1207 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1249 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 5613 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5612 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 142: -#line 1210 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1252 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type) = (yyvsp[-2].interm.type); (yyval.interm.type).shaderQualifiers.merge((yyvsp[0].interm.type).shaderQualifiers); parseContext.mergeObjectLayoutQualifiers((yyval.interm.type).qualifier, (yyvsp[0].interm.type).qualifier, false); } -#line 5623 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5622 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 143: -#line 1217 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1259 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc); parseContext.setLayoutQualifier((yyvsp[0].lex).loc, (yyval.interm.type), *(yyvsp[0].lex).string); } -#line 5632 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5631 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 144: -#line 1221 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1263 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[-2].lex).loc); parseContext.setLayoutQualifier((yyvsp[-2].lex).loc, (yyval.interm.type), *(yyvsp[-2].lex).string, (yyvsp[0].interm.intermTypedNode)); } -#line 5641 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5640 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 145: -#line 1225 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1267 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // because "shared" is both an identifier and a keyword (yyval.interm.type).init((yyvsp[0].lex).loc); TString strShared("shared"); parseContext.setLayoutQualifier((yyvsp[0].lex).loc, (yyval.interm.type), strShared); } -#line 5651 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5650 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 146: -#line 1233 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1276 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.profileRequires((yyval.interm.type).loc, ECoreProfile | ECompatibilityProfile, 400, E_GL_ARB_gpu_shader5, "precise"); parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 320, Num_AEP_gpu_shader5, AEP_gpu_shader5, "precise"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.noContraction = true; } -#line 5662 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5661 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 147: -#line 1242 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1286 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 5670 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5669 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 148: -#line 1245 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1289 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type) = (yyvsp[-1].interm.type); if ((yyval.interm.type).basicType == EbtVoid) @@ -5679,446 +5680,432 @@ yyreduce: (yyval.interm.type).shaderQualifiers.merge((yyvsp[0].interm.type).shaderQualifiers); parseContext.mergeQualifiers((yyval.interm.type).loc, (yyval.interm.type).qualifier, (yyvsp[0].interm.type).qualifier, false); } -#line 5683 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5682 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 149: -#line 1256 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1300 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 5691 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5690 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 150: -#line 1259 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1303 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 5699 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5698 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 151: -#line 1262 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1306 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.checkPrecisionQualifier((yyvsp[0].interm.type).loc, (yyvsp[0].interm.type).qualifier.precision); (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 5708 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5707 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 152: -#line 1266 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1310 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // allow inheritance of storage qualifier from block declaration (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 5717 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5716 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 153: -#line 1270 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1314 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // allow inheritance of storage qualifier from block declaration (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 5726 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5725 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 154: -#line 1274 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1319 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // allow inheritance of storage qualifier from block declaration (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 5735 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5734 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 155: -#line 1278 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1323 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 5743 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5742 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 156: -#line 1284 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1330 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqConst; // will later turn into EvqConstReadOnly, if the initializer is not constant } -#line 5752 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5751 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 157: -#line 1288 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1334 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.requireStage((yyvsp[0].lex).loc, EShLangVertex, "attribute"); - parseContext.checkDeprecated((yyvsp[0].lex).loc, ECoreProfile, 130, "attribute"); - parseContext.checkDeprecated((yyvsp[0].lex).loc, ENoProfile, 130, "attribute"); - parseContext.requireNotRemoved((yyvsp[0].lex).loc, ECoreProfile, 420, "attribute"); - parseContext.requireNotRemoved((yyvsp[0].lex).loc, EEsProfile, 300, "attribute"); - - parseContext.globalCheck((yyvsp[0].lex).loc, "attribute"); - + parseContext.globalCheck((yyvsp[0].lex).loc, "inout"); (yyval.interm.type).init((yyvsp[0].lex).loc); - (yyval.interm.type).qualifier.storage = EvqVaryingIn; + (yyval.interm.type).qualifier.storage = EvqInOut; } -#line 5769 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5761 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 158: -#line 1300 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1339 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.checkDeprecated((yyvsp[0].lex).loc, ENoProfile, 130, "varying"); - parseContext.checkDeprecated((yyvsp[0].lex).loc, ECoreProfile, 130, "varying"); - parseContext.requireNotRemoved((yyvsp[0].lex).loc, ECoreProfile, 420, "varying"); - parseContext.requireNotRemoved((yyvsp[0].lex).loc, EEsProfile, 300, "varying"); - - parseContext.globalCheck((yyvsp[0].lex).loc, "varying"); - + parseContext.globalCheck((yyvsp[0].lex).loc, "in"); (yyval.interm.type).init((yyvsp[0].lex).loc); - if (parseContext.language == EShLangVertex) - (yyval.interm.type).qualifier.storage = EvqVaryingOut; - else - (yyval.interm.type).qualifier.storage = EvqVaryingIn; + // whether this is a parameter "in" or a pipeline "in" will get sorted out a bit later + (yyval.interm.type).qualifier.storage = EvqIn; } -#line 5788 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5772 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 159: -#line 1314 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1345 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.globalCheck((yyvsp[0].lex).loc, "inout"); + parseContext.globalCheck((yyvsp[0].lex).loc, "out"); (yyval.interm.type).init((yyvsp[0].lex).loc); - (yyval.interm.type).qualifier.storage = EvqInOut; + // whether this is a parameter "out" or a pipeline "out" will get sorted out a bit later + (yyval.interm.type).qualifier.storage = EvqOut; } -#line 5798 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5783 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 160: -#line 1319 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1351 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.globalCheck((yyvsp[0].lex).loc, "in"); + parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 120, 0, "centroid"); + parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 300, 0, "centroid"); + parseContext.globalCheck((yyvsp[0].lex).loc, "centroid"); (yyval.interm.type).init((yyvsp[0].lex).loc); - // whether this is a parameter "in" or a pipeline "in" will get sorted out a bit later - (yyval.interm.type).qualifier.storage = EvqIn; + (yyval.interm.type).qualifier.centroid = true; } -#line 5809 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5795 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 161: -#line 1325 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1358 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.globalCheck((yyvsp[0].lex).loc, "out"); + parseContext.globalCheck((yyvsp[0].lex).loc, "uniform"); (yyval.interm.type).init((yyvsp[0].lex).loc); - // whether this is a parameter "out" or a pipeline "out" will get sorted out a bit later - (yyval.interm.type).qualifier.storage = EvqOut; + (yyval.interm.type).qualifier.storage = EvqUniform; } -#line 5820 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5805 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 162: -#line 1331 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1363 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 120, 0, "centroid"); - parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 300, 0, "centroid"); - parseContext.globalCheck((yyvsp[0].lex).loc, "centroid"); + parseContext.globalCheck((yyvsp[0].lex).loc, "shared"); + parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, 430, E_GL_ARB_compute_shader, "shared"); + parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 310, 0, "shared"); + parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangComputeMask | EShLangMeshNVMask | EShLangTaskNVMask), "shared"); (yyval.interm.type).init((yyvsp[0].lex).loc); - (yyval.interm.type).qualifier.centroid = true; + (yyval.interm.type).qualifier.storage = EvqShared; } -#line 5832 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5818 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 163: -#line 1338 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1371 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.globalCheck((yyvsp[0].lex).loc, "patch"); - parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangTessControlMask | EShLangTessEvaluationMask), "patch"); + parseContext.globalCheck((yyvsp[0].lex).loc, "buffer"); (yyval.interm.type).init((yyvsp[0].lex).loc); - (yyval.interm.type).qualifier.patch = true; + (yyval.interm.type).qualifier.storage = EvqBuffer; } -#line 5843 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5828 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 164: -#line 1344 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1377 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.globalCheck((yyvsp[0].lex).loc, "sample"); + parseContext.requireStage((yyvsp[0].lex).loc, EShLangVertex, "attribute"); + parseContext.checkDeprecated((yyvsp[0].lex).loc, ECoreProfile, 130, "attribute"); + parseContext.checkDeprecated((yyvsp[0].lex).loc, ENoProfile, 130, "attribute"); + parseContext.requireNotRemoved((yyvsp[0].lex).loc, ECoreProfile, 420, "attribute"); + parseContext.requireNotRemoved((yyvsp[0].lex).loc, EEsProfile, 300, "attribute"); + + parseContext.globalCheck((yyvsp[0].lex).loc, "attribute"); + (yyval.interm.type).init((yyvsp[0].lex).loc); - (yyval.interm.type).qualifier.sample = true; + (yyval.interm.type).qualifier.storage = EvqVaryingIn; } -#line 5853 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5845 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 165: -#line 1349 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1389 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.globalCheck((yyvsp[0].lex).loc, "uniform"); + parseContext.checkDeprecated((yyvsp[0].lex).loc, ENoProfile, 130, "varying"); + parseContext.checkDeprecated((yyvsp[0].lex).loc, ECoreProfile, 130, "varying"); + parseContext.requireNotRemoved((yyvsp[0].lex).loc, ECoreProfile, 420, "varying"); + parseContext.requireNotRemoved((yyvsp[0].lex).loc, EEsProfile, 300, "varying"); + + parseContext.globalCheck((yyvsp[0].lex).loc, "varying"); + (yyval.interm.type).init((yyvsp[0].lex).loc); - (yyval.interm.type).qualifier.storage = EvqUniform; + if (parseContext.language == EShLangVertex) + (yyval.interm.type).qualifier.storage = EvqVaryingOut; + else + (yyval.interm.type).qualifier.storage = EvqVaryingIn; } -#line 5863 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5864 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 166: -#line 1354 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1403 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.globalCheck((yyvsp[0].lex).loc, "buffer"); + parseContext.globalCheck((yyvsp[0].lex).loc, "patch"); + parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangTessControlMask | EShLangTessEvaluationMask), "patch"); (yyval.interm.type).init((yyvsp[0].lex).loc); - (yyval.interm.type).qualifier.storage = EvqBuffer; + (yyval.interm.type).qualifier.patch = true; } -#line 5873 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5875 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 167: -#line 1359 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1409 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.globalCheck((yyvsp[0].lex).loc, "sample"); + (yyval.interm.type).init((yyvsp[0].lex).loc); + (yyval.interm.type).qualifier.sample = true; + } +#line 5885 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 168: +#line 1414 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef NV_EXTENSIONS parseContext.globalCheck((yyvsp[0].lex).loc, "hitAttributeNV"); parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangIntersectNVMask | EShLangClosestHitNVMask | EShLangAnyHitNVMask), "hitAttributeNV"); parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "hitAttributeNV"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqHitAttrNV; -#endif } -#line 5888 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5898 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 168: -#line 1369 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 169: +#line 1422 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef NV_EXTENSIONS parseContext.globalCheck((yyvsp[0].lex).loc, "rayPayloadNV"); parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangRayGenNVMask | EShLangClosestHitNVMask | EShLangAnyHitNVMask | EShLangMissNVMask), "rayPayloadNV"); parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "rayPayloadNV"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqPayloadNV; -#endif } -#line 5903 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5911 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 169: -#line 1379 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 170: +#line 1430 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef NV_EXTENSIONS parseContext.globalCheck((yyvsp[0].lex).loc, "rayPayloadInNV"); parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangClosestHitNVMask | EShLangAnyHitNVMask | EShLangMissNVMask), "rayPayloadInNV"); parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "rayPayloadInNV"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqPayloadInNV; -#endif } -#line 5918 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5924 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 170: -#line 1389 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 171: +#line 1438 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef NV_EXTENSIONS parseContext.globalCheck((yyvsp[0].lex).loc, "callableDataNV"); parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangRayGenNVMask | EShLangClosestHitNVMask | EShLangMissNVMask | EShLangCallableNVMask), "callableDataNV"); parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "callableDataNV"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqCallableDataNV; -#endif } -#line 5933 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5937 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 171: -#line 1399 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 172: +#line 1446 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef NV_EXTENSIONS parseContext.globalCheck((yyvsp[0].lex).loc, "callableDataInNV"); parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangCallableNVMask), "callableDataInNV"); parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "callableDataInNV"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqCallableDataInNV; -#endif - } -#line 5947 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 172: -#line 1408 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.globalCheck((yyvsp[0].lex).loc, "shared"); - parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, 430, E_GL_ARB_compute_shader, "shared"); - parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 310, 0, "shared"); -#ifdef NV_EXTENSIONS - parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangComputeMask | EShLangMeshNVMask | EShLangTaskNVMask), "shared"); -#else - parseContext.requireStage((yyvsp[0].lex).loc, EShLangCompute, "shared"); -#endif - (yyval.interm.type).init((yyvsp[0].lex).loc); - (yyval.interm.type).qualifier.storage = EvqShared; } -#line 5964 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5949 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 173: -#line 1420 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1453 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.coherent = true; } -#line 5973 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5958 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 174: -#line 1424 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1457 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc); parseContext.requireExtensions((yyvsp[0].lex).loc, 1, &E_GL_KHR_memory_scope_semantics, "devicecoherent"); (yyval.interm.type).qualifier.devicecoherent = true; } -#line 5983 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5968 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 175: -#line 1429 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1462 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc); parseContext.requireExtensions((yyvsp[0].lex).loc, 1, &E_GL_KHR_memory_scope_semantics, "queuefamilycoherent"); (yyval.interm.type).qualifier.queuefamilycoherent = true; } -#line 5993 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5978 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 176: -#line 1434 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1467 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc); parseContext.requireExtensions((yyvsp[0].lex).loc, 1, &E_GL_KHR_memory_scope_semantics, "workgroupcoherent"); (yyval.interm.type).qualifier.workgroupcoherent = true; } -#line 6003 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5988 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 177: -#line 1439 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1472 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc); parseContext.requireExtensions((yyvsp[0].lex).loc, 1, &E_GL_KHR_memory_scope_semantics, "subgroupcoherent"); (yyval.interm.type).qualifier.subgroupcoherent = true; } -#line 6013 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5998 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 178: -#line 1444 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1477 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc); parseContext.requireExtensions((yyvsp[0].lex).loc, 1, &E_GL_KHR_memory_scope_semantics, "nonprivate"); (yyval.interm.type).qualifier.nonprivate = true; } -#line 6023 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6008 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 179: -#line 1449 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1482 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.volatil = true; } -#line 6032 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6017 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 180: -#line 1453 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1486 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.restrict = true; } -#line 6041 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6026 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 181: -#line 1457 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1490 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.readonly = true; } -#line 6050 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6035 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 182: -#line 1461 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1494 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.writeonly = true; } -#line 6059 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6044 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 183: -#line 1465 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1498 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.spvRemoved((yyvsp[0].lex).loc, "subroutine"); parseContext.globalCheck((yyvsp[0].lex).loc, "subroutine"); parseContext.unimplemented((yyvsp[0].lex).loc, "subroutine"); (yyval.interm.type).init((yyvsp[0].lex).loc); } -#line 6070 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6055 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 184: -#line 1471 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1504 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.spvRemoved((yyvsp[-3].lex).loc, "subroutine"); parseContext.globalCheck((yyvsp[-3].lex).loc, "subroutine"); parseContext.unimplemented((yyvsp[-3].lex).loc, "subroutine"); (yyval.interm.type).init((yyvsp[-3].lex).loc); } -#line 6081 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6066 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 185: -#line 1480 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1515 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.nonUniform = true; } -#line 6090 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6075 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 186: -#line 1487 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1522 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // TODO } -#line 6098 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6083 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 187: -#line 1490 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1525 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // TODO: 4.0 semantics: subroutines // 1) make sure each identifier is a type declared earlier with SUBROUTINE // 2) save all of the identifiers for future comparison with the declared function } -#line 6108 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6093 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 188: -#line 1498 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1534 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type) = (yyvsp[-1].interm.type); (yyval.interm.type).qualifier.precision = parseContext.getDefaultPrecision((yyval.interm.type)); (yyval.interm.type).typeParameters = (yyvsp[0].interm.typeParameters); } -#line 6118 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6103 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 189: -#line 1503 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1539 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.arrayOfArrayVersionCheck((yyvsp[0].interm).loc, (yyvsp[0].interm).arraySizes); (yyval.interm.type) = (yyvsp[-2].interm.type); @@ -6126,21 +6113,21 @@ yyreduce: (yyval.interm.type).typeParameters = (yyvsp[-1].interm.typeParameters); (yyval.interm.type).arraySizes = (yyvsp[0].interm).arraySizes; } -#line 6130 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6115 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 190: -#line 1513 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1549 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).loc = (yyvsp[-1].lex).loc; (yyval.interm).arraySizes = new TArraySizes; (yyval.interm).arraySizes->addInnerSize(); } -#line 6140 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6125 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 191: -#line 1518 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1554 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).loc = (yyvsp[-2].lex).loc; (yyval.interm).arraySizes = new TArraySizes; @@ -6149,20 +6136,20 @@ yyreduce: parseContext.arraySizeCheck((yyvsp[-1].interm.intermTypedNode)->getLoc(), (yyvsp[-1].interm.intermTypedNode), size, "array size"); (yyval.interm).arraySizes->addInnerSize(size); } -#line 6153 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6138 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 192: -#line 1526 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1562 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm) = (yyvsp[-2].interm); (yyval.interm).arraySizes->addInnerSize(); } -#line 6162 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6147 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 193: -#line 1530 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1566 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm) = (yyvsp[-3].interm); @@ -6170,35 +6157,35 @@ yyreduce: parseContext.arraySizeCheck((yyvsp[-1].interm.intermTypedNode)->getLoc(), (yyvsp[-1].interm.intermTypedNode), size, "array size"); (yyval.interm).arraySizes->addInnerSize(size); } -#line 6174 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6159 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 194: -#line 1540 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1576 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.typeParameters) = (yyvsp[0].interm.typeParameters); } -#line 6182 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6167 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 195: -#line 1543 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1579 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.typeParameters) = 0; } -#line 6190 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6175 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 196: -#line 1549 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1585 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.typeParameters) = (yyvsp[-1].interm.typeParameters); } -#line 6198 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6183 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 197: -#line 1555 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1591 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.typeParameters) = new TArraySizes; @@ -6206,11 +6193,11 @@ yyreduce: parseContext.arraySizeCheck((yyvsp[0].interm.intermTypedNode)->getLoc(), (yyvsp[0].interm.intermTypedNode), size, "type parameter"); (yyval.interm.typeParameters)->addInnerSize(size); } -#line 6210 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6195 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 198: -#line 1562 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1598 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.typeParameters) = (yyvsp[-2].interm.typeParameters); @@ -6218,1985 +6205,1974 @@ yyreduce: parseContext.arraySizeCheck((yyvsp[0].interm.intermTypedNode)->getLoc(), (yyvsp[0].interm.intermTypedNode), size, "type parameter"); (yyval.interm.typeParameters)->addInnerSize(size); } -#line 6222 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6207 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 199: -#line 1572 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1608 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtVoid; } -#line 6231 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6216 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 200: -#line 1576 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1612 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; } -#line 6240 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6225 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 201: -#line 1580 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1616 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtDouble; + (yyval.interm.type).basicType = EbtInt; } -#line 6250 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6234 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 202: -#line 1585 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1620 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.float16ScalarVectorCheck((yyvsp[0].lex).loc, "float16_t", parseContext.symbolTable.atBuiltInLevel()); + parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned integer"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat16; + (yyval.interm.type).basicType = EbtUint; } -#line 6260 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6244 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 203: -#line 1590 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1625 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).basicType = EbtBool; } -#line 6270 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6253 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 204: -#line 1595 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1629 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtDouble; + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setVector(2); } -#line 6280 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6263 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 205: -#line 1600 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1634 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt; + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setVector(3); } -#line 6289 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6273 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 206: -#line 1604 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1639 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned integer"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint; + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setVector(4); } -#line 6299 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6283 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 207: -#line 1609 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1644 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit signed integer", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt8; + (yyval.interm.type).basicType = EbtBool; + (yyval.interm.type).setVector(2); } -#line 6309 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6293 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 208: -#line 1614 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1649 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint8; + (yyval.interm.type).basicType = EbtBool; + (yyval.interm.type).setVector(3); } -#line 6319 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6303 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 209: -#line 1619 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1654 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit signed integer", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt16; + (yyval.interm.type).basicType = EbtBool; + (yyval.interm.type).setVector(4); } -#line 6329 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6313 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 210: -#line 1624 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1659 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint16; + (yyval.interm.type).basicType = EbtInt; + (yyval.interm.type).setVector(2); } -#line 6339 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6323 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 211: -#line 1629 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1664 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit signed integer", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt; + (yyval.interm.type).setVector(3); } -#line 6349 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6333 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 212: -#line 1634 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1669 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint; + (yyval.interm.type).basicType = EbtInt; + (yyval.interm.type).setVector(4); } -#line 6359 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6343 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 213: -#line 1639 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1674 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int64Check((yyvsp[0].lex).loc, "64-bit integer", parseContext.symbolTable.atBuiltInLevel()); + parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned integer vector"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt64; + (yyval.interm.type).basicType = EbtUint; + (yyval.interm.type).setVector(2); } -#line 6369 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6354 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 214: -#line 1644 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1680 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); + parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned integer vector"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint64; + (yyval.interm.type).basicType = EbtUint; + (yyval.interm.type).setVector(3); } -#line 6379 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6365 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 215: -#line 1649 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1686 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { + parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned integer vector"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtBool; + (yyval.interm.type).basicType = EbtUint; + (yyval.interm.type).setVector(4); } -#line 6388 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6376 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 216: -#line 1653 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1692 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setVector(2); + (yyval.interm.type).setMatrix(2, 2); } -#line 6398 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6386 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 217: -#line 1658 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1697 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setVector(3); + (yyval.interm.type).setMatrix(3, 3); } -#line 6408 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6396 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 218: -#line 1663 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1702 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setVector(4); + (yyval.interm.type).setMatrix(4, 4); } -#line 6418 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6406 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 219: -#line 1668 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1707 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double vector"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtDouble; - (yyval.interm.type).setVector(2); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setMatrix(2, 2); } -#line 6429 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6416 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 220: -#line 1674 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1712 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double vector"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtDouble; - (yyval.interm.type).setVector(3); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setMatrix(2, 3); } -#line 6440 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6426 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 221: -#line 1680 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1717 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double vector"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtDouble; - (yyval.interm.type).setVector(4); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setMatrix(2, 4); } -#line 6451 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6436 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 222: -#line 1686 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1722 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.float16ScalarVectorCheck((yyvsp[0].lex).loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat16; - (yyval.interm.type).setVector(2); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setMatrix(3, 2); } -#line 6462 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6446 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 223: -#line 1692 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1727 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.float16ScalarVectorCheck((yyvsp[0].lex).loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat16; - (yyval.interm.type).setVector(3); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setMatrix(3, 3); } -#line 6473 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6456 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 224: -#line 1698 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1732 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.float16ScalarVectorCheck((yyvsp[0].lex).loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat16; - (yyval.interm.type).setVector(4); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setMatrix(3, 4); } -#line 6484 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6466 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 225: -#line 1704 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1737 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setVector(2); + (yyval.interm.type).setMatrix(4, 2); } -#line 6495 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6476 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 226: -#line 1710 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1742 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setVector(3); + (yyval.interm.type).setMatrix(4, 3); } -#line 6506 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6486 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 227: -#line 1716 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1747 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setVector(4); + (yyval.interm.type).setMatrix(4, 4); } -#line 6517 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6496 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 228: -#line 1722 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1753 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel()); + parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck((yyvsp[0].lex).loc, "double"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; - (yyval.interm.type).setVector(2); } -#line 6528 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6506 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 229: -#line 1728 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1758 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel()); + parseContext.float16ScalarVectorCheck((yyvsp[0].lex).loc, "float16_t", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtDouble; - (yyval.interm.type).setVector(3); + (yyval.interm.type).basicType = EbtFloat16; } -#line 6539 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6516 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 230: -#line 1734 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1763 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel()); + parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtDouble; - (yyval.interm.type).setVector(4); + (yyval.interm.type).basicType = EbtFloat; } -#line 6550 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6526 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 231: -#line 1740 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1768 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { + parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtBool; - (yyval.interm.type).setVector(2); + (yyval.interm.type).basicType = EbtDouble; } -#line 6560 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6536 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 232: -#line 1745 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1773 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { + parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit signed integer", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtBool; - (yyval.interm.type).setVector(3); + (yyval.interm.type).basicType = EbtInt8; } -#line 6570 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6546 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 233: -#line 1750 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1778 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { + parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtBool; - (yyval.interm.type).setVector(4); + (yyval.interm.type).basicType = EbtUint8; } -#line 6580 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6556 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 234: -#line 1755 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1783 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { + parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit signed integer", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt; - (yyval.interm.type).setVector(2); + (yyval.interm.type).basicType = EbtInt16; } -#line 6590 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6566 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 235: -#line 1760 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1788 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { + parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt; - (yyval.interm.type).setVector(3); + (yyval.interm.type).basicType = EbtUint16; } -#line 6600 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6576 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 236: -#line 1765 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1793 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { + parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit signed integer", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt; - (yyval.interm.type).setVector(4); } -#line 6610 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6586 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 237: -#line 1770 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1798 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt8; - (yyval.interm.type).setVector(2); + (yyval.interm.type).basicType = EbtUint; } -#line 6621 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6596 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 238: -#line 1776 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1803 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + parseContext.int64Check((yyvsp[0].lex).loc, "64-bit integer", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt8; - (yyval.interm.type).setVector(3); + (yyval.interm.type).basicType = EbtInt64; } -#line 6632 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6606 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 239: -#line 1782 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1808 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt8; - (yyval.interm.type).setVector(4); + (yyval.interm.type).basicType = EbtUint64; } -#line 6643 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6616 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 240: -#line 1788 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1813 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double vector"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck((yyvsp[0].lex).loc, "double vector"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt16; + (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setVector(2); } -#line 6654 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6627 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 241: -#line 1794 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1819 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double vector"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck((yyvsp[0].lex).loc, "double vector"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt16; + (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setVector(3); } -#line 6665 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6638 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 242: -#line 1800 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1825 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double vector"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck((yyvsp[0].lex).loc, "double vector"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt16; + (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setVector(4); } -#line 6676 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6649 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 243: -#line 1806 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1831 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + parseContext.float16ScalarVectorCheck((yyvsp[0].lex).loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt; + (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setVector(2); } -#line 6687 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6660 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 244: -#line 1812 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1837 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + parseContext.float16ScalarVectorCheck((yyvsp[0].lex).loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt; + (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setVector(3); } -#line 6698 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6671 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 245: -#line 1818 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1843 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + parseContext.float16ScalarVectorCheck((yyvsp[0].lex).loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt; + (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setVector(4); } -#line 6709 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6682 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 246: -#line 1824 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1849 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int64Check((yyvsp[0].lex).loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); + parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt64; + (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setVector(2); } -#line 6720 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6693 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 247: -#line 1830 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1855 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int64Check((yyvsp[0].lex).loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); + parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt64; + (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setVector(3); } -#line 6731 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6704 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 248: -#line 1836 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1861 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int64Check((yyvsp[0].lex).loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); + parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt64; + (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setVector(4); } -#line 6742 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6715 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 249: -#line 1842 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1867 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned integer vector"); + parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint; + (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setVector(2); } -#line 6753 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6726 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 250: -#line 1848 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1873 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned integer vector"); + parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint; + (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setVector(3); } -#line 6764 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6737 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 251: -#line 1854 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1879 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned integer vector"); + parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint; + (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setVector(4); } -#line 6775 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6748 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 252: -#line 1860 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1885 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint8; + (yyval.interm.type).basicType = EbtInt8; (yyval.interm.type).setVector(2); } -#line 6786 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6759 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 253: -#line 1866 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1891 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint8; + (yyval.interm.type).basicType = EbtInt8; (yyval.interm.type).setVector(3); } -#line 6797 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6770 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 254: -#line 1872 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1897 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint8; + (yyval.interm.type).basicType = EbtInt8; (yyval.interm.type).setVector(4); } -#line 6808 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6781 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 255: -#line 1878 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1903 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint16; + (yyval.interm.type).basicType = EbtInt16; (yyval.interm.type).setVector(2); } -#line 6819 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6792 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 256: -#line 1884 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1909 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint16; + (yyval.interm.type).basicType = EbtInt16; (yyval.interm.type).setVector(3); } -#line 6830 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6803 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 257: -#line 1890 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1915 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint16; + (yyval.interm.type).basicType = EbtInt16; (yyval.interm.type).setVector(4); } -#line 6841 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6814 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 258: -#line 1896 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1921 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint; + (yyval.interm.type).basicType = EbtInt; (yyval.interm.type).setVector(2); } -#line 6852 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6825 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 259: -#line 1902 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1927 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint; + (yyval.interm.type).basicType = EbtInt; (yyval.interm.type).setVector(3); } -#line 6863 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6836 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 260: -#line 1908 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1933 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint; + (yyval.interm.type).basicType = EbtInt; (yyval.interm.type).setVector(4); } -#line 6874 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6847 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 261: -#line 1914 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1939 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + parseContext.int64Check((yyvsp[0].lex).loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint64; + (yyval.interm.type).basicType = EbtInt64; (yyval.interm.type).setVector(2); } -#line 6885 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6858 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 262: -#line 1920 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1945 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + parseContext.int64Check((yyvsp[0].lex).loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint64; + (yyval.interm.type).basicType = EbtInt64; (yyval.interm.type).setVector(3); } -#line 6896 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6869 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 263: -#line 1926 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1951 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + parseContext.int64Check((yyvsp[0].lex).loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint64; + (yyval.interm.type).basicType = EbtInt64; (yyval.interm.type).setVector(4); } -#line 6907 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6880 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 264: -#line 1932 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1957 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { + parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setMatrix(2, 2); + (yyval.interm.type).basicType = EbtUint8; + (yyval.interm.type).setVector(2); } -#line 6917 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6891 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 265: -#line 1937 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1963 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { + parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setMatrix(3, 3); + (yyval.interm.type).basicType = EbtUint8; + (yyval.interm.type).setVector(3); } -#line 6927 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6902 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 266: -#line 1942 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1969 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { + parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setMatrix(4, 4); + (yyval.interm.type).basicType = EbtUint8; + (yyval.interm.type).setVector(4); } -#line 6937 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6913 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 267: -#line 1947 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1975 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { + parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setMatrix(2, 2); + (yyval.interm.type).basicType = EbtUint16; + (yyval.interm.type).setVector(2); } -#line 6947 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6924 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 268: -#line 1952 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1981 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { + parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setMatrix(2, 3); + (yyval.interm.type).basicType = EbtUint16; + (yyval.interm.type).setVector(3); } -#line 6957 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6935 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 269: -#line 1957 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1987 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { + parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setMatrix(2, 4); + (yyval.interm.type).basicType = EbtUint16; + (yyval.interm.type).setVector(4); } -#line 6967 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6946 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 270: -#line 1962 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1993 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { + parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setMatrix(3, 2); + (yyval.interm.type).basicType = EbtUint; + (yyval.interm.type).setVector(2); } -#line 6977 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6957 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 271: -#line 1967 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1999 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { + parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setMatrix(3, 3); + (yyval.interm.type).basicType = EbtUint; + (yyval.interm.type).setVector(3); } -#line 6987 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6968 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 272: -#line 1972 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2005 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { + parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setMatrix(3, 4); + (yyval.interm.type).basicType = EbtUint; + (yyval.interm.type).setVector(4); } -#line 6997 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6979 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 273: -#line 1977 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2011 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { + parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setMatrix(4, 2); + (yyval.interm.type).basicType = EbtUint64; + (yyval.interm.type).setVector(2); } -#line 7007 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6990 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 274: -#line 1982 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2017 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { + parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setMatrix(4, 3); + (yyval.interm.type).basicType = EbtUint64; + (yyval.interm.type).setVector(3); } -#line 7017 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7001 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 275: -#line 1987 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2023 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { + parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setMatrix(4, 4); + (yyval.interm.type).basicType = EbtUint64; + (yyval.interm.type).setVector(4); } -#line 7027 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7012 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 276: -#line 1992 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2029 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); + parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(2, 2); } -#line 7038 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7023 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 277: -#line 1998 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2035 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); + parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(3, 3); } -#line 7049 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7034 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 278: -#line 2004 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2041 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); + parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(4, 4); } -#line 7060 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7045 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 279: -#line 2010 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2047 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); + parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(2, 2); } -#line 7071 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7056 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 280: -#line 2016 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2053 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); + parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(2, 3); } -#line 7082 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7067 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 281: -#line 2022 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2059 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); + parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(2, 4); } -#line 7093 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7078 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 282: -#line 2028 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2065 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); + parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(3, 2); } -#line 7104 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7089 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 283: -#line 2034 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2071 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); + parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(3, 3); } -#line 7115 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7100 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 284: -#line 2040 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2077 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); + parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(3, 4); } -#line 7126 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7111 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 285: -#line 2046 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2083 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); + parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(4, 2); } -#line 7137 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7122 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 286: -#line 2052 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2089 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); + parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(4, 3); } -#line 7148 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7133 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 287: -#line 2058 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2095 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); + parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix"); + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(4, 4); } -#line 7159 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7144 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 288: -#line 2064 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2101 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(2, 2); } -#line 7170 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7155 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 289: -#line 2070 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2107 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(3, 3); } -#line 7181 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7166 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 290: -#line 2076 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2113 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(4, 4); } -#line 7192 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7177 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 291: -#line 2082 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2119 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(2, 2); } -#line 7203 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7188 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 292: -#line 2088 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2125 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(2, 3); } -#line 7214 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7199 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 293: -#line 2094 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2131 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(2, 4); } -#line 7225 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7210 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 294: -#line 2100 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2137 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(3, 2); } -#line 7236 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7221 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 295: -#line 2106 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2143 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(3, 3); } -#line 7247 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7232 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 296: -#line 2112 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2149 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(3, 4); } -#line 7258 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7243 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 297: -#line 2118 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2155 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(4, 2); } -#line 7269 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7254 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 298: -#line 2124 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2161 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(4, 3); } -#line 7280 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7265 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 299: -#line 2130 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2167 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(4, 4); } -#line 7291 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7276 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 300: -#line 2136 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2173 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(2, 2); } -#line 7302 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7287 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 301: -#line 2142 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2179 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(3, 3); } -#line 7313 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7298 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 302: -#line 2148 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2185 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(4, 4); } -#line 7324 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7309 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 303: -#line 2154 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2191 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(2, 2); } -#line 7335 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7320 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 304: -#line 2160 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2197 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(2, 3); } -#line 7346 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7331 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 305: -#line 2166 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2203 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(2, 4); } -#line 7357 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7342 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 306: -#line 2172 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2209 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(3, 2); } -#line 7368 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7353 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 307: -#line 2178 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2215 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(3, 3); } -#line 7379 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7364 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 308: -#line 2184 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2221 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(3, 4); } -#line 7390 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7375 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 309: -#line 2190 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2227 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(4, 2); } -#line 7401 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7386 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 310: -#line 2196 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2233 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(4, 3); } -#line 7412 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7397 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 311: -#line 2202 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2239 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(4, 4); } -#line 7423 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7408 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 312: -#line 2208 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2245 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(2, 2); } -#line 7434 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7419 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 313: -#line 2214 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2251 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(3, 3); } -#line 7445 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7430 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 314: -#line 2220 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2257 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(4, 4); } -#line 7456 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7441 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 315: -#line 2226 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2263 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(2, 2); } -#line 7467 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7452 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 316: -#line 2232 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2269 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(2, 3); } -#line 7478 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7463 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 317: -#line 2238 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2275 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(2, 4); } -#line 7489 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7474 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 318: -#line 2244 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2281 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(3, 2); } -#line 7500 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7485 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 319: -#line 2250 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2287 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(3, 3); } -#line 7511 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7496 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 320: -#line 2256 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2293 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(3, 4); } -#line 7522 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7507 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 321: -#line 2262 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2299 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(4, 2); } -#line 7533 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7518 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 322: -#line 2268 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2305 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(4, 3); } -#line 7544 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7529 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 323: -#line 2274 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2311 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(4, 4); } -#line 7555 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7540 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 324: -#line 2280 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2317 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef NV_EXTENSIONS (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtAccStructNV; -#endif } -#line 7566 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7549 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 325: -#line 2286 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2321 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.vulkanRemoved((yyvsp[0].lex).loc, "atomic counter types"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtAtomicUint; } -#line 7576 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7559 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 326: -#line 2291 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2326 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd1D); } -#line 7586 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7569 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 327: -#line 2296 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2332 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd2D); } -#line 7596 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7579 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 328: -#line 2301 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2337 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd3D); } -#line 7606 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7589 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 329: -#line 2306 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2342 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, EsdCube); } -#line 7616 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7599 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 330: -#line 2311 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2347 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat, Esd1D, false, true); + (yyval.interm.type).sampler.set(EbtFloat, Esd2D, false, true); } -#line 7626 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7609 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 331: -#line 2316 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2352 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat, Esd2D, false, true); + (yyval.interm.type).sampler.set(EbtFloat, EsdCube, false, true); } -#line 7636 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7619 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 332: -#line 2321 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2357 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat, EsdCube, false, true); + (yyval.interm.type).sampler.set(EbtFloat, Esd2D, true); } -#line 7646 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7629 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 333: -#line 2326 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2362 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat, Esd1D, true); + (yyval.interm.type).sampler.set(EbtFloat, Esd2D, true, true); } -#line 7656 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7639 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 334: -#line 2331 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2368 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat, Esd2D, true); + (yyval.interm.type).sampler.set(EbtFloat, Esd1D, false, true); } -#line 7666 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7649 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 335: -#line 2336 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2373 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat, Esd1D, true, true); + (yyval.interm.type).sampler.set(EbtFloat, Esd1D, true); } -#line 7676 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7659 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 336: -#line 2341 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2378 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat, Esd2D, true, true); + (yyval.interm.type).sampler.set(EbtFloat, Esd1D, true, true); } -#line 7686 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7669 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 337: -#line 2346 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2383 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, EsdCube, true); } -#line 7696 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7679 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 338: -#line 2351 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2388 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, EsdCube, true, true); } -#line 7706 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7689 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 339: -#line 2356 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2393 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, Esd1D); -#endif } -#line 7719 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7700 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 340: -#line 2364 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2399 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, Esd2D); -#endif } -#line 7732 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7711 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 341: -#line 2372 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2405 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, Esd3D); -#endif } -#line 7745 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7722 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 342: -#line 2380 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2411 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, EsdCube); -#endif } -#line 7758 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7733 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 343: -#line 2388 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2417 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, Esd1D, false, true); -#endif } -#line 7771 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7744 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 344: -#line 2396 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2423 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, Esd2D, false, true); -#endif } -#line 7784 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7755 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 345: -#line 2404 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2429 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, EsdCube, false, true); -#endif } -#line 7797 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7766 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 346: -#line 2412 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2435 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, Esd1D, true); -#endif } -#line 7810 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7777 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 347: -#line 2420 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2441 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, Esd2D, true); -#endif } -#line 7823 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7788 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 348: -#line 2428 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2447 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, Esd1D, true, true); -#endif } -#line 7836 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7799 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 349: -#line 2436 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2453 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, Esd2D, true, true); -#endif } -#line 7849 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7810 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 350: -#line 2444 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2459 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, EsdCube, true); -#endif } -#line 7862 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7821 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 351: -#line 2452 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2465 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat16, EsdCube, true, true); -#endif } -#line 7875 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7832 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 352: -#line 2460 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2471 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, Esd1D); } -#line 7885 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7842 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 353: -#line 2465 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2477 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, Esd2D); } -#line 7895 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7852 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 354: -#line 2470 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2482 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, Esd3D); } -#line 7905 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7862 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 355: -#line 2475 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2487 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, EsdCube); } -#line 7915 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7872 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 356: -#line 2480 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2492 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtInt, Esd1D, true); + (yyval.interm.type).sampler.set(EbtInt, Esd2D, true); } -#line 7925 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7882 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 357: -#line 2485 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2497 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtInt, Esd2D, true); + (yyval.interm.type).sampler.set(EbtUint, Esd2D); } -#line 7935 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7892 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 358: -#line 2490 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2502 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtInt, EsdCube, true); + (yyval.interm.type).sampler.set(EbtUint, Esd3D); } -#line 7945 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7902 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 359: -#line 2495 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2507 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtUint, Esd1D); + (yyval.interm.type).sampler.set(EbtUint, EsdCube); } -#line 7955 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7912 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 360: -#line 2500 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2513 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtUint, Esd2D); + (yyval.interm.type).sampler.set(EbtInt, Esd1D, true); } -#line 7965 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7922 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 361: -#line 2505 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2518 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtUint, Esd3D); + (yyval.interm.type).sampler.set(EbtInt, EsdCube, true); } -#line 7975 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7932 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 362: -#line 2510 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2523 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtUint, EsdCube); + (yyval.interm.type).sampler.set(EbtUint, Esd1D); } -#line 7985 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7942 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 363: -#line 2515 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2528 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, Esd1D, true); } -#line 7995 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7952 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 364: -#line 2520 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2533 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtUint, Esd2D, true); + (yyval.interm.type).sampler.set(EbtUint, EsdCube, true); } -#line 8005 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7962 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 365: -#line 2525 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2538 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtUint, EsdCube, true); + (yyval.interm.type).sampler.setTexture(EbtFloat, EsdCube, true); } -#line 8015 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7972 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 366: -#line 2530 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2543 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat, EsdRect); + (yyval.interm.type).sampler.setTexture(EbtInt, EsdCube, true); } -#line 8025 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7982 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 367: -#line 2535 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2548 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat, EsdRect, false, true); + (yyval.interm.type).sampler.setTexture(EbtUint, EsdCube, true); } -#line 8035 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7992 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 368: -#line 2540 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2554 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS - parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat16, EsdRect); -#endif + (yyval.interm.type).sampler.set(EbtUint, Esd2D, true); } -#line 8048 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8002 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 369: -#line 2548 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2559 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS - parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat16, EsdRect, false, true); -#endif + (yyval.interm.type).sampler.setTexture(EbtFloat, Esd2D); } -#line 8061 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8012 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 370: -#line 2556 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2564 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtInt, EsdRect); + (yyval.interm.type).sampler.setTexture(EbtFloat, Esd3D); } -#line 8071 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8022 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 371: -#line 2561 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2569 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtUint, EsdRect); + (yyval.interm.type).sampler.setTexture(EbtFloat, Esd2D, true); } -#line 8081 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8032 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 372: -#line 2566 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2574 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat, EsdBuffer); + (yyval.interm.type).sampler.setTexture(EbtFloat, EsdCube); } -#line 8091 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8042 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 373: -#line 2571 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2579 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS - parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat16, EsdBuffer); -#endif + (yyval.interm.type).sampler.setTexture(EbtInt, Esd2D); } -#line 8104 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8052 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 374: -#line 2579 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2584 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtInt, EsdBuffer); + (yyval.interm.type).sampler.setTexture(EbtInt, Esd3D); } -#line 8114 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8062 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 375: -#line 2584 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2589 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtUint, EsdBuffer); + (yyval.interm.type).sampler.setTexture(EbtInt, EsdCube); } -#line 8124 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8072 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 376: -#line 2589 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2594 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat, Esd2D, false, false, true); + (yyval.interm.type).sampler.setTexture(EbtInt, Esd2D, true); } -#line 8134 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8082 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 377: -#line 2594 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2599 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS - parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat16, Esd2D, false, false, true); -#endif + (yyval.interm.type).sampler.setTexture(EbtUint, Esd2D); } -#line 8147 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8092 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 378: -#line 2602 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2604 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtInt, Esd2D, false, false, true); + (yyval.interm.type).sampler.setTexture(EbtUint, Esd3D); } -#line 8157 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8102 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 379: -#line 2607 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2609 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtUint, Esd2D, false, false, true); + (yyval.interm.type).sampler.setTexture(EbtUint, EsdCube); } -#line 8167 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8112 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 380: -#line 2612 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2614 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat, Esd2D, true, false, true); + (yyval.interm.type).sampler.setTexture(EbtUint, Esd2D, true); } -#line 8177 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8122 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 381: -#line 2617 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2619 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS - parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat16, Esd2D, true, false, true); -#endif + (yyval.interm.type).sampler.setPureSampler(false); } -#line 8190 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8132 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 382: -#line 2625 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2624 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtInt, Esd2D, true, false, true); + (yyval.interm.type).sampler.setPureSampler(true); } -#line 8200 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8142 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 383: @@ -8204,9 +8180,9 @@ yyreduce: { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtUint, Esd2D, true, false, true); + (yyval.interm.type).sampler.set(EbtFloat, EsdRect); } -#line 8210 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8152 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 384: @@ -8214,1106 +8190,1085 @@ yyreduce: { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setPureSampler(false); + (yyval.interm.type).sampler.set(EbtFloat, EsdRect, false, true); } -#line 8220 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8162 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 385: #line 2640 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setPureSampler(true); + (yyval.interm.type).sampler.set(EbtFloat16, EsdRect); } -#line 8230 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8173 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 386: -#line 2645 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2646 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtFloat, Esd1D); + (yyval.interm.type).sampler.set(EbtFloat16, EsdRect, false, true); } -#line 8240 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8184 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 387: -#line 2650 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2652 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS - parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtFloat16, Esd1D); -#endif + (yyval.interm.type).sampler.set(EbtInt, EsdRect); } -#line 8253 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8194 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 388: -#line 2658 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2657 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtFloat, Esd2D); + (yyval.interm.type).sampler.set(EbtUint, EsdRect); } -#line 8263 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8204 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 389: -#line 2663 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2662 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS - parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtFloat16, Esd2D); -#endif + (yyval.interm.type).sampler.set(EbtFloat, EsdBuffer); } -#line 8276 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8214 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 390: -#line 2671 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2667 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtFloat, Esd3D); + (yyval.interm.type).sampler.set(EbtFloat16, EsdBuffer); } -#line 8286 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8225 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 391: -#line 2676 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2673 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS - parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtFloat16, Esd3D); -#endif + (yyval.interm.type).sampler.set(EbtInt, EsdBuffer); } -#line 8299 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8235 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 392: -#line 2684 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2678 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtFloat, EsdCube); + (yyval.interm.type).sampler.set(EbtUint, EsdBuffer); } -#line 8309 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8245 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 393: -#line 2689 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2683 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS - parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtFloat16, EsdCube); -#endif + (yyval.interm.type).sampler.set(EbtFloat, Esd2D, false, false, true); } -#line 8322 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8255 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 394: -#line 2697 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2688 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtFloat, Esd1D, true); + (yyval.interm.type).sampler.set(EbtFloat16, Esd2D, false, false, true); } -#line 8332 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8266 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 395: -#line 2702 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2694 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS - parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtFloat16, Esd1D, true); -#endif + (yyval.interm.type).sampler.set(EbtInt, Esd2D, false, false, true); } -#line 8345 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8276 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 396: -#line 2710 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2699 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtFloat, Esd2D, true); + (yyval.interm.type).sampler.set(EbtUint, Esd2D, false, false, true); } -#line 8355 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8286 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 397: -#line 2715 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2704 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS - parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtFloat16, Esd2D, true); -#endif + (yyval.interm.type).sampler.set(EbtFloat, Esd2D, true, false, true); } -#line 8368 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8296 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 398: -#line 2723 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2709 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtFloat, EsdCube, true); + (yyval.interm.type).sampler.set(EbtFloat16, Esd2D, true, false, true); } -#line 8378 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8307 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 399: -#line 2728 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2715 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS - parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtFloat16, EsdCube, true); -#endif + (yyval.interm.type).sampler.set(EbtInt, Esd2D, true, false, true); } -#line 8391 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8317 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 400: -#line 2736 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2720 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtInt, Esd1D); + (yyval.interm.type).sampler.set(EbtUint, Esd2D, true, false, true); } -#line 8401 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8327 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 401: -#line 2741 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2725 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtInt, Esd2D); + (yyval.interm.type).sampler.setTexture(EbtFloat, Esd1D); } -#line 8411 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8337 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 402: -#line 2746 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2730 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtInt, Esd3D); + (yyval.interm.type).sampler.setTexture(EbtFloat16, Esd1D); } -#line 8421 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8348 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 403: -#line 2751 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2736 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtInt, EsdCube); + (yyval.interm.type).sampler.setTexture(EbtFloat16, Esd2D); } -#line 8431 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8359 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 404: -#line 2756 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2742 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtInt, Esd1D, true); + (yyval.interm.type).sampler.setTexture(EbtFloat16, Esd3D); } -#line 8441 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8370 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 405: -#line 2761 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2748 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtInt, Esd2D, true); + (yyval.interm.type).sampler.setTexture(EbtFloat16, EsdCube); } -#line 8451 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8381 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 406: -#line 2766 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2754 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtInt, EsdCube, true); + (yyval.interm.type).sampler.setTexture(EbtFloat, Esd1D, true); } -#line 8461 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8391 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 407: -#line 2771 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2759 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtUint, Esd1D); + (yyval.interm.type).sampler.setTexture(EbtFloat16, Esd1D, true); } -#line 8471 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8402 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 408: -#line 2776 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2765 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtUint, Esd2D); + (yyval.interm.type).sampler.setTexture(EbtFloat16, Esd2D, true); } -#line 8481 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8413 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 409: -#line 2781 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2771 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtUint, Esd3D); + (yyval.interm.type).sampler.setTexture(EbtFloat16, EsdCube, true); } -#line 8491 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8424 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 410: -#line 2786 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2777 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtUint, EsdCube); + (yyval.interm.type).sampler.setTexture(EbtInt, Esd1D); } -#line 8501 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8434 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 411: -#line 2791 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2782 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtUint, Esd1D, true); + (yyval.interm.type).sampler.setTexture(EbtInt, Esd1D, true); } -#line 8511 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8444 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 412: -#line 2796 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2787 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtUint, Esd2D, true); + (yyval.interm.type).sampler.setTexture(EbtUint, Esd1D); } -#line 8521 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8454 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 413: -#line 2801 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2792 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.setTexture(EbtUint, EsdCube, true); + (yyval.interm.type).sampler.setTexture(EbtUint, Esd1D, true); } -#line 8531 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8464 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 414: -#line 2806 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2797 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, EsdRect); } -#line 8541 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8474 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 415: -#line 2811 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2802 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat16, EsdRect); -#endif } -#line 8554 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8485 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 416: -#line 2819 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2808 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, EsdRect); } -#line 8564 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8495 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 417: -#line 2824 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2813 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, EsdRect); } -#line 8574 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8505 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 418: -#line 2829 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2818 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, EsdBuffer); } -#line 8584 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8515 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 419: -#line 2834 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2823 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat16, EsdBuffer); -#endif } -#line 8597 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8526 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 420: -#line 2842 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2829 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, EsdBuffer); } -#line 8607 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8536 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 421: -#line 2847 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2834 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, EsdBuffer); } -#line 8617 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8546 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 422: -#line 2852 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2839 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, Esd2D, false, false, true); } -#line 8627 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8556 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 423: -#line 2857 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2844 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat16, Esd2D, false, false, true); -#endif } -#line 8640 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8567 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 424: -#line 2865 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2850 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, Esd2D, false, false, true); } -#line 8650 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8577 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 425: -#line 2870 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2855 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, Esd2D, false, false, true); } -#line 8660 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8587 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 426: -#line 2875 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2860 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, Esd2D, true, false, true); } -#line 8670 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8597 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 427: -#line 2880 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2865 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat16, Esd2D, true, false, true); -#endif } -#line 8683 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8608 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 428: -#line 2888 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2871 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, Esd2D, true, false, true); } -#line 8693 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8618 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 429: -#line 2893 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2876 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, Esd2D, true, false, true); } -#line 8703 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8628 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 430: -#line 2898 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2881 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, Esd1D); } -#line 8713 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8638 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 431: -#line 2903 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2886 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat16, Esd1D); -#endif } -#line 8726 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8649 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 432: -#line 2911 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2892 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, Esd1D); } -#line 8736 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8659 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 433: -#line 2916 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2897 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, Esd1D); } -#line 8746 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8669 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 434: -#line 2921 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2902 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, Esd2D); } -#line 8756 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8679 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 435: -#line 2926 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2907 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat16, Esd2D); -#endif } -#line 8769 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8690 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 436: -#line 2934 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2913 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, Esd2D); } -#line 8779 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8700 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 437: -#line 2939 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2918 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, Esd2D); } -#line 8789 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8710 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 438: -#line 2944 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2923 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, Esd3D); } -#line 8799 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8720 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 439: -#line 2949 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2928 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat16, Esd3D); -#endif } -#line 8812 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8731 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 440: -#line 2957 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2934 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, Esd3D); } -#line 8822 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8741 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 441: -#line 2962 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2939 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, Esd3D); } -#line 8832 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8751 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 442: -#line 2967 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2944 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, EsdRect); } -#line 8842 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8761 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 443: -#line 2972 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2949 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat16, EsdRect); -#endif } -#line 8855 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8772 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 444: -#line 2980 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2955 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, EsdRect); } -#line 8865 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8782 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 445: -#line 2985 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2960 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, EsdRect); } -#line 8875 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8792 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 446: -#line 2990 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2965 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, EsdCube); } -#line 8885 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8802 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 447: -#line 2995 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2970 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat16, EsdCube); -#endif } -#line 8898 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8813 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 448: -#line 3003 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2976 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, EsdCube); } -#line 8908 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8823 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 449: -#line 3008 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2981 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, EsdCube); } -#line 8918 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8833 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 450: -#line 3013 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2986 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, EsdBuffer); } -#line 8928 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8843 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 451: -#line 3018 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2991 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat16, EsdBuffer); -#endif } -#line 8941 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8854 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 452: -#line 3026 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2997 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, EsdBuffer); } -#line 8951 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8864 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 453: -#line 3031 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3002 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, EsdBuffer); } -#line 8961 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8874 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 454: -#line 3036 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3007 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, Esd1D, true); } -#line 8971 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8884 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 455: -#line 3041 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3012 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat16, Esd1D, true); -#endif } -#line 8984 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8895 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 456: -#line 3049 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3018 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, Esd1D, true); } -#line 8994 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8905 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 457: -#line 3054 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3023 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, Esd1D, true); } -#line 9004 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8915 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 458: -#line 3059 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3028 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, Esd2D, true); } -#line 9014 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8925 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 459: -#line 3064 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3033 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat16, Esd2D, true); -#endif } -#line 9027 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8936 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 460: -#line 3072 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3039 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, Esd2D, true); } -#line 9037 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8946 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 461: -#line 3077 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3044 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, Esd2D, true); } -#line 9047 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8956 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 462: -#line 3082 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3049 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, EsdCube, true); } -#line 9057 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8966 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 463: -#line 3087 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3054 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat16, EsdCube, true); -#endif } -#line 9070 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8977 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 464: -#line 3095 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3060 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, EsdCube, true); } -#line 9080 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8987 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 465: -#line 3100 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3065 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, EsdCube, true); } -#line 9090 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8997 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 466: -#line 3105 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3070 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, Esd2D, false, false, true); } -#line 9100 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9007 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 467: -#line 3110 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3075 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat16, Esd2D, false, false, true); -#endif } -#line 9113 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9018 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 468: -#line 3118 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3081 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, Esd2D, false, false, true); } -#line 9123 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9028 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 469: -#line 3123 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3086 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, Esd2D, false, false, true); } -#line 9133 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9038 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 470: -#line 3128 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3091 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, Esd2D, true, false, true); } -#line 9143 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9048 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 471: -#line 3133 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3096 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat16, Esd2D, true, false, true); -#endif } -#line 9156 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9059 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 472: -#line 3141 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3102 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, Esd2D, true, false, true); } -#line 9166 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9069 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 473: -#line 3146 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3107 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, Esd2D, true, false, true); } -#line 9176 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9079 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 474: -#line 3151 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3112 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // GL_OES_EGL_image_external (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd2D); (yyval.interm.type).sampler.external = true; } -#line 9187 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9090 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 475: -#line 3157 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3118 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // GL_EXT_YUV_target (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd2D); (yyval.interm.type).sampler.yuv = true; } -#line 9198 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9101 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 476: -#line 3163 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3124 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setSubpass(EbtFloat); } -#line 9209 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9112 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 477: -#line 3169 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3130 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setSubpass(EbtFloat, true); } -#line 9220 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9123 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 478: -#line 3175 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3136 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float subpass input", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setSubpass(EbtFloat16); -#endif } -#line 9234 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9135 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 479: -#line 3184 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3143 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float subpass input", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setSubpass(EbtFloat16, true); -#endif } -#line 9248 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9147 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 480: -#line 3193 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3150 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setSubpass(EbtInt); } -#line 9259 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9158 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 481: -#line 3199 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3156 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setSubpass(EbtInt, true); } -#line 9270 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9169 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 482: -#line 3205 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3162 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setSubpass(EbtUint); } -#line 9281 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9180 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 483: -#line 3211 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3168 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setSubpass(EbtUint, true); } -#line 9292 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9191 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 484: -#line 3217 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3174 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.fcoopmatCheck((yyvsp[0].lex).loc, "fcoopmatNV", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).coopmat = true; } -#line 9303 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9202 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 485: -#line 3223 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3180 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.intcoopmatCheck((yyvsp[0].lex).loc, "icoopmatNV", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtInt; + (yyval.interm.type).coopmat = true; + } +#line 9213 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 486: +#line 3186 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.intcoopmatCheck((yyvsp[0].lex).loc, "ucoopmatNV", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtUint; + (yyval.interm.type).coopmat = true; + } +#line 9224 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 487: +#line 3193 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type) = (yyvsp[0].interm.type); (yyval.interm.type).qualifier.storage = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; parseContext.structTypeCheck((yyval.interm.type).loc, (yyval.interm.type)); } -#line 9313 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9234 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 486: -#line 3228 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 488: +#line 3198 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // // This is for user defined type names. The lexical phase looked up the @@ -9327,47 +9282,47 @@ yyreduce: } else parseContext.error((yyvsp[0].lex).loc, "expected type name", (yyvsp[0].lex).string->c_str(), ""); } -#line 9331 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9252 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 487: -#line 3244 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 489: +#line 3214 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "highp precision qualifier"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); parseContext.handlePrecisionQualifier((yyvsp[0].lex).loc, (yyval.interm.type).qualifier, EpqHigh); } -#line 9341 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9262 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 488: -#line 3249 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 490: +#line 3219 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "mediump precision qualifier"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); parseContext.handlePrecisionQualifier((yyvsp[0].lex).loc, (yyval.interm.type).qualifier, EpqMedium); } -#line 9351 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9272 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 489: -#line 3254 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 491: +#line 3224 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "lowp precision qualifier"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); parseContext.handlePrecisionQualifier((yyvsp[0].lex).loc, (yyval.interm.type).qualifier, EpqLow); } -#line 9361 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9282 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 490: -#line 3262 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 492: +#line 3232 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.nestedStructCheck((yyvsp[-2].lex).loc); } -#line 9367 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9288 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 491: -#line 3262 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 493: +#line 3232 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { TType* structure = new TType((yyvsp[-1].interm.typeList), *(yyvsp[-4].lex).string); parseContext.structArrayCheck((yyvsp[-4].lex).loc, *structure); @@ -9379,17 +9334,17 @@ yyreduce: (yyval.interm.type).userDef = structure; --parseContext.structNestingLevel; } -#line 9383 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9304 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 492: -#line 3273 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 494: +#line 3243 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.nestedStructCheck((yyvsp[-1].lex).loc); } -#line 9389 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9310 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 493: -#line 3273 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 495: +#line 3243 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { TType* structure = new TType((yyvsp[-1].interm.typeList), TString("")); (yyval.interm.type).init((yyvsp[-4].lex).loc); @@ -9397,19 +9352,19 @@ yyreduce: (yyval.interm.type).userDef = structure; --parseContext.structNestingLevel; } -#line 9401 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9322 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 494: -#line 3283 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 496: +#line 3253 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.typeList) = (yyvsp[0].interm.typeList); } -#line 9409 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9330 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 495: -#line 3286 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 497: +#line 3256 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.typeList) = (yyvsp[-1].interm.typeList); for (unsigned int i = 0; i < (yyvsp[0].interm.typeList)->size(); ++i) { @@ -9420,16 +9375,16 @@ yyreduce: (yyval.interm.typeList)->push_back((*(yyvsp[0].interm.typeList))[i]); } } -#line 9424 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9345 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 496: -#line 3299 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 498: +#line 3269 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if ((yyvsp[-2].interm.type).arraySizes) { parseContext.profileRequires((yyvsp[-2].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); parseContext.profileRequires((yyvsp[-2].interm.type).loc, EEsProfile, 300, 0, "arrayed type"); - if (parseContext.profile == EEsProfile) + if (parseContext.isEsProfile()) parseContext.arraySizeRequiredCheck((yyvsp[-2].interm.type).loc, *(yyvsp[-2].interm.type).arraySizes); } @@ -9447,16 +9402,16 @@ yyreduce: (*(yyval.interm.typeList))[i].type->shallowCopy(type); } } -#line 9451 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9372 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 497: -#line 3321 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 499: +#line 3291 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if ((yyvsp[-2].interm.type).arraySizes) { parseContext.profileRequires((yyvsp[-2].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); parseContext.profileRequires((yyvsp[-2].interm.type).loc, EEsProfile, 300, 0, "arrayed type"); - if (parseContext.profile == EEsProfile) + if (parseContext.isEsProfile()) parseContext.arraySizeRequiredCheck((yyvsp[-2].interm.type).loc, *(yyvsp[-2].interm.type).arraySizes); } @@ -9476,38 +9431,38 @@ yyreduce: (*(yyval.interm.typeList))[i].type->shallowCopy(type); } } -#line 9480 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9401 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 498: -#line 3348 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 500: +#line 3318 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.typeList) = new TTypeList; (yyval.interm.typeList)->push_back((yyvsp[0].interm.typeLine)); } -#line 9489 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9410 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 499: -#line 3352 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 501: +#line 3322 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.typeList)->push_back((yyvsp[0].interm.typeLine)); } -#line 9497 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9418 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 500: -#line 3358 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 502: +#line 3328 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.typeLine).type = new TType(EbtVoid); (yyval.interm.typeLine).loc = (yyvsp[0].lex).loc; (yyval.interm.typeLine).type->setFieldName(*(yyvsp[0].lex).string); } -#line 9507 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9428 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 501: -#line 3363 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 503: +#line 3333 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.arrayOfArrayVersionCheck((yyvsp[-1].lex).loc, (yyvsp[0].interm).arraySizes); @@ -9516,219 +9471,235 @@ yyreduce: (yyval.interm.typeLine).type->setFieldName(*(yyvsp[-1].lex).string); (yyval.interm.typeLine).type->transferArraySizes((yyvsp[0].interm).arraySizes); } -#line 9520 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9441 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 502: -#line 3374 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 504: +#line 3344 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 9528 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9449 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 503: -#line 3377 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 505: +#line 3348 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { const char* initFeature = "{ } style initializers"; parseContext.requireProfile((yyvsp[-2].lex).loc, ~EEsProfile, initFeature); parseContext.profileRequires((yyvsp[-2].lex).loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, initFeature); (yyval.interm.intermTypedNode) = (yyvsp[-1].interm.intermTypedNode); } -#line 9539 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9460 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 504: -#line 3383 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 506: +#line 3354 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { const char* initFeature = "{ } style initializers"; parseContext.requireProfile((yyvsp[-3].lex).loc, ~EEsProfile, initFeature); parseContext.profileRequires((yyvsp[-3].lex).loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, initFeature); (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 9550 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9471 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 505: -#line 3392 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 507: +#line 3365 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.intermediate.growAggregate(0, (yyvsp[0].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)->getLoc()); } -#line 9558 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9479 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 506: -#line 3395 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 508: +#line 3368 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.intermediate.growAggregate((yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); } -#line 9566 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 507: -#line 3401 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9572 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 508: -#line 3405 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9578 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9487 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 509: -#line 3406 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3375 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9584 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9493 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 510: -#line 3412 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3379 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9590 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9499 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 511: -#line 3413 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3380 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9596 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9505 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 512: -#line 3414 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3386 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9602 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9511 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 513: -#line 3415 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3387 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9608 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9517 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 514: -#line 3416 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3388 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9614 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9523 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 515: -#line 3417 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3389 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9620 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9529 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 516: -#line 3418 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3390 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9626 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9535 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 517: -#line 3422 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermNode) = 0; } -#line 9632 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 3391 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } +#line 9541 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 518: -#line 3423 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3392 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } +#line 9547 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 519: +#line 3394 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } +#line 9553 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 520: +#line 3400 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.requireStage((yyvsp[-1].lex).loc, EShLangFragment, "demote"); + parseContext.requireExtensions((yyvsp[-1].lex).loc, 1, &E_GL_EXT_demote_to_helper_invocation, "demote"); + (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpDemote, (yyvsp[-1].lex).loc); + } +#line 9563 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 521: +#line 3409 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermNode) = 0; } +#line 9569 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 522: +#line 3410 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.symbolTable.push(); ++parseContext.statementNestingLevel; } -#line 9641 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9578 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 519: -#line 3427 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 523: +#line 3414 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); --parseContext.statementNestingLevel; } -#line 9650 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9587 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 520: -#line 3431 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 524: +#line 3418 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if ((yyvsp[-2].interm.intermNode) && (yyvsp[-2].interm.intermNode)->getAsAggregate()) (yyvsp[-2].interm.intermNode)->getAsAggregate()->setOperator(EOpSequence); (yyval.interm.intermNode) = (yyvsp[-2].interm.intermNode); } -#line 9660 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9597 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 521: -#line 3439 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 525: +#line 3426 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9666 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9603 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 522: -#line 3440 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 526: +#line 3427 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9672 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9609 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 523: -#line 3444 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 527: +#line 3431 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { ++parseContext.controlFlowNestingLevel; } -#line 9680 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9617 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 524: -#line 3447 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 528: +#line 3434 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { --parseContext.controlFlowNestingLevel; (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9689 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9626 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 525: -#line 3451 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 529: +#line 3438 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.symbolTable.push(); ++parseContext.statementNestingLevel; ++parseContext.controlFlowNestingLevel; } -#line 9699 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9636 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 526: -#line 3456 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 530: +#line 3443 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9710 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9647 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 527: -#line 3465 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 531: +#line 3452 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = 0; } -#line 9718 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9655 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 528: -#line 3468 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 532: +#line 3455 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if ((yyvsp[-1].interm.intermNode) && (yyvsp[-1].interm.intermNode)->getAsAggregate()) (yyvsp[-1].interm.intermNode)->getAsAggregate()->setOperator(EOpSequence); (yyval.interm.intermNode) = (yyvsp[-1].interm.intermNode); } -#line 9728 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9665 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 529: -#line 3476 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 533: +#line 3463 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = parseContext.intermediate.makeAggregate((yyvsp[0].interm.intermNode)); if ((yyvsp[0].interm.intermNode) && (yyvsp[0].interm.intermNode)->getAsBranchNode() && ((yyvsp[0].interm.intermNode)->getAsBranchNode()->getFlowOp() == EOpCase || @@ -9737,11 +9708,11 @@ yyreduce: (yyval.interm.intermNode) = 0; // start a fresh subsequence for what's after this case } } -#line 9741 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9678 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 530: -#line 3484 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 534: +#line 3471 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if ((yyvsp[0].interm.intermNode) && (yyvsp[0].interm.intermNode)->getAsBranchNode() && ((yyvsp[0].interm.intermNode)->getAsBranchNode()->getFlowOp() == EOpCase || (yyvsp[0].interm.intermNode)->getAsBranchNode()->getFlowOp() == EOpDefault)) { @@ -9750,76 +9721,76 @@ yyreduce: } else (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[-1].interm.intermNode), (yyvsp[0].interm.intermNode)); } -#line 9754 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9691 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 531: -#line 3495 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 535: +#line 3482 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = 0; } -#line 9760 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9697 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 532: -#line 3496 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 536: +#line 3483 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[-1].interm.intermTypedNode)); } -#line 9766 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9703 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 533: -#line 3500 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 537: +#line 3487 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9774 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9711 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 534: -#line 3503 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 538: +#line 3491 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.handleSelectionAttributes(*(yyvsp[-1].interm.attributes), (yyvsp[0].interm.intermNode)); (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9783 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9720 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 535: -#line 3509 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 539: +#line 3498 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.boolCheck((yyvsp[-4].lex).loc, (yyvsp[-2].interm.intermTypedNode)); (yyval.interm.intermNode) = parseContext.intermediate.addSelection((yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.nodePair), (yyvsp[-4].lex).loc); } -#line 9792 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9729 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 536: -#line 3516 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 540: +#line 3505 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.nodePair).node1 = (yyvsp[-2].interm.intermNode); (yyval.interm.nodePair).node2 = (yyvsp[0].interm.intermNode); } -#line 9801 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9738 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 537: -#line 3520 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 541: +#line 3509 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.nodePair).node1 = (yyvsp[0].interm.intermNode); (yyval.interm.nodePair).node2 = 0; } -#line 9810 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9747 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 538: -#line 3528 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 542: +#line 3517 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); parseContext.boolCheck((yyvsp[0].interm.intermTypedNode)->getLoc(), (yyvsp[0].interm.intermTypedNode)); } -#line 9819 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9756 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 539: -#line 3532 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 543: +#line 3521 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.boolCheck((yyvsp[-2].lex).loc, (yyvsp[-3].interm.type)); @@ -9830,28 +9801,28 @@ yyreduce: else (yyval.interm.intermTypedNode) = 0; } -#line 9834 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9771 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 540: -#line 3545 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 544: +#line 3534 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9842 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9779 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 541: -#line 3548 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 545: +#line 3538 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.handleSwitchAttributes(*(yyvsp[-1].interm.attributes), (yyvsp[0].interm.intermNode)); (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9851 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9788 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 542: -#line 3554 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 546: +#line 3545 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // start new switch sequence on the switch stack ++parseContext.controlFlowNestingLevel; @@ -9860,11 +9831,11 @@ yyreduce: parseContext.switchLevel.push_back(parseContext.statementNestingLevel); parseContext.symbolTable.push(); } -#line 9864 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9801 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 543: -#line 3562 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 547: +#line 3553 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = parseContext.addSwitch((yyvsp[-7].lex).loc, (yyvsp[-5].interm.intermTypedNode), (yyvsp[-1].interm.intermNode) ? (yyvsp[-1].interm.intermNode)->getAsAggregate() : 0); delete parseContext.switchSequenceStack.back(); @@ -9874,27 +9845,27 @@ yyreduce: --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; } -#line 9878 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9815 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 544: -#line 3574 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 548: +#line 3565 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = 0; } -#line 9886 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9823 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 545: -#line 3577 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 549: +#line 3568 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9894 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9831 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 546: -#line 3583 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 550: +#line 3574 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = 0; if (parseContext.switchLevel.size() == 0) @@ -9907,11 +9878,11 @@ yyreduce: (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpCase, (yyvsp[-1].interm.intermTypedNode), (yyvsp[-2].lex).loc); } } -#line 9911 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9848 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 547: -#line 3595 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 551: +#line 3586 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = 0; if (parseContext.switchLevel.size() == 0) @@ -9921,28 +9892,28 @@ yyreduce: else (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpDefault, (yyvsp[-1].lex).loc); } -#line 9925 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9862 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 548: -#line 3607 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 552: +#line 3598 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9933 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9870 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 549: -#line 3610 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 553: +#line 3602 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.handleLoopAttributes(*(yyvsp[-1].interm.attributes), (yyvsp[0].interm.intermNode)); (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9942 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9879 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 550: -#line 3616 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 554: +#line 3609 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if (! parseContext.limits.whileLoops) parseContext.error((yyvsp[-1].lex).loc, "while loops not available", "limitation", ""); @@ -9951,11 +9922,11 @@ yyreduce: ++parseContext.statementNestingLevel; ++parseContext.controlFlowNestingLevel; } -#line 9955 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9892 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 551: -#line 3624 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 555: +#line 3617 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); (yyval.interm.intermNode) = parseContext.intermediate.addLoop((yyvsp[0].interm.intermNode), (yyvsp[-2].interm.intermTypedNode), 0, true, (yyvsp[-5].lex).loc); @@ -9963,21 +9934,21 @@ yyreduce: --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; } -#line 9967 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9904 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 552: -#line 3631 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 556: +#line 3624 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { ++parseContext.loopNestingLevel; ++parseContext.statementNestingLevel; ++parseContext.controlFlowNestingLevel; } -#line 9977 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9914 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 553: -#line 3636 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 557: +#line 3629 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if (! parseContext.limits.whileLoops) parseContext.error((yyvsp[-7].lex).loc, "do-while loops not available", "limitation", ""); @@ -9989,22 +9960,22 @@ yyreduce: --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; } -#line 9993 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9930 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 554: -#line 3647 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 558: +#line 3640 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.symbolTable.push(); ++parseContext.loopNestingLevel; ++parseContext.statementNestingLevel; ++parseContext.controlFlowNestingLevel; } -#line 10004 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9941 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 555: -#line 3653 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 559: +#line 3646 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); (yyval.interm.intermNode) = parseContext.intermediate.makeAggregate((yyvsp[-3].interm.intermNode), (yyvsp[-5].lex).loc); @@ -10017,81 +9988,81 @@ yyreduce: --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; } -#line 10021 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9958 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 556: -#line 3668 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 560: +#line 3661 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 10029 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9966 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 557: -#line 3671 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 561: +#line 3664 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 10037 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9974 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 558: -#line 3677 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 562: +#line 3670 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 10045 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9982 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 559: -#line 3680 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 563: +#line 3673 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = 0; } -#line 10053 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9990 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 560: -#line 3686 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 564: +#line 3679 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.nodePair).node1 = (yyvsp[-1].interm.intermTypedNode); (yyval.interm.nodePair).node2 = 0; } -#line 10062 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9999 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 561: -#line 3690 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 565: +#line 3683 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.nodePair).node1 = (yyvsp[-2].interm.intermTypedNode); (yyval.interm.nodePair).node2 = (yyvsp[0].interm.intermTypedNode); } -#line 10071 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10008 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 562: -#line 3697 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 566: +#line 3690 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if (parseContext.loopNestingLevel <= 0) parseContext.error((yyvsp[-1].lex).loc, "continue statement only allowed in loops", "", ""); (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpContinue, (yyvsp[-1].lex).loc); } -#line 10081 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10018 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 563: -#line 3702 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 567: +#line 3695 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if (parseContext.loopNestingLevel + parseContext.switchSequenceStack.size() <= 0) parseContext.error((yyvsp[-1].lex).loc, "break statement only allowed in switch and loops", "", ""); (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpBreak, (yyvsp[-1].lex).loc); } -#line 10091 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10028 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 564: -#line 3707 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 568: +#line 3700 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpReturn, (yyvsp[-1].lex).loc); if (parseContext.currentFunctionType->getBasicType() != EbtVoid) @@ -10099,83 +10070,83 @@ yyreduce: if (parseContext.inMain) parseContext.postEntryPointReturn = true; } -#line 10103 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10040 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 565: -#line 3714 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 569: +#line 3707 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = parseContext.handleReturnValue((yyvsp[-2].lex).loc, (yyvsp[-1].interm.intermTypedNode)); } -#line 10111 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10048 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 566: -#line 3717 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 570: +#line 3710 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.requireStage((yyvsp[-1].lex).loc, EShLangFragment, "discard"); (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpKill, (yyvsp[-1].lex).loc); } -#line 10120 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10057 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 567: -#line 3726 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 571: +#line 3719 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); parseContext.intermediate.setTreeRoot((yyval.interm.intermNode)); } -#line 10129 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10066 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 568: -#line 3730 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 572: +#line 3723 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if ((yyvsp[0].interm.intermNode) != nullptr) { (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[-1].interm.intermNode), (yyvsp[0].interm.intermNode)); parseContext.intermediate.setTreeRoot((yyval.interm.intermNode)); } } -#line 10140 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10077 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 569: -#line 3739 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 573: +#line 3732 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 10148 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10085 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 570: -#line 3742 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 574: +#line 3735 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 10156 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10093 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 571: -#line 3745 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 575: +#line 3739 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.requireProfile((yyvsp[0].lex).loc, ~EEsProfile, "extraneous semicolon"); parseContext.profileRequires((yyvsp[0].lex).loc, ~EEsProfile, 460, nullptr, "extraneous semicolon"); (yyval.interm.intermNode) = nullptr; } -#line 10166 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10103 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 572: -#line 3753 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 576: +#line 3748 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyvsp[0].interm).function = parseContext.handleFunctionDeclarator((yyvsp[0].interm).loc, *(yyvsp[0].interm).function, false /* not prototype */); (yyvsp[0].interm).intermNode = parseContext.handleFunctionDefinition((yyvsp[0].interm).loc, *(yyvsp[0].interm).function); } -#line 10175 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10112 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 573: -#line 3757 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 577: +#line 3752 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // May be best done as post process phase on intermediate code if (parseContext.currentFunctionType->getBasicType() != EbtVoid && ! parseContext.functionReturnsValue) @@ -10191,52 +10162,52 @@ yyreduce: (yyval.interm.intermNode)->getAsAggregate()->setDebug(parseContext.contextPragma.debug); (yyval.interm.intermNode)->getAsAggregate()->setPragmaTable(parseContext.contextPragma.pragmaTable); } -#line 10195 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10132 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 574: -#line 3775 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 578: +#line 3771 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.attributes) = (yyvsp[-2].interm.attributes); parseContext.requireExtensions((yyvsp[-4].lex).loc, 1, &E_GL_EXT_control_flow_attributes, "attribute"); } -#line 10204 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10141 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 575: -#line 3781 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 579: +#line 3777 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.attributes) = (yyvsp[0].interm.attributes); } -#line 10212 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10149 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 576: -#line 3784 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 580: +#line 3780 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.attributes) = parseContext.mergeAttributes((yyvsp[-2].interm.attributes), (yyvsp[0].interm.attributes)); } -#line 10220 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10157 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 577: -#line 3789 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 581: +#line 3785 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.attributes) = parseContext.makeAttributes(*(yyvsp[0].lex).string); } -#line 10228 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10165 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 578: -#line 3792 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 582: +#line 3788 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.attributes) = parseContext.makeAttributes(*(yyvsp[-3].lex).string, (yyvsp[-1].interm.intermTypedNode)); } -#line 10236 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10173 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; -#line 10240 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10177 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -10464,5 +10435,5 @@ yyreturn: #endif return yyresult; } -#line 3796 "MachineIndependent/glslang.y" /* yacc.c:1906 */ +#line 3793 "MachineIndependent/glslang.y" /* yacc.c:1906 */ diff --git a/thirdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp.h b/thirdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp.h index a467db644b..f4f4114730 100644 --- a/thirdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp.h +++ b/thirdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp.h @@ -45,271 +45,271 @@ extern int yydebug; # define YYTOKENTYPE enum yytokentype { - ATTRIBUTE = 258, - VARYING = 259, - FLOAT16_T = 260, - FLOAT = 261, - FLOAT32_T = 262, - DOUBLE = 263, - FLOAT64_T = 264, - CONST = 265, - BOOL = 266, - INT = 267, - UINT = 268, - INT64_T = 269, - UINT64_T = 270, - INT32_T = 271, - UINT32_T = 272, - INT16_T = 273, - UINT16_T = 274, - INT8_T = 275, - UINT8_T = 276, - BREAK = 277, - CONTINUE = 278, - DO = 279, - ELSE = 280, - FOR = 281, - IF = 282, - DISCARD = 283, - RETURN = 284, - SWITCH = 285, - CASE = 286, - DEFAULT = 287, - SUBROUTINE = 288, - BVEC2 = 289, - BVEC3 = 290, - BVEC4 = 291, - IVEC2 = 292, - IVEC3 = 293, - IVEC4 = 294, - UVEC2 = 295, - UVEC3 = 296, - UVEC4 = 297, - I64VEC2 = 298, - I64VEC3 = 299, - I64VEC4 = 300, - U64VEC2 = 301, - U64VEC3 = 302, - U64VEC4 = 303, - I32VEC2 = 304, - I32VEC3 = 305, - I32VEC4 = 306, - U32VEC2 = 307, - U32VEC3 = 308, - U32VEC4 = 309, - I16VEC2 = 310, - I16VEC3 = 311, - I16VEC4 = 312, - U16VEC2 = 313, - U16VEC3 = 314, - U16VEC4 = 315, - I8VEC2 = 316, - I8VEC3 = 317, - I8VEC4 = 318, - U8VEC2 = 319, - U8VEC3 = 320, - U8VEC4 = 321, - VEC2 = 322, - VEC3 = 323, - VEC4 = 324, - MAT2 = 325, - MAT3 = 326, - MAT4 = 327, - CENTROID = 328, - IN = 329, - OUT = 330, - INOUT = 331, - UNIFORM = 332, - PATCH = 333, - SAMPLE = 334, - BUFFER = 335, - SHARED = 336, - NONUNIFORM = 337, - PAYLOADNV = 338, - PAYLOADINNV = 339, - HITATTRNV = 340, - CALLDATANV = 341, - CALLDATAINNV = 342, - COHERENT = 343, - VOLATILE = 344, - RESTRICT = 345, - READONLY = 346, - WRITEONLY = 347, - DEVICECOHERENT = 348, - QUEUEFAMILYCOHERENT = 349, - WORKGROUPCOHERENT = 350, - SUBGROUPCOHERENT = 351, - NONPRIVATE = 352, - DVEC2 = 353, - DVEC3 = 354, - DVEC4 = 355, - DMAT2 = 356, - DMAT3 = 357, - DMAT4 = 358, - F16VEC2 = 359, - F16VEC3 = 360, - F16VEC4 = 361, - F16MAT2 = 362, - F16MAT3 = 363, - F16MAT4 = 364, - F32VEC2 = 365, - F32VEC3 = 366, - F32VEC4 = 367, - F32MAT2 = 368, - F32MAT3 = 369, - F32MAT4 = 370, - F64VEC2 = 371, - F64VEC3 = 372, - F64VEC4 = 373, - F64MAT2 = 374, - F64MAT3 = 375, - F64MAT4 = 376, - NOPERSPECTIVE = 377, - FLAT = 378, - SMOOTH = 379, - LAYOUT = 380, - EXPLICITINTERPAMD = 381, - PERVERTEXNV = 382, - PERPRIMITIVENV = 383, - PERVIEWNV = 384, - PERTASKNV = 385, - MAT2X2 = 386, - MAT2X3 = 387, - MAT2X4 = 388, - MAT3X2 = 389, - MAT3X3 = 390, - MAT3X4 = 391, - MAT4X2 = 392, - MAT4X3 = 393, - MAT4X4 = 394, - DMAT2X2 = 395, - DMAT2X3 = 396, - DMAT2X4 = 397, - DMAT3X2 = 398, - DMAT3X3 = 399, - DMAT3X4 = 400, - DMAT4X2 = 401, - DMAT4X3 = 402, - DMAT4X4 = 403, - F16MAT2X2 = 404, - F16MAT2X3 = 405, - F16MAT2X4 = 406, - F16MAT3X2 = 407, - F16MAT3X3 = 408, - F16MAT3X4 = 409, - F16MAT4X2 = 410, - F16MAT4X3 = 411, - F16MAT4X4 = 412, - F32MAT2X2 = 413, - F32MAT2X3 = 414, - F32MAT2X4 = 415, - F32MAT3X2 = 416, - F32MAT3X3 = 417, - F32MAT3X4 = 418, - F32MAT4X2 = 419, - F32MAT4X3 = 420, - F32MAT4X4 = 421, - F64MAT2X2 = 422, - F64MAT2X3 = 423, - F64MAT2X4 = 424, - F64MAT3X2 = 425, - F64MAT3X3 = 426, - F64MAT3X4 = 427, - F64MAT4X2 = 428, - F64MAT4X3 = 429, - F64MAT4X4 = 430, - ATOMIC_UINT = 431, - ACCSTRUCTNV = 432, - FCOOPMATNV = 433, - SAMPLER1D = 434, - SAMPLER2D = 435, - SAMPLER3D = 436, - SAMPLERCUBE = 437, - SAMPLER1DSHADOW = 438, - SAMPLER2DSHADOW = 439, - SAMPLERCUBESHADOW = 440, - SAMPLER1DARRAY = 441, - SAMPLER2DARRAY = 442, - SAMPLER1DARRAYSHADOW = 443, - SAMPLER2DARRAYSHADOW = 444, - ISAMPLER1D = 445, - ISAMPLER2D = 446, - ISAMPLER3D = 447, - ISAMPLERCUBE = 448, - ISAMPLER1DARRAY = 449, - ISAMPLER2DARRAY = 450, - USAMPLER1D = 451, - USAMPLER2D = 452, - USAMPLER3D = 453, - USAMPLERCUBE = 454, - USAMPLER1DARRAY = 455, - USAMPLER2DARRAY = 456, - SAMPLER2DRECT = 457, - SAMPLER2DRECTSHADOW = 458, - ISAMPLER2DRECT = 459, - USAMPLER2DRECT = 460, - SAMPLERBUFFER = 461, - ISAMPLERBUFFER = 462, - USAMPLERBUFFER = 463, - SAMPLERCUBEARRAY = 464, - SAMPLERCUBEARRAYSHADOW = 465, - ISAMPLERCUBEARRAY = 466, - USAMPLERCUBEARRAY = 467, - SAMPLER2DMS = 468, - ISAMPLER2DMS = 469, - USAMPLER2DMS = 470, - SAMPLER2DMSARRAY = 471, - ISAMPLER2DMSARRAY = 472, - USAMPLER2DMSARRAY = 473, - SAMPLEREXTERNALOES = 474, - SAMPLEREXTERNAL2DY2YEXT = 475, - F16SAMPLER1D = 476, - F16SAMPLER2D = 477, - F16SAMPLER3D = 478, - F16SAMPLER2DRECT = 479, - F16SAMPLERCUBE = 480, - F16SAMPLER1DARRAY = 481, - F16SAMPLER2DARRAY = 482, - F16SAMPLERCUBEARRAY = 483, - F16SAMPLERBUFFER = 484, - F16SAMPLER2DMS = 485, - F16SAMPLER2DMSARRAY = 486, - F16SAMPLER1DSHADOW = 487, - F16SAMPLER2DSHADOW = 488, - F16SAMPLER1DARRAYSHADOW = 489, - F16SAMPLER2DARRAYSHADOW = 490, - F16SAMPLER2DRECTSHADOW = 491, - F16SAMPLERCUBESHADOW = 492, - F16SAMPLERCUBEARRAYSHADOW = 493, - SAMPLER = 494, - SAMPLERSHADOW = 495, - TEXTURE1D = 496, - TEXTURE2D = 497, - TEXTURE3D = 498, - TEXTURECUBE = 499, - TEXTURE1DARRAY = 500, - TEXTURE2DARRAY = 501, - ITEXTURE1D = 502, - ITEXTURE2D = 503, - ITEXTURE3D = 504, - ITEXTURECUBE = 505, - ITEXTURE1DARRAY = 506, - ITEXTURE2DARRAY = 507, - UTEXTURE1D = 508, - UTEXTURE2D = 509, - UTEXTURE3D = 510, - UTEXTURECUBE = 511, - UTEXTURE1DARRAY = 512, - UTEXTURE2DARRAY = 513, - TEXTURE2DRECT = 514, - ITEXTURE2DRECT = 515, - UTEXTURE2DRECT = 516, - TEXTUREBUFFER = 517, - ITEXTUREBUFFER = 518, - UTEXTUREBUFFER = 519, - TEXTURECUBEARRAY = 520, - ITEXTURECUBEARRAY = 521, - UTEXTURECUBEARRAY = 522, + CONST = 258, + BOOL = 259, + INT = 260, + UINT = 261, + FLOAT = 262, + BVEC2 = 263, + BVEC3 = 264, + BVEC4 = 265, + IVEC2 = 266, + IVEC3 = 267, + IVEC4 = 268, + UVEC2 = 269, + UVEC3 = 270, + UVEC4 = 271, + VEC2 = 272, + VEC3 = 273, + VEC4 = 274, + MAT2 = 275, + MAT3 = 276, + MAT4 = 277, + MAT2X2 = 278, + MAT2X3 = 279, + MAT2X4 = 280, + MAT3X2 = 281, + MAT3X3 = 282, + MAT3X4 = 283, + MAT4X2 = 284, + MAT4X3 = 285, + MAT4X4 = 286, + SAMPLER2D = 287, + SAMPLER3D = 288, + SAMPLERCUBE = 289, + SAMPLER2DSHADOW = 290, + SAMPLERCUBESHADOW = 291, + SAMPLER2DARRAY = 292, + SAMPLER2DARRAYSHADOW = 293, + ISAMPLER2D = 294, + ISAMPLER3D = 295, + ISAMPLERCUBE = 296, + ISAMPLER2DARRAY = 297, + USAMPLER2D = 298, + USAMPLER3D = 299, + USAMPLERCUBE = 300, + USAMPLER2DARRAY = 301, + SAMPLER = 302, + SAMPLERSHADOW = 303, + TEXTURE2D = 304, + TEXTURE3D = 305, + TEXTURECUBE = 306, + TEXTURE2DARRAY = 307, + ITEXTURE2D = 308, + ITEXTURE3D = 309, + ITEXTURECUBE = 310, + ITEXTURE2DARRAY = 311, + UTEXTURE2D = 312, + UTEXTURE3D = 313, + UTEXTURECUBE = 314, + UTEXTURE2DARRAY = 315, + ATTRIBUTE = 316, + VARYING = 317, + FLOAT16_T = 318, + FLOAT32_T = 319, + DOUBLE = 320, + FLOAT64_T = 321, + INT64_T = 322, + UINT64_T = 323, + INT32_T = 324, + UINT32_T = 325, + INT16_T = 326, + UINT16_T = 327, + INT8_T = 328, + UINT8_T = 329, + I64VEC2 = 330, + I64VEC3 = 331, + I64VEC4 = 332, + U64VEC2 = 333, + U64VEC3 = 334, + U64VEC4 = 335, + I32VEC2 = 336, + I32VEC3 = 337, + I32VEC4 = 338, + U32VEC2 = 339, + U32VEC3 = 340, + U32VEC4 = 341, + I16VEC2 = 342, + I16VEC3 = 343, + I16VEC4 = 344, + U16VEC2 = 345, + U16VEC3 = 346, + U16VEC4 = 347, + I8VEC2 = 348, + I8VEC3 = 349, + I8VEC4 = 350, + U8VEC2 = 351, + U8VEC3 = 352, + U8VEC4 = 353, + DVEC2 = 354, + DVEC3 = 355, + DVEC4 = 356, + DMAT2 = 357, + DMAT3 = 358, + DMAT4 = 359, + F16VEC2 = 360, + F16VEC3 = 361, + F16VEC4 = 362, + F16MAT2 = 363, + F16MAT3 = 364, + F16MAT4 = 365, + F32VEC2 = 366, + F32VEC3 = 367, + F32VEC4 = 368, + F32MAT2 = 369, + F32MAT3 = 370, + F32MAT4 = 371, + F64VEC2 = 372, + F64VEC3 = 373, + F64VEC4 = 374, + F64MAT2 = 375, + F64MAT3 = 376, + F64MAT4 = 377, + DMAT2X2 = 378, + DMAT2X3 = 379, + DMAT2X4 = 380, + DMAT3X2 = 381, + DMAT3X3 = 382, + DMAT3X4 = 383, + DMAT4X2 = 384, + DMAT4X3 = 385, + DMAT4X4 = 386, + F16MAT2X2 = 387, + F16MAT2X3 = 388, + F16MAT2X4 = 389, + F16MAT3X2 = 390, + F16MAT3X3 = 391, + F16MAT3X4 = 392, + F16MAT4X2 = 393, + F16MAT4X3 = 394, + F16MAT4X4 = 395, + F32MAT2X2 = 396, + F32MAT2X3 = 397, + F32MAT2X4 = 398, + F32MAT3X2 = 399, + F32MAT3X3 = 400, + F32MAT3X4 = 401, + F32MAT4X2 = 402, + F32MAT4X3 = 403, + F32MAT4X4 = 404, + F64MAT2X2 = 405, + F64MAT2X3 = 406, + F64MAT2X4 = 407, + F64MAT3X2 = 408, + F64MAT3X3 = 409, + F64MAT3X4 = 410, + F64MAT4X2 = 411, + F64MAT4X3 = 412, + F64MAT4X4 = 413, + ATOMIC_UINT = 414, + ACCSTRUCTNV = 415, + FCOOPMATNV = 416, + ICOOPMATNV = 417, + UCOOPMATNV = 418, + SAMPLERCUBEARRAY = 419, + SAMPLERCUBEARRAYSHADOW = 420, + ISAMPLERCUBEARRAY = 421, + USAMPLERCUBEARRAY = 422, + SAMPLER1D = 423, + SAMPLER1DARRAY = 424, + SAMPLER1DARRAYSHADOW = 425, + ISAMPLER1D = 426, + SAMPLER1DSHADOW = 427, + SAMPLER2DRECT = 428, + SAMPLER2DRECTSHADOW = 429, + ISAMPLER2DRECT = 430, + USAMPLER2DRECT = 431, + SAMPLERBUFFER = 432, + ISAMPLERBUFFER = 433, + USAMPLERBUFFER = 434, + SAMPLER2DMS = 435, + ISAMPLER2DMS = 436, + USAMPLER2DMS = 437, + SAMPLER2DMSARRAY = 438, + ISAMPLER2DMSARRAY = 439, + USAMPLER2DMSARRAY = 440, + SAMPLEREXTERNALOES = 441, + SAMPLEREXTERNAL2DY2YEXT = 442, + ISAMPLER1DARRAY = 443, + USAMPLER1D = 444, + USAMPLER1DARRAY = 445, + F16SAMPLER1D = 446, + F16SAMPLER2D = 447, + F16SAMPLER3D = 448, + F16SAMPLER2DRECT = 449, + F16SAMPLERCUBE = 450, + F16SAMPLER1DARRAY = 451, + F16SAMPLER2DARRAY = 452, + F16SAMPLERCUBEARRAY = 453, + F16SAMPLERBUFFER = 454, + F16SAMPLER2DMS = 455, + F16SAMPLER2DMSARRAY = 456, + F16SAMPLER1DSHADOW = 457, + F16SAMPLER2DSHADOW = 458, + F16SAMPLER1DARRAYSHADOW = 459, + F16SAMPLER2DARRAYSHADOW = 460, + F16SAMPLER2DRECTSHADOW = 461, + F16SAMPLERCUBESHADOW = 462, + F16SAMPLERCUBEARRAYSHADOW = 463, + IMAGE1D = 464, + IIMAGE1D = 465, + UIMAGE1D = 466, + IMAGE2D = 467, + IIMAGE2D = 468, + UIMAGE2D = 469, + IMAGE3D = 470, + IIMAGE3D = 471, + UIMAGE3D = 472, + IMAGE2DRECT = 473, + IIMAGE2DRECT = 474, + UIMAGE2DRECT = 475, + IMAGECUBE = 476, + IIMAGECUBE = 477, + UIMAGECUBE = 478, + IMAGEBUFFER = 479, + IIMAGEBUFFER = 480, + UIMAGEBUFFER = 481, + IMAGE1DARRAY = 482, + IIMAGE1DARRAY = 483, + UIMAGE1DARRAY = 484, + IMAGE2DARRAY = 485, + IIMAGE2DARRAY = 486, + UIMAGE2DARRAY = 487, + IMAGECUBEARRAY = 488, + IIMAGECUBEARRAY = 489, + UIMAGECUBEARRAY = 490, + IMAGE2DMS = 491, + IIMAGE2DMS = 492, + UIMAGE2DMS = 493, + IMAGE2DMSARRAY = 494, + IIMAGE2DMSARRAY = 495, + UIMAGE2DMSARRAY = 496, + F16IMAGE1D = 497, + F16IMAGE2D = 498, + F16IMAGE3D = 499, + F16IMAGE2DRECT = 500, + F16IMAGECUBE = 501, + F16IMAGE1DARRAY = 502, + F16IMAGE2DARRAY = 503, + F16IMAGECUBEARRAY = 504, + F16IMAGEBUFFER = 505, + F16IMAGE2DMS = 506, + F16IMAGE2DMSARRAY = 507, + TEXTURECUBEARRAY = 508, + ITEXTURECUBEARRAY = 509, + UTEXTURECUBEARRAY = 510, + TEXTURE1D = 511, + ITEXTURE1D = 512, + UTEXTURE1D = 513, + TEXTURE1DARRAY = 514, + ITEXTURE1DARRAY = 515, + UTEXTURE1DARRAY = 516, + TEXTURE2DRECT = 517, + ITEXTURE2DRECT = 518, + UTEXTURE2DRECT = 519, + TEXTUREBUFFER = 520, + ITEXTUREBUFFER = 521, + UTEXTUREBUFFER = 522, TEXTURE2DMS = 523, ITEXTURE2DMS = 524, UTEXTURE2DMS = 525, @@ -335,121 +335,124 @@ extern int yydebug; USUBPASSINPUTMS = 545, F16SUBPASSINPUT = 546, F16SUBPASSINPUTMS = 547, - IMAGE1D = 548, - IIMAGE1D = 549, - UIMAGE1D = 550, - IMAGE2D = 551, - IIMAGE2D = 552, - UIMAGE2D = 553, - IMAGE3D = 554, - IIMAGE3D = 555, - UIMAGE3D = 556, - IMAGE2DRECT = 557, - IIMAGE2DRECT = 558, - UIMAGE2DRECT = 559, - IMAGECUBE = 560, - IIMAGECUBE = 561, - UIMAGECUBE = 562, - IMAGEBUFFER = 563, - IIMAGEBUFFER = 564, - UIMAGEBUFFER = 565, - IMAGE1DARRAY = 566, - IIMAGE1DARRAY = 567, - UIMAGE1DARRAY = 568, - IMAGE2DARRAY = 569, - IIMAGE2DARRAY = 570, - UIMAGE2DARRAY = 571, - IMAGECUBEARRAY = 572, - IIMAGECUBEARRAY = 573, - UIMAGECUBEARRAY = 574, - IMAGE2DMS = 575, - IIMAGE2DMS = 576, - UIMAGE2DMS = 577, - IMAGE2DMSARRAY = 578, - IIMAGE2DMSARRAY = 579, - UIMAGE2DMSARRAY = 580, - F16IMAGE1D = 581, - F16IMAGE2D = 582, - F16IMAGE3D = 583, - F16IMAGE2DRECT = 584, - F16IMAGECUBE = 585, - F16IMAGE1DARRAY = 586, - F16IMAGE2DARRAY = 587, - F16IMAGECUBEARRAY = 588, - F16IMAGEBUFFER = 589, - F16IMAGE2DMS = 590, - F16IMAGE2DMSARRAY = 591, - STRUCT = 592, - VOID = 593, - WHILE = 594, - IDENTIFIER = 595, - TYPE_NAME = 596, - FLOATCONSTANT = 597, - DOUBLECONSTANT = 598, - INT16CONSTANT = 599, - UINT16CONSTANT = 600, - INT32CONSTANT = 601, - UINT32CONSTANT = 602, - INTCONSTANT = 603, - UINTCONSTANT = 604, - INT64CONSTANT = 605, - UINT64CONSTANT = 606, - BOOLCONSTANT = 607, - FLOAT16CONSTANT = 608, - LEFT_OP = 609, - RIGHT_OP = 610, - INC_OP = 611, - DEC_OP = 612, - LE_OP = 613, - GE_OP = 614, - EQ_OP = 615, - NE_OP = 616, - AND_OP = 617, - OR_OP = 618, - XOR_OP = 619, - MUL_ASSIGN = 620, - DIV_ASSIGN = 621, - ADD_ASSIGN = 622, - MOD_ASSIGN = 623, - LEFT_ASSIGN = 624, - RIGHT_ASSIGN = 625, - AND_ASSIGN = 626, - XOR_ASSIGN = 627, - OR_ASSIGN = 628, - SUB_ASSIGN = 629, - LEFT_PAREN = 630, - RIGHT_PAREN = 631, - LEFT_BRACKET = 632, - RIGHT_BRACKET = 633, - LEFT_BRACE = 634, - RIGHT_BRACE = 635, - DOT = 636, - COMMA = 637, - COLON = 638, - EQUAL = 639, - SEMICOLON = 640, - BANG = 641, - DASH = 642, - TILDE = 643, - PLUS = 644, - STAR = 645, - SLASH = 646, - PERCENT = 647, - LEFT_ANGLE = 648, - RIGHT_ANGLE = 649, - VERTICAL_BAR = 650, - CARET = 651, - AMPERSAND = 652, - QUESTION = 653, - INVARIANT = 654, - PRECISE = 655, - HIGH_PRECISION = 656, - MEDIUM_PRECISION = 657, - LOW_PRECISION = 658, - PRECISION = 659, - PACKED = 660, - RESOURCE = 661, - SUPERP = 662 + LEFT_OP = 548, + RIGHT_OP = 549, + INC_OP = 550, + DEC_OP = 551, + LE_OP = 552, + GE_OP = 553, + EQ_OP = 554, + NE_OP = 555, + AND_OP = 556, + OR_OP = 557, + XOR_OP = 558, + MUL_ASSIGN = 559, + DIV_ASSIGN = 560, + ADD_ASSIGN = 561, + MOD_ASSIGN = 562, + LEFT_ASSIGN = 563, + RIGHT_ASSIGN = 564, + AND_ASSIGN = 565, + XOR_ASSIGN = 566, + OR_ASSIGN = 567, + SUB_ASSIGN = 568, + LEFT_PAREN = 569, + RIGHT_PAREN = 570, + LEFT_BRACKET = 571, + RIGHT_BRACKET = 572, + LEFT_BRACE = 573, + RIGHT_BRACE = 574, + DOT = 575, + COMMA = 576, + COLON = 577, + EQUAL = 578, + SEMICOLON = 579, + BANG = 580, + DASH = 581, + TILDE = 582, + PLUS = 583, + STAR = 584, + SLASH = 585, + PERCENT = 586, + LEFT_ANGLE = 587, + RIGHT_ANGLE = 588, + VERTICAL_BAR = 589, + CARET = 590, + AMPERSAND = 591, + QUESTION = 592, + INVARIANT = 593, + HIGH_PRECISION = 594, + MEDIUM_PRECISION = 595, + LOW_PRECISION = 596, + PRECISION = 597, + PACKED = 598, + RESOURCE = 599, + SUPERP = 600, + FLOATCONSTANT = 601, + INTCONSTANT = 602, + UINTCONSTANT = 603, + BOOLCONSTANT = 604, + IDENTIFIER = 605, + TYPE_NAME = 606, + CENTROID = 607, + IN = 608, + OUT = 609, + INOUT = 610, + STRUCT = 611, + VOID = 612, + WHILE = 613, + BREAK = 614, + CONTINUE = 615, + DO = 616, + ELSE = 617, + FOR = 618, + IF = 619, + DISCARD = 620, + RETURN = 621, + SWITCH = 622, + CASE = 623, + DEFAULT = 624, + UNIFORM = 625, + SHARED = 626, + BUFFER = 627, + FLAT = 628, + SMOOTH = 629, + LAYOUT = 630, + DOUBLECONSTANT = 631, + INT16CONSTANT = 632, + UINT16CONSTANT = 633, + FLOAT16CONSTANT = 634, + INT32CONSTANT = 635, + UINT32CONSTANT = 636, + INT64CONSTANT = 637, + UINT64CONSTANT = 638, + SUBROUTINE = 639, + DEMOTE = 640, + PAYLOADNV = 641, + PAYLOADINNV = 642, + HITATTRNV = 643, + CALLDATANV = 644, + CALLDATAINNV = 645, + PATCH = 646, + SAMPLE = 647, + NONUNIFORM = 648, + COHERENT = 649, + VOLATILE = 650, + RESTRICT = 651, + READONLY = 652, + WRITEONLY = 653, + DEVICECOHERENT = 654, + QUEUEFAMILYCOHERENT = 655, + WORKGROUPCOHERENT = 656, + SUBGROUPCOHERENT = 657, + NONPRIVATE = 658, + NOPERSPECTIVE = 659, + EXPLICITINTERPAMD = 660, + PERVERTEXNV = 661, + PERPRIMITIVENV = 662, + PERVIEWNV = 663, + PERTASKNV = 664, + PRECISE = 665 }; #endif @@ -458,7 +461,7 @@ extern int yydebug; union YYSTYPE { -#line 71 "MachineIndependent/glslang.y" /* yacc.c:1909 */ +#line 96 "MachineIndependent/glslang.y" /* yacc.c:1909 */ struct { glslang::TSourceLoc loc; @@ -494,7 +497,7 @@ union YYSTYPE glslang::TArraySizes* typeParameters; } interm; -#line 498 "MachineIndependent/glslang_tab.cpp.h" /* yacc.c:1909 */ +#line 501 "MachineIndependent/glslang_tab.cpp.h" /* yacc.c:1909 */ }; typedef union YYSTYPE YYSTYPE; diff --git a/thirdparty/glslang/glslang/MachineIndependent/intermOut.cpp b/thirdparty/glslang/glslang/MachineIndependent/intermOut.cpp index 5e2eed16ed..3a93aedafb 100644 --- a/thirdparty/glslang/glslang/MachineIndependent/intermOut.cpp +++ b/thirdparty/glslang/glslang/MachineIndependent/intermOut.cpp @@ -35,6 +35,8 @@ // POSSIBILITY OF SUCH DAMAGE. // +#ifndef GLSLANG_WEB + #include "localintermediate.h" #include "../Include/InfoSink.h" @@ -174,7 +176,7 @@ bool TOutputTraverser::visitBinary(TVisit /* visit */, TIntermBinary* node) case EOpIndexIndirect: out.debug << "indirect index"; break; case EOpIndexDirectStruct: { - bool reference = node->getLeft()->getType().getBasicType() == EbtReference; + bool reference = node->getLeft()->getType().isReference(); const TTypeList *members = reference ? node->getLeft()->getType().getReferentType()->getStruct() : node->getLeft()->getType().getStruct(); out.debug << (*members)[node->getRight()->getAsConstantUnion()->getConstArray()[0].getIConst()].type->getFieldName(); out.debug << ": direct index for structure"; break; @@ -211,6 +213,13 @@ bool TOutputTraverser::visitBinary(TVisit /* visit */, TIntermBinary* node) case EOpLogicalXor: out.debug << "logical-xor"; break; case EOpLogicalAnd: out.debug << "logical-and"; break; + case EOpAbsDifference: out.debug << "absoluteDifference"; break; + case EOpAddSaturate: out.debug << "addSaturate"; break; + case EOpSubSaturate: out.debug << "subtractSaturate"; break; + case EOpAverage: out.debug << "average"; break; + case EOpAverageRounded: out.debug << "averageRounded"; break; + case EOpMul32x16: out.debug << "multiply32x16"; break; + default: out.debug << "<unknown op>"; } @@ -555,6 +564,9 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node) case EOpFindLSB: out.debug << "findLSB"; break; case EOpFindMSB: out.debug << "findMSB"; break; + case EOpCountLeadingZeros: out.debug << "countLeadingZeros"; break; + case EOpCountTrailingZeros: out.debug << "countTrailingZeros"; break; + case EOpNoise: out.debug << "noise"; break; case EOpBallot: out.debug << "ballot"; break; @@ -615,7 +627,6 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node) case EOpSubgroupQuadSwapVertical: out.debug << "subgroupQuadSwapVertical"; break; case EOpSubgroupQuadSwapDiagonal: out.debug << "subgroupQuadSwapDiagonal"; break; -#ifdef NV_EXTENSIONS case EOpSubgroupPartition: out.debug << "subgroupPartitionNV"; break; case EOpSubgroupPartitionedAdd: out.debug << "subgroupPartitionedAddNV"; break; case EOpSubgroupPartitionedMul: out.debug << "subgroupPartitionedMulNV"; break; @@ -638,7 +649,6 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node) case EOpSubgroupPartitionedExclusiveAnd: out.debug << "subgroupPartitionedExclusiveAndNV"; break; case EOpSubgroupPartitionedExclusiveOr: out.debug << "subgroupPartitionedExclusiveOrNV"; break; case EOpSubgroupPartitionedExclusiveXor: out.debug << "subgroupPartitionedExclusiveXorNV"; break; -#endif case EOpClip: out.debug << "clip"; break; case EOpIsFinite: out.debug << "isfinite"; break; @@ -648,7 +658,6 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node) case EOpSparseTexelsResident: out.debug << "sparseTexelsResident"; break; -#ifdef AMD_EXTENSIONS case EOpMinInvocations: out.debug << "minInvocations"; break; case EOpMaxInvocations: out.debug << "maxInvocations"; break; case EOpAddInvocations: out.debug << "addInvocations"; break; @@ -677,7 +686,6 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node) case EOpCubeFaceIndex: out.debug << "cubeFaceIndex"; break; case EOpCubeFaceCoord: out.debug << "cubeFaceCoord"; break; -#endif case EOpSubpassLoad: out.debug << "subpassLoad"; break; case EOpSubpassLoadMS: out.debug << "subpassLoadMS"; break; @@ -863,7 +871,6 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node case EOpReadInvocation: out.debug << "readInvocation"; break; -#ifdef AMD_EXTENSIONS case EOpSwizzleInvocations: out.debug << "swizzleInvocations"; break; case EOpSwizzleInvocationsMasked: out.debug << "swizzleInvocationsMasked"; break; case EOpWriteInvocation: out.debug << "writeInvocation"; break; @@ -871,9 +878,7 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node case EOpMin3: out.debug << "min3"; break; case EOpMax3: out.debug << "max3"; break; case EOpMid3: out.debug << "mid3"; break; - case EOpTime: out.debug << "time"; break; -#endif case EOpAtomicAdd: out.debug << "AtomicAdd"; break; case EOpAtomicMin: out.debug << "AtomicMin"; break; @@ -910,10 +915,8 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node case EOpImageAtomicCompSwap: out.debug << "imageAtomicCompSwap"; break; case EOpImageAtomicLoad: out.debug << "imageAtomicLoad"; break; case EOpImageAtomicStore: out.debug << "imageAtomicStore"; break; -#ifdef AMD_EXTENSIONS case EOpImageLoadLod: out.debug << "imageLoadLod"; break; case EOpImageStoreLod: out.debug << "imageStoreLod"; break; -#endif case EOpTextureQuerySize: out.debug << "textureSize"; break; case EOpTextureQueryLod: out.debug << "textureQueryLod"; break; @@ -940,11 +943,9 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node case EOpTextureOffsetClamp: out.debug << "textureOffsetClamp"; break; case EOpTextureGradClamp: out.debug << "textureGradClamp"; break; case EOpTextureGradOffsetClamp: out.debug << "textureGradOffsetClamp"; break; -#ifdef AMD_EXTENSIONS case EOpTextureGatherLod: out.debug << "textureGatherLod"; break; case EOpTextureGatherLodOffset: out.debug << "textureGatherLodOffset"; break; case EOpTextureGatherLodOffsets: out.debug << "textureGatherLodOffsets"; break; -#endif case EOpSparseTexture: out.debug << "sparseTexture"; break; case EOpSparseTextureOffset: out.debug << "sparseTextureOffset"; break; @@ -962,19 +963,15 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node case EOpSparseTextureOffsetClamp: out.debug << "sparseTextureOffsetClamp"; break; case EOpSparseTextureGradClamp: out.debug << "sparseTextureGradClamp"; break; case EOpSparseTextureGradOffsetClamp: out.debug << "sparseTextureGradOffsetClam"; break; -#ifdef AMD_EXTENSIONS case EOpSparseTextureGatherLod: out.debug << "sparseTextureGatherLod"; break; case EOpSparseTextureGatherLodOffset: out.debug << "sparseTextureGatherLodOffset"; break; case EOpSparseTextureGatherLodOffsets: out.debug << "sparseTextureGatherLodOffsets"; break; case EOpSparseImageLoadLod: out.debug << "sparseImageLoadLod"; break; -#endif -#ifdef NV_EXTENSIONS case EOpImageSampleFootprintNV: out.debug << "imageSampleFootprintNV"; break; case EOpImageSampleFootprintClampNV: out.debug << "imageSampleFootprintClampNV"; break; case EOpImageSampleFootprintLodNV: out.debug << "imageSampleFootprintLodNV"; break; case EOpImageSampleFootprintGradNV: out.debug << "imageSampleFootprintGradNV"; break; case EOpImageSampleFootprintGradClampNV: out.debug << "mageSampleFootprintGradClampNV"; break; -#endif case EOpAddCarry: out.debug << "addCarry"; break; case EOpSubBorrow: out.debug << "subBorrow"; break; case EOpUMulExtended: out.debug << "uMulExtended"; break; @@ -988,9 +985,7 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node case EOpInterpolateAtSample: out.debug << "interpolateAtSample"; break; case EOpInterpolateAtOffset: out.debug << "interpolateAtOffset"; break; -#ifdef AMD_EXTENSIONS case EOpInterpolateAtVertex: out.debug << "interpolateAtVertex"; break; -#endif case EOpSinCos: out.debug << "sincos"; break; case EOpGenMul: out.debug << "mul"; break; @@ -1057,22 +1052,45 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node case EOpSubgroupQuadSwapVertical: out.debug << "subgroupQuadSwapVertical"; break; case EOpSubgroupQuadSwapDiagonal: out.debug << "subgroupQuadSwapDiagonal"; break; + case EOpSubgroupPartition: out.debug << "subgroupPartitionNV"; break; + case EOpSubgroupPartitionedAdd: out.debug << "subgroupPartitionedAddNV"; break; + case EOpSubgroupPartitionedMul: out.debug << "subgroupPartitionedMulNV"; break; + case EOpSubgroupPartitionedMin: out.debug << "subgroupPartitionedMinNV"; break; + case EOpSubgroupPartitionedMax: out.debug << "subgroupPartitionedMaxNV"; break; + case EOpSubgroupPartitionedAnd: out.debug << "subgroupPartitionedAndNV"; break; + case EOpSubgroupPartitionedOr: out.debug << "subgroupPartitionedOrNV"; break; + case EOpSubgroupPartitionedXor: out.debug << "subgroupPartitionedXorNV"; break; + case EOpSubgroupPartitionedInclusiveAdd: out.debug << "subgroupPartitionedInclusiveAddNV"; break; + case EOpSubgroupPartitionedInclusiveMul: out.debug << "subgroupPartitionedInclusiveMulNV"; break; + case EOpSubgroupPartitionedInclusiveMin: out.debug << "subgroupPartitionedInclusiveMinNV"; break; + case EOpSubgroupPartitionedInclusiveMax: out.debug << "subgroupPartitionedInclusiveMaxNV"; break; + case EOpSubgroupPartitionedInclusiveAnd: out.debug << "subgroupPartitionedInclusiveAndNV"; break; + case EOpSubgroupPartitionedInclusiveOr: out.debug << "subgroupPartitionedInclusiveOrNV"; break; + case EOpSubgroupPartitionedInclusiveXor: out.debug << "subgroupPartitionedInclusiveXorNV"; break; + case EOpSubgroupPartitionedExclusiveAdd: out.debug << "subgroupPartitionedExclusiveAddNV"; break; + case EOpSubgroupPartitionedExclusiveMul: out.debug << "subgroupPartitionedExclusiveMulNV"; break; + case EOpSubgroupPartitionedExclusiveMin: out.debug << "subgroupPartitionedExclusiveMinNV"; break; + case EOpSubgroupPartitionedExclusiveMax: out.debug << "subgroupPartitionedExclusiveMaxNV"; break; + case EOpSubgroupPartitionedExclusiveAnd: out.debug << "subgroupPartitionedExclusiveAndNV"; break; + case EOpSubgroupPartitionedExclusiveOr: out.debug << "subgroupPartitionedExclusiveOrNV"; break; + case EOpSubgroupPartitionedExclusiveXor: out.debug << "subgroupPartitionedExclusiveXorNV"; break; + case EOpSubpassLoad: out.debug << "subpassLoad"; break; case EOpSubpassLoadMS: out.debug << "subpassLoadMS"; break; -#ifdef NV_EXTENSIONS case EOpTraceNV: out.debug << "traceNV"; break; case EOpReportIntersectionNV: out.debug << "reportIntersectionNV"; break; case EOpIgnoreIntersectionNV: out.debug << "ignoreIntersectionNV"; break; case EOpTerminateRayNV: out.debug << "terminateRayNV"; break; case EOpExecuteCallableNV: out.debug << "executeCallableNV"; break; case EOpWritePackedPrimitiveIndices4x8NV: out.debug << "writePackedPrimitiveIndices4x8NV"; break; -#endif case EOpCooperativeMatrixLoad: out.debug << "Load cooperative matrix"; break; case EOpCooperativeMatrixStore: out.debug << "Store cooperative matrix"; break; case EOpCooperativeMatrixMulAdd: out.debug << "MulAdd cooperative matrices"; break; + case EOpIsHelperInvocation: out.debug << "IsHelperInvocation"; break; + default: out.debug.message(EPrefixError, "Bad aggregation op"); } @@ -1367,6 +1385,7 @@ bool TOutputTraverser::visitBranch(TVisit /* visit*/, TIntermBranch* node) case EOpContinue: out.debug << "Branch: Continue"; break; case EOpReturn: out.debug << "Branch: Return"; break; case EOpCase: out.debug << "case: "; break; + case EOpDemote: out.debug << "Demote"; break; case EOpDefault: out.debug << "default: "; break; default: out.debug << "Branch: Unknown Branch"; break; } @@ -1477,18 +1496,17 @@ void TIntermediate::output(TInfoSink& infoSink, bool tree) } infoSink.debug << "\n"; } + if (interlockOrdering != EioNone) + infoSink.debug << "interlock ordering = " << TQualifier::getInterlockOrderingString(interlockOrdering) << "\n"; break; -#ifdef NV_EXTENSIONS case EShLangMeshNV: infoSink.debug << "max_vertices = " << vertices << "\n"; infoSink.debug << "max_primitives = " << primitives << "\n"; infoSink.debug << "output primitive = " << TQualifier::getGeometryString(outputPrimitive) << "\n"; // Fall through - case EShLangTaskNV: // Fall through -#endif case EShLangCompute: infoSink.debug << "local_size = (" << localSize[0] << ", " << localSize[1] << ", " << localSize[2] << ")\n"; { @@ -1517,3 +1535,5 @@ void TIntermediate::output(TInfoSink& infoSink, bool tree) } } // end namespace glslang + +#endif // not GLSLANG_WEB
\ No newline at end of file diff --git a/thirdparty/glslang/glslang/MachineIndependent/iomapper.cpp b/thirdparty/glslang/glslang/MachineIndependent/iomapper.cpp index 46c7558378..3262c0a203 100644 --- a/thirdparty/glslang/glslang/MachineIndependent/iomapper.cpp +++ b/thirdparty/glslang/glslang/MachineIndependent/iomapper.cpp @@ -33,16 +33,13 @@ // POSSIBILITY OF SUCH DAMAGE. // +#ifndef GLSLANG_WEB + #include "../Include/Common.h" #include "../Include/InfoSink.h" -#include "iomapper.h" -#include "LiveTraverser.h" -#include "localintermediate.h" #include "gl_types.h" - -#include <unordered_set> -#include <unordered_map> +#include "iomapper.h" // // Map IO bindings. @@ -61,60 +58,9 @@ // c. implicit dead bindings are left un-bound. // - namespace glslang { -struct TVarEntryInfo -{ - int id; - TIntermSymbol* symbol; - bool live; - int newBinding; - int newSet; - int newLocation; - int newComponent; - int newIndex; - - struct TOrderById - { - inline bool operator()(const TVarEntryInfo& l, const TVarEntryInfo& r) - { - return l.id < r.id; - } - }; - - struct TOrderByPriority - { - // ordering: - // 1) has both binding and set - // 2) has binding but no set - // 3) has no binding but set - // 4) has no binding and no set - inline bool operator()(const TVarEntryInfo& l, const TVarEntryInfo& r) - { - const TQualifier& lq = l.symbol->getQualifier(); - const TQualifier& rq = r.symbol->getQualifier(); - - // simple rules: - // has binding gives 2 points - // has set gives 1 point - // who has the most points is more important. - int lPoints = (lq.hasBinding() ? 2 : 0) + (lq.hasSet() ? 1 : 0); - int rPoints = (rq.hasBinding() ? 2 : 0) + (rq.hasSet() ? 1 : 0); - - if (lPoints == rPoints) - return l.id < r.id; - return lPoints > rPoints; - } - }; -}; - - - -typedef std::vector<TVarEntryInfo> TVarLiveMap; - -class TVarGatherTraverser : public TLiveTraverser -{ +class TVarGatherTraverser : public TLiveTraverser { public: TVarGatherTraverser(const TIntermediate& i, bool traverseDeadCode, TVarLiveMap& inList, TVarLiveMap& outList, TVarLiveMap& uniformList) : TLiveTraverser(i, traverseDeadCode, true, true, false) @@ -124,7 +70,6 @@ public: { } - virtual void visitSymbol(TIntermSymbol* base) { TVarLiveMap* target = nullptr; @@ -132,16 +77,17 @@ public: target = &inputList; else if (base->getQualifier().storage == EvqVaryingOut) target = &outputList; - else if (base->getQualifier().isUniformOrBuffer() && !base->getQualifier().layoutPushConstant) + else if (base->getQualifier().isUniformOrBuffer() && !base->getQualifier().isPushConstant()) target = &uniformList; - if (target) { - TVarEntryInfo ent = { base->getId(), base, !traverseAll }; - TVarLiveMap::iterator at = std::lower_bound(target->begin(), target->end(), ent, TVarEntryInfo::TOrderById()); - if (at != target->end() && at->id == ent.id) - at->live = at->live || !traverseAll; // update live state + TVarEntryInfo ent = {base->getId(), base, ! traverseAll}; + ent.stage = intermediate.getStage(); + TVarLiveMap::iterator at = target->find( + ent.symbol->getName()); // std::lower_bound(target->begin(), target->end(), ent, TVarEntryInfo::TOrderById()); + if (at != target->end() && at->second.id == ent.id) + at->second.live = at->second.live || ! traverseAll; // update live state else - target->insert(at, ent); + (*target)[ent.symbol->getName()] = ent; } } @@ -162,9 +108,7 @@ public: { } - - virtual void visitSymbol(TIntermSymbol* base) - { + virtual void visitSymbol(TIntermSymbol* base) { const TVarLiveMap* source; if (base->getQualifier().storage == EvqVaryingIn) source = &inputList; @@ -176,23 +120,23 @@ public: return; TVarEntryInfo ent = { base->getId() }; - TVarLiveMap::const_iterator at = std::lower_bound(source->begin(), source->end(), ent, TVarEntryInfo::TOrderById()); + TVarLiveMap::const_iterator at = source->find(base->getName()); if (at == source->end()) return; - if (at->id != ent.id) + if (at->second.id != ent.id) return; - if (at->newBinding != -1) - base->getWritableType().getQualifier().layoutBinding = at->newBinding; - if (at->newSet != -1) - base->getWritableType().getQualifier().layoutSet = at->newSet; - if (at->newLocation != -1) - base->getWritableType().getQualifier().layoutLocation = at->newLocation; - if (at->newComponent != -1) - base->getWritableType().getQualifier().layoutComponent = at->newComponent; - if (at->newIndex != -1) - base->getWritableType().getQualifier().layoutIndex = at->newIndex; + if (at->second.newBinding != -1) + base->getWritableType().getQualifier().layoutBinding = at->second.newBinding; + if (at->second.newSet != -1) + base->getWritableType().getQualifier().layoutSet = at->second.newSet; + if (at->second.newLocation != -1) + base->getWritableType().getQualifier().layoutLocation = at->second.newLocation; + if (at->second.newComponent != -1) + base->getWritableType().getQualifier().layoutComponent = at->second.newComponent; + if (at->second.newIndex != -1) + base->getWritableType().getQualifier().layoutIndex = at->second.newIndex; } private: @@ -210,10 +154,12 @@ struct TNotifyUniformAdaptor , resolver(r) { } - inline void operator()(TVarEntryInfo& ent) + + inline void operator()(std::pair<const TString, TVarEntryInfo>& entKey) { - resolver.notifyBinding(stage, ent.symbol->getName().c_str(), ent.symbol->getType(), ent.live); + resolver.notifyBinding(stage, entKey.second); } + private: TNotifyUniformAdaptor& operator=(TNotifyUniformAdaptor&); }; @@ -222,49 +168,46 @@ struct TNotifyInOutAdaptor { EShLanguage stage; TIoMapResolver& resolver; - inline TNotifyInOutAdaptor(EShLanguage s, TIoMapResolver& r) + inline TNotifyInOutAdaptor(EShLanguage s, TIoMapResolver& r) : stage(s) , resolver(r) { } - inline void operator()(TVarEntryInfo& ent) + + inline void operator()(std::pair<const TString, TVarEntryInfo>& entKey) { - resolver.notifyInOut(stage, ent.symbol->getName().c_str(), ent.symbol->getType(), ent.live); + resolver.notifyInOut(stage, entKey.second); } + private: TNotifyInOutAdaptor& operator=(TNotifyInOutAdaptor&); }; -struct TResolverUniformAdaptor -{ - TResolverUniformAdaptor(EShLanguage s, TIoMapResolver& r, TInfoSink& i, bool& e, TIntermediate& interm) +struct TResolverUniformAdaptor { + TResolverUniformAdaptor(EShLanguage s, TIoMapResolver& r, TInfoSink& i, bool& e) : stage(s) , resolver(r) , infoSink(i) , error(e) - , intermediate(interm) { } - inline void operator()(TVarEntryInfo& ent) - { + inline void operator()(std::pair<const TString, TVarEntryInfo>& entKey) { + TVarEntryInfo& ent = entKey.second; ent.newLocation = -1; ent.newComponent = -1; ent.newBinding = -1; ent.newSet = -1; ent.newIndex = -1; - const bool isValid = resolver.validateBinding(stage, ent.symbol->getName().c_str(), ent.symbol->getType(), - ent.live); + const bool isValid = resolver.validateBinding(stage, ent); if (isValid) { - ent.newBinding = resolver.resolveBinding(stage, ent.symbol->getName().c_str(), ent.symbol->getType(), - ent.live); - ent.newSet = resolver.resolveSet(stage, ent.symbol->getName().c_str(), ent.symbol->getType(), ent.live); - ent.newLocation = resolver.resolveUniformLocation(stage, ent.symbol->getName().c_str(), - ent.symbol->getType(), ent.live); + resolver.resolveBinding(stage, ent); + resolver.resolveSet(stage, ent); + resolver.resolveUniformLocation(stage, ent); if (ent.newBinding != -1) { if (ent.newBinding >= int(TQualifier::layoutBindingEnd)) { - TString err = "mapped binding out of range: " + ent.symbol->getName(); + TString err = "mapped binding out of range: " + entKey.first; infoSink.info.message(EPrefixInternalError, err.c_str()); error = true; @@ -272,64 +215,52 @@ struct TResolverUniformAdaptor } if (ent.newSet != -1) { if (ent.newSet >= int(TQualifier::layoutSetEnd)) { - TString err = "mapped set out of range: " + ent.symbol->getName(); + TString err = "mapped set out of range: " + entKey.first; infoSink.info.message(EPrefixInternalError, err.c_str()); error = true; } } } else { - TString errorMsg = "Invalid binding: " + ent.symbol->getName(); + TString errorMsg = "Invalid binding: " + entKey.first; infoSink.info.message(EPrefixInternalError, errorMsg.c_str()); error = true; } } + inline void setStage(EShLanguage s) { stage = s; } + EShLanguage stage; TIoMapResolver& resolver; TInfoSink& infoSink; bool& error; - TIntermediate& intermediate; private: TResolverUniformAdaptor& operator=(TResolverUniformAdaptor&); }; -struct TResolverInOutAdaptor -{ - TResolverInOutAdaptor(EShLanguage s, TIoMapResolver& r, TInfoSink& i, bool& e, TIntermediate& interm) +struct TResolverInOutAdaptor { + TResolverInOutAdaptor(EShLanguage s, TIoMapResolver& r, TInfoSink& i, bool& e) : stage(s) , resolver(r) , infoSink(i) , error(e) - , intermediate(interm) { } - inline void operator()(TVarEntryInfo& ent) + inline void operator()(std::pair<const TString, TVarEntryInfo>& entKey) { + TVarEntryInfo& ent = entKey.second; ent.newLocation = -1; ent.newComponent = -1; ent.newBinding = -1; ent.newSet = -1; ent.newIndex = -1; - const bool isValid = resolver.validateInOut(stage, - ent.symbol->getName().c_str(), - ent.symbol->getType(), - ent.live); + const bool isValid = resolver.validateInOut(stage, ent); if (isValid) { - ent.newLocation = resolver.resolveInOutLocation(stage, - ent.symbol->getName().c_str(), - ent.symbol->getType(), - ent.live); - ent.newComponent = resolver.resolveInOutComponent(stage, - ent.symbol->getName().c_str(), - ent.symbol->getType(), - ent.live); - ent.newIndex = resolver.resolveInOutIndex(stage, - ent.symbol->getName().c_str(), - ent.symbol->getType(), - ent.live); + resolver.resolveInOutLocation(stage, ent); + resolver.resolveInOutComponent(stage, ent); + resolver.resolveInOutIndex(stage, ent); } else { TString errorMsg; if (ent.symbol->getType().getQualifier().semanticName != nullptr) { @@ -344,218 +275,621 @@ struct TResolverInOutAdaptor } } + inline void setStage(EShLanguage s) { stage = s; } + EShLanguage stage; TIoMapResolver& resolver; TInfoSink& infoSink; bool& error; - TIntermediate& intermediate; private: TResolverInOutAdaptor& operator=(TResolverInOutAdaptor&); }; -// Base class for shared TIoMapResolver services, used by several derivations. -struct TDefaultIoResolverBase : public glslang::TIoMapResolver -{ - TDefaultIoResolverBase(const TIntermediate &intermediate) : - intermediate(intermediate), - nextUniformLocation(intermediate.getUniformLocationBase()), - nextInputLocation(0), - nextOutputLocation(0) - { } +// The class is used for reserving explicit uniform locations and ubo/ssbo/opaque bindings - int getBaseBinding(TResourceType res, unsigned int set) const { - return selectBaseBinding(intermediate.getShiftBinding(res), - intermediate.getShiftBindingForSet(res, set)); +struct TSymbolValidater +{ + TSymbolValidater(TIoMapResolver& r, TInfoSink& i, TVarLiveMap* in[EShLangCount], TVarLiveMap* out[EShLangCount], + TVarLiveMap* uniform[EShLangCount], bool& hadError) + : preStage(EShLangCount) + , currentStage(EShLangCount) + , nextStage(EShLangCount) + , resolver(r) + , infoSink(i) + , hadError(hadError) + { + memcpy(inVarMaps, in, EShLangCount * (sizeof(TVarLiveMap*))); + memcpy(outVarMaps, out, EShLangCount * (sizeof(TVarLiveMap*))); + memcpy(uniformVarMap, uniform, EShLangCount * (sizeof(TVarLiveMap*))); } - const std::vector<std::string>& getResourceSetBinding() const { return intermediate.getResourceSetBinding(); } - - bool doAutoBindingMapping() const { return intermediate.getAutoMapBindings(); } - bool doAutoLocationMapping() const { return intermediate.getAutoMapLocations(); } + inline void operator()(std::pair<const TString, TVarEntryInfo>& entKey) { + TVarEntryInfo& ent1 = entKey.second; + TIntermSymbol* base = ent1.symbol; + const TType& type = ent1.symbol->getType(); + const TString& name = entKey.first; + TString mangleName1, mangleName2; + type.appendMangledName(mangleName1); + EShLanguage stage = ent1.stage; + if (currentStage != stage) { + preStage = currentStage; + currentStage = stage; + nextStage = EShLangCount; + for (int i = currentStage + 1; i < EShLangCount; i++) { + if (inVarMaps[i] != nullptr) + nextStage = static_cast<EShLanguage>(i); + } + } + if (base->getQualifier().storage == EvqVaryingIn) { + // validate stage in; + if (preStage == EShLangCount) + return; + if (outVarMaps[preStage] != nullptr) { + auto ent2 = outVarMaps[preStage]->find(name); + if (ent2 != outVarMaps[preStage]->end()) { + ent2->second.symbol->getType().appendMangledName(mangleName2); + if (mangleName1 == mangleName2) + return; + else { + TString err = "Invalid In/Out variable type : " + entKey.first; + infoSink.info.message(EPrefixInternalError, err.c_str()); + hadError = true; + } + } + return; + } + } else if (base->getQualifier().storage == EvqVaryingOut) { + // validate stage out; + if (nextStage == EShLangCount) + return; + if (outVarMaps[nextStage] != nullptr) { + auto ent2 = inVarMaps[nextStage]->find(name); + if (ent2 != inVarMaps[nextStage]->end()) { + ent2->second.symbol->getType().appendMangledName(mangleName2); + if (mangleName1 == mangleName2) + return; + else { + TString err = "Invalid In/Out variable type : " + entKey.first; + infoSink.info.message(EPrefixInternalError, err.c_str()); + hadError = true; + } + } + return; + } + } else if (base->getQualifier().isUniformOrBuffer() && ! base->getQualifier().isPushConstant()) { + // validate uniform type; + for (int i = 0; i < EShLangCount; i++) { + if (i != currentStage && outVarMaps[i] != nullptr) { + auto ent2 = uniformVarMap[i]->find(name); + if (ent2 != uniformVarMap[i]->end()) { + ent2->second.symbol->getType().appendMangledName(mangleName2); + if (mangleName1 != mangleName2) { + TString err = "Invalid Uniform variable type : " + entKey.first; + infoSink.info.message(EPrefixInternalError, err.c_str()); + hadError = true; + } + mangleName2.clear(); + } + } + } + } + } + TVarLiveMap *inVarMaps[EShLangCount], *outVarMaps[EShLangCount], *uniformVarMap[EShLangCount]; + // Use for mark pre stage, to get more interface symbol information. + EShLanguage preStage, currentStage, nextStage; + // Use for mark current shader stage for resolver + TIoMapResolver& resolver; + TInfoSink& infoSink; + bool& hadError; - typedef std::vector<int> TSlotSet; - typedef std::unordered_map<int, TSlotSet> TSlotSetMap; - TSlotSetMap slots; +private: + TSymbolValidater& operator=(TSymbolValidater&); +}; - TSlotSet::iterator findSlot(int set, int slot) - { - return std::lower_bound(slots[set].begin(), slots[set].end(), slot); - } +struct TSlotCollector { + TSlotCollector(TIoMapResolver& r, TInfoSink& i) : resolver(r), infoSink(i) { } - bool checkEmpty(int set, int slot) - { - TSlotSet::iterator at = findSlot(set, slot); - return !(at != slots[set].end() && *at == slot); + inline void operator()(std::pair<const TString, TVarEntryInfo>& entKey) { + resolver.reserverStorageSlot(entKey.second, infoSink); + resolver.reserverResourceSlot(entKey.second, infoSink); } + TIoMapResolver& resolver; + TInfoSink& infoSink; - int reserveSlot(int set, int slot, int size = 1) - { - TSlotSet::iterator at = findSlot(set, slot); +private: + TSlotCollector& operator=(TSlotCollector&); +}; - // tolerate aliasing, by not double-recording aliases - // (policy about appropriateness of the alias is higher up) - for (int i = 0; i < size; i++) { - if (at == slots[set].end() || *at != slot + i) - at = slots[set].insert(at, slot + i); - ++at; - } +TDefaultIoResolverBase::TDefaultIoResolverBase(const TIntermediate& intermediate) + : intermediate(intermediate) + , nextUniformLocation(intermediate.getUniformLocationBase()) + , nextInputLocation(0) + , nextOutputLocation(0) +{ + memset(stageMask, false, sizeof(bool) * (EShLangCount + 1)); +} - return slot; - } +int TDefaultIoResolverBase::getBaseBinding(TResourceType res, unsigned int set) const { + return selectBaseBinding(intermediate.getShiftBinding(res), intermediate.getShiftBindingForSet(res, set)); +} - int getFreeSlot(int set, int base, int size = 1) - { - TSlotSet::iterator at = findSlot(set, base); - if (at == slots[set].end()) - return reserveSlot(set, base, size); +const std::vector<std::string>& TDefaultIoResolverBase::getResourceSetBinding() const { + return intermediate.getResourceSetBinding(); +} - // look for a big enough gap - for (; at != slots[set].end(); ++at) { - if (*at - base >= size) - break; - base = *at + 1; - } - return reserveSlot(set, base, size); - } +bool TDefaultIoResolverBase::doAutoBindingMapping() const { return intermediate.getAutoMapBindings(); } - virtual bool validateBinding(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool /*is_live*/) override = 0; +bool TDefaultIoResolverBase::doAutoLocationMapping() const { return intermediate.getAutoMapLocations(); } - virtual int resolveBinding(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool is_live) override = 0; +TDefaultIoResolverBase::TSlotSet::iterator TDefaultIoResolverBase::findSlot(int set, int slot) { + return std::lower_bound(slots[set].begin(), slots[set].end(), slot); +} - int resolveSet(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool /*is_live*/) override - { - if (type.getQualifier().hasSet()) - return type.getQualifier().layoutSet; +bool TDefaultIoResolverBase::checkEmpty(int set, int slot) { + TSlotSet::iterator at = findSlot(set, slot); + return ! (at != slots[set].end() && *at == slot); +} - // If a command line or API option requested a single descriptor set, use that (if not overrided by spaceN) - if (getResourceSetBinding().size() == 1) - return atoi(getResourceSetBinding()[0].c_str()); +int TDefaultIoResolverBase::reserveSlot(int set, int slot, int size) { + TSlotSet::iterator at = findSlot(set, slot); + // tolerate aliasing, by not double-recording aliases + // (policy about appropriateness of the alias is higher up) + for (int i = 0; i < size; i++) { + if (at == slots[set].end() || *at != slot + i) + at = slots[set].insert(at, slot + i); + ++at; + } + return slot; +} - return 0; +int TDefaultIoResolverBase::getFreeSlot(int set, int base, int size) { + TSlotSet::iterator at = findSlot(set, base); + if (at == slots[set].end()) + return reserveSlot(set, base, size); + // look for a big enough gap + for (; at != slots[set].end(); ++at) { + if (*at - base >= size) + break; + base = *at + 1; } - int resolveUniformLocation(EShLanguage /*stage*/, const char* name, const glslang::TType& type, bool /*is_live*/) override - { - // kick out of not doing this - if (!doAutoLocationMapping()) - return -1; + return reserveSlot(set, base, size); +} - // no locations added if already present, a built-in variable, a block, or an opaque - if (type.getQualifier().hasLocation() || type.isBuiltIn() || - type.getBasicType() == EbtBlock || - type.getBasicType() == EbtAtomicUint || - (type.containsOpaque() && intermediate.getSpv().openGl == 0)) - return -1; +int TDefaultIoResolverBase::resolveSet(EShLanguage /*stage*/, TVarEntryInfo& ent) { + const TType& type = ent.symbol->getType(); + if (type.getQualifier().hasSet()) { + return ent.newSet = type.getQualifier().layoutSet; + } + // If a command line or API option requested a single descriptor set, use that (if not overrided by spaceN) + if (getResourceSetBinding().size() == 1) { + return ent.newSet = atoi(getResourceSetBinding()[0].c_str()); + } + return ent.newSet = 0; +} - // no locations on blocks of built-in variables - if (type.isStruct()) { - if (type.getStruct()->size() < 1) - return -1; - if ((*type.getStruct())[0].type->isBuiltIn()) - return -1; +int TDefaultIoResolverBase::resolveUniformLocation(EShLanguage /*stage*/, TVarEntryInfo& ent) { + const TType& type = ent.symbol->getType(); + const char* name = ent.symbol->getName().c_str(); + // kick out of not doing this + if (! doAutoLocationMapping()) { + return ent.newLocation = -1; + } + // no locations added if already present, a built-in variable, a block, or an opaque + if (type.getQualifier().hasLocation() || type.isBuiltIn() || type.getBasicType() == EbtBlock || + type.isAtomic() || (type.containsOpaque() && intermediate.getSpv().openGl == 0)) { + return ent.newLocation = -1; + } + // no locations on blocks of built-in variables + if (type.isStruct()) { + if (type.getStruct()->size() < 1) { + return ent.newLocation = -1; } + if ((*type.getStruct())[0].type->isBuiltIn()) { + return ent.newLocation = -1; + } + } + int location = intermediate.getUniformLocationOverride(name); + if (location != -1) { + return ent.newLocation = location; + } + location = nextUniformLocation; + nextUniformLocation += TIntermediate::computeTypeUniformLocationSize(type); + return ent.newLocation = location; +} - int location = intermediate.getUniformLocationOverride(name); - if (location != -1) - return location; +int TDefaultIoResolverBase::resolveInOutLocation(EShLanguage stage, TVarEntryInfo& ent) { + const TType& type = ent.symbol->getType(); + // kick out of not doing this + if (! doAutoLocationMapping()) { + return ent.newLocation = -1; + } + + // no locations added if already present, or a built-in variable + if (type.getQualifier().hasLocation() || type.isBuiltIn()) { + return ent.newLocation = -1; + } + + // no locations on blocks of built-in variables + if (type.isStruct()) { + if (type.getStruct()->size() < 1) { + return ent.newLocation = -1; + } + if ((*type.getStruct())[0].type->isBuiltIn()) { + return ent.newLocation = -1; + } + } + // point to the right input or output location counter + int& nextLocation = type.getQualifier().isPipeInput() ? nextInputLocation : nextOutputLocation; + // Placeholder. This does not do proper cross-stage lining up, nor + // work with mixed location/no-location declarations. + int location = nextLocation; + int typeLocationSize; + // Don’t take into account the outer-most array if the stage’s + // interface is automatically an array. + typeLocationSize = computeTypeLocationSize(type, stage); + nextLocation += typeLocationSize; + return ent.newLocation = location; +} - location = nextUniformLocation; +int TDefaultIoResolverBase::resolveInOutComponent(EShLanguage /*stage*/, TVarEntryInfo& ent) { + return ent.newComponent = -1; +} - nextUniformLocation += TIntermediate::computeTypeUniformLocationSize(type); +int TDefaultIoResolverBase::resolveInOutIndex(EShLanguage /*stage*/, TVarEntryInfo& ent) { return ent.newIndex = -1; } + +uint32_t TDefaultIoResolverBase::computeTypeLocationSize(const TType& type, EShLanguage stage) { + int typeLocationSize; + // Don’t take into account the outer-most array if the stage’s + // interface is automatically an array. + if (type.getQualifier().isArrayedIo(stage)) { + TType elementType(type, 0); + typeLocationSize = TIntermediate::computeTypeLocationSize(elementType, stage); + } else { + typeLocationSize = TIntermediate::computeTypeLocationSize(type, stage); + } + return typeLocationSize; +} - return location; +//TDefaultGlslIoResolver +TResourceType TDefaultGlslIoResolver::getResourceType(const glslang::TType& type) { + if (isImageType(type)) { + return EResImage; } - bool validateInOut(EShLanguage /*stage*/, const char* /*name*/, const TType& /*type*/, bool /*is_live*/) override - { - return true; + if (isTextureType(type)) { + return EResTexture; } - int resolveInOutLocation(EShLanguage stage, const char* /*name*/, const TType& type, bool /*is_live*/) override - { - // kick out of not doing this - if (!doAutoLocationMapping()) - return -1; + if (isSsboType(type)) { + return EResSsbo; + } + if (isSamplerType(type)) { + return EResSampler; + } + if (isUboType(type)) { + return EResUbo; + } + return EResCount; +} - // no locations added if already present, or a built-in variable - if (type.getQualifier().hasLocation() || type.isBuiltIn()) - return -1; +TDefaultGlslIoResolver::TDefaultGlslIoResolver(const TIntermediate& intermediate) + : TDefaultIoResolverBase(intermediate) + , preStage(EShLangCount) + , currentStage(EShLangCount) +{ } + +int TDefaultGlslIoResolver::resolveInOutLocation(EShLanguage stage, TVarEntryInfo& ent) { + const TType& type = ent.symbol->getType(); + const TString& name = ent.symbol->getName(); + if (currentStage != stage) { + preStage = currentStage; + currentStage = stage; + } + // kick out of not doing this + if (! doAutoLocationMapping()) { + return ent.newLocation = -1; + } + // expand the location to each element if the symbol is a struct or array + if (type.getQualifier().hasLocation()) { + return ent.newLocation = type.getQualifier().layoutLocation; + } + // no locations added if already present, or a built-in variable + if (type.isBuiltIn()) { + return ent.newLocation = -1; + } + // no locations on blocks of built-in variables + if (type.isStruct()) { + if (type.getStruct()->size() < 1) { + return ent.newLocation = -1; + } + if ((*type.getStruct())[0].type->isBuiltIn()) { + return ent.newLocation = -1; + } + } + int typeLocationSize = computeTypeLocationSize(type, stage); + int location = type.getQualifier().layoutLocation; + bool hasLocation = false; + EShLanguage keyStage(EShLangCount); + TStorageQualifier storage; + storage = EvqInOut; + if (type.getQualifier().isPipeInput()) { + // If this symbol is a input, search pre stage's out + keyStage = preStage; + } + if (type.getQualifier().isPipeOutput()) { + // If this symbol is a output, search next stage's in + keyStage = currentStage; + } + // The in/out in current stage is not declared with location, but it is possible declared + // with explicit location in other stages, find the storageSlotMap firstly to check whether + // the in/out has location + int resourceKey = buildStorageKey(keyStage, storage); + if (! storageSlotMap[resourceKey].empty()) { + TVarSlotMap::iterator iter = storageSlotMap[resourceKey].find(name); + if (iter != storageSlotMap[resourceKey].end()) { + // If interface resource be found, set it has location and this symbol's new location + // equal the symbol's explicit location declarated in pre or next stage. + // + // vs: out vec4 a; + // fs: layout(..., location = 3,...) in vec4 a; + hasLocation = true; + location = iter->second; + // if we want deal like that: + // vs: layout(location=4) out vec4 a; + // out vec4 b; + // + // fs: in vec4 a; + // layout(location = 4) in vec4 b; + // we need retraverse the map. + } + if (! hasLocation) { + // If interface resource note found, It's mean the location in two stage are both implicit declarat. + // So we should find a new slot for this interface. + // + // vs: out vec4 a; + // fs: in vec4 a; + location = getFreeSlot(resourceKey, 0, typeLocationSize); + storageSlotMap[resourceKey][name] = location; + } + } else { + // the first interface declarated in a program. + TVarSlotMap varSlotMap; + location = getFreeSlot(resourceKey, 0, typeLocationSize); + varSlotMap[name] = location; + storageSlotMap[resourceKey] = varSlotMap; + } + //Update location + return ent.newLocation = location; +} +int TDefaultGlslIoResolver::resolveUniformLocation(EShLanguage /*stage*/, TVarEntryInfo& ent) { + const TType& type = ent.symbol->getType(); + const TString& name = ent.symbol->getName(); + // kick out of not doing this + if (! doAutoLocationMapping()) { + return ent.newLocation = -1; + } + // expand the location to each element if the symbol is a struct or array + if (type.getQualifier().hasLocation() && (type.isStruct() || type.isArray())) { + return ent.newLocation = type.getQualifier().layoutLocation; + } else { + // no locations added if already present, a built-in variable, a block, or an opaque + if (type.getQualifier().hasLocation() || type.isBuiltIn() || type.getBasicType() == EbtBlock || + type.isAtomic() || (type.containsOpaque() && intermediate.getSpv().openGl == 0)) { + return ent.newLocation = -1; + } // no locations on blocks of built-in variables if (type.isStruct()) { - if (type.getStruct()->size() < 1) - return -1; - if ((*type.getStruct())[0].type->isBuiltIn()) - return -1; - } - - // point to the right input or output location counter - int& nextLocation = type.getQualifier().isPipeInput() ? nextInputLocation : nextOutputLocation; - - // Placeholder. This does not do proper cross-stage lining up, nor - // work with mixed location/no-location declarations. - int location = nextLocation; - int typeLocationSize; - // Don’t take into account the outer-most array if the stage’s - // interface is automatically an array. - if (type.getQualifier().isArrayedIo(stage)) { - TType elementType(type, 0); - typeLocationSize = TIntermediate::computeTypeLocationSize(elementType, stage); - } else { - typeLocationSize = TIntermediate::computeTypeLocationSize(type, stage); + if (type.getStruct()->size() < 1) { + return ent.newLocation = -1; + } + if ((*type.getStruct())[0].type->isBuiltIn()) { + return ent.newLocation = -1; + } } - nextLocation += typeLocationSize; - - return location; } - int resolveInOutComponent(EShLanguage /*stage*/, const char* /*name*/, const TType& /*type*/, bool /*is_live*/) override - { - return -1; + int location = intermediate.getUniformLocationOverride(name.c_str()); + if (location != -1) { + return ent.newLocation = location; } - int resolveInOutIndex(EShLanguage /*stage*/, const char* /*name*/, const TType& /*type*/, bool /*is_live*/) override - { - return -1; + + int size = TIntermediate::computeTypeUniformLocationSize(type); + + // The uniform in current stage is not declared with location, but it is possible declared + // with explicit location in other stages, find the storageSlotMap firstly to check whether + // the uniform has location + bool hasLocation = false; + int resourceKey = buildStorageKey(EShLangCount, EvqUniform); + TVarSlotMap& slotMap = storageSlotMap[resourceKey]; + // Check dose shader program has uniform resource + if (! slotMap.empty()) { + // If uniform resource not empty, try find a same name uniform + TVarSlotMap::iterator iter = slotMap.find(name); + if (iter != slotMap.end()) { + // If uniform resource be found, set it has location and this symbol's new location + // equal the uniform's explicit location declarated in other stage. + // + // vs: uniform vec4 a; + // fs: layout(..., location = 3,...) uniform vec4 a; + hasLocation = true; + location = iter->second; + } + if (! hasLocation) { + // No explicit location declaraten in other stage. + // So we should find a new slot for this uniform. + // + // vs: uniform vec4 a; + // fs: uniform vec4 a; + location = getFreeSlot(resourceKey, 0, computeTypeLocationSize(type, currentStage)); + storageSlotMap[resourceKey][name] = location; + } + } else { + // the first uniform declarated in a program. + TVarSlotMap varSlotMap; + location = getFreeSlot(resourceKey, 0, size); + varSlotMap[name] = location; + storageSlotMap[resourceKey] = varSlotMap; } + return ent.newLocation = location; +} - void notifyBinding(EShLanguage, const char* /*name*/, const TType&, bool /*is_live*/) override {} - void notifyInOut(EShLanguage, const char* /*name*/, const TType&, bool /*is_live*/) override {} - void endNotifications(EShLanguage) override {} - void beginNotifications(EShLanguage) override {} - void beginResolve(EShLanguage) override {} - void endResolve(EShLanguage) override {} +int TDefaultGlslIoResolver::resolveBinding(EShLanguage /*stage*/, TVarEntryInfo& ent) { + const TType& type = ent.symbol->getType(); + const TString& name = ent.symbol->getName(); + // On OpenGL arrays of opaque types take a seperate binding for each element + int numBindings = intermediate.getSpv().openGl != 0 && type.isSizedArray() ? type.getCumulativeArraySize() : 1; + TResourceType resource = getResourceType(type); + // don't need to handle uniform symbol, it will be handled in resolveUniformLocation + if (resource == EResUbo && type.getBasicType() != EbtBlock) { + return ent.newBinding = -1; + } + // There is no 'set' qualifier in OpenGL shading language, each resource has its own + // binding name space, so remap the 'set' to resource type which make each resource + // binding is valid from 0 to MAX_XXRESOURCE_BINDINGS + int set = resource; + if (resource < EResCount) { + if (type.getQualifier().hasBinding()) { + ent.newBinding = reserveSlot(set, getBaseBinding(resource, set) + type.getQualifier().layoutBinding, numBindings); + return ent.newBinding; + } else if (ent.live && doAutoBindingMapping()) { + // The resource in current stage is not declared with binding, but it is possible declared + // with explicit binding in other stages, find the resourceSlotMap firstly to check whether + // the resource has binding, don't need to allocate if it already has a binding + bool hasBinding = false; + if (! resourceSlotMap[resource].empty()) { + TVarSlotMap::iterator iter = resourceSlotMap[resource].find(name); + if (iter != resourceSlotMap[resource].end()) { + hasBinding = true; + ent.newBinding = iter->second; + } + } + if (! hasBinding) { + TVarSlotMap varSlotMap; + // find free slot, the caller did make sure it passes all vars with binding + // first and now all are passed that do not have a binding and needs one + int binding = getFreeSlot(resource, getBaseBinding(resource, set), numBindings); + varSlotMap[name] = binding; + resourceSlotMap[resource] = varSlotMap; + ent.newBinding = binding; + } + return ent.newBinding; + } + } + return ent.newBinding = -1; +} -protected: - TDefaultIoResolverBase(TDefaultIoResolverBase&); - TDefaultIoResolverBase& operator=(TDefaultIoResolverBase&); +void TDefaultGlslIoResolver::beginResolve(EShLanguage stage) { + // reset stage state + if (stage == EShLangCount) + preStage = currentStage = stage; + // update stage state + else if (currentStage != stage) { + preStage = currentStage; + currentStage = stage; + } +} - const TIntermediate &intermediate; - int nextUniformLocation; - int nextInputLocation; - int nextOutputLocation; +void TDefaultGlslIoResolver::endResolve(EShLanguage /*stage*/) { + // TODO nothing +} - // Return descriptor set specific base if there is one, and the generic base otherwise. - int selectBaseBinding(int base, int descriptorSetBase) const { - return descriptorSetBase != -1 ? descriptorSetBase : base; +void TDefaultGlslIoResolver::beginCollect(EShLanguage stage) { + // reset stage state + if (stage == EShLangCount) + preStage = currentStage = stage; + // update stage state + else if (currentStage != stage) { + preStage = currentStage; + currentStage = stage; } +} - static int getLayoutSet(const glslang::TType& type) { - if (type.getQualifier().hasSet()) - return type.getQualifier().layoutSet; - else - return 0; - } +void TDefaultGlslIoResolver::endCollect(EShLanguage /*stage*/) { + // TODO nothing +} - static bool isSamplerType(const glslang::TType& type) { - return type.getBasicType() == glslang::EbtSampler && type.getSampler().isPureSampler(); +void TDefaultGlslIoResolver::reserverStorageSlot(TVarEntryInfo& ent, TInfoSink& infoSink) { + const TType& type = ent.symbol->getType(); + const TString& name = ent.symbol->getName(); + TStorageQualifier storage = type.getQualifier().storage; + EShLanguage stage(EShLangCount); + switch (storage) { + case EvqUniform: + if (type.getBasicType() != EbtBlock && type.getQualifier().hasLocation()) { + // + // Reserve the slots for the uniforms who has explicit location + int storageKey = buildStorageKey(EShLangCount, EvqUniform); + int location = type.getQualifier().layoutLocation; + TVarSlotMap& varSlotMap = storageSlotMap[storageKey]; + TVarSlotMap::iterator iter = varSlotMap.find(name); + if (iter == varSlotMap.end()) { + int numLocations = TIntermediate::computeTypeUniformLocationSize(type); + reserveSlot(storageKey, location, numLocations); + varSlotMap[name] = location; + } else { + // Allocate location by name for OpenGL driver, so the uniform in different + // stages should be declared with the same location + if (iter->second != location) { + TString errorMsg = "Invalid location: " + name; + infoSink.info.message(EPrefixInternalError, errorMsg.c_str()); + } + } + } + break; + case EvqVaryingIn: + case EvqVaryingOut: + // + // Reserve the slots for the inout who has explicit location + if (type.getQualifier().hasLocation()) { + stage = storage == EvqVaryingIn ? preStage : stage; + stage = storage == EvqVaryingOut ? currentStage : stage; + int storageKey = buildStorageKey(stage, EvqInOut); + int location = type.getQualifier().layoutLocation; + TVarSlotMap& varSlotMap = storageSlotMap[storageKey]; + TVarSlotMap::iterator iter = varSlotMap.find(name); + if (iter == varSlotMap.end()) { + int numLocations = TIntermediate::computeTypeUniformLocationSize(type); + reserveSlot(storageKey, location, numLocations); + varSlotMap[name] = location; + } else { + // Allocate location by name for OpenGL driver, so the uniform in different + // stages should be declared with the same location + if (iter->second != location) { + TString errorMsg = "Invalid location: " + name; + infoSink.info.message(EPrefixInternalError, errorMsg.c_str()); + } + } + } + break; + default: + break; } +} - static bool isTextureType(const glslang::TType& type) { - return (type.getBasicType() == glslang::EbtSampler && - (type.getSampler().isTexture() || type.getSampler().isSubpass())); +void TDefaultGlslIoResolver::reserverResourceSlot(TVarEntryInfo& ent, TInfoSink& infoSink) { + const TType& type = ent.symbol->getType(); + const TString& name = ent.symbol->getName(); + int resource = getResourceType(type); + if (type.getQualifier().hasBinding()) { + TVarSlotMap& varSlotMap = resourceSlotMap[resource]; + TVarSlotMap::iterator iter = varSlotMap.find(name); + int binding = type.getQualifier().layoutBinding; + if (iter == varSlotMap.end()) { + // Reserve the slots for the ubo, ssbo and opaques who has explicit binding + int numBindings = type.isSizedArray() ? type.getCumulativeArraySize() : 1; + varSlotMap[name] = binding; + reserveSlot(resource, binding, numBindings); + } else { + // Allocate binding by name for OpenGL driver, so the resource in different + // stages should be declared with the same binding + if (iter->second != binding) { + TString errorMsg = "Invalid binding: " + name; + infoSink.info.message(EPrefixInternalError, errorMsg.c_str()); + } + } } +} - static bool isUboType(const glslang::TType& type) { - return type.getQualifier().storage == EvqUniform; - } -}; +//TDefaultGlslIoResolver end /* * Basic implementation of glslang::TIoMapResolver that replaces the @@ -567,69 +901,51 @@ protected: /* * Default resolver */ -struct TDefaultIoResolver : public TDefaultIoResolverBase -{ - TDefaultIoResolver(const TIntermediate &intermediate) : TDefaultIoResolverBase(intermediate) { } +struct TDefaultIoResolver : public TDefaultIoResolverBase { + TDefaultIoResolver(const TIntermediate& intermediate) : TDefaultIoResolverBase(intermediate) { } - bool validateBinding(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& /*type*/, bool /*is_live*/) override - { - return true; + bool validateBinding(EShLanguage /*stage*/, TVarEntryInfo& /*ent*/) override { return true; } + + TResourceType getResourceType(const glslang::TType& type) override { + if (isImageType(type)) { + return EResImage; + } + if (isTextureType(type)) { + return EResTexture; + } + if (isSsboType(type)) { + return EResSsbo; + } + if (isSamplerType(type)) { + return EResSampler; + } + if (isUboType(type)) { + return EResUbo; + } + return EResCount; } - int resolveBinding(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool is_live) override - { + int resolveBinding(EShLanguage /*stage*/, TVarEntryInfo& ent) override { + const TType& type = ent.symbol->getType(); const int set = getLayoutSet(type); // On OpenGL arrays of opaque types take a seperate binding for each element int numBindings = intermediate.getSpv().openGl != 0 && type.isSizedArray() ? type.getCumulativeArraySize() : 1; - - if (type.getQualifier().hasBinding()) { - if (isImageType(type)) - return reserveSlot(set, getBaseBinding(EResImage, set) + type.getQualifier().layoutBinding, numBindings); - - if (isTextureType(type)) - return reserveSlot(set, getBaseBinding(EResTexture, set) + type.getQualifier().layoutBinding, numBindings); - - if (isSsboType(type)) - return reserveSlot(set, getBaseBinding(EResSsbo, set) + type.getQualifier().layoutBinding, numBindings); - - if (isSamplerType(type)) - return reserveSlot(set, getBaseBinding(EResSampler, set) + type.getQualifier().layoutBinding, numBindings); - - if (isUboType(type)) - return reserveSlot(set, getBaseBinding(EResUbo, set) + type.getQualifier().layoutBinding, numBindings); - } else if (is_live && doAutoBindingMapping()) { - // find free slot, the caller did make sure it passes all vars with binding - // first and now all are passed that do not have a binding and needs one - - if (isImageType(type)) - return getFreeSlot(set, getBaseBinding(EResImage, set), numBindings); - - if (isTextureType(type)) - return getFreeSlot(set, getBaseBinding(EResTexture, set), numBindings); - - if (isSsboType(type)) - return getFreeSlot(set, getBaseBinding(EResSsbo, set), numBindings); - - if (isSamplerType(type)) - return getFreeSlot(set, getBaseBinding(EResSampler, set), numBindings); - - if (isUboType(type)) - return getFreeSlot(set, getBaseBinding(EResUbo, set), numBindings); + TResourceType resource = getResourceType(type); + if (resource < EResCount) { + if (type.getQualifier().hasBinding()) { + return ent.newBinding = reserveSlot( + set, getBaseBinding(resource, set) + type.getQualifier().layoutBinding, numBindings); + } else if (ent.live && doAutoBindingMapping()) { + // find free slot, the caller did make sure it passes all vars with binding + // first and now all are passed that do not have a binding and needs one + return ent.newBinding = getFreeSlot(set, getBaseBinding(resource, set), numBindings); + } } - - return -1; - } - -protected: - static bool isImageType(const glslang::TType& type) { - return type.getBasicType() == glslang::EbtSampler && type.getSampler().isImage(); - } - - static bool isSsboType(const glslang::TType& type) { - return type.getQualifier().storage == EvqBuffer; + return ent.newBinding = -1; } }; +#ifdef ENABLE_HLSL /******************************************************************************** The following IO resolver maps types in HLSL register space, as follows: @@ -647,7 +963,7 @@ t - for shader resource views (SRV) BYTEADDRESSBUFFER BUFFER TBUFFER - + s - for samplers SAMPLER SAMPLER1D @@ -673,98 +989,69 @@ b - for constant buffer views (CBV) CBUFFER CONSTANTBUFFER ********************************************************************************/ -struct TDefaultHlslIoResolver : public TDefaultIoResolverBase -{ - TDefaultHlslIoResolver(const TIntermediate &intermediate) : TDefaultIoResolverBase(intermediate) { } - - bool validateBinding(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& /*type*/, bool /*is_live*/) override - { - return true; - } - - int resolveBinding(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool is_live) override - { - const int set = getLayoutSet(type); - - if (type.getQualifier().hasBinding()) { - if (isUavType(type)) - return reserveSlot(set, getBaseBinding(EResUav, set) + type.getQualifier().layoutBinding); - - if (isSrvType(type)) - return reserveSlot(set, getBaseBinding(EResTexture, set) + type.getQualifier().layoutBinding); +struct TDefaultHlslIoResolver : public TDefaultIoResolverBase { + TDefaultHlslIoResolver(const TIntermediate& intermediate) : TDefaultIoResolverBase(intermediate) { } - if (isSamplerType(type)) - return reserveSlot(set, getBaseBinding(EResSampler, set) + type.getQualifier().layoutBinding); + bool validateBinding(EShLanguage /*stage*/, TVarEntryInfo& /*ent*/) override { return true; } - if (isUboType(type)) - return reserveSlot(set, getBaseBinding(EResUbo, set) + type.getQualifier().layoutBinding); - } else if (is_live && doAutoBindingMapping()) { - // find free slot, the caller did make sure it passes all vars with binding - // first and now all are passed that do not have a binding and needs one - - if (isUavType(type)) - return getFreeSlot(set, getBaseBinding(EResUav, set)); - - if (isSrvType(type)) - return getFreeSlot(set, getBaseBinding(EResTexture, set)); - - if (isSamplerType(type)) - return getFreeSlot(set, getBaseBinding(EResSampler, set)); - - if (isUboType(type)) - return getFreeSlot(set, getBaseBinding(EResUbo, set)); + TResourceType getResourceType(const glslang::TType& type) override { + if (isUavType(type)) { + return EResUav; } - - return -1; - } - -protected: - // Return true if this is a SRV (shader resource view) type: - static bool isSrvType(const glslang::TType& type) { - return isTextureType(type) || type.getQualifier().storage == EvqBuffer; + if (isSrvType(type)) { + return EResTexture; + } + if (isSamplerType(type)) { + return EResSampler; + } + if (isUboType(type)) { + return EResUbo; + } + return EResCount; } - // Return true if this is a UAV (unordered access view) type: - static bool isUavType(const glslang::TType& type) { - if (type.getQualifier().readonly) - return false; - - return (type.getBasicType() == glslang::EbtSampler && type.getSampler().isImage()) || - (type.getQualifier().storage == EvqBuffer); + int resolveBinding(EShLanguage /*stage*/, TVarEntryInfo& ent) override { + const TType& type = ent.symbol->getType(); + const int set = getLayoutSet(type); + TResourceType resource = getResourceType(type); + if (resource < EResCount) { + if (type.getQualifier().hasBinding()) { + return ent.newBinding = reserveSlot(set, getBaseBinding(resource, set) + type.getQualifier().layoutBinding); + } else if (ent.live && doAutoBindingMapping()) { + // find free slot, the caller did make sure it passes all vars with binding + // first and now all are passed that do not have a binding and needs one + return ent.newBinding = getFreeSlot(set, getBaseBinding(resource, set)); + } + } + return ent.newBinding = -1; } }; - +#endif // Map I/O variables to provided offsets, and make bindings for // unbound but live variables. // // Returns false if the input is too malformed to do this. -bool TIoMapper::addStage(EShLanguage stage, TIntermediate &intermediate, TInfoSink &infoSink, TIoMapResolver *resolver) -{ - bool somethingToDo = !intermediate.getResourceSetBinding().empty() || - intermediate.getAutoMapBindings() || - intermediate.getAutoMapLocations(); - - for (int res = 0; res < EResCount; ++res) { - somethingToDo = somethingToDo || - (intermediate.getShiftBinding(TResourceType(res)) != 0) || - intermediate.hasShiftBindingForSet(TResourceType(res)); +bool TIoMapper::addStage(EShLanguage stage, TIntermediate& intermediate, TInfoSink& infoSink, TIoMapResolver* resolver) { + bool somethingToDo = ! intermediate.getResourceSetBinding().empty() || intermediate.getAutoMapBindings() || + intermediate.getAutoMapLocations(); + // Restrict the stricter condition to further check 'somethingToDo' only if 'somethingToDo' has not been set, reduce + // unnecessary or insignificant for-loop operation after 'somethingToDo' have been true. + for (int res = 0; (res < EResCount && !somethingToDo); ++res) { + somethingToDo = somethingToDo || (intermediate.getShiftBinding(TResourceType(res)) != 0) || + intermediate.hasShiftBindingForSet(TResourceType(res)); } - - if (!somethingToDo && resolver == nullptr) + if (! somethingToDo && resolver == nullptr) return true; - if (intermediate.getNumEntryPoints() != 1 || intermediate.isRecursive()) return false; - TIntermNode* root = intermediate.getTreeRoot(); if (root == nullptr) return false; - // if no resolver is provided, use the default resolver with the given shifts and auto map settings TDefaultIoResolver defaultResolver(intermediate); +#ifdef ENABLE_HLSL TDefaultHlslIoResolver defaultHlslResolver(intermediate); - if (resolver == nullptr) { // TODO: use a passed in IO mapper for this if (intermediate.usingHlslIoMapping()) @@ -772,47 +1059,191 @@ bool TIoMapper::addStage(EShLanguage stage, TIntermediate &intermediate, TInfoSi else resolver = &defaultResolver; } + resolver->addStage(stage); +#else + resolver = &defaultResolver; +#endif TVarLiveMap inVarMap, outVarMap, uniformVarMap; + TVarLiveVector inVector, outVector, uniformVector; TVarGatherTraverser iter_binding_all(intermediate, true, inVarMap, outVarMap, uniformVarMap); TVarGatherTraverser iter_binding_live(intermediate, false, inVarMap, outVarMap, uniformVarMap); - root->traverse(&iter_binding_all); iter_binding_live.pushFunction(intermediate.getEntryPointMangledName().c_str()); - - while (!iter_binding_live.functions.empty()) { + while (! iter_binding_live.functions.empty()) { TIntermNode* function = iter_binding_live.functions.back(); iter_binding_live.functions.pop_back(); function->traverse(&iter_binding_live); } - // sort entries by priority. see TVarEntryInfo::TOrderByPriority for info. - std::sort(uniformVarMap.begin(), uniformVarMap.end(), TVarEntryInfo::TOrderByPriority()); - + std::for_each(inVarMap.begin(), inVarMap.end(), + [&inVector](TVarLivePair p) { inVector.push_back(p); }); + std::sort(inVector.begin(), inVector.end(), [](const TVarLivePair& p1, const TVarLivePair& p2) -> bool { + return TVarEntryInfo::TOrderByPriority()(p1.second, p2.second); + }); + std::for_each(outVarMap.begin(), outVarMap.end(), + [&outVector](TVarLivePair p) { outVector.push_back(p); }); + std::sort(outVector.begin(), outVector.end(), [](const TVarLivePair& p1, const TVarLivePair& p2) -> bool { + return TVarEntryInfo::TOrderByPriority()(p1.second, p2.second); + }); + std::for_each(uniformVarMap.begin(), uniformVarMap.end(), + [&uniformVector](TVarLivePair p) { uniformVector.push_back(p); }); + std::sort(uniformVector.begin(), uniformVector.end(), [](const TVarLivePair& p1, const TVarLivePair& p2) -> bool { + return TVarEntryInfo::TOrderByPriority()(p1.second, p2.second); + }); bool hadError = false; TNotifyInOutAdaptor inOutNotify(stage, *resolver); TNotifyUniformAdaptor uniformNotify(stage, *resolver); - TResolverUniformAdaptor uniformResolve(stage, *resolver, infoSink, hadError, intermediate); - TResolverInOutAdaptor inOutResolve(stage, *resolver, infoSink, hadError, intermediate); + TResolverUniformAdaptor uniformResolve(stage, *resolver, infoSink, hadError); + TResolverInOutAdaptor inOutResolve(stage, *resolver, infoSink, hadError); resolver->beginNotifications(stage); - std::for_each(inVarMap.begin(), inVarMap.end(), inOutNotify); - std::for_each(outVarMap.begin(), outVarMap.end(), inOutNotify); - std::for_each(uniformVarMap.begin(), uniformVarMap.end(), uniformNotify); + std::for_each(inVector.begin(), inVector.end(), inOutNotify); + std::for_each(outVector.begin(), outVector.end(), inOutNotify); + std::for_each(uniformVector.begin(), uniformVector.end(), uniformNotify); resolver->endNotifications(stage); resolver->beginResolve(stage); - std::for_each(inVarMap.begin(), inVarMap.end(), inOutResolve); - std::for_each(outVarMap.begin(), outVarMap.end(), inOutResolve); - std::for_each(uniformVarMap.begin(), uniformVarMap.end(), uniformResolve); + std::for_each(inVector.begin(), inVector.end(), inOutResolve); + std::for_each(inVector.begin(), inVector.end(), [&inVarMap](TVarLivePair p) { + auto at = inVarMap.find(p.second.symbol->getName()); + if (at != inVarMap.end()) + at->second = p.second; + }); + std::for_each(outVector.begin(), outVector.end(), inOutResolve); + std::for_each(outVector.begin(), outVector.end(), [&outVarMap](TVarLivePair p) { + auto at = outVarMap.find(p.second.symbol->getName()); + if (at != outVarMap.end()) + at->second = p.second; + }); + std::for_each(uniformVector.begin(), uniformVector.end(), uniformResolve); + std::for_each(uniformVector.begin(), uniformVector.end(), [&uniformVarMap](TVarLivePair p) { + auto at = uniformVarMap.find(p.second.symbol->getName()); + if (at != uniformVarMap.end()) + at->second = p.second; + }); resolver->endResolve(stage); - if (!hadError) { - // sort by id again, so we can use lower bound to find entries - std::sort(uniformVarMap.begin(), uniformVarMap.end(), TVarEntryInfo::TOrderById()); TVarSetTraverser iter_iomap(intermediate, inVarMap, outVarMap, uniformVarMap); root->traverse(&iter_iomap); } + return !hadError; +} +// Map I/O variables to provided offsets, and make bindings for +// unbound but live variables. +// +// Returns false if the input is too malformed to do this. +bool TGlslIoMapper::addStage(EShLanguage stage, TIntermediate& intermediate, TInfoSink& infoSink, TIoMapResolver* resolver) { + + bool somethingToDo = ! intermediate.getResourceSetBinding().empty() || intermediate.getAutoMapBindings() || + intermediate.getAutoMapLocations(); + // Restrict the stricter condition to further check 'somethingToDo' only if 'somethingToDo' has not been set, reduce + // unnecessary or insignificant for-loop operation after 'somethingToDo' have been true. + for (int res = 0; (res < EResCount && !somethingToDo); ++res) { + somethingToDo = somethingToDo || (intermediate.getShiftBinding(TResourceType(res)) != 0) || + intermediate.hasShiftBindingForSet(TResourceType(res)); + } + if (! somethingToDo && resolver == nullptr) { + return true; + } + if (intermediate.getNumEntryPoints() != 1 || intermediate.isRecursive()) { + return false; + } + TIntermNode* root = intermediate.getTreeRoot(); + if (root == nullptr) { + return false; + } + // if no resolver is provided, use the default resolver with the given shifts and auto map settings + TDefaultGlslIoResolver defaultResolver(intermediate); + if (resolver == nullptr) { + resolver = &defaultResolver; + } + resolver->addStage(stage); + inVarMaps[stage] = new TVarLiveMap, outVarMaps[stage] = new TVarLiveMap(), uniformVarMap[stage] = new TVarLiveMap(); + TVarGatherTraverser iter_binding_all(intermediate, true, *inVarMaps[stage], *outVarMaps[stage], + *uniformVarMap[stage]); + TVarGatherTraverser iter_binding_live(intermediate, false, *inVarMaps[stage], *outVarMaps[stage], + *uniformVarMap[stage]); + root->traverse(&iter_binding_all); + iter_binding_live.pushFunction(intermediate.getEntryPointMangledName().c_str()); + while (! iter_binding_live.functions.empty()) { + TIntermNode* function = iter_binding_live.functions.back(); + iter_binding_live.functions.pop_back(); + function->traverse(&iter_binding_live); + } + TNotifyInOutAdaptor inOutNotify(stage, *resolver); + TNotifyUniformAdaptor uniformNotify(stage, *resolver); + // Resolve current stage input symbol location with previous stage output here, + // uniform symbol, ubo, ssbo and opaque symbols are per-program resource, + // will resolve uniform symbol location and ubo/ssbo/opaque binding in doMap() + resolver->beginNotifications(stage); + std::for_each(inVarMaps[stage]->begin(), inVarMaps[stage]->end(), inOutNotify); + std::for_each(outVarMaps[stage]->begin(), outVarMaps[stage]->end(), inOutNotify); + std::for_each(uniformVarMap[stage]->begin(), uniformVarMap[stage]->end(), uniformNotify); + resolver->endNotifications(stage); + TSlotCollector slotCollector(*resolver, infoSink); + resolver->beginCollect(stage); + std::for_each(inVarMaps[stage]->begin(), inVarMaps[stage]->end(), slotCollector); + std::for_each(outVarMaps[stage]->begin(), outVarMaps[stage]->end(), slotCollector); + std::for_each(uniformVarMap[stage]->begin(), uniformVarMap[stage]->end(), slotCollector); + resolver->endCollect(stage); + intermediates[stage] = &intermediate; return !hadError; } +bool TGlslIoMapper::doMap(TIoMapResolver* resolver, TInfoSink& infoSink) { + resolver->endResolve(EShLangCount); + if (!hadError) { + //Resolve uniform location, ubo/ssbo/opaque bindings across stages + TResolverUniformAdaptor uniformResolve(EShLangCount, *resolver, infoSink, hadError); + TResolverInOutAdaptor inOutResolve(EShLangCount, *resolver, infoSink, hadError); + TSymbolValidater symbolValidater(*resolver, infoSink, inVarMaps, outVarMaps, uniformVarMap, hadError); + TVarLiveVector uniformVector; + resolver->beginResolve(EShLangCount); + for (int stage = EShLangVertex; stage < EShLangCount; stage++) { + if (inVarMaps[stage] != nullptr) { + inOutResolve.setStage(EShLanguage(stage)); + std::for_each(inVarMaps[stage]->begin(), inVarMaps[stage]->end(), symbolValidater); + std::for_each(inVarMaps[stage]->begin(), inVarMaps[stage]->end(), inOutResolve); + std::for_each(outVarMaps[stage]->begin(), outVarMaps[stage]->end(), symbolValidater); + std::for_each(outVarMaps[stage]->begin(), outVarMaps[stage]->end(), inOutResolve); + } + if (uniformVarMap[stage] != nullptr) { + uniformResolve.setStage(EShLanguage(stage)); + // sort entries by priority. see TVarEntryInfo::TOrderByPriority for info. + std::for_each(uniformVarMap[stage]->begin(), uniformVarMap[stage]->end(), + [&uniformVector](TVarLivePair p) { uniformVector.push_back(p); }); + } + } + std::sort(uniformVector.begin(), uniformVector.end(), [](const TVarLivePair& p1, const TVarLivePair& p2) -> bool { + return TVarEntryInfo::TOrderByPriority()(p1.second, p2.second); + }); + std::for_each(uniformVector.begin(), uniformVector.end(), symbolValidater); + std::for_each(uniformVector.begin(), uniformVector.end(), uniformResolve); + std::sort(uniformVector.begin(), uniformVector.end(), [](const TVarLivePair& p1, const TVarLivePair& p2) -> bool { + return TVarEntryInfo::TOrderByPriority()(p1.second, p2.second); + }); + resolver->endResolve(EShLangCount); + for (size_t stage = 0; stage < EShLangCount; stage++) { + if (intermediates[stage] != nullptr) { + // traverse each stage, set new location to each input/output and unifom symbol, set new binding to + // ubo, ssbo and opaque symbols + TVarLiveMap** pUniformVarMap = uniformVarMap; + std::for_each(uniformVector.begin(), uniformVector.end(), [pUniformVarMap, stage](TVarLivePair p) { + auto at = pUniformVarMap[stage]->find(p.second.symbol->getName()); + if (at != pUniformVarMap[stage]->end()) + at->second = p.second; + }); + TVarSetTraverser iter_iomap(*intermediates[stage], *inVarMaps[stage], *outVarMaps[stage], + *uniformVarMap[stage]); + intermediates[stage]->getTreeRoot()->traverse(&iter_iomap); + } + } + return !hadError; + } else { + return false; + } +} + } // end namespace glslang + +#endif // GLSLANG_WEB diff --git a/thirdparty/glslang/glslang/MachineIndependent/iomapper.h b/thirdparty/glslang/glslang/MachineIndependent/iomapper.h index 5e0d4391cc..684e88d571 100644 --- a/thirdparty/glslang/glslang/MachineIndependent/iomapper.h +++ b/thirdparty/glslang/glslang/MachineIndependent/iomapper.h @@ -33,11 +33,15 @@ // POSSIBILITY OF SUCH DAMAGE. // +#ifndef GLSLANG_WEB + #ifndef _IOMAPPER_INCLUDED #define _IOMAPPER_INCLUDED -#include "../Public/ShaderLang.h" - +#include <cstdint> +#include "LiveTraverser.h" +#include <unordered_map> +#include <unordered_set> // // A reflection database and its interface, consistent with the OpenGL API reflection queries. // @@ -47,17 +51,249 @@ class TInfoSink; namespace glslang { class TIntermediate; +struct TVarEntryInfo { + int id; + TIntermSymbol* symbol; + bool live; + int newBinding; + int newSet; + int newLocation; + int newComponent; + int newIndex; + EShLanguage stage; + struct TOrderById { + inline bool operator()(const TVarEntryInfo& l, const TVarEntryInfo& r) { return l.id < r.id; } + }; + + struct TOrderByPriority { + // ordering: + // 1) has both binding and set + // 2) has binding but no set + // 3) has no binding but set + // 4) has no binding and no set + inline bool operator()(const TVarEntryInfo& l, const TVarEntryInfo& r) { + const TQualifier& lq = l.symbol->getQualifier(); + const TQualifier& rq = r.symbol->getQualifier(); + + // simple rules: + // has binding gives 2 points + // has set gives 1 point + // who has the most points is more important. + int lPoints = (lq.hasBinding() ? 2 : 0) + (lq.hasSet() ? 1 : 0); + int rPoints = (rq.hasBinding() ? 2 : 0) + (rq.hasSet() ? 1 : 0); + + if (lPoints == rPoints) + return l.id < r.id; + return lPoints > rPoints; + } + }; +}; + +// Base class for shared TIoMapResolver services, used by several derivations. +struct TDefaultIoResolverBase : public glslang::TIoMapResolver { +public: + TDefaultIoResolverBase(const TIntermediate& intermediate); + typedef std::vector<int> TSlotSet; + typedef std::unordered_map<int, TSlotSet> TSlotSetMap; + + // grow the reflection stage by stage + void notifyBinding(EShLanguage, TVarEntryInfo& /*ent*/) override {} + void notifyInOut(EShLanguage, TVarEntryInfo& /*ent*/) override {} + void beginNotifications(EShLanguage) override {} + void endNotifications(EShLanguage) override {} + void beginResolve(EShLanguage) override {} + void endResolve(EShLanguage) override {} + void beginCollect(EShLanguage) override {} + void endCollect(EShLanguage) override {} + void reserverResourceSlot(TVarEntryInfo& /*ent*/, TInfoSink& /*infoSink*/) override {} + void reserverStorageSlot(TVarEntryInfo& /*ent*/, TInfoSink& /*infoSink*/) override {} + int getBaseBinding(TResourceType res, unsigned int set) const; + const std::vector<std::string>& getResourceSetBinding() const; + virtual TResourceType getResourceType(const glslang::TType& type) = 0; + bool doAutoBindingMapping() const; + bool doAutoLocationMapping() const; + TSlotSet::iterator findSlot(int set, int slot); + bool checkEmpty(int set, int slot); + bool validateInOut(EShLanguage /*stage*/, TVarEntryInfo& /*ent*/) override { return true; } + int reserveSlot(int set, int slot, int size = 1); + int getFreeSlot(int set, int base, int size = 1); + int resolveSet(EShLanguage /*stage*/, TVarEntryInfo& ent) override; + int resolveUniformLocation(EShLanguage /*stage*/, TVarEntryInfo& ent) override; + int resolveInOutLocation(EShLanguage stage, TVarEntryInfo& ent) override; + int resolveInOutComponent(EShLanguage /*stage*/, TVarEntryInfo& ent) override; + int resolveInOutIndex(EShLanguage /*stage*/, TVarEntryInfo& ent) override; + void addStage(EShLanguage stage) override { + if (stage < EShLangCount) + stageMask[stage] = true; + } + uint32_t computeTypeLocationSize(const TType& type, EShLanguage stage); + + TSlotSetMap slots; + +protected: + TDefaultIoResolverBase(TDefaultIoResolverBase&); + TDefaultIoResolverBase& operator=(TDefaultIoResolverBase&); + const TIntermediate& intermediate; + int nextUniformLocation; + int nextInputLocation; + int nextOutputLocation; + bool stageMask[EShLangCount + 1]; + // Return descriptor set specific base if there is one, and the generic base otherwise. + int selectBaseBinding(int base, int descriptorSetBase) const { + return descriptorSetBase != -1 ? descriptorSetBase : base; + } + + static int getLayoutSet(const glslang::TType& type) { + if (type.getQualifier().hasSet()) + return type.getQualifier().layoutSet; + else + return 0; + } + + static bool isSamplerType(const glslang::TType& type) { + return type.getBasicType() == glslang::EbtSampler && type.getSampler().isPureSampler(); + } + + static bool isTextureType(const glslang::TType& type) { + return (type.getBasicType() == glslang::EbtSampler && + (type.getSampler().isTexture() || type.getSampler().isSubpass())); + } + + static bool isUboType(const glslang::TType& type) { + return type.getQualifier().storage == EvqUniform; + } + + static bool isImageType(const glslang::TType& type) { + return type.getBasicType() == glslang::EbtSampler && type.getSampler().isImage(); + } + + static bool isSsboType(const glslang::TType& type) { + return type.getQualifier().storage == EvqBuffer; + } + + // Return true if this is a SRV (shader resource view) type: + static bool isSrvType(const glslang::TType& type) { + return isTextureType(type) || type.getQualifier().storage == EvqBuffer; + } + + // Return true if this is a UAV (unordered access view) type: + static bool isUavType(const glslang::TType& type) { + if (type.getQualifier().isReadOnly()) + return false; + return (type.getBasicType() == glslang::EbtSampler && type.getSampler().isImage()) || + (type.getQualifier().storage == EvqBuffer); + } +}; + +// Defaulf I/O resolver for OpenGL +struct TDefaultGlslIoResolver : public TDefaultIoResolverBase { +public: + typedef std::map<TString, int> TVarSlotMap; // <resourceName, location/binding> + typedef std::map<int, TVarSlotMap> TSlotMap; // <resourceKey, TVarSlotMap> + TDefaultGlslIoResolver(const TIntermediate& intermediate); + bool validateBinding(EShLanguage /*stage*/, TVarEntryInfo& /*ent*/) override { return true; } + TResourceType getResourceType(const glslang::TType& type) override; + int resolveInOutLocation(EShLanguage stage, TVarEntryInfo& ent) override; + int resolveUniformLocation(EShLanguage /*stage*/, TVarEntryInfo& ent) override; + int resolveBinding(EShLanguage /*stage*/, TVarEntryInfo& ent) override; + void beginResolve(EShLanguage /*stage*/) override; + void endResolve(EShLanguage stage) override; + void beginCollect(EShLanguage) override; + void endCollect(EShLanguage) override; + void reserverStorageSlot(TVarEntryInfo& ent, TInfoSink& infoSink) override; + void reserverResourceSlot(TVarEntryInfo& ent, TInfoSink& infoSink) override; + // in/out symbol and uniform symbol are stored in the same resourceSlotMap, the storage key is used to identify each type of symbol. + // We use stage and storage qualifier to construct a storage key. it can help us identify the same storage resource used in different stage. + // if a resource is a program resource and we don't need know it usage stage, we can use same stage to build storage key. + // Note: both stage and type must less then 0xffff. + int buildStorageKey(EShLanguage stage, TStorageQualifier type) { + assert(static_cast<uint32_t>(stage) <= 0x0000ffff && static_cast<uint32_t>(type) <= 0x0000ffff); + return (stage << 16) | type; + } + +protected: + // Use for mark pre stage, to get more interface symbol information. + EShLanguage preStage; + // Use for mark current shader stage for resolver + EShLanguage currentStage; + // Slot map for storage resource(location of uniform and interface symbol) It's a program share slot + TSlotMap resourceSlotMap; + // Slot map for other resource(image, ubo, ssbo), It's a program share slot. + TSlotMap storageSlotMap; +}; + +typedef std::map<TString, TVarEntryInfo> TVarLiveMap; + +// override function "operator=", if a vector<const _Kty, _Ty> being sort, +// when use vc++, the sort function will call : +// pair& operator=(const pair<_Other1, _Other2>& _Right) +// { +// first = _Right.first; +// second = _Right.second; +// return (*this); +// } +// that will make a const type handing on left. +// override this function can avoid a compiler error. +// In the future, if the vc++ compiler can handle such a situation, +// this part of the code will be removed. +struct TVarLivePair : std::pair<const TString, TVarEntryInfo> { + TVarLivePair(std::pair<const TString, TVarEntryInfo>& _Right) : pair(_Right.first, _Right.second) {} + TVarLivePair& operator=(const TVarLivePair& _Right) { + const_cast<TString&>(first) = _Right.first; + second = _Right.second; + return (*this); + } +}; +typedef std::vector<TVarLivePair> TVarLiveVector; // I/O mapper class TIoMapper { public: TIoMapper() {} virtual ~TIoMapper() {} + // grow the reflection stage by stage + bool virtual addStage(EShLanguage, TIntermediate&, TInfoSink&, TIoMapResolver*); + bool virtual doMap(TIoMapResolver*, TInfoSink&) { return true; } +}; +// I/O mapper for OpenGL +class TGlslIoMapper : public TIoMapper { +public: + TGlslIoMapper() { + memset(inVarMaps, 0, sizeof(TVarLiveMap*) * (EShLangCount + 1)); + memset(outVarMaps, 0, sizeof(TVarLiveMap*) * (EShLangCount + 1)); + memset(uniformVarMap, 0, sizeof(TVarLiveMap*) * (EShLangCount + 1)); + memset(intermediates, 0, sizeof(TIntermediate*) * (EShLangCount + 1)); + } + virtual ~TGlslIoMapper() { + for (size_t stage = 0; stage < EShLangCount; stage++) { + if (inVarMaps[stage] != nullptr) { + delete inVarMaps[stage]; + inVarMaps[stage] = nullptr; + } + if (outVarMaps[stage] != nullptr) { + delete outVarMaps[stage]; + outVarMaps[stage] = nullptr; + } + if (uniformVarMap[stage] != nullptr) { + delete uniformVarMap[stage]; + uniformVarMap[stage] = nullptr; + } + if (intermediates[stage] != nullptr) + intermediates[stage] = nullptr; + } + } // grow the reflection stage by stage - bool addStage(EShLanguage, TIntermediate&, TInfoSink&, TIoMapResolver*); + bool addStage(EShLanguage, TIntermediate&, TInfoSink&, TIoMapResolver*) override; + bool doMap(TIoMapResolver*, TInfoSink&) override; + TVarLiveMap *inVarMaps[EShLangCount], *outVarMaps[EShLangCount], + *uniformVarMap[EShLangCount]; + TIntermediate* intermediates[EShLangCount]; + bool hadError = false; }; } // end namespace glslang #endif // _IOMAPPER_INCLUDED + +#endif // GLSLANG_WEB diff --git a/thirdparty/glslang/glslang/MachineIndependent/limits.cpp b/thirdparty/glslang/glslang/MachineIndependent/limits.cpp index 64d191b472..51d9300341 100644 --- a/thirdparty/glslang/glslang/MachineIndependent/limits.cpp +++ b/thirdparty/glslang/glslang/MachineIndependent/limits.cpp @@ -187,12 +187,14 @@ bool TIndexTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node) // void TParseContext::constantIndexExpressionCheck(TIntermNode* index) { +#ifndef GLSLANG_WEB TIndexTraverser it(inductiveLoopIds); index->traverse(&it); if (it.bad) error(it.badLoc, "Non-constant-index-expression", "limitations", ""); +#endif } } // end namespace glslang diff --git a/thirdparty/glslang/glslang/MachineIndependent/linkValidate.cpp b/thirdparty/glslang/glslang/MachineIndependent/linkValidate.cpp index f935d4a629..fe51ec93ff 100644 --- a/thirdparty/glslang/glslang/MachineIndependent/linkValidate.cpp +++ b/thirdparty/glslang/glslang/MachineIndependent/linkValidate.cpp @@ -56,8 +56,10 @@ namespace glslang { // void TIntermediate::error(TInfoSink& infoSink, const char* message) { +#ifndef GLSLANG_WEB infoSink.info.prefix(EPrefixError); infoSink.info << "Linking " << StageName(language) << " stage: " << message << "\n"; +#endif ++numErrors; } @@ -65,8 +67,10 @@ void TIntermediate::error(TInfoSink& infoSink, const char* message) // Link-time warning. void TIntermediate::warn(TInfoSink& infoSink, const char* message) { +#ifndef GLSLANG_WEB infoSink.info.prefix(EPrefixWarning); infoSink.info << "Linking " << StageName(language) << " stage: " << message << "\n"; +#endif } // TODO: 4.4 offset/align: "Two blocks linked together in the same program with the same block @@ -78,9 +82,11 @@ void TIntermediate::warn(TInfoSink& infoSink, const char* message) // void TIntermediate::merge(TInfoSink& infoSink, TIntermediate& unit) { +#ifndef GLSLANG_WEB mergeCallGraphs(infoSink, unit); mergeModes(infoSink, unit); mergeTrees(infoSink, unit); +#endif } void TIntermediate::mergeCallGraphs(TInfoSink& infoSink, TIntermediate& unit) @@ -98,6 +104,8 @@ void TIntermediate::mergeCallGraphs(TInfoSink& infoSink, TIntermediate& unit) callGraph.insert(callGraph.end(), unit.callGraph.begin(), unit.callGraph.end()); } +#ifndef GLSLANG_WEB + #define MERGE_MAX(member) member = std::max(member, unit.member) #define MERGE_TRUE(member) if (unit.member) member = unit.member; @@ -106,9 +114,9 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit) if (language != unit.language) error(infoSink, "stages must match when linking into a single stage"); - if (source == EShSourceNone) - source = unit.source; - if (source != unit.source) + if (getSource() == EShSourceNone) + setSource(unit.getSource()); + if (getSource() != unit.getSource()) error(infoSink, "can't link compilation units from different source languages"); if (treeRoot == nullptr) { @@ -116,7 +124,7 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit) version = unit.version; requestedExtensions = unit.requestedExtensions; } else { - if ((profile == EEsProfile) != (unit.profile == EEsProfile)) + if ((isEsProfile()) != (unit.isEsProfile())) error(infoSink, "Cannot cross link ES and desktop profiles"); else if (unit.profile == ECompatibilityProfile) profile = ECompatibilityProfile; @@ -142,18 +150,13 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit) if (vertices == TQualifier::layoutNotSet) vertices = unit.vertices; else if (vertices != unit.vertices) { - if (language == EShLangGeometry -#ifdef NV_EXTENSIONS - || language == EShLangMeshNV -#endif - ) + if (language == EShLangGeometry || language == EShLangMeshNV) error(infoSink, "Contradictory layout max_vertices values"); else if (language == EShLangTessControl) error(infoSink, "Contradictory layout vertices values"); else assert(0); } -#ifdef NV_EXTENSIONS if (primitives == TQualifier::layoutNotSet) primitives = unit.primitives; else if (primitives != unit.primitives) { @@ -162,7 +165,6 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit) else assert(0); } -#endif if (inputPrimitive == ElgNone) inputPrimitive = unit.inputPrimitive; @@ -190,12 +192,14 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit) MERGE_TRUE(pointMode); for (int i = 0; i < 3; ++i) { - if (localSize[i] > 1) + if (!localSizeNotDefault[i] && unit.localSizeNotDefault[i]) { localSize[i] = unit.localSize[i]; + localSizeNotDefault[i] = true; + } else if (localSize[i] != unit.localSize[i]) error(infoSink, "Contradictory local size"); - if (localSizeSpecId[i] != TQualifier::layoutNotSet) + if (localSizeSpecId[i] == TQualifier::layoutNotSet) localSizeSpecId[i] = unit.localSizeSpecId[i]; else if (localSizeSpecId[i] != unit.localSizeSpecId[i]) error(infoSink, "Contradictory local size specialization ids"); @@ -224,21 +228,16 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit) xfbBuffers[b].implicitStride = std::max(xfbBuffers[b].implicitStride, unit.xfbBuffers[b].implicitStride); if (unit.xfbBuffers[b].contains64BitType) xfbBuffers[b].contains64BitType = true; -#ifdef AMD_EXTENSIONS if (unit.xfbBuffers[b].contains32BitType) xfbBuffers[b].contains32BitType = true; if (unit.xfbBuffers[b].contains16BitType) xfbBuffers[b].contains16BitType = true; -#endif // TODO: 4.4 link: enhanced layouts: compare ranges } MERGE_TRUE(multiStream); - -#ifdef NV_EXTENSIONS MERGE_TRUE(layoutOverrideCoverage); MERGE_TRUE(geoPassthroughEXT); -#endif for (unsigned int i = 0; i < unit.shiftBinding.size(); ++i) { if (unit.shiftBinding[i] > 0) @@ -287,13 +286,8 @@ void TIntermediate::mergeTrees(TInfoSink& infoSink, TIntermediate& unit) } // Getting this far means we have two existing trees to merge... -#ifdef NV_EXTENSIONS numShaderRecordNVBlocks += unit.numShaderRecordNVBlocks; -#endif - -#ifdef NV_EXTENSIONS numTaskNVBlocks += unit.numTaskNVBlocks; -#endif // Get the top-level globals of each unit TIntermSequence& globals = treeRoot->getAsAggregate()->getSequence(); @@ -315,6 +309,8 @@ void TIntermediate::mergeTrees(TInfoSink& infoSink, TIntermediate& unit) ioAccessed.insert(unit.ioAccessed.begin(), unit.ioAccessed.end()); } +#endif + // Traverser that seeds an ID map with all built-ins, and tracks the // maximum ID used. // (It would be nice to put this in a function, but that causes warnings @@ -502,6 +498,7 @@ void TIntermediate::mergeImplicitArraySizes(TType& type, const TType& unitType) // void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& symbol, const TIntermSymbol& unitSymbol, bool crossStage) { +#ifndef GLSLANG_WEB bool writeTypeComparison = false; // Types have to match @@ -536,7 +533,7 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy } // Precise... - if (! crossStage && symbol.getQualifier().noContraction != unitSymbol.getQualifier().noContraction) { + if (! crossStage && symbol.getQualifier().isNoContraction() != unitSymbol.getQualifier().isNoContraction()) { error(infoSink, "Presence of precise qualifier must match:"); writeTypeComparison = true; } @@ -545,9 +542,9 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy if (symbol.getQualifier().centroid != unitSymbol.getQualifier().centroid || symbol.getQualifier().smooth != unitSymbol.getQualifier().smooth || symbol.getQualifier().flat != unitSymbol.getQualifier().flat || - symbol.getQualifier().sample != unitSymbol.getQualifier().sample || - symbol.getQualifier().patch != unitSymbol.getQualifier().patch || - symbol.getQualifier().nopersp != unitSymbol.getQualifier().nopersp) { + symbol.getQualifier().isSample()!= unitSymbol.getQualifier().isSample() || + symbol.getQualifier().isPatch() != unitSymbol.getQualifier().isPatch() || + symbol.getQualifier().isNonPerspective() != unitSymbol.getQualifier().isNonPerspective()) { error(infoSink, "Interpolation and auxiliary storage qualifiers must match:"); writeTypeComparison = true; } @@ -595,6 +592,7 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy if (writeTypeComparison) infoSink.info << " " << symbol.getName() << ": \"" << symbol.getType().getCompleteString() << "\" versus \"" << unitSymbol.getType().getCompleteString() << "\"\n"; +#endif } // @@ -609,15 +607,12 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled) return; if (numEntryPoints < 1) { - if (source == EShSourceGlsl) + if (getSource() == EShSourceGlsl) error(infoSink, "Missing entry point: Each stage requires one entry point"); else warn(infoSink, "Entry point not found"); } - if (numPushConstants > 1) - error(infoSink, "Only one push_constant block is allowed per stage"); - // recursion and missing body checking checkCallGraphCycles(infoSink); checkCallGraphBodies(infoSink, keepUncalled); @@ -625,6 +620,10 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled) // overlap/alias/missing I/O, etc. inOutLocationCheck(infoSink); +#ifndef GLSLANG_WEB + if (getNumPushConstants() > 1) + error(infoSink, "Only one push_constant block is allowed per stage"); + // invocations if (invocations == TQualifier::layoutNotSet) invocations = 1; @@ -642,12 +641,10 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled) for (size_t b = 0; b < xfbBuffers.size(); ++b) { if (xfbBuffers[b].contains64BitType) RoundToPow2(xfbBuffers[b].implicitStride, 8); -#ifdef AMD_EXTENSIONS else if (xfbBuffers[b].contains32BitType) RoundToPow2(xfbBuffers[b].implicitStride, 4); else if (xfbBuffers[b].contains16BitType) RoundToPow2(xfbBuffers[b].implicitStride, 2); -#endif // "It is a compile-time or link-time error to have // any xfb_offset that overflows xfb_stride, whether stated on declarations before or after the xfb_stride, or @@ -668,16 +665,11 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled) error(infoSink, "xfb_stride must be multiple of 8 for buffer holding a double or 64-bit integer:"); infoSink.info.prefix(EPrefixError); infoSink.info << " xfb_buffer " << (unsigned int)b << ", xfb_stride " << xfbBuffers[b].stride << "\n"; -#ifdef AMD_EXTENSIONS } else if (xfbBuffers[b].contains32BitType && ! IsMultipleOfPow2(xfbBuffers[b].stride, 4)) { -#else - } else if (! IsMultipleOfPow2(xfbBuffers[b].stride, 4)) { -#endif error(infoSink, "xfb_stride must be multiple of 4:"); infoSink.info.prefix(EPrefixError); infoSink.info << " xfb_buffer " << (unsigned int)b << ", xfb_stride " << xfbBuffers[b].stride << "\n"; } -#ifdef AMD_EXTENSIONS // "If the buffer is capturing any // outputs with half-precision or 16-bit integer components, the stride must be a multiple of 2" else if (xfbBuffers[b].contains16BitType && ! IsMultipleOfPow2(xfbBuffers[b].stride, 2)) { @@ -686,7 +678,6 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled) infoSink.info << " xfb_buffer " << (unsigned int)b << ", xfb_stride " << xfbBuffers[b].stride << "\n"; } -#endif // "The resulting stride (implicit or explicit), when divided by 4, must be less than or equal to the // implementation-dependent constant gl_MaxTransformFeedbackInterleavedComponents." if (xfbBuffers[b].stride > (unsigned int)(4 * resources.maxTransformFeedbackInterleavedComponents)) { @@ -704,7 +695,7 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled) error(infoSink, "At least one shader must specify an output layout(vertices=...)"); break; case EShLangTessEvaluation: - if (source == EShSourceGlsl) { + if (getSource() == EShSourceGlsl) { if (inputPrimitive == ElgNone) error(infoSink, "At least one shader must specify an input layout primitive"); if (vertexSpacing == EvsNone) @@ -730,8 +721,6 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled) break; case EShLangCompute: break; - -#ifdef NV_EXTENSIONS case EShLangRayGenNV: case EShLangIntersectNV: case EShLangAnyHitNV: @@ -764,8 +753,6 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled) if (numTaskNVBlocks > 1) error(infoSink, "Only one taskNV interface block is allowed per shader"); break; -#endif - default: error(infoSink, "Unknown Stage."); break; @@ -787,6 +774,7 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled) } finalLinkTraverser; treeRoot->traverse(&finalLinkTraverser); +#endif } // @@ -973,7 +961,7 @@ void TIntermediate::inOutLocationCheck(TInfoSink& infoSink) } } - if (profile == EEsProfile) { + if (isEsProfile()) { if (numFragOut > 1 && fragOutWithNoLocation) error(infoSink, "when more than one fragment shader output, all must have location qualifiers"); } @@ -1066,6 +1054,7 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ // So, for the case of dvec3, we need two independent ioRanges. int collision = -1; // no collision +#ifndef GLSLANG_WEB if (size == 2 && type.getBasicType() == EbtDouble && type.getVectorSize() == 3 && (qualifier.isPipeInput() || qualifier.isPipeOutput())) { // Dealing with dvec3 in/out split across two locations. @@ -1092,7 +1081,9 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ if (collision < 0) usedIo[set].push_back(range2); } - } else { + } else +#endif + { // Not a dvec3 in/out split across two locations, generic path. // Need a single IO-range block. @@ -1106,10 +1097,10 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ } // combine location and component ranges - TIoRange range(locationRange, componentRange, type.getBasicType(), qualifier.hasIndex() ? qualifier.layoutIndex : 0); + TIoRange range(locationRange, componentRange, type.getBasicType(), qualifier.hasIndex() ? qualifier.getIndex() : 0); // check for collisions, except for vertex inputs on desktop targeting OpenGL - if (! (profile != EEsProfile && language == EShLangVertex && qualifier.isPipeInput()) || spvVersion.vulkan > 0) + if (! (!isEsProfile() && language == EShLangVertex && qualifier.isPipeInput()) || spvVersion.vulkan > 0) collision = checkLocationRange(set, range, type, typeCollision); if (collision < 0) @@ -1187,14 +1178,10 @@ int TIntermediate::computeTypeLocationSize(const TType& type, EShLanguage stage) // TODO: perf: this can be flattened by using getCumulativeArraySize(), and a deref that discards all arrayness // TODO: are there valid cases of having an unsized array with a location? If so, running this code too early. TType elementType(type, 0); - if (type.isSizedArray() -#ifdef NV_EXTENSIONS - && !type.getQualifier().isPerView() -#endif - ) + if (type.isSizedArray() && !type.getQualifier().isPerView()) return type.getOuterArraySize() * computeTypeLocationSize(elementType, stage); else { -#ifdef NV_EXTENSIONS +#ifndef GLSLANG_WEB // unset perViewNV attributes for arrayed per-view outputs: "perviewNV vec4 v[MAX_VIEWS][3];" elementType.getQualifier().perViewNV = false; #endif @@ -1273,6 +1260,8 @@ int TIntermediate::computeTypeUniformLocationSize(const TType& type) return 1; } +#ifndef GLSLANG_WEB + // Accumulate xfb buffer ranges and check for collisions as the accumulation is done. // // Returns < 0 if no collision, >= 0 if collision and the value returned is a colliding value. @@ -1285,11 +1274,7 @@ int TIntermediate::addXfbBufferOffset(const TType& type) TXfbBuffer& buffer = xfbBuffers[qualifier.layoutXfbBuffer]; // compute the range -#ifdef AMD_EXTENSIONS unsigned int size = computeTypeXfbSize(type, buffer.contains64BitType, buffer.contains32BitType, buffer.contains16BitType); -#else - unsigned int size = computeTypeXfbSize(type, buffer.contains64BitType); -#endif buffer.implicitStride = std::max(buffer.implicitStride, qualifier.layoutXfbOffset + size); TRange range(qualifier.layoutXfbOffset, qualifier.layoutXfbOffset + size - 1); @@ -1309,15 +1294,10 @@ int TIntermediate::addXfbBufferOffset(const TType& type) // Recursively figure out how many bytes of xfb buffer are used by the given type. // Return the size of type, in bytes. // Sets contains64BitType to true if the type contains a 64-bit data type. -#ifdef AMD_EXTENSIONS // Sets contains32BitType to true if the type contains a 32-bit data type. // Sets contains16BitType to true if the type contains a 16-bit data type. // N.B. Caller must set contains64BitType, contains32BitType, and contains16BitType to false before calling. unsigned int TIntermediate::computeTypeXfbSize(const TType& type, bool& contains64BitType, bool& contains32BitType, bool& contains16BitType) const -#else -// N.B. Caller must set contains64BitType to false before calling. -unsigned int TIntermediate::computeTypeXfbSize(const TType& type, bool& contains64BitType) const -#endif { // "...if applied to an aggregate containing a double or 64-bit integer, the offset must also be a multiple of 8, // and the space taken in the buffer will be a multiple of 8. @@ -1330,44 +1310,32 @@ unsigned int TIntermediate::computeTypeXfbSize(const TType& type, bool& contains // TODO: perf: this can be flattened by using getCumulativeArraySize(), and a deref that discards all arrayness assert(type.isSizedArray()); TType elementType(type, 0); -#ifdef AMD_EXTENSIONS return type.getOuterArraySize() * computeTypeXfbSize(elementType, contains64BitType, contains16BitType, contains16BitType); -#else - return type.getOuterArraySize() * computeTypeXfbSize(elementType, contains64BitType); -#endif } if (type.isStruct()) { unsigned int size = 0; bool structContains64BitType = false; -#ifdef AMD_EXTENSIONS bool structContains32BitType = false; bool structContains16BitType = false; -#endif for (int member = 0; member < (int)type.getStruct()->size(); ++member) { TType memberType(type, member); // "... if applied to // an aggregate containing a double or 64-bit integer, the offset must also be a multiple of 8, // and the space taken in the buffer will be a multiple of 8." bool memberContains64BitType = false; -#ifdef AMD_EXTENSIONS bool memberContains32BitType = false; bool memberContains16BitType = false; int memberSize = computeTypeXfbSize(memberType, memberContains64BitType, memberContains32BitType, memberContains16BitType); -#else - int memberSize = computeTypeXfbSize(memberType, memberContains64BitType); -#endif if (memberContains64BitType) { structContains64BitType = true; RoundToPow2(size, 8); -#ifdef AMD_EXTENSIONS } else if (memberContains32BitType) { structContains32BitType = true; RoundToPow2(size, 4); } else if (memberContains16BitType) { structContains16BitType = true; RoundToPow2(size, 2); -#endif } size += memberSize; } @@ -1375,14 +1343,12 @@ unsigned int TIntermediate::computeTypeXfbSize(const TType& type, bool& contains if (structContains64BitType) { contains64BitType = true; RoundToPow2(size, 8); -#ifdef AMD_EXTENSIONS } else if (structContains32BitType) { contains32BitType = true; RoundToPow2(size, 4); } else if (structContains16BitType) { contains16BitType = true; RoundToPow2(size, 2); -#endif } return size; } @@ -1402,7 +1368,6 @@ unsigned int TIntermediate::computeTypeXfbSize(const TType& type, bool& contains if (type.getBasicType() == EbtDouble || type.getBasicType() == EbtInt64 || type.getBasicType() == EbtUint64) { contains64BitType = true; return 8 * numComponents; -#ifdef AMD_EXTENSIONS } else if (type.getBasicType() == EbtFloat16 || type.getBasicType() == EbtInt16 || type.getBasicType() == EbtUint16) { contains16BitType = true; return 2 * numComponents; @@ -1412,12 +1377,10 @@ unsigned int TIntermediate::computeTypeXfbSize(const TType& type, bool& contains contains32BitType = true; return 4 * numComponents; } -#else - } else - return 4 * numComponents; -#endif } +#endif + const int baseAlignmentVec4Std140 = 16; // Return the size and alignment of a component of the given type. @@ -1425,6 +1388,10 @@ const int baseAlignmentVec4Std140 = 16; // Return value is the alignment.. int TIntermediate::getBaseAlignmentScalar(const TType& type, int& size) { +#ifdef GLSLANG_WEB + size = 4; return 4; +#endif + switch (type.getBasicType()) { case EbtInt64: case EbtUint64: @@ -1741,7 +1708,7 @@ int TIntermediate::getBlockSize(const TType& blockType) int TIntermediate::computeBufferReferenceTypeSize(const TType& type) { - assert(type.getBasicType() == EbtReference); + assert(type.isReference()); int size = getBlockSize(*type.getReferentType()); int align = type.getBufferReferenceAlignment(); diff --git a/thirdparty/glslang/glslang/MachineIndependent/localintermediate.h b/thirdparty/glslang/glslang/MachineIndependent/localintermediate.h index f29c93c08e..683290af74 100644 --- a/thirdparty/glslang/glslang/MachineIndependent/localintermediate.h +++ b/thirdparty/glslang/glslang/MachineIndependent/localintermediate.h @@ -147,23 +147,19 @@ struct TOffsetRange { TRange offset; }; +#ifndef GLSLANG_WEB // Things that need to be tracked per xfb buffer. struct TXfbBuffer { -#ifdef AMD_EXTENSIONS TXfbBuffer() : stride(TQualifier::layoutXfbStrideEnd), implicitStride(0), contains64BitType(false), contains32BitType(false), contains16BitType(false) { } -#else - TXfbBuffer() : stride(TQualifier::layoutXfbStrideEnd), implicitStride(0), contains64BitType(false) { } -#endif std::vector<TRange> ranges; // byte offsets that have already been assigned unsigned int stride; unsigned int implicitStride; bool contains64BitType; -#ifdef AMD_EXTENSIONS bool contains32BitType; bool contains16BitType; -#endif }; +#endif // Track a set of strings describing how the module was processed. // Using the form: @@ -217,7 +213,6 @@ class TSymbolTable; class TSymbol; class TVariable; -#ifdef NV_EXTENSIONS // // Texture and Sampler transformation mode. // @@ -226,7 +221,6 @@ enum ComputeDerivativeMode { LayoutDerivativeGroupQuads, // derivative_group_quadsNV LayoutDerivativeGroupLinear, // derivative_group_linearNV }; -#endif // // Set of helper functions to help parse and build the tree. @@ -234,32 +228,36 @@ enum ComputeDerivativeMode { class TIntermediate { public: explicit TIntermediate(EShLanguage l, int v = 0, EProfile p = ENoProfile) : - implicitThisName("@this"), implicitCounterName("@count"), - language(l), source(EShSourceNone), profile(p), version(v), treeRoot(0), + language(l), + profile(p), version(v), treeRoot(0), numEntryPoints(0), numErrors(0), numPushConstants(0), recursive(false), + invertY(false), + useStorageBuffer(false), + nanMinMaxClamp(false), + depthReplacing(false) +#ifndef GLSLANG_WEB + , + implicitThisName("@this"), implicitCounterName("@count"), + source(EShSourceNone), + useVulkanMemoryModel(false), invocations(TQualifier::layoutNotSet), vertices(TQualifier::layoutNotSet), inputPrimitive(ElgNone), outputPrimitive(ElgNone), pixelCenterInteger(false), originUpperLeft(false), - vertexSpacing(EvsNone), vertexOrder(EvoNone), pointMode(false), earlyFragmentTests(false), - postDepthCoverage(false), depthLayout(EldNone), depthReplacing(false), + vertexSpacing(EvsNone), vertexOrder(EvoNone), interlockOrdering(EioNone), pointMode(false), earlyFragmentTests(false), + postDepthCoverage(false), depthLayout(EldNone), hlslFunctionality1(false), blendEquations(0), xfbMode(false), multiStream(false), -#ifdef NV_EXTENSIONS layoutOverrideCoverage(false), geoPassthroughEXT(false), numShaderRecordNVBlocks(0), computeDerivativeMode(LayoutDerivativeNone), primitives(TQualifier::layoutNotSet), numTaskNVBlocks(0), -#endif autoMapBindings(false), autoMapLocations(false), - invertY(false), flattenUniformArrays(false), useUnknownFormat(false), hlslOffsets(false), - useStorageBuffer(false), - useVulkanMemoryModel(false), hlslIoMapping(false), useVariablePointers(false), textureSamplerTransformMode(EShTexSampTransKeep), @@ -267,160 +265,22 @@ public: binaryDoubleOutput(false), usePhysicalStorageBuffer(false), uniformLocationBase(0) +#endif { localSize[0] = 1; localSize[1] = 1; localSize[2] = 1; + localSizeNotDefault[0] = false; + localSizeNotDefault[1] = false; + localSizeNotDefault[2] = false; localSizeSpecId[0] = TQualifier::layoutNotSet; localSizeSpecId[1] = TQualifier::layoutNotSet; localSizeSpecId[2] = TQualifier::layoutNotSet; +#ifndef GLSLANG_WEB xfbBuffers.resize(TQualifier::layoutXfbBufferEnd); - shiftBinding.fill(0); +#endif } - void setLimits(const TBuiltInResource& r) { resources = r; } - - bool postProcess(TIntermNode*, EShLanguage); - void output(TInfoSink&, bool tree); - void removeTree(); - - void setSource(EShSource s) { source = s; } - EShSource getSource() const { return source; } - void setEntryPointName(const char* ep) - { - entryPointName = ep; - processes.addProcess("entry-point"); - processes.addArgument(entryPointName); - } - void setEntryPointMangledName(const char* ep) { entryPointMangledName = ep; } - const std::string& getEntryPointName() const { return entryPointName; } - const std::string& getEntryPointMangledName() const { return entryPointMangledName; } - - void setShiftBinding(TResourceType res, unsigned int shift) - { - shiftBinding[res] = shift; - - const char* name = getResourceName(res); - if (name != nullptr) - processes.addIfNonZero(name, shift); - } - - unsigned int getShiftBinding(TResourceType res) const { return shiftBinding[res]; } - - void setShiftBindingForSet(TResourceType res, unsigned int shift, unsigned int set) - { - if (shift == 0) // ignore if there's no shift: it's a no-op. - return; - - shiftBindingForSet[res][set] = shift; - - const char* name = getResourceName(res); - if (name != nullptr) { - processes.addProcess(name); - processes.addArgument(shift); - processes.addArgument(set); - } - } - - int getShiftBindingForSet(TResourceType res, unsigned int set) const - { - const auto shift = shiftBindingForSet[res].find(set); - return shift == shiftBindingForSet[res].end() ? -1 : shift->second; - } - bool hasShiftBindingForSet(TResourceType res) const { return !shiftBindingForSet[res].empty(); } - - void setResourceSetBinding(const std::vector<std::string>& shift) - { - resourceSetBinding = shift; - if (shift.size() > 0) { - processes.addProcess("resource-set-binding"); - for (int s = 0; s < (int)shift.size(); ++s) - processes.addArgument(shift[s]); - } - } - const std::vector<std::string>& getResourceSetBinding() const { return resourceSetBinding; } - void setAutoMapBindings(bool map) - { - autoMapBindings = map; - if (autoMapBindings) - processes.addProcess("auto-map-bindings"); - } - bool getAutoMapBindings() const { return autoMapBindings; } - void setAutoMapLocations(bool map) - { - autoMapLocations = map; - if (autoMapLocations) - processes.addProcess("auto-map-locations"); - } - bool getAutoMapLocations() const { return autoMapLocations; } - void setInvertY(bool invert) - { - invertY = invert; - if (invertY) - processes.addProcess("invert-y"); - } - bool getInvertY() const { return invertY; } - - void setFlattenUniformArrays(bool flatten) - { - flattenUniformArrays = flatten; - if (flattenUniformArrays) - processes.addProcess("flatten-uniform-arrays"); - } - bool getFlattenUniformArrays() const { return flattenUniformArrays; } - void setNoStorageFormat(bool b) - { - useUnknownFormat = b; - if (useUnknownFormat) - processes.addProcess("no-storage-format"); - } - bool getNoStorageFormat() const { return useUnknownFormat; } - void setHlslOffsets() - { - hlslOffsets = true; - if (hlslOffsets) - processes.addProcess("hlsl-offsets"); - } - bool usingHlslOffsets() const { return hlslOffsets; } - void setUseStorageBuffer() - { - useStorageBuffer = true; - processes.addProcess("use-storage-buffer"); - } - bool usingStorageBuffer() const { return useStorageBuffer; } - void setHlslIoMapping(bool b) - { - hlslIoMapping = b; - if (hlslIoMapping) - processes.addProcess("hlsl-iomap"); - } - bool usingHlslIoMapping() { return hlslIoMapping; } - void setUseVulkanMemoryModel() - { - useVulkanMemoryModel = true; - processes.addProcess("use-vulkan-memory-model"); - } - bool usingVulkanMemoryModel() const { return useVulkanMemoryModel; } - void setUsePhysicalStorageBuffer() - { - usePhysicalStorageBuffer = true; - } - bool usingPhysicalStorageBuffer() const { return usePhysicalStorageBuffer; } - void setUseVariablePointers() - { - useVariablePointers = true; - processes.addProcess("use-variable-pointers"); - } - bool usingVariablePointers() const { return useVariablePointers; } - - template<class T> T addCounterBufferName(const T& name) const { return name + implicitCounterName; } - bool hasCounterBufferName(const TString& name) const { - size_t len = strlen(implicitCounterName); - return name.size() > len && - name.compare(name.size() - len, len, implicitCounterName) == 0; - } - - void setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode) { textureSamplerTransformMode = mode; } void setVersion(int v) { version = v; } int getVersion() const { return version; } @@ -451,6 +311,12 @@ public: case EShTargetSpv_1_3: processes.addProcess("target-env spirv1.3"); break; + case EShTargetSpv_1_4: + processes.addProcess("target-env spirv1.4"); + break; + case EShTargetSpv_1_5: + processes.addProcess("target-env spirv1.5"); + break; default: processes.addProcess("target-env spirvUnknown"); break; @@ -466,6 +332,9 @@ public: case EShTargetVulkan_1_1: processes.addProcess("target-env vulkan1.1"); break; + case EShTargetVulkan_1_2: + processes.addProcess("target-env vulkan1.2"); + break; default: processes.addProcess("target-env vulkanUnknown"); break; @@ -484,9 +353,35 @@ public: int getNumEntryPoints() const { return numEntryPoints; } int getNumErrors() const { return numErrors; } void addPushConstantCount() { ++numPushConstants; } -#ifdef NV_EXTENSIONS - void addShaderRecordNVCount() { ++numShaderRecordNVBlocks; } - void addTaskNVCount() { ++numTaskNVBlocks; } + void setLimits(const TBuiltInResource& r) { resources = r; } + + bool postProcess(TIntermNode*, EShLanguage); + void removeTree(); + + void setEntryPointName(const char* ep) + { + entryPointName = ep; + processes.addProcess("entry-point"); + processes.addArgument(entryPointName); + } + void setEntryPointMangledName(const char* ep) { entryPointMangledName = ep; } + const std::string& getEntryPointName() const { return entryPointName; } + const std::string& getEntryPointMangledName() const { return entryPointMangledName; } + + void setInvertY(bool invert) + { + invertY = invert; + if (invertY) + processes.addProcess("invert-y"); + } + bool getInvertY() const { return invertY; } + +#ifdef ENABLE_HLSL + void setSource(EShSource s) { source = s; } + EShSource getSource() const { return source; } +#else + void setSource(EShSource s) { assert(s == EShSourceGlsl); } + EShSource getSource() const { return EShSourceGlsl; } #endif bool isRecursive() const { return recursive; } @@ -565,6 +460,169 @@ public: void addSymbolLinkageNodes(TIntermAggregate*& linkage, EShLanguage, TSymbolTable&); void addSymbolLinkageNode(TIntermAggregate*& linkage, const TSymbol&); + void setUseStorageBuffer() + { + useStorageBuffer = true; + processes.addProcess("use-storage-buffer"); + } + bool usingStorageBuffer() const { return useStorageBuffer; } + void setDepthReplacing() { depthReplacing = true; } + bool isDepthReplacing() const { return depthReplacing; } + bool setLocalSize(int dim, int size) + { + if (localSizeNotDefault[dim]) + return size == localSize[dim]; + localSizeNotDefault[dim] = true; + localSize[dim] = size; + return true; + } + unsigned int getLocalSize(int dim) const { return localSize[dim]; } + bool setLocalSizeSpecId(int dim, int id) + { + if (localSizeSpecId[dim] != TQualifier::layoutNotSet) + return id == localSizeSpecId[dim]; + localSizeSpecId[dim] = id; + return true; + } + int getLocalSizeSpecId(int dim) const { return localSizeSpecId[dim]; } +#ifdef GLSLANG_WEB + void output(TInfoSink&, bool tree) { } + + bool isEsProfile() const { return false; } + bool getXfbMode() const { return false; } + bool isMultiStream() const { return false; } + TLayoutGeometry getOutputPrimitive() const { return ElgNone; } + bool getPostDepthCoverage() const { return false; } + bool getEarlyFragmentTests() const { return false; } + TLayoutDepth getDepth() const { return EldNone; } + bool getPixelCenterInteger() const { return false; } + void setOriginUpperLeft() { } + bool getOriginUpperLeft() const { return true; } + TInterlockOrdering getInterlockOrdering() const { return EioNone; } + + bool getAutoMapBindings() const { return false; } + bool getAutoMapLocations() const { return false; } + int getNumPushConstants() const { return 0; } + void addShaderRecordNVCount() { } + void addTaskNVCount() { } + void setUseVulkanMemoryModel() { } + bool usingVulkanMemoryModel() const { return false; } + bool usingPhysicalStorageBuffer() const { return false; } + bool usingVariablePointers() const { return false; } + unsigned getXfbStride(int buffer) const { return 0; } + bool hasLayoutDerivativeModeNone() const { return false; } + ComputeDerivativeMode getLayoutDerivativeModeNone() const { return LayoutDerivativeNone; } +#else + void output(TInfoSink&, bool tree); + + bool isEsProfile() const { return profile == EEsProfile; } + + void setShiftBinding(TResourceType res, unsigned int shift) + { + shiftBinding[res] = shift; + + const char* name = getResourceName(res); + if (name != nullptr) + processes.addIfNonZero(name, shift); + } + + unsigned int getShiftBinding(TResourceType res) const { return shiftBinding[res]; } + + void setShiftBindingForSet(TResourceType res, unsigned int shift, unsigned int set) + { + if (shift == 0) // ignore if there's no shift: it's a no-op. + return; + + shiftBindingForSet[res][set] = shift; + + const char* name = getResourceName(res); + if (name != nullptr) { + processes.addProcess(name); + processes.addArgument(shift); + processes.addArgument(set); + } + } + + int getShiftBindingForSet(TResourceType res, unsigned int set) const + { + const auto shift = shiftBindingForSet[res].find(set); + return shift == shiftBindingForSet[res].end() ? -1 : shift->second; + } + bool hasShiftBindingForSet(TResourceType res) const { return !shiftBindingForSet[res].empty(); } + + void setResourceSetBinding(const std::vector<std::string>& shift) + { + resourceSetBinding = shift; + if (shift.size() > 0) { + processes.addProcess("resource-set-binding"); + for (int s = 0; s < (int)shift.size(); ++s) + processes.addArgument(shift[s]); + } + } + const std::vector<std::string>& getResourceSetBinding() const { return resourceSetBinding; } + void setAutoMapBindings(bool map) + { + autoMapBindings = map; + if (autoMapBindings) + processes.addProcess("auto-map-bindings"); + } + bool getAutoMapBindings() const { return autoMapBindings; } + void setAutoMapLocations(bool map) + { + autoMapLocations = map; + if (autoMapLocations) + processes.addProcess("auto-map-locations"); + } + bool getAutoMapLocations() const { return autoMapLocations; } + +#ifdef ENABLE_HLSL + void setFlattenUniformArrays(bool flatten) + { + flattenUniformArrays = flatten; + if (flattenUniformArrays) + processes.addProcess("flatten-uniform-arrays"); + } + bool getFlattenUniformArrays() const { return flattenUniformArrays; } +#endif + void setNoStorageFormat(bool b) + { + useUnknownFormat = b; + if (useUnknownFormat) + processes.addProcess("no-storage-format"); + } + bool getNoStorageFormat() const { return useUnknownFormat; } + void setUseVulkanMemoryModel() + { + useVulkanMemoryModel = true; + processes.addProcess("use-vulkan-memory-model"); + } + bool usingVulkanMemoryModel() const { return useVulkanMemoryModel; } + void setUsePhysicalStorageBuffer() + { + usePhysicalStorageBuffer = true; + } + bool usingPhysicalStorageBuffer() const { return usePhysicalStorageBuffer; } + void setUseVariablePointers() + { + useVariablePointers = true; + processes.addProcess("use-variable-pointers"); + } + bool usingVariablePointers() const { return useVariablePointers; } + +#ifdef ENABLE_HLSL + template<class T> T addCounterBufferName(const T& name) const { return name + implicitCounterName; } + bool hasCounterBufferName(const TString& name) const { + size_t len = strlen(implicitCounterName); + return name.size() > len && + name.compare(name.size() - len, len, implicitCounterName) == 0; + } +#endif + + void setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode) { textureSamplerTransformMode = mode; } + int getNumPushConstants() const { return numPushConstants; } + void addShaderRecordNVCount() { ++numShaderRecordNVBlocks; } + void addTaskNVCount() { ++numTaskNVBlocks; } + bool setInvocations(int i) { if (invocations != TQualifier::layoutNotSet) @@ -608,23 +666,14 @@ public: void setPointMode() { pointMode = true; } bool getPointMode() const { return pointMode; } - bool setLocalSize(int dim, int size) - { - if (localSize[dim] > 1) - return size == localSize[dim]; - localSize[dim] = size; - return true; - } - unsigned int getLocalSize(int dim) const { return localSize[dim]; } - - bool setLocalSizeSpecId(int dim, int id) + bool setInterlockOrdering(TInterlockOrdering o) { - if (localSizeSpecId[dim] != TQualifier::layoutNotSet) - return id == localSizeSpecId[dim]; - localSizeSpecId[dim] = id; + if (interlockOrdering != EioNone) + return interlockOrdering == o; + interlockOrdering = o; return true; } - int getLocalSizeSpecId(int dim) const { return localSizeSpecId[dim]; } + TInterlockOrdering getInterlockOrdering() const { return interlockOrdering; } void setXfbMode() { xfbMode = true; } bool getXfbMode() const { return xfbMode; } @@ -638,14 +687,10 @@ public: return true; } TLayoutGeometry getOutputPrimitive() const { return outputPrimitive; } - void setOriginUpperLeft() { originUpperLeft = true; } - bool getOriginUpperLeft() const { return originUpperLeft; } - void setPixelCenterInteger() { pixelCenterInteger = true; } - bool getPixelCenterInteger() const { return pixelCenterInteger; } - void setEarlyFragmentTests() { earlyFragmentTests = true; } - bool getEarlyFragmentTests() const { return earlyFragmentTests; } void setPostDepthCoverage() { postDepthCoverage = true; } bool getPostDepthCoverage() const { return postDepthCoverage; } + void setEarlyFragmentTests() { earlyFragmentTests = true; } + bool getEarlyFragmentTests() const { return earlyFragmentTests; } bool setDepth(TLayoutDepth d) { if (depthLayout != EldNone) @@ -654,29 +699,12 @@ public: return true; } TLayoutDepth getDepth() const { return depthLayout; } - void setDepthReplacing() { depthReplacing = true; } - bool isDepthReplacing() const { return depthReplacing; } - - void setHlslFunctionality1() { hlslFunctionality1 = true; } - bool getHlslFunctionality1() const { return hlslFunctionality1; } - + void setOriginUpperLeft() { originUpperLeft = true; } + bool getOriginUpperLeft() const { return originUpperLeft; } + void setPixelCenterInteger() { pixelCenterInteger = true; } + bool getPixelCenterInteger() const { return pixelCenterInteger; } void addBlendEquation(TBlendEquationShift b) { blendEquations |= (1 << b); } unsigned int getBlendEquations() const { return blendEquations; } - - void addToCallGraph(TInfoSink&, const TString& caller, const TString& callee); - void merge(TInfoSink&, TIntermediate&); - void finalCheck(TInfoSink&, bool keepUncalled); - - void addIoAccessed(const TString& name) { ioAccessed.insert(name); } - bool inIoAccessed(const TString& name) const { return ioAccessed.find(name) != ioAccessed.end(); } - - int addUsedLocation(const TQualifier&, const TType&, bool& typeCollision); - int checkLocationRange(int set, const TIoRange& range, const TType&, bool& typeCollision); - int addUsedOffsets(int binding, int offset, int numOffsets); - bool addUsedConstantId(int id); - static int computeTypeLocationSize(const TType&, EShLanguage); - static int computeTypeUniformLocationSize(const TType&); - bool setXfbBufferStride(int buffer, unsigned stride) { if (xfbBuffers[buffer].stride != TQualifier::layoutXfbStrideEnd) @@ -686,28 +714,14 @@ public: } unsigned getXfbStride(int buffer) const { return xfbBuffers[buffer].stride; } int addXfbBufferOffset(const TType&); -#ifdef AMD_EXTENSIONS unsigned int computeTypeXfbSize(const TType&, bool& contains64BitType, bool& contains32BitType, bool& contains16BitType) const; -#else unsigned int computeTypeXfbSize(const TType&, bool& contains64BitType) const; -#endif - static int getBaseAlignmentScalar(const TType&, int& size); - static int getBaseAlignment(const TType&, int& size, int& stride, TLayoutPacking layoutPacking, bool rowMajor); - static int getScalarAlignment(const TType&, int& size, int& stride, bool rowMajor); - static int getMemberAlignment(const TType&, int& size, int& stride, TLayoutPacking layoutPacking, bool rowMajor); - static bool improperStraddle(const TType& type, int size, int offset); - static void updateOffset(const TType& parentType, const TType& memberType, int& offset, int& memberSize); - static int getOffset(const TType& type, int index); - static int getBlockSize(const TType& blockType); - static int computeBufferReferenceTypeSize(const TType&); - bool promote(TIntermOperator*); - -#ifdef NV_EXTENSIONS void setLayoutOverrideCoverage() { layoutOverrideCoverage = true; } bool getLayoutOverrideCoverage() const { return layoutOverrideCoverage; } void setGeoPassthroughEXT() { geoPassthroughEXT = true; } bool getGeoPassthroughEXT() const { return geoPassthroughEXT; } void setLayoutDerivativeMode(ComputeDerivativeMode mode) { computeDerivativeMode = mode; } + bool hasLayoutDerivativeModeNone() const { return computeDerivativeMode != LayoutDerivativeNone; } ComputeDerivativeMode getLayoutDerivativeModeNone() const { return computeDerivativeMode; } bool setPrimitives(int m) { @@ -717,28 +731,10 @@ public: return true; } int getPrimitives() const { return primitives; } -#endif - const char* addSemanticName(const TString& name) { return semanticNameSet.insert(name).first->c_str(); } - - void setSourceFile(const char* file) { if (file != nullptr) sourceFile = file; } - const std::string& getSourceFile() const { return sourceFile; } - void addSourceText(const char* text, size_t len) { sourceText.append(text, len); } - const std::string& getSourceText() const { return sourceText; } - const std::map<std::string, std::string>& getIncludeText() const { return includeText; } - void addIncludeText(const char* name, const char* text, size_t len) { includeText[name].assign(text,len); } - void addProcesses(const std::vector<std::string>& p) - { - for (int i = 0; i < (int)p.size(); ++i) - processes.addProcess(p[i]); - } - void addProcess(const std::string& process) { processes.addProcess(process); } - void addProcessArgument(const std::string& arg) { processes.addArgument(arg); } - const std::vector<std::string>& getProcesses() const { return processes.getProcesses(); } - void addUniformLocationOverride(const char* nameStr, int location) { std::string name = nameStr; @@ -763,9 +759,98 @@ public: void setBinaryDoubleOutput() { binaryDoubleOutput = true; } bool getBinaryDoubleOutput() { return binaryDoubleOutput; } +#endif // GLSLANG_WEB - const char* const implicitThisName; - const char* const implicitCounterName; +#ifdef ENABLE_HLSL + void setHlslFunctionality1() { hlslFunctionality1 = true; } + bool getHlslFunctionality1() const { return hlslFunctionality1; } + void setHlslOffsets() + { + hlslOffsets = true; + if (hlslOffsets) + processes.addProcess("hlsl-offsets"); + } + bool usingHlslOffsets() const { return hlslOffsets; } + void setHlslIoMapping(bool b) + { + hlslIoMapping = b; + if (hlslIoMapping) + processes.addProcess("hlsl-iomap"); + } + bool usingHlslIoMapping() { return hlslIoMapping; } +#else + bool getHlslFunctionality1() const { return false; } + bool usingHlslOffsets() const { return false; } + bool usingHlslIoMapping() { return false; } +#endif + + void addToCallGraph(TInfoSink&, const TString& caller, const TString& callee); + void merge(TInfoSink&, TIntermediate&); + void finalCheck(TInfoSink&, bool keepUncalled); + + bool buildConvertOp(TBasicType dst, TBasicType src, TOperator& convertOp) const; + TIntermTyped* createConversion(TBasicType convertTo, TIntermTyped* node) const; + + void addIoAccessed(const TString& name) { ioAccessed.insert(name); } + bool inIoAccessed(const TString& name) const { return ioAccessed.find(name) != ioAccessed.end(); } + + int addUsedLocation(const TQualifier&, const TType&, bool& typeCollision); + int checkLocationRange(int set, const TIoRange& range, const TType&, bool& typeCollision); + int addUsedOffsets(int binding, int offset, int numOffsets); + bool addUsedConstantId(int id); + static int computeTypeLocationSize(const TType&, EShLanguage); + static int computeTypeUniformLocationSize(const TType&); + + static int getBaseAlignmentScalar(const TType&, int& size); + static int getBaseAlignment(const TType&, int& size, int& stride, TLayoutPacking layoutPacking, bool rowMajor); + static int getScalarAlignment(const TType&, int& size, int& stride, bool rowMajor); + static int getMemberAlignment(const TType&, int& size, int& stride, TLayoutPacking layoutPacking, bool rowMajor); + static bool improperStraddle(const TType& type, int size, int offset); + static void updateOffset(const TType& parentType, const TType& memberType, int& offset, int& memberSize); + static int getOffset(const TType& type, int index); + static int getBlockSize(const TType& blockType); + static int computeBufferReferenceTypeSize(const TType&); + bool promote(TIntermOperator*); + void setNanMinMaxClamp(bool setting) { nanMinMaxClamp = setting; } + bool getNanMinMaxClamp() const { return nanMinMaxClamp; } + + void setSourceFile(const char* file) { if (file != nullptr) sourceFile = file; } + const std::string& getSourceFile() const { return sourceFile; } + void addSourceText(const char* text, size_t len) { sourceText.append(text, len); } + const std::string& getSourceText() const { return sourceText; } + const std::map<std::string, std::string>& getIncludeText() const { return includeText; } + void addIncludeText(const char* name, const char* text, size_t len) { includeText[name].assign(text,len); } + void addProcesses(const std::vector<std::string>& p) + { + for (int i = 0; i < (int)p.size(); ++i) + processes.addProcess(p[i]); + } + void addProcess(const std::string& process) { processes.addProcess(process); } + void addProcessArgument(const std::string& arg) { processes.addArgument(arg); } + const std::vector<std::string>& getProcesses() const { return processes.getProcesses(); } + + // Certain explicit conversions are allowed conditionally +#ifdef GLSLANG_WEB + bool getArithemeticInt8Enabled() const { return false; } + bool getArithemeticInt16Enabled() const { return false; } + bool getArithemeticFloat16Enabled() const { return false; } +#else + bool getArithemeticInt8Enabled() const { + return extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) || + extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int8); + } + bool getArithemeticInt16Enabled() const { + return extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) || + extensionRequested(E_GL_AMD_gpu_shader_int16) || + extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int16); + } + + bool getArithemeticFloat16Enabled() const { + return extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) || + extensionRequested(E_GL_AMD_gpu_shader_half_float) || + extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_float16); + } +#endif protected: TIntermSymbol* addSymbol(int Id, const TString&, const TType&, const TConstUnionArray&, TIntermTyped* subtree, const TSourceLoc&); @@ -796,13 +881,21 @@ protected: bool specConstantPropagates(const TIntermTyped&, const TIntermTyped&); void performTextureUpgradeAndSamplerRemovalTransformation(TIntermNode* root); bool isConversionAllowed(TOperator op, TIntermTyped* node) const; - TIntermTyped* createConversion(TBasicType convertTo, TIntermTyped* node) const; std::tuple<TBasicType, TBasicType> getConversionDestinatonType(TBasicType type0, TBasicType type1, TOperator op) const; + + // JohnK: I think this function should go away. + // This data structure is just a log to pass on to back ends. + // Versioning and extensions are handled in Version.cpp, with a rich + // set of functions for querying stages, versions, extension enable/disabled, etc. +#ifdef GLSLANG_WEB + bool extensionRequested(const char *extension) const { return false; } +#else bool extensionRequested(const char *extension) const {return requestedExtensions.find(extension) != requestedExtensions.end();} +#endif + static const char* getResourceName(TResourceType); const EShLanguage language; // stage, known at construction time - EShSource source; // source language, known a bit later std::string entryPointName; std::string entryPointMangledName; typedef std::list<TCall> TGraph; @@ -818,6 +911,20 @@ protected: int numErrors; int numPushConstants; bool recursive; + bool invertY; + bool useStorageBuffer; + bool nanMinMaxClamp; // true if desiring min/max/clamp to favor non-NaN over NaN + bool depthReplacing; + int localSize[3]; + bool localSizeNotDefault[3]; + int localSizeSpecId[3]; +#ifndef GLSLANG_WEB +public: + const char* const implicitThisName; + const char* const implicitCounterName; +protected: + EShSource source; // source language, known a bit later + bool useVulkanMemoryModel; int invocations; int vertices; TLayoutGeometry inputPrimitive; @@ -826,27 +933,22 @@ protected: bool originUpperLeft; TVertexSpacing vertexSpacing; TVertexOrder vertexOrder; + TInterlockOrdering interlockOrdering; bool pointMode; - int localSize[3]; - int localSizeSpecId[3]; bool earlyFragmentTests; bool postDepthCoverage; TLayoutDepth depthLayout; - bool depthReplacing; bool hlslFunctionality1; int blendEquations; // an 'or'ing of masks of shifts of TBlendEquationShift bool xfbMode; std::vector<TXfbBuffer> xfbBuffers; // all the data we need to track per xfb buffer bool multiStream; - -#ifdef NV_EXTENSIONS bool layoutOverrideCoverage; bool geoPassthroughEXT; int numShaderRecordNVBlocks; ComputeDerivativeMode computeDerivativeMode; int primitives; int numTaskNVBlocks; -#endif // Base shift values std::array<unsigned int, EResCount> shiftBinding; @@ -857,23 +959,29 @@ protected: std::vector<std::string> resourceSetBinding; bool autoMapBindings; bool autoMapLocations; - bool invertY; bool flattenUniformArrays; bool useUnknownFormat; bool hlslOffsets; - bool useStorageBuffer; - bool useVulkanMemoryModel; bool hlslIoMapping; bool useVariablePointers; - std::set<TString> ioAccessed; // set of names of statically read/written I/O that might need extra checking - std::vector<TIoRange> usedIo[4]; // sets of used locations, one for each of in, out, uniform, and buffers - std::vector<TOffsetRange> usedAtomics; // sets of bindings used by atomic counters - std::unordered_set<int> usedConstantId; // specialization constant ids used std::set<TString> semanticNameSet; EShTextureSamplerTransformMode textureSamplerTransformMode; + bool needToLegalize; + bool binaryDoubleOutput; + bool usePhysicalStorageBuffer; + + std::unordered_map<std::string, int> uniformLocationOverrides; + int uniformLocationBase; +#endif + + std::unordered_set<int> usedConstantId; // specialization constant ids used + std::vector<TOffsetRange> usedAtomics; // sets of bindings used by atomic counters + std::vector<TIoRange> usedIo[4]; // sets of used locations, one for each of in, out, uniform, and buffers + // set of names of statically read/written I/O that might need extra checking + std::set<TString> ioAccessed; // source code of shader, useful as part of debug information std::string sourceFile; std::string sourceText; @@ -884,13 +992,6 @@ protected: // for OpModuleProcessed, or equivalent TProcesses processes; - bool needToLegalize; - bool binaryDoubleOutput; - bool usePhysicalStorageBuffer; - - std::unordered_map<std::string, int> uniformLocationOverrides; - int uniformLocationBase; - private: void operator=(TIntermediate&); // prevent assignments }; diff --git a/thirdparty/glslang/glslang/MachineIndependent/parseVersions.h b/thirdparty/glslang/glslang/MachineIndependent/parseVersions.h index 02af76a8a3..aa1964fc2e 100644 --- a/thirdparty/glslang/glslang/MachineIndependent/parseVersions.h +++ b/thirdparty/glslang/glslang/MachineIndependent/parseVersions.h @@ -57,26 +57,91 @@ public: TParseVersions(TIntermediate& interm, int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TInfoSink& infoSink, bool forwardCompatible, EShMessages messages) - : infoSink(infoSink), version(version), profile(profile), language(language), - spvVersion(spvVersion), forwardCompatible(forwardCompatible), - intermediate(interm), messages(messages), numErrors(0), currentScanner(0) { } + : +#ifndef GLSLANG_WEB + forwardCompatible(forwardCompatible), + profile(profile), +#endif + infoSink(infoSink), version(version), + language(language), + spvVersion(spvVersion), + intermediate(interm), messages(messages), numErrors(0), currentScanner(0) { } virtual ~TParseVersions() { } + void requireStage(const TSourceLoc&, EShLanguageMask, const char* featureDesc); + void requireStage(const TSourceLoc&, EShLanguage, const char* featureDesc); +#ifdef GLSLANG_WEB + const EProfile profile = EEsProfile; + bool isEsProfile() const { return true; } + void requireProfile(const TSourceLoc& loc, int profileMask, const char* featureDesc) + { + if (! (EEsProfile & profileMask)) + error(loc, "not supported with this profile:", featureDesc, ProfileName(profile)); + } + void profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, int numExtensions, + const char* const extensions[], const char* featureDesc) + { + if ((EEsProfile & profileMask) && (minVersion == 0 || version < minVersion)) + error(loc, "not supported for this version or the enabled extensions", featureDesc, ""); + } + void profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, const char* extension, + const char* featureDesc) + { + profileRequires(loc, profileMask, minVersion, extension ? 1 : 0, &extension, featureDesc); + } + void initializeExtensionBehavior() { } + void checkDeprecated(const TSourceLoc&, int queryProfiles, int depVersion, const char* featureDesc) { } + void requireNotRemoved(const TSourceLoc&, int queryProfiles, int removedVersion, const char* featureDesc) { } + void requireExtensions(const TSourceLoc&, int numExtensions, const char* const extensions[], + const char* featureDesc) { } + void ppRequireExtensions(const TSourceLoc&, int numExtensions, const char* const extensions[], + const char* featureDesc) { } + TExtensionBehavior getExtensionBehavior(const char*) { return EBhMissing; } + bool extensionTurnedOn(const char* const extension) { return false; } + bool extensionsTurnedOn(int numExtensions, const char* const extensions[]) { return false; } + void updateExtensionBehavior(int line, const char* const extension, const char* behavior) { } + void updateExtensionBehavior(const char* const extension, TExtensionBehavior) { } + void checkExtensionStage(const TSourceLoc&, const char* const extension) { } + void fullIntegerCheck(const TSourceLoc&, const char* op) { } + void doubleCheck(const TSourceLoc&, const char* op) { } + bool float16Arithmetic() { return false; } + void requireFloat16Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc) { } + bool int16Arithmetic() { return false; } + void requireInt16Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc) { } + bool int8Arithmetic() { return false; } + void requireInt8Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc) { } + void int64Check(const TSourceLoc&, const char* op, bool builtIn = false) { } + void explicitFloat32Check(const TSourceLoc&, const char* op, bool builtIn = false) { } + void explicitFloat64Check(const TSourceLoc&, const char* op, bool builtIn = false) { } + bool relaxedErrors() const { return false; } + bool suppressWarnings() const { return true; } + bool isForwardCompatible() const { return false; } +#else + bool forwardCompatible; // true if errors are to be given for use of deprecated features + EProfile profile; // the declared profile in the shader (core by default) + bool isEsProfile() const { return profile == EEsProfile; } + void requireProfile(const TSourceLoc& loc, int profileMask, const char* featureDesc); + void profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, int numExtensions, + const char* const extensions[], const char* featureDesc); + void profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, const char* extension, + const char* featureDesc); virtual void initializeExtensionBehavior(); - virtual void requireProfile(const TSourceLoc&, int queryProfiles, const char* featureDesc); - virtual void profileRequires(const TSourceLoc&, int queryProfiles, int minVersion, int numExtensions, const char* const extensions[], const char* featureDesc); - virtual void profileRequires(const TSourceLoc&, int queryProfiles, int minVersion, const char* const extension, const char* featureDesc); - virtual void requireStage(const TSourceLoc&, EShLanguageMask, const char* featureDesc); - virtual void requireStage(const TSourceLoc&, EShLanguage, const char* featureDesc); virtual void checkDeprecated(const TSourceLoc&, int queryProfiles, int depVersion, const char* featureDesc); virtual void requireNotRemoved(const TSourceLoc&, int queryProfiles, int removedVersion, const char* featureDesc); - virtual void unimplemented(const TSourceLoc&, const char* featureDesc); - virtual void requireExtensions(const TSourceLoc&, int numExtensions, const char* const extensions[], const char* featureDesc); - virtual void ppRequireExtensions(const TSourceLoc&, int numExtensions, const char* const extensions[], const char* featureDesc); + virtual void requireExtensions(const TSourceLoc&, int numExtensions, const char* const extensions[], + const char* featureDesc); + virtual void ppRequireExtensions(const TSourceLoc&, int numExtensions, const char* const extensions[], + const char* featureDesc); virtual TExtensionBehavior getExtensionBehavior(const char*); virtual bool extensionTurnedOn(const char* const extension); virtual bool extensionsTurnedOn(int numExtensions, const char* const extensions[]); virtual void updateExtensionBehavior(int line, const char* const extension, const char* behavior); + virtual void updateExtensionBehavior(const char* const extension, TExtensionBehavior); + virtual bool checkExtensionsRequested(const TSourceLoc&, int numExtensions, const char* const extensions[], + const char* featureDesc); + virtual void checkExtensionStage(const TSourceLoc&, const char* const extension); virtual void fullIntegerCheck(const TSourceLoc&, const char* op); + + virtual void unimplemented(const TSourceLoc&, const char* featureDesc); virtual void doubleCheck(const TSourceLoc&, const char* op); virtual void float16Check(const TSourceLoc&, const char* op, bool builtIn = false); virtual void float16ScalarVectorCheck(const TSourceLoc&, const char* op, bool builtIn = false); @@ -88,24 +153,35 @@ public: virtual void int8ScalarVectorCheck(const TSourceLoc&, const char* op, bool builtIn = false); virtual bool int8Arithmetic(); virtual void requireInt8Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc); -#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 explicitInt8Check(const TSourceLoc&, const char* op, bool builtIn = false); virtual void explicitInt16Check(const TSourceLoc&, const char* op, bool builtIn = false); virtual void explicitInt32Check(const TSourceLoc&, const char* op, bool builtIn = false); virtual void explicitFloat32Check(const TSourceLoc&, const char* op, bool builtIn = false); virtual void explicitFloat64Check(const TSourceLoc&, const char* op, bool builtIn = false); + virtual void fcoopmatCheck(const TSourceLoc&, const char* op, bool builtIn = false); + virtual void intcoopmatCheck(const TSourceLoc&, const char *op, bool builtIn = false); + bool relaxedErrors() const { return (messages & EShMsgRelaxedErrors) != 0; } + bool suppressWarnings() const { return (messages & EShMsgSuppressWarnings) != 0; } + bool isForwardCompatible() const { return forwardCompatible; } +#endif // GLSLANG_WEB virtual void spvRemoved(const TSourceLoc&, const char* op); virtual void vulkanRemoved(const TSourceLoc&, const char* op); virtual void requireVulkan(const TSourceLoc&, const char* op); virtual void requireSpv(const TSourceLoc&, const char* op); - virtual bool checkExtensionsRequested(const TSourceLoc&, int numExtensions, const char* const extensions[], const char* featureDesc); - virtual void updateExtensionBehavior(const char* const extension, TExtensionBehavior); - virtual void checkExtensionStage(const TSourceLoc&, const char* const extension); - virtual void fcoopmatCheck(const TSourceLoc&, const char* op, bool builtIn = false); + +#if defined(GLSLANG_WEB) && !defined(GLSLANG_WEB_DEVEL) + void C_DECL error(const TSourceLoc&, const char* szReason, const char* szToken, + const char* szExtraInfoFormat, ...) { addError(); } + void C_DECL warn(const TSourceLoc&, const char* szReason, const char* szToken, + const char* szExtraInfoFormat, ...) { } + void C_DECL ppError(const TSourceLoc&, const char* szReason, const char* szToken, + const char* szExtraInfoFormat, ...) { addError(); } + void C_DECL ppWarn(const TSourceLoc&, const char* szReason, const char* szToken, + const char* szExtraInfoFormat, ...) { } +#else virtual void C_DECL error(const TSourceLoc&, const char* szReason, const char* szToken, const char* szExtraInfoFormat, ...) = 0; virtual void C_DECL warn(const TSourceLoc&, const char* szReason, const char* szToken, @@ -114,6 +190,7 @@ public: const char* szExtraInfoFormat, ...) = 0; virtual void C_DECL ppWarn(const TSourceLoc&, const char* szReason, const char* szToken, const char* szExtraInfoFormat, ...) = 0; +#endif void addError() { ++numErrors; } int getNumErrors() const { return numErrors; } @@ -127,20 +204,20 @@ public: void setCurrentString(int string) { currentScanner->setString(string); } void getPreamble(std::string&); - bool relaxedErrors() const { return (messages & EShMsgRelaxedErrors) != 0; } - bool suppressWarnings() const { return (messages & EShMsgSuppressWarnings) != 0; } +#ifdef ENABLE_HLSL bool isReadingHLSL() const { return (messages & EShMsgReadHlsl) == EShMsgReadHlsl; } bool hlslEnable16BitTypes() const { return (messages & EShMsgHlslEnable16BitTypes) != 0; } bool hlslDX9Compatible() const { return (messages & EShMsgHlslDX9Compatible) != 0; } +#else + bool isReadingHLSL() const { return false; } +#endif TInfoSink& infoSink; // compilation mode int version; // version, updated by #version in the shader - EProfile profile; // the declared profile in the shader (core by default) EShLanguage language; // really the stage SpvVersion spvVersion; - bool forwardCompatible; // true if errors are to be given for use of deprecated features TIntermediate& intermediate; // helper for making and hooking up pieces of the parse tree protected: diff --git a/thirdparty/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp b/thirdparty/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp index c74e44f0fd..d7ff485c0a 100644..100755 --- a/thirdparty/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp +++ b/thirdparty/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp @@ -545,7 +545,7 @@ int TPpContext::evalToToken(int token, bool shortCircuit, int& res, bool& err, T case MacroExpandStarted: break; case MacroExpandUndef: - if (! shortCircuit && parseContext.profile == EEsProfile) { + if (! shortCircuit && parseContext.isEsProfile()) { const char* message = "undefined macro in expression not allowed in es profile"; if (parseContext.relaxedErrors()) parseContext.ppWarn(ppToken->loc, message, "preprocessor evaluation", ppToken->name); @@ -722,6 +722,7 @@ int TPpContext::CPPline(TPpToken* ppToken) parseContext.setCurrentLine(lineRes); if (token != '\n') { +#ifndef GLSLANG_WEB if (token == PpAtomConstString) { parseContext.ppRequireExtensions(directiveLoc, 1, &E_GL_GOOGLE_cpp_style_line_directive, "filename-based #line"); // We need to save a copy of the string instead of pointing @@ -731,7 +732,9 @@ int TPpContext::CPPline(TPpToken* ppToken) parseContext.setCurrentSourceName(sourceName); hasFile = true; token = scanToken(ppToken); - } else { + } else +#endif + { token = eval(token, MIN_PRECEDENCE, false, fileRes, fileErr, ppToken); if (! fileErr) { parseContext.setCurrentString(fileRes); @@ -792,10 +795,8 @@ int TPpContext::CPPpragma(TPpToken* ppToken) case PpAtomConstUint: case PpAtomConstInt64: case PpAtomConstUint64: -#ifdef AMD_EXTENSIONS case PpAtomConstInt16: case PpAtomConstUint16: -#endif case PpAtomConstFloat: case PpAtomConstDouble: case PpAtomConstFloat16: @@ -954,18 +955,20 @@ int TPpContext::readCPPline(TPpToken* ppToken) case PpAtomIfndef: token = CPPifdef(0, ppToken); break; + case PpAtomLine: + token = CPPline(ppToken); + break; +#ifndef GLSLANG_WEB case PpAtomInclude: if(!parseContext.isReadingHLSL()) { parseContext.ppRequireExtensions(ppToken->loc, 1, &E_GL_GOOGLE_include_directive, "#include"); } token = CPPinclude(ppToken); break; - case PpAtomLine: - token = CPPline(ppToken); - break; case PpAtomPragma: token = CPPpragma(ppToken); break; +#endif case PpAtomUndef: token = CPPundef(ppToken); break; diff --git a/thirdparty/glslang/glslang/MachineIndependent/preprocessor/PpContext.cpp b/thirdparty/glslang/glslang/MachineIndependent/preprocessor/PpContext.cpp index cc003a8d12..cc003a8d12 100644..100755 --- a/thirdparty/glslang/glslang/MachineIndependent/preprocessor/PpContext.cpp +++ b/thirdparty/glslang/glslang/MachineIndependent/preprocessor/PpContext.cpp diff --git a/thirdparty/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp b/thirdparty/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp index f6f52d7d55..c293af3c1e 100644..100755 --- a/thirdparty/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp +++ b/thirdparty/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp @@ -142,6 +142,7 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken) ch = getChar(); int firstDecimal = len; +#ifdef ENABLE_HLSL // 1.#INF or -1.#INF if (ch == '#' && (ifdepth > 0 || parseContext.intermediate.getSource() == EShSourceHlsl)) { if ((len < 2) || @@ -169,6 +170,7 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken) } } } +#endif // Consume leading-zero digits after the decimal point while (ch == '0') { @@ -257,6 +259,7 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken) // Suffix: bool isDouble = false; bool isFloat16 = false; +#ifndef GLSLANG_WEB if (ch == 'l' || ch == 'L') { if (ifdepth == 0 && parseContext.intermediate.getSource() == EShSourceGlsl) parseContext.doubleCheck(ppToken->loc, "double floating-point suffix"); @@ -295,11 +298,15 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken) saveName(ch); isFloat16 = true; } - } else if (ch == 'f' || ch == 'F') { + } else +#endif + if (ch == 'f' || ch == 'F') { +#ifndef GLSLANG_WEB if (ifdepth == 0) parseContext.profileRequires(ppToken->loc, EEsProfile, 300, nullptr, "floating-point suffix"); if (ifdepth == 0 && !parseContext.relaxedErrors()) parseContext.profileRequires(ppToken->loc, ~EEsProfile, 120, nullptr, "floating-point suffix"); +#endif if (ifdepth == 0 && !hasDecimalOrExponent) parseContext.ppError(ppToken->loc, "float literal needs a decimal point or exponent", "", ""); saveName(ch); @@ -468,9 +475,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) static const int Num_Int64_Extensions = sizeof(Int64_Extensions) / sizeof(Int64_Extensions[0]); static const char* const Int16_Extensions[] = { -#ifdef AMD_EXTENSIONS E_GL_AMD_gpu_shader_int16, -#endif E_GL_EXT_shader_explicit_arithmetic_types, E_GL_EXT_shader_explicit_arithmetic_types_int16 }; static const int Num_Int16_Extensions = sizeof(Int16_Extensions) / sizeof(Int16_Extensions[0]); @@ -579,6 +584,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) ppToken->name[len++] = (char)ch; isUnsigned = true; +#ifndef GLSLANG_WEB int nextCh = getch(); if (nextCh == 'l' || nextCh == 'L') { if (len < MaxTokenLength) @@ -587,7 +593,6 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) } else ungetch(); -#ifdef AMD_EXTENSIONS nextCh = getch(); if ((nextCh == 's' || nextCh == 'S') && pp->parseContext.intermediate.getSource() == EShSourceGlsl) { @@ -596,12 +601,10 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) isInt16 = true; } else ungetch(); -#endif } else if (ch == 'l' || ch == 'L') { if (len < MaxTokenLength) ppToken->name[len++] = (char)ch; isInt64 = true; -#ifdef AMD_EXTENSIONS } else if ((ch == 's' || ch == 'S') && pp->parseContext.intermediate.getSource() == EShSourceGlsl) { if (len < MaxTokenLength) @@ -689,6 +692,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) ppToken->name[len++] = (char)ch; isUnsigned = true; +#ifndef GLSLANG_WEB int nextCh = getch(); if (nextCh == 'l' || nextCh == 'L') { if (len < MaxTokenLength) @@ -697,7 +701,6 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) } else ungetch(); -#ifdef AMD_EXTENSIONS nextCh = getch(); if ((nextCh == 's' || nextCh == 'S') && pp->parseContext.intermediate.getSource() == EShSourceGlsl) { @@ -706,12 +709,10 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) isInt16 = true; } else ungetch(); -#endif } else if (ch == 'l' || ch == 'L') { if (len < MaxTokenLength) ppToken->name[len++] = (char)ch; isInt64 = true; -#ifdef AMD_EXTENSIONS } else if ((ch == 's' || ch == 'S') && pp->parseContext.intermediate.getSource() == EShSourceGlsl) { if (len < MaxTokenLength) @@ -780,6 +781,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) ppToken->name[len++] = (char)ch; isUnsigned = true; +#ifndef GLSLANG_WEB int nextCh = getch(); if (nextCh == 'l' || nextCh == 'L') { if (len < MaxTokenLength) @@ -788,7 +790,6 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) } else ungetch(); -#ifdef AMD_EXTENSIONS nextCh = getch(); if ((nextCh == 's' || nextCh == 'S') && pp->parseContext.intermediate.getSource() == EShSourceGlsl) { @@ -797,12 +798,10 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) isInt16 = true; } else ungetch(); -#endif } else if (ch == 'l' || ch == 'L') { if (len < MaxTokenLength) ppToken->name[len++] = (char)ch; isInt64 = true; -#ifdef AMD_EXTENSIONS } else if ((ch == 's' || ch == 'S') && pp->parseContext.intermediate.getSource() == EShSourceGlsl) { if (len < MaxTokenLength) diff --git a/thirdparty/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp b/thirdparty/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp index ac9d8ac351..7ed58703f2 100644..100755 --- a/thirdparty/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp +++ b/thirdparty/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp @@ -116,6 +116,7 @@ int TPpContext::TokenStream::getToken(TParseContextBase& parseContext, TPpToken int atom = stream[currentPos++].get(*ppToken); ppToken->loc = parseContext.getCurrentLoc(); +#ifndef GLSLANG_WEB // Check for ##, unless the current # is the last character if (atom == '#') { if (peekToken('#')) { @@ -125,6 +126,7 @@ int TPpContext::TokenStream::getToken(TParseContextBase& parseContext, TPpToken atom = PpAtomPaste; } } +#endif return atom; } diff --git a/thirdparty/glslang/glslang/MachineIndependent/propagateNoContraction.cpp b/thirdparty/glslang/glslang/MachineIndependent/propagateNoContraction.cpp index ae95688ae8..83a3230f51 100644 --- a/thirdparty/glslang/glslang/MachineIndependent/propagateNoContraction.cpp +++ b/thirdparty/glslang/glslang/MachineIndependent/propagateNoContraction.cpp @@ -37,6 +37,8 @@ // propagate the 'noContraction' qualifier. // +#ifndef GLSLANG_WEB + #include "propagateNoContraction.h" #include <cstdlib> @@ -79,7 +81,7 @@ typedef std::unordered_set<glslang::TIntermBranch*> ReturnBranchNodeSet; // the node has 'noContraction' qualifier, otherwise false. bool isPreciseObjectNode(glslang::TIntermTyped* node) { - return node->getType().getQualifier().noContraction; + return node->getType().getQualifier().isNoContraction(); } // Returns true if the opcode is a dereferencing one. @@ -864,3 +866,5 @@ void PropagateNoContraction(const glslang::TIntermediate& intermediate) } } }; + +#endif // GLSLANG_WEB
\ No newline at end of file diff --git a/thirdparty/glslang/glslang/MachineIndependent/reflection.cpp b/thirdparty/glslang/glslang/MachineIndependent/reflection.cpp index a09a04880e..b09367113c 100644 --- a/thirdparty/glslang/glslang/MachineIndependent/reflection.cpp +++ b/thirdparty/glslang/glslang/MachineIndependent/reflection.cpp @@ -33,6 +33,8 @@ // POSSIBILITY OF SUCH DAMAGE. // +#ifndef GLSLANG_WEB + #include "../Include/Common.h" #include "reflection.h" #include "LiveTraverser.h" @@ -110,6 +112,10 @@ public: TReflection::TMapIndexToReflection &ioItems = input ? reflection.indexToPipeInput : reflection.indexToPipeOutput; + + TReflection::TNameToIndex &ioMapper = + input ? reflection.pipeInNameToIndex : reflection.pipeOutNameToIndex; + if (reflection.options & EShReflectionUnwrapIOBlocks) { bool anonymous = IsAnonymous(name); @@ -127,12 +133,13 @@ public: blowUpIOAggregate(input, baseName, type); } } else { - TReflection::TNameToIndex::const_iterator it = reflection.nameToIndex.find(name.c_str()); - if (it == reflection.nameToIndex.end()) { - reflection.nameToIndex[name.c_str()] = (int)ioItems.size(); + TReflection::TNameToIndex::const_iterator it = ioMapper.find(name.c_str()); + if (it == ioMapper.end()) { + // seperate pipe i/o params from uniforms and blocks + // in is only for input in first stage as out is only for last stage. check traverse in call stack. + ioMapper[name.c_str()] = static_cast<int>(ioItems.size()); ioItems.push_back( TObjectReflection(name.c_str(), type, 0, mapToGlType(type), mapToGlArraySize(type), 0)); - EShLanguageMask& stages = ioItems.back().stages; stages = static_cast<EShLanguageMask>(stages | 1 << intermediate.getStage()); } else { @@ -396,7 +403,7 @@ public: topLevelArrayStride = variables.back().arrayStride; } - if ((reflection.options & EShReflectionSeparateBuffers) && terminalType->getBasicType() == EbtAtomicUint) + if ((reflection.options & EShReflectionSeparateBuffers) && terminalType->isAtomic()) reflection.atomicCounterUniformIndices.push_back(uniformIndex); variables.back().topLevelArrayStride = topLevelArrayStride; @@ -554,15 +561,18 @@ public: bool blockParent = (base->getType().getBasicType() == EbtBlock && base->getQualifier().storage == EvqBuffer); if (strictArraySuffix && blockParent) { - const TTypeList& typeList = *base->getType().getStruct(); + TType structDerefType(base->getType(), 0); + + const TType &structType = base->getType().isArray() ? structDerefType : base->getType(); + const TTypeList& typeList = *structType.getStruct(); TVector<int> memberOffsets; memberOffsets.resize(typeList.size()); - getOffsets(base->getType(), memberOffsets); + getOffsets(structType, memberOffsets); for (int i = 0; i < (int)typeList.size(); ++i) { - TType derefType(base->getType(), i); + TType derefType(structType, i); TString name = baseName; if (name.size() > 0) name.append("."); @@ -573,7 +583,7 @@ public: if (derefType.isArray() && derefType.isStruct()) { name.append("[0]"); blowUpActiveAggregate(TType(derefType, 0), name, derefs, derefs.end(), memberOffsets[i], - blockIndex, 0, getArrayStride(base->getType(), derefType), + blockIndex, 0, getArrayStride(structType, derefType), base->getQualifier().storage, false); } else { blowUpActiveAggregate(derefType, name, derefs, derefs.end(), memberOffsets[i], blockIndex, @@ -701,7 +711,6 @@ public: case EsdBuffer: return GL_SAMPLER_BUFFER; } -#ifdef AMD_EXTENSIONS case EbtFloat16: switch ((int)sampler.dim) { case Esd1D: @@ -730,7 +739,6 @@ public: case EsdBuffer: return GL_FLOAT16_SAMPLER_BUFFER_AMD; } -#endif case EbtInt: switch ((int)sampler.dim) { case Esd1D: @@ -793,7 +801,6 @@ public: case EsdBuffer: return GL_IMAGE_BUFFER; } -#ifdef AMD_EXTENSIONS case EbtFloat16: switch ((int)sampler.dim) { case Esd1D: @@ -812,7 +819,6 @@ public: case EsdBuffer: return GL_FLOAT16_IMAGE_BUFFER_AMD; } -#endif case EbtInt: switch ((int)sampler.dim) { case Esd1D: @@ -878,9 +884,7 @@ public: switch (type.getBasicType()) { case EbtFloat: return GL_FLOAT_VEC2 + offset; case EbtDouble: return GL_DOUBLE_VEC2 + offset; -#ifdef AMD_EXTENSIONS case EbtFloat16: return GL_FLOAT16_VEC2_NV + offset; -#endif case EbtInt: return GL_INT_VEC2 + offset; case EbtUint: return GL_UNSIGNED_INT_VEC2 + offset; case EbtInt64: return GL_INT64_ARB + offset; @@ -940,7 +944,6 @@ public: default: return 0; } } -#ifdef AMD_EXTENSIONS case EbtFloat16: switch (type.getMatrixCols()) { case 2: @@ -965,7 +968,6 @@ public: default: return 0; } } -#endif default: return 0; } @@ -974,9 +976,7 @@ public: switch (type.getBasicType()) { case EbtFloat: return GL_FLOAT; case EbtDouble: return GL_DOUBLE; -#ifdef AMD_EXTENSIONS case EbtFloat16: return GL_FLOAT16_NV; -#endif case EbtInt: return GL_INT; case EbtUint: return GL_UNSIGNED_INT; case EbtInt64: return GL_INT64_ARB; @@ -1093,6 +1093,7 @@ void TReflection::buildAttributeReflection(EShLanguage stage, const TIntermediat // build counter block index associations for buffers void TReflection::buildCounterIndices(const TIntermediate& intermediate) { +#ifdef ENABLE_HLSL // search for ones that have counters for (int i = 0; i < int(indexToUniformBlock.size()); ++i) { const TString counterName(intermediate.addCounterBufferName(indexToUniformBlock[i].name).c_str()); @@ -1101,6 +1102,7 @@ void TReflection::buildCounterIndices(const TIntermediate& intermediate) if (index >= 0) indexToUniformBlock[i].counterIndex = index; } +#endif } // build Shader Stages mask for all uniforms @@ -1198,3 +1200,5 @@ void TReflection::dump() } } // end namespace glslang + +#endif // GLSLANG_WEB diff --git a/thirdparty/glslang/glslang/MachineIndependent/reflection.h b/thirdparty/glslang/glslang/MachineIndependent/reflection.h index 44b17a05ad..efdc8934fb 100644 --- a/thirdparty/glslang/glslang/MachineIndependent/reflection.h +++ b/thirdparty/glslang/glslang/MachineIndependent/reflection.h @@ -33,6 +33,8 @@ // POSSIBILITY OF SUCH DAMAGE. // +#ifndef GLSLANG_WEB + #ifndef _REFLECTION_INCLUDED #define _REFLECTION_INCLUDED @@ -150,6 +152,20 @@ public: // see getIndex(const char*) int getIndex(const TString& name) const { return getIndex(name.c_str()); } + + // for mapping any name to its index (only pipe input/output names) + int getPipeIOIndex(const char* name, const bool inOrOut) const + { + TNameToIndex::const_iterator it = inOrOut ? pipeInNameToIndex.find(name) : pipeOutNameToIndex.find(name); + if (it == (inOrOut ? pipeInNameToIndex.end() : pipeOutNameToIndex.end())) + return -1; + else + return it->second; + } + + // see gePipeIOIndex(const char*, const bool) + int getPipeIOIndex(const TString& name, const bool inOrOut) const { return getPipeIOIndex(name.c_str(), inOrOut); } + // Thread local size unsigned getLocalSize(int dim) const { return dim <= 2 ? localSize[dim] : 0; } @@ -187,6 +203,8 @@ protected: TObjectReflection badReflection; // return for queries of -1 or generally out of range; has expected descriptions with in it for this TNameToIndex nameToIndex; // maps names to indexes; can hold all types of data: uniform/buffer and which function names have been processed + TNameToIndex pipeInNameToIndex; // maps pipe in names to indexes, this is a fix to seperate pipe I/O from uniforms and buffers. + TNameToIndex pipeOutNameToIndex; // maps pipe out names to indexes, this is a fix to seperate pipe I/O from uniforms and buffers. TMapIndexToReflection indexToUniform; TMapIndexToReflection indexToUniformBlock; TMapIndexToReflection indexToBufferVariable; @@ -201,3 +219,5 @@ protected: } // end namespace glslang #endif // _REFLECTION_INCLUDED + +#endif // GLSLANG_WEB
\ No newline at end of file diff --git a/thirdparty/glslang/glslang/OSDependent/Web/glslang.after.js b/thirdparty/glslang/glslang/OSDependent/Web/glslang.after.js new file mode 100644 index 0000000000..c2cfc35a48 --- /dev/null +++ b/thirdparty/glslang/glslang/OSDependent/Web/glslang.after.js @@ -0,0 +1,26 @@ +export default (() => { + const initialize = () => { + return new Promise(resolve => { + Module({ + locateFile() { + const i = import.meta.url.lastIndexOf('/') + return import.meta.url.substring(0, i) + '/glslang.wasm'; + }, + onRuntimeInitialized() { + resolve({ + compileGLSLZeroCopy: this.compileGLSLZeroCopy, + compileGLSL: this.compileGLSL, + }); + }, + }); + }); + }; + + let instance; + return () => { + if (!instance) { + instance = initialize(); + } + return instance; + }; +})(); diff --git a/thirdparty/glslang/glslang/OSDependent/Web/glslang.js.cpp b/thirdparty/glslang/glslang/OSDependent/Web/glslang.js.cpp new file mode 100644 index 0000000000..6cb93fe27e --- /dev/null +++ b/thirdparty/glslang/glslang/OSDependent/Web/glslang.js.cpp @@ -0,0 +1,269 @@ +// +// Copyright (C) 2019 Google, Inc. +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// +// Neither the name of 3Dlabs Inc. Ltd. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include <cstdio> +#include <cstdint> +#include <memory> + +#ifdef __EMSCRIPTEN__ +#include <emscripten.h> +#endif + +#include "../../../SPIRV/GlslangToSpv.h" +#include "../../../glslang/Public/ShaderLang.h" + +#ifndef __EMSCRIPTEN__ +#define EMSCRIPTEN_KEEPALIVE +#endif + +const TBuiltInResource DefaultTBuiltInResource = { + /* .MaxLights = */ 32, + /* .MaxClipPlanes = */ 6, + /* .MaxTextureUnits = */ 32, + /* .MaxTextureCoords = */ 32, + /* .MaxVertexAttribs = */ 64, + /* .MaxVertexUniformComponents = */ 4096, + /* .MaxVaryingFloats = */ 64, + /* .MaxVertexTextureImageUnits = */ 32, + /* .MaxCombinedTextureImageUnits = */ 80, + /* .MaxTextureImageUnits = */ 32, + /* .MaxFragmentUniformComponents = */ 4096, + /* .MaxDrawBuffers = */ 32, + /* .MaxVertexUniformVectors = */ 128, + /* .MaxVaryingVectors = */ 8, + /* .MaxFragmentUniformVectors = */ 16, + /* .MaxVertexOutputVectors = */ 16, + /* .MaxFragmentInputVectors = */ 15, + /* .MinProgramTexelOffset = */ -8, + /* .MaxProgramTexelOffset = */ 7, + /* .MaxClipDistances = */ 8, + /* .MaxComputeWorkGroupCountX = */ 65535, + /* .MaxComputeWorkGroupCountY = */ 65535, + /* .MaxComputeWorkGroupCountZ = */ 65535, + /* .MaxComputeWorkGroupSizeX = */ 1024, + /* .MaxComputeWorkGroupSizeY = */ 1024, + /* .MaxComputeWorkGroupSizeZ = */ 64, + /* .MaxComputeUniformComponents = */ 1024, + /* .MaxComputeTextureImageUnits = */ 16, + /* .MaxComputeImageUniforms = */ 8, + /* .MaxComputeAtomicCounters = */ 8, + /* .MaxComputeAtomicCounterBuffers = */ 1, + /* .MaxVaryingComponents = */ 60, + /* .MaxVertexOutputComponents = */ 64, + /* .MaxGeometryInputComponents = */ 64, + /* .MaxGeometryOutputComponents = */ 128, + /* .MaxFragmentInputComponents = */ 128, + /* .MaxImageUnits = */ 8, + /* .MaxCombinedImageUnitsAndFragmentOutputs = */ 8, + /* .MaxCombinedShaderOutputResources = */ 8, + /* .MaxImageSamples = */ 0, + /* .MaxVertexImageUniforms = */ 0, + /* .MaxTessControlImageUniforms = */ 0, + /* .MaxTessEvaluationImageUniforms = */ 0, + /* .MaxGeometryImageUniforms = */ 0, + /* .MaxFragmentImageUniforms = */ 8, + /* .MaxCombinedImageUniforms = */ 8, + /* .MaxGeometryTextureImageUnits = */ 16, + /* .MaxGeometryOutputVertices = */ 256, + /* .MaxGeometryTotalOutputComponents = */ 1024, + /* .MaxGeometryUniformComponents = */ 1024, + /* .MaxGeometryVaryingComponents = */ 64, + /* .MaxTessControlInputComponents = */ 128, + /* .MaxTessControlOutputComponents = */ 128, + /* .MaxTessControlTextureImageUnits = */ 16, + /* .MaxTessControlUniformComponents = */ 1024, + /* .MaxTessControlTotalOutputComponents = */ 4096, + /* .MaxTessEvaluationInputComponents = */ 128, + /* .MaxTessEvaluationOutputComponents = */ 128, + /* .MaxTessEvaluationTextureImageUnits = */ 16, + /* .MaxTessEvaluationUniformComponents = */ 1024, + /* .MaxTessPatchComponents = */ 120, + /* .MaxPatchVertices = */ 32, + /* .MaxTessGenLevel = */ 64, + /* .MaxViewports = */ 16, + /* .MaxVertexAtomicCounters = */ 0, + /* .MaxTessControlAtomicCounters = */ 0, + /* .MaxTessEvaluationAtomicCounters = */ 0, + /* .MaxGeometryAtomicCounters = */ 0, + /* .MaxFragmentAtomicCounters = */ 8, + /* .MaxCombinedAtomicCounters = */ 8, + /* .MaxAtomicCounterBindings = */ 1, + /* .MaxVertexAtomicCounterBuffers = */ 0, + /* .MaxTessControlAtomicCounterBuffers = */ 0, + /* .MaxTessEvaluationAtomicCounterBuffers = */ 0, + /* .MaxGeometryAtomicCounterBuffers = */ 0, + /* .MaxFragmentAtomicCounterBuffers = */ 1, + /* .MaxCombinedAtomicCounterBuffers = */ 1, + /* .MaxAtomicCounterBufferSize = */ 16384, + /* .MaxTransformFeedbackBuffers = */ 4, + /* .MaxTransformFeedbackInterleavedComponents = */ 64, + /* .MaxCullDistances = */ 8, + /* .MaxCombinedClipAndCullDistances = */ 8, + /* .MaxSamples = */ 4, + /* .maxMeshOutputVerticesNV = */ 256, + /* .maxMeshOutputPrimitivesNV = */ 512, + /* .maxMeshWorkGroupSizeX_NV = */ 32, + /* .maxMeshWorkGroupSizeY_NV = */ 1, + /* .maxMeshWorkGroupSizeZ_NV = */ 1, + /* .maxTaskWorkGroupSizeX_NV = */ 32, + /* .maxTaskWorkGroupSizeY_NV = */ 1, + /* .maxTaskWorkGroupSizeZ_NV = */ 1, + /* .maxMeshViewCountNV = */ 4, + + /* .limits = */ { + /* .nonInductiveForLoops = */ 1, + /* .whileLoops = */ 1, + /* .doWhileLoops = */ 1, + /* .generalUniformIndexing = */ 1, + /* .generalAttributeMatrixVectorIndexing = */ 1, + /* .generalVaryingIndexing = */ 1, + /* .generalSamplerIndexing = */ 1, + /* .generalVariableIndexing = */ 1, + /* .generalConstantMatrixVectorIndexing = */ 1, + }}; + +static bool initialized = false; + +extern "C" { + +/* + * Takes in a GLSL shader as a string and converts it to SPIR-V in binary form. + * + * |glsl| Null-terminated string containing the shader to be converted. + * |stage_int| Magic number indicating the type of shader being processed. +* Legal values are as follows: + * Vertex = 0 + * Fragment = 4 + * Compute = 5 + * |gen_debug| Flag to indicate if debug information should be generated. + * |spirv| Output parameter for a pointer to the resulting SPIR-V data. + * |spirv_len| Output parameter for the length of the output binary buffer. + * + * Returns a void* pointer which, if not null, must be destroyed by + * destroy_output_buffer.o. (This is not the same pointer returned in |spirv|.) + * If null, the compilation failed. + */ +EMSCRIPTEN_KEEPALIVE +void* convert_glsl_to_spirv(const char* glsl, int stage_int, bool gen_debug, uint32_t** spirv, size_t* spirv_len) +{ + if (glsl == nullptr) { + fprintf(stderr, "Input pointer null\n"); + return nullptr; + } + if (spirv == nullptr || spirv_len == nullptr) { + fprintf(stderr, "Output pointer null\n"); + return nullptr; + } + *spirv = nullptr; + *spirv_len = 0; + + if (stage_int != 0 && stage_int != 4 && stage_int != 5) { + fprintf(stderr, "Invalid shader stage\n"); + return nullptr; + } + EShLanguage stage = static_cast<EShLanguage>(stage_int); + + if (!initialized) { + glslang::InitializeProcess(); + initialized = true; + } + + glslang::TShader shader(stage); + shader.setStrings(&glsl, 1); + shader.setEnvInput(glslang::EShSourceGlsl, stage, glslang::EShClientVulkan, 100); + shader.setEnvClient(glslang::EShClientVulkan, glslang::EShTargetVulkan_1_1); + shader.setEnvTarget(glslang::EShTargetSpv, glslang::EShTargetSpv_1_3); + if (!shader.parse(&DefaultTBuiltInResource, 100, true, EShMsgDefault)) { + fprintf(stderr, "Parse failed\n"); + fprintf(stderr, "%s\n", shader.getInfoLog()); + return nullptr; + } + + glslang::TProgram program; + program.addShader(&shader); + if (!program.link(EShMsgDefault)) { + fprintf(stderr, "Link failed\n"); + fprintf(stderr, "%s\n", program.getInfoLog()); + return nullptr; + } + + glslang::SpvOptions spvOptions; + spvOptions.generateDebugInfo = gen_debug; + spvOptions.optimizeSize = false; + spvOptions.disassemble = false; + spvOptions.validate = false; + + std::vector<uint32_t>* output = new std::vector<uint32_t>; + glslang::GlslangToSpv(*program.getIntermediate(stage), *output, nullptr, &spvOptions); + + *spirv_len = output->size(); + *spirv = output->data(); + return output; +} + +/* + * Destroys a buffer created by convert_glsl_to_spirv + */ +EMSCRIPTEN_KEEPALIVE +void destroy_output_buffer(void* p) +{ + delete static_cast<std::vector<uint32_t>*>(p); +} + +} // extern "C" + +/* + * For non-Emscripten builds we supply a generic main, so that the glslang.js + * build target can generate an executable with a trivial use case instead of + * generating a WASM binary. This is done so that there is a target that can be + * built and output analyzed using desktop tools, since WASM binaries are + * specific to the Emscripten toolchain. + */ +#ifndef __EMSCRIPTEN__ +int main() { + const char* input = R"(#version 310 es + +void main() { })"; + + uint32_t* output; + size_t output_len; + + void* id = convert_glsl_to_spirv(input, 4, false, &output, &output_len); + assert(output != nullptr); + assert(output_len != 0); + destroy_output_buffer(id); + return 0; +} +#endif // ifndef __EMSCRIPTEN__ diff --git a/thirdparty/glslang/glslang/OSDependent/Web/glslang.pre.js b/thirdparty/glslang/glslang/OSDependent/Web/glslang.pre.js new file mode 100644 index 0000000000..7d3fd0234c --- /dev/null +++ b/thirdparty/glslang/glslang/OSDependent/Web/glslang.pre.js @@ -0,0 +1,45 @@ +Module['compileGLSLZeroCopy'] = function(glsl, shader_stage, gen_debug) { + gen_debug = !!gen_debug; + + var shader_stage_int; + if (shader_stage === 'vertex') { + shader_stage_int = 0; + } else if (shader_stage === 'fragment') { + shader_stage_int = 4; + } else if (shader_stage === 'compute') { + shader_stage_int = 5; + } else { + throw new Error("shader_stage must be 'vertex', 'fragment', or 'compute'"); + } + + var p_output = Module['_malloc'](4); + var p_output_len = Module['_malloc'](4); + var id = ccall('convert_glsl_to_spirv', + 'number', + ['string', 'number', 'boolean', 'number', 'number'], + [glsl, shader_stage_int, gen_debug, p_output, p_output_len]); + var output = getValue(p_output, 'i32'); + var output_len = getValue(p_output_len, 'i32'); + Module['_free'](p_output); + Module['_free'](p_output_len); + + if (id === 0) { + throw new Error('GLSL compilation failed'); + } + + var ret = {}; + var outputIndexU32 = output / 4; + ret['data'] = Module['HEAPU32'].subarray(outputIndexU32, outputIndexU32 + output_len); + ret['free'] = function() { + Module['_destroy_output_buffer'](id); + }; + + return ret; +}; + +Module['compileGLSL'] = function(glsl, shader_stage, gen_debug) { + var compiled = Module['compileGLSLZeroCopy'](glsl, shader_stage, gen_debug); + var ret = compiled['data'].slice() + compiled['free'](); + return ret; +}; diff --git a/thirdparty/glslang/glslang/Public/ShaderLang.h b/thirdparty/glslang/glslang/Public/ShaderLang.h index 33f05e2cdf..4fe5c7df19 100644..100755 --- a/thirdparty/glslang/glslang/Public/ShaderLang.h +++ b/thirdparty/glslang/glslang/Public/ShaderLang.h @@ -68,7 +68,7 @@ // This should always increase, as some paths to do not consume // a more major number. // It should increment by one when new functionality is added. -#define GLSLANG_MINOR_VERSION 12 +#define GLSLANG_MINOR_VERSION 13 // // Call before doing any other compiler/linker operations. @@ -126,36 +126,38 @@ class TType; typedef enum { EShSourceNone, - EShSourceGlsl, - EShSourceHlsl, -} EShSource; // if EShLanguage were EShStage, this could be EShLanguage instead + EShSourceGlsl, // GLSL, includes ESSL (OpenGL ES GLSL) + EShSourceHlsl, // HLSL +} EShSource; // if EShLanguage were EShStage, this could be EShLanguage instead typedef enum { - EShClientNone, + EShClientNone, // use when there is no client, e.g. for validation EShClientVulkan, EShClientOpenGL, } EShClient; typedef enum { EShTargetNone, - EShTargetSpv, // preferred spelling + EShTargetSpv, // SPIR-V (preferred spelling) EshTargetSpv = EShTargetSpv, // legacy spelling } EShTargetLanguage; typedef enum { - EShTargetVulkan_1_0 = (1 << 22), - EShTargetVulkan_1_1 = (1 << 22) | (1 << 12), - EShTargetOpenGL_450 = 450, + EShTargetVulkan_1_0 = (1 << 22), // Vulkan 1.0 + EShTargetVulkan_1_1 = (1 << 22) | (1 << 12), // Vulkan 1.1 + EShTargetVulkan_1_2 = (1 << 22) | (2 << 12), // Vulkan 1.2 + EShTargetOpenGL_450 = 450, // OpenGL } EShTargetClientVersion; typedef EShTargetClientVersion EshTargetClientVersion; typedef enum { - EShTargetSpv_1_0 = (1 << 16), - EShTargetSpv_1_1 = (1 << 16) | (1 << 8), - EShTargetSpv_1_2 = (1 << 16) | (2 << 8), - EShTargetSpv_1_3 = (1 << 16) | (3 << 8), - EShTargetSpv_1_4 = (1 << 16) | (4 << 8), + EShTargetSpv_1_0 = (1 << 16), // SPIR-V 1.0 + EShTargetSpv_1_1 = (1 << 16) | (1 << 8), // SPIR-V 1.1 + EShTargetSpv_1_2 = (1 << 16) | (2 << 8), // SPIR-V 1.2 + EShTargetSpv_1_3 = (1 << 16) | (3 << 8), // SPIR-V 1.3 + EShTargetSpv_1_4 = (1 << 16) | (4 << 8), // SPIR-V 1.4 + EShTargetSpv_1_5 = (1 << 16) | (5 << 8), // SPIR-V 1.5 } EShTargetLanguageVersion; struct TInputLanguage { @@ -432,15 +434,42 @@ public: void addUniformLocationOverride(const char* name, int loc); void setUniformLocationBase(int base); void setInvertY(bool invert); +#ifdef ENABLE_HLSL void setHlslIoMapping(bool hlslIoMap); void setFlattenUniformArrays(bool flatten); +#endif void setNoStorageFormat(bool useUnknownFormat); + void setNanMinMaxClamp(bool nanMinMaxClamp); void setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode); // For setting up the environment (cleared to nothingness in the constructor). // These must be called so that parsing is done for the right source language and // target environment, either indirectly through TranslateEnvironment() based on // EShMessages et. al., or directly by the user. + // + // setEnvInput: The input source language and stage. If generating code for a + // specific client, the input client semantics to use and the + // version of the that client's input semantics to use, otherwise + // use EShClientNone and version of 0, e.g. for validation mode. + // Note 'version' does not describe the target environment, + // just the version of the source dialect to compile under. + // + // See the definitions of TEnvironment, EShSource, EShLanguage, + // and EShClient for choices and more detail. + // + // setEnvClient: The client that will be hosting the execution, and it's version. + // Note 'version' is not the version of the languages involved, but + // the version of the client environment. + // Use EShClientNone and version of 0 if there is no client, e.g. + // for validation mode. + // + // See EShTargetClientVersion for choices. + // + // setEnvTarget: The language to translate to when generating code, and that + // language's version. + // Use EShTargetNone and version of 0 if there is no client, e.g. + // for validation mode. + // void setEnvInput(EShSource lang, EShLanguage envStage, EShClient client, int version) { environment.input.languageFamily = lang; @@ -458,8 +487,15 @@ public: environment.target.language = lang; environment.target.version = version; } + + void getStrings(const char* const* &s, int& n) { s = strings; n = numStrings; } + +#ifdef ENABLE_HLSL void setEnvTargetHlslFunctionality1() { environment.target.hlslFunctionality1 = true; } bool getEnvTargetHlslFunctionality1() const { return environment.target.hlslFunctionality1; } +#else + bool getEnvTargetHlslFunctionality1() const { return false; } +#endif // Interface to #include handlers. // @@ -610,6 +646,8 @@ private: TShader& operator=(TShader&); }; +#ifndef GLSLANG_WEB + // // A reflection database and its interface, consistent with the OpenGL API reflection queries. // @@ -645,8 +683,9 @@ protected: const TType* type; }; -class TReflection; -class TIoMapper; +class TReflection; +class TIoMapper; +struct TVarEntryInfo; // Allows to customize the binding layout after linking. // All used uniform variables will invoke at least validateBinding. @@ -667,53 +706,65 @@ class TIoMapper; // notifiy callbacks, this phase ends with a call to endNotifications. // Phase two starts directly after the call to endNotifications // and calls all other callbacks to validate and to get the -// bindings, sets, locations, component and color indices. +// bindings, sets, locations, component and color indices. // // NOTE: that still limit checks are applied to bindings and sets // and may result in an error. class TIoMapResolver { public: - virtual ~TIoMapResolver() {} - - // Should return true if the resulting/current binding would be okay. - // Basic idea is to do aliasing binding checks with this. - virtual bool validateBinding(EShLanguage stage, const char* name, const TType& type, bool is_live) = 0; - // Should return a value >= 0 if the current binding should be overridden. - // Return -1 if the current binding (including no binding) should be kept. - virtual int resolveBinding(EShLanguage stage, const char* name, const TType& type, bool is_live) = 0; - // Should return a value >= 0 if the current set should be overridden. - // Return -1 if the current set (including no set) should be kept. - virtual int resolveSet(EShLanguage stage, const char* name, const TType& type, bool is_live) = 0; - // Should return a value >= 0 if the current location should be overridden. - // Return -1 if the current location (including no location) should be kept. - virtual int resolveUniformLocation(EShLanguage stage, const char* name, const TType& type, bool is_live) = 0; - // Should return true if the resulting/current setup would be okay. - // Basic idea is to do aliasing checks and reject invalid semantic names. - virtual bool validateInOut(EShLanguage stage, const char* name, const TType& type, bool is_live) = 0; - // Should return a value >= 0 if the current location should be overridden. - // Return -1 if the current location (including no location) should be kept. - virtual int resolveInOutLocation(EShLanguage stage, const char* name, const TType& type, bool is_live) = 0; - // Should return a value >= 0 if the current component index should be overridden. - // Return -1 if the current component index (including no index) should be kept. - virtual int resolveInOutComponent(EShLanguage stage, const char* name, const TType& type, bool is_live) = 0; - // Should return a value >= 0 if the current color index should be overridden. - // Return -1 if the current color index (including no index) should be kept. - virtual int resolveInOutIndex(EShLanguage stage, const char* name, const TType& type, bool is_live) = 0; - // Notification of a uniform variable - virtual void notifyBinding(EShLanguage stage, const char* name, const TType& type, bool is_live) = 0; - // Notification of a in or out variable - virtual void notifyInOut(EShLanguage stage, const char* name, const TType& type, bool is_live) = 0; - // Called by mapIO when it has finished the notify pass - virtual void endNotifications(EShLanguage stage) = 0; - // Called by mapIO when it starts its notify pass for the given stage - virtual void beginNotifications(EShLanguage stage) = 0; - // Called by mipIO when it starts its resolve pass for the given stage - virtual void beginResolve(EShLanguage stage) = 0; - // Called by mapIO when it has finished the resolve pass - virtual void endResolve(EShLanguage stage) = 0; + virtual ~TIoMapResolver() {} + + // Should return true if the resulting/current binding would be okay. + // Basic idea is to do aliasing binding checks with this. + virtual bool validateBinding(EShLanguage stage, TVarEntryInfo& ent) = 0; + // Should return a value >= 0 if the current binding should be overridden. + // Return -1 if the current binding (including no binding) should be kept. + virtual int resolveBinding(EShLanguage stage, TVarEntryInfo& ent) = 0; + // Should return a value >= 0 if the current set should be overridden. + // Return -1 if the current set (including no set) should be kept. + virtual int resolveSet(EShLanguage stage, TVarEntryInfo& ent) = 0; + // Should return a value >= 0 if the current location should be overridden. + // Return -1 if the current location (including no location) should be kept. + virtual int resolveUniformLocation(EShLanguage stage, TVarEntryInfo& ent) = 0; + // Should return true if the resulting/current setup would be okay. + // Basic idea is to do aliasing checks and reject invalid semantic names. + virtual bool validateInOut(EShLanguage stage, TVarEntryInfo& ent) = 0; + // Should return a value >= 0 if the current location should be overridden. + // Return -1 if the current location (including no location) should be kept. + virtual int resolveInOutLocation(EShLanguage stage, TVarEntryInfo& ent) = 0; + // Should return a value >= 0 if the current component index should be overridden. + // Return -1 if the current component index (including no index) should be kept. + virtual int resolveInOutComponent(EShLanguage stage, TVarEntryInfo& ent) = 0; + // Should return a value >= 0 if the current color index should be overridden. + // Return -1 if the current color index (including no index) should be kept. + virtual int resolveInOutIndex(EShLanguage stage, TVarEntryInfo& ent) = 0; + // Notification of a uniform variable + virtual void notifyBinding(EShLanguage stage, TVarEntryInfo& ent) = 0; + // Notification of a in or out variable + virtual void notifyInOut(EShLanguage stage, TVarEntryInfo& ent) = 0; + // Called by mapIO when it starts its notify pass for the given stage + virtual void beginNotifications(EShLanguage stage) = 0; + // Called by mapIO when it has finished the notify pass + virtual void endNotifications(EShLanguage stage) = 0; + // Called by mipIO when it starts its resolve pass for the given stage + virtual void beginResolve(EShLanguage stage) = 0; + // Called by mapIO when it has finished the resolve pass + virtual void endResolve(EShLanguage stage) = 0; + // Called by mapIO when it starts its symbol collect for teh given stage + virtual void beginCollect(EShLanguage stage) = 0; + // Called by mapIO when it has finished the symbol collect + virtual void endCollect(EShLanguage stage) = 0; + // Called by TSlotCollector to resolve storage locations or bindings + virtual void reserverStorageSlot(TVarEntryInfo& ent, TInfoSink& infoSink) = 0; + // Called by TSlotCollector to resolve resource locations or bindings + virtual void reserverResourceSlot(TVarEntryInfo& ent, TInfoSink& infoSink) = 0; + // Called by mapIO.addStage to set shader stage mask to mark a stage be added to this pipeline + virtual void addStage(EShLanguage stage) = 0; }; +#endif // GLSLANG_WEB + // Make one TProgram per set of shaders that will get linked together. Add all // the shaders that are to be linked together. After calling shader.parse() // for all shaders, call link(). @@ -725,7 +776,7 @@ public: TProgram(); virtual ~TProgram(); void addShader(TShader* shader) { stages[shader->stage].push_back(shader); } - + std::list<TShader*>& getShaders(EShLanguage stage) { return stages[stage]; } // Link Validation interface bool link(EShMessages); const char* getInfoLog(); @@ -733,14 +784,15 @@ public: TIntermediate* getIntermediate(EShLanguage stage) const { return intermediate[stage]; } +#ifndef GLSLANG_WEB + // Reflection Interface // call first, to do liveness analysis, index mapping, etc.; returns false on failure - bool buildReflection(int opts = EShReflectionDefault); - + bool buildReflection(int opts = EShReflectionDefault); unsigned getLocalSize(int dim) const; // return dim'th local size int getReflectionIndex(const char *name) const; - + int getReflectionPipeIOIndex(const char* name, const bool inOrOut) const; int getNumUniformVariables() const; const TObjectReflection& getUniform(int index) const; int getNumUniformBlocks() const; @@ -770,6 +822,9 @@ public: // can be used for glGetUniformIndices() int getUniformIndex(const char *name) const { return getReflectionIndex(name); } + int getPipeIOIndex(const char *name, const bool inOrOut) const + { return getReflectionPipeIOIndex(name, inOrOut); } + // can be used for "name" part of glGetActiveUniform() const char *getUniformName(int index) const { return getUniform(index).name.c_str(); } @@ -819,11 +874,11 @@ public: const TType *getAttributeTType(int index) const { return getPipeInput(index).getType(); } void dumpReflection(); - // I/O mapping: apply base offsets and map live unbound variables // If resolver is not provided it uses the previous approach // and respects auto assignment and offsets. - bool mapIO(TIoMapResolver* resolver = NULL); + bool mapIO(TIoMapResolver* pResolver = nullptr, TIoMapper* pIoMapper = nullptr); +#endif protected: bool linkStage(EShLanguage, EShMessages); @@ -833,8 +888,9 @@ protected: TIntermediate* intermediate[EShLangCount]; bool newedIntermediate[EShLangCount]; // track which intermediate were "new" versus reusing a singleton unit in a stage TInfoSink* infoSink; +#ifndef GLSLANG_WEB TReflection* reflection; - TIoMapper* ioMapper; +#endif bool linked; private: diff --git a/thirdparty/glslang/patches/fix-mingw-snprintf.patch b/thirdparty/glslang/patches/fix-mingw-snprintf.patch new file mode 100644 index 0000000000..2a51bc1f22 --- /dev/null +++ b/thirdparty/glslang/patches/fix-mingw-snprintf.patch @@ -0,0 +1,15 @@ +diff --git a/thirdparty/glslang/glslang/Include/Common.h b/thirdparty/glslang/glslang/Include/Common.h +index 733a790cfd..2c511bc1c5 100644 +--- a/thirdparty/glslang/glslang/Include/Common.h ++++ b/thirdparty/glslang/glslang/Include/Common.h +@@ -50,7 +50,9 @@ std::string to_string(const T& val) { + } + #endif + +-#if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/) || defined MINGW_HAS_SECURE_API ++// -- GODOT start -- ++#if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/) /* || defined MINGW_HAS_SECURE_API */ ++// -- GODOT end -- + #include <basetsd.h> + #ifndef snprintf + #define snprintf sprintf_s |