diff --git a/BUILD.gn b/BUILD.gn index e38e78a4..be9e1ab9 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -37,6 +37,8 @@ spirv_tools_dir = glslang_spirv_tools_dir config("glslang_public") { include_dirs = [ "." ] + + defines = [ "ENABLE_HLSL=1" ] } source_set("glslang_sources") { @@ -129,9 +131,25 @@ source_set("glslang_sources") { "glslang/MachineIndependent/reflection.h", "glslang/OSDependent/osinclude.h", "glslang/Public/ShaderLang.h", + "hlsl/hlslAttributes.cpp", + "hlsl/hlslAttributes.h", + "hlsl/hlslGrammar.cpp", + "hlsl/hlslGrammar.h", + "hlsl/hlslOpMap.cpp", + "hlsl/hlslOpMap.h", + "hlsl/hlslParseHelper.cpp", + "hlsl/hlslParseHelper.h", + "hlsl/hlslParseables.cpp", + "hlsl/hlslParseables.h", + "hlsl/hlslScanContext.cpp", + "hlsl/hlslScanContext.h", + "hlsl/hlslTokenStream.cpp", + "hlsl/hlslTokenStream.h", + "hlsl/hlslTokens.h", ] defines = [ "ENABLE_OPT=1" ] + if (is_win) { sources += [ "glslang/OSDependent/Windows/ossource.cpp" ] defines += [ "GLSLANG_OSINCLUDE_WIN32" ] @@ -153,8 +171,8 @@ source_set("glslang_sources") { } if (is_win && !is_clang) { cflags = [ - "/wd4018", # signed/unsigned mismatch - "/wd4189", # local variable is initialized but not referenced + "/wd4018", # signed/unsigned mismatch + "/wd4189", # local variable is initialized but not referenced ] } @@ -169,7 +187,9 @@ source_set("glslang_default_resource_limits_sources") { "StandAlone/ResourceLimits.cpp", "StandAlone/ResourceLimits.h", ] - deps = [ ":glslang_sources" ] + deps = [ + ":glslang_sources", + ] public_configs = [ ":glslang_public" ] } diff --git a/CMakeLists.txt b/CMakeLists.txt index 5638fabe..196194d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,9 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) # Adhere to GNU filesystem layout conventions include(GNUInstallDirs) +# Needed for CMAKE_DEPENDENT_OPTION macro +include(CMakeDependentOption) + option(BUILD_SHARED_LIBS "Build Shared Libraries" OFF) set(LIB_TYPE STATIC) @@ -23,12 +26,13 @@ if(NOT ${SKIP_GLSLANG_INSTALL}) endif() option(ENABLE_SPVREMAPPER "Enables building of SPVRemapper" ON) -option(ENABLE_AMD_EXTENSIONS "Enables support of AMD-specific extensions" ON) option(ENABLE_GLSLANG_BINARIES "Builds glslangValidator and spirv-remap" ON) -option(ENABLE_NV_EXTENSIONS "Enables support of Nvidia-specific extensions" ON) +option(ENABLE_GLSLANG_WEB "Reduces glslang to minumum needed for web use" OFF) +option(ENABLE_EMSCRIPTEN_SINGLE_FILE "If using emscripten, enables SINGLE_FILE build" OFF) +option(ENABLE_EMSCRIPTEN_ENVIRONMENT_NODE "If using emscripten, builds to run on Node instead of Web" OFF) -option(ENABLE_HLSL "Enables HLSL input support" ON) +CMAKE_DEPENDENT_OPTION(ENABLE_HLSL "Enables HLSL input support" ON "NOT ENABLE_GLSLANG_WEB" OFF) option(ENABLE_OPT "Enables spirv-opt capability if present" ON) @@ -60,18 +64,14 @@ project(glslang) # make testing optional include(CTest) -if(ENABLE_AMD_EXTENSIONS) - add_definitions(-DAMD_EXTENSIONS) -endif(ENABLE_AMD_EXTENSIONS) - -if(ENABLE_NV_EXTENSIONS) - add_definitions(-DNV_EXTENSIONS) -endif(ENABLE_NV_EXTENSIONS) - if(ENABLE_HLSL) add_definitions(-DENABLE_HLSL) endif(ENABLE_HLSL) +if(ENABLE_GLSLANG_WEB) + add_definitions(-DGLSLANG_WEB) +endif(ENABLE_GLSLANG_WEB) + if(WIN32) set(CMAKE_DEBUG_POSTFIX "d") if(MSVC) @@ -88,12 +88,49 @@ if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU") add_compile_options(-Wall -Wmaybe-uninitialized -Wuninitialized -Wunused -Wunused-local-typedefs -Wunused-parameter -Wunused-value -Wunused-variable -Wunused-but-set-parameter -Wunused-but-set-variable -fno-exceptions) add_compile_options(-Wno-reorder) # disable this from -Wall, since it happens all over. + add_compile_options(-fno-rtti) elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") add_compile_options(-Wall -Wuninitialized -Wunused -Wunused-local-typedefs -Wunused-parameter -Wunused-value -Wunused-variable) add_compile_options(-Wno-reorder) # disable this from -Wall, since it happens all over. + add_compile_options(-fno-rtti) +elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "MSVC") + add_compile_options(/GR-) # Disable RTTI endif() +if(ENABLE_GLSLANG_WEB) + if(EMSCRIPTEN) + add_compile_options(-Os -fno-exceptions) + add_compile_options("SHELL: -s WASM=1") + add_compile_options("SHELL: -s WASM_OBJECT_FILES=0") + add_link_options(-Os) + add_link_options("SHELL: -s FILESYSTEM=0") + add_link_options("SHELL: --llvm-lto 1") + add_link_options("SHELL: --closure 1") + add_link_options("SHELL: -s ALLOW_MEMORY_GROWTH=1") + + add_link_options("SHELL: -s MODULARIZE=1") + if(ENABLE_EMSCRIPTEN_SINGLE_FILE) + add_link_options("SHELL: -s SINGLE_FILE=1") + endif(ENABLE_EMSCRIPTEN_SINGLE_FILE) + + if(ENABLE_EMSCRIPTEN_ENVIRONMENT_NODE) + add_link_options("SHELL: -s ENVIRONMENT=node") + add_link_options("SHELL: -s BINARYEN_ASYNC_COMPILATION=0") + else() + add_link_options("SHELL: -s ENVIRONMENT=web,worker") + add_link_options("SHELL: -s EXPORT_ES6=1") + endif() + else() + if(MSVC) + add_compile_options(/Os /GR-) + else() + add_compile_options(-Os -fno-exceptions) + add_link_options(-Os) + endif() + endif(EMSCRIPTEN) +endif(ENABLE_GLSLANG_WEB) + # Request C++11 if(${CMAKE_VERSION} VERSION_LESS 3.1) # CMake versions before 3.1 do not understand CMAKE_CXX_STANDARD @@ -105,8 +142,6 @@ else() set(CMAKE_CXX_EXTENSIONS OFF) endif() -add_compile_options(-fno-rtti) - function(glslang_set_link_args TARGET) # For MinGW compiles, statically link against the GCC and C++ runtimes. # This avoids the need to ship those runtimes as DLLs. diff --git a/LICENSE.txt b/LICENSE.txt old mode 100755 new mode 100644 diff --git a/README.md b/README.md index ff89e4c0..427cf5a5 100755 --- a/README.md +++ b/README.md @@ -155,13 +155,36 @@ changes are quite infrequent. For windows you can get binaries from The command to rebuild is: ```bash +m4 -P MachineIndependent/glslang.m4 > MachineIndependent/glslang.y bison --defines=MachineIndependent/glslang_tab.cpp.h -t MachineIndependent/glslang.y -o MachineIndependent/glslang_tab.cpp ``` -The above command is also available in the bash script at -`glslang/updateGrammar`. +The above commands are also available in the bash script in `updateGrammar`, +when executed from the glslang subdirectory of the glslang repository. +With no arguments it builds the full grammar, and with a "web" argument, +the web grammar subset (see more about the web subset in the next section). + +### WASM for the the Web + +Use the steps in [Build Steps](#build-steps), which following notes/exceptions: +* For building the web subset of core glslang: + + `m4` also needs a `-DGLSLANG_WEB` argument, or simply execute `updateGrammar web` from the glslang subdirectory + + turn off the CMAKE options for `BUILD_TESTING`, `ENABLE_OPT`, and `INSTALL_GTEST`, + while turning on `ENABLE_GLSLANG_WEB` +* `emsdk` needs to be present in your executable search path, *PATH* for + Bash-like enivironments + + Instructions located + [here](https://emscripten.org/docs/getting_started/downloads.html#sdk-download-and-install) +* Do not checkout SPIRV-Tools into `External` + + Does not work correctly with emscripten out of the box and we don't want it + in the build anyway. *TBD* Have build ignore SPIRV-Tools for web build +* Wrap call to `cmake` using `emconfigure` with ENABLE_GLSLANG_WEB=ON: + + e.g. For Linux, `emconfigure cmake -DCMAKE_BUILD_TYPE=Release + -DENABLE_GLSLANG_WEB=ON -DCMAKE_INSTALL_PREFIX="$(pwd)/install" ..` +* To get a 'true' minimized build, make sure to use `brotli` to compress the .js + and .wasm files Testing ------- @@ -244,7 +267,8 @@ The `main()` in `StandAlone/StandAlone.cpp` shows examples using both styles. ### C++ Class Interface (new, preferred) This interface is in roughly the last 1/3 of `ShaderLang.h`. It is in the -glslang namespace and contains the following. +glslang namespace and contains the following, here with suggested calls +for generating SPIR-V: ```cxx const char* GetEsslVersionString(); @@ -267,8 +291,17 @@ class TProgram Reflection queries ``` +For just validating (not generating code), subsitute these calls: + +```cxx + setEnvInput(EShSourceHlsl or EShSourceGlsl, stage, EShClientNone, 0); + setEnvClient(EShClientNone, 0); + setEnvTarget(EShTargetNone, 0); +``` + See `ShaderLang.h` and the usage of it in `StandAlone/StandAlone.cpp` for more -details. +details. There is a block comment giving more detail above the calls for +`setEnvInput, setEnvClient, and setEnvTarget`. ### C Functional Interface (orignal) diff --git a/SPIRV/CMakeLists.txt b/SPIRV/CMakeLists.txt index 594ab1ef..94d2ebeb 100644 --- a/SPIRV/CMakeLists.txt +++ b/SPIRV/CMakeLists.txt @@ -25,24 +25,14 @@ set(HEADERS spvIR.h doc.h SpvTools.h - disassemble.h) + disassemble.h + GLSL.ext.AMD.h + GLSL.ext.NV.h) set(SPVREMAP_HEADERS SPVRemapper.h doc.h) -if(ENABLE_AMD_EXTENSIONS) - list(APPEND - HEADERS - GLSL.ext.AMD.h) -endif(ENABLE_AMD_EXTENSIONS) - -if(ENABLE_NV_EXTENSIONS) - list(APPEND - HEADERS - GLSL.ext.NV.h) -endif(ENABLE_NV_EXTENSIONS) - add_library(SPIRV ${LIB_TYPE} ${SOURCES} ${HEADERS}) set_property(TARGET SPIRV PROPERTY FOLDER glslang) set_property(TARGET SPIRV PROPERTY POSITION_INDEPENDENT_CODE ON) diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 24c7232b..2c9fcd81 100644 --- a/SPIRV/GlslangToSpv.cpp +++ b/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 @@ -192,17 +210,13 @@ protected: spv::Id createMiscOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, std::vector& 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) @@ -210,6 +224,7 @@ protected: } std::pair getForcedType(spv::BuiltIn, const glslang::TType&); spv::Id translateForcedType(spv::Id object); + spv::Id createCompositeConstruct(spv::Id typeId, std::vector constituents); glslang::SpvOptions& options; spv::Function* shaderEntry; @@ -253,6 +268,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) { @@ -277,12 +296,12 @@ spv::ExecutionModel TranslateExecutionModel(EShLanguage stage) { switch (stage) { case EShLangVertex: return spv::ExecutionModelVertex; + case EShLangFragment: return spv::ExecutionModelFragment; +#ifndef GLSLANG_WEB + case EShLangCompute: return spv::ExecutionModelGLCompute; 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; @@ -341,7 +360,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; @@ -360,6 +379,7 @@ spv::Decoration TranslateBlockDecoration(const glslang::TType& type, bool useSto // Translate glslang type to SPIR-V memory decorations. void TranslateMemoryDecoration(const glslang::TQualifier& qualifier, std::vector& memory, bool useVulkanMemoryModel) { +#ifndef GLSLANG_WEB if (!useVulkanMemoryModel) { if (qualifier.coherent) memory.push_back(spv::DecorationCoherent); @@ -370,10 +390,11 @@ void TranslateMemoryDecoration(const glslang::TQualifier& qualifier, std::vector } if (qualifier.restrict) 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); +#endif } // Translate glslang type to SPIR-V layout decorations. @@ -416,7 +437,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: @@ -440,16 +461,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; } @@ -459,15 +478,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. @@ -482,29 +504,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.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 || @@ -523,15 +552,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 || @@ -550,12 +584,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; @@ -573,12 +610,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; @@ -590,12 +631,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; } @@ -608,6 +649,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()) { @@ -622,8 +664,21 @@ 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; + +#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. @@ -663,11 +718,9 @@ 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 || @@ -678,12 +731,6 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI } 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.addCapability(spv::CapabilityDrawParameters); @@ -714,10 +761,6 @@ 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; @@ -802,7 +845,6 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI 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; @@ -830,7 +872,6 @@ 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); @@ -852,7 +893,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); @@ -953,7 +993,6 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI return spv::BuiltInMeshViewCountNV; case glslang::EbvMeshViewIndicesNV: return spv::BuiltInMeshViewIndicesNV; -#endif // sm builtins case glslang::EbvWarpsPerSM: @@ -972,6 +1011,8 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI builder.addExtension(spv::E_SPV_NV_shader_sm_builtins); builder.addCapability(spv::CapabilityShaderSMBuiltinsNV); return spv::BuiltInSMIDNV; +#endif + default: return spv::BuiltInMax; } @@ -982,8 +1023,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: @@ -1020,7 +1065,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; @@ -1134,19 +1179,17 @@ 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); @@ -1154,7 +1197,7 @@ spv::StorageClass TGlslangToSpvTraverser::TranslateStorageClass(const glslang::T } if (type.getQualifier().isUniformOrBuffer()) { - if (type.getQualifier().layoutPushConstant) + if (type.getQualifier().isPushConstant()) return spv::StorageClassPushConstant; if (type.getBasicType() == glslang::EbtBlock) return spv::StorageClassUniform; @@ -1162,11 +1205,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 +#ifndef GLSLANG_WEB + case glslang::EvqShared: return spv::StorageClassWorkgroup; case glslang::EvqPayloadNV: return spv::StorageClassRayPayloadNV; case glslang::EvqPayloadInNV: return spv::StorageClassIncomingRayPayloadNV; case glslang::EvqHitAttrNV: return spv::StorageClassHitAttributeNV; @@ -1185,15 +1228,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); @@ -1211,15 +1255,16 @@ void TGlslangToSpvTraverser::addIndirectionIndexCapabilities(const glslang::TTyp if (baseType.getQualifier().hasAttachment()) { builder.addExtension("SPV_EXT_descriptor_indexing"); builder.addCapability(spv::CapabilityInputAttachmentArrayDynamicIndexingEXT); - } else if (baseType.isImage() && baseType.getSampler().dim == glslang::EsdBuffer) { + } else if (baseType.isImage() && baseType.getSampler().isBuffer()) { builder.addExtension("SPV_EXT_descriptor_indexing"); builder.addCapability(spv::CapabilityStorageTexelBufferArrayDynamicIndexingEXT); - } else if (baseType.isTexture() && baseType.getSampler().dim == glslang::EsdBuffer) { + } else if (baseType.isTexture() && baseType.getSampler().isBuffer()) { builder.addExtension("SPV_EXT_descriptor_indexing"); builder.addCapability(spv::CapabilityUniformTexelBufferArrayDynamicIndexingEXT); } } } +#endif } // Return whether or not the given type is something that should be tied to a @@ -1229,10 +1274,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 @@ -1252,16 +1295,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) @@ -1286,13 +1334,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 } @@ -1398,6 +1439,77 @@ 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; + +#ifndef GLSLANG_WEB + 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; case EShLangTessEvaluation: case EShLangTessControl: builder.addCapability(spv::CapabilityTessellation); @@ -1467,80 +1579,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); - - 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); - } - - 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: @@ -1591,9 +1629,11 @@ void TGlslangToSpvTraverser::finishSpv() for (auto it = iOSet.cbegin(); it != iOSet.cend(); ++it) entryPoint->addIdOperand(*it); +#ifndef GLSLANG_WEB // Add capabilities, extensions, remove unneeded decorations, etc., // based on the resulting SPIR-V. builder.postProcess(); +#endif } // Write the SPV into 'out'. @@ -1674,6 +1714,7 @@ void TGlslangToSpvTraverser::visitSymbol(glslang::TIntermSymbol* symbol) builder.setAccessChainLValue(id); } +#ifdef ENABLE_HLSL // Process linkage-only nodes for any special additional interface work. if (linkageOnly) { if (glslangIntermediate->getHlslFunctionality1()) { @@ -1705,6 +1746,7 @@ void TGlslangToSpvTraverser::visitSymbol(glslang::TIntermSymbol* symbol) } } } +#endif } bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::TIntermBinary* node) @@ -1799,7 +1841,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) { @@ -2077,6 +2119,7 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI spv::Builder::AccessChain::CoherentFlags lvalueCoherentFlags; +#ifndef GLSLANG_WEB if (node->getOp() == glslang::EOpAtomicCounterIncrement || node->getOp() == glslang::EOpAtomicCounterDecrement || node->getOp() == glslang::EOpAtomicCounter || @@ -2085,7 +2128,10 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI 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()), @@ -2102,7 +2148,7 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI if (result) { if (invertedType) { result = createInvertedSwizzle(decorations.precision, *node->getOperand(), result); - builder.addDecoration(result, decorations.nonUniform); + decorations.addNonUniform(builder, result); } builder.clearAccessChain(); @@ -2122,6 +2168,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) @@ -2132,6 +2179,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; @@ -2159,12 +2207,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"); @@ -2172,6 +2222,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 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 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 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); @@ -2189,14 +2272,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; @@ -2413,7 +2497,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt std::vector 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 @@ -2466,6 +2550,8 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt // which can be emitted by the one in createBinaryOperation() binOp = glslang::EOpMod; break; + +#ifndef GLSLANG_WEB case glslang::EOpEmitVertex: case glslang::EOpEndPrimitive: case glslang::EOpBarrier: @@ -2518,7 +2604,6 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt atomic = true; break; -#ifdef NV_EXTENSIONS case glslang::EOpIgnoreIntersectionNV: case glslang::EOpTerminateRayNV: case glslang::EOpTraceNV: @@ -2526,7 +2611,6 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt case glslang::EOpWritePackedPrimitiveIndices4x8NV: noReturnValue = true; break; -#endif case glslang::EOpCooperativeMatrixLoad: case glslang::EOpCooperativeMatrixStore: noReturnValue = true; @@ -2536,6 +2620,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt builder.addExtension(spv::E_SPV_EXT_fragment_shader_interlock); noReturnValue = true; break; +#endif default: break; @@ -2583,16 +2668,18 @@ 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; +#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; @@ -2643,6 +2730,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt if (arg == 1) lvalue = true; break; +#endif default: break; } @@ -2652,6 +2740,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) { @@ -2694,6 +2783,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt continue; } } +#endif if (lvalue) { operands.push_back(builder.accessChainGetLValue()); @@ -2706,6 +2796,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt } builder.setLine(node->getLoc().line, node->getLoc().getFilename()); +#ifndef GLSLANG_WEB if (node->getOp() == glslang::EOpCooperativeMatrixLoad) { std::vector idImmOps; @@ -2735,7 +2826,9 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt } else if (atomic) { // Handle all atomics result = createAtomicOperation(node->getOp(), precision, resultType(), operands, node->getBasicType(), lvalueCoherentFlags); - } else { + } else +#endif + { // Pass through to generic operations. switch (glslangOperands.size()) { case 0: @@ -3111,11 +3204,13 @@ 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); @@ -3141,9 +3236,8 @@ spv::Id TGlslangToSpvTraverser::createSpvVariable(const glslang::TIntermSymbol* 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: @@ -3151,10 +3245,6 @@ spv::Id TGlslangToSpvTraverser::createSpvVariable(const glslang::TIntermSymbol* addPre13Extension(spv::E_SPV_KHR_16bit_storage); 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); if (node->getType().getQualifier().storage == glslang::EvqBuffer) @@ -3162,24 +3252,27 @@ spv::Id TGlslangToSpvTraverser::createSpvVariable(const glslang::TIntermSymbol* else builder.addCapability(spv::CapabilityStorageUniform16); break; +#ifndef GLSLANG_WEB + case spv::StorageClassPushConstant: + addPre13Extension(spv::E_SPV_KHR_16bit_storage); + builder.addCapability(spv::CapabilityStoragePushConstant16); + break; case spv::StorageClassStorageBuffer: case spv::StorageClassPhysicalStorageBufferEXT: addPre13Extension(spv::E_SPV_KHR_16bit_storage); builder.addCapability(spv::CapabilityStorageUniformBufferBlock16); break; +#endif default: - if (node->getType().containsBasicType(glslang::EbtFloat16)) + if (node->getType().contains16BitFloat()) builder.addCapability(spv::CapabilityFloat16); - if (node->getType().containsBasicType(glslang::EbtInt16) || - node->getType().containsBasicType(glslang::EbtUint16)) + 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.addCapability(spv::CapabilityStoragePushConstant8); @@ -3205,15 +3298,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); @@ -3271,15 +3364,6 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty spvType = builder.makeVoidType(); assert (! type.isArray()); break; - case glslang::EbtFloat: - spvType = builder.makeFloatType(32); - break; - 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. @@ -3288,6 +3372,22 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty 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::EbtInt8: spvType = builder.makeIntType(8); break; @@ -3300,12 +3400,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; @@ -3316,22 +3410,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); } @@ -3357,23 +3467,6 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty 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; @@ -3392,6 +3485,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); @@ -3438,11 +3535,13 @@ 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.addCapability(spv::CapabilityRuntimeDescriptorArrayEXT); } spvType = builder.makeRuntimeArray(spvType); +#endif } if (stride > 0) builder.addDecoration(spvType, spv::DecorationArrayStride, stride); @@ -3457,7 +3556,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" && @@ -3524,7 +3623,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)); } @@ -3591,13 +3690,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 @@ -3606,6 +3706,7 @@ void TGlslangToSpvTraverser::decorateStructType(const glslang::TType& type, for (unsigned int i = 0; i < memory.size(); ++i) 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. @@ -3643,6 +3744,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())); @@ -3652,7 +3754,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){ @@ -3991,10 +4092,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: @@ -4057,7 +4158,7 @@ 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. @@ -4093,8 +4194,12 @@ void TGlslangToSpvTraverser::makeFunctions(const glslang::TIntermSequence& glslF std::vector> 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) { @@ -4128,13 +4233,11 @@ void TGlslangToSpvTraverser::makeFunctions(const glslang::TIntermSequence& glslF builder.addName(function->getParamId(p), parameters[p]->getAsSymbolNode()->getName().c_str()); const glslang::TType& paramType = parameters[p]->getAsTyped()->getType(); - if (paramType.containsBasicType(glslang::EbtInt8) || - paramType.containsBasicType(glslang::EbtUint8)) + if (paramType.contains8BitInt()) builder.addCapability(spv::CapabilityInt8); - if (paramType.containsBasicType(glslang::EbtInt16) || - paramType.containsBasicType(glslang::EbtUint16)) + if (paramType.contains16BitInt()) builder.addCapability(spv::CapabilityInt16); - if (paramType.containsBasicType(glslang::EbtFloat16)) + if (paramType.contains16BitFloat()) builder.addCapability(spv::CapabilityFloat16); } } @@ -4180,13 +4283,13 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate& 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 } @@ -4195,6 +4298,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()) { @@ -4215,7 +4319,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; @@ -4229,21 +4332,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; @@ -4252,7 +4340,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: @@ -4268,23 +4355,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; @@ -4294,7 +4364,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; @@ -4308,8 +4377,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; @@ -4327,7 +4394,6 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate& if (i == 7) lvalue = true; break; -#endif default: break; } @@ -4337,6 +4403,7 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate& lvalueCoherentFlags = builder.getAccessChain().coherentFlags; lvalueCoherentFlags |= TranslateCoherent(glslangArguments[i]->getAsTyped()->getType()); } else +#endif arguments.push_back(accessChainLoad(glslangArguments[i]->getAsTyped()->getType())); } } @@ -4361,7 +4428,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; @@ -4408,6 +4477,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); @@ -4418,6 +4488,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; @@ -4459,12 +4530,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); } @@ -4476,22 +4547,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(); @@ -4503,12 +4568,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))) }; @@ -4526,18 +4589,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 { @@ -4546,16 +4601,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(); @@ -4567,12 +4620,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))) }; @@ -4583,28 +4634,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(); @@ -4616,12 +4661,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); @@ -4644,7 +4687,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; @@ -4666,7 +4709,7 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO } } -#ifdef AMD_EXTENSIONS +#ifndef GLSLANG_WEB // Check for fragment mask functions other than queries if (cracked.fragMask) { assert(sampler.ms); @@ -4707,45 +4750,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; } @@ -4757,7 +4787,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 || @@ -4775,11 +4805,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) { @@ -4800,19 +4826,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; } @@ -4833,6 +4855,7 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO ++extraArgs; } +#ifndef GLSLANG_WEB // lod clamp if (cracked.lodClamp) { params.lodClamp = arguments[2 + extraArgs]; @@ -4843,7 +4866,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 @@ -4853,7 +4875,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 @@ -4870,7 +4891,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); @@ -5222,8 +5243,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); } @@ -5235,7 +5256,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; } @@ -5296,8 +5317,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); } @@ -5361,8 +5382,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); } @@ -5401,14 +5422,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: @@ -5586,6 +5607,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; @@ -5604,6 +5626,7 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDe case glslang::EOpUnpackDouble2x32: libCall = spv::GLSLstd450UnpackDouble2x32; break; +#endif case glslang::EOpPackInt2x32: case glslang::EOpUnpackInt2x32: @@ -5637,31 +5660,7 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDe case glslang::EOpFwidth: unaryOp = spv::OpFwidth; break; - case glslang::EOpDPdxFine: - unaryOp = spv::OpDPdxFine; - break; - case glslang::EOpDPdyFine: - unaryOp = spv::OpDPdyFine; - break; - case glslang::EOpFwidthFine: - unaryOp = spv::OpFwidthFine; - break; - case glslang::EOpDPdxCoarse: - unaryOp = spv::OpDPdxCoarse; - break; - case glslang::EOpDPdyCoarse: - unaryOp = spv::OpDPdyCoarse; - break; - case glslang::EOpFwidthCoarse: - 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; @@ -5682,6 +5681,30 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDe libCall = spv::GLSLstd450SSign; break; +#ifndef GLSLANG_WEB + case glslang::EOpDPdxFine: + unaryOp = spv::OpDPdxFine; + break; + case glslang::EOpDPdyFine: + unaryOp = spv::OpDPdyFine; + break; + case glslang::EOpFwidthFine: + unaryOp = spv::OpFwidthFine; + break; + case glslang::EOpDPdxCoarse: + unaryOp = spv::OpDPdxCoarse; + break; + case glslang::EOpDPdyCoarse: + unaryOp = spv::OpDPdyCoarse; + break; + case glslang::EOpFwidthCoarse: + unaryOp = spv::OpFwidthCoarse; + break; + case glslang::EOpInterpolateAtCentroid: + if (typeProxy == glslang::EbtFloat16) + builder.addExtension(spv::E_SPV_AMD_gpu_shader_half_float); + libCall = spv::GLSLstd450InterpolateAtCentroid; + break; case glslang::EOpAtomicCounterIncrement: case glslang::EOpAtomicCounterDecrement: case glslang::EOpAtomicCounter: @@ -5713,7 +5736,6 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDe case glslang::EOpAnyInvocation: case glslang::EOpAllInvocations: case glslang::EOpAllInvocationsEqual: -#ifdef AMD_EXTENSIONS case glslang::EOpMinInvocations: case glslang::EOpMaxInvocations: case glslang::EOpAddInvocations: @@ -5732,7 +5754,6 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDe case glslang::EOpMinInvocationsExclusiveScanNonUniform: case glslang::EOpMaxInvocationsExclusiveScanNonUniform: case glslang::EOpAddInvocationsExclusiveScanNonUniform: -#endif { std::vector operands; operands.push_back(operand); @@ -5777,7 +5798,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; @@ -5792,15 +5812,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; @@ -5819,8 +5837,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); } @@ -5848,14 +5866,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; } @@ -5947,110 +5965,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; @@ -6085,17 +6042,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: @@ -6121,13 +6067,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); @@ -6154,6 +6103,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: @@ -6264,6 +6278,8 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, OpDecora case glslang::EOpConvPtrToUint64: convOp = spv::OpConvertPtrToU; break; +#endif + default: break; } @@ -6280,7 +6296,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; } @@ -6383,7 +6399,9 @@ spv::Id TGlslangToSpvTraverser::createAtomicOperation(glslang::TOperator op, spv scopeId = builder.makeUintConstant(spv::ScopeDevice); } // semantics default to relaxed - spv::Id semanticsId = builder.makeUintConstant(lvalueCoherentFlags.volatil ? spv::MemorySemanticsVolatileMask : spv::MemorySemanticsMaskNone); + spv::Id semanticsId = builder.makeUintConstant(lvalueCoherentFlags.isVolatile() ? + spv::MemorySemanticsVolatileMask : + spv::MemorySemanticsMaskNone); spv::Id semanticsId2 = semanticsId; pointerId = operands[0]; @@ -6454,10 +6472,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& operands, glslang::TBasicType typeProxy) { -#ifdef AMD_EXTENSIONS bool isUnsigned = isTypeUnsignedInt(typeProxy); bool isFloat = isTypeFloat(typeProxy); -#endif spv::Op opCode = spv::OpNop; std::vector spvGroupOperands; @@ -6474,7 +6490,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 || @@ -6485,9 +6500,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: @@ -6522,7 +6535,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) { @@ -6569,7 +6581,6 @@ spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op builder.createCompositeConstruct(uvec2Type, components)); } -#ifdef AMD_EXTENSIONS case glslang::EOpMinInvocations: case glslang::EOpMaxInvocations: case glslang::EOpAddInvocations: @@ -6656,7 +6667,6 @@ spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op return CreateInvocationsVectorOperation(opCode, groupOperation, typeId, operands); break; -#endif default: logger->missingFunctionality("invocation operation"); return spv::NoResult; @@ -6670,7 +6680,6 @@ spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op spv::Id TGlslangToSpvTraverser::CreateInvocationsVectorOperation(spv::Op op, spv::GroupOperation groupOperation, spv::Id typeId, std::vector& 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 || @@ -6678,12 +6687,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. @@ -6807,7 +6810,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: @@ -6832,7 +6834,6 @@ 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!"); } @@ -6866,11 +6867,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 { @@ -6881,11 +6880,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 { @@ -6896,11 +6893,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) { @@ -6913,11 +6908,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) { @@ -6930,11 +6923,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 { @@ -6945,11 +6936,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 { @@ -6960,11 +6949,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 { @@ -7022,7 +7009,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: @@ -7050,7 +7036,6 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s case glslang::EOpSubgroupPartitionedExclusiveXor: groupOperation = spv::GroupOperationPartitionedExclusiveScanNV; break; -#endif } // build the instruction @@ -7182,18 +7167,15 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: case glslang::EOpRefract: libCall = spv::GLSLstd450Refract; 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: @@ -7235,11 +7217,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 @@ -7269,7 +7249,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: @@ -7291,10 +7270,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; @@ -7348,7 +7325,6 @@ 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. @@ -7391,7 +7367,6 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: } break; -#ifdef NV_EXTENSIONS case glslang::EOpReportIntersectionNV: { typeId = builder.makeBoolType(); @@ -7413,11 +7388,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; } @@ -7461,6 +7435,7 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: } } +#ifndef GLSLANG_WEB // Decode the return types that were structures switch (op) { case glslang::EOpAddCarry: @@ -7490,6 +7465,7 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: default: break; } +#endif return builder.setPrecision(id, precision); } @@ -7497,6 +7473,7 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: // Intrinsics with no arguments (or no return value, and no precision). spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId) { +#ifndef GLSLANG_WEB // GLSL memory barriers use queuefamily scope in new model, device scope in old model spv::Scope memoryBarrierScope = glslangIntermediate->usingVulkanMemoryModel() ? spv::ScopeQueueFamilyKHR : spv::ScopeDevice; @@ -7595,22 +7572,18 @@ spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op, spv: std::vector operands; return createSubgroupOperation(op, typeId, operands, glslang::EbtVoid); } -#ifdef AMD_EXTENSIONS case glslang::EOpTime: { std::vector 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; -#endif case glslang::EOpBeginInvocationInterlock: builder.createNoResultOp(spv::OpBeginInvocationInterlockEXT); @@ -7642,11 +7615,14 @@ spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op, spv: builder.addCapability(spv::CapabilityShaderClockKHR); return builder.createOp(spv::OpReadClockKHR, typeId, args); } - default: - logger->missingFunctionality("unknown operation with no arguments"); - return 0; + break; } +#endif + + logger->missingFunctionality("unknown operation with no arguments"); + + return 0; } spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol) @@ -7670,15 +7646,15 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol 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); @@ -7717,6 +7693,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 memory; TranslateMemoryDecoration(symbol->getType().getQualifier(), memory, glslangIntermediate->usingVulkanMemoryModel()); @@ -7724,15 +7706,9 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol builder.addDecoration(id, memory[i]); } - // add built-in variable decoration - 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 @@ -7771,7 +7747,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"); @@ -7779,14 +7754,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) { @@ -7847,6 +7823,7 @@ spv::Id TGlslangToSpvTraverser::createSpvConstant(const glslang::TIntermTyped& n // We now know we have a specialization constant to build +#ifndef GLSLANG_WEB // gl_WorkGroupSize is a special case until the front-end handles hierarchical specialization constants, // even then, it's specialization ids are handled by special case syntax in GLSL: layout(local_size_x = ... if (node.getType().getQualifier().builtIn == glslang::EbvWorkGroupSize) { @@ -7861,6 +7838,7 @@ spv::Id TGlslangToSpvTraverser::createSpvConstant(const glslang::TIntermTyped& n } return builder.makeCompositeConstant(builder.makeVectorType(builder.makeUintType(32), 3), dimConstId, true); } +#endif // An AST node labelled as specialization constant should be a symbol node. // Its initializer should either be a sub tree with constant nodes, or a constant union array. @@ -7922,6 +7900,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; @@ -7934,30 +7925,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; @@ -7969,6 +7949,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; @@ -7981,34 +7974,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; @@ -8152,7 +8134,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) @@ -8212,6 +8194,7 @@ void OutputSpvBin(const std::vector& spirv, const char* baseName) // Write SPIR-V out to a text file with 32-bit hexadecimal words void OutputSpvHex(const std::vector& 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()) @@ -8239,6 +8222,7 @@ void OutputSpvHex(const std::vector& spirv, const char* baseName, out << "};"; } out.close(); +#endif } // diff --git a/SPIRV/Logger.cpp b/SPIRV/Logger.cpp index 48bd4e3a..7ea0c634 100644 --- a/SPIRV/Logger.cpp +++ b/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 @@ -66,3 +68,5 @@ std::string SpvBuildLogger::getAllMessages() const { } } // end spv namespace + +#endif \ No newline at end of file diff --git a/SPIRV/Logger.h b/SPIRV/Logger.h index 2e4ddaf5..411367c0 100644 --- a/SPIRV/Logger.h +++ b/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/SPIRV/SpvBuilder.cpp b/SPIRV/SpvBuilder.cpp index 4ef7e5fe..bd208952 100644 --- a/SPIRV/SpvBuilder.cpp +++ b/SPIRV/SpvBuilder.cpp @@ -46,7 +46,9 @@ #include "SpvBuilder.h" +#ifndef GLSLANG_WEB #include "hex_float.h" +#endif #ifndef _WIN32 #include @@ -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(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& 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(query)); + addCapability(CapabilityImageQuery); return query->getResultId(); } @@ -2282,7 +2313,12 @@ Id Builder::createMatrixConstructor(Decoration precision, const std::vector& 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/SPIRV/SpvBuilder.h b/SPIRV/SpvBuilder.h index faed8e82..a99a0c30 100644 --- a/SPIRV/SpvBuilder.h +++ b/SPIRV/SpvBuilder.h @@ -201,7 +201,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 +561,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 +589,6 @@ public: isImage = 0; } - CoherentFlags() { clear(); } CoherentFlags operator |=(const CoherentFlags &other) { coherent |= other.coherent; devicecoherent |= other.devicecoherent; @@ -589,6 +600,7 @@ public: isImage |= other.isImage; return *this; } +#endif }; CoherentFlags coherentFlags; }; diff --git a/SPIRV/SpvPostProcess.cpp b/SPIRV/SpvPostProcess.cpp index 6e1f7cf6..18765a31 100644 --- a/SPIRV/SpvPostProcess.cpp +++ b/SPIRV/SpvPostProcess.cpp @@ -51,12 +51,8 @@ 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 { @@ -160,7 +156,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 +171,6 @@ void Builder::postProcessType(const Instruction& inst, Id typeId) default: break; } -#endif break; default: if (basicTypeOp == OpTypeFloat && width == 16) @@ -222,12 +216,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: diff --git a/SPIRV/SpvTools.h b/SPIRV/SpvTools.h index cf8fc859..7422d012 100644 --- a/SPIRV/SpvTools.h +++ b/SPIRV/SpvTools.h @@ -41,8 +41,10 @@ #ifndef GLSLANG_SPV_TOOLS_H #define GLSLANG_SPV_TOOLS_H +#ifdef ENABLE_OPT #include #include +#endif #include "../glslang/MachineIndependent/localintermediate.h" #include "Logger.h" @@ -59,7 +61,7 @@ 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& spirv); diff --git a/SPIRV/disassemble.cpp b/SPIRV/disassemble.cpp index 80ebac4a..930e7994 100644 --- a/SPIRV/disassemble.cpp +++ b/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; @@ -653,7 +628,6 @@ static void GLSLstd450GetDebugNames(const char** names) 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) { @@ -695,9 +669,7 @@ 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 || @@ -751,7 +723,6 @@ static const char* GLSLextNVGetDebugNames(const char* name, unsigned entrypoint) } return "Bad"; } -#endif void Disassemble(std::ostream& out, const std::vector& stream) { diff --git a/SPIRV/doc.cpp b/SPIRV/doc.cpp index ffa2af83..b0bcdfbe 100644 --- a/SPIRV/doc.cpp +++ b/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,11 @@ 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"; @@ -220,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"; @@ -289,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"; @@ -301,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"; @@ -371,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"; @@ -379,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"; @@ -405,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"; @@ -422,7 +398,6 @@ 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"; @@ -781,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"; } @@ -902,17 +875,14 @@ const char* CapabilityString(int info) 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"; @@ -927,7 +897,6 @@ const char* CapabilityString(int info) case CapabilityImageFootprintNV: return "ImageFootprintNV"; // case CapabilityShadingRateNV: return "ShadingRateNV"; // superseded by FragmentDensityEXT case CapabilitySampleMaskOverrideCoverageNV: return "SampleMaskOverrideCoverageNV"; -#endif case CapabilityFragmentDensityEXT: return "FragmentDensityEXT"; case CapabilityFragmentFullyCoveredEXT: return "FragmentFullyCoveredEXT"; @@ -1337,7 +1306,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"; @@ -1349,14 +1317,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"; @@ -1366,7 +1332,6 @@ 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"; @@ -2686,7 +2651,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'"); @@ -2725,9 +2689,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); @@ -2765,7 +2727,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'"); diff --git a/StandAlone/ResourceLimits.cpp b/StandAlone/ResourceLimits.cpp index 66e79af9..028caa66 100644 --- a/StandAlone/ResourceLimits.cpp +++ b/StandAlone/ResourceLimits.cpp @@ -234,7 +234,6 @@ std::string GetDefaultTBuiltInResourceString() << "MaxCullDistances " << DefaultTBuiltInResource.maxCullDistances << "\n" << "MaxCombinedClipAndCullDistances " << DefaultTBuiltInResource.maxCombinedClipAndCullDistances << "\n" << "MaxSamples " << DefaultTBuiltInResource.maxSamples << "\n" -#ifdef NV_EXTENSIONS << "MaxMeshOutputVerticesNV " << DefaultTBuiltInResource.maxMeshOutputVerticesNV << "\n" << "MaxMeshOutputPrimitivesNV " << DefaultTBuiltInResource.maxMeshOutputPrimitivesNV << "\n" << "MaxMeshWorkGroupSizeX_NV " << DefaultTBuiltInResource.maxMeshWorkGroupSizeX_NV << "\n" @@ -244,7 +243,6 @@ std::string GetDefaultTBuiltInResourceString() << "MaxTaskWorkGroupSizeY_NV " << DefaultTBuiltInResource.maxTaskWorkGroupSizeY_NV << "\n" << "MaxTaskWorkGroupSizeZ_NV " << DefaultTBuiltInResource.maxTaskWorkGroupSizeZ_NV << "\n" << "MaxMeshViewCountNV " << DefaultTBuiltInResource.maxMeshViewCountNV << "\n" -#endif << "nonInductiveForLoops " << DefaultTBuiltInResource.limits.nonInductiveForLoops << "\n" << "whileLoops " << DefaultTBuiltInResource.limits.whileLoops << "\n" << "doWhileLoops " << DefaultTBuiltInResource.limits.doWhileLoops << "\n" @@ -451,7 +449,6 @@ void DecodeResourceLimits(TBuiltInResource* resources, char* config) resources->maxCombinedClipAndCullDistances = value; else if (tokenStr == "MaxSamples") resources->maxSamples = value; -#ifdef NV_EXTENSIONS else if (tokenStr == "MaxMeshOutputVerticesNV") resources->maxMeshOutputVerticesNV = value; else if (tokenStr == "MaxMeshOutputPrimitivesNV") @@ -470,7 +467,6 @@ void DecodeResourceLimits(TBuiltInResource* resources, char* config) resources->maxTaskWorkGroupSizeZ_NV = value; else if (tokenStr == "MaxMeshViewCountNV") resources->maxMeshViewCountNV = value; -#endif else if (tokenStr == "nonInductiveForLoops") resources->limits.nonInductiveForLoops = (value != 0); else if (tokenStr == "whileLoops") diff --git a/StandAlone/StandAlone.cpp b/StandAlone/StandAlone.cpp index 3bb3af39..9fa311bc 100644 --- a/StandAlone/StandAlone.cpp +++ b/StandAlone/StandAlone.cpp @@ -146,11 +146,13 @@ void ProcessConfigFile() { if (ConfigFile.size() == 0) Resources = glslang::DefaultTBuiltInResource; +#ifndef GLSLANG_WEB else { char* configString = ReadFileData(ConfigFile.c_str()); glslang::DecodeResourceLimits(&Resources, configString); FreeFileData(configString); } +#endif } int ReflectOptions = EShReflectionDefault; @@ -255,7 +257,6 @@ const char* GetBinaryName(EShLanguage stage) case EShLangGeometry: name = "geom.spv"; break; case EShLangFragment: name = "frag.spv"; break; case EShLangCompute: name = "comp.spv"; break; -#ifdef NV_EXTENSIONS case EShLangRayGenNV: name = "rgen.spv"; break; case EShLangIntersectNV: name = "rint.spv"; break; case EShLangAnyHitNV: name = "rahit.spv"; break; @@ -264,7 +265,6 @@ const char* GetBinaryName(EShLanguage stage) case EShLangCallableNV: name = "rcall.spv"; break; case EShLangMeshNV: name = "mesh.spv"; break; case EShLangTaskNV: name = "task.spv"; break; -#endif default: name = "unknown"; break; } } else @@ -977,6 +977,7 @@ void CompileAndLinkShaderUnits(std::vector compUnits) shader->setPreamble(UserPreamble.get()); shader->addProcesses(Processes); +#ifndef GLSLANG_WEB // Set IO mapper binding shift values for (int r = 0; r < glslang::EResCount; ++r) { const glslang::TResourceType res = glslang::TResourceType(r); @@ -990,30 +991,33 @@ void CompileAndLinkShaderUnits(std::vector compUnits) i != baseBindingForSet[res][compUnit.stage].end(); ++i) shader->setShiftBindingForSet(res, i->second, i->first); } - - shader->setFlattenUniformArrays((Options & EOptionFlattenUniformArrays) != 0); shader->setNoStorageFormat((Options & EOptionNoStorageFormat) != 0); - shader->setNanMinMaxClamp(NaNClamp); shader->setResourceSetBinding(baseResourceSetBinding[compUnit.stage]); - if (Options & EOptionHlslIoMapping) - shader->setHlslIoMapping(true); - if (Options & EOptionAutoMapBindings) shader->setAutoMapBindings(true); if (Options & EOptionAutoMapLocations) shader->setAutoMapLocations(true); - if (Options & EOptionInvertY) - shader->setInvertY(true); - for (auto& uniOverride : uniformLocationOverrides) { shader->addUniformLocationOverride(uniOverride.first.c_str(), uniOverride.second); } shader->setUniformLocationBase(uniformBase); +#endif + + shader->setNanMinMaxClamp(NaNClamp); + +#ifdef ENABLE_HLSL + shader->setFlattenUniformArrays((Options & EOptionFlattenUniformArrays) != 0); + if (Options & EOptionHlslIoMapping) + shader->setHlslIoMapping(true); +#endif + + if (Options & EOptionInvertY) + shader->setInvertY(true); // Set up the environment, some subsettings take precedence over earlier // ways of setting things. @@ -1023,8 +1027,10 @@ void CompileAndLinkShaderUnits(std::vector compUnits) compUnit.stage, Client, ClientInputSemanticsVersion); shader->setEnvClient(Client, ClientVersion); shader->setEnvTarget(TargetLanguage, TargetVersion); +#ifdef ENABLE_HLSL if (targetHlslFunctionality1) shader->setEnvTargetHlslFunctionality1(); +#endif } shaders.push_back(shader); @@ -1034,6 +1040,7 @@ void CompileAndLinkShaderUnits(std::vector compUnits) DirStackFileIncluder includer; std::for_each(IncludeDirectoryList.rbegin(), IncludeDirectoryList.rend(), [&includer](const std::string& dir) { includer.pushExternalLocalDirectory(dir); }); +#ifndef GLSLANG_WEB if (Options & EOptionOutputPreprocessed) { std::string str; if (shader->preprocess(&Resources, defaultVersion, ENoProfile, false, false, messages, &str, includer)) { @@ -1045,6 +1052,7 @@ void CompileAndLinkShaderUnits(std::vector compUnits) StderrIfNonEmpty(shader->getInfoDebugLog()); continue; } +#endif if (! shader->parse(&Resources, defaultVersion, false, messages, includer)) CompileFailed = true; @@ -1067,11 +1075,13 @@ void CompileAndLinkShaderUnits(std::vector compUnits) if (! (Options & EOptionOutputPreprocessed) && ! program.link(messages)) LinkFailed = true; +#ifndef GLSLANG_WEB // Map IO if (Options & EOptionSpv) { if (!program.mapIO()) LinkFailed = true; } +#endif // Report if (! (Options & EOptionSuppressInfolog) && @@ -1080,11 +1090,13 @@ void CompileAndLinkShaderUnits(std::vector compUnits) PutsIfNonEmpty(program.getInfoDebugLog()); } +#ifndef GLSLANG_WEB // Reflect if (Options & EOptionDumpReflection) { program.buildReflection(ReflectOptions); program.dumpReflection(); } +#endif // Dump SPIR-V if (Options & EOptionSpv) { @@ -1114,8 +1126,10 @@ void CompileAndLinkShaderUnits(std::vector compUnits) } else { glslang::OutputSpvBin(spirv, GetBinaryName((EShLanguage)stage)); } +#ifndef GLSLANG_WEB if (!SpvToolsDisassembler && (Options & EOptionHumanReadableSpv)) spv::Disassemble(std::cout, spirv); +#endif } } } @@ -1203,11 +1217,13 @@ int singleMain() workList.add(item.get()); }); +#ifndef GLSLANG_WEB if (Options & EOptionDumpConfig) { printf("%s", glslang::GetDefaultTBuiltInResourceString().c_str()); if (workList.empty()) return ESuccess; } +#endif if (Options & EOptionDumpBareVersion) { printf("%d.%d.%d\n", @@ -1379,7 +1395,6 @@ EShLanguage FindLanguage(const std::string& name, bool parseStageName) return EShLangFragment; else if (stageName == "comp") return EShLangCompute; -#ifdef NV_EXTENSIONS else if (stageName == "rgen") return EShLangRayGenNV; else if (stageName == "rint") @@ -1396,7 +1411,6 @@ EShLanguage FindLanguage(const std::string& name, bool parseStageName) return EShLangMeshNV; else if (stageName == "task") return EShLangTaskNV; -#endif usage(); return EShLangVertex; @@ -1466,7 +1480,6 @@ void usage() " .geom for a geometry shader\n" " .frag for a fragment shader\n" " .comp for a compute shader\n" -#ifdef NV_EXTENSIONS " .mesh for a mesh shader\n" " .task for a task shader\n" " .rgen for a ray generation shader\n" @@ -1475,7 +1488,6 @@ void usage() " .rchit for a ray closest hit shader\n" " .rmiss for a ray miss shader\n" " .rcall for a ray callable shader\n" -#endif " .glsl for .vert.glsl, .tesc.glsl, ..., .comp.glsl compound suffixes\n" " .hlsl for .vert.hlsl, .tesc.hlsl, ..., .comp.hlsl compound suffixes\n" "\n" diff --git a/Test/310.inheritMemory.frag b/Test/310.inheritMemory.frag new file mode 100644 index 00000000..bdf12832 --- /dev/null +++ b/Test/310.inheritMemory.frag @@ -0,0 +1,43 @@ +#version 310 es +precision mediump float; + +struct S { + float buff[10]; +}; + +layout(std430, binding=2) readonly buffer RoBuff { + float buff_ro[10]; + S s_ro; +} ro_buffer; + +layout(std430, binding=2) buffer Buff { + float buff[10]; + S s; +} non_ro_buffer; + +void non_ro_fun(float[10] buff) { } +void non_ro_funf(float el) { } +void non_ro_funS(S s) { } + +out vec4 fragColor; + +void main() +{ + S s; + + non_ro_fun(s.buff); + non_ro_funf(s.buff[3]); + non_ro_funS(s); + + non_ro_fun(non_ro_buffer.buff); + non_ro_fun(non_ro_buffer.s.buff); + non_ro_funf(non_ro_buffer.buff[3]); + non_ro_funf(non_ro_buffer.s.buff[3]); + non_ro_funS(non_ro_buffer.s); + + non_ro_fun(ro_buffer.buff_ro); + non_ro_fun(ro_buffer.s_ro.buff); + non_ro_funf(ro_buffer.buff_ro[3]); + non_ro_funf(ro_buffer.s_ro.buff[3]); + non_ro_funS(ro_buffer.s_ro); +} diff --git a/Test/baseResults/310.comp.out b/Test/baseResults/310.comp.out index b4136b0a..538b750f 100644 --- a/Test/baseResults/310.comp.out +++ b/Test/baseResults/310.comp.out @@ -119,9 +119,9 @@ ERROR: node is still EOpNull! 0:59 Function Parameters: 0:61 Sequence 0:61 move second child to first child ( temp highp float) -0:61 direct index (layout( column_major shared) temp highp float) -0:61 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) -0:61 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:61 direct index (layout( column_major shared) readonly temp highp float) +0:61 values: direct index for structure (layout( column_major shared) readonly buffer unsized 3-element array of highp float) +0:61 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) readonly buffer highp int value, layout( column_major shared) readonly buffer unsized 3-element array of highp float values}) 0:61 Constant: 0:61 1 (const int) 0:61 Constant: @@ -129,8 +129,8 @@ ERROR: node is still EOpNull! 0:61 Constant: 0:61 4.700000 0:62 array length ( temp int) -0:62 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) -0:62 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:62 values: direct index for structure (layout( column_major shared) readonly buffer unsized 3-element array of highp float) +0:62 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) readonly buffer highp int value, layout( column_major shared) readonly buffer unsized 3-element array of highp float values}) 0:62 Constant: 0:62 1 (const int) 0:63 Pre-Increment ( temp highp 4-component vector of float) @@ -282,9 +282,9 @@ ERROR: node is still EOpNull! 0:? Sequence 0:194 move second child to first child ( temp highp float) 0:194 'g' ( temp highp float) -0:194 direct index (layout( column_major shared) temp highp float) -0:194 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) -0:194 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:194 direct index (layout( column_major shared) writeonly temp highp float) +0:194 values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float) +0:194 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:194 Constant: 0:194 1 (const int) 0:194 Constant: @@ -292,42 +292,42 @@ ERROR: node is still EOpNull! 0:195 Sequence 0:195 move second child to first child ( temp highp float) 0:195 'f' ( temp highp float) -0:195 direct index (layout( column_major shared) temp highp float) -0:195 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) -0:195 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:195 direct index (layout( column_major shared) writeonly temp highp float) +0:195 values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float) +0:195 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:195 Constant: 0:195 1 (const int) 0:195 Constant: 0:195 2 (const int) 0:196 Pre-Increment ( temp highp float) -0:196 direct index (layout( column_major shared) temp highp float) -0:196 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) -0:196 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:196 direct index (layout( column_major shared) writeonly temp highp float) +0:196 values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float) +0:196 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:196 Constant: 0:196 1 (const int) 0:196 Constant: 0:196 2 (const int) 0:197 Post-Decrement ( temp highp float) -0:197 direct index (layout( column_major shared) temp highp float) -0:197 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) -0:197 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:197 direct index (layout( column_major shared) writeonly temp highp float) +0:197 values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float) +0:197 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:197 Constant: 0:197 1 (const int) 0:197 Constant: 0:197 2 (const int) 0:198 add ( temp highp float) 0:198 'f' ( temp highp float) -0:198 direct index (layout( column_major shared) temp highp float) -0:198 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) -0:198 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:198 direct index (layout( column_major shared) writeonly temp highp float) +0:198 values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float) +0:198 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:198 Constant: 0:198 1 (const int) 0:198 Constant: 0:198 2 (const int) 0:199 subtract ( temp highp float) -0:199 direct index (layout( column_major shared) temp highp float) -0:199 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) -0:199 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:199 direct index (layout( column_major shared) writeonly temp highp float) +0:199 values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float) +0:199 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:199 Constant: 0:199 1 (const int) 0:199 Constant: @@ -339,9 +339,9 @@ ERROR: node is still EOpNull! 0:201 true case 0:201 'f' ( temp highp float) 0:201 false case -0:201 direct index (layout( column_major shared) temp highp float) -0:201 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) -0:201 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:201 direct index (layout( column_major shared) writeonly temp highp float) +0:201 values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float) +0:201 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:201 Constant: 0:201 1 (const int) 0:201 Constant: @@ -350,9 +350,9 @@ ERROR: node is still EOpNull! 0:202 Condition 0:202 'b' ( temp bool) 0:202 true case -0:202 direct index (layout( column_major shared) temp highp float) -0:202 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) -0:202 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:202 direct index (layout( column_major shared) writeonly temp highp float) +0:202 values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float) +0:202 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:202 Constant: 0:202 1 (const int) 0:202 Constant: @@ -363,9 +363,9 @@ ERROR: node is still EOpNull! 0:203 Condition 0:203 Compare Equal ( temp bool) 0:203 'f' ( temp highp float) -0:203 direct index (layout( column_major shared) temp highp float) -0:203 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) -0:203 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:203 direct index (layout( column_major shared) writeonly temp highp float) +0:203 values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float) +0:203 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:203 Constant: 0:203 1 (const int) 0:203 Constant: @@ -377,9 +377,9 @@ ERROR: node is still EOpNull! 0:205 Condition 0:205 Compare Greater Than or Equal ( temp bool) 0:205 'f' ( temp highp float) -0:205 direct index (layout( column_major shared) temp highp float) -0:205 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) -0:205 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:205 direct index (layout( column_major shared) writeonly temp highp float) +0:205 values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float) +0:205 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:205 Constant: 0:205 1 (const int) 0:205 Constant: @@ -391,9 +391,9 @@ ERROR: node is still EOpNull! 0:207 'f' ( temp highp float) 0:207 direct index ( temp highp float) 0:207 Construct vec3 ( temp highp 3-component vector of float) -0:207 direct index (layout( column_major shared) temp highp float) -0:207 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) -0:207 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:207 direct index (layout( column_major shared) writeonly temp highp float) +0:207 values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float) +0:207 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:207 Constant: 0:207 1 (const int) 0:207 Constant: @@ -401,14 +401,14 @@ ERROR: node is still EOpNull! 0:207 Constant: 0:207 0 (const int) 0:208 Bitwise not ( temp highp int) -0:208 value: direct index for structure (layout( column_major shared) buffer highp int) -0:208 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:208 value: direct index for structure (layout( column_major shared) writeonly buffer highp int) +0:208 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:208 Constant: 0:208 0 (const int) 0:209 move second child to first child ( temp highp float) -0:209 direct index (layout( column_major shared) temp highp float) -0:209 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) -0:209 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:209 direct index (layout( column_major shared) writeonly temp highp float) +0:209 values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float) +0:209 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:209 Constant: 0:209 1 (const int) 0:209 Constant: @@ -420,22 +420,22 @@ ERROR: node is still EOpNull! 0:? Sequence 0:221 move second child to first child ( temp highp float) 0:221 'g' ( temp highp float) -0:221 direct index (layout( column_major shared) temp highp float) -0:221 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) -0:221 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:221 direct index (layout( column_major shared) writeonly temp highp float) +0:221 values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float) +0:221 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:221 Constant: 0:221 1 (const int) 0:221 Constant: 0:221 2 (const int) 0:222 Bitwise not ( temp highp int) -0:222 value: direct index for structure (layout( column_major shared) buffer highp int) -0:222 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:222 value: direct index for structure (layout( column_major shared) writeonly buffer highp int) +0:222 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:222 Constant: 0:222 0 (const int) 0:223 move second child to first child ( temp highp float) -0:223 direct index (layout( column_major shared) temp highp float) -0:223 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) -0:223 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:223 direct index (layout( column_major shared) writeonly temp highp float) +0:223 values: direct index for structure (layout( column_major shared) writeonly buffer unsized 3-element array of highp float) +0:223 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:223 Constant: 0:223 1 (const int) 0:223 Constant: @@ -443,8 +443,8 @@ ERROR: node is still EOpNull! 0:223 Constant: 0:223 3.400000 0:224 move second child to first child ( temp highp int) -0:224 value: direct index for structure (layout( column_major shared) buffer highp int) -0:224 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:224 value: direct index for structure (layout( column_major shared) writeonly buffer highp int) +0:224 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:224 Constant: 0:224 0 (const int) 0:224 Constant: @@ -477,7 +477,7 @@ ERROR: node is still EOpNull! 0:? 'arrX' ( global 2-element array of highp int) 0:? 'arrY' ( global 1-element array of highp int) 0:? 'arrZ' ( global 4096-element array of highp int) -0:? 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:? 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) readonly buffer highp int value, layout( column_major shared) readonly buffer unsized 3-element array of highp float values}) 0:? 'v' ( buffer highp 4-component vector of float) 0:? 'us2dbad' ( uniform mediump usampler2D) 0:? 'us2d' ( uniform highp usampler2D) @@ -516,7 +516,7 @@ ERROR: node is still EOpNull! 0:? 'badQ1' (layout( rgba32f) coherent volatile restrict uniform highp image2D) 0:? 'badQ2' (layout( rgba8i) coherent volatile restrict uniform highp iimage2D) 0:? 'badQ3' (layout( rgba16ui) coherent volatile restrict uniform highp uimage2D) -0:? 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:? 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:? 'multio' (layout( column_major shared) buffer block{layout( column_major shared) readonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 1-element array of highp float values}) 0:? 'inbi' ( in block{ in highp int a}) 0:? 'outbi' ( out block{ out highp int a}) @@ -571,7 +571,7 @@ ERROR: node is still EOpNull! 0:? 'arrX' ( global 2-element array of highp int) 0:? 'arrY' ( global 1-element array of highp int) 0:? 'arrZ' ( global 4096-element array of highp int) -0:? 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:? 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) readonly buffer highp int value, layout( column_major shared) readonly buffer unsized 3-element array of highp float values}) 0:? 'v' ( buffer highp 4-component vector of float) 0:? 'us2dbad' ( uniform mediump usampler2D) 0:? 'us2d' ( uniform highp usampler2D) @@ -610,7 +610,7 @@ ERROR: node is still EOpNull! 0:? 'badQ1' (layout( rgba32f) coherent volatile restrict uniform highp image2D) 0:? 'badQ2' (layout( rgba8i) coherent volatile restrict uniform highp iimage2D) 0:? 'badQ3' (layout( rgba16ui) coherent volatile restrict uniform highp uimage2D) -0:? 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:? 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) writeonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 3-element array of highp float values}) 0:? 'multio' (layout( column_major shared) buffer block{layout( column_major shared) readonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 1-element array of highp float values}) 0:? 'inbi' ( in block{ in highp int a}) 0:? 'outbi' ( out block{ out highp int a}) diff --git a/Test/baseResults/310.inheritMemory.frag.out b/Test/baseResults/310.inheritMemory.frag.out new file mode 100644 index 00000000..6d5528b2 --- /dev/null +++ b/Test/baseResults/310.inheritMemory.frag.out @@ -0,0 +1,221 @@ +310.inheritMemory.frag +Shader version: 310 +0:? Sequence +0:18 Function Definition: non_ro_fun(f1[10]; ( global void) +0:18 Function Parameters: +0:18 'buff' ( in 10-element array of mediump float) +0:19 Function Definition: non_ro_funf(f1; ( global void) +0:19 Function Parameters: +0:19 'el' ( in mediump float) +0:20 Function Definition: non_ro_funS(struct-S-f1[10]1; ( global void) +0:20 Function Parameters: +0:20 's' ( in structure{ global 10-element array of mediump float buff}) +0:24 Function Definition: main( ( global void) +0:24 Function Parameters: +0:? Sequence +0:28 Function Call: non_ro_fun(f1[10]; ( global void) +0:28 buff: direct index for structure ( global 10-element array of mediump float) +0:28 's' ( temp structure{ global 10-element array of mediump float buff}) +0:28 Constant: +0:28 0 (const int) +0:29 Function Call: non_ro_funf(f1; ( global void) +0:29 direct index ( temp mediump float) +0:29 buff: direct index for structure ( global 10-element array of mediump float) +0:29 's' ( temp structure{ global 10-element array of mediump float buff}) +0:29 Constant: +0:29 0 (const int) +0:29 Constant: +0:29 3 (const int) +0:30 Function Call: non_ro_funS(struct-S-f1[10]1; ( global void) +0:30 's' ( temp structure{ global 10-element array of mediump float buff}) +0:32 Function Call: non_ro_fun(f1[10]; ( global void) +0:32 buff: direct index for structure (layout( column_major std430 offset=0) buffer 10-element array of mediump float) +0:32 'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s}) +0:32 Constant: +0:32 0 (const int) +0:33 Function Call: non_ro_fun(f1[10]; ( global void) +0:33 buff: direct index for structure ( global 10-element array of mediump float) +0:33 s: direct index for structure (layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff}) +0:33 'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s}) +0:33 Constant: +0:33 1 (const int) +0:33 Constant: +0:33 0 (const int) +0:34 Function Call: non_ro_funf(f1; ( global void) +0:34 direct index (layout( column_major std430 offset=0) temp mediump float) +0:34 buff: direct index for structure (layout( column_major std430 offset=0) buffer 10-element array of mediump float) +0:34 'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s}) +0:34 Constant: +0:34 0 (const int) +0:34 Constant: +0:34 3 (const int) +0:35 Function Call: non_ro_funf(f1; ( global void) +0:35 direct index ( temp mediump float) +0:35 buff: direct index for structure ( global 10-element array of mediump float) +0:35 s: direct index for structure (layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff}) +0:35 'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s}) +0:35 Constant: +0:35 1 (const int) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 3 (const int) +0:36 Function Call: non_ro_funS(struct-S-f1[10]1; ( global void) +0:36 s: direct index for structure (layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff}) +0:36 'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s}) +0:36 Constant: +0:36 1 (const int) +0:38 Function Call: non_ro_fun(f1[10]; ( global void) +0:38 buff_ro: direct index for structure (layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float) +0:38 'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro}) +0:38 Constant: +0:38 0 (const int) +0:39 Function Call: non_ro_fun(f1[10]; ( global void) +0:39 buff: direct index for structure ( readonly global 10-element array of mediump float) +0:39 s_ro: direct index for structure (layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff}) +0:39 'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro}) +0:39 Constant: +0:39 1 (const int) +0:39 Constant: +0:39 0 (const int) +0:40 Function Call: non_ro_funf(f1; ( global void) +0:40 direct index (layout( column_major std430 offset=0) readonly temp mediump float) +0:40 buff_ro: direct index for structure (layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float) +0:40 'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro}) +0:40 Constant: +0:40 0 (const int) +0:40 Constant: +0:40 3 (const int) +0:41 Function Call: non_ro_funf(f1; ( global void) +0:41 direct index ( readonly temp mediump float) +0:41 buff: direct index for structure ( readonly global 10-element array of mediump float) +0:41 s_ro: direct index for structure (layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff}) +0:41 'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro}) +0:41 Constant: +0:41 1 (const int) +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 3 (const int) +0:42 Function Call: non_ro_funS(struct-S-f1[10]1; ( global void) +0:42 s_ro: direct index for structure (layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff}) +0:42 'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro}) +0:42 Constant: +0:42 1 (const int) +0:? Linker Objects +0:? 'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro}) +0:? 'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s}) +0:? 'fragColor' ( out mediump 4-component vector of float) + + +Linked fragment stage: + + +Shader version: 310 +0:? Sequence +0:18 Function Definition: non_ro_fun(f1[10]; ( global void) +0:18 Function Parameters: +0:18 'buff' ( in 10-element array of mediump float) +0:19 Function Definition: non_ro_funf(f1; ( global void) +0:19 Function Parameters: +0:19 'el' ( in mediump float) +0:20 Function Definition: non_ro_funS(struct-S-f1[10]1; ( global void) +0:20 Function Parameters: +0:20 's' ( in structure{ global 10-element array of mediump float buff}) +0:24 Function Definition: main( ( global void) +0:24 Function Parameters: +0:? Sequence +0:28 Function Call: non_ro_fun(f1[10]; ( global void) +0:28 buff: direct index for structure ( global 10-element array of mediump float) +0:28 's' ( temp structure{ global 10-element array of mediump float buff}) +0:28 Constant: +0:28 0 (const int) +0:29 Function Call: non_ro_funf(f1; ( global void) +0:29 direct index ( temp mediump float) +0:29 buff: direct index for structure ( global 10-element array of mediump float) +0:29 's' ( temp structure{ global 10-element array of mediump float buff}) +0:29 Constant: +0:29 0 (const int) +0:29 Constant: +0:29 3 (const int) +0:30 Function Call: non_ro_funS(struct-S-f1[10]1; ( global void) +0:30 's' ( temp structure{ global 10-element array of mediump float buff}) +0:32 Function Call: non_ro_fun(f1[10]; ( global void) +0:32 buff: direct index for structure (layout( column_major std430 offset=0) buffer 10-element array of mediump float) +0:32 'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s}) +0:32 Constant: +0:32 0 (const int) +0:33 Function Call: non_ro_fun(f1[10]; ( global void) +0:33 buff: direct index for structure ( global 10-element array of mediump float) +0:33 s: direct index for structure (layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff}) +0:33 'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s}) +0:33 Constant: +0:33 1 (const int) +0:33 Constant: +0:33 0 (const int) +0:34 Function Call: non_ro_funf(f1; ( global void) +0:34 direct index (layout( column_major std430 offset=0) temp mediump float) +0:34 buff: direct index for structure (layout( column_major std430 offset=0) buffer 10-element array of mediump float) +0:34 'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s}) +0:34 Constant: +0:34 0 (const int) +0:34 Constant: +0:34 3 (const int) +0:35 Function Call: non_ro_funf(f1; ( global void) +0:35 direct index ( temp mediump float) +0:35 buff: direct index for structure ( global 10-element array of mediump float) +0:35 s: direct index for structure (layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff}) +0:35 'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s}) +0:35 Constant: +0:35 1 (const int) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 3 (const int) +0:36 Function Call: non_ro_funS(struct-S-f1[10]1; ( global void) +0:36 s: direct index for structure (layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff}) +0:36 'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s}) +0:36 Constant: +0:36 1 (const int) +0:38 Function Call: non_ro_fun(f1[10]; ( global void) +0:38 buff_ro: direct index for structure (layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float) +0:38 'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro}) +0:38 Constant: +0:38 0 (const int) +0:39 Function Call: non_ro_fun(f1[10]; ( global void) +0:39 buff: direct index for structure ( readonly global 10-element array of mediump float) +0:39 s_ro: direct index for structure (layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff}) +0:39 'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro}) +0:39 Constant: +0:39 1 (const int) +0:39 Constant: +0:39 0 (const int) +0:40 Function Call: non_ro_funf(f1; ( global void) +0:40 direct index (layout( column_major std430 offset=0) readonly temp mediump float) +0:40 buff_ro: direct index for structure (layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float) +0:40 'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro}) +0:40 Constant: +0:40 0 (const int) +0:40 Constant: +0:40 3 (const int) +0:41 Function Call: non_ro_funf(f1; ( global void) +0:41 direct index ( readonly temp mediump float) +0:41 buff: direct index for structure ( readonly global 10-element array of mediump float) +0:41 s_ro: direct index for structure (layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff}) +0:41 'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro}) +0:41 Constant: +0:41 1 (const int) +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 3 (const int) +0:42 Function Call: non_ro_funS(struct-S-f1[10]1; ( global void) +0:42 s_ro: direct index for structure (layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff}) +0:42 'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro}) +0:42 Constant: +0:42 1 (const int) +0:? Linker Objects +0:? 'ro_buffer' (layout( binding=2 column_major std430) readonly buffer block{layout( column_major std430 offset=0) readonly buffer 10-element array of mediump float buff_ro, layout( column_major std430 offset=40) readonly buffer structure{ global 10-element array of mediump float buff} s_ro}) +0:? 'non_ro_buffer' (layout( binding=2 column_major std430) buffer block{layout( column_major std430 offset=0) buffer 10-element array of mediump float buff, layout( column_major std430 offset=40) buffer structure{ global 10-element array of mediump float buff} s}) +0:? 'fragColor' ( out mediump 4-component vector of float) + diff --git a/Test/baseResults/310.vert.out b/Test/baseResults/310.vert.out index baf09870..a910e345 100644 --- a/Test/baseResults/310.vert.out +++ b/Test/baseResults/310.vert.out @@ -269,7 +269,7 @@ ERROR: node is still EOpNull! 0:117 'gl_InstanceID' ( gl_InstanceId highp int InstanceId) 0:118 move second child to first child ( temp highp 4-component vector of float) 0:118 gl_Position: direct index for structure ( gl_Position highp 4-component vector of float Position) -0:118 'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position, }) +0:118 'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position}) 0:118 Constant: 0:118 0 (const uint) 0:118 Constant: @@ -278,7 +278,7 @@ ERROR: node is still EOpNull! 0:118 1.000000 0:118 1.000000 0:119 gl_PointSize: direct index for structure ( gl_PointSize highp void PointSize) -0:119 'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position, }) +0:119 'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position}) 0:119 Constant: 0:119 1 (const uint) 0:153 Function Definition: pfooBad( ( global void) @@ -940,7 +940,7 @@ ERROR: node is still EOpNull! 0:? 'anon@0' ( out block{layout( location=12) out highp int aAnon, layout( location=13) out highp 4-component vector of float vAnon}) 0:? 'aliased' (layout( location=12) smooth out highp int) 0:? 'inbinst' ( in block{ in highp int a}) -0:? 'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position, }) +0:? 'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position}) 0:? 'smon' ( smooth out block{ out highp int i}) 0:? 'fmon' ( flat out block{ out highp int i}) 0:? 'cmon' ( centroid out block{ out highp int i}) @@ -1184,7 +1184,7 @@ ERROR: node is still EOpNull! 0:? 'anon@0' ( out block{layout( location=12) out highp int aAnon, layout( location=13) out highp 4-component vector of float vAnon}) 0:? 'aliased' (layout( location=12) smooth out highp int) 0:? 'inbinst' ( in block{ in highp int a}) -0:? 'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position, }) +0:? 'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position}) 0:? 'smon' ( smooth out block{ out highp int i}) 0:? 'fmon' ( flat out block{ out highp int i}) 0:? 'cmon' ( centroid out block{ out highp int i}) diff --git a/Test/baseResults/320.vert.out b/Test/baseResults/320.vert.out index 2838ab89..bf127d42 100644 --- a/Test/baseResults/320.vert.out +++ b/Test/baseResults/320.vert.out @@ -49,7 +49,7 @@ ERROR: node is still EOpNull! 0:26 'gl_InstanceID' ( gl_InstanceId highp int InstanceId) 0:27 move second child to first child ( temp highp 4-component vector of float) 0:27 gl_Position: direct index for structure ( gl_Position highp 4-component vector of float Position) -0:27 'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position, }) +0:27 'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position}) 0:27 Constant: 0:27 0 (const uint) 0:27 Constant: @@ -58,7 +58,7 @@ ERROR: node is still EOpNull! 0:27 1.000000 0:27 1.000000 0:28 gl_PointSize: direct index for structure ( gl_PointSize highp void PointSize) -0:28 'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position, }) +0:28 'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position}) 0:28 Constant: 0:28 1 (const uint) 0:62 Function Definition: pfoo( ( global void) @@ -623,7 +623,7 @@ ERROR: node is still EOpNull! 0:? 'anon@0' ( out block{layout( location=12) out highp int aAnon, layout( location=13) out highp 4-component vector of float vAnon}) 0:? 'aliased' (layout( location=12) smooth out highp int) 0:? 'inbinst' ( in block{ in highp int a}) -0:? 'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position, }) +0:? 'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position}) 0:? 'smon' ( smooth out block{ out highp int i}) 0:? 'fmon' ( flat out block{ out highp int i}) 0:? 'cmon' ( centroid out block{ out highp int i}) @@ -709,7 +709,7 @@ ERROR: node is still EOpNull! 0:26 'gl_InstanceID' ( gl_InstanceId highp int InstanceId) 0:27 move second child to first child ( temp highp 4-component vector of float) 0:27 gl_Position: direct index for structure ( gl_Position highp 4-component vector of float Position) -0:27 'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position, }) +0:27 'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position}) 0:27 Constant: 0:27 0 (const uint) 0:27 Constant: @@ -718,7 +718,7 @@ ERROR: node is still EOpNull! 0:27 1.000000 0:27 1.000000 0:28 gl_PointSize: direct index for structure ( gl_PointSize highp void PointSize) -0:28 'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position, }) +0:28 'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position}) 0:28 Constant: 0:28 1 (const uint) 0:? Linker Objects @@ -726,7 +726,7 @@ ERROR: node is still EOpNull! 0:? 'anon@0' ( out block{layout( location=12) out highp int aAnon, layout( location=13) out highp 4-component vector of float vAnon}) 0:? 'aliased' (layout( location=12) smooth out highp int) 0:? 'inbinst' ( in block{ in highp int a}) -0:? 'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position, }) +0:? 'anon@1' ( out block{ gl_Position highp 4-component vector of float Position gl_Position}) 0:? 'smon' ( smooth out block{ out highp int i}) 0:? 'fmon' ( flat out block{ out highp int i}) 0:? 'cmon' ( centroid out block{ out highp int i}) diff --git a/Test/baseResults/330.frag.out b/Test/baseResults/330.frag.out index 77456312..36ba7a2b 100644 --- a/Test/baseResults/330.frag.out +++ b/Test/baseResults/330.frag.out @@ -71,7 +71,7 @@ ERROR: node is still EOpNull! 0:23 move second child to first child ( temp 4-component vector of float) 0:23 'c' ( temp 4-component vector of float) 0:23 gl_Color: direct index for structure ( in 4-component vector of float Color) -0:23 'anon@0' ( in block{ in 4-component vector of float Color gl_Color, }) +0:23 'anon@0' ( in block{ in 4-component vector of float Color gl_Color}) 0:23 Constant: 0:23 2 (const uint) 0:24 move second child to first child ( temp 4-component vector of float) @@ -93,7 +93,7 @@ ERROR: node is still EOpNull! 0:? 'inVar' ( smooth in 4-component vector of float) 0:? 'outVar' (layout( location=0 index=0) out 4-component vector of float) 0:? 'varyingVar' ( smooth in 4-component vector of float) -0:? 'anon@0' ( in block{ in 4-component vector of float Color gl_Color, }) +0:? 'anon@0' ( in block{ in 4-component vector of float Color gl_Color}) 0:? 'gl_name' ( in block{ in int gl_i}) 0:? 'start' ( const int) 0:? 6 (const int) @@ -158,7 +158,7 @@ ERROR: node is still EOpNull! 0:? 'inVar' ( smooth in 4-component vector of float) 0:? 'outVar' (layout( location=0 index=0) out 4-component vector of float) 0:? 'varyingVar' ( smooth in 4-component vector of float) -0:? 'anon@0' ( in block{ in 4-component vector of float Color gl_Color, }) +0:? 'anon@0' ( in block{ in 4-component vector of float Color gl_Color}) 0:? 'gl_name' ( in block{ in int gl_i}) 0:? 'start' ( const int) 0:? 6 (const int) diff --git a/Test/baseResults/410.geom.out b/Test/baseResults/410.geom.out index ab5ad472..c38ba483 100644 --- a/Test/baseResults/410.geom.out +++ b/Test/baseResults/410.geom.out @@ -38,12 +38,12 @@ ERROR: node is still EOpNull! 0:30 0 (const int) 0:31 move second child to first child ( temp float) 0:31 gl_PointSize: direct index for structure (layout( stream=0) gl_PointSize float PointSize) -0:31 'anon@0' (layout( stream=0) out block{layout( stream=0) gl_PointSize float PointSize gl_PointSize, }) +0:31 'anon@0' (layout( stream=0) out block{layout( stream=0) gl_PointSize float PointSize gl_PointSize}) 0:31 Constant: 0:31 1 (const uint) 0:31 'p' ( temp float) 0:33 gl_Position: direct index for structure (layout( stream=0) gl_Position void Position) -0:33 'anon@0' (layout( stream=0) out block{layout( stream=0) gl_PointSize float PointSize gl_PointSize, }) +0:33 'anon@0' (layout( stream=0) out block{layout( stream=0) gl_PointSize float PointSize gl_PointSize}) 0:33 Constant: 0:33 0 (const uint) 0:36 Function Definition: foo5( ( global float) @@ -54,7 +54,7 @@ ERROR: node is still EOpNull! 0:38 4.000000 0:? Linker Objects 0:? 'gl_in' ( in unsized 2-element array of block{ in float PointSize gl_PointSize}) -0:? 'anon@0' (layout( stream=0) out block{layout( stream=0) gl_PointSize float PointSize gl_PointSize, }) +0:? 'anon@0' (layout( stream=0) out block{layout( stream=0) gl_PointSize float PointSize gl_PointSize}) Linked geometry stage: @@ -78,5 +78,5 @@ ERROR: node is still EOpNull! 0:5 7 (const int) 0:? Linker Objects 0:? 'gl_in' ( in 2-element array of block{ in float PointSize gl_PointSize}) -0:? 'anon@0' (layout( stream=0) out block{layout( stream=0) gl_PointSize float PointSize gl_PointSize, }) +0:? 'anon@0' (layout( stream=0) out block{layout( stream=0) gl_PointSize float PointSize gl_PointSize}) diff --git a/Test/baseResults/420.vert.out b/Test/baseResults/420.vert.out index c572d97b..3d493270 100644 --- a/Test/baseResults/420.vert.out +++ b/Test/baseResults/420.vert.out @@ -281,7 +281,7 @@ ERROR: node is still EOpNull! 0:? 'sampb3' (layout( binding=80) uniform sampler2D) 0:? 'sampb4' (layout( binding=31) uniform sampler2D) 0:? 'sampb5' (layout( binding=79) uniform 2-element array of sampler2D) -0:? 'anon@3' ( out block{ out 4-element array of float ClipDistance gl_ClipDistance, }) +0:? 'anon@3' ( out block{ out 4-element array of float ClipDistance gl_ClipDistance}) 0:? 'patchIn' ( patch in 4-component vector of float) 0:? 'patchOut' ( smooth patch out 4-component vector of float) 0:? 'comma0' ( temp int) @@ -363,7 +363,7 @@ ERROR: node is still EOpNull! 0:? 'sampb3' (layout( binding=80) uniform sampler2D) 0:? 'sampb4' (layout( binding=31) uniform sampler2D) 0:? 'sampb5' (layout( binding=79) uniform 2-element array of sampler2D) -0:? 'anon@3' ( out block{ out 4-element array of float ClipDistance gl_ClipDistance, }) +0:? 'anon@3' ( out block{ out 4-element array of float ClipDistance gl_ClipDistance}) 0:? 'patchIn' ( patch in 4-component vector of float) 0:? 'patchOut' ( smooth patch out 4-component vector of float) 0:? 'comma0' ( temp int) diff --git a/Test/baseResults/430.comp.out b/Test/baseResults/430.comp.out index 599cd8e3..ef8d19e1 100644 --- a/Test/baseResults/430.comp.out +++ b/Test/baseResults/430.comp.out @@ -55,9 +55,9 @@ ERROR: node is still EOpNull! 0:63 Function Parameters: 0:65 Sequence 0:65 move second child to first child ( temp float) -0:65 direct index (layout( column_major shared) temp float) -0:65 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of float) -0:65 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer int value, layout( column_major shared) buffer unsized 3-element array of float values}) +0:65 direct index (layout( column_major shared) readonly temp float) +0:65 values: direct index for structure (layout( column_major shared) readonly buffer unsized 3-element array of float) +0:65 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) readonly buffer int value, layout( column_major shared) readonly buffer unsized 3-element array of float values}) 0:65 Constant: 0:65 1 (const int) 0:65 Constant: @@ -65,8 +65,8 @@ ERROR: node is still EOpNull! 0:65 Constant: 0:65 4.700000 0:66 array length ( temp int) -0:66 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of float) -0:66 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer int value, layout( column_major shared) buffer unsized 3-element array of float values}) +0:66 values: direct index for structure (layout( column_major shared) readonly buffer unsized 3-element array of float) +0:66 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) readonly buffer int value, layout( column_major shared) readonly buffer unsized 3-element array of float values}) 0:66 Constant: 0:66 1 (const int) 0:67 Barrier ( global void) @@ -140,7 +140,7 @@ ERROR: node is still EOpNull! 0:? 'arrX' ( global 2-element array of int) 0:? 'arrY' ( global 1-element array of int) 0:? 'arrZ' ( global 4096-element array of int) -0:? 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer int value, layout( column_major shared) buffer unsized 3-element array of float values}) +0:? 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) readonly buffer int value, layout( column_major shared) readonly buffer unsized 3-element array of float values}) 0:? 'roll' ( uniform double) 0:? 'destTex' ( writeonly uniform image2D) 0:? 'inbi' ( in block{ in int a}) @@ -201,7 +201,7 @@ ERROR: node is still EOpNull! 0:? 'arrX' ( global 2-element array of int) 0:? 'arrY' ( global 1-element array of int) 0:? 'arrZ' ( global 4096-element array of int) -0:? 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer int value, layout( column_major shared) buffer unsized 3-element array of float values}) +0:? 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) readonly buffer int value, layout( column_major shared) readonly buffer unsized 3-element array of float values}) 0:? 'roll' ( uniform double) 0:? 'destTex' ( writeonly uniform image2D) 0:? 'inbi' ( in block{ in int a}) diff --git a/Test/baseResults/430.vert.out b/Test/baseResults/430.vert.out index d741d357..4bac5fc6 100644 --- a/Test/baseResults/430.vert.out +++ b/Test/baseResults/430.vert.out @@ -78,7 +78,7 @@ ERROR: node is still EOpNull! 0:16 move second child to first child ( temp float) 0:16 direct index ( temp float ClipDistance) 0:16 gl_ClipDistance: direct index for structure ( out 17-element array of float ClipDistance) -0:16 'anon@0' ( out block{ out 17-element array of float ClipDistance gl_ClipDistance, }) +0:16 'anon@0' ( out block{ out 17-element array of float ClipDistance gl_ClipDistance}) 0:16 Constant: 0:16 2 (const uint) 0:16 Constant: @@ -206,7 +206,7 @@ ERROR: node is still EOpNull! 0:? 'uv4' (layout( location=4) uniform 4-component vector of float) 0:? 'b1' (layout( location=2) in block{ in 4-component vector of float v}) 0:? 'b2' (layout( location=2) out block{ out 4-component vector of float v}) -0:? 'anon@0' ( out block{ out 17-element array of float ClipDistance gl_ClipDistance, }) +0:? 'anon@0' ( out block{ out 17-element array of float ClipDistance gl_ClipDistance}) 0:? 'cs' (layout( location=10) smooth out 2-element array of structure{ global 7-element array of 3X2 matrix of float m, global float f}) 0:? 'cf' (layout( location=54) smooth out float) 0:? 'cg' (layout( location=53) smooth out float) @@ -281,7 +281,7 @@ ERROR: node is still EOpNull! 0:? 'uv4' (layout( location=4) uniform 4-component vector of float) 0:? 'b1' (layout( location=2) in block{ in 4-component vector of float v}) 0:? 'b2' (layout( location=2) out block{ out 4-component vector of float v}) -0:? 'anon@0' ( out block{ out 17-element array of float ClipDistance gl_ClipDistance, }) +0:? 'anon@0' ( out block{ out 17-element array of float ClipDistance gl_ClipDistance}) 0:? 'cs' (layout( location=10) smooth out 2-element array of structure{ global 7-element array of 3X2 matrix of float m, global float f}) 0:? 'cf' (layout( location=54) smooth out float) 0:? 'cg' (layout( location=53) smooth out float) diff --git a/Test/baseResults/440.vert.out b/Test/baseResults/440.vert.out index 5af757ab..6c975c09 100644 --- a/Test/baseResults/440.vert.out +++ b/Test/baseResults/440.vert.out @@ -156,7 +156,7 @@ ERROR: node is still EOpNull! 0:? 'bbinst9' ( out block{layout( xfb_buffer=4 xfb_offset=1) out bool b, layout( xfb_buffer=4 xfb_offset=12) out structure{ global bool b, global structure{ global int i, global double d, global float f} s, global 2-component vector of float v2} t, layout( xfb_buffer=4 xfb_offset=52) out 3X3 matrix of float m3, layout( xfb_buffer=4 xfb_offset=90) out int i, layout( xfb_buffer=4 xfb_offset=98) out double d, layout( xfb_buffer=4 xfb_offset=108) out structure{ global int a} s}) 0:? 'bm' (layout( xfb_buffer=5 xfb_offset=0) smooth out float) 0:? 'bbinst10' ( out block{layout( xfb_buffer=7 xfb_offset=0) out 4X4 matrix of double m1, layout( xfb_buffer=7 xfb_offset=128) out 4X4 matrix of double m2, layout( xfb_buffer=7 xfb_offset=256) out float f}) -0:? 'anon@0' ( out block{layout( xfb_buffer=3 xfb_offset=36) gl_Position 4-component vector of float Position gl_Position, layout( xfb_buffer=3 xfb_offset=32) gl_PointSize float PointSize gl_PointSize, }) +0:? 'anon@0' ( out block{layout( xfb_buffer=3 xfb_offset=36) gl_Position 4-component vector of float Position gl_Position, layout( xfb_buffer=3 xfb_offset=32) gl_PointSize float PointSize gl_PointSize}) 0:? 'gl_VertexID' ( gl_VertexId int VertexId) 0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId) @@ -241,7 +241,7 @@ ERROR: node is still EOpNull! 0:? 'bbinst9' ( out block{layout( xfb_buffer=4 xfb_offset=1) out bool b, layout( xfb_buffer=4 xfb_offset=12) out structure{ global bool b, global structure{ global int i, global double d, global float f} s, global 2-component vector of float v2} t, layout( xfb_buffer=4 xfb_offset=52) out 3X3 matrix of float m3, layout( xfb_buffer=4 xfb_offset=90) out int i, layout( xfb_buffer=4 xfb_offset=98) out double d, layout( xfb_buffer=4 xfb_offset=108) out structure{ global int a} s}) 0:? 'bm' (layout( xfb_buffer=5 xfb_offset=0) smooth out float) 0:? 'bbinst10' ( out block{layout( xfb_buffer=7 xfb_offset=0) out 4X4 matrix of double m1, layout( xfb_buffer=7 xfb_offset=128) out 4X4 matrix of double m2, layout( xfb_buffer=7 xfb_offset=256) out float f}) -0:? 'anon@0' ( out block{layout( xfb_buffer=3 xfb_offset=36) gl_Position 4-component vector of float Position gl_Position, layout( xfb_buffer=3 xfb_offset=32) gl_PointSize float PointSize gl_PointSize, }) +0:? 'anon@0' ( out block{layout( xfb_buffer=3 xfb_offset=36) gl_Position 4-component vector of float Position gl_Position, layout( xfb_buffer=3 xfb_offset=32) gl_PointSize float PointSize gl_PointSize}) 0:? 'gl_VertexID' ( gl_VertexId int VertexId) 0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId) diff --git a/Test/baseResults/glspv.esversion.vert.out b/Test/baseResults/glspv.esversion.vert.out index 782865ab..395d7f37 100644 --- a/Test/baseResults/glspv.esversion.vert.out +++ b/Test/baseResults/glspv.esversion.vert.out @@ -1,6 +1,25 @@ glspv.esversion.vert -ERROR: #version: ES shaders for OpenGL SPIR-V are not supported -ERROR: 1 compilation errors. No code generated. +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 10 - -SPIR-V is not generated for failed compile or link + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" 8 9 + Source ESSL 310 + Name 4 "main" + Name 8 "gl_VertexID" + Name 9 "gl_InstanceID" + Decorate 8(gl_VertexID) BuiltIn VertexId + Decorate 9(gl_InstanceID) BuiltIn InstanceId + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 1 + 7: TypePointer Input 6(int) + 8(gl_VertexID): 7(ptr) Variable Input +9(gl_InstanceID): 7(ptr) Variable Input + 4(main): 2 Function None 3 + 5: Label + Return + FunctionEnd diff --git a/Test/baseResults/glspv.vert.out b/Test/baseResults/glspv.vert.out index f2fe53b2..d5192628 100644 --- a/Test/baseResults/glspv.vert.out +++ b/Test/baseResults/glspv.vert.out @@ -2,12 +2,14 @@ glspv.vert ERROR: 0:3: 'push_constant' : only allowed when using GLSL for Vulkan ERROR: 0:6: 'descriptor set' : only allowed when using GLSL for Vulkan ERROR: 0:8: 'shared' : not allowed when generating SPIR-V +ERROR: 0:8: 'binding' : uniform/buffer blocks require layout(binding=X) ERROR: 0:9: 'packed' : not allowed when generating SPIR-V +ERROR: 0:9: 'binding' : uniform/buffer blocks require layout(binding=X) ERROR: 0:13: 'gl_VertexIndex' : undeclared identifier ERROR: 0:14: 'gl_InstanceIndex' : undeclared identifier ERROR: 0:17: 'gl_DepthRangeParameters' : undeclared identifier ERROR: 0:20: '' : syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON -ERROR: 8 compilation errors. No code generated. +ERROR: 10 compilation errors. No code generated. SPIR-V is not generated for failed compile or link diff --git a/Test/baseResults/hlsl.depthGreater.frag.out b/Test/baseResults/hlsl.depthGreater.frag.out index 9749371a..df6311f6 100644 --- a/Test/baseResults/hlsl.depthGreater.frag.out +++ b/Test/baseResults/hlsl.depthGreater.frag.out @@ -58,8 +58,8 @@ using depth_greater MemoryModel Logical GLSL450 EntryPoint Fragment 4 "PixelShaderFunction" 18 ExecutionMode 4 OriginUpperLeft - ExecutionMode 4 DepthGreater ExecutionMode 4 DepthReplacing + ExecutionMode 4 DepthGreater Source HLSL 500 Name 4 "PixelShaderFunction" Name 10 "@PixelShaderFunction(f1;" diff --git a/Test/baseResults/hlsl.depthLess.frag.out b/Test/baseResults/hlsl.depthLess.frag.out index c3af8eea..d2b9d8ed 100644 --- a/Test/baseResults/hlsl.depthLess.frag.out +++ b/Test/baseResults/hlsl.depthLess.frag.out @@ -50,8 +50,8 @@ using depth_less MemoryModel Logical GLSL450 EntryPoint Fragment 4 "PixelShaderFunction" 14 ExecutionMode 4 OriginUpperLeft - ExecutionMode 4 DepthLess ExecutionMode 4 DepthReplacing + ExecutionMode 4 DepthLess Source HLSL 500 Name 4 "PixelShaderFunction" Name 8 "@PixelShaderFunction(" diff --git a/Test/baseResults/hlsl.structIoFourWay.frag.out b/Test/baseResults/hlsl.structIoFourWay.frag.out index 32ac68f3..9938be8b 100644 --- a/Test/baseResults/hlsl.structIoFourWay.frag.out +++ b/Test/baseResults/hlsl.structIoFourWay.frag.out @@ -170,8 +170,8 @@ using depth_greater MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 22 27 31 36 45 48 51 55 ExecutionMode 4 OriginUpperLeft - ExecutionMode 4 DepthGreater ExecutionMode 4 DepthReplacing + ExecutionMode 4 DepthGreater Source HLSL 500 Name 4 "main" Name 8 "T" diff --git a/Test/baseResults/link1.vk.frag.out b/Test/baseResults/link1.vk.frag.out index a24246a6..094a50d8 100644 --- a/Test/baseResults/link1.vk.frag.out +++ b/Test/baseResults/link1.vk.frag.out @@ -42,8 +42,8 @@ gl_FragCoord origin is upper left 0:? 'b' ( global 5-element array of highp int) 0:? 'c' ( global unsized 4-element array of highp int) 0:? 'i' ( global highp int) -0:? 'anon@0' (layout( column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float r}) -0:? 'anon@1' (layout( column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float m}) +0:? 'anon@0' (layout( binding=0 column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float r}) +0:? 'anon@1' (layout( binding=1 column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float m}) link2.vk.frag Shader version: 450 @@ -99,8 +99,8 @@ gl_FragCoord origin is upper left 0:? 'b' ( global unsized 3-element array of highp int) 0:? 'c' ( global 7-element array of highp int) 0:? 'i' ( global highp int) -0:? 'anon@0' (layout( column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float r}) -0:? 'anon@1' (layout( column_major std430) buffer block{layout( column_major std430) buffer 4-element array of highp float m}) +0:? 'anon@0' (layout( binding=0 column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float r}) +0:? 'anon@1' (layout( binding=1 column_major std430) buffer block{layout( column_major std430) buffer 4-element array of highp float m}) Linked fragment stage: @@ -192,8 +192,8 @@ gl_FragCoord origin is upper left 0:? 'b' ( global 5-element array of highp int) 0:? 'c' ( global 7-element array of highp int) 0:? 'i' ( global highp int) -0:? 'anon@0' (layout( column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float r}) -0:? 'anon@1' (layout( column_major std430) buffer block{layout( column_major std430) buffer 4-element array of highp float m}) +0:? 'anon@0' (layout( binding=0 column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float r}) +0:? 'anon@1' (layout( binding=1 column_major std430) buffer block{layout( column_major std430) buffer 4-element array of highp float m}) 0:? 's2D' (layout( binding=1) uniform highp sampler2D) // Module Version 10000 @@ -233,7 +233,7 @@ gl_FragCoord origin is upper left MemberDecorate 67(bnameImplicit) 0 Offset 0 Decorate 67(bnameImplicit) BufferBlock Decorate 69 DescriptorSet 0 - Decorate 69 Binding 0 + Decorate 69 Binding 1 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 diff --git a/Test/baseResults/reflection.options.vert.out b/Test/baseResults/reflection.options.vert.out index 9e3df0ca..3f4a2716 100644 --- a/Test/baseResults/reflection.options.vert.out +++ b/Test/baseResults/reflection.options.vert.out @@ -51,10 +51,15 @@ MultipleArrays.tri[0].v[2].normal[0]: offset 60, type 1406, size 3, index 1, bin MultipleArrays.vert[0].position[0]: offset 360, type 1406, size 3, index 1, binding -1, stages 1, arrayStride 4, topLevelArrayStride 24 MultipleArrays.vert[0].normal[0]: offset 372, type 1406, size 3, index 1, binding -1, stages 0, arrayStride 4, topLevelArrayStride 24 MultipleArrays.f[0]: offset 480, type 1406, size 5, index 1, binding -1, stages 1, arrayStride 4, topLevelArrayStride 4 +ArrayedBind[0].a: offset 0, type 1406, size 1, index 4, binding -1, stages 0 +ArrayedBind[0].b: offset 4, type 1406, size 1, index 4, binding -1, stages 1 Buffer block reflection: VertexCollection: offset -1, type ffffffff, size 400, index -1, binding -1, stages 1, numMembers 7 MultipleArrays: offset -1, type ffffffff, size 500, index -1, binding -1, stages 1, numMembers 9 +ArrayedBind[0]: offset -1, type ffffffff, size 8, index -1, binding -1, stages 1, numMembers 2 +ArrayedBind[1]: offset -1, type ffffffff, size 8, index -1, binding -1, stages 1, numMembers 2 +ArrayedBind[2]: offset -1, type ffffffff, size 8, index -1, binding -1, stages 1, numMembers 2 Pipeline input reflection: gl_InstanceID: offset 0, type 1404, size 1, index 0, binding -1, stages 1 diff --git a/Test/baseResults/size b/Test/baseResults/size new file mode 100644 index 00000000..48487765 --- /dev/null +++ b/Test/baseResults/size @@ -0,0 +1 @@ +388096 ../build/install/bin/glslangValidator.exe diff --git a/Test/baseResults/specExamples.vert.out b/Test/baseResults/specExamples.vert.out index 3a83f3b7..1dbf9a29 100644 --- a/Test/baseResults/specExamples.vert.out +++ b/Test/baseResults/specExamples.vert.out @@ -307,7 +307,7 @@ ERROR: node is still EOpNull! 0:? 'c' ( in 4-component vector of float) 0:? 'd' ( in 4-component vector of float) 0:? 'v' ( noContraction smooth out 4-component vector of float) -0:? 'anon@6' (layout( column_major shared) coherent buffer block{layout( column_major shared) readonly buffer 4-component vector of float member1, layout( column_major shared) buffer 4-component vector of float member2}) +0:? 'anon@6' (layout( column_major shared) coherent buffer block{layout( column_major shared) coherent readonly buffer 4-component vector of float member1, layout( column_major shared) coherent buffer 4-component vector of float member2}) 0:? 'anon@7' (layout( column_major shared) buffer block{layout( column_major shared) coherent readonly buffer 4-component vector of float member1A, layout( column_major shared) coherent buffer 4-component vector of float member2A}) 0:? 'shv' ( shared 4-component vector of float) 0:? 'img1' (layout( rgba32f) uniform image2D) @@ -590,7 +590,7 @@ ERROR: node is still EOpNull! 0:? 'c' ( in 4-component vector of float) 0:? 'd' ( in 4-component vector of float) 0:? 'v' ( noContraction smooth out 4-component vector of float) -0:? 'anon@6' (layout( column_major shared) coherent buffer block{layout( column_major shared) readonly buffer 4-component vector of float member1, layout( column_major shared) buffer 4-component vector of float member2}) +0:? 'anon@6' (layout( column_major shared) coherent buffer block{layout( column_major shared) coherent readonly buffer 4-component vector of float member1, layout( column_major shared) coherent buffer 4-component vector of float member2}) 0:? 'anon@7' (layout( column_major shared) buffer block{layout( column_major shared) coherent readonly buffer 4-component vector of float member1A, layout( column_major shared) coherent buffer 4-component vector of float member2A}) 0:? 'shv' ( shared 4-component vector of float) 0:? 'img1' (layout( rgba32f) uniform image2D) diff --git a/Test/baseResults/specExamplesConf.vert.out b/Test/baseResults/specExamplesConf.vert.out index 6487de22..94f48a5e 100644 --- a/Test/baseResults/specExamplesConf.vert.out +++ b/Test/baseResults/specExamplesConf.vert.out @@ -308,7 +308,7 @@ ERROR: node is still EOpNull! 0:? 'c' ( in 4-component vector of float) 0:? 'd' ( in 4-component vector of float) 0:? 'v' ( noContraction smooth out 4-component vector of float) -0:? 'anon@6' (layout( column_major shared) coherent buffer block{layout( column_major shared) readonly buffer 4-component vector of float member1, layout( column_major shared) buffer 4-component vector of float member2}) +0:? 'anon@6' (layout( column_major shared) coherent buffer block{layout( column_major shared) coherent readonly buffer 4-component vector of float member1, layout( column_major shared) coherent buffer 4-component vector of float member2}) 0:? 'anon@7' (layout( column_major shared) buffer block{layout( column_major shared) coherent readonly buffer 4-component vector of float member1A, layout( column_major shared) coherent buffer 4-component vector of float member2A}) 0:? 'shv' ( shared 4-component vector of float) 0:? 'img1' (layout( rgba32f) uniform image2D) @@ -591,7 +591,7 @@ ERROR: node is still EOpNull! 0:? 'c' ( in 4-component vector of float) 0:? 'd' ( in 4-component vector of float) 0:? 'v' ( noContraction smooth out 4-component vector of float) -0:? 'anon@6' (layout( column_major shared) coherent buffer block{layout( column_major shared) readonly buffer 4-component vector of float member1, layout( column_major shared) buffer 4-component vector of float member2}) +0:? 'anon@6' (layout( column_major shared) coherent buffer block{layout( column_major shared) coherent readonly buffer 4-component vector of float member1, layout( column_major shared) coherent buffer 4-component vector of float member2}) 0:? 'anon@7' (layout( column_major shared) buffer block{layout( column_major shared) coherent readonly buffer 4-component vector of float member1A, layout( column_major shared) coherent buffer 4-component vector of float member2A}) 0:? 'shv' ( shared 4-component vector of float) 0:? 'img1' (layout( rgba32f) uniform image2D) diff --git a/Test/baseResults/spv.1.4.constructComposite.comp.out b/Test/baseResults/spv.1.4.constructComposite.comp.out new file mode 100644 index 00000000..5c0f5cfa --- /dev/null +++ b/Test/baseResults/spv.1.4.constructComposite.comp.out @@ -0,0 +1,62 @@ +spv.1.4.constructComposite.comp +// Module Version 10400 +// Generated by (magic number): 80007 +// Id's are bound by 27 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" 10 15 + ExecutionMode 4 LocalSize 64 1 1 + Source GLSL 460 + Name 4 "main" + Name 7 "sA" + MemberName 7(sA) 0 "x" + MemberName 7(sA) 1 "y" + Name 8 "sC" + MemberName 8(sC) 0 "state" + Name 10 "c" + Name 11 "sA" + MemberName 11(sA) 0 "x" + MemberName 11(sA) 1 "y" + Name 12 "sB" + MemberName 12(sB) 0 "a" + Name 13 "ubo" + MemberName 13(ubo) 0 "b" + Name 15 "" + MemberDecorate 11(sA) 0 Offset 0 + MemberDecorate 11(sA) 1 Offset 4 + MemberDecorate 12(sB) 0 Offset 0 + MemberDecorate 13(ubo) 0 Offset 0 + Decorate 13(ubo) Block + Decorate 15 DescriptorSet 0 + Decorate 15 Binding 0 + Decorate 26 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 1 + 7(sA): TypeStruct 6(int) 6(int) + 8(sC): TypeStruct 7(sA) + 9: TypePointer Private 8(sC) + 10(c): 9(ptr) Variable Private + 11(sA): TypeStruct 6(int) 6(int) + 12(sB): TypeStruct 11(sA) + 13(ubo): TypeStruct 12(sB) + 14: TypePointer Uniform 13(ubo) + 15: 14(ptr) Variable Uniform + 16: 6(int) Constant 0 + 17: TypePointer Uniform 11(sA) + 22: TypeInt 32 0 + 23: TypeVector 22(int) 3 + 24: 22(int) Constant 64 + 25: 22(int) Constant 1 + 26: 23(ivec3) ConstantComposite 24 25 25 + 4(main): 2 Function None 3 + 5: Label + 18: 17(ptr) AccessChain 15 16 16 + 19: 11(sA) Load 18 + 20: 7(sA) CopyLogical 19 + 21: 8(sC) CompositeConstruct 20 + Store 10(c) 21 + Return + FunctionEnd diff --git a/Test/baseResults/spv.constructComposite.comp.out b/Test/baseResults/spv.constructComposite.comp.out new file mode 100644 index 00000000..6a23ecb2 --- /dev/null +++ b/Test/baseResults/spv.constructComposite.comp.out @@ -0,0 +1,64 @@ +spv.constructComposite.comp +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 29 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" + ExecutionMode 4 LocalSize 64 1 1 + Source GLSL 460 + Name 4 "main" + Name 7 "sA" + MemberName 7(sA) 0 "x" + MemberName 7(sA) 1 "y" + Name 8 "sC" + MemberName 8(sC) 0 "state" + Name 10 "c" + Name 11 "sA" + MemberName 11(sA) 0 "x" + MemberName 11(sA) 1 "y" + Name 12 "sB" + MemberName 12(sB) 0 "a" + Name 13 "ubo" + MemberName 13(ubo) 0 "b" + Name 15 "" + MemberDecorate 11(sA) 0 Offset 0 + MemberDecorate 11(sA) 1 Offset 4 + MemberDecorate 12(sB) 0 Offset 0 + MemberDecorate 13(ubo) 0 Offset 0 + Decorate 13(ubo) Block + Decorate 15 DescriptorSet 0 + Decorate 15 Binding 0 + Decorate 28 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 1 + 7(sA): TypeStruct 6(int) 6(int) + 8(sC): TypeStruct 7(sA) + 9: TypePointer Private 8(sC) + 10(c): 9(ptr) Variable Private + 11(sA): TypeStruct 6(int) 6(int) + 12(sB): TypeStruct 11(sA) + 13(ubo): TypeStruct 12(sB) + 14: TypePointer Uniform 13(ubo) + 15: 14(ptr) Variable Uniform + 16: 6(int) Constant 0 + 17: TypePointer Uniform 11(sA) + 24: TypeInt 32 0 + 25: TypeVector 24(int) 3 + 26: 24(int) Constant 64 + 27: 24(int) Constant 1 + 28: 25(ivec3) ConstantComposite 26 27 27 + 4(main): 2 Function None 3 + 5: Label + 18: 17(ptr) AccessChain 15 16 16 + 19: 11(sA) Load 18 + 20: 6(int) CompositeExtract 19 0 + 21: 6(int) CompositeExtract 19 1 + 22: 7(sA) CompositeConstruct 20 21 + 23: 8(sC) CompositeConstruct 22 + Store 10(c) 23 + Return + FunctionEnd diff --git a/Test/baseResults/spv.coopmat.comp.out b/Test/baseResults/spv.coopmat.comp.out index 0507129c..acdcbc4f 100644 --- a/Test/baseResults/spv.coopmat.comp.out +++ b/Test/baseResults/spv.coopmat.comp.out @@ -282,7 +282,7 @@ spv.coopmat.comp 101: 100(ptr) AccessChain 91(block16) 99 102: 85(ptr) Load 101 MakePointerVisibleKHR NonPrivatePointerKHR 71 104: 103(ptr) AccessChain 102 58 31 - 105: 32 CooperativeMatrixLoadNV 104 74 76 Aligned 16 + 105: 32 CooperativeMatrixLoadNV 104 74 76 Aligned MakePointerVisibleKHR NonPrivatePointerKHR 16 71 Store 98(tempArg) 105 106: 32 Load 98(tempArg) Store 34(m) 106 @@ -290,7 +290,7 @@ spv.coopmat.comp 108: 100(ptr) AccessChain 91(block16) 99 109: 85(ptr) Load 108 MakePointerVisibleKHR NonPrivatePointerKHR 71 110: 103(ptr) AccessChain 109 58 31 - CooperativeMatrixStoreNV 110 107 74 76 Aligned 16 + CooperativeMatrixStoreNV 110 107 74 76 Aligned MakePointerAvailableKHR NonPrivatePointerKHR 16 71 113: 50 Load 112(A) 115: 10 Load 114(B) 117: 32 Load 116(C) diff --git a/Test/baseResults/spv.debugInfo.1.1.frag.out b/Test/baseResults/spv.debugInfo.1.1.frag.out index afd8cfdf..e2120892 100644 --- a/Test/baseResults/spv.debugInfo.1.1.frag.out +++ b/Test/baseResults/spv.debugInfo.1.1.frag.out @@ -81,6 +81,7 @@ void main() Name 97 "i" ModuleProcessed "no-storage-format" ModuleProcessed "resource-set-binding 3" + ModuleProcessed "auto-map-bindings" ModuleProcessed "auto-map-locations" ModuleProcessed "client opengl100" ModuleProcessed "target-env spirv1.3" @@ -99,7 +100,7 @@ void main() Decorate 56 Binding 0 Decorate 67(s2d) Location 0 Decorate 67(s2d) DescriptorSet 3 - Decorate 67(s2d) Binding 0 + Decorate 67(s2d) Binding 1 3: TypeVoid 4: TypeFunction 3 7: TypeInt 32 1 diff --git a/Test/baseResults/spv.depthOut.frag.out b/Test/baseResults/spv.depthOut.frag.out index 5da0df07..59afd3e1 100644 --- a/Test/baseResults/spv.depthOut.frag.out +++ b/Test/baseResults/spv.depthOut.frag.out @@ -8,8 +8,8 @@ spv.depthOut.frag MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 8 10 14 ExecutionMode 4 OriginUpperLeft - ExecutionMode 4 DepthGreater ExecutionMode 4 DepthReplacing + ExecutionMode 4 DepthGreater Source GLSL 450 Name 4 "main" Name 8 "gl_FragDepth" diff --git a/Test/baseResults/spv.hlslDebugInfo.frag.out b/Test/baseResults/spv.hlslDebugInfo.frag.out index 9912d4e4..35a6a4d9 100644 --- a/Test/baseResults/spv.hlslDebugInfo.frag.out +++ b/Test/baseResults/spv.hlslDebugInfo.frag.out @@ -15,12 +15,12 @@ spv.hlslDebugInfo.vert // OpModuleProcessed shift-UBO-binding 6 // OpModuleProcessed shift-ssbo-binding 3 // OpModuleProcessed shift-uav-binding 5 -// OpModuleProcessed flatten-uniform-arrays // OpModuleProcessed no-storage-format // OpModuleProcessed resource-set-binding t0 0 0 -// OpModuleProcessed hlsl-iomap // OpModuleProcessed auto-map-bindings // OpModuleProcessed auto-map-locations +// OpModuleProcessed flatten-uniform-arrays +// OpModuleProcessed hlsl-iomap // OpModuleProcessed client vulkan100 // OpModuleProcessed target-env vulkan1.0 // OpModuleProcessed source-entrypoint origMain diff --git a/Test/baseResults/spv.hlslOffsets.vert.out b/Test/baseResults/spv.hlslOffsets.vert.out index 84dc47b2..72367546 100644 --- a/Test/baseResults/spv.hlslOffsets.vert.out +++ b/Test/baseResults/spv.hlslOffsets.vert.out @@ -4,7 +4,7 @@ Shader version: 450 0:27 Function Definition: main( ( global void) 0:27 Function Parameters: 0:? Linker Objects -0:? 'anon@0' (layout( column_major std430) buffer block{layout( column_major std430) buffer highp float m0, layout( column_major std430) buffer highp 3-component vector of float m4, layout( column_major std430) buffer highp float m16, layout( column_major std430 offset=20) buffer highp 3-component vector of float m20, layout( column_major std430) buffer highp 3-component vector of float m32, layout( column_major std430) buffer highp 2-component vector of float m48, layout( column_major std430) buffer highp 2-component vector of float m56, layout( column_major std430) buffer highp float m64, layout( column_major std430) buffer highp 2-component vector of float m68, layout( column_major std430) buffer highp float m76, layout( column_major std430) buffer highp float m80, layout( column_major std430 offset=88) buffer highp 2-component vector of float m88, layout( column_major std430) buffer highp 2-component vector of float m96, layout( column_major std430) buffer 2-component vector of double m112}) +0:? 'anon@0' (layout( binding=0 column_major std430) buffer block{layout( column_major std430) buffer highp float m0, layout( column_major std430) buffer highp 3-component vector of float m4, layout( column_major std430) buffer highp float m16, layout( column_major std430 offset=20) buffer highp 3-component vector of float m20, layout( column_major std430) buffer highp 3-component vector of float m32, layout( column_major std430) buffer highp 2-component vector of float m48, layout( column_major std430) buffer highp 2-component vector of float m56, layout( column_major std430) buffer highp float m64, layout( column_major std430) buffer highp 2-component vector of float m68, layout( column_major std430) buffer highp float m76, layout( column_major std430) buffer highp float m80, layout( column_major std430 offset=88) buffer highp 2-component vector of float m88, layout( column_major std430) buffer highp 2-component vector of float m96, layout( column_major std430) buffer 2-component vector of double m112}) Linked vertex stage: @@ -15,7 +15,7 @@ Shader version: 450 0:27 Function Definition: main( ( global void) 0:27 Function Parameters: 0:? Linker Objects -0:? 'anon@0' (layout( column_major std430) buffer block{layout( column_major std430) buffer highp float m0, layout( column_major std430) buffer highp 3-component vector of float m4, layout( column_major std430) buffer highp float m16, layout( column_major std430 offset=20) buffer highp 3-component vector of float m20, layout( column_major std430) buffer highp 3-component vector of float m32, layout( column_major std430) buffer highp 2-component vector of float m48, layout( column_major std430) buffer highp 2-component vector of float m56, layout( column_major std430) buffer highp float m64, layout( column_major std430) buffer highp 2-component vector of float m68, layout( column_major std430) buffer highp float m76, layout( column_major std430) buffer highp float m80, layout( column_major std430 offset=88) buffer highp 2-component vector of float m88, layout( column_major std430) buffer highp 2-component vector of float m96, layout( column_major std430) buffer 2-component vector of double m112}) +0:? 'anon@0' (layout( binding=0 column_major std430) buffer block{layout( column_major std430) buffer highp float m0, layout( column_major std430) buffer highp 3-component vector of float m4, layout( column_major std430) buffer highp float m16, layout( column_major std430 offset=20) buffer highp 3-component vector of float m20, layout( column_major std430) buffer highp 3-component vector of float m32, layout( column_major std430) buffer highp 2-component vector of float m48, layout( column_major std430) buffer highp 2-component vector of float m56, layout( column_major std430) buffer highp float m64, layout( column_major std430) buffer highp 2-component vector of float m68, layout( column_major std430) buffer highp float m76, layout( column_major std430) buffer highp float m80, layout( column_major std430 offset=88) buffer highp 2-component vector of float m88, layout( column_major std430) buffer highp 2-component vector of float m96, layout( column_major std430) buffer 2-component vector of double m112}) // Module Version 10000 // Generated by (magic number): 80007 diff --git a/Test/baseResults/spv.intcoopmat.comp.out b/Test/baseResults/spv.intcoopmat.comp.out new file mode 100644 index 00000000..06f5623d --- /dev/null +++ b/Test/baseResults/spv.intcoopmat.comp.out @@ -0,0 +1,418 @@ +spv.intcoopmat.comp +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 262 + + Capability Shader + Capability Float16 + Capability Int8 + Capability StorageBuffer8BitAccess + Capability VulkanMemoryModelKHR + Capability PhysicalStorageBufferAddressesEXT + Capability CooperativeMatrixNV + Extension "SPV_EXT_physical_storage_buffer" + Extension "SPV_KHR_8bit_storage" + Extension "SPV_KHR_storage_buffer_storage_class" + Extension "SPV_KHR_vulkan_memory_model" + Extension "SPV_NV_cooperative_matrix" + 1: ExtInstImport "GLSL.std.450" + MemoryModel PhysicalStorageBuffer64EXT VulkanKHR + EntryPoint GLCompute 4 "main" + ExecutionMode 4 LocalSize 64 1 1 + Source GLSL 450 + SourceExtension "GL_EXT_buffer_reference" + SourceExtension "GL_EXT_shader_explicit_arithmetic_types" + SourceExtension "GL_KHR_memory_scope_semantics" + SourceExtension "GL_NV_cooperative_matrix" + SourceExtension "GL_NV_integer_cooperative_matrix" + Name 4 "main" + Name 14 "ineg(i81;" + Name 13 "m" + Name 21 "umul(u81;" + Name 20 "m" + Name 35 "mu" + Name 39 "mi" + Name 55 "mf16_0" + Name 61 "mf32_0" + Name 64 "mf16_1" + Name 67 "mf32_1" + Name 71 "x" + Name 81 "tempArg" + Name 85 "Block" + MemberName 85(Block) 0 "y" + MemberName 85(Block) 1 "x" + Name 87 "block" + Name 98 "tempArg" + Name 103 "Block16" + MemberName 103(Block16) 0 "y" + MemberName 103(Block16) 1 "x" + MemberName 103(Block16) 2 "b" + Name 106 "Block" + MemberName 106(Block) 0 "y" + MemberName 106(Block) 1 "x" + Name 108 "block8" + Name 115 "tempArg" + Name 128 "D" + Name 129 "A" + Name 131 "B" + Name 133 "C" + Name 137 "l" + Name 142 "a" + Name 146 "md1" + Name 156 "Y" + Name 157 "Z" + Name 161 "muC2" + Name 169 "miC2" + Name 176 "tempArg" + Name 182 "tempArg" + Name 188 "p1" + Name 189 "param" + Name 192 "p2" + Name 193 "param" + Name 207 "tempArg" + Name 212 "shmatrix" + Name 217 "ms" + Name 225 "miC" + Name 226 "muC" + Name 231 "iarr" + Name 236 "iarr2" + Name 241 "uarr" + Name 246 "uarr2" + Name 251 "S" + MemberName 251(S) 0 "a" + MemberName 251(S) 1 "b" + MemberName 251(S) 2 "c" + Name 256 "SC" + Name 261 "scm" + Decorate 83 ArrayStride 4 + Decorate 84 ArrayStride 4 + MemberDecorate 85(Block) 0 Offset 0 + MemberDecorate 85(Block) 1 Offset 4194304 + Decorate 85(Block) Block + Decorate 87(block) DescriptorSet 0 + Decorate 87(block) Binding 0 + Decorate 99 ArrayStride 1 + Decorate 101 ArrayStride 1 + MemberDecorate 103(Block16) 0 Offset 0 + MemberDecorate 103(Block16) 1 Offset 1048576 + MemberDecorate 103(Block16) 2 Offset 1048584 + Decorate 103(Block16) Block + Decorate 104 ArrayStride 4 + Decorate 105 ArrayStride 4 + MemberDecorate 106(Block) 0 Offset 0 + MemberDecorate 106(Block) 1 Offset 4194304 + Decorate 106(Block) Block + Decorate 108(block8) DescriptorSet 0 + Decorate 108(block8) Binding 0 + Decorate 156(Y) SpecId 0 + Decorate 223 BuiltIn WorkgroupSize + Decorate 256(SC) SpecId 2 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 8 1 + 7: TypeInt 32 0 + 8: 7(int) Constant 3 + 9: 7(int) Constant 8 + 10: TypeCooperativeMatrixNV 6(int8_t) 8 9 9 + 11: TypePointer Function 10 + 12: TypeFunction 10 11(ptr) + 16: TypeInt 8 0 + 17: TypeCooperativeMatrixNV 16(int8_t) 8 9 9 + 18: TypePointer Function 17 + 19: TypeFunction 17 18(ptr) + 28: 16(int8_t) Constant 2 + 32: 7(int) Constant 16 + 33: TypeCooperativeMatrixNV 16(int8_t) 8 32 9 + 34: TypePointer Function 33 + 36: 33 ConstantComposite 28 + 37: TypeCooperativeMatrixNV 6(int8_t) 8 32 9 + 38: TypePointer Function 37 + 40: 6(int8_t) Constant 2 + 41: 37 ConstantComposite 40 + 52: TypeFloat 16 + 53: TypeCooperativeMatrixNV 52(float16_t) 8 32 9 + 54: TypePointer Function 53 + 58: TypeFloat 32 + 59: TypeCooperativeMatrixNV 58(float) 8 32 9 + 60: TypePointer Function 59 + 70: TypePointer Function 16(int8_t) + 72: TypeInt 32 1 + 73: 72(int) Constant 1 + 76: 72(int) Constant 0 + 79: TypePointer Function 6(int8_t) + 82: 7(int) Constant 1048576 + 83: TypeArray 7(int) 82 + 84: TypeRuntimeArray 7(int) + 85(Block): TypeStruct 83 84 + 86: TypePointer StorageBuffer 85(Block) + 87(block): 86(ptr) Variable StorageBuffer + 88: 7(int) Constant 5 + 89: TypePointer StorageBuffer 7(int) + 91: 7(int) Constant 128 + 92: TypeBool + 93: 92(bool) ConstantFalse + 99: TypeArray 6(int8_t) 82 + 100: 7(int) Constant 1 + 101: TypeArray 6(int8_t) 100 + TypeForwardPointer 102 PhysicalStorageBufferEXT + 103(Block16): TypeStruct 99 101 102 + 104: TypeArray 7(int) 82 + 105: TypeRuntimeArray 7(int) + 106(Block): TypeStruct 104 105 + 102: TypePointer PhysicalStorageBufferEXT 106(Block) + 107: TypePointer StorageBuffer 103(Block16) + 108(block8): 107(ptr) Variable StorageBuffer + 109: TypePointer StorageBuffer 6(int8_t) + 116: 72(int) Constant 2 + 117: TypePointer StorageBuffer 102(ptr) + 120: TypePointer PhysicalStorageBufferEXT 7(int) + 136: TypePointer Function 72(int) + 138: 7(int) SpecConstantOp 5362 33 + 139: 72(int) SpecConstantOp 128 138 76 + 140: TypeArray 37 88 + 141: TypePointer Function 140 + 143: 72(int) Constant 3 + 144: 6(int8_t) Constant 1 + 150: 72(int) Constant 1234 + 155: 72(int) Constant 8 + 156(Y): 72(int) SpecConstant 2 + 157(Z): 72(int) SpecConstantOp 132 155 156(Y) + 158: TypeCooperativeMatrixNV 16(int8_t) 8 157(Z) 9 + 159: TypeArray 158 8 + 160: TypePointer Private 159 + 161(muC2): 160(ptr) Variable Private + 162: TypePointer Private 158 + 166: TypeCooperativeMatrixNV 6(int8_t) 8 157(Z) 9 + 167: TypeArray 166 8 + 168: TypePointer Private 167 + 169(miC2): 168(ptr) Variable Private + 170: TypePointer Private 6(int8_t) + 174: TypePointer Private 16(int8_t) + 204: 16(int8_t) Constant 4 + 208: TypeVector 7(int) 4 + 209: 7(int) Constant 32 + 210: TypeArray 208(ivec4) 209 + 211: TypePointer Workgroup 210 + 212(shmatrix): 211(ptr) Variable Workgroup + 213: 7(int) Constant 2 + 214: TypePointer Workgroup 208(ivec4) + 221: TypeVector 7(int) 3 + 222: 7(int) Constant 64 + 223: 221(ivec3) ConstantComposite 222 100 100 + 224: TypePointer Private 166 + 225(miC): 224(ptr) Variable Private + 226(muC): 162(ptr) Variable Private + 227: 7(int) SpecConstantOp 5362 166 + 228: 72(int) SpecConstantOp 128 227 76 + 229: TypeArray 72(int) 228 + 230: TypePointer Private 229 + 231(iarr): 230(ptr) Variable Private + 232: 7(int) SpecConstantOp 5362 166 + 233: 72(int) SpecConstantOp 128 232 76 + 234: TypeArray 72(int) 233 + 235: TypePointer Private 234 + 236(iarr2): 235(ptr) Variable Private + 237: 7(int) SpecConstantOp 5362 158 + 238: 72(int) SpecConstantOp 128 237 76 + 239: TypeArray 72(int) 238 + 240: TypePointer Private 239 + 241(uarr): 240(ptr) Variable Private + 242: 7(int) SpecConstantOp 5362 158 + 243: 72(int) SpecConstantOp 128 242 76 + 244: TypeArray 72(int) 243 + 245: TypePointer Private 244 + 246(uarr2): 245(ptr) Variable Private + 247: TypeCooperativeMatrixNV 72(int) 8 157(Z) 9 + 248: 247 ConstantComposite 73 + 249: 16(int8_t) Constant 1 + 250: 17 ConstantComposite 249 + 251(S): TypeStruct 72(int) 72(int) 72(int) + 252: 72(int) Constant 12 + 253: 72(int) Constant 23 + 254: 72(int) Constant 34 + 255: 251(S) ConstantComposite 252 253 254 + 256(SC): 72(int) SpecConstant 1 + 257: TypeCooperativeMatrixNV 7(int) 8 256(SC) 256(SC) + 258: TypeArray 257 256(SC) + 259: TypeArray 258 256(SC) + 260: TypePointer Private 259 + 261(scm): 260(ptr) Variable Private + 4(main): 2 Function None 3 + 5: Label + 35(mu): 34(ptr) Variable Function + 39(mi): 38(ptr) Variable Function + 55(mf16_0): 54(ptr) Variable Function + 61(mf32_0): 60(ptr) Variable Function + 64(mf16_1): 54(ptr) Variable Function + 67(mf32_1): 60(ptr) Variable Function + 71(x): 70(ptr) Variable Function + 81(tempArg): 38(ptr) Variable Function + 98(tempArg): 34(ptr) Variable Function + 115(tempArg): 38(ptr) Variable Function + 128(D): 34(ptr) Variable Function + 129(A): 34(ptr) Variable Function + 131(B): 18(ptr) Variable Function + 133(C): 34(ptr) Variable Function + 137(l): 136(ptr) Variable Function + 142(a): 141(ptr) Variable Function + 146(md1): 136(ptr) Variable Function + 176(tempArg): 38(ptr) Variable Function + 182(tempArg): 34(ptr) Variable Function + 188(p1): 11(ptr) Variable Function + 189(param): 11(ptr) Variable Function + 192(p2): 18(ptr) Variable Function + 193(param): 18(ptr) Variable Function + 207(tempArg): 38(ptr) Variable Function + 217(ms): 38(ptr) Variable Function + Store 35(mu) 36 + Store 39(mi) 41 + 42: 33 Load 35(mu) + 43: 33 Load 35(mu) + 44: 33 IAdd 42 43 + Store 35(mu) 44 + 45: 33 Load 35(mu) + 46: 33 Load 35(mu) + 47: 33 ISub 45 46 + Store 35(mu) 47 + 48: 37 Load 39(mi) + 49: 37 SNegate 48 + Store 39(mi) 49 + 50: 37 Load 39(mi) + 51: 37 MatrixTimesScalar 50 40 + Store 39(mi) 51 + 56: 33 Load 35(mu) + 57: 53 ConvertUToF 56 + Store 55(mf16_0) 57 + 62: 33 Load 35(mu) + 63: 59 ConvertUToF 62 + Store 61(mf32_0) 63 + 65: 37 Load 39(mi) + 66: 53 ConvertSToF 65 + Store 64(mf16_1) 66 + 68: 37 Load 39(mi) + 69: 59 ConvertSToF 68 + Store 67(mf32_1) 69 + 74: 70(ptr) AccessChain 35(mu) 73 + 75: 16(int8_t) Load 74 + Store 71(x) 75 + 77: 16(int8_t) Load 71(x) + 78: 6(int8_t) Bitcast 77 + 80: 79(ptr) AccessChain 39(mi) 76 + Store 80 78 + 90: 89(ptr) AccessChain 87(block) 73 32 + 94: 37 CooperativeMatrixLoadNV 90 91 93 MakePointerVisibleKHR NonPrivatePointerKHR 88 + Store 81(tempArg) 94 + 95: 37 Load 81(tempArg) + Store 39(mi) 95 + 96: 37 Load 39(mi) + 97: 89(ptr) AccessChain 87(block) 73 32 + CooperativeMatrixStoreNV 97 96 91 93 MakePointerAvailableKHR NonPrivatePointerKHR 88 + 110: 109(ptr) AccessChain 108(block8) 73 32 + 111: 33 CooperativeMatrixLoadNV 110 91 93 MakePointerVisibleKHR NonPrivatePointerKHR 88 + Store 98(tempArg) 111 + 112: 33 Load 98(tempArg) + Store 35(mu) 112 + 113: 33 Load 35(mu) + 114: 109(ptr) AccessChain 108(block8) 73 32 + CooperativeMatrixStoreNV 114 113 91 93 MakePointerAvailableKHR NonPrivatePointerKHR 88 + 118: 117(ptr) AccessChain 108(block8) 116 + 119: 102(ptr) Load 118 MakePointerVisibleKHR NonPrivatePointerKHR 88 + 121: 120(ptr) AccessChain 119 73 32 + 122: 37 CooperativeMatrixLoadNV 121 91 93 Aligned MakePointerVisibleKHR NonPrivatePointerKHR 16 88 + Store 115(tempArg) 122 + 123: 37 Load 115(tempArg) + Store 39(mi) 123 + 124: 37 Load 39(mi) + 125: 117(ptr) AccessChain 108(block8) 116 + 126: 102(ptr) Load 125 MakePointerVisibleKHR NonPrivatePointerKHR 88 + 127: 120(ptr) AccessChain 126 73 32 + CooperativeMatrixStoreNV 127 124 91 93 Aligned MakePointerAvailableKHR NonPrivatePointerKHR 16 88 + 130: 33 Load 129(A) + 132: 17 Load 131(B) + 134: 33 Load 133(C) + 135: 33 CooperativeMatrixMulAddNV 130 132 134 + Store 128(D) 135 + Store 137(l) 139 + 145: 79(ptr) AccessChain 142(a) 143 76 + Store 145 144 + Store 146(md1) 73 + 147: 37 Load 39(mi) + 148: 37 Load 39(mi) + 149: 37 IAdd 148 147 + Store 39(mi) 149 + 151: 6(int8_t) CompositeExtract 149 1234 + 152: 72(int) SConvert 151 + 153: 72(int) Load 146(md1) + 154: 72(int) IAdd 153 152 + Store 146(md1) 154 + 163: 162(ptr) AccessChain 161(muC2) 73 + 164: 158 Load 163 + 165: 162(ptr) AccessChain 161(muC2) 76 + Store 165 164 + 171: 170(ptr) AccessChain 169(miC2) 116 76 + 172: 6(int8_t) Load 171 + 173: 16(int8_t) Bitcast 172 + 175: 174(ptr) AccessChain 161(muC2) 73 76 + Store 175 173 + 177: 89(ptr) AccessChain 87(block) 76 32 + 178: 37 CooperativeMatrixLoadNV 177 91 93 MakePointerVisibleKHR NonPrivatePointerKHR 88 + Store 176(tempArg) 178 + 179: 37 Load 176(tempArg) + Store 39(mi) 179 + 180: 37 Load 39(mi) + 181: 89(ptr) AccessChain 87(block) 76 32 + CooperativeMatrixStoreNV 181 180 91 93 MakePointerAvailableKHR NonPrivatePointerKHR 88 + 183: 109(ptr) AccessChain 108(block8) 76 32 + 184: 33 CooperativeMatrixLoadNV 183 91 93 MakePointerVisibleKHR NonPrivatePointerKHR 88 + Store 182(tempArg) 184 + 185: 33 Load 182(tempArg) + Store 35(mu) 185 + 186: 33 Load 35(mu) + 187: 109(ptr) AccessChain 108(block8) 76 32 + CooperativeMatrixStoreNV 187 186 91 93 MakePointerAvailableKHR NonPrivatePointerKHR 88 + 190: 10 Load 188(p1) + Store 189(param) 190 + 191: 10 FunctionCall 14(ineg(i81;) 189(param) + Store 188(p1) 191 + 194: 17 Load 192(p2) + Store 193(param) 194 + 195: 17 FunctionCall 21(umul(u81;) 193(param) + Store 192(p2) 195 + 196: 10 Load 188(p1) + 197: 10 Load 188(p1) + 198: 10 SDiv 197 196 + Store 188(p1) 198 + 199: 17 Load 192(p2) + 200: 17 Load 192(p2) + 201: 17 UDiv 200 199 + Store 192(p2) 201 + 202: 10 Load 188(p1) + 203: 10 MatrixTimesScalar 202 40 + Store 188(p1) 203 + 205: 17 Load 192(p2) + 206: 17 MatrixTimesScalar 205 204 + Store 192(p2) 206 + 215: 214(ptr) AccessChain 212(shmatrix) 100 + 216: 37 CooperativeMatrixLoadNV 215 213 93 MakePointerVisibleKHR NonPrivatePointerKHR 213 + Store 207(tempArg) 216 + 218: 37 Load 207(tempArg) + Store 217(ms) 218 + 219: 37 Load 217(ms) + 220: 214(ptr) AccessChain 212(shmatrix) 100 + CooperativeMatrixStoreNV 220 219 213 93 MakePointerAvailableKHR NonPrivatePointerKHR 213 + Return + FunctionEnd + 14(ineg(i81;): 10 Function None 12 + 13(m): 11(ptr) FunctionParameter + 15: Label + 23: 10 Load 13(m) + 24: 10 SNegate 23 + ReturnValue 24 + FunctionEnd + 21(umul(u81;): 17 Function None 19 + 20(m): 18(ptr) FunctionParameter + 22: Label + 27: 17 Load 20(m) + 29: 17 MatrixTimesScalar 27 28 + ReturnValue 29 + FunctionEnd diff --git a/Test/baseResults/web.array.frag.out b/Test/baseResults/web.array.frag.out new file mode 100644 index 00000000..df70be12 --- /dev/null +++ b/Test/baseResults/web.array.frag.out @@ -0,0 +1,102 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 74 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %colorOut + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %foo_f1_5__ "foo(f1[5];" + OpName %a "a" + OpName %g4 "g4" + OpName %g5 "g5" + OpName %param "param" + OpName %u "u" + OpName %param_0 "param" + OpName %colorOut "colorOut" + OpDecorate %colorOut Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 +%_arr_float_uint_5 = OpTypeArray %float %uint_5 +%_ptr_Function__arr_float_uint_5 = OpTypePointer Function %_arr_float_uint_5 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 + %13 = OpTypeFunction %_arr_float_uint_4 %_ptr_Function__arr_float_uint_5 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Function_float = OpTypePointer Function %float + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 +%_ptr_Private__arr_float_uint_4 = OpTypePointer Private %_arr_float_uint_4 + %g4 = OpVariable %_ptr_Private__arr_float_uint_4 Private +%_ptr_Private__arr_float_uint_5 = OpTypePointer Private %_arr_float_uint_5 + %g5 = OpVariable %_ptr_Private__arr_float_uint_5 Private + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %45 = OpConstantComposite %_arr_float_uint_4 %float_1 %float_2 %float_3 %float_4 + %bool = OpTypeBool + %v2float = OpTypeVector %float 2 +%_ptr_Output_v2float = OpTypePointer Output %v2float + %colorOut = OpVariable %_ptr_Output_v2float Output + %float_5 = OpConstant %float 5 + %73 = OpConstantComposite %v2float %float_4 %float_5 + %main = OpFunction %void None %3 + %5 = OpLabel + %param = OpVariable %_ptr_Function__arr_float_uint_5 Function + %u = OpVariable %_ptr_Function__arr_float_uint_5 Function + %param_0 = OpVariable %_ptr_Function__arr_float_uint_5 Function + %39 = OpLoad %_arr_float_uint_5 %g5 + OpStore %param %39 + %40 = OpFunctionCall %_arr_float_uint_4 %foo_f1_5__ %param + OpStore %g4 %40 + %46 = OpLoad %_arr_float_uint_4 %g4 + %48 = OpCompositeExtract %float %45 0 + %49 = OpCompositeExtract %float %46 0 + %50 = OpFOrdEqual %bool %48 %49 + %51 = OpCompositeExtract %float %45 1 + %52 = OpCompositeExtract %float %46 1 + %53 = OpFOrdEqual %bool %51 %52 + %54 = OpLogicalAnd %bool %50 %53 + %55 = OpCompositeExtract %float %45 2 + %56 = OpCompositeExtract %float %46 2 + %57 = OpFOrdEqual %bool %55 %56 + %58 = OpLogicalAnd %bool %54 %57 + %59 = OpCompositeExtract %float %45 3 + %60 = OpCompositeExtract %float %46 3 + %61 = OpFOrdEqual %bool %59 %60 + %62 = OpLogicalAnd %bool %58 %61 + OpSelectionMerge %64 None + OpBranchConditional %62 %63 %64 + %63 = OpLabel + OpBranch %64 + %64 = OpLabel + %67 = OpLoad %_arr_float_uint_5 %u + OpStore %param_0 %67 + %68 = OpFunctionCall %_arr_float_uint_4 %foo_f1_5__ %param_0 + OpStore %colorOut %73 + OpReturn + OpFunctionEnd + %foo_f1_5__ = OpFunction %_arr_float_uint_4 None %13 + %a = OpFunctionParameter %_ptr_Function__arr_float_uint_5 + %16 = OpLabel + %20 = OpAccessChain %_ptr_Function_float %a %int_0 + %21 = OpLoad %float %20 + %23 = OpAccessChain %_ptr_Function_float %a %int_1 + %24 = OpLoad %float %23 + %26 = OpAccessChain %_ptr_Function_float %a %int_2 + %27 = OpLoad %float %26 + %29 = OpAccessChain %_ptr_Function_float %a %int_3 + %30 = OpLoad %float %29 + %31 = OpCompositeConstruct %_arr_float_uint_4 %21 %24 %27 %30 + OpReturnValue %31 + OpFunctionEnd diff --git a/Test/baseResults/web.basic.vert.out b/Test/baseResults/web.basic.vert.out new file mode 100644 index 00000000..cd9805bd --- /dev/null +++ b/Test/baseResults/web.basic.vert.out @@ -0,0 +1,65 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 38 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %outv4 %inv4 + OpSource ESSL 310 + OpName %main "main" + OpName %outv4 "outv4" + OpName %inv4 "inv4" + OpName %uBlock "uBlock" + OpMemberName %uBlock 0 "a" + OpMemberName %uBlock 1 "b" + OpMemberName %uBlock 2 "c" + OpName %uInst "uInst" + OpDecorate %outv4 Location 1 + OpDecorate %inv4 Location 2 + OpMemberDecorate %uBlock 0 Offset 0 + OpMemberDecorate %uBlock 1 Offset 16 + OpMemberDecorate %uBlock 2 Offset 32 + OpDecorate %uBlock Block + OpDecorate %uInst DescriptorSet 0 + OpDecorate %uInst Binding 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %outv4 = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float + %inv4 = OpVariable %_ptr_Input_v4float Input + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %uBlock = OpTypeStruct %v4float %v4int %v4uint +%_ptr_Uniform_uBlock = OpTypePointer Uniform %uBlock + %uInst = OpVariable %_ptr_Uniform_uBlock Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float + %int_1 = OpConstant %int 1 +%_ptr_Uniform_v4int = OpTypePointer Uniform %v4int + %int_2 = OpConstant %int 2 +%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint + %main = OpFunction %void None %3 + %5 = OpLabel + %12 = OpLoad %v4float %inv4 + %13 = OpExtInst %v4float %1 Normalize %12 + %23 = OpAccessChain %_ptr_Uniform_v4float %uInst %int_0 + %24 = OpLoad %v4float %23 + %25 = OpFMul %v4float %13 %24 + %28 = OpAccessChain %_ptr_Uniform_v4int %uInst %int_1 + %29 = OpLoad %v4int %28 + %30 = OpConvertSToF %v4float %29 + %31 = OpFMul %v4float %25 %30 + %34 = OpAccessChain %_ptr_Uniform_v4uint %uInst %int_2 + %35 = OpLoad %v4uint %34 + %36 = OpConvertUToF %v4float %35 + %37 = OpFMul %v4float %31 %36 + OpStore %outv4 %37 + OpReturn + OpFunctionEnd diff --git a/Test/baseResults/web.builtins.frag.out b/Test/baseResults/web.builtins.frag.out new file mode 100644 index 00000000..2862dc15 --- /dev/null +++ b/Test/baseResults/web.builtins.frag.out @@ -0,0 +1,149 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 69 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %gl_FragDepth %sc %s2 %sf %c1D %c2D %c4D %c3D %ic1D %ic3D %ic4D + OpExecutionMode %main OriginUpperLeft + OpExecutionMode %main DepthReplacing + OpSource ESSL 310 + OpName %main "main" + OpName %f "f" + OpName %gl_FragCoord "gl_FragCoord" + OpName %gl_FragDepth "gl_FragDepth" + OpName %sc "sc" + OpName %S2 "S2" + OpMemberName %S2 0 "c" + OpMemberName %S2 1 "f" + OpName %s2 "s2" + OpName %sf "sf" + OpName %c1D "c1D" + OpName %c2D "c2D" + OpName %c4D "c4D" + OpName %c3D "c3D" + OpName %ic1D "ic1D" + OpName %ic3D "ic3D" + OpName %ic4D "ic4D" + OpDecorate %f RelaxedPrecision + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %gl_FragDepth BuiltIn FragDepth + OpDecorate %19 RelaxedPrecision + OpDecorate %sc RelaxedPrecision + OpDecorate %sc Location 0 + OpMemberDecorate %S2 0 RelaxedPrecision + OpMemberDecorate %S2 1 RelaxedPrecision + OpDecorate %s2 Location 8 + OpDecorate %30 RelaxedPrecision + OpDecorate %sf RelaxedPrecision + OpDecorate %sf Location 1 + OpDecorate %34 RelaxedPrecision + OpDecorate %c1D RelaxedPrecision + OpDecorate %c1D Location 4 + OpDecorate %36 RelaxedPrecision + OpDecorate %37 RelaxedPrecision + OpDecorate %38 RelaxedPrecision + OpDecorate %39 RelaxedPrecision + OpDecorate %c2D RelaxedPrecision + OpDecorate %c2D Location 5 + OpDecorate %43 RelaxedPrecision + OpDecorate %44 RelaxedPrecision + OpDecorate %45 RelaxedPrecision + OpDecorate %46 RelaxedPrecision + OpDecorate %47 RelaxedPrecision + OpDecorate %c4D RelaxedPrecision + OpDecorate %c4D Location 7 + OpDecorate %49 RelaxedPrecision + OpDecorate %50 RelaxedPrecision + OpDecorate %51 RelaxedPrecision + OpDecorate %52 RelaxedPrecision + OpDecorate %53 RelaxedPrecision + OpDecorate %c3D RelaxedPrecision + OpDecorate %c3D Location 6 + OpDecorate %55 RelaxedPrecision + OpDecorate %56 RelaxedPrecision + OpDecorate %ic1D RelaxedPrecision + OpDecorate %ic1D Flat + OpDecorate %ic1D Location 1 + OpDecorate %ic3D RelaxedPrecision + OpDecorate %ic3D Flat + OpDecorate %ic3D Location 2 + OpDecorate %ic4D RelaxedPrecision + OpDecorate %ic4D Flat + OpDecorate %ic4D Location 3 + OpDecorate %68 RelaxedPrecision + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float +%_ptr_Output_float = OpTypePointer Output %float +%gl_FragDepth = OpVariable %_ptr_Output_float Output + %v3float = OpTypeVector %float 3 +%_ptr_Output_v3float = OpTypePointer Output %v3float + %sc = OpVariable %_ptr_Output_v3float Output + %S2 = OpTypeStruct %v3float %float +%_ptr_Input_S2 = OpTypePointer Input %S2 + %s2 = OpVariable %_ptr_Input_S2 Input + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Input_v3float = OpTypePointer Input %v3float + %sf = OpVariable %_ptr_Output_float Output + %int_1 = OpConstant %int 1 + %c1D = OpVariable %_ptr_Input_float Input + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %c2D = OpVariable %_ptr_Input_v2float Input + %c4D = OpVariable %_ptr_Input_v4float Input + %c3D = OpVariable %_ptr_Input_v3float Input +%_ptr_Input_int = OpTypePointer Input %int + %ic1D = OpVariable %_ptr_Input_int Input + %v3int = OpTypeVector %int 3 +%_ptr_Input_v3int = OpTypePointer Input %v3int + %ic3D = OpVariable %_ptr_Input_v3int Input + %v4int = OpTypeVector %int 4 +%_ptr_Input_v4int = OpTypePointer Input %v4int + %ic4D = OpVariable %_ptr_Input_v4int Input + %v2int = OpTypeVector %int 2 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %68 = OpConstantComposite %v2int %int_2 %int_3 + %main = OpFunction %void None %3 + %5 = OpLabel + %f = OpVariable %_ptr_Function_float Function + %15 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1 + %16 = OpLoad %float %15 + OpStore %f %16 + %19 = OpLoad %float %f + OpStore %gl_FragDepth %19 + %29 = OpAccessChain %_ptr_Input_v3float %s2 %int_0 + %30 = OpLoad %v3float %29 + OpStore %sc %30 + %33 = OpAccessChain %_ptr_Input_float %s2 %int_1 + %34 = OpLoad %float %33 + OpStore %sf %34 + %36 = OpLoad %float %c1D + %37 = OpExtInst %float %1 Sinh %36 + %38 = OpLoad %float %c1D + %39 = OpExtInst %float %1 Cosh %38 + %43 = OpLoad %v2float %c2D + %44 = OpExtInst %v2float %1 Tanh %43 + %45 = OpVectorTimesScalar %v2float %44 %39 + %46 = OpCompositeConstruct %v2float %37 %37 + %47 = OpFAdd %v2float %46 %45 + %49 = OpLoad %v4float %c4D + %50 = OpExtInst %v4float %1 Asinh %49 + %51 = OpLoad %v4float %c4D + %52 = OpExtInst %v4float %1 Acosh %51 + %53 = OpFAdd %v4float %50 %52 + %55 = OpLoad %v3float %c3D + %56 = OpExtInst %v3float %1 Atanh %55 + OpReturn + OpFunctionEnd diff --git a/Test/baseResults/web.builtins.vert.out b/Test/baseResults/web.builtins.vert.out new file mode 100644 index 00000000..9ea66726 --- /dev/null +++ b/Test/baseResults/web.builtins.vert.out @@ -0,0 +1,62 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %gl_Position %ps %gl_VertexIndex %gl_PointSize %gl_InstanceIndex + OpSource ESSL 310 + OpName %main "main" + OpName %gl_Position "gl_Position" + OpName %ps "ps" + OpName %gl_VertexIndex "gl_VertexIndex" + OpName %gl_PointSize "gl_PointSize" + OpName %gl_InstanceIndex "gl_InstanceIndex" + OpDecorate %gl_Position Invariant + OpDecorate %gl_Position BuiltIn Position + OpDecorate %ps RelaxedPrecision + OpDecorate %ps Location 0 + OpDecorate %12 RelaxedPrecision + OpDecorate %gl_VertexIndex BuiltIn VertexIndex + OpDecorate %gl_PointSize BuiltIn PointSize + OpDecorate %25 RelaxedPrecision + OpDecorate %gl_InstanceIndex BuiltIn InstanceIndex + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_Position = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_float = OpTypePointer Input %float + %ps = OpVariable %_ptr_Input_float Input + %int = OpTypeInt 32 1 + %int_4 = OpConstant %int 4 +%_ptr_Input_int = OpTypePointer Input %int +%gl_VertexIndex = OpVariable %_ptr_Input_int Input +%_ptr_Output_float = OpTypePointer Output %float +%gl_PointSize = OpVariable %_ptr_Output_float Output + %int_5 = OpConstant %int 5 +%gl_InstanceIndex = OpVariable %_ptr_Input_int Input + %main = OpFunction %void None %3 + %5 = OpLabel + %12 = OpLoad %float %ps + %13 = OpCompositeConstruct %v4float %12 %12 %12 %12 + OpStore %gl_Position %13 + %18 = OpLoad %int %gl_VertexIndex + %19 = OpISub %int %int_4 %18 + %20 = OpConvertSToF %float %19 + %21 = OpLoad %v4float %gl_Position + %22 = OpVectorTimesScalar %v4float %21 %20 + OpStore %gl_Position %22 + %25 = OpLoad %float %ps + OpStore %gl_PointSize %25 + %28 = OpLoad %int %gl_InstanceIndex + %29 = OpISub %int %int_5 %28 + %30 = OpConvertSToF %float %29 + %31 = OpLoad %float %gl_PointSize + %32 = OpFMul %float %31 %30 + OpStore %gl_PointSize %32 + OpReturn + OpFunctionEnd diff --git a/Test/baseResults/web.controlFlow.frag.out b/Test/baseResults/web.controlFlow.frag.out new file mode 100644 index 00000000..ebfa5be6 --- /dev/null +++ b/Test/baseResults/web.controlFlow.frag.out @@ -0,0 +1,347 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 193 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %x %BaseColor %Count %bigColor %outColor %v4 %f_0 + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %c "c" + OpName %f "f" + OpName %x "x" + OpName %d "d" + OpName %color "color" + OpName %BaseColor "BaseColor" + OpName %i "i" + OpName %Count "Count" + OpName %bigColor "bigColor" + OpName %outColor "outColor" + OpName %sum "sum" + OpName %i_0 "i" + OpName %v4 "v4" + OpName %i_1 "i" + OpName %tv4 "tv4" + OpName %r "r" + OpName %i_2 "i" + OpName %i_3 "i" + OpName %i_4 "i" + OpName %A "A" + OpName %B "B" + OpName %C "C" + OpName %D "D" + OpName %f_0 "f" + OpDecorate %f RelaxedPrecision + OpDecorate %x Location 0 + OpDecorate %color RelaxedPrecision + OpDecorate %BaseColor RelaxedPrecision + OpDecorate %BaseColor Location 2 + OpDecorate %47 RelaxedPrecision + OpDecorate %Count Flat + OpDecorate %Count Location 4 + OpDecorate %bigColor RelaxedPrecision + OpDecorate %bigColor Location 1 + OpDecorate %63 RelaxedPrecision + OpDecorate %64 RelaxedPrecision + OpDecorate %65 RelaxedPrecision + OpDecorate %outColor RelaxedPrecision + OpDecorate %outColor Location 0 + OpDecorate %71 RelaxedPrecision + OpDecorate %sum RelaxedPrecision + OpDecorate %v4 Flat + OpDecorate %v4 Location 5 + OpDecorate %91 RelaxedPrecision + OpDecorate %92 RelaxedPrecision + OpDecorate %93 RelaxedPrecision + OpDecorate %tv4 RelaxedPrecision + OpDecorate %111 RelaxedPrecision + OpDecorate %115 RelaxedPrecision + OpDecorate %116 RelaxedPrecision + OpDecorate %117 RelaxedPrecision + OpDecorate %118 RelaxedPrecision + OpDecorate %119 RelaxedPrecision + OpDecorate %120 RelaxedPrecision + OpDecorate %r RelaxedPrecision + OpDecorate %123 RelaxedPrecision + OpDecorate %124 RelaxedPrecision + OpDecorate %136 RelaxedPrecision + OpDecorate %141 RelaxedPrecision + OpDecorate %142 RelaxedPrecision + OpDecorate %143 RelaxedPrecision + OpDecorate %144 RelaxedPrecision + OpDecorate %145 RelaxedPrecision + OpDecorate %157 RelaxedPrecision + OpDecorate %158 RelaxedPrecision + OpDecorate %159 RelaxedPrecision + OpDecorate %f_0 RelaxedPrecision + OpDecorate %f_0 Location 3 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Private_int = OpTypePointer Private %int + %c = OpVariable %_ptr_Private_int Private + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Input_float = OpTypePointer Input %float + %x = OpVariable %_ptr_Input_float Input + %d = OpVariable %_ptr_Private_int Private + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float + %BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 +%_ptr_Input_int = OpTypePointer Input %int + %Count = OpVariable %_ptr_Input_int Input + %bool = OpTypeBool + %bigColor = OpVariable %_ptr_Input_v4float Input + %int_1 = OpConstant %int 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %outColor = OpVariable %_ptr_Output_v4float Output + %float_0 = OpConstant %float 0 + %int_4 = OpConstant %int 4 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 +%_ptr_Input_v4uint = OpTypePointer Input %v4uint + %v4 = OpVariable %_ptr_Input_v4uint Input +%_ptr_Input_uint = OpTypePointer Input %uint + %uint_4 = OpConstant %uint 4 + %v3float = OpTypeVector %float 3 + %uint_3 = OpConstant %uint 3 + %int_16 = OpConstant %int 16 + %int_10 = OpConstant %int 10 + %int_2 = OpConstant %int 2 + %int_5 = OpConstant %int 5 + %int_3 = OpConstant %int 3 + %f_0 = OpVariable %_ptr_Input_float Input + %main = OpFunction %void None %3 + %5 = OpLabel + %f = OpVariable %_ptr_Function_float Function + %color = OpVariable %_ptr_Function_v4float Function + %i = OpVariable %_ptr_Function_int Function + %sum = OpVariable %_ptr_Function_float Function + %i_0 = OpVariable %_ptr_Function_int Function + %i_1 = OpVariable %_ptr_Function_int Function + %tv4 = OpVariable %_ptr_Function_v4float Function + %r = OpVariable %_ptr_Function_v4float Function + %i_2 = OpVariable %_ptr_Function_int Function + %i_3 = OpVariable %_ptr_Function_int Function + %i_4 = OpVariable %_ptr_Function_int Function + %A = OpVariable %_ptr_Function_int Function + %B = OpVariable %_ptr_Function_int Function + %C = OpVariable %_ptr_Function_int Function + %D = OpVariable %_ptr_Function_int Function + %9 = OpLoad %int %c + OpSelectionMerge %13 None + OpSwitch %9 %12 1 %10 2 %11 + %12 = OpLabel + %39 = OpLoad %float %x + %40 = OpExtInst %float %1 Tan %39 + OpStore %f %40 + OpBranch %13 + %10 = OpLabel + %19 = OpLoad %float %x + %20 = OpExtInst %float %1 Sin %19 + OpStore %f %20 + OpBranch %13 + %11 = OpLabel + %23 = OpLoad %int %d + OpSelectionMerge %26 None + OpSwitch %23 %26 1 %24 2 %25 + %24 = OpLabel + %27 = OpLoad %float %x + %28 = OpLoad %float %x + %29 = OpFMul %float %27 %28 + %30 = OpLoad %float %x + %31 = OpFMul %float %29 %30 + OpStore %f %31 + OpBranch %26 + %25 = OpLabel + %33 = OpLoad %float %x + %34 = OpLoad %float %x + %35 = OpFMul %float %33 %34 + OpStore %f %35 + OpBranch %26 + %26 = OpLabel + OpBranch %13 + %13 = OpLabel + %47 = OpLoad %v4float %BaseColor + OpStore %color %47 + OpStore %i %int_0 + OpBranch %51 + %51 = OpLabel + OpLoopMerge %53 %54 None + OpBranch %55 + %55 = OpLabel + %56 = OpLoad %int %i + %59 = OpLoad %int %Count + %61 = OpSLessThan %bool %56 %59 + OpBranchConditional %61 %52 %53 + %52 = OpLabel + %63 = OpLoad %v4float %bigColor + %64 = OpLoad %v4float %color + %65 = OpFAdd %v4float %64 %63 + OpStore %color %65 + OpBranch %54 + %54 = OpLabel + %66 = OpLoad %int %i + %68 = OpIAdd %int %66 %int_1 + OpStore %i %68 + OpBranch %51 + %53 = OpLabel + %71 = OpLoad %v4float %color + OpStore %outColor %71 + OpStore %sum %float_0 + OpStore %i_0 %int_0 + OpBranch %75 + %75 = OpLabel + OpLoopMerge %77 %78 None + OpBranch %79 + %79 = OpLabel + %80 = OpLoad %int %i_0 + %82 = OpSLessThan %bool %80 %int_4 + OpBranchConditional %82 %76 %77 + %76 = OpLabel + %87 = OpLoad %int %i_0 + %89 = OpAccessChain %_ptr_Input_uint %v4 %87 + %90 = OpLoad %uint %89 + %91 = OpConvertUToF %float %90 + %92 = OpLoad %float %sum + %93 = OpFAdd %float %92 %91 + OpStore %sum %93 + OpBranch %78 + %78 = OpLabel + %94 = OpLoad %int %i_0 + %95 = OpIAdd %int %94 %int_1 + OpStore %i_0 %95 + OpBranch %75 + %77 = OpLabel + OpStore %i_1 %int_0 + OpBranch %97 + %97 = OpLabel + OpLoopMerge %99 %100 None + OpBranch %101 + %101 = OpLabel + %102 = OpLoad %int %i_1 + %103 = OpSLessThan %bool %102 %int_4 + OpBranchConditional %103 %98 %99 + %98 = OpLabel + %105 = OpLoad %int %i_1 + %106 = OpLoad %int %i_1 + %107 = OpAccessChain %_ptr_Input_uint %v4 %106 + %108 = OpLoad %uint %107 + %110 = OpIMul %uint %108 %uint_4 + %111 = OpConvertUToF %float %110 + %112 = OpAccessChain %_ptr_Function_float %tv4 %105 + OpStore %112 %111 + OpBranch %100 + %100 = OpLabel + %113 = OpLoad %int %i_1 + %114 = OpIAdd %int %113 %int_1 + OpStore %i_1 %114 + OpBranch %97 + %99 = OpLabel + %115 = OpLoad %float %sum + %116 = OpCompositeConstruct %v4float %115 %115 %115 %115 + %117 = OpLoad %v4float %tv4 + %118 = OpFAdd %v4float %116 %117 + %119 = OpLoad %v4float %outColor + %120 = OpFAdd %v4float %119 %118 + OpStore %outColor %120 + %123 = OpLoad %v4float %BaseColor + %124 = OpVectorShuffle %v3float %123 %123 0 1 2 + %125 = OpLoad %v4float %r + %126 = OpVectorShuffle %v4float %125 %124 4 5 6 3 + OpStore %r %126 + OpStore %i_2 %int_0 + OpBranch %128 + %128 = OpLabel + OpLoopMerge %130 %131 None + OpBranch %132 + %132 = OpLabel + %133 = OpLoad %int %i_2 + %134 = OpLoad %int %Count + %135 = OpSLessThan %bool %133 %134 + OpBranchConditional %135 %129 %130 + %129 = OpLabel + %136 = OpLoad %float %f + %138 = OpAccessChain %_ptr_Function_float %r %uint_3 + OpStore %138 %136 + OpBranch %131 + %131 = OpLabel + %139 = OpLoad %int %i_2 + %140 = OpIAdd %int %139 %int_1 + OpStore %i_2 %140 + OpBranch %128 + %130 = OpLabel + %141 = OpLoad %v4float %r + %142 = OpVectorShuffle %v3float %141 %141 0 1 2 + %143 = OpLoad %v4float %outColor + %144 = OpVectorShuffle %v3float %143 %143 0 1 2 + %145 = OpFAdd %v3float %144 %142 + %146 = OpLoad %v4float %outColor + %147 = OpVectorShuffle %v4float %146 %145 4 5 6 3 + OpStore %outColor %147 + OpStore %i_3 %int_0 + OpBranch %149 + %149 = OpLabel + OpLoopMerge %151 %152 None + OpBranch %153 + %153 = OpLabel + %154 = OpLoad %int %i_3 + %156 = OpSLessThan %bool %154 %int_16 + OpBranchConditional %156 %150 %151 + %150 = OpLabel + %157 = OpLoad %float %f + %158 = OpLoad %v4float %outColor + %159 = OpVectorTimesScalar %v4float %158 %157 + OpStore %outColor %159 + OpBranch %152 + %152 = OpLabel + %160 = OpLoad %int %i_3 + %161 = OpIAdd %int %160 %int_4 + OpStore %i_3 %161 + OpBranch %149 + %151 = OpLabel + OpStore %i_4 %int_0 + OpBranch %163 + %163 = OpLabel + OpLoopMerge %165 %166 None + OpBranch %167 + %167 = OpLabel + %168 = OpLoad %int %i_4 + %170 = OpSLessThan %bool %168 %int_10 + OpBranchConditional %170 %164 %165 + %164 = OpLabel + OpStore %A %int_1 + %172 = OpLoad %int %i_4 + %174 = OpSMod %int %172 %int_2 + %175 = OpIEqual %bool %174 %int_0 + OpSelectionMerge %177 None + OpBranchConditional %175 %176 %177 + %176 = OpLabel + OpStore %B %int_2 + OpBranch %166 + %177 = OpLabel + %181 = OpLoad %int %i_4 + %183 = OpSMod %int %181 %int_5 + %184 = OpIEqual %bool %183 %int_0 + OpSelectionMerge %186 None + OpBranchConditional %184 %185 %186 + %185 = OpLabel + OpStore %B %int_2 + OpBranch %165 + %186 = OpLabel + %188 = OpLoad %int %i_4 + %189 = OpIAdd %int %188 %int_1 + OpStore %i_4 %189 + OpBranch %166 + %166 = OpLabel + OpBranch %163 + %165 = OpLabel + OpStore %D %int_3 + OpReturn + OpFunctionEnd diff --git a/Test/baseResults/web.operations.frag.out b/Test/baseResults/web.operations.frag.out new file mode 100644 index 00000000..eb016246 --- /dev/null +++ b/Test/baseResults/web.operations.frag.out @@ -0,0 +1,321 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 207 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %f "f" + OpName %v4 "v4" + OpName %u "u" + OpName %uv4 "uv4" + OpName %iv3 "iv3" + OpName %i "i" + OpName %uv3 "uv3" + OpName %m2 "m2" + OpName %iv4 "iv4" + OpName %m4 "m4" + OpName %a "a" + OpName %S "S" + OpMemberName %S 0 "i" + OpName %s "s" + OpName %b "b" + OpName %arr "arr" + OpName %arr2 "arr2" + OpName %block "block" + OpMemberName %block 0 "f" + OpName %instanceName "instanceName" + OpDecorate %u RelaxedPrecision + OpDecorate %18 RelaxedPrecision + OpDecorate %19 RelaxedPrecision + OpDecorate %20 RelaxedPrecision + OpDecorate %uv4 RelaxedPrecision + OpDecorate %24 RelaxedPrecision + OpDecorate %25 RelaxedPrecision + OpDecorate %26 RelaxedPrecision + OpDecorate %27 RelaxedPrecision + OpDecorate %iv3 RelaxedPrecision + OpDecorate %32 RelaxedPrecision + OpDecorate %33 RelaxedPrecision + OpDecorate %34 RelaxedPrecision + OpDecorate %i RelaxedPrecision + OpDecorate %38 RelaxedPrecision + OpDecorate %39 RelaxedPrecision + OpDecorate %uv3 RelaxedPrecision + OpDecorate %43 RelaxedPrecision + OpDecorate %45 RelaxedPrecision + OpDecorate %46 RelaxedPrecision + OpDecorate %iv4 RelaxedPrecision + OpDecorate %62 RelaxedPrecision + OpDecorate %64 RelaxedPrecision + OpDecorate %65 RelaxedPrecision + OpDecorate %104 RelaxedPrecision + OpDecorate %105 RelaxedPrecision + OpMemberDecorate %S 0 RelaxedPrecision + OpDecorate %153 RelaxedPrecision + OpDecorate %154 RelaxedPrecision + OpDecorate %155 RelaxedPrecision + OpDecorate %156 RelaxedPrecision + OpDecorate %157 RelaxedPrecision + OpDecorate %158 RelaxedPrecision + OpDecorate %159 RelaxedPrecision + OpDecorate %160 RelaxedPrecision + OpDecorate %161 RelaxedPrecision + OpDecorate %162 RelaxedPrecision + OpDecorate %163 RelaxedPrecision + OpDecorate %164 RelaxedPrecision + OpDecorate %165 RelaxedPrecision + OpDecorate %166 RelaxedPrecision + OpDecorate %167 RelaxedPrecision + OpDecorate %168 RelaxedPrecision + OpDecorate %169 RelaxedPrecision + OpDecorate %170 RelaxedPrecision + OpDecorate %171 RelaxedPrecision + OpDecorate %172 RelaxedPrecision + OpDecorate %173 RelaxedPrecision + OpDecorate %174 RelaxedPrecision + OpDecorate %175 RelaxedPrecision + OpDecorate %176 RelaxedPrecision + OpDecorate %177 RelaxedPrecision + OpDecorate %178 RelaxedPrecision + OpDecorate %179 RelaxedPrecision + OpDecorate %180 RelaxedPrecision + OpDecorate %181 RelaxedPrecision + OpDecorate %182 RelaxedPrecision + OpDecorate %183 RelaxedPrecision + OpDecorate %184 RelaxedPrecision + OpDecorate %185 RelaxedPrecision + OpDecorate %186 RelaxedPrecision + OpDecorate %187 RelaxedPrecision + OpDecorate %188 RelaxedPrecision + OpDecorate %189 RelaxedPrecision + OpDecorate %190 RelaxedPrecision + OpDecorate %191 RelaxedPrecision + OpDecorate %192 RelaxedPrecision + OpDecorate %193 RelaxedPrecision + OpDecorate %194 RelaxedPrecision + OpDecorate %arr RelaxedPrecision + OpDecorate %arr2 RelaxedPrecision + OpMemberDecorate %block 0 RelaxedPrecision + OpMemberDecorate %block 0 Offset 0 + OpDecorate %block Block + OpDecorate %instanceName DescriptorSet 0 + OpDecorate %instanceName Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %uint = OpTypeInt 32 0 +%_ptr_Function_uint = OpTypePointer Function %uint + %v4uint = OpTypeVector %uint 4 +%_ptr_Function_v4uint = OpTypePointer Function %v4uint + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Function_v3int = OpTypePointer Function %v3int +%_ptr_Function_int = OpTypePointer Function %int + %int_3 = OpConstant %int 3 + %v3uint = OpTypeVector %uint 3 +%_ptr_Function_v3uint = OpTypePointer Function %v3uint + %uint_4 = OpConstant %uint 4 + %v2float = OpTypeVector %float 2 +%mat2v2float = OpTypeMatrix %v2float 2 +%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float + %float_1 = OpConstant %float 1 + %v4int = OpTypeVector %int 4 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %int_1 = OpConstant %int 1 +%mat4v4float = OpTypeMatrix %v4float 4 +%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float + %bool = OpTypeBool + %v4bool = OpTypeVector %bool 4 + %v2bool = OpTypeVector %bool 2 + %uint_5 = OpConstant %uint 5 +%_arr_float_uint_5 = OpTypeArray %float %uint_5 +%_ptr_Private__arr_float_uint_5 = OpTypePointer Private %_arr_float_uint_5 + %a = OpVariable %_ptr_Private__arr_float_uint_5 Private + %S = OpTypeStruct %int +%_ptr_Private_S = OpTypePointer Private %S + %s = OpVariable %_ptr_Private_S Private +%_ptr_Function_bool = OpTypePointer Function %bool + %uint_2 = OpConstant %uint 2 +%_arr_int_uint_2 = OpTypeArray %int %uint_2 +%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2 + %uint_3 = OpConstant %uint 3 +%_arr_int_uint_3 = OpTypeArray %int %uint_3 +%_ptr_Function__arr_int_uint_3 = OpTypePointer Function %_arr_int_uint_3 + %int_2 = OpConstant %int 2 + %block = OpTypeStruct %float +%_ptr_Uniform_block = OpTypePointer Uniform %block +%instanceName = OpVariable %_ptr_Uniform_block Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + %f = OpVariable %_ptr_Function_float Function + %v4 = OpVariable %_ptr_Function_v4float Function + %u = OpVariable %_ptr_Function_uint Function + %uv4 = OpVariable %_ptr_Function_v4uint Function + %iv3 = OpVariable %_ptr_Function_v3int Function + %i = OpVariable %_ptr_Function_int Function + %uv3 = OpVariable %_ptr_Function_v3uint Function + %m2 = OpVariable %_ptr_Function_mat2v2float Function + %iv4 = OpVariable %_ptr_Function_v4int Function + %m4 = OpVariable %_ptr_Function_mat4v4float Function + %b = OpVariable %_ptr_Function_bool Function + %arr = OpVariable %_ptr_Function__arr_int_uint_2 Function + %arr2 = OpVariable %_ptr_Function__arr_int_uint_3 Function + %9 = OpLoad %float %f + %13 = OpLoad %v4float %v4 + %14 = OpVectorTimesScalar %v4float %13 %9 + %18 = OpLoad %uint %u + %19 = OpLoad %uint %u + %20 = OpIAdd %uint %18 %19 + %24 = OpLoad %v4uint %uv4 + %25 = OpLoad %uint %u + %26 = OpCompositeConstruct %v4uint %25 %25 %25 %25 + %27 = OpUDiv %v4uint %24 %26 + %32 = OpLoad %v3int %iv3 + %33 = OpLoad %v3int %iv3 + %34 = OpISub %v3int %33 %32 + OpStore %iv3 %34 + %38 = OpLoad %int %i + %39 = OpSMod %int %38 %int_3 + OpStore %i %39 + %43 = OpLoad %v3uint %uv3 + %45 = OpCompositeConstruct %v3uint %uint_4 %uint_4 %uint_4 + %46 = OpUMod %v3uint %43 %45 + %51 = OpLoad %mat2v2float %m2 + %53 = OpCompositeConstruct %v2float %float_1 %float_1 + %54 = OpCompositeExtract %v2float %51 0 + %55 = OpFSub %v2float %54 %53 + %56 = OpCompositeExtract %v2float %51 1 + %57 = OpFSub %v2float %56 %53 + %58 = OpCompositeConstruct %mat2v2float %55 %57 + OpStore %m2 %58 + %62 = OpLoad %v4int %iv4 + %64 = OpCompositeConstruct %v4int %int_1 %int_1 %int_1 %int_1 + %65 = OpIAdd %v4int %62 %64 + OpStore %iv4 %65 + %69 = OpLoad %mat4v4float %m4 + %70 = OpLoad %mat4v4float %m4 + %72 = OpCompositeExtract %v4float %69 0 + %73 = OpCompositeExtract %v4float %70 0 + %75 = OpFOrdNotEqual %v4bool %72 %73 + %76 = OpAny %bool %75 + %77 = OpCompositeExtract %v4float %69 1 + %78 = OpCompositeExtract %v4float %70 1 + %79 = OpFOrdNotEqual %v4bool %77 %78 + %80 = OpAny %bool %79 + %81 = OpLogicalOr %bool %76 %80 + %82 = OpCompositeExtract %v4float %69 2 + %83 = OpCompositeExtract %v4float %70 2 + %84 = OpFOrdNotEqual %v4bool %82 %83 + %85 = OpAny %bool %84 + %86 = OpLogicalOr %bool %81 %85 + %87 = OpCompositeExtract %v4float %69 3 + %88 = OpCompositeExtract %v4float %70 3 + %89 = OpFOrdNotEqual %v4bool %87 %88 + %90 = OpAny %bool %89 + %91 = OpLogicalOr %bool %86 %90 + %92 = OpLoad %mat2v2float %m2 + %93 = OpLoad %mat2v2float %m2 + %94 = OpCompositeExtract %v2float %92 0 + %95 = OpCompositeExtract %v2float %93 0 + %97 = OpFOrdEqual %v2bool %94 %95 + %98 = OpAll %bool %97 + %99 = OpCompositeExtract %v2float %92 1 + %100 = OpCompositeExtract %v2float %93 1 + %101 = OpFOrdEqual %v2bool %99 %100 + %102 = OpAll %bool %101 + %103 = OpLogicalAnd %bool %98 %102 + %104 = OpLoad %int %i + %105 = OpLoad %int %i + %106 = OpSLessThanEqual %bool %104 %105 + %111 = OpLoad %_arr_float_uint_5 %a + %112 = OpLoad %_arr_float_uint_5 %a + %113 = OpCompositeExtract %float %111 0 + %114 = OpCompositeExtract %float %112 0 + %115 = OpFOrdEqual %bool %113 %114 + %116 = OpCompositeExtract %float %111 1 + %117 = OpCompositeExtract %float %112 1 + %118 = OpFOrdEqual %bool %116 %117 + %119 = OpLogicalAnd %bool %115 %118 + %120 = OpCompositeExtract %float %111 2 + %121 = OpCompositeExtract %float %112 2 + %122 = OpFOrdEqual %bool %120 %121 + %123 = OpLogicalAnd %bool %119 %122 + %124 = OpCompositeExtract %float %111 3 + %125 = OpCompositeExtract %float %112 3 + %126 = OpFOrdEqual %bool %124 %125 + %127 = OpLogicalAnd %bool %123 %126 + %128 = OpCompositeExtract %float %111 4 + %129 = OpCompositeExtract %float %112 4 + %130 = OpFOrdEqual %bool %128 %129 + %131 = OpLogicalAnd %bool %127 %130 + %135 = OpLoad %S %s + %136 = OpLoad %S %s + %137 = OpCompositeExtract %int %135 0 + %138 = OpCompositeExtract %int %136 0 + %139 = OpINotEqual %bool %137 %138 + %142 = OpLoad %bool %b + %143 = OpLoad %bool %b + %144 = OpLogicalAnd %bool %142 %143 + %145 = OpLoad %bool %b + %146 = OpLoad %bool %b + %147 = OpLogicalOr %bool %145 %146 + %148 = OpLoad %bool %b + %149 = OpLoad %bool %b + %150 = OpLogicalNotEqual %bool %148 %149 + %151 = OpLoad %bool %b + %152 = OpLogicalNot %bool %151 + %153 = OpLoad %int %i + %154 = OpNot %int %153 + %155 = OpLoad %uint %u + %156 = OpNot %uint %155 + %157 = OpLoad %v3uint %uv3 + %158 = OpNot %v3uint %157 + %159 = OpLoad %v3int %iv3 + %160 = OpNot %v3int %159 + %161 = OpLoad %int %i + %162 = OpLoad %v3uint %uv3 + %163 = OpCompositeConstruct %v3int %161 %161 %161 + %164 = OpShiftLeftLogical %v3uint %162 %163 + OpStore %uv3 %164 + %165 = OpLoad %int %i + %166 = OpLoad %int %i + %167 = OpShiftRightArithmetic %int %165 %166 + %168 = OpLoad %uint %u + %169 = OpLoad %uint %u + %170 = OpShiftLeftLogical %uint %168 %169 + %171 = OpLoad %v3int %iv3 + %172 = OpLoad %v3int %iv3 + %173 = OpShiftRightArithmetic %v3int %171 %172 + %174 = OpLoad %int %i + %175 = OpLoad %int %i + %176 = OpBitwiseAnd %int %174 %175 + %177 = OpLoad %uint %u + %178 = OpLoad %uint %u + %179 = OpBitwiseOr %uint %177 %178 + %180 = OpLoad %v3int %iv3 + %181 = OpLoad %v3int %iv3 + %182 = OpBitwiseXor %v3int %180 %181 + %183 = OpLoad %uint %u + %184 = OpLoad %v3uint %uv3 + %185 = OpCompositeConstruct %v3uint %183 %183 %183 + %186 = OpBitwiseAnd %v3uint %185 %184 + %187 = OpLoad %v3uint %uv3 + %188 = OpLoad %uint %u + %189 = OpCompositeConstruct %v3uint %188 %188 %188 + %190 = OpBitwiseOr %v3uint %187 %189 + %191 = OpLoad %uint %u + %192 = OpLoad %v3uint %uv3 + %193 = OpCompositeConstruct %v3uint %191 %191 %191 + %194 = OpBitwiseAnd %v3uint %192 %193 + OpStore %uv3 %194 + OpReturn + OpFunctionEnd diff --git a/Test/baseResults/web.texture.frag.out b/Test/baseResults/web.texture.frag.out new file mode 100644 index 00000000..6fbebb4d --- /dev/null +++ b/Test/baseResults/web.texture.frag.out @@ -0,0 +1,396 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 189 +; Schema: 0 + OpCapability Shader + OpCapability ImageQuery + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %c2D %c4D %c3D %ic3D %ic1D %c1D %ic4D %s2 %sc %sf + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %v "v" + OpName %s2D "s2D" + OpName %c2D "c2D" + OpName %s3D "s3D" + OpName %c4D "c4D" + OpName %s2DArray "s2DArray" + OpName %c3D "c3D" + OpName %ic3D "ic3D" + OpName %ic1D "ic1D" + OpName %f "f" + OpName %s2DShadow "s2DShadow" + OpName %c1D "c1D" + OpName %sCube "sCube" + OpName %s2DArrayShadow "s2DArrayShadow" + OpName %iv "iv" + OpName %is2D "is2D" + OpName %is3D "is3D" + OpName %isCube "isCube" + OpName %is2DArray "is2DArray" + OpName %sCubeShadow "sCubeShadow" + OpName %us2D "us2D" + OpName %us3D "us3D" + OpName %usCube "usCube" + OpName %us2DArray "us2DArray" + OpName %ic4D "ic4D" + OpName %S2 "S2" + OpMemberName %S2 0 "c" + OpMemberName %S2 1 "f" + OpName %s2 "s2" + OpName %sc "sc" + OpName %sf "sf" + OpName %arrayedSampler "arrayedSampler" + OpDecorate %v RelaxedPrecision + OpDecorate %s2D RelaxedPrecision + OpDecorate %s2D DescriptorSet 0 + OpDecorate %s2D Binding 1 + OpDecorate %14 RelaxedPrecision + OpDecorate %c2D RelaxedPrecision + OpDecorate %c2D Location 5 + OpDecorate %18 RelaxedPrecision + OpDecorate %19 RelaxedPrecision + OpDecorate %s3D RelaxedPrecision + OpDecorate %s3D DescriptorSet 0 + OpDecorate %s3D Binding 2 + OpDecorate %24 RelaxedPrecision + OpDecorate %c4D RelaxedPrecision + OpDecorate %c4D Location 7 + OpDecorate %27 RelaxedPrecision + OpDecorate %28 RelaxedPrecision + OpDecorate %s2DArray RelaxedPrecision + OpDecorate %s2DArray DescriptorSet 0 + OpDecorate %s2DArray Binding 6 + OpDecorate %33 RelaxedPrecision + OpDecorate %c3D RelaxedPrecision + OpDecorate %c3D Location 6 + OpDecorate %37 RelaxedPrecision + OpDecorate %39 RelaxedPrecision + OpDecorate %40 RelaxedPrecision + OpDecorate %ic3D RelaxedPrecision + OpDecorate %ic3D Flat + OpDecorate %ic3D Location 2 + OpDecorate %45 RelaxedPrecision + OpDecorate %ic1D RelaxedPrecision + OpDecorate %ic1D Flat + OpDecorate %ic1D Location 1 + OpDecorate %48 RelaxedPrecision + OpDecorate %50 RelaxedPrecision + OpDecorate %f RelaxedPrecision + OpDecorate %s2DShadow RelaxedPrecision + OpDecorate %s2DShadow DescriptorSet 0 + OpDecorate %s2DShadow Binding 5 + OpDecorate %57 RelaxedPrecision + OpDecorate %58 RelaxedPrecision + OpDecorate %c1D RelaxedPrecision + OpDecorate %c1D Location 4 + OpDecorate %61 RelaxedPrecision + OpDecorate %67 RelaxedPrecision + OpDecorate %68 RelaxedPrecision + OpDecorate %69 RelaxedPrecision + OpDecorate %70 RelaxedPrecision + OpDecorate %71 RelaxedPrecision + OpDecorate %sCube RelaxedPrecision + OpDecorate %sCube DescriptorSet 0 + OpDecorate %sCube Binding 3 + OpDecorate %76 RelaxedPrecision + OpDecorate %77 RelaxedPrecision + OpDecorate %78 RelaxedPrecision + OpDecorate %79 RelaxedPrecision + OpDecorate %80 RelaxedPrecision + OpDecorate %s2DArrayShadow RelaxedPrecision + OpDecorate %s2DArrayShadow DescriptorSet 0 + OpDecorate %s2DArrayShadow Binding 7 + OpDecorate %85 RelaxedPrecision + OpDecorate %86 RelaxedPrecision + OpDecorate %87 RelaxedPrecision + OpDecorate %88 RelaxedPrecision + OpDecorate %90 RelaxedPrecision + OpDecorate %91 RelaxedPrecision + OpDecorate %92 RelaxedPrecision + OpDecorate %93 RelaxedPrecision + OpDecorate %94 RelaxedPrecision + OpDecorate %95 RelaxedPrecision + OpDecorate %96 RelaxedPrecision + OpDecorate %97 RelaxedPrecision + OpDecorate %98 RelaxedPrecision + OpDecorate %99 RelaxedPrecision + OpDecorate %100 RelaxedPrecision + OpDecorate %iv RelaxedPrecision + OpDecorate %is2D RelaxedPrecision + OpDecorate %is2D DescriptorSet 0 + OpDecorate %is2D Binding 8 + OpDecorate %108 RelaxedPrecision + OpDecorate %109 RelaxedPrecision + OpDecorate %110 RelaxedPrecision + OpDecorate %111 RelaxedPrecision + OpDecorate %112 RelaxedPrecision + OpDecorate %115 RelaxedPrecision + OpDecorate %116 RelaxedPrecision + OpDecorate %117 RelaxedPrecision + OpDecorate %118 RelaxedPrecision + OpDecorate %119 RelaxedPrecision + OpDecorate %120 RelaxedPrecision + OpDecorate %121 RelaxedPrecision + OpDecorate %122 RelaxedPrecision + OpDecorate %123 RelaxedPrecision + OpDecorate %124 RelaxedPrecision + OpDecorate %is3D RelaxedPrecision + OpDecorate %is3D DescriptorSet 0 + OpDecorate %is3D Binding 9 + OpDecorate %129 RelaxedPrecision + OpDecorate %130 RelaxedPrecision + OpDecorate %132 RelaxedPrecision + OpDecorate %isCube RelaxedPrecision + OpDecorate %isCube DescriptorSet 0 + OpDecorate %isCube Binding 10 + OpDecorate %137 RelaxedPrecision + OpDecorate %138 RelaxedPrecision + OpDecorate %139 RelaxedPrecision + OpDecorate %140 RelaxedPrecision + OpDecorate %is2DArray RelaxedPrecision + OpDecorate %is2DArray DescriptorSet 0 + OpDecorate %is2DArray Binding 11 + OpDecorate %145 RelaxedPrecision + OpDecorate %146 RelaxedPrecision + OpDecorate %147 RelaxedPrecision + OpDecorate %149 RelaxedPrecision + OpDecorate %sCubeShadow RelaxedPrecision + OpDecorate %sCubeShadow DescriptorSet 0 + OpDecorate %sCubeShadow Binding 4 + OpDecorate %154 RelaxedPrecision + OpDecorate %us2D RelaxedPrecision + OpDecorate %us2D DescriptorSet 0 + OpDecorate %us2D Binding 12 + OpDecorate %us3D RelaxedPrecision + OpDecorate %us3D DescriptorSet 0 + OpDecorate %us3D Binding 13 + OpDecorate %usCube RelaxedPrecision + OpDecorate %usCube DescriptorSet 0 + OpDecorate %usCube Binding 14 + OpDecorate %us2DArray RelaxedPrecision + OpDecorate %us2DArray DescriptorSet 0 + OpDecorate %us2DArray Binding 15 + OpDecorate %ic4D RelaxedPrecision + OpDecorate %ic4D Flat + OpDecorate %ic4D Location 3 + OpDecorate %65 RelaxedPrecision + OpMemberDecorate %S2 0 RelaxedPrecision + OpMemberDecorate %S2 1 RelaxedPrecision + OpDecorate %s2 Location 8 + OpDecorate %sc RelaxedPrecision + OpDecorate %sc Location 0 + OpDecorate %sf RelaxedPrecision + OpDecorate %sf Location 1 + OpDecorate %arrayedSampler RelaxedPrecision + OpDecorate %arrayedSampler DescriptorSet 0 + OpDecorate %arrayedSampler Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %10 = OpTypeImage %float 2D 0 0 0 1 Unknown + %11 = OpTypeSampledImage %10 +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %s2D = OpVariable %_ptr_UniformConstant_11 UniformConstant + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float + %c2D = OpVariable %_ptr_Input_v2float Input + %20 = OpTypeImage %float 3D 0 0 0 1 Unknown + %21 = OpTypeSampledImage %20 +%_ptr_UniformConstant_21 = OpTypePointer UniformConstant %21 + %s3D = OpVariable %_ptr_UniformConstant_21 UniformConstant +%_ptr_Input_v4float = OpTypePointer Input %v4float + %c4D = OpVariable %_ptr_Input_v4float Input + %29 = OpTypeImage %float 2D 0 1 0 1 Unknown + %30 = OpTypeSampledImage %29 +%_ptr_UniformConstant_30 = OpTypePointer UniformConstant %30 + %s2DArray = OpVariable %_ptr_UniformConstant_30 UniformConstant + %v3float = OpTypeVector %float 3 +%_ptr_Input_v3float = OpTypePointer Input %v3float + %c3D = OpVariable %_ptr_Input_v3float Input +%float_1_20000005 = OpConstant %float 1.20000005 + %int = OpTypeInt 32 1 + %v3int = OpTypeVector %int 3 +%_ptr_Input_v3int = OpTypePointer Input %v3int + %ic3D = OpVariable %_ptr_Input_v3int Input +%_ptr_Input_int = OpTypePointer Input %int + %ic1D = OpVariable %_ptr_Input_int Input +%_ptr_Function_float = OpTypePointer Function %float + %53 = OpTypeImage %float 2D 1 0 0 1 Unknown + %54 = OpTypeSampledImage %53 +%_ptr_UniformConstant_54 = OpTypePointer UniformConstant %54 + %s2DShadow = OpVariable %_ptr_UniformConstant_54 UniformConstant +%_ptr_Input_float = OpTypePointer Input %float + %c1D = OpVariable %_ptr_Input_float Input + %v2int = OpTypeVector %int 2 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %65 = OpConstantComposite %v2int %int_2 %int_3 + %72 = OpTypeImage %float Cube 0 0 0 1 Unknown + %73 = OpTypeSampledImage %72 +%_ptr_UniformConstant_73 = OpTypePointer UniformConstant %73 + %sCube = OpVariable %_ptr_UniformConstant_73 UniformConstant + %81 = OpTypeImage %float 2D 1 1 0 1 Unknown + %82 = OpTypeSampledImage %81 +%_ptr_UniformConstant_82 = OpTypePointer UniformConstant %82 +%s2DArrayShadow = OpVariable %_ptr_UniformConstant_82 UniformConstant + %v4int = OpTypeVector %int 4 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %104 = OpTypeImage %int 2D 0 0 0 1 Unknown + %105 = OpTypeSampledImage %104 +%_ptr_UniformConstant_105 = OpTypePointer UniformConstant %105 + %is2D = OpVariable %_ptr_UniformConstant_105 UniformConstant + %125 = OpTypeImage %int 3D 0 0 0 1 Unknown + %126 = OpTypeSampledImage %125 +%_ptr_UniformConstant_126 = OpTypePointer UniformConstant %126 + %is3D = OpVariable %_ptr_UniformConstant_126 UniformConstant +%float_4_19999981 = OpConstant %float 4.19999981 + %133 = OpTypeImage %int Cube 0 0 0 1 Unknown + %134 = OpTypeSampledImage %133 +%_ptr_UniformConstant_134 = OpTypePointer UniformConstant %134 + %isCube = OpVariable %_ptr_UniformConstant_134 UniformConstant + %141 = OpTypeImage %int 2D 0 1 0 1 Unknown + %142 = OpTypeSampledImage %141 +%_ptr_UniformConstant_142 = OpTypePointer UniformConstant %142 + %is2DArray = OpVariable %_ptr_UniformConstant_142 UniformConstant + %150 = OpTypeImage %float Cube 1 0 0 1 Unknown + %151 = OpTypeSampledImage %150 +%_ptr_UniformConstant_151 = OpTypePointer UniformConstant %151 +%sCubeShadow = OpVariable %_ptr_UniformConstant_151 UniformConstant + %uint = OpTypeInt 32 0 + %160 = OpTypeImage %uint 2D 0 0 0 1 Unknown + %161 = OpTypeSampledImage %160 +%_ptr_UniformConstant_161 = OpTypePointer UniformConstant %161 + %us2D = OpVariable %_ptr_UniformConstant_161 UniformConstant + %164 = OpTypeImage %uint 3D 0 0 0 1 Unknown + %165 = OpTypeSampledImage %164 +%_ptr_UniformConstant_165 = OpTypePointer UniformConstant %165 + %us3D = OpVariable %_ptr_UniformConstant_165 UniformConstant + %168 = OpTypeImage %uint Cube 0 0 0 1 Unknown + %169 = OpTypeSampledImage %168 +%_ptr_UniformConstant_169 = OpTypePointer UniformConstant %169 + %usCube = OpVariable %_ptr_UniformConstant_169 UniformConstant + %172 = OpTypeImage %uint 2D 0 1 0 1 Unknown + %173 = OpTypeSampledImage %172 +%_ptr_UniformConstant_173 = OpTypePointer UniformConstant %173 + %us2DArray = OpVariable %_ptr_UniformConstant_173 UniformConstant +%_ptr_Input_v4int = OpTypePointer Input %v4int + %ic4D = OpVariable %_ptr_Input_v4int Input + %S2 = OpTypeStruct %v3float %float +%_ptr_Input_S2 = OpTypePointer Input %S2 + %s2 = OpVariable %_ptr_Input_S2 Input +%_ptr_Output_v3float = OpTypePointer Output %v3float + %sc = OpVariable %_ptr_Output_v3float Output +%_ptr_Output_float = OpTypePointer Output %float + %sf = OpVariable %_ptr_Output_float Output + %uint_5 = OpConstant %uint 5 +%_arr_11_uint_5 = OpTypeArray %11 %uint_5 +%_ptr_UniformConstant__arr_11_uint_5 = OpTypePointer UniformConstant %_arr_11_uint_5 +%arrayedSampler = OpVariable %_ptr_UniformConstant__arr_11_uint_5 UniformConstant + %main = OpFunction %void None %3 + %5 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function + %f = OpVariable %_ptr_Function_float Function + %iv = OpVariable %_ptr_Function_v4int Function + %14 = OpLoad %11 %s2D + %18 = OpLoad %v2float %c2D + %19 = OpImageSampleImplicitLod %v4float %14 %18 + OpStore %v %19 + %24 = OpLoad %21 %s3D + %27 = OpLoad %v4float %c4D + %28 = OpImageSampleProjImplicitLod %v4float %24 %27 + OpStore %v %28 + %33 = OpLoad %30 %s2DArray + %37 = OpLoad %v3float %c3D + %39 = OpImageSampleExplicitLod %v4float %33 %37 Lod %float_1_20000005 + OpStore %v %39 + %40 = OpLoad %21 %s3D + %45 = OpLoad %v3int %ic3D + %48 = OpLoad %int %ic1D + %49 = OpImage %20 %40 + %50 = OpImageFetch %v4float %49 %45 Lod %48 + OpStore %v %50 + %57 = OpLoad %54 %s2DShadow + %58 = OpLoad %v3float %c3D + %61 = OpLoad %float %c1D + %66 = OpCompositeExtract %float %58 2 + %67 = OpImageSampleDrefExplicitLod %float %57 %58 %66 Lod|ConstOffset %61 %65 + OpStore %f %67 + %68 = OpLoad %11 %s2D + %69 = OpLoad %v3float %c3D + %70 = OpLoad %float %c1D + %71 = OpImageSampleProjExplicitLod %v4float %68 %69 Lod|ConstOffset %70 %65 + OpStore %v %71 + %76 = OpLoad %73 %sCube + %77 = OpLoad %v3float %c3D + %78 = OpLoad %v3float %c3D + %79 = OpLoad %v3float %c3D + %80 = OpImageSampleExplicitLod %v4float %76 %77 Grad %78 %79 + OpStore %v %80 + %85 = OpLoad %82 %s2DArrayShadow + %86 = OpLoad %v4float %c4D + %87 = OpLoad %v2float %c2D + %88 = OpLoad %v2float %c2D + %89 = OpCompositeExtract %float %86 3 + %90 = OpImageSampleDrefExplicitLod %float %85 %86 %89 Grad|ConstOffset %87 %88 %65 + OpStore %f %90 + %91 = OpLoad %21 %s3D + %92 = OpLoad %v4float %c4D + %93 = OpLoad %v3float %c3D + %94 = OpLoad %v3float %c3D + %95 = OpImageSampleProjExplicitLod %v4float %91 %92 Grad %93 %94 + OpStore %v %95 + %96 = OpLoad %11 %s2D + %97 = OpLoad %v3float %c3D + %98 = OpLoad %v2float %c2D + %99 = OpLoad %v2float %c2D + %100 = OpImageSampleProjExplicitLod %v4float %96 %97 Grad|ConstOffset %98 %99 %65 + OpStore %v %100 + %108 = OpLoad %105 %is2D + %109 = OpLoad %v2float %c2D + %110 = OpImageSampleImplicitLod %v4int %108 %109 + OpStore %iv %110 + %111 = OpLoad %105 %is2D + %112 = OpLoad %v4float %c4D + %113 = OpCompositeExtract %float %112 3 + %114 = OpCompositeInsert %v4float %113 %112 2 + %115 = OpImageSampleProjImplicitLod %v4int %111 %114 ConstOffset %65 + OpStore %iv %115 + %116 = OpLoad %105 %is2D + %117 = OpLoad %v3float %c3D + %118 = OpLoad %float %c1D + %119 = OpImageSampleProjExplicitLod %v4int %116 %117 Lod %118 + OpStore %iv %119 + %120 = OpLoad %105 %is2D + %121 = OpLoad %v3float %c3D + %122 = OpLoad %v2float %c2D + %123 = OpLoad %v2float %c2D + %124 = OpImageSampleProjExplicitLod %v4int %120 %121 Grad %122 %123 + OpStore %iv %124 + %129 = OpLoad %126 %is3D + %130 = OpLoad %v3float %c3D + %132 = OpImageSampleImplicitLod %v4int %129 %130 Bias %float_4_19999981 + OpStore %iv %132 + %137 = OpLoad %134 %isCube + %138 = OpLoad %v3float %c3D + %139 = OpLoad %float %c1D + %140 = OpImageSampleExplicitLod %v4int %137 %138 Lod %139 + OpStore %iv %140 + %145 = OpLoad %142 %is2DArray + %146 = OpLoad %v3int %ic3D + %147 = OpLoad %int %ic1D + %148 = OpImage %141 %145 + %149 = OpImageFetch %v4int %148 %146 Lod %147 + OpStore %iv %149 + %154 = OpLoad %151 %sCubeShadow + %155 = OpImage %150 %154 + %156 = OpImageQuerySizeLod %v2int %155 %int_2 + %157 = OpLoad %v4int %iv + %158 = OpVectorShuffle %v4int %157 %156 4 5 2 3 + OpStore %iv %158 + OpReturn + OpFunctionEnd diff --git a/Test/link1.vk.frag b/Test/link1.vk.frag index 167e78ee..c860f647 100644 --- a/Test/link1.vk.frag +++ b/Test/link1.vk.frag @@ -10,8 +10,8 @@ int b[5]; int c[]; int i; -buffer bnameRuntime { float r[]; }; -buffer bnameImplicit { float m[]; }; +layout (binding = 0) buffer bnameRuntime { float r[]; }; +layout (binding = 1) buffer bnameImplicit { float m[]; }; void main() { diff --git a/Test/link2.vk.frag b/Test/link2.vk.frag index b80402ca..b83f8694 100644 --- a/Test/link2.vk.frag +++ b/Test/link2.vk.frag @@ -8,8 +8,8 @@ int b[]; int c[7]; int i; -buffer bnameRuntime { float r[]; }; -buffer bnameImplicit { float m[4]; }; +layout (binding = 0) buffer bnameRuntime { float r[]; }; +layout (binding = 1) buffer bnameImplicit { float m[4]; }; vec4 getColor() { diff --git a/Test/reflection.options.vert b/Test/reflection.options.vert index e97c9108..b88f8542 100644 --- a/Test/reflection.options.vert +++ b/Test/reflection.options.vert @@ -20,6 +20,11 @@ buffer MultipleArrays { float f[5]; } multiarray; +buffer ArrayedBind { + float a; + float b; +} buffers[3]; + uniform UBO { VertexInfo verts[2]; float flt[8]; @@ -52,6 +57,7 @@ void main() f += ubo.flt[gl_InstanceID]; f += ubo.uniform_multi[0][0][0]; f += uniform_multi[gl_InstanceID][gl_InstanceID][gl_InstanceID]; + f += buffers[gl_InstanceID].b; TriangleInfo tlocal[5] = t; outval.val = f; outarr[2] = f; diff --git a/Test/runtests b/Test/runtests index c50f1482..8e31c069 100755 --- a/Test/runtests +++ b/Test/runtests @@ -55,8 +55,8 @@ diff -b $BASEDIR/hlsl.automap.frag.out $TARGETDIR/hlsl.automap.frag.out || HASER # multi-threaded test # echo Comparing single thread to multithread for all tests in current directory... -$EXE -i -C *.vert *.geom *.frag *.tes* *.comp > singleThread.out -$EXE -i -C *.vert *.geom *.frag *.tes* *.comp -t > multiThread.out +$EXE -i -C *.vert *.geom *.frag *.tesc *.tese *.comp > singleThread.out +$EXE -i -C *.vert *.geom *.frag *.tesc *.tese *.comp -t > multiThread.out diff singleThread.out multiThread.out || HASERROR=1 if [ $HASERROR -eq 0 ] then @@ -145,7 +145,7 @@ echo Testing SPV Debug Information $EXE -g --relaxed-errors --suppress-warnings --aml --amb --hlsl-offsets --nsf --spirv-val \ -G -H spv.debugInfo.frag --rsb frag 3 > $TARGETDIR/spv.debugInfo.frag.out diff -b $BASEDIR/spv.debugInfo.frag.out $TARGETDIR/spv.debugInfo.frag.out || HASERROR=1 -$EXE -g -Od --target-env vulkan1.1 --relaxed-errors --suppress-warnings --aml --hlsl-offsets --nsf --spirv-val \ +$EXE -g -Od --target-env vulkan1.1 --relaxed-errors --suppress-warnings --aml --amb --hlsl-offsets --nsf --spirv-val \ -G -H spv.debugInfo.frag --rsb frag 3 > $TARGETDIR/spv.debugInfo.1.1.frag.out diff -b $BASEDIR/spv.debugInfo.1.1.frag.out $TARGETDIR/spv.debugInfo.1.1.frag.out || HASERROR=1 $EXE -g -D -Od -e newMain -g --amb --aml --fua --hlsl-iomap --nsf --spirv-val --sib 1 --ssb 2 --sbb 3 --stb 4 --suavb 5 --sub 6 \ diff --git a/Test/spv.1.4.constructComposite.comp b/Test/spv.1.4.constructComposite.comp new file mode 100644 index 00000000..7f1c3707 --- /dev/null +++ b/Test/spv.1.4.constructComposite.comp @@ -0,0 +1,25 @@ +#version 460 core + +layout(local_size_x=64) in; + +struct sA { + int x, y; +}; + +struct sB { + sA a; +}; + +layout(binding=0,set=0) uniform ubo { + sB b; +}; + +struct sC { + sA state; +} c = { + b.a, +}; + +void main() +{ +} diff --git a/Test/spv.constructComposite.comp b/Test/spv.constructComposite.comp new file mode 100644 index 00000000..7f1c3707 --- /dev/null +++ b/Test/spv.constructComposite.comp @@ -0,0 +1,25 @@ +#version 460 core + +layout(local_size_x=64) in; + +struct sA { + int x, y; +}; + +struct sB { + sA a; +}; + +layout(binding=0,set=0) uniform ubo { + sB b; +}; + +struct sC { + sA state; +} c = { + b.a, +}; + +void main() +{ +} diff --git a/Test/spv.hlslOffsets.vert b/Test/spv.hlslOffsets.vert index 87e32a72..26950d93 100644 --- a/Test/spv.hlslOffsets.vert +++ b/Test/spv.hlslOffsets.vert @@ -1,6 +1,6 @@ #version 450 -buffer block { +layout(binding = 0) buffer block { float m0; vec3 m4; ////// diff --git a/Test/spv.intcoopmat.comp b/Test/spv.intcoopmat.comp new file mode 100644 index 00000000..235aa16b --- /dev/null +++ b/Test/spv.intcoopmat.comp @@ -0,0 +1,117 @@ +#version 450 core +#extension GL_KHR_memory_scope_semantics : enable +#extension GL_NV_cooperative_matrix : enable +#extension GL_NV_integer_cooperative_matrix : enable +#extension GL_EXT_shader_explicit_arithmetic_types : enable +#extension GL_EXT_buffer_reference : enable + +layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in; + +const int X = 8; +layout(constant_id = 0) const int Y = 2; +const int Z = X*Y; + +icoopmatNV<8, gl_ScopeSubgroup, Z, 8> miC; +icoopmatNV<8, gl_ScopeSubgroup, Z, 8> miC2[3]; +ucoopmatNV<8, gl_ScopeSubgroup, Z, 8> muC; +ucoopmatNV<8, gl_ScopeSubgroup, Z, 8> muC2[3]; + +int iarr[miC.length()]; +int iarr2[miC2[1].length()]; +int uarr[muC.length()]; +int uarr2[muC2[1].length()]; + +const icoopmatNV<32, gl_ScopeSubgroup, Z, 8> mD = icoopmatNV<32, gl_ScopeSubgroup, Z, 8>(1); +const ucoopmatNV<8, gl_ScopeSubgroup, 8, 8> mD2 = ucoopmatNV<8, gl_ScopeSubgroup, 8, 8>(1); + +struct S { int a; int b; int c; }; + +const S s = S(12, 23, 34); + +layout(set = 0, binding = 0, buffer_reference) coherent buffer Block { + uint y[1024*1024]; + uint x[]; +} block; + +layout(set = 0, binding = 0) coherent buffer Block16 { + int8_t y[1024*1024]; + int8_t x[]; + + Block b; +} block8; + +icoopmatNV<8, gl_ScopeSubgroup, 8, 8> ineg(icoopmatNV<8, gl_ScopeSubgroup, 8, 8> m) { return -m; } +ucoopmatNV<8, gl_ScopeSubgroup, 8, 8> umul(ucoopmatNV<8, gl_ScopeSubgroup, 8, 8> m) { return m * uint8_t(2); } + +layout(constant_id = 2) const int SC = 1; +ucoopmatNV<32, gl_ScopeSubgroup, SC, SC> scm[SC][SC]; + +// sized for icoopmatNV<8, gl_ScopeSubgroup, 16, 16> +shared uvec4 shmatrix[16*16*2/16]; + +void main() +{ + ucoopmatNV<8, gl_ScopeSubgroup, 16, (2>1?8:4)> mu = ucoopmatNV<8, gl_ScopeSubgroup, 16, (2>1?8:4)>(2); + icoopmatNV<8, gl_ScopeSubgroup, 16, (2>1?8:4)> mi = icoopmatNV<8, gl_ScopeSubgroup, 16, (2>1?8:4)>(2); + + mu = mu + mu; + mu = mu - mu; + mi = -mi; + mi = mi * int8_t(2); + + fcoopmatNV<16, gl_ScopeSubgroup, 16, 8> mf16_0 = fcoopmatNV<16, gl_ScopeSubgroup, 16, 8>(mu); + fcoopmatNV<32, gl_ScopeSubgroup, 16, 8> mf32_0 = fcoopmatNV<32, gl_ScopeSubgroup, 16, 8>(mu); + fcoopmatNV<16, gl_ScopeSubgroup, 16, 8> mf16_1 = fcoopmatNV<16, gl_ScopeSubgroup, 16, 8>(mi); + fcoopmatNV<32, gl_ScopeSubgroup, 16, 8> mf32_1 = fcoopmatNV<32, gl_ScopeSubgroup, 16, 8>(mi); + + uint8_t x = mu[1]; + mi[0] = int8_t(x); + + coopMatLoadNV(mi, block.x, 16, 128, false); + coopMatStoreNV(mi, block.x, 16, 128, false); + coopMatLoadNV(mu, block8.x, 16, 128, false); + coopMatStoreNV(mu, block8.x, 16, 128, false); + coopMatLoadNV(mi, block8.b.x, 16, 128, false); + coopMatStoreNV(mi, block8.b.x, 16, 128, false); + + ucoopmatNV<8, gl_ScopeSubgroup, 16, 8> A; + ucoopmatNV<8, gl_ScopeSubgroup, 8, 8> B; + ucoopmatNV<8, gl_ScopeSubgroup, 16, 8> C; + ucoopmatNV<8, gl_ScopeSubgroup, 16, 8> D; + D = coopMatMulAddNV(A, B, C); + + int l = D.length(); + + + icoopmatNV<8, gl_ScopeSubgroup, 16, (2>1?8:4)> a[5]; + a[3][0] = int8_t(1); + + int md1 = mD[1]; + + md1 += (mi += mi)[1234]; + + muC2[0] = muC2[1]; + muC2[1][0] = (miC2[2][0]); + + coopMatLoadNV(mi, block.y, 16, 128, false); + coopMatStoreNV(mi, block.y, 16, 128, false); + coopMatLoadNV(mu, block8.y, 16, 128, false); + coopMatStoreNV(mu, block8.y, 16, 128, false); + + icoopmatNV<8, gl_ScopeSubgroup, 8, 8> p1; + ucoopmatNV<8, gl_ScopeSubgroup, 8, 8> p2; + + p1 = ineg(p1); + p2 = umul(p2); + + p1 /= p1; + p2 /= p2; + + p1 *= int8_t(2); + p2 *= uint8_t(4); + + icoopmatNV<8, gl_ScopeSubgroup, 16, 8> ms; + coopMatLoadNV(ms, shmatrix, 1, 2, false); + coopMatStoreNV(ms, shmatrix, 1, 2, false); + +} diff --git a/Test/vulkan.vert b/Test/vulkan.vert index 99456b9f..7142691a 100644 --- a/Test/vulkan.vert +++ b/Test/vulkan.vert @@ -21,8 +21,8 @@ void main() } layout(binding = 0) uniform atomic_uint aui; // ERROR, no atomics in Vulkan -layout(shared) uniform ub1n { int a; } ub1i; // ERROR, no shared -layout(packed) uniform ub2n { int a; } ub2i; // ERROR, no packed +layout(shared, binding = 1) uniform ub1n { int a; } ub1i; // ERROR, no shared +layout(packed, binding = 2) uniform ub2n { int a; } ub2i; // ERROR, no packed layout(constant_id=222) const int arraySize = 4; diff --git a/Test/web.array.frag b/Test/web.array.frag new file mode 100644 index 00000000..8b8acdf5 --- /dev/null +++ b/Test/web.array.frag @@ -0,0 +1,26 @@ +#version 310 es + +precision highp float; + +float g4[4]; +float g5[5]; + +layout(location = 0) out vec2 colorOut; + +float[4] foo(float a[5]) +{ + return float[](a[0], a[1], a[2], a[3]); +} + +void main() +{ + g4 = foo(g5); + + if (float[4](1.0, 2.0, 3.0, 4.0) == g4) + ; + + float u[5]; + foo(u); + + colorOut = vec2(g4.length(), g5.length()); +} diff --git a/Test/web.basic.vert b/Test/web.basic.vert new file mode 100644 index 00000000..9bc4c30f --- /dev/null +++ b/Test/web.basic.vert @@ -0,0 +1,15 @@ +#version 310 es + +layout(location = 2) in vec4 inv4; +layout(location = 1) out vec4 outv4; + +layout(binding = 3) uniform uBlock { + vec4 a; + ivec4 b; + uvec4 c; +} uInst; + +void main() +{ + outv4 = normalize(inv4) * uInst.a * vec4(uInst.b) * vec4(uInst.c); +} diff --git a/Test/web.builtins.frag b/Test/web.builtins.frag new file mode 100644 index 00000000..5ede9a91 --- /dev/null +++ b/Test/web.builtins.frag @@ -0,0 +1,58 @@ +#version 310 es + +precision lowp float; +layout(location = 4) in float c1D; +layout(location = 5) in vec2 c2D; +layout(location = 6) in vec3 c3D; +layout(location = 7) in smooth vec4 c4D; + +layout(location = 1) flat in int ic1D; +layout(location = 2) flat in ivec3 ic3D; +layout(location = 3) flat in ivec4 ic4D; + +const ivec2 ic2D = ivec2(2, 3); + +struct s { + int i; + sampler2D s; +}; + +struct S2 { + vec3 c; + float f; +}; + +layout(location = 8) in S2 s2; + +layout(location = 0) out vec3 sc; +layout(location = 1) out float sf; + +void main() +{ + float f = gl_FragCoord.y; + gl_FragDepth = f; + + sc = s2.c; + sf = s2.f; + + sinh(c1D) + + cosh(c1D) * tanh(c2D); + asinh(c4D) + acosh(c4D); + atanh(c3D); +} + +void foo324(void) +{ + float p = pow(3.2, 4.6); + p += sin(0.4); + p += distance(vec2(10.0, 11.0), vec2(13.0, 15.0)); // 5 + p += dot(vec3(2,3,5), vec3(-2,-1,4)); // 13 + vec3 c3 = cross(vec3(3,-3,1), vec3(4,9,2)); // (-15, -2, 39) + c3 += faceforward(vec3(1,2,3), vec3(2,3,5), vec3(-2,-1,4)); // (-1,-2,-3) + c3 += faceforward(vec3(1,2,3), vec3(-2,-3,-5), vec3(-2,-1,4)); // (1,2,3) + vec2 c2 = reflect(vec2(1,3), vec2(0,1)); // (1,-3) + c2 += refract(vec2(1,3), vec2(0,1), 1.0); // (1,-3) + c2 += refract(vec2(1,3), vec2(0,1), 3.0); + c2 += refract(vec2(1,0.1), vec2(0,1), 5.0); // (0,0) + mat3x2 m32 = outerProduct(vec2(2,3), vec3(5,7,11));// rows: (10, 14, 22), (15, 21, 33) +} diff --git a/Test/web.builtins.vert b/Test/web.builtins.vert new file mode 100644 index 00000000..f27b12b2 --- /dev/null +++ b/Test/web.builtins.vert @@ -0,0 +1,14 @@ +#version 310 es + +layout(location = 0) in mediump float ps; + +invariant gl_Position; + +void main() +{ + gl_Position = vec4(ps); + gl_Position *= float(4 - gl_VertexIndex); + + gl_PointSize = ps; + gl_PointSize *= float(5 - gl_InstanceIndex); +} diff --git a/Test/web.controlFlow.frag b/Test/web.controlFlow.frag new file mode 100644 index 00000000..89f7e68d --- /dev/null +++ b/Test/web.controlFlow.frag @@ -0,0 +1,91 @@ +#version 310 es + +precision mediump float; +precision highp int; + +int c, d; +layout(location = 0) in highp float x; +layout(location = 1) in vec4 bigColor; +layout(location = 2) in vec4 BaseColor; +layout(location = 3) in float f; + +layout(location = 4) flat in int Count; +layout(location = 5) flat in uvec4 v4; + +layout(location = 0) out vec4 outColor; + +void main() +{ + float f; + int a[2]; + + switch(c) + { + } + + switch (c) { // a no-error normal switch + case 1: + f = sin(x); + break; + case 2: + switch (d) { + case 1: + f = x * x * x; + break; + case 2: + f = x * x; + break; + } + break; + default: + f = tan(x); + } + + vec4 color = BaseColor; + + for (int i = 0; i < Count; ++i) { + color += bigColor; + } + + outColor = color; + + float sum = 0.0; + for (int i = 0; i < 4; ++i) + sum += float(v4[i]); + + vec4 tv4; + + for (int i = 0; i < 4; ++i) + tv4[i] = float(v4[i] * 4u); + + outColor += vec4(sum) + tv4; + + vec4 r; + r.xyz = BaseColor.xyz; + + for (int i = 0; i < Count; ++i) + r.w = f; + + outColor.xyz += r.xyz; + + for (int i = 0; i < 16; i += 4) + outColor *= f; + + int i = 0; + int A, B, C, D; + while (i<10) { + A = 1; + if (i%2 == 0) { + B = 2; + continue; + C = 2; + } + if (i%5 == 0) { + B = 2; + break; + C = 2; + } + i++; + } + D = 3; +} diff --git a/Test/web.operations.frag b/Test/web.operations.frag new file mode 100644 index 00000000..589ae6fd --- /dev/null +++ b/Test/web.operations.frag @@ -0,0 +1,73 @@ +#version 310 es + +precision highp float; + +layout(binding = 0) uniform block { + mediump float f; +} instanceName; + +struct S { + int i; +} s; + +float a[5]; + +void main() +{ + bool b; + float f; + int i; + uint u; + bvec3 b3; + vec3 v3; + ivec3 iv3; + uvec3 uv3; + vec4 v4; + ivec4 iv4; + uvec4 uv4; + mat2 m2; + mat4 m4; + + f * v4; + u + u; + uv4 / u; + iv3 -= iv3; + + i %= 3; + uv3 % 4u; + --m2; + iv4++; + + m4 != m4; + m2 == m2; + i <= i; + a == a; + s != s; + + b && b; + b || b; + b ^^ b; + + !b, uv3; + + ~i; + ~u; + ~uv3; + ~iv3; + + uv3 <<= i; + i >> i; + u << u; + iv3 >> iv3; + + i & i; + u | u; + iv3 ^ iv3; + u & uv3; + uv3 | u; + uv3 &= u; + int arr[0x222 & 0xf]; + arr[1]; // size 2 + int arr2[(uvec2(0, 0x2) | 0x1u).y]; + arr2[2]; // size 3 +} diff --git a/Test/web.runtests b/Test/web.runtests new file mode 100755 index 00000000..3283dd83 --- /dev/null +++ b/Test/web.runtests @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +TESTLIST=web.testlist +TARGETDIR=localResults +BASEDIR=baseResults +EXE=../build/install/bin/glslangValidator.exe +HASERROR=0 +mkdir -p $TARGETDIR + +if [ -a $TESTLIST ] + then + while read t; do + echo Running $t... + b=`basename $t` + $EXE -V -o webtest.spv $t + spirv-dis webtest.spv > $TARGETDIR/$b.out + rm -f webtest.spv + diff -b $BASEDIR/$b.out $TARGETDIR/$b.out || HASERROR=1 + done < $TESTLIST +else + echo $TESTLIST is missing +fi + +wc --bytes $EXE > $TARGETDIR/size +echo "base size was" `cat $BASEDIR/size` +echo "new size is" `cat $TARGETDIR/size` + +# +# Final checking +# +if [ $HASERROR -eq 0 ] +then + echo Tests Succeeded. +else + echo Tests Failed. +fi + +exit $HASERROR diff --git a/Test/web.testlist b/Test/web.testlist new file mode 100644 index 00000000..fba92127 --- /dev/null +++ b/Test/web.testlist @@ -0,0 +1,7 @@ +web.builtins.vert +web.builtins.frag +web.basic.vert +web.controlFlow.frag +web.operations.frag +web.texture.frag +web.array.frag diff --git a/Test/web.texture.frag b/Test/web.texture.frag new file mode 100644 index 00000000..5bfd9620 --- /dev/null +++ b/Test/web.texture.frag @@ -0,0 +1,77 @@ +#version 310 es +layout(binding = 1) uniform sampler2D s2D; +layout(binding = 2) uniform lowp sampler3D s3D; +layout(binding = 3) uniform samplerCube sCube; +layout(binding = 4) uniform lowp samplerCubeShadow sCubeShadow; +layout(binding = 5) uniform lowp sampler2DShadow s2DShadow; +layout(binding = 6) uniform lowp sampler2DArray s2DArray; +layout(binding = 7) uniform lowp sampler2DArrayShadow s2DArrayShadow; +layout(binding = 8) uniform lowp isampler2D is2D; +layout(binding = 9) uniform lowp isampler3D is3D; +layout(binding = 10) uniform lowp isamplerCube isCube; +layout(binding = 11) uniform lowp isampler2DArray is2DArray; +layout(binding = 12) uniform lowp usampler2D us2D; +layout(binding = 13) uniform lowp usampler3D us3D; +layout(binding = 14) uniform lowp usamplerCube usCube; +layout(binding = 15) uniform lowp usampler2DArray us2DArray; + +precision lowp float; +layout(location = 4) in float c1D; +layout(location = 5) in vec2 c2D; +layout(location = 6) in vec3 c3D; +layout(location = 7) in smooth vec4 c4D; + +layout(location = 1) flat in int ic1D; +layout(location = 2) flat in ivec3 ic3D; +layout(location = 3) flat in ivec4 ic4D; + +const ivec2 ic2D = ivec2(2, 3); + +struct s { + int i; + sampler2D s; +}; + +struct S2 { + vec3 c; + float f; +}; + +layout(location = 8) in S2 s2; + +layout(location = 0) out vec3 sc; +layout(location = 1) out float sf; + +layout(binding = 0) uniform sampler2D arrayedSampler[5]; + +void main() +{ + float f; + vec4 v; + v = texture(s2D, c2D); + v = textureProj(s3D, c4D); + v = textureLod(s2DArray, c3D, 1.2); + v = texelFetch(s3D, ic3D, ic1D); + f = textureLodOffset(s2DShadow, c3D, c1D, ic2D); + v = textureProjLodOffset(s2D, c3D, c1D, ic2D); + v = textureGrad(sCube, c3D, c3D, c3D); + f = textureGradOffset(s2DArrayShadow, c4D, c2D, c2D, ic2D); + v = textureProjGrad(s3D, c4D, c3D, c3D); + v = textureProjGradOffset(s2D, c3D, c2D, c2D, ic2D); + + ivec4 iv; + iv = texture(is2D, c2D); + iv = textureProjOffset(is2D, c4D, ic2D); + iv = textureProjLod(is2D, c3D, c1D); + iv = textureProjGrad(is2D, c3D, c2D, c2D); + iv = texture(is3D, c3D, 4.2); + iv = textureLod(isCube, c3D, c1D); + iv = texelFetch(is2DArray, ic3D, ic1D); + + iv.xy = textureSize(sCubeShadow, 2); +} + +void foo23() +{ + textureOffset(s2DShadow, c3D, ivec2(-8, 7), c1D); +} diff --git a/_config.yml b/_config.yml new file mode 100644 index 00000000..c50ff38d --- /dev/null +++ b/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-merlot \ No newline at end of file diff --git a/glslang/CMakeLists.txt b/glslang/CMakeLists.txt index 60169fb7..73124c56 100644 --- a/glslang/CMakeLists.txt +++ b/glslang/CMakeLists.txt @@ -7,6 +7,7 @@ else(WIN32) endif(WIN32) set(SOURCES + MachineIndependent/glslang.m4 MachineIndependent/glslang.y MachineIndependent/glslang_tab.cpp MachineIndependent/attribute.cpp @@ -71,15 +72,6 @@ set(HEADERS MachineIndependent/preprocessor/PpContext.h MachineIndependent/preprocessor/PpTokens.h) -# This might be useful for making grammar changes: -# -# find_package(BISON) -# add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/MachineIndependent/glslang_tab.cpp ${CMAKE_CURRENT_SOURCE_DIR}/MachineIndependent/glslang_tab.cpp.h -# COMMAND ${BISON_EXECUTABLE} --defines=${CMAKE_CURRENT_SOURCE_DIR}/MachineIndependent/glslang_tab.cpp.h -t ${CMAKE_CURRENT_SOURCE_DIR}/MachineIndependent/glslang.y -o ${CMAKE_CURRENT_SOURCE_DIR}/MachineIndependent/glslang_tab.cpp -# MAIN_DEPENDENCY MachineIndependent/glslang.y -# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) -# set(BISON_GLSLParser_OUTPUT_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/MachineIndependent/glslang_tab.cpp) - glslang_pch(SOURCES MachineIndependent/pch.cpp) add_library(glslang ${LIB_TYPE} ${BISON_GLSLParser_OUTPUT_SOURCE} ${SOURCES} ${HEADERS}) @@ -122,3 +114,16 @@ if(ENABLE_GLSLANG_INSTALL) install(FILES ${file} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/glslang/${dir}) endforeach() endif(ENABLE_GLSLANG_INSTALL) + +if(ENABLE_GLSLANG_WEB) + add_executable(glslang.js glslang.js.cpp) + glslang_set_link_args(glslang.js) + target_link_libraries(glslang.js glslang SPIRV) + if(EMSCRIPTEN) + set_target_properties(glslang.js PROPERTIES + OUTPUT_NAME "glslang" + SUFFIX ".js" + LINK_FLAGS "--bind -s EXPORT_NAME=\"glslangModule\"") + em_link_pre_js(glslang.js ${CMAKE_CURRENT_SOURCE_DIR}/glslang.pre.js) + endif(EMSCRIPTEN) +endif(ENABLE_GLSLANG_WEB) diff --git a/glslang/Include/BaseTypes.h b/glslang/Include/BaseTypes.h index 1a99e1bb..6d4b4ff8 100644 --- a/glslang/Include/BaseTypes.h +++ b/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, @@ -273,7 +264,6 @@ enum TBuiltInVariable { EbvLayerPerViewNV, EbvMeshViewCountNV, EbvMeshViewIndicesNV, -#endif // sm builtins EbvWarpsPerSM, @@ -299,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) { @@ -325,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"; } } @@ -413,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"; @@ -421,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"; @@ -429,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"; @@ -464,7 +462,6 @@ __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"; @@ -475,15 +472,6 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v) } } -// 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) { @@ -494,6 +482,7 @@ __inline const char* GetPrecisionQualifierString(TPrecisionQualifier p) default: return "unknown precision qualifier"; } } +#endif __inline bool isTypeSignedInt(TBasicType type) { @@ -538,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/glslang/Include/ConstantUnion.h b/glslang/Include/ConstantUnion.h index 3e933401..76b2d9c0 100644 --- a/glslang/Include/ConstantUnion.h +++ b/glslang/Include/ConstantUnion.h @@ -213,6 +213,28 @@ public: return false; switch (type) { + case EbtInt: + if (constant.iConst == iConst) + return true; + + break; + case EbtUint: + if (constant.uConst == uConst) + return true; + + break; + case EbtBool: + if (constant.bConst == bConst) + return true; + + break; + case EbtDouble: + if (constant.dConst == dConst) + return true; + + break; + +#ifndef GLSLANG_WEB case EbtInt16: if (constant.i16Const == i16Const) return true; @@ -232,16 +254,6 @@ public: if (constant.u8Const == u8Const) return true; - break; - case EbtInt: - if (constant.iConst == iConst) - return true; - - break; - case EbtUint: - if (constant.uConst == uConst) - return true; - break; case EbtInt64: if (constant.i64Const == i64Const) @@ -253,16 +265,7 @@ public: return true; break; - case EbtDouble: - if (constant.dConst == dConst) - return true; - - break; - case EbtBool: - if (constant.bConst == bConst) - 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; @@ -348,16 +367,6 @@ public: 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) @@ -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,10 +419,21 @@ 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"); @@ -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/glslang/Include/Types.h b/glslang/Include/Types.h index 989c34a7..3140006e 100644 --- a/glslang/Include/Types.h +++ b/glslang/Include/Types.h @@ -79,32 +79,64 @@ struct TSampler { // misnomer now; includes images, textures without sampler, bool ms : 1; 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 +#ifdef ENABLE_HLSL unsigned int vectorSize : 3; // vector return type size. + unsigned int getVectorSize() const { return vectorSize; } + void clearReturnStruct() { structReturnIndex = noReturnStruct; } + bool hasReturnStruct() const { return structReturnIndex != noReturnStruct; } + unsigned getStructReturnIndex() const { return structReturnIndex; } - // 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<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 @@ -1483,7 +1549,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'. @@ -1542,7 +1608,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; } @@ -1580,9 +1650,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; } @@ -1592,7 +1662,15 @@ public: virtual bool isSubpass() const { return basicType == EbtSampler && getSampler().isSubpass(); } virtual bool isTexture() const { return basicType == EbtSampler && getSampler().isTexture(); } 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 @@ -1673,20 +1751,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 @@ -1746,11 +1848,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) @@ -1808,16 +1908,17 @@ 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"; +#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"; @@ -1825,14 +1926,20 @@ public: 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; @@ -1921,7 +2028,6 @@ public: appendUint(1u << qualifier.layoutBufferReferenceAlign); } -#ifdef NV_EXTENSIONS if (qualifier.layoutPassthrough) appendStr(" passthrough"); if (qualifier.layoutViewportRelative) @@ -1932,7 +2038,6 @@ public: } if (qualifier.layoutShaderRecordNV) appendStr(" shaderRecordNV"); -#endif appendStr(")"); } @@ -1950,11 +2055,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) @@ -1963,7 +2065,6 @@ public: appendStr(" perviewNV"); if (qualifier.perTaskNV) appendStr(" taskNV"); -#endif if (qualifier.patch) appendStr(" patch"); if (qualifier.sample) @@ -2050,13 +2151,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("}"); @@ -2076,6 +2179,8 @@ 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 @@ -2142,12 +2247,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); @@ -2159,7 +2264,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); @@ -2194,7 +2299,7 @@ public: matrixCols == right.matrixCols && matrixRows == right.matrixRows && vector1 == right.vector1 && - coopmat == right.coopmat && + isCoopMat() == right.isCoopMat() && sameStructType(right) && sameReferenceType(right); } @@ -2203,10 +2308,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 { @@ -2220,12 +2339,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/glslang/Include/intermediate.h b/glslang/Include/intermediate.h index 212a09f2..3a7405ad 100644 --- a/glslang/Include/intermediate.h +++ b/glslang/Include/intermediate.h @@ -422,11 +422,9 @@ enum TOperator { EOpReflect, EOpRefract, -#ifdef AMD_EXTENSIONS EOpMin3, EOpMax3, EOpMid3, -#endif EOpDPdx, // Fragment only EOpDPdy, // Fragment only @@ -441,10 +439,7 @@ enum TOperator { EOpInterpolateAtCentroid, // Fragment only EOpInterpolateAtSample, // Fragment only EOpInterpolateAtOffset, // Fragment only - -#ifdef AMD_EXTENSIONS EOpInterpolateAtVertex, -#endif EOpMatrixTimesMatrix, EOpOuterProduct, @@ -534,7 +529,6 @@ enum TOperator { EOpSubgroupQuadSwapVertical, EOpSubgroupQuadSwapDiagonal, -#ifdef NV_EXTENSIONS EOpSubgroupPartition, EOpSubgroupPartitionedAdd, EOpSubgroupPartitionedMul, @@ -557,11 +551,9 @@ enum TOperator { EOpSubgroupPartitionedExclusiveAnd, EOpSubgroupPartitionedExclusiveOr, EOpSubgroupPartitionedExclusiveXor, -#endif EOpSubgroupGuardStop, -#ifdef AMD_EXTENSIONS EOpMinInvocations, EOpMaxInvocations, EOpAddInvocations, @@ -588,7 +580,6 @@ enum TOperator { EOpCubeFaceIndex, EOpCubeFaceCoord, EOpTime, -#endif EOpAtomicAdd, EOpAtomicMin, @@ -795,10 +786,8 @@ enum TOperator { EOpImageQuerySamples, EOpImageLoad, EOpImageStore, -#ifdef AMD_EXTENSIONS EOpImageLoadLod, EOpImageStoreLod, -#endif EOpImageAtomicAdd, EOpImageAtomicMin, EOpImageAtomicMax, @@ -813,9 +802,7 @@ enum TOperator { EOpSubpassLoad, EOpSubpassLoadMS, EOpSparseImageLoad, -#ifdef AMD_EXTENSIONS EOpSparseImageLoadLod, -#endif EOpImageGuardEnd, @@ -853,13 +840,11 @@ enum TOperator { EOpTextureOffsetClamp, EOpTextureGradClamp, EOpTextureGradOffsetClamp, -#ifdef AMD_EXTENSIONS EOpTextureGatherLod, EOpTextureGatherLodOffset, EOpTextureGatherLodOffsets, EOpFragmentMaskFetch, EOpFragmentFetch, -#endif EOpSparseTextureGuardBegin, @@ -879,15 +864,12 @@ enum TOperator { EOpSparseTextureOffsetClamp, EOpSparseTextureGradClamp, EOpSparseTextureGradOffsetClamp, -#ifdef AMD_EXTENSIONS EOpSparseTextureGatherLod, EOpSparseTextureGatherLodOffset, EOpSparseTextureGatherLodOffsets, -#endif EOpSparseTextureGuardEnd, -#ifdef NV_EXTENSIONS EOpImageFootprintGuardBegin, EOpImageSampleFootprintNV, EOpImageSampleFootprintClampNV, @@ -895,7 +877,6 @@ enum TOperator { EOpImageSampleFootprintGradNV, EOpImageSampleFootprintGradClampNV, EOpImageFootprintGuardEnd, -#endif EOpSamplingGuardEnd, EOpTextureGuardEnd, @@ -914,14 +895,12 @@ enum TOperator { EOpFindLSB, EOpFindMSB, -#ifdef NV_EXTENSIONS EOpTraceNV, EOpReportIntersectionNV, EOpIgnoreIntersectionNV, EOpTerminateRayNV, EOpExecuteCallableNV, EOpWritePackedPrimitiveIndices4x8NV, -#endif // // HLSL operations // @@ -1110,6 +1089,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: @@ -1303,9 +1284,7 @@ struct TCrackedTextureOp { bool grad; bool subpass; bool lodClamp; -#ifdef AMD_EXTENSIONS bool fragMask; -#endif }; // @@ -1321,12 +1300,17 @@ 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; } +#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; } +#endif void setOperationPrecision(TPrecisionQualifier p) { operationPrecision = p; } TPrecisionQualifier getOperationPrecision() const { return operationPrecision != EpqNone ? @@ -1356,9 +1340,7 @@ public: cracked.grad = false; cracked.subpass = false; cracked.lodClamp = false; -#ifdef AMD_EXTENSIONS cracked.fragMask = false; -#endif switch (op) { case EOpImageQuerySize: @@ -1373,10 +1355,6 @@ public: case EOpTexture: case EOpSparseTexture: break; - case EOpTextureClamp: - case EOpSparseTextureClamp: - cracked.lodClamp = true; - break; case EOpTextureProj: cracked.proj = true; break; @@ -1388,22 +1366,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: @@ -1428,11 +1401,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; @@ -1447,6 +1415,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; @@ -1467,7 +1450,6 @@ public: cracked.gather = true; cracked.offsets = true; break; -#ifdef AMD_EXTENSIONS case EOpTextureGatherLod: case EOpSparseTextureGatherLod: cracked.gather = true; @@ -1498,8 +1480,6 @@ public: cracked.subpass = sampler.dim == EsdSubpass; cracked.fragMask = true; break; -#endif -#ifdef NV_EXTENSIONS case EOpImageSampleFootprintNV: break; case EOpImageSampleFootprintClampNV: @@ -1515,11 +1495,11 @@ public: cracked.lodClamp = true; cracked.grad = true; break; -#endif case EOpSubpassLoad: case EOpSubpassLoadMS: cracked.subpass = true; break; +#endif default: break; } diff --git a/glslang/Include/revision.h b/glslang/Include/revision.h index 7afa37b0..06fccdf4 100644 --- a/glslang/Include/revision.h +++ b/glslang/Include/revision.h @@ -1,3 +1,3 @@ // This header is generated by the make-revision script. -#define GLSLANG_PATCH_LEVEL 3321 +#define GLSLANG_PATCH_LEVEL 3381 diff --git a/glslang/MachineIndependent/Constant.cpp b/glslang/MachineIndependent/Constant.cpp index e0f3d55a..98c2666f 100755 --- a/glslang/MachineIndependent/Constant.cpp +++ b/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); @@ -527,14 +529,16 @@ 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(-static_cast(unionArray[i].getUConst()))); break; +#ifndef GLSLANG_WEB case EbtInt8: newConstArray[i].setI8Const(-unionArray[i].getI8Const()); break; case EbtUint8: newConstArray[i].setU8Const(static_cast(-static_cast(unionArray[i].getU8Const()))); break; case EbtInt16: newConstArray[i].setI16Const(-unionArray[i].getI16Const()); break; case EbtUint16:newConstArray[i].setU16Const(static_cast(-static_cast(unionArray[i].getU16Const()))); break; - case EbtInt: newConstArray[i].setIConst(-unionArray[i].getIConst()); break; - case EbtUint: newConstArray[i].setUConst(static_cast(-static_cast(unionArray[i].getUConst()))); break; case EbtInt64: newConstArray[i].setI64Const(-unionArray[i].getI64Const()); break; case EbtUint64: newConstArray[i].setU64Const(static_cast(-static_cast(unionArray[i].getU64Const()))); break; +#endif default: return nullptr; } @@ -669,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(unionArray[i].getDConst())); break; + + case EOpConvFloatToInt: + case EOpConvDoubleToInt: + newConstArray[i].setIConst(static_cast(unionArray[i].getDConst())); break; + +#ifndef GLSLANG_WEB case EOpConvInt8ToBool: newConstArray[i].setBConst(unionArray[i].getI8Const() != 0); break; case EOpConvUint8ToBool: @@ -677,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; @@ -700,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; @@ -808,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; @@ -817,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: @@ -829,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(unionArray[i].getI64Const())); break; case EOpConvInt64ToInt16: @@ -903,48 +921,35 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) newConstArray[i].setI8Const(static_cast(unionArray[i].getDConst())); break; case EOpConvFloatToInt16: newConstArray[i].setI16Const(static_cast(unionArray[i].getDConst())); break; - case EOpConvFloatToInt: - newConstArray[i].setIConst(static_cast(unionArray[i].getDConst())); break; case EOpConvFloatToInt64: newConstArray[i].setI64Const(static_cast(unionArray[i].getDConst())); break; case EOpConvFloatToUint8: newConstArray[i].setU8Const(static_cast(unionArray[i].getDConst())); break; case EOpConvFloatToUint16: newConstArray[i].setU16Const(static_cast(unionArray[i].getDConst())); break; - case EOpConvFloatToUint: - newConstArray[i].setUConst(static_cast(unionArray[i].getDConst())); break; case EOpConvFloatToUint64: newConstArray[i].setU64Const(static_cast(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(unionArray[i].getDConst())); break; case EOpConvDoubleToInt16: newConstArray[i].setI16Const(static_cast(unionArray[i].getDConst())); break; - case EOpConvDoubleToInt: - newConstArray[i].setIConst(static_cast(unionArray[i].getDConst())); break; case EOpConvDoubleToInt64: newConstArray[i].setI64Const(static_cast(unionArray[i].getDConst())); break; case EOpConvDoubleToUint8: newConstArray[i].setU8Const(static_cast(unionArray[i].getDConst())); break; case EOpConvDoubleToUint16: newConstArray[i].setU16Const(static_cast(unionArray[i].getDConst())); break; - case EOpConvDoubleToUint: - newConstArray[i].setUConst(static_cast(unionArray[i].getDConst())); break; case EOpConvDoubleToUint64: newConstArray[i].setU64Const(static_cast(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 @@ -1076,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; @@ -1088,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; @@ -1110,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; @@ -1122,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; @@ -1145,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())); @@ -1165,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())); @@ -1177,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; diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp index a229e302..8ea58ccc 100644 --- a/glslang/MachineIndependent/Initialize.cpp +++ b/glslang/MachineIndependent/Initialize.cpp @@ -64,6 +64,366 @@ 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(TypeF | TypeI); +const ArgType TypeFIB = static_cast(TypeF | TypeI | TypeB); +const ArgType TypeIU = static_cast(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(ENoProfile | ECoreProfile | ECompatibilityProfile); + +// Declare pointers to put into the table for versioning. +#ifdef GLSLANG_WEB + const Versioning* Es300Desktop130 = 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 }, +#ifndef GLSLANG_WEB + { 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 }, + { 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 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) { + if (function.classes & ClassCV) + decls.append("coherent volatile "); + 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& spvVersion) +{ +#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 subtlies +// to get correct if instead trying to do it surgically. +void RelateTabledBuiltins(const BuiltInFunction* 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); + +#ifdef GLSLANG_WEB + return; +#endif + + 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); +} + inline bool IncludeLegacy(int version, EProfile profile, const SpvVersion& spvVersion) { return profile != EEsProfile && (version <= 130 || (spvVersion.spv == 0 && ARBCompatibility) || profile == ECompatibilityProfile); @@ -84,27 +444,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 +#endif } TBuiltIns::~TBuiltIns() @@ -122,32 +485,18 @@ TBuiltIns::~TBuiltIns() // void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvVersion) { + 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);" @@ -280,318 +629,6 @@ 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 // @@ -983,7 +1020,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV ); } -#ifdef AMD_EXTENSIONS // GL_AMD_shader_trinary_minmax if (profile != EEsProfile && version >= 430) { commonBuiltins.append( @@ -1080,48 +1116,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 +1202,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 +1230,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 @@ -1284,6 +1284,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } +#endif if ((profile == EEsProfile && version >= 300) || (profile != EEsProfile && version >= 400)) { @@ -1306,7 +1307,9 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV commonBuiltins.append( "mediump vec2 unpackHalf2x16(highp uint);" "\n"); - } else if (profile != EEsProfile && version >= 420) { + } +#ifndef GLSLANG_WEB + else if (profile != EEsProfile && version >= 420) { commonBuiltins.append( " vec2 unpackHalf2x16(highp uint);" "\n"); @@ -1331,48 +1334,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 +1393,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.) @@ -2445,7 +2305,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "bvec3 subgroupQuadSwapDiagonal(bvec3);\n" "bvec4 subgroupQuadSwapDiagonal(bvec4);\n" -#ifdef NV_EXTENSIONS "uvec4 subgroupPartitionNV(float);\n" "uvec4 subgroupPartitionNV(vec2);\n" "uvec4 subgroupPartitionNV(vec3);\n" @@ -2735,8 +2594,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "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) { @@ -2876,8 +2733,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "dvec3 subgroupQuadSwapDiagonal(dvec3);\n" "dvec4 subgroupQuadSwapDiagonal(dvec4);\n" - -#ifdef NV_EXTENSIONS "uvec4 subgroupPartitionNV(double);\n" "uvec4 subgroupPartitionNV(dvec2);\n" "uvec4 subgroupPartitionNV(dvec3);\n" @@ -2942,7 +2797,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "dvec2 subgroupPartitionedExclusiveMaxNV(dvec2, uvec4 ballot);\n" "dvec3 subgroupPartitionedExclusiveMaxNV(dvec3, uvec4 ballot);\n" "dvec4 subgroupPartitionedExclusiveMaxNV(dvec4, uvec4 ballot);\n" -#endif "\n"); } @@ -2952,7 +2806,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n" ); -#ifdef NV_EXTENSIONS stageBuiltins[EShLangMeshNV].append( "void subgroupMemoryBarrierShared();" "\n" @@ -2961,7 +2814,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "void subgroupMemoryBarrierShared();" "\n" ); -#endif } if (profile != EEsProfile && version >= 460) { @@ -2973,7 +2825,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( @@ -3870,10 +3721,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } -#endif // AMD_EXTENSIONS - - -#ifdef NV_EXTENSIONS if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) { commonBuiltins.append( @@ -3907,7 +3754,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( @@ -4889,7 +4735,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();" @@ -4898,7 +4743,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "void barrier();" ); } -#endif if ((profile != EEsProfile && version >= 130) || esBarrier) commonBuiltins.append( "void memoryBarrier();" @@ -4914,7 +4758,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "void groupMemoryBarrier();" ); } -#ifdef NV_EXTENSIONS if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) { stageBuiltins[EShLangMeshNV].append( "void memoryBarrierShared();" @@ -4925,7 +4768,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"); @@ -4955,6 +4797,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" ); } @@ -5000,9 +4896,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); @@ -5039,7 +4932,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "bool helperInvocationEXT();" "\n"); -#ifdef AMD_EXTENSIONS // GL_AMD_shader_explicit_vertex_parameter if (profile != EEsProfile && version >= 450) { stageBuiltins[EShLangFragment].append( @@ -5113,9 +5005,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) { @@ -5145,7 +5034,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV //E_SPV_NV_compute_shader_derivatives if ((profile == EEsProfile && version >= 320) || (profile != EEsProfile && version >= 450)) { - stageBuiltins[EShLangCompute].append(derivatives); stageBuiltins[EShLangCompute].append(derivativeControls); stageBuiltins[EShLangCompute].append("\n"); } @@ -5183,11 +5071,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( @@ -5196,6 +5086,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. @@ -5342,7 +5233,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } -#ifdef NV_EXTENSIONS //============================================================================ // // Define the interface to the mesh/task shader. @@ -5430,7 +5320,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } } -#endif //============================================================================ // @@ -5564,7 +5453,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 @@ -5573,8 +5461,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) { @@ -5589,15 +5475,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 {" @@ -5649,10 +5539,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[];" @@ -5698,7 +5586,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 @@ -5707,7 +5594,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) { @@ -5772,13 +5658,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[];" @@ -5877,7 +5761,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 @@ -5886,7 +5769,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, @@ -6011,7 +5893,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;" @@ -6022,9 +5903,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;" @@ -6037,7 +5916,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "in vec3 gl_BaryCoordNoPerspNV;" ); -#endif } else { // ES profile @@ -6049,6 +5927,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 @@ -6057,6 +5936,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 @@ -6084,7 +5964,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;" @@ -6095,14 +5974,16 @@ 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 = @@ -6129,10 +6010,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) || @@ -6186,7 +6065,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV stageBuiltins[EShLangCompute] .append(subgroupDecls); stageBuiltins[EShLangCompute] .append(computeSubgroupDecls); stageBuiltins[EShLangFragment] .append(fragmentSubgroupDecls); -#ifdef NV_EXTENSIONS stageBuiltins[EShLangMeshNV] .append(subgroupDecls); stageBuiltins[EShLangMeshNV] .append(computeSubgroupDecls); stageBuiltins[EShLangTaskNV] .append(subgroupDecls); @@ -6197,10 +6075,8 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV stageBuiltins[EShLangClosestHitNV] .append(subgroupDecls); stageBuiltins[EShLangMissNV] .append(subgroupDecls); stageBuiltins[EShLangCallableNV] .append(subgroupDecls); -#endif } -#ifdef NV_EXTENSIONS // GL_NV_ray_tracing if (profile != EEsProfile && version >= 460) { @@ -6300,7 +6176,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( @@ -6330,6 +6205,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()); @@ -6345,19 +6221,28 @@ 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 }; -#else - TBasicType bTypes[3] = { EbtFloat, EbtInt, EbtUint }; -#endif - 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 - +#ifdef GLSLANG_WEB + const TBasicType bTypes[] = { EbtFloat, EbtInt, EbtUint }; + bool skipBuffer = true; + bool skipCubeArrayed = true; + const int image = 0; +#else + 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); + 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) +#endif + { +#ifndef GLSLANG_WEB if ((ms || image) && shadow) continue; if (ms && profile != EEsProfile && version < 150) @@ -6366,9 +6251,19 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c continue; if (ms && profile == EEsProfile && version < 310) continue; +#endif 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 == EsdSubpass && spvVersion.vulkan == 0) continue; if (dim == EsdSubpass && (image || shadow || arrayed)) @@ -6377,43 +6272,41 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c continue; if (dim != Esd2D && dim != EsdSubpass && ms) continue; - if ((dim == Esd3D || dim == EsdRect) && arrayed) - continue; - if (dim == Esd3D && shadow) - continue; - if (dim == EsdCube && arrayed && skipCubeArrayed) - continue; if (dim == EsdBuffer && skipBuffer) continue; if (dim == EsdBuffer && (shadow || arrayed || ms)) continue; if (ms && arrayed && profile == EEsProfile && version < 310) continue; -#ifdef AMD_EXTENSIONS - for (int bType = 0; bType < 4; ++bType) { // float, float16, int, uint results +#endif + if (dim == Esd3D && shadow) + continue; + if (dim == EsdCube && arrayed && skipCubeArrayed) + continue; + if ((dim == Esd3D || dim == EsdRect) && arrayed) + continue; - if (shadow && bType > 1) + // Loop over the bTypes + for (int bType = 0; bType < sizeof(bTypes)/sizeof(TBasicType); ++bType) { +#ifndef GLSLANG_WEB + if (bTypes[bType] == EbtFloat16 && (profile == EEsProfile || version < 450)) continue; - - 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); @@ -6425,10 +6318,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); @@ -6436,8 +6331,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). @@ -6452,6 +6347,7 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c addSamplingFunctions(sampler, textureTypeName, version, profile); addQueryFunctions(sampler, textureTypeName, version, profile); } +#endif } } } @@ -6460,13 +6356,14 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c } } +#ifndef GLSLANG_WEB // // sparseTexelsResidentARB() // - if (profile != EEsProfile && version >= 450) { commonBuiltins.append("bool sparseTexelsResidentARB(int code);\n"); } +#endif } // @@ -6477,14 +6374,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) @@ -6493,12 +6401,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"); @@ -6509,9 +6417,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("); @@ -6523,40 +6431,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) @@ -6566,14 +6462,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"); @@ -6600,7 +6496,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) @@ -6616,7 +6512,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 "); @@ -6693,8 +6589,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) @@ -6720,7 +6615,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 "); @@ -6728,7 +6623,6 @@ void TBuiltIns::addImageFunctions(TSampler sampler, const TString& typeName, int commonBuiltins.append("vec4"); commonBuiltins.append(");\n"); } -#endif } // @@ -6743,7 +6637,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"); } @@ -6761,12 +6655,13 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName, // 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; @@ -6775,18 +6670,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 @@ -6797,14 +6692,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; @@ -6824,31 +6720,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; @@ -6858,14 +6769,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 "); @@ -6903,7 +6810,6 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName, // sampler type s.append(typeName); -#ifdef AMD_EXTENSIONS // P coordinate if (extraProj) { if (f16TexAddr) @@ -6921,31 +6827,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) @@ -6974,23 +6864,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) @@ -7001,7 +6874,6 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName, } } -#ifdef AMD_EXTENSIONS // lod clamp if (lodClamp) { if (f16TexAddr) @@ -7009,29 +6881,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) @@ -7039,27 +6901,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 } } } @@ -7086,18 +6939,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 @@ -7145,14 +6996,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]); @@ -7180,14 +7027,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; @@ -7313,7 +7157,6 @@ void TBuiltIns::addGatherFunctions(TSampler sampler, const TString& typeName, in } } } -#endif } // @@ -7382,6 +7225,9 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf s.append(builtInConstant); } +#ifdef GLSLANG_WEB + } +#else if (version >= 310) { // geometry @@ -7440,10 +7286,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"); } @@ -7630,10 +7474,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];" @@ -7761,7 +7603,6 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf s.append(builtInConstant); } -#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); @@ -7879,6 +7720,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); @@ -7913,7 +7765,6 @@ 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); @@ -7959,15 +7810,12 @@ 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("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); @@ -8008,16 +7856,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); @@ -8027,7 +7865,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: @@ -8043,22 +7880,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); @@ -8070,19 +7911,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); @@ -8113,7 +7945,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); @@ -8214,7 +8045,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_WarpIDNV", EbvWarpID, symbolTable); BuiltInVariable("gl_SMIDNV", EbvSMID, symbolTable); } - +#endif break; case EShLangFragment: @@ -8231,6 +8062,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); @@ -8385,7 +8217,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); @@ -8423,9 +8254,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); @@ -8441,7 +8269,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_BaryCoordNV", EbvBaryCoordNV, symbolTable); BuiltInVariable("gl_BaryCoordNoPerspNV", EbvBaryCoordNoPerspNV, symbolTable); } -#endif if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 310)) { @@ -8581,8 +8408,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); @@ -8605,7 +8430,6 @@ 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); @@ -8645,8 +8469,10 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion } symbolTable.setFunctionExtensions("helperInvocationEXT", 1, &E_GL_EXT_demote_to_helper_invocation); +#endif break; +#ifndef GLSLANG_WEB case EShLangCompute: BuiltInVariable("gl_NumWorkGroups", EbvNumWorkGroups, symbolTable); BuiltInVariable("gl_WorkGroupSize", EbvWorkGroupSize, symbolTable); @@ -8755,11 +8581,13 @@ 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); + } -#ifdef NV_EXTENSIONS 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); @@ -8771,10 +8599,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion 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 case EShLangRayGenNV: case EShLangIntersectNV: case EShLangAnyHitNV: @@ -9130,7 +8956,8 @@ 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); + + relateTabledBuiltins(version, profile, spvVersion, language, symbolTable); symbolTable.relateToOperator("matrixCompMult", EOpMul); // 120 and 150 are correct for both ES and desktop @@ -9143,61 +8970,11 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion } } - 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); @@ -9211,12 +8988,14 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("int16BitsToHalf", EOpInt16BitsToFloat16); symbolTable.relateToOperator("uint16BitsToHalf", EOpUint16BitsToFloat16); +#endif symbolTable.relateToOperator("packSnorm2x16", EOpPackSnorm2x16); symbolTable.relateToOperator("unpackSnorm2x16", EOpUnpackSnorm2x16); symbolTable.relateToOperator("packUnorm2x16", EOpPackUnorm2x16); symbolTable.relateToOperator("unpackUnorm2x16", EOpUnpackUnorm2x16); +#ifndef GLSLANG_WEB symbolTable.relateToOperator("packSnorm4x8", EOpPackSnorm4x8); symbolTable.relateToOperator("unpackSnorm4x8", EOpUnpackSnorm4x8); symbolTable.relateToOperator("packUnorm4x8", EOpPackUnorm4x8); @@ -9224,6 +9003,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("packDouble2x32", EOpPackDouble2x32); symbolTable.relateToOperator("unpackDouble2x32", EOpUnpackDouble2x32); +#endif symbolTable.relateToOperator("packHalf2x16", EOpPackHalf2x16); symbolTable.relateToOperator("unpackHalf2x16", EOpUnpackHalf2x16); @@ -9233,6 +9013,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("packUint2x32", EOpPackUint2x32); symbolTable.relateToOperator("unpackUint2x32", EOpUnpackUint2x32); +#ifndef GLSLANG_WEB symbolTable.relateToOperator("packInt2x16", EOpPackInt2x16); symbolTable.relateToOperator("unpackInt2x16", EOpUnpackInt2x16); symbolTable.relateToOperator("packUint2x16", EOpPackUint2x16); @@ -9253,18 +9034,6 @@ 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); @@ -9272,14 +9041,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion 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); @@ -9320,8 +9081,10 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("findMSB", EOpFindMSB); symbolTable.relateToOperator("helperInvocationEXT", EOpIsHelperInvocation); +#endif if (PureOperatorBuiltins) { +#ifndef GLSLANG_WEB symbolTable.relateToOperator("imageSize", EOpImageQuerySize); symbolTable.relateToOperator("imageSamples", EOpImageQuerySamples); symbolTable.relateToOperator("imageLoad", EOpImageLoad); @@ -9339,6 +9102,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("subpassLoad", EOpSubpassLoad); symbolTable.relateToOperator("subpassLoadMS", EOpSubpassLoadMS); +#endif symbolTable.relateToOperator("textureSize", EOpTextureQuerySize); symbolTable.relateToOperator("textureQueryLod", EOpTextureQueryLod); @@ -9358,6 +9122,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("textureGradOffset", EOpTextureGradOffset); symbolTable.relateToOperator("textureProjGrad", EOpTextureProjGrad); symbolTable.relateToOperator("textureProjGradOffset", EOpTextureProjGradOffset); + +#ifndef GLSLANG_WEB symbolTable.relateToOperator("textureGather", EOpTextureGather); symbolTable.relateToOperator("textureGatherOffset", EOpTextureGatherOffset); symbolTable.relateToOperator("textureGatherOffsets", EOpTextureGatherOffsets); @@ -9367,13 +9133,11 @@ 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) || (profile == EEsProfile && version == 100))) { @@ -9469,7 +9233,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); @@ -9514,7 +9277,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("fragmentMaskFetchAMD", EOpFragmentMaskFetch); symbolTable.relateToOperator("fragmentFetchAMD", EOpFragmentFetch); -#endif } // GL_KHR_shader_subgroup @@ -9575,7 +9337,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); @@ -9598,15 +9359,16 @@ 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) { symbolTable.relateToOperator("shadow2DEXT", EOpTexture); symbolTable.relateToOperator("shadow2DProjEXT", EOpTextureProj); } +#endif } +#ifndef GLSLANG_WEB switch(language) { case EShLangVertex: break; @@ -9623,9 +9385,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); @@ -9638,10 +9397,8 @@ 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); @@ -9652,7 +9409,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion 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); @@ -9665,13 +9421,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: @@ -9707,11 +9461,11 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("subgroupMemoryBarrierShared", EOpSubgroupMemoryBarrierShared); } break; -#endif default: assert(false && "Language not supported"); } +#endif } // @@ -9725,6 +9479,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); @@ -9770,13 +9525,11 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_in", "gl_TexCoord", EbvTexCoord, symbolTable); BuiltInVariable("gl_in", "gl_FogFragCoord", EbvFogFragCoord, symbolTable); -#ifdef NV_EXTENSIONS 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); -#endif // extension requirements if (profile == EEsProfile) { @@ -9788,6 +9541,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion default: break; } +#endif } } // end namespace glslang diff --git a/glslang/MachineIndependent/Initialize.h b/glslang/MachineIndependent/Initialize.h index b5de3242..ac8ec33e 100644 --- a/glslang/MachineIndependent/Initialize.h +++ b/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/glslang/MachineIndependent/Intermediate.cpp b/glslang/MachineIndependent/Intermediate.cpp index 1dd6dcef..93d41f7d 100644 --- a/glslang/MachineIndependent/Intermediate.cpp +++ b/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 EOpConstructInt: newType = EbtInt; break; - case EOpConstructUint: newType = EbtUint; break; - case EOpConstructInt64: newType = EbtInt64; break; - case EOpConstructUint64: newType = EbtUint64; 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 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 @@ -609,16 +609,17 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped } switch (convertTo) { +#ifndef GLSLANG_WEB case EbtDouble: switch (node->getBasicType()) { + 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; @@ -626,23 +627,27 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped return nullptr; } break; +#endif case EbtFloat: switch (node->getBasicType()) { + 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 EbtInt: newOp = EOpConvIntToFloat; break; - case EbtUint: newOp = EOpConvUintToFloat; break; - case EbtBool: newOp = EOpConvBoolToFloat; break; - case EbtDouble: newOp = EOpConvDoubleToFloat; break; case EbtFloat16: newOp = EOpConvFloat16ToFloat; break; case EbtInt64: newOp = EOpConvInt64ToFloat; break; case EbtUint64: newOp = EOpConvUint64ToFloat; break; +#endif default: return nullptr; } break; +#ifndef GLSLANG_WEB case EbtFloat16: switch (node->getBasicType()) { case EbtInt8: newOp = EOpConvInt8ToFloat16; break; @@ -660,23 +665,27 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped return nullptr; } break; +#endif case EbtBool: switch (node->getBasicType()) { + 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 EbtInt: newOp = EOpConvIntToBool; break; - case EbtUint: newOp = EOpConvUintToBool; break; - case EbtFloat: newOp = EOpConvFloatToBool; break; - case EbtDouble: newOp = EOpConvDoubleToBool; break; case EbtFloat16: newOp = EOpConvFloat16ToBool; break; case EbtInt64: newOp = EOpConvInt64ToBool; break; case EbtUint64: newOp = EOpConvUint64ToBool; break; +#endif default: return nullptr; } break; +#ifndef GLSLANG_WEB case EbtInt8: switch (node->getBasicType()) { case EbtUint8: newOp = EOpConvUint8ToInt8; break; @@ -746,41 +755,47 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped return nullptr; } break; +#endif case EbtInt: switch (node->getBasicType()) { + 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; } break; case EbtUint: switch (node->getBasicType()) { + 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; } break; +#ifndef GLSLANG_WEB case EbtInt64: switch (node->getBasicType()) { case EbtInt8: newOp = EOpConvInt8ToInt64; break; @@ -815,6 +830,7 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped return nullptr; } break; +#endif default: return nullptr; } @@ -921,7 +937,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); @@ -932,7 +948,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; @@ -1027,6 +1043,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; @@ -1055,18 +1078,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: @@ -1110,7 +1128,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; @@ -1133,7 +1151,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())) @@ -1179,7 +1197,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: @@ -1232,7 +1250,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: @@ -1335,7 +1353,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) @@ -1448,7 +1466,31 @@ 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 EbtInt: + switch(to) { + case EbtUint: + return version >= 400 || getSource() == EShSourceHlsl; + case EbtInt64: + case EbtUint64: + return true; + default: + break; + } + break; + case EbtUint: + switch(to) { + case EbtInt64: + case EbtUint64: + return true; + default: + break; + } + break; case EbtInt8: switch (to) { case EbtUint8: @@ -1495,26 +1537,6 @@ bool TIntermediate::isIntegralConversion(TBasicType from, TBasicType to) const break; } break; - case EbtInt: - switch(to) { - case EbtUint: - return version >= 400 || (source == EShSourceHlsl); - case EbtInt64: - case EbtUint64: - return true; - default: - break; - } - break; - case EbtUint: - switch(to) { - case EbtInt64: - case EbtUint64: - return true; - default: - break; - } - break; case EbtInt64: if (to == EbtUint64) { return true; @@ -1528,6 +1550,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 { @@ -1538,6 +1564,17 @@ bool TIntermediate::isFPConversion(TBasicType from, TBasicType to) const bool TIntermediate::isFPIntegralConversion(TBasicType from, TBasicType to) const { switch (from) { + case EbtInt: + case EbtUint: + switch(to) { + case EbtFloat: + case EbtDouble: + return true; + default: + break; + } + break; +#ifndef GLSLANG_WEB case EbtInt8: case EbtUint8: case EbtInt16: @@ -1551,23 +1588,13 @@ bool TIntermediate::isFPIntegralConversion(TBasicType from, TBasicType to) const break; } break; - case EbtInt: - case EbtUint: - switch(to) { - case EbtFloat: - case EbtDouble: - return true; - default: - break; - } - break; case EbtInt64: case EbtUint64: if (to == EbtDouble) { return true; } break; - +#endif default: break; } @@ -1580,7 +1607,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) @@ -1588,7 +1615,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); @@ -1655,7 +1682,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; } @@ -1670,13 +1697,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; } @@ -1687,34 +1712,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; } @@ -1723,11 +1742,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; } @@ -1738,11 +1755,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; } @@ -1751,15 +1766,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: @@ -1769,10 +1781,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: @@ -1780,7 +1790,6 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat default: break; } -#endif return false; default: return false; @@ -1790,7 +1799,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) { @@ -1849,7 +1863,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; @@ -1898,10 +1918,10 @@ std::tuple 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; @@ -1970,7 +1990,7 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const { TOperator op = EOpNull; - if (type.getQualifier().nonUniform) + if (type.getQualifier().isNonUniform()) return EOpConstructNonuniform; if (type.isCoopMat()) @@ -1981,7 +2001,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: @@ -2023,6 +2043,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()) { @@ -2136,82 +2271,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; @@ -2230,47 +2289,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; } @@ -2729,6 +2751,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); @@ -2739,6 +2762,7 @@ bool TIntermediate::postProcess(TIntermNode* root, EShLanguage /*language*/) performTextureUpgradeAndSamplerRemovalTransformation(root); break; } +#endif return true; } @@ -3780,6 +3804,16 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC #define PROMOTE(Set, CType, Get) leftUnionArray[i].Set(static_cast(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; \ @@ -3796,20 +3830,23 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC case EbtBool: PROMOTE_TO_BOOL(Get); break; \ default: return node; \ } +#endif switch (node->getType().getBasicType()) { - case EbtFloat16: TO_ALL(getDConst); break; 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 EbtInt: TO_ALL(getIConst); break; case EbtInt64: TO_ALL(getI64Const); break; case EbtUint8: TO_ALL(getU8Const); break; case EbtUint16: TO_ALL(getU16Const); break; - case EbtUint: TO_ALL(getUConst); break; case EbtUint64: TO_ALL(getU64Const); break; - case EbtBool: TO_ALL(getBConst); break; +#endif default: return node; } } @@ -3839,7 +3876,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/glslang/MachineIndependent/ParseContextBase.cpp b/glslang/MachineIndependent/ParseContextBase.cpp index e0de1a4a..282ecca0 100644 --- a/glslang/MachineIndependent/ParseContextBase.cpp +++ b/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()); } @@ -574,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. @@ -618,6 +621,7 @@ void TParseContextBase::growGlobalUniformBlock(const TSourceLoc& loc, TType& mem ++firstNewMember; } +#endif void TParseContextBase::finish() { diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 6df25f0e..33a16641 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -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& tokens) { +#ifndef GLSLANG_WEB if (pragmaCallback) pragmaCallback(loc.line, tokens); @@ -285,6 +295,7 @@ void TParseContext::handlePragma(const TSourceLoc& loc, const TVector& 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, @@ -312,6 +324,7 @@ TIntermTyped* TParseContext::handleVariable(const TSourceLoc& loc, TSymbol* symb symbol->getAsAnonMember()->getAnonContainer().getType().containsUnsizedArray())) makeEditable(symbol); } +#endif const TVariable* variable; const TAnonMember* anon = symbol ? symbol->getAsAnonMember() : nullptr; @@ -357,7 +370,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 +391,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 +402,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 +420,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 +448,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 +465,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 +473,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 +487,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 +496,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 +553,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 +587,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 +634,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 +659,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 +680,6 @@ int TParseContext::getIoArrayImplicitSize(const TQualifier &qualifier, TString * str = "max_vertices"; } } -#endif if (featureString) *featureString = str; return expectedSize; @@ -686,19 +694,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 +729,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 +751,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 +826,7 @@ TIntermTyped* TParseContext::handleDotDereference(const TSourceLoc& loc, TInterm TSwizzleSelectors 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 +861,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 +884,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 +1132,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,8 +1152,9 @@ 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"; if (argQualifier.volatil && ! formalQualifier.volatil) error(arguments->getLoc(), message, "volatile", ""); @@ -1169,15 +1176,14 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction // "...but only restrict can be taken away from a calling argument, by a formal parameter that // lacks the restrict qualifier..." } - 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"); @@ -1217,9 +1223,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); } @@ -1348,13 +1356,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 ? @@ -1375,7 +1379,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) { @@ -1400,6 +1406,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) { @@ -1452,6 +1459,7 @@ void TParseContext::checkLocation(const TSourceLoc& loc, TOperator op) default: break; } +#endif } // Finish processing object.length(). This started earlier in handleDotDereference(), where @@ -1469,29 +1477,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()) { @@ -1524,6 +1531,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 @@ -1551,6 +1559,7 @@ void TParseContext::addInputArgumentConversions(const TFunction& function, TInte } } } +#endif } // @@ -1562,6 +1571,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? @@ -1629,6 +1641,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) @@ -1796,7 +1809,6 @@ void TParseContext::memorySemanticsCheck(const TSourceLoc& loc, const TFunction& } } - // // Do additional checking of built-in function calls that is not caught // by normal semantic checks on argument type, extension tagging, etc. @@ -1824,6 +1836,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: @@ -1880,7 +1893,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; @@ -1895,12 +1907,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: @@ -1978,7 +1986,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; @@ -1991,7 +1999,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; @@ -2011,7 +2019,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", ""); @@ -2020,7 +2028,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: @@ -2042,12 +2049,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(), ""); } @@ -2075,13 +2082,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; } @@ -2089,9 +2092,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. @@ -2101,13 +2102,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", ""); @@ -2121,8 +2121,6 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan } } } -#endif - break; case EOpEmitStreamVertex: @@ -2165,6 +2163,7 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan memorySemanticsCheck(loc, fnCandidate, callNode); } break; +#endif default: break; @@ -2182,7 +2181,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)) @@ -2202,6 +2201,8 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan } } +#ifndef GLSLANG_WEB + extern bool PureOperatorBuiltins; // Deprecated! Use PureOperatorBuiltins == true instead, in which case this @@ -2317,17 +2318,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. // @@ -2475,6 +2478,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 ... @@ -2490,10 +2494,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) { @@ -2525,8 +2527,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 @@ -2549,7 +2550,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; @@ -2586,12 +2587,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 } // @@ -2643,7 +2642,7 @@ void TParseContext::reservedErrorCheck(const TSourceLoc& loc, const TString& ide // in undefined behavior." // however, before that, ES tests required an error. if (identifier.find("__") != TString::npos) { - if (profile == EEsProfile && version <= 300) + 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(), ""); @@ -2668,13 +2667,13 @@ 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) + 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); @@ -2689,10 +2688,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) @@ -2745,8 +2748,10 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T bool constructingMatrix = false; switch(op) { +#ifndef GLSLANG_WEB case EOpConstructTextureSampler: return constructorTextureSamplerError(loc, function); +#endif case EOpConstructMat2x2: case EOpConstructMat2x3: case EOpConstructMat2x4: @@ -2756,6 +2761,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: @@ -2774,6 +2780,7 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T case EOpConstructF16Mat4x2: case EOpConstructF16Mat4x3: case EOpConstructF16Mat4x4: +#endif constructingMatrix = true; break; default: @@ -2823,20 +2830,19 @@ 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"); } } } +#ifndef GLSLANG_WEB switch (op) { case EOpConstructFloat16: case EOpConstructF16Vec2: @@ -2876,6 +2882,7 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T default: break; } +#endif // inherit constness from children if (constType) { @@ -2884,17 +2891,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: @@ -2907,18 +2921,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(); @@ -3028,7 +3037,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; } @@ -3074,7 +3083,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, ""); @@ -3126,14 +3135,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"); } @@ -3150,6 +3159,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) @@ -3160,7 +3171,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) @@ -3173,7 +3184,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) { @@ -3238,7 +3250,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); @@ -3252,7 +3264,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()) { @@ -3262,13 +3274,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 @@ -3281,25 +3293,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) @@ -3307,13 +3309,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) { @@ -3331,18 +3331,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"); @@ -3353,12 +3341,16 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali requireProfile(loc, ~EEsProfile, "fragment-shader struct input containing an array"); } break; - - case EShLangCompute: +#ifndef GLSLANG_WEB + case EShLangCompute: if (! symbolTable.atBuiltInLevel()) error(loc, "global storage input qualifier cannot be used in a compute shader", "in", ""); break; - + case EShLangTessControl: + if (qualifier.patch) + error(loc, "can only use on output in tessellation-control shader", "patch", ""); + break; +#endif default: break; } @@ -3376,18 +3368,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) { @@ -3406,10 +3386,15 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali error(loc, "cannot contain a double, int64, or uint64", GetStorageQualifierString(qualifier.storage), ""); break; +#ifndef GLSLANG_WEB case EShLangCompute: error(loc, "global storage output qualifier cannot be used in a compute shader", "out", ""); break; - + case EShLangTessEvaluation: + if (qualifier.patch) + error(loc, "can only use on input in tessellation-evaluation shader", "patch", ""); + break; +#endif default: break; } @@ -3433,18 +3418,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 ", "", ""); @@ -3456,7 +3437,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", "", ""); @@ -3481,6 +3462,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)) || @@ -3488,6 +3470,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); @@ -3495,19 +3478,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); @@ -3520,8 +3501,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", "", ""); @@ -3564,11 +3545,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; @@ -3592,8 +3573,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) { @@ -3612,8 +3595,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"); @@ -3776,8 +3758,10 @@ 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, @@ -3791,36 +3775,36 @@ void TParseContext::arraySizesCheck(const TSourceLoc& loc, const TQualifier& qua 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 + arraySizeRequiredCheck(loc, *arraySizes); } @@ -3861,6 +3845,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); @@ -3868,6 +3853,7 @@ void TParseContext::declareArray(const TSourceLoc& loc, const TString& identifie } else fixIoArraySize(loc, symbol->getWritableType()); } +#endif return; } @@ -3905,6 +3891,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())) @@ -3918,8 +3905,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) { @@ -3933,7 +3923,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(); @@ -3943,10 +3933,7 @@ void TParseContext::checkRuntimeSizable(const TSourceLoc& loc, const TIntermType } // check for additional things allowed by GL_EXT_nonuniform_qualifier - if (base.getBasicType() == EbtSampler || -#ifdef NV_EXTENSIONS - base.getBasicType() == EbtAccStructNV || -#endif + 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 @@ -3963,7 +3950,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(); @@ -3975,7 +3962,6 @@ bool TParseContext::isRuntimeLength(const TIntermTyped& base) const return false; } -#ifdef NV_EXTENSIONS // 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) @@ -4002,7 +3988,8 @@ void TParseContext::checkAndResizeMeshViewDim(const TSourceLoc& loc, TType& type 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. // @@ -4015,7 +4002,7 @@ void TParseContext::checkAndResizeMeshViewDim(const TSourceLoc& loc, TType& type // source string number source-string-number. bool TParseContext::lineDirectiveShouldSetNextLine() const { - return profile == EEsProfile || version >= 330; + return isEsProfile() || version >= 330; } // @@ -4046,18 +4033,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" || @@ -4080,11 +4068,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. @@ -4164,16 +4150,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()); @@ -4186,12 +4169,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; } @@ -4203,16 +4186,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; } @@ -4271,7 +4251,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 @@ -4281,7 +4260,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; @@ -4314,7 +4292,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()) @@ -4334,7 +4311,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()) @@ -4425,6 +4401,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) @@ -4472,9 +4449,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", ""); } @@ -4515,12 +4492,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"); @@ -4550,6 +4530,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) @@ -4601,6 +4582,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) @@ -4696,8 +4678,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) { @@ -4707,13 +4691,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. @@ -4727,6 +4710,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. // @@ -4748,33 +4733,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) { @@ -4794,8 +4776,8 @@ void TParseContext::finish() } } } -#endif } +#endif // GLSLANG_WEB // // Layout qualifier stuff. @@ -4831,6 +4813,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"); @@ -4870,20 +4853,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; @@ -4892,10 +4867,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; @@ -4912,14 +4884,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); @@ -5007,10 +4977,8 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi 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)); -#ifdef NV_EXTENSIONS if (order == EioShadingRateInterlockOrdered || order == EioShadingRateInterlockUnordered) requireExtensions(loc, 1, &E_GL_NV_shading_rate_image, TQualifier::getInterlockOrderingString(order)); -#endif publicType.shaderQualifiers.interlockOrdering = order; return; } @@ -5031,7 +4999,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; @@ -5069,9 +5036,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(), ""); } @@ -5156,8 +5122,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 @@ -5165,7 +5133,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) @@ -5175,7 +5159,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 @@ -5221,7 +5206,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) @@ -5232,20 +5216,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; @@ -5253,8 +5223,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 || @@ -5267,7 +5235,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"); @@ -5348,7 +5315,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"); @@ -5372,15 +5338,12 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi case EShLangTaskNV: // Fall through -#endif case EShLangCompute: if (id.compare(0, 11, "local_size_") == 0) { -#ifdef NV_EXTENSIONS if (language == EShLangMeshNV || language == EShLangTaskNV) { requireExtensions(loc, 1, &E_GL_NV_mesh_shader, "gl_WorkGroupSize"); } else -#endif { profileRequires(loc, EEsProfile, 310, 0, "gl_WorkGroupSize"); profileRequires(loc, ~EEsProfile, 430, E_GL_ARB_compute_shader, "gl_WorkGroupSize"); @@ -5419,11 +5382,12 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi } } break; - default: break; } +#endif // GLSLANG_WEB + error(loc, "there is no such layout identifier for this stage taking an assigned value", id.c_str(), ""); } @@ -5448,53 +5412,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) @@ -5563,17 +5524,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: @@ -5637,17 +5596,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: @@ -5670,6 +5627,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) @@ -5681,25 +5639,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: @@ -5722,15 +5675,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; @@ -5740,18 +5697,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", ""); @@ -5776,40 +5731,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 (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 (profile == EEsProfile) { + 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()) { @@ -5866,10 +5819,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); @@ -5886,7 +5840,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); @@ -5900,6 +5854,7 @@ void TParseContext::layoutQualifierCheck(const TSourceLoc& loc, const TQualifier } break; } +#endif case EvqUniform: case EvqBuffer: { @@ -5940,18 +5895,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()) @@ -5963,12 +5917,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) @@ -5981,10 +5935,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", ""); @@ -5992,38 +5942,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 @@ -6052,6 +6002,7 @@ void TParseContext::fixOffset(const TSourceLoc& loc, TSymbol& symbol) atomicUintOffsets[qualifier.layoutBinding] = offset + numOffsets; } } +#endif } // @@ -6061,13 +6012,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) || @@ -6077,7 +6031,7 @@ 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); @@ -6239,6 +6193,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()); }; @@ -6313,6 +6269,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()); }; @@ -6364,11 +6322,13 @@ 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() && + publicType.qualifier.hasOffset()) { if (publicType.qualifier.layoutBinding >= (unsigned int)resources.maxAtomicCounterBindings) { error(loc, "atomic_uint binding is too large", "binding", ""); return; @@ -6377,8 +6337,9 @@ void TParseContext::declareTypeDefaults(const TSourceLoc& loc, const TPublicType return; } - if (publicType.qualifier.hasLayout() && !publicType.qualifier.layoutBufferReference) + if (publicType.qualifier.hasLayout() && !publicType.qualifier.hasBufferReference()) warn(loc, "useless application of layout qualifier", "layout", ""); +#endif } // @@ -6409,12 +6370,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(), ""); @@ -6430,18 +6399,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"); @@ -6449,13 +6418,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 @@ -6511,12 +6479,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 } // @@ -6545,7 +6515,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)) { @@ -6572,7 +6544,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; } @@ -6590,7 +6562,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) @@ -6644,7 +6618,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 @@ -6926,6 +6900,29 @@ 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: + 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: @@ -7036,20 +7033,6 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T } break; - case EOpConstructIVec2: - case EOpConstructIVec3: - case EOpConstructIVec4: - case EOpConstructInt: - basicOp = EOpConstructInt; - break; - - case EOpConstructUVec2: - case EOpConstructUVec3: - case EOpConstructUVec4: - case EOpConstructUint: - basicOp = EOpConstructUint; - break; - case EOpConstructI64Vec2: case EOpConstructI64Vec3: case EOpConstructI64Vec4: @@ -7058,7 +7041,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; } @@ -7069,13 +7052,6 @@ 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()); @@ -7084,7 +7060,7 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T 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 @@ -7102,19 +7078,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()); @@ -7122,6 +7154,8 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T return node; +#endif // GLSLANG_WEB + default: error(loc, "unsupported construction", "", ""); @@ -7163,6 +7197,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. // @@ -7178,7 +7229,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(); @@ -7187,7 +7238,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) @@ -7240,18 +7292,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 @@ -7269,9 +7316,7 @@ 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; @@ -7294,6 +7339,7 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con 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); @@ -7301,6 +7347,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; @@ -7317,11 +7364,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); @@ -7347,7 +7392,7 @@ 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) { checkAndResizeMeshViewDim(typeList[member].loc, *typeList[member].type, /*isBlockMember*/ true); @@ -7366,10 +7411,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", ""); @@ -7381,7 +7427,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) { @@ -7393,7 +7439,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. @@ -7441,12 +7489,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); @@ -7460,7 +7510,7 @@ void TParseContext::blockStageIoCheck(const TSourceLoc& loc, const TQualifier& q case EvqUniform: profileRequires(loc, EEsProfile, 300, nullptr, "uniform block"); profileRequires(loc, ENoProfile, 140, nullptr, "uniform block"); - if (currentBlockQualifier.layoutPacking == ElpStd430 && ! currentBlockQualifier.layoutPushConstant) + if (currentBlockQualifier.layoutPacking == ElpStd430 && ! currentBlockQualifier.isPushConstant()) requireExtensions(loc, 1, &E_GL_EXT_scalar_block_layout, "std430 requires the buffer storage qualifier"); break; case EvqBuffer: @@ -7472,41 +7522,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), @@ -7561,18 +7598,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 } // @@ -7621,6 +7656,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 @@ -7633,24 +7669,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; @@ -7660,6 +7690,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 @@ -7736,7 +7767,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); @@ -7776,10 +7807,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()) @@ -7802,7 +7833,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 { @@ -7817,12 +7848,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) @@ -7833,7 +7861,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"; @@ -7843,7 +7870,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", ""); @@ -7860,12 +7886,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); @@ -7877,14 +7901,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: @@ -7934,9 +7956,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 - else if (language == EShLangMeshNV) { + } else if (language == EShLangMeshNV) { switch (i) { case 0: max = resources.maxMeshWorkGroupSizeX_NV; break; case 1: max = resources.maxMeshWorkGroupSizeY_NV; break; @@ -7945,8 +7965,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; @@ -7955,9 +7974,7 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con } if (intermediate.getLocalSize(i) > (unsigned int)max) error(loc, "too large; see gl_MaxTaskWorkGroupSizeNV", "local_size", ""); - } -#endif - else { + } else { assert(0); } @@ -7981,6 +7998,7 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con workGroupSize->getWritableType().getQualifier().specConstant = true; } } + if (publicType.shaderQualifiers.earlyFragmentTests) { if (publicType.qualifier.storage == EvqVaryingIn) intermediate.setEarlyFragmentTests(); @@ -7993,7 +8011,7 @@ 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", ""); } @@ -8006,7 +8024,6 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con 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", ""); @@ -8051,6 +8068,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() || @@ -8075,6 +8093,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()) @@ -8083,6 +8102,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", "", ""); @@ -8095,16 +8115,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 } // @@ -8171,7 +8189,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/glslang/MachineIndependent/ParseHelper.h b/glslang/MachineIndependent/ParseHelper.h index 3619437c..5cee05e1 100644 --- a/glslang/MachineIndependent/ParseHelper.h +++ b/glslang/MachineIndependent/ParseHelper.h @@ -97,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, @@ -105,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; @@ -150,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 @@ -297,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; @@ -404,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); @@ -417,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; @@ -425,9 +433,9 @@ 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 checkAndResizeMeshViewDim(const TSourceLoc&, TType&, bool isBlockMember); @@ -441,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: // @@ -467,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 needsIndexLimitationChecking; // @@ -506,6 +517,7 @@ protected: // array-sizing declarations // TVector ioArraySymbolResizeList; +#endif }; } // end namespace glslang diff --git a/glslang/MachineIndependent/Scan.cpp b/glslang/MachineIndependent/Scan.cpp index 119b0bc1..9a9b69cc 100644 --- a/glslang/MachineIndependent/Scan.cpp +++ b/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* KeywordMap = nullptr; +#ifndef GLSLANG_WEB std::unordered_set* ReservedSet = nullptr; +#endif }; @@ -341,9 +343,14 @@ void TScanContext::fillInKeywordMap() (*KeywordMap)["const"] = CONST; (*KeywordMap)["uniform"] = UNIFORM; - (*KeywordMap)["nonuniformEXT"] = NONUNIFORM; (*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; @@ -356,7 +363,6 @@ void TScanContext::fillInKeywordMap() (*KeywordMap)["default"] = DEFAULT; (*KeywordMap)["if"] = IF; (*KeywordMap)["else"] = ELSE; - (*KeywordMap)["demote"] = DEMOTE; (*KeywordMap)["discard"] = DISCARD; (*KeywordMap)["return"] = RETURN; (*KeywordMap)["void"] = VOID; @@ -377,8 +383,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)["noperspective"] = NOPERSPECTIVE; (*KeywordMap)["buffer"] = BUFFER; (*KeywordMap)["coherent"] = COHERENT; (*KeywordMap)["devicecoherent"] = DEVICECOHERENT; @@ -391,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; @@ -458,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; @@ -549,6 +560,7 @@ void TScanContext::fillInKeywordMap() (*KeywordMap)["f64mat4x2"] = F64MAT4X2; (*KeywordMap)["f64mat4x3"] = F64MAT4X3; (*KeywordMap)["f64mat4x4"] = F64MAT4X4; +#endif (*KeywordMap)["sampler2D"] = SAMPLER2D; (*KeywordMap)["samplerCube"] = SAMPLERCUBE; @@ -556,12 +568,6 @@ void TScanContext::fillInKeywordMap() (*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; @@ -573,6 +579,16 @@ void TScanContext::fillInKeywordMap() (*KeywordMap)["usampler3D"] = USAMPLER3D; (*KeywordMap)["usamplerCube"] = USAMPLERCUBE; (*KeywordMap)["usampler2DArray"] = USAMPLER2DARRAY; + (*KeywordMap)["sampler3D"] = SAMPLER3D; + (*KeywordMap)["sampler2DShadow"] = SAMPLER2DSHADOW; + +#ifndef GLSLANG_WEB + (*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; @@ -585,8 +601,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; @@ -639,7 +653,6 @@ void TScanContext::fillInKeywordMap() (*KeywordMap)["usubpassInput"] = USUBPASSINPUT; (*KeywordMap)["usubpassInputMS"] = USUBPASSINPUTMS; -#ifdef AMD_EXTENSIONS (*KeywordMap)["f16sampler1D"] = F16SAMPLER1D; (*KeywordMap)["f16sampler2D"] = F16SAMPLER2D; (*KeywordMap)["f16sampler3D"] = F16SAMPLER3D; @@ -685,25 +698,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; @@ -713,9 +711,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; @@ -756,14 +755,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. @@ -842,13 +844,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(); @@ -870,8 +874,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()) { @@ -902,16 +908,10 @@ int TScanContext::tokenizeIdentifier() 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; @@ -943,20 +943,66 @@ int TScanContext::tokenizeIdentifier() parserToken->sType.lex.b = false; return keyword; - case ATTRIBUTE: - case VARYING: - if (parseContext.profile == EEsProfile && parseContext.version >= 300) - reservedWord(); - return keyword; - - case BUFFER: - afterBuffer = true; - if ((parseContext.profile == EEsProfile && parseContext.version < 310) || - (parseContext.profile != EEsProfile && parseContext.version < 430)) + 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 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(); -#ifdef NV_EXTENSIONS + 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); + } + +#ifndef GLSLANG_WEB + case NOPERSPECTIVE: + if (parseContext.isEsProfile() && parseContext.version >= 300 && + 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 BUFFER: + afterBuffer = true; + if ((parseContext.isEsProfile() && parseContext.version < 310) || + (!parseContext.isEsProfile() && parseContext.version < 430)) + return identifierOrType(); + return keyword; case PAYLOADNV: case PAYLOADINNV: case HITATTRNV: @@ -964,14 +1010,12 @@ int TScanContext::tokenizeIdentifier() case CALLDATAINNV: case ACCSTRUCTNV: if (parseContext.symbolTable.atBuiltInLevel() || - (parseContext.profile != EEsProfile && parseContext.version >= 460 + (!parseContext.isEsProfile() && parseContext.version >= 460 && 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); @@ -985,53 +1029,52 @@ 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); + case SHARED: + if ((parseContext.isEsProfile() && parseContext.version < 300) || + (!parseContext.isEsProfile() && parseContext.version < 140)) + return identifierOrType(); + return keyword; +#endif + + 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: @@ -1050,6 +1093,7 @@ int TScanContext::tokenizeIdentifier() case MAT4X4: return matNxM(); +#ifndef GLSLANG_WEB case DMAT2: case DMAT3: case DMAT4: @@ -1080,7 +1124,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); @@ -1104,7 +1148,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(); @@ -1123,7 +1167,7 @@ int TScanContext::tokenizeIdentifier() case DVEC3: case DVEC4: afterType = true; - if (parseContext.profile == EEsProfile || parseContext.version < 400) + if (parseContext.isEsProfile() || parseContext.version < 400) reservedWord(); return keyword; @@ -1137,7 +1181,7 @@ int TScanContext::tokenizeIdentifier() case U64VEC4: afterType = true; if (parseContext.symbolTable.atBuiltInLevel() || - (parseContext.profile != EEsProfile && parseContext.version >= 450 && + (!parseContext.isEsProfile() && 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)))) @@ -1157,7 +1201,7 @@ int TScanContext::tokenizeIdentifier() ((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.isEsProfile() && parseContext.version >= 450)) return keyword; return identifierOrType(); @@ -1171,11 +1215,8 @@ 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.isEsProfile() && parseContext.version >= 450 && + (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)))) @@ -1193,7 +1234,7 @@ int TScanContext::tokenizeIdentifier() 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.isEsProfile() && parseContext.version >= 450)) return keyword; return identifierOrType(); case FLOAT32_T: @@ -1216,7 +1257,7 @@ int TScanContext::tokenizeIdentifier() 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.isEsProfile() && parseContext.version >= 450)) return keyword; return identifierOrType(); @@ -1240,7 +1281,7 @@ int TScanContext::tokenizeIdentifier() 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.isEsProfile() && parseContext.version >= 450)) return keyword; return identifierOrType(); @@ -1250,11 +1291,8 @@ 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.isEsProfile() && parseContext.version >= 450 && + (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)))) @@ -1276,37 +1314,27 @@ 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.isEsProfile() && parseContext.version >= 450 && + (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(); +#endif case SAMPLERCUBEARRAY: case SAMPLERCUBEARRAYSHADOW: 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 UINT: case UVEC2: case UVEC3: @@ -1325,6 +1353,30 @@ 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; + +#ifndef GLSLANG_WEB + case ISAMPLER1D: + case ISAMPLER1DARRAY: + case SAMPLER1DARRAYSHADOW: + case USAMPLER1D: + case USAMPLER1DARRAY: + afterType = true; + return es30ReservedFromGLSL(130); case ISAMPLER2DRECT: case USAMPLER2DRECT: afterType = true; @@ -1332,7 +1384,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); @@ -1340,7 +1392,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); @@ -1349,7 +1401,7 @@ int TScanContext::tokenizeIdentifier() case ISAMPLER2DMS: case USAMPLER2DMS: afterType = true; - if (parseContext.profile == EEsProfile && parseContext.version >= 310) + if (parseContext.isEsProfile() && parseContext.version >= 310) return keyword; return es30ReservedFromGLSL(150); @@ -1357,7 +1409,7 @@ 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; return es30ReservedFromGLSL(150); @@ -1365,30 +1417,14 @@ int TScanContext::tokenizeIdentifier() 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()) @@ -1400,10 +1436,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; @@ -1473,7 +1509,6 @@ int TScanContext::tokenizeIdentifier() else return identifierOrType(); -#ifdef AMD_EXTENSIONS case F16SAMPLER1D: case F16SAMPLER2D: case F16SAMPLER3D: @@ -1522,98 +1557,42 @@ int TScanContext::tokenizeIdentifier() afterType = true; if (parseContext.symbolTable.atBuiltInLevel() || (parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float_fetch) && - parseContext.profile != EEsProfile && parseContext.version >= 450)) + !parseContext.isEsProfile() && parseContext.version >= 450)) 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 && + if (!parseContext.isEsProfile() && parseContext.version >= 450 && 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.isEsProfile() && parseContext.version >= 320)) && 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; @@ -1622,11 +1601,20 @@ 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); @@ -1645,7 +1633,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; @@ -1675,7 +1663,7 @@ int TScanContext::identifierOrReserved(bool reserved) return 0; } - if (parseContext.forwardCompatible) + if (parseContext.isForwardCompatible()) parseContext.warn(loc, "using future reserved keyword", tokenText, ""); return identifierOrType(); @@ -1688,13 +1676,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; @@ -1704,9 +1692,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(); @@ -1717,10 +1705,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(); @@ -1733,7 +1721,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(); @@ -1743,16 +1731,16 @@ 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) return keyword; - if (parseContext.forwardCompatible) + if (parseContext.isForwardCompatible()) parseContext.warn(loc, "using future type keyword", tokenText, ""); return identifierOrType(); @@ -1761,19 +1749,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(); @@ -1781,17 +1769,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/glslang/MachineIndependent/ShaderLang.cpp b/glslang/MachineIndependent/ShaderLang.cpp index fa21db94..f63305e1 100755 --- a/glslang/MachineIndependent/ShaderLang.cpp +++ b/glslang/MachineIndependent/ShaderLang.cpp @@ -326,6 +326,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)) { @@ -347,7 +348,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, @@ -377,8 +377,6 @@ bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TS infoSink, commonTable, symbolTables); #endif - - return true; } @@ -479,11 +477,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 +581,7 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo break; } +#ifndef GLSLANG_WEB // Correct for stage type... switch (stage) { case EShLangGeometry: @@ -612,7 +613,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 +633,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 +645,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 +669,7 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo break; } } +#endif return correct; } @@ -833,13 +828,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 +851,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 +859,7 @@ bool ProcessDeferred( << "), while in source code it is (" << version << ", " << ProfileName(profile) << ")\n"; } - +#endif if (versionNotFound) { versionNotFirstToken = false; versionNotFirst = false; @@ -872,6 +872,7 @@ bool ProcessDeferred( bool goodVersion = DeduceVersionProfile(compiler->infoSink, stage, versionNotFirst, defaultVersion, source, version, profile, spvVersion); bool versionWillBeError = (versionNotFound || (profile == EEsProfile && version >= 300 && versionNotFirst)); +#ifndef GLSLANG_WEB bool warnVersionNotFirst = false; if (! versionWillBeError && versionNotFirstToken) { if (messages & EShMsgRelaxedErrors) @@ -879,6 +880,7 @@ bool ProcessDeferred( else versionWillBeError = true; } +#endif intermediate.setSource(source); intermediate.setVersion(version); @@ -887,8 +889,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 +942,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 +979,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 +1177,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 +1209,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 +1242,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 +1761,11 @@ void TShader::addProcesses(const std::vector& 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 +1793,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,13 +1804,16 @@ void TShader::setUniformLocationBase(int base) { intermediate->setUniformLocationBase(base); } +void TShader::setNoStorageFormat(bool useUnknownFormat) { intermediate->setNoStorageFormat(useUnknownFormat); } +void TShader::setResourceSetBinding(const std::vector& 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); } -void TShader::setNoStorageFormat(bool useUnknownFormat) { intermediate->setNoStorageFormat(useUnknownFormat); } -void TShader::setNanMinMaxClamp(bool useNonNan) { intermediate->setNanMinMaxClamp(useNonNan); } -void TShader::setResourceSetBinding(const std::vector& base) { intermediate->setResourceSetBinding(base); } -void TShader::setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode) { intermediate->setTextureSamplerTransformMode(mode); } +#endif // // Turn the shader strings into a parse tree in the TIntermediate. @@ -1817,6 +1837,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. // @@ -1841,6 +1862,7 @@ bool TShader::preprocess(const TBuiltInResource* builtInResources, defaultProfile, forceDefaultVersionAndProfile, forwardCompatible, message, includer, *intermediate, output_string); } +#endif const char* TShader::getInfoLog() { @@ -1852,7 +1874,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; @@ -1864,9 +1890,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]) @@ -1911,6 +1938,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) { @@ -1959,7 +1987,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) @@ -1978,6 +2008,8 @@ const char* TProgram::getInfoDebugLog() return infoSink->debug.c_str(); } +#ifndef GLSLANG_WEB + // // Reflection implementation. // @@ -2035,21 +2067,26 @@ 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/glslang/MachineIndependent/SymbolTable.cpp b/glslang/MachineIndependent/SymbolTable.cpp index f4d97d22..2ea14af2 100755 --- a/glslang/MachineIndependent/SymbolTable.cpp +++ b/glslang/MachineIndependent/SymbolTable.cpp @@ -61,54 +61,56 @@ 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 } @@ -117,7 +119,7 @@ void TType::buildMangledName(TString& mangledName) const 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()) { @@ -128,7 +130,7 @@ void TType::buildMangledName(TString& mangledName) const } } - if (sampler.ms) + if (sampler.isMultiSample()) mangledName += "M"; break; case EbtStruct: @@ -172,6 +174,8 @@ void TType::buildMangledName(TString& mangledName) const } } +#ifndef GLSLANG_WEB + // // Dump functions. // @@ -250,6 +254,8 @@ void TSymbolTable::dump(TInfoSink& infoSink, bool complete) const } } +#endif + // // Functions have buried pointers to delete. // diff --git a/glslang/MachineIndependent/SymbolTable.h b/glslang/MachineIndependent/SymbolTable.h index f3873cff..40ca3da5 100755 --- a/glslang/MachineIndependent/SymbolTable.h +++ b/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/glslang/MachineIndependent/Versions.cpp b/glslang/MachineIndependent/Versions.cpp index e2519188..eb1314a6 100644 --- a/glslang/MachineIndependent/Versions.cpp +++ b/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 @@ -221,7 +223,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; @@ -232,9 +233,7 @@ 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_NV_sample_mask_override_coverage] = EBhDisable; extensionBehavior[E_SPV_NV_geometry_shader_passthrough] = EBhDisable; extensionBehavior[E_GL_NV_viewport_array2] = EBhDisable; @@ -250,10 +249,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; @@ -302,15 +301,19 @@ void TParseVersions::initializeExtensionBehavior() extensionBehavior[E_GL_EXT_shader_explicit_arithmetic_types_float32] = EBhDisable; extensionBehavior[E_GL_EXT_shader_explicit_arithmetic_types_float64] = 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" @@ -350,11 +353,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 = @@ -412,7 +413,6 @@ void TParseVersions::getPreamble(std::string& preamble) "#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" @@ -423,9 +423,7 @@ 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_NV_sample_mask_override_coverage 1\n" "#define GL_NV_geometry_shader_passthrough 1\n" "#define GL_NV_viewport_array2 1\n" @@ -438,8 +436,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" @@ -458,10 +456,12 @@ 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" @@ -481,6 +481,7 @@ void TParseVersions::getPreamble(std::string& preamble) "#define GL_GOOGLE_cpp_style_line_directive 1\n" "#define GL_GOOGLE_include_directive 1\n" ; +#endif // #define VULKAN XXXX const int numberBufSize = 12; @@ -491,6 +492,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 "; @@ -498,22 +501,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 } // @@ -523,12 +511,12 @@ const char* StageName(EShLanguage stage) { switch(stage) { case EShLangVertex: return "vertex"; + case EShLangFragment: return "fragment"; +#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"; @@ -542,53 +530,6 @@ const char* StageName(EShLanguage stage) } } -// -// When to use profileRequires(): -// -// If a set of profiles have the same requirements for what version or extensions -// are needed to support a feature. -// -// It must be called for each profile that needs protection. Use requireProfile() first -// to reduce that set of profiles. -// -// Operation: Will issue warnings/errors based on the current profile, version, and extension -// behaviors. It only checks extensions when the current profile is one of the profileMask. -// -// A minVersion of 0 means no version of the profileMask support this in core, -// the extension must be present. -// - -// 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) -{ - if (profile & profileMask) { - bool okay = false; - if (minVersion > 0 && version >= minVersion) - okay = true; - for (int i = 0; i < numExtensions; ++i) { - switch (getExtensionBehavior(extensions[i])) { - case EBhWarn: - infoSink.info.message(EPrefixWarning, ("extension " + TString(extensions[i]) + " is being used for " + featureDesc).c_str(), loc); - // fall through - case EBhRequire: - case EBhEnable: - okay = true; - break; - default: break; // some compilers want this - } - } - - 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) -{ - profileRequires(loc, profileMask, minVersion, extension ? 1 : 0, &extension, featureDesc); -} - // // When to use requireStage() // @@ -609,6 +550,75 @@ void TParseVersions::requireStage(const TSourceLoc& loc, EShLanguage stage, cons requireStage(loc, static_cast(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 +// are needed to support a feature. +// +// It must be called for each profile that needs protection. Use requireProfile() first +// to reduce that set of profiles. +// +// Operation: Will issue warnings/errors based on the current profile, version, and extension +// behaviors. It only checks extensions when the current profile is one of the profileMask. +// +// A minVersion of 0 means no version of the profileMask support this in core, +// the extension must be present. +// + +// 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) +{ + if (profile & profileMask) { + bool okay = minVersion > 0 && version >= minVersion; +#ifndef GLSLANG_WEB + for (int i = 0; i < numExtensions; ++i) { + switch (getExtensionBehavior(extensions[i])) { + case EBhWarn: + infoSink.info.message(EPrefixWarning, ("extension " + TString(extensions[i]) + " is being used for " + featureDesc).c_str(), loc); + // fall through + case EBhRequire: + case EBhEnable: + okay = true; + break; + 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) +{ + profileRequires(loc, profileMask, minVersion, extension ? 1 : 0, &extension, featureDesc); +} + +void TParseVersions::unimplemented(const TSourceLoc& loc, const char* featureDesc) +{ + error(loc, "feature not yet implemented", featureDesc, ""); +} + // // Within a set of profiles, see if a feature is deprecated and give an error or warning based on whether // a future compatibility context is being use. @@ -642,11 +652,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) @@ -815,12 +820,12 @@ 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) updateExtensionBehavior(line, "GL_EXT_buffer_reference", behaviorString); + else if (strcmp(extension, "GL_NV_integer_cooperative_matrix") == 0) + updateExtensionBehavior(line, "GL_NV_cooperative_matrix", behaviorString); } void TParseVersions::updateExtensionBehavior(const char* extension, TExtensionBehavior behavior) @@ -866,7 +871,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), @@ -874,7 +878,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. @@ -896,9 +899,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); @@ -908,9 +909,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); @@ -919,9 +918,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); @@ -943,9 +940,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()); @@ -959,9 +954,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()); @@ -984,9 +977,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}; @@ -1026,7 +1017,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) { @@ -1036,16 +1026,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); @@ -1056,9 +1043,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}; @@ -1108,6 +1093,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) { @@ -1125,15 +1118,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/glslang/MachineIndependent/Versions.h b/glslang/MachineIndependent/Versions.h index 809ba746..9535c891 100644 --- a/glslang/MachineIndependent/Versions.h +++ b/glslang/MachineIndependent/Versions.h @@ -193,7 +193,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"; @@ -204,9 +203,6 @@ 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_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"; @@ -228,10 +224,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"; diff --git a/glslang/MachineIndependent/attribute.cpp b/glslang/MachineIndependent/attribute.cpp index d4a23f39..95855183 100644 --- a/glslang/MachineIndependent/attribute.cpp +++ b/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/glslang/MachineIndependent/gl_types.h b/glslang/MachineIndependent/gl_types.h index c9fee9ec..b6f613bc 100644 --- a/glslang/MachineIndependent/gl_types.h +++ b/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/glslang/MachineIndependent/glslang.m4 b/glslang/MachineIndependent/glslang.m4 new file mode 100644 index 00000000..6ace0380 --- /dev/null +++ b/glslang/MachineIndependent/glslang.m4 @@ -0,0 +1,3799 @@ +// +// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. +// Copyright (C) 2012-2013 LunarG, Inc. +// Copyright (C) 2017 ARM Limited. +// Copyright (C) 2015-2018 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. +// + +// +// Do not edit the .y file, only edit the .m4 file. +// The .y bison file is not a source file, it is a derivitive 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 exluded from the grammar when m4 is executed as: +// +// m4 -P -DGLSLANG_WEB +// +// It will be included when m4 is executed as: +// +// m4 -P +// + +m4_define(`GLSLANG_WEB_EXCLUDE_ON', `m4_ifdef(`GLSLANG_WEB', `m4_divert(`-1')')') +m4_define(`GLSLANG_WEB_EXCLUDE_OFF', `m4_ifdef(`GLSLANG_WEB', `m4_divert')') + +/** + * This is bison grammar and productions for parsing all versions of the + * GLSL shading languages. + */ +%{ + +/* Based on: +ANSI C Yacc grammar + +In 1985, Jeff Lee published his Yacc grammar (which is accompanied by a +matching Lex specification) for the April 30, 1985 draft version of the +ANSI C standard. Tom Stockfisch reposted it to net.sources in 1987; that +original, as mentioned in the answer to question 17.25 of the comp.lang.c +FAQ, can be ftp'ed from ftp.uu.net, file usenet/net.sources/ansi.c.grammar.Z. + +I intend to keep this version as close to the current C Standard grammar as +possible; please let me know if you discover discrepancies. + +Jutta Degener, 1995 +*/ + +#include "SymbolTable.h" +#include "ParseHelper.h" +#include "../Public/ShaderLang.h" +#include "attribute.h" + +using namespace glslang; + +%} + +%define parse.error verbose + +%union { + struct { + glslang::TSourceLoc loc; + union { + glslang::TString *string; + int i; + unsigned int u; + long long i64; + unsigned long long u64; + bool b; + double d; + }; + glslang::TSymbol* symbol; + } lex; + struct { + glslang::TSourceLoc loc; + glslang::TOperator op; + union { + TIntermNode* intermNode; + glslang::TIntermNodePair nodePair; + glslang::TIntermTyped* intermTypedNode; + glslang::TAttributes* attributes; + }; + union { + glslang::TPublicType type; + glslang::TFunction* function; + glslang::TParameter param; + glslang::TTypeLoc typeLine; + glslang::TTypeList* typeList; + glslang::TArraySizes* arraySizes; + glslang::TIdentifierList* identifierList; + }; + glslang::TArraySizes* typeParameters; + } interm; +} + +%{ + +/* windows only pragma */ +#ifdef _MSC_VER + #pragma warning(disable : 4065) + #pragma warning(disable : 4127) + #pragma warning(disable : 4244) +#endif + +#define parseContext (*pParseContext) +#define yyerror(context, msg) context->parserError(msg) + +extern int yylex(YYSTYPE*, TParseContext&); + +%} + +%parse-param {glslang::TParseContext* pParseContext} +%lex-param {parseContext} +%pure-parser // enable thread safety +%expect 1 // One shift reduce conflict because of if | else + +%token CONST BOOL INT UINT FLOAT +%token BVEC2 BVEC3 BVEC4 +%token IVEC2 IVEC3 IVEC4 +%token UVEC2 UVEC3 UVEC4 +%token VEC2 VEC3 VEC4 +%token MAT2 MAT3 MAT4 +%token MAT2X2 MAT2X3 MAT2X4 +%token MAT3X2 MAT3X3 MAT3X4 +%token MAT4X2 MAT4X3 MAT4X4 + +// combined image/sampler +%token SAMPLER2D SAMPLER3D SAMPLERCUBE SAMPLER2DSHADOW +%token SAMPLERCUBESHADOW SAMPLER2DARRAY +%token SAMPLER2DARRAYSHADOW ISAMPLER2D ISAMPLER3D ISAMPLERCUBE +%token ISAMPLER2DARRAY USAMPLER2D USAMPLER3D +%token USAMPLERCUBE USAMPLER2DARRAY +%token SAMPLERCUBEARRAY SAMPLERCUBEARRAYSHADOW +%token ISAMPLERCUBEARRAY USAMPLERCUBEARRAY + +GLSLANG_WEB_EXCLUDE_ON + +%token ATTRIBUTE VARYING +%token FLOAT16_T FLOAT32_T DOUBLE FLOAT64_T +%token INT64_T UINT64_T INT32_T UINT32_T INT16_T UINT16_T INT8_T UINT8_T +%token I64VEC2 I64VEC3 I64VEC4 +%token U64VEC2 U64VEC3 U64VEC4 +%token I32VEC2 I32VEC3 I32VEC4 +%token U32VEC2 U32VEC3 U32VEC4 +%token I16VEC2 I16VEC3 I16VEC4 +%token U16VEC2 U16VEC3 U16VEC4 +%token I8VEC2 I8VEC3 I8VEC4 +%token U8VEC2 U8VEC3 U8VEC4 +%token DVEC2 DVEC3 DVEC4 DMAT2 DMAT3 DMAT4 +%token F16VEC2 F16VEC3 F16VEC4 F16MAT2 F16MAT3 F16MAT4 +%token F32VEC2 F32VEC3 F32VEC4 F32MAT2 F32MAT3 F32MAT4 +%token F64VEC2 F64VEC3 F64VEC4 F64MAT2 F64MAT3 F64MAT4 +%token DMAT2X2 DMAT2X3 DMAT2X4 +%token DMAT3X2 DMAT3X3 DMAT3X4 +%token DMAT4X2 DMAT4X3 DMAT4X4 +%token F16MAT2X2 F16MAT2X3 F16MAT2X4 +%token F16MAT3X2 F16MAT3X3 F16MAT3X4 +%token F16MAT4X2 F16MAT4X3 F16MAT4X4 +%token F32MAT2X2 F32MAT2X3 F32MAT2X4 +%token F32MAT3X2 F32MAT3X3 F32MAT3X4 +%token F32MAT4X2 F32MAT4X3 F32MAT4X4 +%token F64MAT2X2 F64MAT2X3 F64MAT2X4 +%token F64MAT3X2 F64MAT3X3 F64MAT3X4 +%token F64MAT4X2 F64MAT4X3 F64MAT4X4 +%token ATOMIC_UINT +%token ACCSTRUCTNV +%token FCOOPMATNV ICOOPMATNV UCOOPMATNV + +// combined image/sampler +%token SAMPLER1D SAMPLER1DARRAY SAMPLER1DARRAYSHADOW ISAMPLER1D SAMPLER1DSHADOW +%token SAMPLER2DRECT SAMPLER2DRECTSHADOW ISAMPLER2DRECT USAMPLER2DRECT +%token SAMPLERBUFFER ISAMPLERBUFFER USAMPLERBUFFER +%token SAMPLER2DMS ISAMPLER2DMS USAMPLER2DMS +%token SAMPLER2DMSARRAY ISAMPLER2DMSARRAY USAMPLER2DMSARRAY +%token SAMPLEREXTERNALOES +%token SAMPLEREXTERNAL2DY2YEXT +%token ISAMPLER1DARRAY USAMPLER1D USAMPLER1DARRAY +%token F16SAMPLER1D F16SAMPLER2D F16SAMPLER3D F16SAMPLER2DRECT F16SAMPLERCUBE +%token F16SAMPLER1DARRAY F16SAMPLER2DARRAY F16SAMPLERCUBEARRAY +%token F16SAMPLERBUFFER F16SAMPLER2DMS F16SAMPLER2DMSARRAY +%token F16SAMPLER1DSHADOW F16SAMPLER2DSHADOW F16SAMPLER1DARRAYSHADOW F16SAMPLER2DARRAYSHADOW +%token F16SAMPLER2DRECTSHADOW F16SAMPLERCUBESHADOW F16SAMPLERCUBEARRAYSHADOW + +// images +%token IMAGE1D IIMAGE1D UIMAGE1D IMAGE2D IIMAGE2D +%token UIMAGE2D IMAGE3D IIMAGE3D UIMAGE3D +%token IMAGE2DRECT IIMAGE2DRECT UIMAGE2DRECT +%token IMAGECUBE IIMAGECUBE UIMAGECUBE +%token IMAGEBUFFER IIMAGEBUFFER UIMAGEBUFFER +%token IMAGE1DARRAY IIMAGE1DARRAY UIMAGE1DARRAY +%token IMAGE2DARRAY IIMAGE2DARRAY UIMAGE2DARRAY +%token IMAGECUBEARRAY IIMAGECUBEARRAY UIMAGECUBEARRAY +%token IMAGE2DMS IIMAGE2DMS UIMAGE2DMS +%token IMAGE2DMSARRAY IIMAGE2DMSARRAY UIMAGE2DMSARRAY + +%token F16IMAGE1D F16IMAGE2D F16IMAGE3D F16IMAGE2DRECT +%token F16IMAGECUBE F16IMAGE1DARRAY F16IMAGE2DARRAY F16IMAGECUBEARRAY +%token F16IMAGEBUFFER F16IMAGE2DMS F16IMAGE2DMSARRAY + +// pure sampler +%token SAMPLER SAMPLERSHADOW + +// texture without sampler +%token TEXTURE1D TEXTURE2D TEXTURE3D TEXTURECUBE +%token TEXTURE1DARRAY TEXTURE2DARRAY +%token ITEXTURE1D ITEXTURE2D ITEXTURE3D ITEXTURECUBE +%token ITEXTURE1DARRAY ITEXTURE2DARRAY UTEXTURE1D UTEXTURE2D UTEXTURE3D +%token UTEXTURECUBE UTEXTURE1DARRAY UTEXTURE2DARRAY +%token TEXTURE2DRECT ITEXTURE2DRECT UTEXTURE2DRECT +%token TEXTUREBUFFER ITEXTUREBUFFER UTEXTUREBUFFER +%token TEXTURECUBEARRAY ITEXTURECUBEARRAY UTEXTURECUBEARRAY +%token TEXTURE2DMS ITEXTURE2DMS UTEXTURE2DMS +%token TEXTURE2DMSARRAY ITEXTURE2DMSARRAY UTEXTURE2DMSARRAY + +%token F16TEXTURE1D F16TEXTURE2D F16TEXTURE3D F16TEXTURE2DRECT F16TEXTURECUBE +%token F16TEXTURE1DARRAY F16TEXTURE2DARRAY F16TEXTURECUBEARRAY +%token F16TEXTUREBUFFER F16TEXTURE2DMS F16TEXTURE2DMSARRAY + +// input attachments +%token SUBPASSINPUT SUBPASSINPUTMS ISUBPASSINPUT ISUBPASSINPUTMS USUBPASSINPUT USUBPASSINPUTMS +%token F16SUBPASSINPUT F16SUBPASSINPUTMS + +GLSLANG_WEB_EXCLUDE_OFF + +%token LEFT_OP RIGHT_OP +%token INC_OP DEC_OP LE_OP GE_OP EQ_OP NE_OP +%token AND_OP OR_OP XOR_OP MUL_ASSIGN DIV_ASSIGN ADD_ASSIGN +%token MOD_ASSIGN LEFT_ASSIGN RIGHT_ASSIGN AND_ASSIGN XOR_ASSIGN OR_ASSIGN +%token SUB_ASSIGN + +%token LEFT_PAREN RIGHT_PAREN LEFT_BRACKET RIGHT_BRACKET LEFT_BRACE RIGHT_BRACE DOT +%token COMMA COLON EQUAL SEMICOLON BANG DASH TILDE PLUS STAR SLASH PERCENT +%token LEFT_ANGLE RIGHT_ANGLE VERTICAL_BAR CARET AMPERSAND QUESTION + +%token INVARIANT +%token HIGH_PRECISION MEDIUM_PRECISION LOW_PRECISION PRECISION +%token PACKED RESOURCE SUPERP + +%token FLOATCONSTANT INTCONSTANT UINTCONSTANT BOOLCONSTANT +%token IDENTIFIER TYPE_NAME +%token CENTROID IN OUT INOUT +%token STRUCT VOID WHILE +%token BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT +%token UNIFORM SHARED +%token FLAT SMOOTH LAYOUT + +GLSLANG_WEB_EXCLUDE_ON +%token DOUBLECONSTANT INT16CONSTANT UINT16CONSTANT FLOAT16CONSTANT INT32CONSTANT UINT32CONSTANT +%token INT64CONSTANT UINT64CONSTANT +%token SUBROUTINE DEMOTE +%token PAYLOADNV PAYLOADINNV HITATTRNV CALLDATANV CALLDATAINNV +%token PATCH SAMPLE BUFFER NONUNIFORM +%token COHERENT VOLATILE RESTRICT READONLY WRITEONLY DEVICECOHERENT QUEUEFAMILYCOHERENT WORKGROUPCOHERENT +%token SUBGROUPCOHERENT NONPRIVATE +%token NOPERSPECTIVE EXPLICITINTERPAMD PERVERTEXNV PERPRIMITIVENV PERVIEWNV PERTASKNV +%token PRECISE +GLSLANG_WEB_EXCLUDE_OFF + +%type assignment_operator unary_operator +%type variable_identifier primary_expression postfix_expression +%type expression integer_expression assignment_expression +%type unary_expression multiplicative_expression additive_expression +%type relational_expression equality_expression +%type conditional_expression constant_expression +%type logical_or_expression logical_xor_expression logical_and_expression +%type shift_expression and_expression exclusive_or_expression inclusive_or_expression +%type function_call initializer condition conditionopt + +%type translation_unit function_definition +%type statement simple_statement +%type statement_list switch_statement_list compound_statement +%type declaration_statement selection_statement selection_statement_nonattributed expression_statement +%type switch_statement switch_statement_nonattributed case_label +%type declaration external_declaration +%type for_init_statement compound_statement_no_new_scope +%type selection_rest_statement for_rest_statement +%type iteration_statement iteration_statement_nonattributed jump_statement statement_no_new_scope statement_scoped +%type single_declaration init_declarator_list + +%type parameter_declaration parameter_declarator parameter_type_specifier + +%type array_specifier +%type invariant_qualifier interpolation_qualifier storage_qualifier precision_qualifier +%type layout_qualifier layout_qualifier_id_list layout_qualifier_id + +%type type_parameter_specifier +%type type_parameter_specifier_opt +%type type_parameter_specifier_list + +%type type_qualifier fully_specified_type type_specifier +%type single_type_qualifier +%type type_specifier_nonarray +%type struct_specifier +%type struct_declarator +%type struct_declarator_list struct_declaration struct_declaration_list +%type block_structure +%type function_header function_declarator +%type function_header_with_parameters +%type function_call_header_with_parameters function_call_header_no_parameters function_call_generic function_prototype +%type function_call_or_method function_identifier function_call_header + +%type identifier_list + +GLSLANG_WEB_EXCLUDE_ON +%type precise_qualifier non_uniform_qualifier +%type type_name_list +%type attribute attribute_list single_attribute +%type demote_statement +%type initializer_list +GLSLANG_WEB_EXCLUDE_OFF + +%start translation_unit +%% + +variable_identifier + : IDENTIFIER { + $$ = parseContext.handleVariable($1.loc, $1.symbol, $1.string); + } + ; + +primary_expression + : variable_identifier { + $$ = $1; + } + | LEFT_PAREN expression RIGHT_PAREN { + $$ = $2; + if ($$->getAsConstantUnion()) + $$->getAsConstantUnion()->setExpression(); + } + | FLOATCONSTANT { + $$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat, $1.loc, true); + } + | INTCONSTANT { + $$ = parseContext.intermediate.addConstantUnion($1.i, $1.loc, true); + } + | UINTCONSTANT { + parseContext.fullIntegerCheck($1.loc, "unsigned literal"); + $$ = parseContext.intermediate.addConstantUnion($1.u, $1.loc, true); + } + | BOOLCONSTANT { + $$ = parseContext.intermediate.addConstantUnion($1.b, $1.loc, true); + } +GLSLANG_WEB_EXCLUDE_ON + | 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); + } + | UINT64CONSTANT { + parseContext.int64Check($1.loc, "64-bit unsigned integer literal"); + $$ = parseContext.intermediate.addConstantUnion($1.u64, $1.loc, true); + } + | INT16CONSTANT { + parseContext.explicitInt16Check($1.loc, "16-bit integer literal"); + $$ = parseContext.intermediate.addConstantUnion((short)$1.i, $1.loc, true); + } + | UINT16CONSTANT { + parseContext.explicitInt16Check($1.loc, "16-bit unsigned integer literal"); + $$ = parseContext.intermediate.addConstantUnion((unsigned short)$1.u, $1.loc, true); + } + | DOUBLECONSTANT { + 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); + } +GLSLANG_WEB_EXCLUDE_OFF + ; + +postfix_expression + : primary_expression { + $$ = $1; + } + | postfix_expression LEFT_BRACKET integer_expression RIGHT_BRACKET { + $$ = parseContext.handleBracketDereference($2.loc, $1, $3); + } + | function_call { + $$ = $1; + } + | postfix_expression DOT IDENTIFIER { + $$ = parseContext.handleDotDereference($3.loc, $1, *$3.string); + } + | postfix_expression INC_OP { + parseContext.variableCheck($1); + parseContext.lValueErrorCheck($2.loc, "++", $1); + $$ = parseContext.handleUnaryMath($2.loc, "++", EOpPostIncrement, $1); + } + | postfix_expression DEC_OP { + parseContext.variableCheck($1); + parseContext.lValueErrorCheck($2.loc, "--", $1); + $$ = parseContext.handleUnaryMath($2.loc, "--", EOpPostDecrement, $1); + } + ; + +integer_expression + : expression { + parseContext.integerCheck($1, "[]"); + $$ = $1; + } + ; + +function_call + : function_call_or_method { + $$ = parseContext.handleFunctionCall($1.loc, $1.function, $1.intermNode); + delete $1.function; + } + ; + +function_call_or_method + : function_call_generic { + $$ = $1; + } + ; + +function_call_generic + : function_call_header_with_parameters RIGHT_PAREN { + $$ = $1; + $$.loc = $2.loc; + } + | function_call_header_no_parameters RIGHT_PAREN { + $$ = $1; + $$.loc = $2.loc; + } + ; + +function_call_header_no_parameters + : function_call_header VOID { + $$ = $1; + } + | function_call_header { + $$ = $1; + } + ; + +function_call_header_with_parameters + : function_call_header assignment_expression { + TParameter param = { 0, new TType }; + param.type->shallowCopy($2->getType()); + $1.function->addParameter(param); + $$.function = $1.function; + $$.intermNode = $2; + } + | function_call_header_with_parameters COMMA assignment_expression { + TParameter param = { 0, new TType }; + param.type->shallowCopy($3->getType()); + $1.function->addParameter(param); + $$.function = $1.function; + $$.intermNode = parseContext.intermediate.growAggregate($1.intermNode, $3, $2.loc); + } + ; + +function_call_header + : function_identifier LEFT_PAREN { + $$ = $1; + } + ; + +// Grammar Note: Constructors look like functions, but are recognized as types. + +function_identifier + : type_specifier { + // Constructor + $$.intermNode = 0; + $$.function = parseContext.handleConstructorCall($1.loc, $1); + } + | postfix_expression { + // + // Should be a method or subroutine call, but we haven't recognized the arguments yet. + // + $$.function = 0; + $$.intermNode = 0; + + TIntermMethod* method = $1->getAsMethodNode(); + if (method) { + $$.function = new TFunction(&method->getMethodName(), TType(EbtInt), EOpArrayLength); + $$.intermNode = method->getObject(); + } else { + TIntermSymbol* symbol = $1->getAsSymbolNode(); + if (symbol) { + parseContext.reservedErrorCheck(symbol->getLoc(), symbol->getName()); + TFunction *function = new TFunction(&symbol->getName(), TType(EbtVoid)); + $$.function = function; + } else + parseContext.error($1->getLoc(), "function call, method, or subroutine call expected", "", ""); + } + + if ($$.function == 0) { + // error recover + TString* empty = NewPoolTString(""); + $$.function = new TFunction(empty, TType(EbtVoid), EOpNull); + } + } +GLSLANG_WEB_EXCLUDE_ON + | non_uniform_qualifier { + // Constructor + $$.intermNode = 0; + $$.function = parseContext.handleConstructorCall($1.loc, $1); + } +GLSLANG_WEB_EXCLUDE_OFF + ; + +unary_expression + : postfix_expression { + parseContext.variableCheck($1); + $$ = $1; + if (TIntermMethod* method = $1->getAsMethodNode()) + parseContext.error($1->getLoc(), "incomplete method syntax", method->getMethodName().c_str(), ""); + } + | INC_OP unary_expression { + parseContext.lValueErrorCheck($1.loc, "++", $2); + $$ = parseContext.handleUnaryMath($1.loc, "++", EOpPreIncrement, $2); + } + | DEC_OP unary_expression { + parseContext.lValueErrorCheck($1.loc, "--", $2); + $$ = parseContext.handleUnaryMath($1.loc, "--", EOpPreDecrement, $2); + } + | unary_operator unary_expression { + if ($1.op != EOpNull) { + char errorOp[2] = {0, 0}; + switch($1.op) { + case EOpNegative: errorOp[0] = '-'; break; + case EOpLogicalNot: errorOp[0] = '!'; break; + case EOpBitwiseNot: errorOp[0] = '~'; break; + default: break; // some compilers want this + } + $$ = parseContext.handleUnaryMath($1.loc, errorOp, $1.op, $2); + } else { + $$ = $2; + if ($$->getAsConstantUnion()) + $$->getAsConstantUnion()->setExpression(); + } + } + ; +// Grammar Note: No traditional style type casts. + +unary_operator + : PLUS { $$.loc = $1.loc; $$.op = EOpNull; } + | DASH { $$.loc = $1.loc; $$.op = EOpNegative; } + | BANG { $$.loc = $1.loc; $$.op = EOpLogicalNot; } + | TILDE { $$.loc = $1.loc; $$.op = EOpBitwiseNot; + parseContext.fullIntegerCheck($1.loc, "bitwise not"); } + ; +// Grammar Note: No '*' or '&' unary ops. Pointers are not supported. + +multiplicative_expression + : unary_expression { $$ = $1; } + | multiplicative_expression STAR unary_expression { + $$ = parseContext.handleBinaryMath($2.loc, "*", EOpMul, $1, $3); + if ($$ == 0) + $$ = $1; + } + | multiplicative_expression SLASH unary_expression { + $$ = parseContext.handleBinaryMath($2.loc, "/", EOpDiv, $1, $3); + if ($$ == 0) + $$ = $1; + } + | multiplicative_expression PERCENT unary_expression { + parseContext.fullIntegerCheck($2.loc, "%"); + $$ = parseContext.handleBinaryMath($2.loc, "%", EOpMod, $1, $3); + if ($$ == 0) + $$ = $1; + } + ; + +additive_expression + : multiplicative_expression { $$ = $1; } + | additive_expression PLUS multiplicative_expression { + $$ = parseContext.handleBinaryMath($2.loc, "+", EOpAdd, $1, $3); + if ($$ == 0) + $$ = $1; + } + | additive_expression DASH multiplicative_expression { + $$ = parseContext.handleBinaryMath($2.loc, "-", EOpSub, $1, $3); + if ($$ == 0) + $$ = $1; + } + ; + +shift_expression + : additive_expression { $$ = $1; } + | shift_expression LEFT_OP additive_expression { + parseContext.fullIntegerCheck($2.loc, "bit shift left"); + $$ = parseContext.handleBinaryMath($2.loc, "<<", EOpLeftShift, $1, $3); + if ($$ == 0) + $$ = $1; + } + | shift_expression RIGHT_OP additive_expression { + parseContext.fullIntegerCheck($2.loc, "bit shift right"); + $$ = parseContext.handleBinaryMath($2.loc, ">>", EOpRightShift, $1, $3); + if ($$ == 0) + $$ = $1; + } + ; + +relational_expression + : shift_expression { $$ = $1; } + | relational_expression LEFT_ANGLE shift_expression { + $$ = parseContext.handleBinaryMath($2.loc, "<", EOpLessThan, $1, $3); + if ($$ == 0) + $$ = parseContext.intermediate.addConstantUnion(false, $2.loc); + } + | relational_expression RIGHT_ANGLE shift_expression { + $$ = parseContext.handleBinaryMath($2.loc, ">", EOpGreaterThan, $1, $3); + if ($$ == 0) + $$ = parseContext.intermediate.addConstantUnion(false, $2.loc); + } + | relational_expression LE_OP shift_expression { + $$ = parseContext.handleBinaryMath($2.loc, "<=", EOpLessThanEqual, $1, $3); + if ($$ == 0) + $$ = parseContext.intermediate.addConstantUnion(false, $2.loc); + } + | relational_expression GE_OP shift_expression { + $$ = parseContext.handleBinaryMath($2.loc, ">=", EOpGreaterThanEqual, $1, $3); + if ($$ == 0) + $$ = parseContext.intermediate.addConstantUnion(false, $2.loc); + } + ; + +equality_expression + : relational_expression { $$ = $1; } + | equality_expression EQ_OP relational_expression { + parseContext.arrayObjectCheck($2.loc, $1->getType(), "array comparison"); + parseContext.opaqueCheck($2.loc, $1->getType(), "=="); + parseContext.specializationCheck($2.loc, $1->getType(), "=="); + parseContext.referenceCheck($2.loc, $1->getType(), "=="); + $$ = parseContext.handleBinaryMath($2.loc, "==", EOpEqual, $1, $3); + if ($$ == 0) + $$ = parseContext.intermediate.addConstantUnion(false, $2.loc); + } + | equality_expression NE_OP relational_expression { + parseContext.arrayObjectCheck($2.loc, $1->getType(), "array comparison"); + parseContext.opaqueCheck($2.loc, $1->getType(), "!="); + parseContext.specializationCheck($2.loc, $1->getType(), "!="); + parseContext.referenceCheck($2.loc, $1->getType(), "!="); + $$ = parseContext.handleBinaryMath($2.loc, "!=", EOpNotEqual, $1, $3); + if ($$ == 0) + $$ = parseContext.intermediate.addConstantUnion(false, $2.loc); + } + ; + +and_expression + : equality_expression { $$ = $1; } + | and_expression AMPERSAND equality_expression { + parseContext.fullIntegerCheck($2.loc, "bitwise and"); + $$ = parseContext.handleBinaryMath($2.loc, "&", EOpAnd, $1, $3); + if ($$ == 0) + $$ = $1; + } + ; + +exclusive_or_expression + : and_expression { $$ = $1; } + | exclusive_or_expression CARET and_expression { + parseContext.fullIntegerCheck($2.loc, "bitwise exclusive or"); + $$ = parseContext.handleBinaryMath($2.loc, "^", EOpExclusiveOr, $1, $3); + if ($$ == 0) + $$ = $1; + } + ; + +inclusive_or_expression + : exclusive_or_expression { $$ = $1; } + | inclusive_or_expression VERTICAL_BAR exclusive_or_expression { + parseContext.fullIntegerCheck($2.loc, "bitwise inclusive or"); + $$ = parseContext.handleBinaryMath($2.loc, "|", EOpInclusiveOr, $1, $3); + if ($$ == 0) + $$ = $1; + } + ; + +logical_and_expression + : inclusive_or_expression { $$ = $1; } + | logical_and_expression AND_OP inclusive_or_expression { + $$ = parseContext.handleBinaryMath($2.loc, "&&", EOpLogicalAnd, $1, $3); + if ($$ == 0) + $$ = parseContext.intermediate.addConstantUnion(false, $2.loc); + } + ; + +logical_xor_expression + : logical_and_expression { $$ = $1; } + | logical_xor_expression XOR_OP logical_and_expression { + $$ = parseContext.handleBinaryMath($2.loc, "^^", EOpLogicalXor, $1, $3); + if ($$ == 0) + $$ = parseContext.intermediate.addConstantUnion(false, $2.loc); + } + ; + +logical_or_expression + : logical_xor_expression { $$ = $1; } + | logical_or_expression OR_OP logical_xor_expression { + $$ = parseContext.handleBinaryMath($2.loc, "||", EOpLogicalOr, $1, $3); + if ($$ == 0) + $$ = parseContext.intermediate.addConstantUnion(false, $2.loc); + } + ; + +conditional_expression + : logical_or_expression { $$ = $1; } + | logical_or_expression QUESTION { + ++parseContext.controlFlowNestingLevel; + } + expression COLON assignment_expression { + --parseContext.controlFlowNestingLevel; + parseContext.boolCheck($2.loc, $1); + parseContext.rValueErrorCheck($2.loc, "?", $1); + parseContext.rValueErrorCheck($5.loc, ":", $4); + parseContext.rValueErrorCheck($5.loc, ":", $6); + $$ = parseContext.intermediate.addSelection($1, $4, $6, $2.loc); + if ($$ == 0) { + parseContext.binaryOpError($2.loc, ":", $4->getCompleteString(), $6->getCompleteString()); + $$ = $6; + } + } + ; + +assignment_expression + : conditional_expression { $$ = $1; } + | unary_expression assignment_operator assignment_expression { + parseContext.arrayObjectCheck($2.loc, $1->getType(), "array assignment"); + parseContext.opaqueCheck($2.loc, $1->getType(), "="); + parseContext.storage16BitAssignmentCheck($2.loc, $1->getType(), "="); + parseContext.specializationCheck($2.loc, $1->getType(), "="); + parseContext.lValueErrorCheck($2.loc, "assign", $1); + parseContext.rValueErrorCheck($2.loc, "assign", $3); + $$ = parseContext.intermediate.addAssign($2.op, $1, $3, $2.loc); + if ($$ == 0) { + parseContext.assignError($2.loc, "assign", $1->getCompleteString(), $3->getCompleteString()); + $$ = $1; + } + } + ; + +assignment_operator + : EQUAL { + $$.loc = $1.loc; + $$.op = EOpAssign; + } + | MUL_ASSIGN { + $$.loc = $1.loc; + $$.op = EOpMulAssign; + } + | DIV_ASSIGN { + $$.loc = $1.loc; + $$.op = EOpDivAssign; + } + | MOD_ASSIGN { + parseContext.fullIntegerCheck($1.loc, "%="); + $$.loc = $1.loc; + $$.op = EOpModAssign; + } + | ADD_ASSIGN { + $$.loc = $1.loc; + $$.op = EOpAddAssign; + } + | SUB_ASSIGN { + $$.loc = $1.loc; + $$.op = EOpSubAssign; + } + | LEFT_ASSIGN { + parseContext.fullIntegerCheck($1.loc, "bit-shift left assign"); + $$.loc = $1.loc; $$.op = EOpLeftShiftAssign; + } + | RIGHT_ASSIGN { + parseContext.fullIntegerCheck($1.loc, "bit-shift right assign"); + $$.loc = $1.loc; $$.op = EOpRightShiftAssign; + } + | AND_ASSIGN { + parseContext.fullIntegerCheck($1.loc, "bitwise-and assign"); + $$.loc = $1.loc; $$.op = EOpAndAssign; + } + | XOR_ASSIGN { + parseContext.fullIntegerCheck($1.loc, "bitwise-xor assign"); + $$.loc = $1.loc; $$.op = EOpExclusiveOrAssign; + } + | OR_ASSIGN { + parseContext.fullIntegerCheck($1.loc, "bitwise-or assign"); + $$.loc = $1.loc; $$.op = EOpInclusiveOrAssign; + } + ; + +expression + : assignment_expression { + $$ = $1; + } + | expression COMMA assignment_expression { + parseContext.samplerConstructorLocationCheck($2.loc, ",", $3); + $$ = parseContext.intermediate.addComma($1, $3, $2.loc); + if ($$ == 0) { + parseContext.binaryOpError($2.loc, ",", $1->getCompleteString(), $3->getCompleteString()); + $$ = $3; + } + } + ; + +constant_expression + : conditional_expression { + parseContext.constantValueCheck($1, ""); + $$ = $1; + } + ; + +declaration + : function_prototype SEMICOLON { + parseContext.handleFunctionDeclarator($1.loc, *$1.function, true /* prototype */); + $$ = 0; + // TODO: 4.0 functionality: subroutines: make the identifier a user type for this signature + } + | init_declarator_list SEMICOLON { + if ($1.intermNode && $1.intermNode->getAsAggregate()) + $1.intermNode->getAsAggregate()->setOperator(EOpSequence); + $$ = $1.intermNode; + } + | 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); + $$ = 0; + } + | block_structure SEMICOLON { + parseContext.declareBlock($1.loc, *$1.typeList); + $$ = 0; + } + | block_structure IDENTIFIER SEMICOLON { + parseContext.declareBlock($1.loc, *$1.typeList, $2.string); + $$ = 0; + } + | block_structure IDENTIFIER array_specifier SEMICOLON { + parseContext.declareBlock($1.loc, *$1.typeList, $2.string, $3.arraySizes); + $$ = 0; + } + | type_qualifier SEMICOLON { + parseContext.globalQualifierFixCheck($1.loc, $1.qualifier); + parseContext.updateStandaloneQualifierDefaults($1.loc, $1); + $$ = 0; + } + | type_qualifier IDENTIFIER SEMICOLON { + parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers); + parseContext.addQualifierToExisting($1.loc, $1.qualifier, *$2.string); + $$ = 0; + } + | type_qualifier IDENTIFIER identifier_list SEMICOLON { + parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers); + $3->push_back($2.string); + parseContext.addQualifierToExisting($1.loc, $1.qualifier, *$3); + $$ = 0; + } + ; + +block_structure + : type_qualifier IDENTIFIER LEFT_BRACE { parseContext.nestedBlockCheck($1.loc); } struct_declaration_list RIGHT_BRACE { + --parseContext.structNestingLevel; + parseContext.blockName = $2.string; + parseContext.globalQualifierFixCheck($1.loc, $1.qualifier); + parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers); + parseContext.currentBlockQualifier = $1.qualifier; + $$.loc = $1.loc; + $$.typeList = $5; + } + +identifier_list + : COMMA IDENTIFIER { + $$ = new TIdentifierList; + $$->push_back($2.string); + } + | identifier_list COMMA IDENTIFIER { + $$ = $1; + $$->push_back($3.string); + } + ; + +function_prototype + : function_declarator RIGHT_PAREN { + $$.function = $1; + $$.loc = $2.loc; + } + ; + +function_declarator + : function_header { + $$ = $1; + } + | function_header_with_parameters { + $$ = $1; + } + ; + + +function_header_with_parameters + : function_header parameter_declaration { + // Add the parameter + $$ = $1; + if ($2.param.type->getBasicType() != EbtVoid) + $1->addParameter($2.param); + else + delete $2.param.type; + } + | function_header_with_parameters COMMA parameter_declaration { + // + // Only first parameter of one-parameter functions can be void + // The check for named parameters not being void is done in parameter_declarator + // + if ($3.param.type->getBasicType() == EbtVoid) { + // + // This parameter > first is void + // + parseContext.error($2.loc, "cannot be an argument type except for '(void)'", "void", ""); + delete $3.param.type; + } else { + // Add the parameter + $$ = $1; + $1->addParameter($3.param); + } + } + ; + +function_header + : fully_specified_type IDENTIFIER LEFT_PAREN { + if ($1.qualifier.storage != EvqGlobal && $1.qualifier.storage != EvqTemporary) { + parseContext.error($2.loc, "no qualifiers allowed for function return", + GetStorageQualifierString($1.qualifier.storage), ""); + } + if ($1.arraySizes) + parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes); + + // Add the function as a prototype after parsing it (we do not support recursion) + TFunction *function; + TType type($1); + + // Potentially rename shader entry point function. No-op most of the time. + parseContext.renameShaderFunction($2.string); + + // Make the function + function = new TFunction($2.string, type); + $$ = function; + } + ; + +parameter_declarator + // Type + name + : type_specifier IDENTIFIER { + 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"); + parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes); + } + if ($1.basicType == EbtVoid) { + parseContext.error($2.loc, "illegal use of type 'void'", $2.string->c_str(), ""); + } + parseContext.reservedErrorCheck($2.loc, *$2.string); + + TParameter param = {$2.string, new TType($1)}; + $$.loc = $2.loc; + $$.param = param; + } + | type_specifier IDENTIFIER array_specifier { + 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"); + parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes); + } + TType* type = new TType($1); + type->transferArraySizes($3.arraySizes); + type->copyArrayInnerSizes($1.arraySizes); + + parseContext.arrayOfArrayVersionCheck($2.loc, type->getArraySizes()); + parseContext.arraySizeRequiredCheck($3.loc, *$3.arraySizes); + parseContext.reservedErrorCheck($2.loc, *$2.string); + + TParameter param = { $2.string, type }; + + $$.loc = $2.loc; + $$.param = param; + } + ; + +parameter_declaration + // + // With name + // + : type_qualifier parameter_declarator { + $$ = $2; + if ($1.qualifier.precision != EpqNone) + $$.param.type->getQualifier().precision = $1.qualifier.precision; + parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier()); + + parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers); + parseContext.parameterTypeCheck($2.loc, $1.qualifier.storage, *$$.param.type); + parseContext.paramCheckFix($1.loc, $1.qualifier, *$$.param.type); + + } + | parameter_declarator { + $$ = $1; + + parseContext.parameterTypeCheck($1.loc, EvqIn, *$1.param.type); + parseContext.paramCheckFixStorage($1.loc, EvqTemporary, *$$.param.type); + parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier()); + } + // + // Without name + // + | type_qualifier parameter_type_specifier { + $$ = $2; + if ($1.qualifier.precision != EpqNone) + $$.param.type->getQualifier().precision = $1.qualifier.precision; + parseContext.precisionQualifierCheck($1.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier()); + + parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers); + parseContext.parameterTypeCheck($2.loc, $1.qualifier.storage, *$$.param.type); + parseContext.paramCheckFix($1.loc, $1.qualifier, *$$.param.type); + } + | parameter_type_specifier { + $$ = $1; + + parseContext.parameterTypeCheck($1.loc, EvqIn, *$1.param.type); + parseContext.paramCheckFixStorage($1.loc, EvqTemporary, *$$.param.type); + parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier()); + } + ; + +parameter_type_specifier + : type_specifier { + TParameter param = { 0, new TType($1) }; + $$.param = param; + if ($1.arraySizes) + parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes); + } + ; + +init_declarator_list + : single_declaration { + $$ = $1; + } + | init_declarator_list COMMA IDENTIFIER { + $$ = $1; + parseContext.declareVariable($3.loc, *$3.string, $1.type); + } + | init_declarator_list COMMA IDENTIFIER array_specifier { + $$ = $1; + parseContext.declareVariable($3.loc, *$3.string, $1.type, $4.arraySizes); + } + | init_declarator_list COMMA IDENTIFIER array_specifier EQUAL initializer { + $$.type = $1.type; + TIntermNode* initNode = parseContext.declareVariable($3.loc, *$3.string, $1.type, $4.arraySizes, $6); + $$.intermNode = parseContext.intermediate.growAggregate($1.intermNode, initNode, $5.loc); + } + | init_declarator_list COMMA IDENTIFIER EQUAL initializer { + $$.type = $1.type; + TIntermNode* initNode = parseContext.declareVariable($3.loc, *$3.string, $1.type, 0, $5); + $$.intermNode = parseContext.intermediate.growAggregate($1.intermNode, initNode, $4.loc); + } + ; + +single_declaration + : fully_specified_type { + $$.type = $1; + $$.intermNode = 0; +GLSLANG_WEB_EXCLUDE_ON + parseContext.declareTypeDefaults($$.loc, $$.type); +GLSLANG_WEB_EXCLUDE_OFF + } + | fully_specified_type IDENTIFIER { + $$.type = $1; + $$.intermNode = 0; + parseContext.declareVariable($2.loc, *$2.string, $1); + } + | fully_specified_type IDENTIFIER array_specifier { + $$.type = $1; + $$.intermNode = 0; + parseContext.declareVariable($2.loc, *$2.string, $1, $3.arraySizes); + } + | fully_specified_type IDENTIFIER array_specifier EQUAL initializer { + $$.type = $1; + TIntermNode* initNode = parseContext.declareVariable($2.loc, *$2.string, $1, $3.arraySizes, $5); + $$.intermNode = parseContext.intermediate.growAggregate(0, initNode, $4.loc); + } + | fully_specified_type IDENTIFIER EQUAL initializer { + $$.type = $1; + TIntermNode* initNode = parseContext.declareVariable($2.loc, *$2.string, $1, 0, $4); + $$.intermNode = parseContext.intermediate.growAggregate(0, initNode, $3.loc); + } + +// Grammar Note: No 'enum', or 'typedef'. + +fully_specified_type + : type_specifier { + $$ = $1; + + parseContext.globalQualifierTypeCheck($1.loc, $1.qualifier, $$); + 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"); + } + parseContext.precisionQualifierCheck($$.loc, $$.basicType, $$.qualifier); + } + | type_qualifier type_specifier { + parseContext.globalQualifierFixCheck($1.loc, $1.qualifier); + parseContext.globalQualifierTypeCheck($1.loc, $1.qualifier, $2); + + 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 ($2.arraySizes && parseContext.arrayQualifierError($2.loc, $1.qualifier)) + $2.arraySizes = nullptr; + + parseContext.checkNoShaderLayouts($2.loc, $1.shaderQualifiers); + $2.shaderQualifiers.merge($1.shaderQualifiers); + parseContext.mergeQualifiers($2.loc, $2.qualifier, $1.qualifier, true); + parseContext.precisionQualifierCheck($2.loc, $2.basicType, $2.qualifier); + + $$ = $2; + + if (! $$.qualifier.isInterpolation() && + ((parseContext.language == EShLangVertex && $$.qualifier.storage == EvqVaryingOut) || + (parseContext.language == EShLangFragment && $$.qualifier.storage == EvqVaryingIn))) + $$.qualifier.smooth = true; + } + ; + +invariant_qualifier + : INVARIANT { + parseContext.globalCheck($1.loc, "invariant"); + parseContext.profileRequires($$.loc, ENoProfile, 120, 0, "invariant"); + $$.init($1.loc); + $$.qualifier.invariant = true; + } + ; + +interpolation_qualifier + : SMOOTH { + parseContext.globalCheck($1.loc, "smooth"); + parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "smooth"); + parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "smooth"); + $$.init($1.loc); + $$.qualifier.smooth = true; + } + | FLAT { + parseContext.globalCheck($1.loc, "flat"); + parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "flat"); + parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "flat"); + $$.init($1.loc); + $$.qualifier.flat = true; + } +GLSLANG_WEB_EXCLUDE_ON + | NOPERSPECTIVE { + parseContext.globalCheck($1.loc, "noperspective"); + parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_NV_shader_noperspective_interpolation, "noperspective"); + parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "noperspective"); + $$.init($1.loc); + $$.qualifier.nopersp = true; + } + | EXPLICITINTERPAMD { + 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; + } + | PERVERTEXNV { + 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; + } + | PERPRIMITIVENV { + // 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"); + // Fragment shader stage doesn't check for extension. So we explicitly add below extension check. + if (parseContext.language == EShLangFragment) + parseContext.requireExtensions($1.loc, 1, &E_GL_NV_mesh_shader, "perprimitiveNV"); + $$.init($1.loc); + $$.qualifier.perPrimitiveNV = true; + } + | PERVIEWNV { + // 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; + } + | PERTASKNV { + // 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; + } +GLSLANG_WEB_EXCLUDE_OFF + ; + +layout_qualifier + : LAYOUT LEFT_PAREN layout_qualifier_id_list RIGHT_PAREN { + $$ = $3; + } + ; + +layout_qualifier_id_list + : layout_qualifier_id { + $$ = $1; + } + | layout_qualifier_id_list COMMA layout_qualifier_id { + $$ = $1; + $$.shaderQualifiers.merge($3.shaderQualifiers); + parseContext.mergeObjectLayoutQualifiers($$.qualifier, $3.qualifier, false); + } + +layout_qualifier_id + : IDENTIFIER { + $$.init($1.loc); + parseContext.setLayoutQualifier($1.loc, $$, *$1.string); + } + | IDENTIFIER EQUAL constant_expression { + $$.init($1.loc); + parseContext.setLayoutQualifier($1.loc, $$, *$1.string, $3); + } + | SHARED { // because "shared" is both an identifier and a keyword + $$.init($1.loc); + TString strShared("shared"); + parseContext.setLayoutQualifier($1.loc, $$, strShared); + } + ; + +GLSLANG_WEB_EXCLUDE_ON +precise_qualifier + : PRECISE { + parseContext.profileRequires($$.loc, ECoreProfile | ECompatibilityProfile, 400, E_GL_ARB_gpu_shader5, "precise"); + parseContext.profileRequires($1.loc, EEsProfile, 320, Num_AEP_gpu_shader5, AEP_gpu_shader5, "precise"); + $$.init($1.loc); + $$.qualifier.noContraction = true; + } + ; +GLSLANG_WEB_EXCLUDE_OFF + +type_qualifier + : single_type_qualifier { + $$ = $1; + } + | type_qualifier single_type_qualifier { + $$ = $1; + if ($$.basicType == EbtVoid) + $$.basicType = $2.basicType; + + $$.shaderQualifiers.merge($2.shaderQualifiers); + parseContext.mergeQualifiers($$.loc, $$.qualifier, $2.qualifier, false); + } + ; + +single_type_qualifier + : storage_qualifier { + $$ = $1; + } + | layout_qualifier { + $$ = $1; + } + | precision_qualifier { + parseContext.checkPrecisionQualifier($1.loc, $1.qualifier.precision); + $$ = $1; + } + | interpolation_qualifier { + // allow inheritance of storage qualifier from block declaration + $$ = $1; + } + | invariant_qualifier { + // allow inheritance of storage qualifier from block declaration + $$ = $1; + } +GLSLANG_WEB_EXCLUDE_ON + | precise_qualifier { + // allow inheritance of storage qualifier from block declaration + $$ = $1; + } + | non_uniform_qualifier { + $$ = $1; + } +GLSLANG_WEB_EXCLUDE_OFF + ; + +storage_qualifier + : CONST { + $$.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; + } +GLSLANG_WEB_EXCLUDE_ON + | 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"); + parseContext.checkDeprecated($1.loc, ENoProfile, 130, "attribute"); + parseContext.requireNotRemoved($1.loc, ECoreProfile, 420, "attribute"); + parseContext.requireNotRemoved($1.loc, EEsProfile, 300, "attribute"); + + parseContext.globalCheck($1.loc, "attribute"); + + $$.init($1.loc); + $$.qualifier.storage = EvqVaryingIn; + } + | VARYING { + parseContext.checkDeprecated($1.loc, ENoProfile, 130, "varying"); + parseContext.checkDeprecated($1.loc, ECoreProfile, 130, "varying"); + parseContext.requireNotRemoved($1.loc, ECoreProfile, 420, "varying"); + parseContext.requireNotRemoved($1.loc, EEsProfile, 300, "varying"); + + parseContext.globalCheck($1.loc, "varying"); + + $$.init($1.loc); + if (parseContext.language == EShLangVertex) + $$.qualifier.storage = EvqVaryingOut; + else + $$.qualifier.storage = EvqVaryingIn; + } + | PATCH { + parseContext.globalCheck($1.loc, "patch"); + parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangTessControlMask | EShLangTessEvaluationMask), "patch"); + $$.init($1.loc); + $$.qualifier.patch = true; + } + | SAMPLE { + parseContext.globalCheck($1.loc, "sample"); + $$.init($1.loc); + $$.qualifier.sample = true; + } + | HITATTRNV { + 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; + } + | PAYLOADNV { + 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; + } + | PAYLOADINNV { + 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; + } + | CALLDATANV { + 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; + } + | CALLDATAINNV { + 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; + } + | COHERENT { + $$.init($1.loc); + $$.qualifier.coherent = true; + } + | DEVICECOHERENT { + $$.init($1.loc); + parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "devicecoherent"); + $$.qualifier.devicecoherent = true; + } + | QUEUEFAMILYCOHERENT { + $$.init($1.loc); + parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "queuefamilycoherent"); + $$.qualifier.queuefamilycoherent = true; + } + | WORKGROUPCOHERENT { + $$.init($1.loc); + parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "workgroupcoherent"); + $$.qualifier.workgroupcoherent = true; + } + | SUBGROUPCOHERENT { + $$.init($1.loc); + parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "subgroupcoherent"); + $$.qualifier.subgroupcoherent = true; + } + | NONPRIVATE { + $$.init($1.loc); + parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "nonprivate"); + $$.qualifier.nonprivate = true; + } + | VOLATILE { + $$.init($1.loc); + $$.qualifier.volatil = true; + } + | RESTRICT { + $$.init($1.loc); + $$.qualifier.restrict = true; + } + | READONLY { + $$.init($1.loc); + $$.qualifier.readonly = true; + } + | WRITEONLY { + $$.init($1.loc); + $$.qualifier.writeonly = true; + } + | SUBROUTINE { + parseContext.spvRemoved($1.loc, "subroutine"); + parseContext.globalCheck($1.loc, "subroutine"); + parseContext.unimplemented($1.loc, "subroutine"); + $$.init($1.loc); + } + | SUBROUTINE LEFT_PAREN type_name_list RIGHT_PAREN { + parseContext.spvRemoved($1.loc, "subroutine"); + parseContext.globalCheck($1.loc, "subroutine"); + parseContext.unimplemented($1.loc, "subroutine"); + $$.init($1.loc); + } +GLSLANG_WEB_EXCLUDE_OFF + ; + +GLSLANG_WEB_EXCLUDE_ON +non_uniform_qualifier + : NONUNIFORM { + $$.init($1.loc); + $$.qualifier.nonUniform = true; + } + ; + +type_name_list + : IDENTIFIER { + // TODO + } + | type_name_list COMMA IDENTIFIER { + // 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 + } + ; +GLSLANG_WEB_EXCLUDE_OFF + +type_specifier + : type_specifier_nonarray type_parameter_specifier_opt { + $$ = $1; + $$.qualifier.precision = parseContext.getDefaultPrecision($$); + $$.typeParameters = $2; + } + | type_specifier_nonarray type_parameter_specifier_opt array_specifier { + parseContext.arrayOfArrayVersionCheck($3.loc, $3.arraySizes); + $$ = $1; + $$.qualifier.precision = parseContext.getDefaultPrecision($$); + $$.typeParameters = $2; + $$.arraySizes = $3.arraySizes; + } + ; + +array_specifier + : LEFT_BRACKET RIGHT_BRACKET { + $$.loc = $1.loc; + $$.arraySizes = new TArraySizes; + $$.arraySizes->addInnerSize(); + } + | LEFT_BRACKET conditional_expression RIGHT_BRACKET { + $$.loc = $1.loc; + $$.arraySizes = new TArraySizes; + + TArraySize size; + parseContext.arraySizeCheck($2->getLoc(), $2, size, "array size"); + $$.arraySizes->addInnerSize(size); + } + | array_specifier LEFT_BRACKET RIGHT_BRACKET { + $$ = $1; + $$.arraySizes->addInnerSize(); + } + | array_specifier LEFT_BRACKET conditional_expression RIGHT_BRACKET { + $$ = $1; + + TArraySize size; + parseContext.arraySizeCheck($3->getLoc(), $3, size, "array size"); + $$.arraySizes->addInnerSize(size); + } + ; + +type_parameter_specifier_opt + : type_parameter_specifier { + $$ = $1; + } + | /* May be null */ { + $$ = 0; + } + ; + +type_parameter_specifier + : LEFT_ANGLE type_parameter_specifier_list RIGHT_ANGLE { + $$ = $2; + } + ; + +type_parameter_specifier_list + : unary_expression { + $$ = new TArraySizes; + + TArraySize size; + parseContext.arraySizeCheck($1->getLoc(), $1, size, "type parameter"); + $$->addInnerSize(size); + } + | type_parameter_specifier_list COMMA unary_expression { + $$ = $1; + + TArraySize size; + parseContext.arraySizeCheck($3->getLoc(), $3, size, "type parameter"); + $$->addInnerSize(size); + } + ; + +type_specifier_nonarray + : VOID { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtVoid; + } + | FLOAT { + $$.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); + } +GLSLANG_WEB_EXCLUDE_ON + | DOUBLE { + parseContext.doubleCheck($1.loc, "double"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + } + | FLOAT16_T { + parseContext.float16ScalarVectorCheck($1.loc, "float16_t", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat16; + } + | FLOAT32_T { + parseContext.explicitFloat32Check($1.loc, "float32_t", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + } + | FLOAT64_T { + parseContext.explicitFloat64Check($1.loc, "float64_t", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + } + | INT8_T { + parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtInt8; + } + | UINT8_T { + parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtUint8; + } + | INT16_T { + parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtInt16; + } + | UINT16_T { + parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtUint16; + } + | INT32_T { + parseContext.explicitInt32Check($1.loc, "32-bit signed integer", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtInt; + } + | UINT32_T { + parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtUint; + } + | INT64_T { + parseContext.int64Check($1.loc, "64-bit integer", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtInt64; + } + | UINT64_T { + parseContext.int64Check($1.loc, "64-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtUint64; + } + | DVEC2 { + parseContext.doubleCheck($1.loc, "double vector"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setVector(2); + } + | DVEC3 { + parseContext.doubleCheck($1.loc, "double vector"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setVector(3); + } + | DVEC4 { + parseContext.doubleCheck($1.loc, "double vector"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setVector(4); + } + | F16VEC2 { + parseContext.float16ScalarVectorCheck($1.loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat16; + $$.setVector(2); + } + | F16VEC3 { + parseContext.float16ScalarVectorCheck($1.loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat16; + $$.setVector(3); + } + | F16VEC4 { + parseContext.float16ScalarVectorCheck($1.loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat16; + $$.setVector(4); + } + | F32VEC2 { + parseContext.explicitFloat32Check($1.loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setVector(2); + } + | F32VEC3 { + parseContext.explicitFloat32Check($1.loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setVector(3); + } + | F32VEC4 { + parseContext.explicitFloat32Check($1.loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setVector(4); + } + | F64VEC2 { + parseContext.explicitFloat64Check($1.loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setVector(2); + } + | F64VEC3 { + parseContext.explicitFloat64Check($1.loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setVector(3); + } + | F64VEC4 { + parseContext.explicitFloat64Check($1.loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setVector(4); + } + | I8VEC2 { + parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtInt8; + $$.setVector(2); + } + | I8VEC3 { + parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtInt8; + $$.setVector(3); + } + | I8VEC4 { + parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtInt8; + $$.setVector(4); + } + | I16VEC2 { + parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtInt16; + $$.setVector(2); + } + | I16VEC3 { + parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtInt16; + $$.setVector(3); + } + | I16VEC4 { + parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtInt16; + $$.setVector(4); + } + | I32VEC2 { + parseContext.explicitInt32Check($1.loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtInt; + $$.setVector(2); + } + | I32VEC3 { + parseContext.explicitInt32Check($1.loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtInt; + $$.setVector(3); + } + | I32VEC4 { + parseContext.explicitInt32Check($1.loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtInt; + $$.setVector(4); + } + | I64VEC2 { + parseContext.int64Check($1.loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtInt64; + $$.setVector(2); + } + | I64VEC3 { + parseContext.int64Check($1.loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtInt64; + $$.setVector(3); + } + | I64VEC4 { + parseContext.int64Check($1.loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtInt64; + $$.setVector(4); + } + | U8VEC2 { + parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtUint8; + $$.setVector(2); + } + | U8VEC3 { + parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtUint8; + $$.setVector(3); + } + | U8VEC4 { + parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtUint8; + $$.setVector(4); + } + | U16VEC2 { + parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtUint16; + $$.setVector(2); + } + | U16VEC3 { + parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtUint16; + $$.setVector(3); + } + | U16VEC4 { + parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtUint16; + $$.setVector(4); + } + | U32VEC2 { + parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtUint; + $$.setVector(2); + } + | U32VEC3 { + parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtUint; + $$.setVector(3); + } + | U32VEC4 { + parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtUint; + $$.setVector(4); + } + | U64VEC2 { + parseContext.int64Check($1.loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtUint64; + $$.setVector(2); + } + | U64VEC3 { + parseContext.int64Check($1.loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtUint64; + $$.setVector(3); + } + | U64VEC4 { + parseContext.int64Check($1.loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtUint64; + $$.setVector(4); + } + | DMAT2 { + parseContext.doubleCheck($1.loc, "double matrix"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(2, 2); + } + | DMAT3 { + parseContext.doubleCheck($1.loc, "double matrix"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(3, 3); + } + | DMAT4 { + parseContext.doubleCheck($1.loc, "double matrix"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(4, 4); + } + | DMAT2X2 { + parseContext.doubleCheck($1.loc, "double matrix"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(2, 2); + } + | DMAT2X3 { + parseContext.doubleCheck($1.loc, "double matrix"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(2, 3); + } + | DMAT2X4 { + parseContext.doubleCheck($1.loc, "double matrix"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(2, 4); + } + | DMAT3X2 { + parseContext.doubleCheck($1.loc, "double matrix"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(3, 2); + } + | DMAT3X3 { + parseContext.doubleCheck($1.loc, "double matrix"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(3, 3); + } + | DMAT3X4 { + parseContext.doubleCheck($1.loc, "double matrix"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(3, 4); + } + | DMAT4X2 { + parseContext.doubleCheck($1.loc, "double matrix"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(4, 2); + } + | DMAT4X3 { + parseContext.doubleCheck($1.loc, "double matrix"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(4, 3); + } + | DMAT4X4 { + parseContext.doubleCheck($1.loc, "double matrix"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(4, 4); + } + | F16MAT2 { + parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat16; + $$.setMatrix(2, 2); + } + | F16MAT3 { + parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat16; + $$.setMatrix(3, 3); + } + | F16MAT4 { + parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat16; + $$.setMatrix(4, 4); + } + | F16MAT2X2 { + parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat16; + $$.setMatrix(2, 2); + } + | F16MAT2X3 { + parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat16; + $$.setMatrix(2, 3); + } + | F16MAT2X4 { + parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat16; + $$.setMatrix(2, 4); + } + | F16MAT3X2 { + parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat16; + $$.setMatrix(3, 2); + } + | F16MAT3X3 { + parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat16; + $$.setMatrix(3, 3); + } + | F16MAT3X4 { + parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat16; + $$.setMatrix(3, 4); + } + | F16MAT4X2 { + parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat16; + $$.setMatrix(4, 2); + } + | F16MAT4X3 { + parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat16; + $$.setMatrix(4, 3); + } + | F16MAT4X4 { + parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat16; + $$.setMatrix(4, 4); + } + | F32MAT2 { + parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(2, 2); + } + | F32MAT3 { + parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(3, 3); + } + | F32MAT4 { + parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(4, 4); + } + | F32MAT2X2 { + parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(2, 2); + } + | F32MAT2X3 { + parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(2, 3); + } + | F32MAT2X4 { + parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(2, 4); + } + | F32MAT3X2 { + parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(3, 2); + } + | F32MAT3X3 { + parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(3, 3); + } + | F32MAT3X4 { + parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(3, 4); + } + | F32MAT4X2 { + parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(4, 2); + } + | F32MAT4X3 { + parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(4, 3); + } + | F32MAT4X4 { + parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(4, 4); + } + | F64MAT2 { + parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(2, 2); + } + | F64MAT3 { + parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(3, 3); + } + | F64MAT4 { + parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(4, 4); + } + | F64MAT2X2 { + parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(2, 2); + } + | F64MAT2X3 { + parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(2, 3); + } + | F64MAT2X4 { + parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(2, 4); + } + | F64MAT3X2 { + parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(3, 2); + } + | F64MAT3X3 { + parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(3, 3); + } + | F64MAT3X4 { + parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(3, 4); + } + | F64MAT4X2 { + parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(4, 2); + } + | F64MAT4X3 { + parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(4, 3); + } + | F64MAT4X4 { + parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(4, 4); + } + | ACCSTRUCTNV { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtAccStructNV; + } + | ATOMIC_UINT { + parseContext.vulkanRemoved($1.loc, "atomic counter types"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtAtomicUint; + } + | SAMPLER1D { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat, Esd1D); + } +GLSLANG_WEB_EXCLUDE_OFF + | SAMPLER2D { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat, Esd2D); + } + | SAMPLER3D { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat, Esd3D); + } + | SAMPLERCUBE { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat, EsdCube); + } + | SAMPLER2DSHADOW { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat, Esd2D, false, true); + } + | SAMPLERCUBESHADOW { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat, EsdCube, false, true); + } +GLSLANG_WEB_EXCLUDE_ON + | SAMPLER1DSHADOW { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat, Esd1D, false, true); + } + | SAMPLER1DARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat, Esd1D, true); + } + | SAMPLER1DARRAYSHADOW { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat, Esd1D, true, true); + } +GLSLANG_WEB_EXCLUDE_OFF + | SAMPLER2DARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat, Esd2D, true); + } + | SAMPLER2DARRAYSHADOW { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat, Esd2D, true, true); + } + | SAMPLERCUBEARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat, EsdCube, true); + } + | SAMPLERCUBEARRAYSHADOW { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat, EsdCube, true, true); + } +GLSLANG_WEB_EXCLUDE_ON + | F16SAMPLER1D { + parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat16, Esd1D); + } + | F16SAMPLER2D { + parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat16, Esd2D); + } + | F16SAMPLER3D { + parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat16, Esd3D); + } + | F16SAMPLERCUBE { + parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat16, EsdCube); + } + | F16SAMPLER1DSHADOW { + parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat16, Esd1D, false, true); + } + | F16SAMPLER2DSHADOW { + parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat16, Esd2D, false, true); + } + | F16SAMPLERCUBESHADOW { + parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat16, EsdCube, false, true); + } + | F16SAMPLER1DARRAY { + parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat16, Esd1D, true); + } + | F16SAMPLER2DARRAY { + parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat16, Esd2D, true); + } + | F16SAMPLER1DARRAYSHADOW { + parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat16, Esd1D, true, true); + } + | F16SAMPLER2DARRAYSHADOW { + parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat16, Esd2D, true, true); + } + | F16SAMPLERCUBEARRAY { + parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat16, EsdCube, true); + } + | F16SAMPLERCUBEARRAYSHADOW { + parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat16, EsdCube, true, true); + } + | ISAMPLER1D { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtInt, Esd1D); + } +GLSLANG_WEB_EXCLUDE_OFF + | ISAMPLER2D { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtInt, Esd2D); + } + | ISAMPLER3D { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtInt, Esd3D); + } + | ISAMPLERCUBE { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtInt, EsdCube); + } +GLSLANG_WEB_EXCLUDE_ON + | ISAMPLER1DARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtInt, Esd1D, true); + } +GLSLANG_WEB_EXCLUDE_OFF + | ISAMPLER2DARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtInt, Esd2D, true); + } + | ISAMPLERCUBEARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtInt, EsdCube, true); + } +GLSLANG_WEB_EXCLUDE_ON + | USAMPLER1D { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtUint, Esd1D); + } +GLSLANG_WEB_EXCLUDE_OFF + | USAMPLER2D { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.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); + } +GLSLANG_WEB_EXCLUDE_ON + | USAMPLER1DARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtUint, Esd1D, true); + } +GLSLANG_WEB_EXCLUDE_OFF + | USAMPLER2DARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtUint, Esd2D, true); + } + | USAMPLERCUBEARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtUint, EsdCube, true); + } +GLSLANG_WEB_EXCLUDE_ON + | SAMPLER2DRECT { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat, EsdRect); + } + | SAMPLER2DRECTSHADOW { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat, EsdRect, false, true); + } + | F16SAMPLER2DRECT { + parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat16, EsdRect); + } + | F16SAMPLER2DRECTSHADOW { + parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat16, EsdRect, false, true); + } + | ISAMPLER2DRECT { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtInt, EsdRect); + } + | USAMPLER2DRECT { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtUint, EsdRect); + } + | SAMPLERBUFFER { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat, EsdBuffer); + } + | F16SAMPLERBUFFER { + parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat16, EsdBuffer); + } + | ISAMPLERBUFFER { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtInt, EsdBuffer); + } + | USAMPLERBUFFER { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtUint, EsdBuffer); + } + | SAMPLER2DMS { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat, Esd2D, false, false, true); + } + | F16SAMPLER2DMS { + 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); + } + | ISAMPLER2DMS { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtInt, Esd2D, false, false, true); + } + | USAMPLER2DMS { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtUint, Esd2D, false, false, true); + } + | SAMPLER2DMSARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat, Esd2D, true, false, true); + } + | F16SAMPLER2DMSARRAY { + 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); + } + | ISAMPLER2DMSARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtInt, Esd2D, true, false, true); + } + | USAMPLER2DMSARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.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 { + parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtFloat16, Esd1D); + } + | TEXTURE2D { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtFloat, Esd2D); + } + | F16TEXTURE2D { + parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtFloat16, Esd2D); + } + | TEXTURE3D { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtFloat, Esd3D); + } + | F16TEXTURE3D { + parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtFloat16, Esd3D); + } + | TEXTURECUBE { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtFloat, EsdCube); + } + | F16TEXTURECUBE { + parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtFloat16, EsdCube); + } + | TEXTURE1DARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtFloat, Esd1D, true); + } + | F16TEXTURE1DARRAY { + parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtFloat16, Esd1D, true); + } + | TEXTURE2DARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtFloat, Esd2D, true); + } + | F16TEXTURE2DARRAY { + parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtFloat16, Esd2D, true); + } + | TEXTURECUBEARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtFloat, EsdCube, true); + } + | F16TEXTURECUBEARRAY { + parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtFloat16, EsdCube, true); + } + | 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 { + parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtFloat16, EsdRect); + } + | ITEXTURE2DRECT { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtInt, EsdRect); + } + | UTEXTURE2DRECT { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtUint, EsdRect); + } + | TEXTUREBUFFER { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtFloat, EsdBuffer); + } + | F16TEXTUREBUFFER { + parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtFloat16, EsdBuffer); + } + | ITEXTUREBUFFER { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtInt, EsdBuffer); + } + | UTEXTUREBUFFER { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtUint, EsdBuffer); + } + | TEXTURE2DMS { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtFloat, Esd2D, false, false, true); + } + | F16TEXTURE2DMS { + 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); + } + | ITEXTURE2DMS { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtInt, Esd2D, false, false, true); + } + | UTEXTURE2DMS { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtUint, Esd2D, false, false, true); + } + | TEXTURE2DMSARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtFloat, Esd2D, true, false, true); + } + | F16TEXTURE2DMSARRAY { + 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); + } + | ITEXTURE2DMSARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtInt, Esd2D, true, false, true); + } + | UTEXTURE2DMSARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtUint, Esd2D, true, false, true); + } + | IMAGE1D { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtFloat, Esd1D); + } + | F16IMAGE1D { + parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtFloat16, Esd1D); + } + | IIMAGE1D { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtInt, Esd1D); + } + | UIMAGE1D { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtUint, Esd1D); + } + | IMAGE2D { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtFloat, Esd2D); + } + | F16IMAGE2D { + parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtFloat16, Esd2D); + } + | IIMAGE2D { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtInt, Esd2D); + } + | UIMAGE2D { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtUint, Esd2D); + } + | IMAGE3D { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtFloat, Esd3D); + } + | F16IMAGE3D { + parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtFloat16, Esd3D); + } + | IIMAGE3D { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtInt, Esd3D); + } + | UIMAGE3D { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtUint, Esd3D); + } + | IMAGE2DRECT { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtFloat, EsdRect); + } + | F16IMAGE2DRECT { + parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtFloat16, EsdRect); + } + | IIMAGE2DRECT { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtInt, EsdRect); + } + | UIMAGE2DRECT { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtUint, EsdRect); + } + | IMAGECUBE { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtFloat, EsdCube); + } + | F16IMAGECUBE { + parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtFloat16, EsdCube); + } + | IIMAGECUBE { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtInt, EsdCube); + } + | UIMAGECUBE { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtUint, EsdCube); + } + | IMAGEBUFFER { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtFloat, EsdBuffer); + } + | F16IMAGEBUFFER { + parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtFloat16, EsdBuffer); + } + | IIMAGEBUFFER { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtInt, EsdBuffer); + } + | UIMAGEBUFFER { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtUint, EsdBuffer); + } + | IMAGE1DARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtFloat, Esd1D, true); + } + | F16IMAGE1DARRAY { + parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtFloat16, Esd1D, true); + } + | IIMAGE1DARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtInt, Esd1D, true); + } + | UIMAGE1DARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtUint, Esd1D, true); + } + | IMAGE2DARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtFloat, Esd2D, true); + } + | F16IMAGE2DARRAY { + parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtFloat16, Esd2D, true); + } + | IIMAGE2DARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtInt, Esd2D, true); + } + | UIMAGE2DARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtUint, Esd2D, true); + } + | IMAGECUBEARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtFloat, EsdCube, true); + } + | F16IMAGECUBEARRAY { + parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtFloat16, EsdCube, true); + } + | IIMAGECUBEARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtInt, EsdCube, true); + } + | UIMAGECUBEARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtUint, EsdCube, true); + } + | IMAGE2DMS { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtFloat, Esd2D, false, false, true); + } + | F16IMAGE2DMS { + 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); + } + | IIMAGE2DMS { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtInt, Esd2D, false, false, true); + } + | UIMAGE2DMS { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtUint, Esd2D, false, false, true); + } + | IMAGE2DMSARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtFloat, Esd2D, true, false, true); + } + | F16IMAGE2DMSARRAY { + 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); + } + | IIMAGE2DMSARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtInt, Esd2D, true, false, true); + } + | UIMAGE2DMSARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtUint, Esd2D, true, false, true); + } + | SAMPLEREXTERNALOES { // GL_OES_EGL_image_external + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat, Esd2D); + $$.sampler.external = true; + } + | SAMPLEREXTERNAL2DY2YEXT { // GL_EXT_YUV_target + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat, Esd2D); + $$.sampler.yuv = true; + } + | SUBPASSINPUT { + parseContext.requireStage($1.loc, EShLangFragment, "subpass input"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setSubpass(EbtFloat); + } + | SUBPASSINPUTMS { + parseContext.requireStage($1.loc, EShLangFragment, "subpass input"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setSubpass(EbtFloat, true); + } + | F16SUBPASSINPUT { + 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); + } + | F16SUBPASSINPUTMS { + 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); + } + | ISUBPASSINPUT { + parseContext.requireStage($1.loc, EShLangFragment, "subpass input"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setSubpass(EbtInt); + } + | ISUBPASSINPUTMS { + parseContext.requireStage($1.loc, EShLangFragment, "subpass input"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setSubpass(EbtInt, true); + } + | USUBPASSINPUT { + parseContext.requireStage($1.loc, EShLangFragment, "subpass input"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setSubpass(EbtUint); + } + | USUBPASSINPUTMS { + parseContext.requireStage($1.loc, EShLangFragment, "subpass input"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setSubpass(EbtUint, true); + } + | FCOOPMATNV { + parseContext.fcoopmatCheck($1.loc, "fcoopmatNV", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.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; + } +GLSLANG_WEB_EXCLUDE_OFF + | struct_specifier { + $$ = $1; + $$.qualifier.storage = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; + parseContext.structTypeCheck($$.loc, $$); + } + | TYPE_NAME { + // + // This is for user defined type names. The lexical phase looked up the + // type. + // + if (const TVariable* variable = ($1.symbol)->getAsVariable()) { + const TType& structure = variable->getType(); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtStruct; + $$.userDef = &structure; + } else + parseContext.error($1.loc, "expected type name", $1.string->c_str(), ""); + } + ; + +precision_qualifier + : HIGH_PRECISION { + parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "highp precision qualifier"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + parseContext.handlePrecisionQualifier($1.loc, $$.qualifier, EpqHigh); + } + | MEDIUM_PRECISION { + parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "mediump precision qualifier"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + parseContext.handlePrecisionQualifier($1.loc, $$.qualifier, EpqMedium); + } + | LOW_PRECISION { + parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "lowp precision qualifier"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + parseContext.handlePrecisionQualifier($1.loc, $$.qualifier, EpqLow); + } + ; + +struct_specifier + : STRUCT IDENTIFIER LEFT_BRACE { parseContext.nestedStructCheck($1.loc); } struct_declaration_list RIGHT_BRACE { + TType* structure = new TType($5, *$2.string); + parseContext.structArrayCheck($2.loc, *structure); + TVariable* userTypeDef = new TVariable($2.string, *structure, true); + if (! parseContext.symbolTable.insert(*userTypeDef)) + parseContext.error($2.loc, "redefinition", $2.string->c_str(), "struct"); + $$.init($1.loc); + $$.basicType = EbtStruct; + $$.userDef = structure; + --parseContext.structNestingLevel; + } + | STRUCT LEFT_BRACE { parseContext.nestedStructCheck($1.loc); } struct_declaration_list RIGHT_BRACE { + TType* structure = new TType($4, TString("")); + $$.init($1.loc); + $$.basicType = EbtStruct; + $$.userDef = structure; + --parseContext.structNestingLevel; + } + ; + +struct_declaration_list + : struct_declaration { + $$ = $1; + } + | struct_declaration_list struct_declaration { + $$ = $1; + for (unsigned int i = 0; i < $2->size(); ++i) { + for (unsigned int j = 0; j < $$->size(); ++j) { + if ((*$$)[j].type->getFieldName() == (*$2)[i].type->getFieldName()) + parseContext.error((*$2)[i].loc, "duplicate member name:", "", (*$2)[i].type->getFieldName().c_str()); + } + $$->push_back((*$2)[i]); + } + } + ; + +struct_declaration + : type_specifier struct_declarator_list SEMICOLON { + 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.isEsProfile()) + parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes); + } + + $$ = $2; + + parseContext.voidErrorCheck($1.loc, (*$2)[0].type->getFieldName(), $1.basicType); + parseContext.precisionQualifierCheck($1.loc, $1.basicType, $1.qualifier); + + for (unsigned int i = 0; i < $$->size(); ++i) { + TType type($1); + type.setFieldName((*$$)[i].type->getFieldName()); + type.transferArraySizes((*$$)[i].type->getArraySizes()); + type.copyArrayInnerSizes($1.arraySizes); + parseContext.arrayOfArrayVersionCheck((*$$)[i].loc, type.getArraySizes()); + (*$$)[i].type->shallowCopy(type); + } + } + | type_qualifier type_specifier struct_declarator_list SEMICOLON { + 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.isEsProfile()) + parseContext.arraySizeRequiredCheck($2.loc, *$2.arraySizes); + } + + $$ = $3; + + parseContext.memberQualifierCheck($1); + parseContext.voidErrorCheck($2.loc, (*$3)[0].type->getFieldName(), $2.basicType); + parseContext.mergeQualifiers($2.loc, $2.qualifier, $1.qualifier, true); + parseContext.precisionQualifierCheck($2.loc, $2.basicType, $2.qualifier); + + for (unsigned int i = 0; i < $$->size(); ++i) { + TType type($2); + type.setFieldName((*$$)[i].type->getFieldName()); + type.transferArraySizes((*$$)[i].type->getArraySizes()); + type.copyArrayInnerSizes($2.arraySizes); + parseContext.arrayOfArrayVersionCheck((*$$)[i].loc, type.getArraySizes()); + (*$$)[i].type->shallowCopy(type); + } + } + ; + +struct_declarator_list + : struct_declarator { + $$ = new TTypeList; + $$->push_back($1); + } + | struct_declarator_list COMMA struct_declarator { + $$->push_back($3); + } + ; + +struct_declarator + : IDENTIFIER { + $$.type = new TType(EbtVoid); + $$.loc = $1.loc; + $$.type->setFieldName(*$1.string); + } + | IDENTIFIER array_specifier { + parseContext.arrayOfArrayVersionCheck($1.loc, $2.arraySizes); + + $$.type = new TType(EbtVoid); + $$.loc = $1.loc; + $$.type->setFieldName(*$1.string); + $$.type->transferArraySizes($2.arraySizes); + } + ; + +initializer + : assignment_expression { + $$ = $1; + } +GLSLANG_WEB_EXCLUDE_ON + | LEFT_BRACE initializer_list RIGHT_BRACE { + const char* initFeature = "{ } style initializers"; + parseContext.requireProfile($1.loc, ~EEsProfile, initFeature); + parseContext.profileRequires($1.loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, initFeature); + $$ = $2; + } + | LEFT_BRACE initializer_list COMMA RIGHT_BRACE { + const char* initFeature = "{ } style initializers"; + parseContext.requireProfile($1.loc, ~EEsProfile, initFeature); + parseContext.profileRequires($1.loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, initFeature); + $$ = $2; + } +GLSLANG_WEB_EXCLUDE_OFF + ; + +GLSLANG_WEB_EXCLUDE_ON +initializer_list + : initializer { + $$ = parseContext.intermediate.growAggregate(0, $1, $1->getLoc()); + } + | initializer_list COMMA initializer { + $$ = parseContext.intermediate.growAggregate($1, $3); + } + ; +GLSLANG_WEB_EXCLUDE_OFF + +declaration_statement + : declaration { $$ = $1; } + ; + +statement + : compound_statement { $$ = $1; } + | simple_statement { $$ = $1; } + ; + +// Grammar Note: labeled statements for switch statements only; 'goto' is not supported. + +simple_statement + : declaration_statement { $$ = $1; } + | expression_statement { $$ = $1; } + | selection_statement { $$ = $1; } + | switch_statement { $$ = $1; } + | case_label { $$ = $1; } + | iteration_statement { $$ = $1; } + | jump_statement { $$ = $1; } +GLSLANG_WEB_EXCLUDE_ON + | demote_statement { $$ = $1; } +GLSLANG_WEB_EXCLUDE_OFF + ; + +GLSLANG_WEB_EXCLUDE_ON +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); + } + ; +GLSLANG_WEB_EXCLUDE_OFF + +compound_statement + : LEFT_BRACE RIGHT_BRACE { $$ = 0; } + | LEFT_BRACE { + parseContext.symbolTable.push(); + ++parseContext.statementNestingLevel; + } + statement_list { + parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); + --parseContext.statementNestingLevel; + } + RIGHT_BRACE { + if ($3 && $3->getAsAggregate()) + $3->getAsAggregate()->setOperator(EOpSequence); + $$ = $3; + } + ; + +statement_no_new_scope + : compound_statement_no_new_scope { $$ = $1; } + | simple_statement { $$ = $1; } + ; + +statement_scoped + : { + ++parseContext.controlFlowNestingLevel; + } + compound_statement { + --parseContext.controlFlowNestingLevel; + $$ = $2; + } + | { + parseContext.symbolTable.push(); + ++parseContext.statementNestingLevel; + ++parseContext.controlFlowNestingLevel; + } + simple_statement { + parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); + --parseContext.statementNestingLevel; + --parseContext.controlFlowNestingLevel; + $$ = $2; + } + +compound_statement_no_new_scope + // Statement that doesn't create a new scope, for selection_statement, iteration_statement + : LEFT_BRACE RIGHT_BRACE { + $$ = 0; + } + | LEFT_BRACE statement_list RIGHT_BRACE { + if ($2 && $2->getAsAggregate()) + $2->getAsAggregate()->setOperator(EOpSequence); + $$ = $2; + } + ; + +statement_list + : statement { + $$ = parseContext.intermediate.makeAggregate($1); + if ($1 && $1->getAsBranchNode() && ($1->getAsBranchNode()->getFlowOp() == EOpCase || + $1->getAsBranchNode()->getFlowOp() == EOpDefault)) { + parseContext.wrapupSwitchSubsequence(0, $1); + $$ = 0; // start a fresh subsequence for what's after this case + } + } + | statement_list statement { + if ($2 && $2->getAsBranchNode() && ($2->getAsBranchNode()->getFlowOp() == EOpCase || + $2->getAsBranchNode()->getFlowOp() == EOpDefault)) { + parseContext.wrapupSwitchSubsequence($1 ? $1->getAsAggregate() : 0, $2); + $$ = 0; // start a fresh subsequence for what's after this case + } else + $$ = parseContext.intermediate.growAggregate($1, $2); + } + ; + +expression_statement + : SEMICOLON { $$ = 0; } + | expression SEMICOLON { $$ = static_cast($1); } + ; + +selection_statement + : selection_statement_nonattributed { + $$ = $1; + } +GLSLANG_WEB_EXCLUDE_ON + | attribute selection_statement_nonattributed { + parseContext.handleSelectionAttributes(*$1, $2); + $$ = $2; + } +GLSLANG_WEB_EXCLUDE_OFF + +selection_statement_nonattributed + : IF LEFT_PAREN expression RIGHT_PAREN selection_rest_statement { + parseContext.boolCheck($1.loc, $3); + $$ = parseContext.intermediate.addSelection($3, $5, $1.loc); + } + ; + +selection_rest_statement + : statement_scoped ELSE statement_scoped { + $$.node1 = $1; + $$.node2 = $3; + } + | statement_scoped { + $$.node1 = $1; + $$.node2 = 0; + } + ; + +condition + // In 1996 c++ draft, conditions can include single declarations + : expression { + $$ = $1; + parseContext.boolCheck($1->getLoc(), $1); + } + | fully_specified_type IDENTIFIER EQUAL initializer { + parseContext.boolCheck($2.loc, $1); + + TType type($1); + TIntermNode* initNode = parseContext.declareVariable($2.loc, *$2.string, $1, 0, $4); + if (initNode) + $$ = initNode->getAsTyped(); + else + $$ = 0; + } + ; + +switch_statement + : switch_statement_nonattributed { + $$ = $1; + } +GLSLANG_WEB_EXCLUDE_ON + | attribute switch_statement_nonattributed { + parseContext.handleSwitchAttributes(*$1, $2); + $$ = $2; + } +GLSLANG_WEB_EXCLUDE_OFF + +switch_statement_nonattributed + : SWITCH LEFT_PAREN expression RIGHT_PAREN { + // start new switch sequence on the switch stack + ++parseContext.controlFlowNestingLevel; + ++parseContext.statementNestingLevel; + parseContext.switchSequenceStack.push_back(new TIntermSequence); + parseContext.switchLevel.push_back(parseContext.statementNestingLevel); + parseContext.symbolTable.push(); + } + LEFT_BRACE switch_statement_list RIGHT_BRACE { + $$ = parseContext.addSwitch($1.loc, $3, $7 ? $7->getAsAggregate() : 0); + delete parseContext.switchSequenceStack.back(); + parseContext.switchSequenceStack.pop_back(); + parseContext.switchLevel.pop_back(); + parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); + --parseContext.statementNestingLevel; + --parseContext.controlFlowNestingLevel; + } + ; + +switch_statement_list + : /* nothing */ { + $$ = 0; + } + | statement_list { + $$ = $1; + } + ; + +case_label + : CASE expression COLON { + $$ = 0; + if (parseContext.switchLevel.size() == 0) + parseContext.error($1.loc, "cannot appear outside switch statement", "case", ""); + else if (parseContext.switchLevel.back() != parseContext.statementNestingLevel) + parseContext.error($1.loc, "cannot be nested inside control flow", "case", ""); + else { + parseContext.constantValueCheck($2, "case"); + parseContext.integerCheck($2, "case"); + $$ = parseContext.intermediate.addBranch(EOpCase, $2, $1.loc); + } + } + | DEFAULT COLON { + $$ = 0; + if (parseContext.switchLevel.size() == 0) + parseContext.error($1.loc, "cannot appear outside switch statement", "default", ""); + else if (parseContext.switchLevel.back() != parseContext.statementNestingLevel) + parseContext.error($1.loc, "cannot be nested inside control flow", "default", ""); + else + $$ = parseContext.intermediate.addBranch(EOpDefault, $1.loc); + } + ; + +iteration_statement + : iteration_statement_nonattributed { + $$ = $1; + } +GLSLANG_WEB_EXCLUDE_ON + | attribute iteration_statement_nonattributed { + parseContext.handleLoopAttributes(*$1, $2); + $$ = $2; + } +GLSLANG_WEB_EXCLUDE_OFF + +iteration_statement_nonattributed + : WHILE LEFT_PAREN { + if (! parseContext.limits.whileLoops) + parseContext.error($1.loc, "while loops not available", "limitation", ""); + parseContext.symbolTable.push(); + ++parseContext.loopNestingLevel; + ++parseContext.statementNestingLevel; + ++parseContext.controlFlowNestingLevel; + } + condition RIGHT_PAREN statement_no_new_scope { + parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); + $$ = parseContext.intermediate.addLoop($6, $4, 0, true, $1.loc); + --parseContext.loopNestingLevel; + --parseContext.statementNestingLevel; + --parseContext.controlFlowNestingLevel; + } + | DO { + ++parseContext.loopNestingLevel; + ++parseContext.statementNestingLevel; + ++parseContext.controlFlowNestingLevel; + } + statement WHILE LEFT_PAREN expression RIGHT_PAREN SEMICOLON { + if (! parseContext.limits.whileLoops) + parseContext.error($1.loc, "do-while loops not available", "limitation", ""); + + parseContext.boolCheck($8.loc, $6); + + $$ = parseContext.intermediate.addLoop($3, $6, 0, false, $4.loc); + --parseContext.loopNestingLevel; + --parseContext.statementNestingLevel; + --parseContext.controlFlowNestingLevel; + } + | FOR LEFT_PAREN { + parseContext.symbolTable.push(); + ++parseContext.loopNestingLevel; + ++parseContext.statementNestingLevel; + ++parseContext.controlFlowNestingLevel; + } + for_init_statement for_rest_statement RIGHT_PAREN statement_no_new_scope { + parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); + $$ = parseContext.intermediate.makeAggregate($4, $2.loc); + TIntermLoop* forLoop = parseContext.intermediate.addLoop($7, reinterpret_cast($5.node1), reinterpret_cast($5.node2), true, $1.loc); + if (! parseContext.limits.nonInductiveForLoops) + parseContext.inductiveLoopCheck($1.loc, $4, forLoop); + $$ = parseContext.intermediate.growAggregate($$, forLoop, $1.loc); + $$->getAsAggregate()->setOperator(EOpSequence); + --parseContext.loopNestingLevel; + --parseContext.statementNestingLevel; + --parseContext.controlFlowNestingLevel; + } + ; + +for_init_statement + : expression_statement { + $$ = $1; + } + | declaration_statement { + $$ = $1; + } + ; + +conditionopt + : condition { + $$ = $1; + } + | /* May be null */ { + $$ = 0; + } + ; + +for_rest_statement + : conditionopt SEMICOLON { + $$.node1 = $1; + $$.node2 = 0; + } + | conditionopt SEMICOLON expression { + $$.node1 = $1; + $$.node2 = $3; + } + ; + +jump_statement + : CONTINUE SEMICOLON { + if (parseContext.loopNestingLevel <= 0) + parseContext.error($1.loc, "continue statement only allowed in loops", "", ""); + $$ = parseContext.intermediate.addBranch(EOpContinue, $1.loc); + } + | BREAK SEMICOLON { + if (parseContext.loopNestingLevel + parseContext.switchSequenceStack.size() <= 0) + parseContext.error($1.loc, "break statement only allowed in switch and loops", "", ""); + $$ = parseContext.intermediate.addBranch(EOpBreak, $1.loc); + } + | RETURN SEMICOLON { + $$ = parseContext.intermediate.addBranch(EOpReturn, $1.loc); + if (parseContext.currentFunctionType->getBasicType() != EbtVoid) + parseContext.error($1.loc, "non-void function must return a value", "return", ""); + if (parseContext.inMain) + parseContext.postEntryPointReturn = true; + } + | RETURN expression SEMICOLON { + $$ = parseContext.handleReturnValue($1.loc, $2); + } + | DISCARD SEMICOLON { + parseContext.requireStage($1.loc, EShLangFragment, "discard"); + $$ = parseContext.intermediate.addBranch(EOpKill, $1.loc); + } + ; + +// Grammar Note: No 'goto'. Gotos are not supported. + +translation_unit + : external_declaration { + $$ = $1; + parseContext.intermediate.setTreeRoot($$); + } + | translation_unit external_declaration { + if ($2 != nullptr) { + $$ = parseContext.intermediate.growAggregate($1, $2); + parseContext.intermediate.setTreeRoot($$); + } + } + ; + +external_declaration + : function_definition { + $$ = $1; + } + | declaration { + $$ = $1; + } +GLSLANG_WEB_EXCLUDE_ON + | SEMICOLON { + parseContext.requireProfile($1.loc, ~EEsProfile, "extraneous semicolon"); + parseContext.profileRequires($1.loc, ~EEsProfile, 460, nullptr, "extraneous semicolon"); + $$ = nullptr; + } +GLSLANG_WEB_EXCLUDE_OFF + ; + +function_definition + : function_prototype { + $1.function = parseContext.handleFunctionDeclarator($1.loc, *$1.function, false /* not prototype */); + $1.intermNode = parseContext.handleFunctionDefinition($1.loc, *$1.function); + } + compound_statement_no_new_scope { + // May be best done as post process phase on intermediate code + if (parseContext.currentFunctionType->getBasicType() != EbtVoid && ! parseContext.functionReturnsValue) + parseContext.error($1.loc, "function does not return a value:", "", $1.function->getName().c_str()); + parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); + $$ = parseContext.intermediate.growAggregate($1.intermNode, $3); + parseContext.intermediate.setAggregateOperator($$, EOpFunction, $1.function->getType(), $1.loc); + $$->getAsAggregate()->setName($1.function->getMangledName().c_str()); + + // store the pragma information for debug and optimize and other vendor specific + // information. This information can be queried from the parse tree + $$->getAsAggregate()->setOptimize(parseContext.contextPragma.optimize); + $$->getAsAggregate()->setDebug(parseContext.contextPragma.debug); + $$->getAsAggregate()->setPragmaTable(parseContext.contextPragma.pragmaTable); + } + ; + +GLSLANG_WEB_EXCLUDE_ON +attribute + : LEFT_BRACKET LEFT_BRACKET attribute_list RIGHT_BRACKET RIGHT_BRACKET { + $$ = $3; + parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_control_flow_attributes, "attribute"); + } + +attribute_list + : single_attribute { + $$ = $1; + } + | attribute_list COMMA single_attribute { + $$ = parseContext.mergeAttributes($1, $3); + } + +single_attribute + : IDENTIFIER { + $$ = parseContext.makeAttributes(*$1.string); + } + | IDENTIFIER LEFT_PAREN constant_expression RIGHT_PAREN { + $$ = parseContext.makeAttributes(*$1.string, $3); + } +GLSLANG_WEB_EXCLUDE_OFF + +%% diff --git a/glslang/MachineIndependent/glslang.y b/glslang/MachineIndependent/glslang.y index 97595725..008faf0e 100644 --- a/glslang/MachineIndependent/glslang.y +++ b/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 derivitive 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 exluded 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,30 @@ extern int yylex(YYSTYPE*, TParseContext&); %pure-parser // enable thread safety %expect 1 // One shift reduce conflict because of if | else -%token ATTRIBUTE VARYING -%token FLOAT16_T FLOAT FLOAT32_T DOUBLE FLOAT64_T -%token CONST BOOL INT UINT INT64_T UINT64_T INT32_T UINT32_T INT16_T UINT16_T INT8_T UINT8_T -%token BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT SUBROUTINE DEMOTE +%token CONST BOOL INT UINT FLOAT %token BVEC2 BVEC3 BVEC4 %token IVEC2 IVEC3 IVEC4 %token UVEC2 UVEC3 UVEC4 +%token VEC2 VEC3 VEC4 +%token MAT2 MAT3 MAT4 +%token MAT2X2 MAT2X3 MAT2X4 +%token MAT3X2 MAT3X3 MAT3X4 +%token MAT4X2 MAT4X3 MAT4X4 + +// combined image/sampler +%token SAMPLER2D SAMPLER3D SAMPLERCUBE SAMPLER2DSHADOW +%token SAMPLERCUBESHADOW SAMPLER2DARRAY +%token SAMPLER2DARRAYSHADOW ISAMPLER2D ISAMPLER3D ISAMPLERCUBE +%token ISAMPLER2DARRAY USAMPLER2D USAMPLER3D +%token USAMPLERCUBE USAMPLER2DARRAY +%token SAMPLERCUBEARRAY SAMPLERCUBEARRAYSHADOW +%token ISAMPLERCUBEARRAY USAMPLERCUBEARRAY + + + +%token ATTRIBUTE VARYING +%token FLOAT16_T FLOAT32_T DOUBLE FLOAT64_T +%token INT64_T UINT64_T INT32_T UINT32_T INT16_T UINT16_T INT8_T UINT8_T %token I64VEC2 I64VEC3 I64VEC4 %token U64VEC2 U64VEC3 U64VEC4 %token I32VEC2 I32VEC3 I32VEC4 @@ -140,19 +182,10 @@ extern int yylex(YYSTYPE*, TParseContext&); %token U16VEC2 U16VEC3 U16VEC4 %token I8VEC2 I8VEC3 I8VEC4 %token U8VEC2 U8VEC3 U8VEC4 -%token VEC2 VEC3 VEC4 -%token MAT2 MAT3 MAT4 CENTROID IN OUT INOUT -%token UNIFORM PATCH SAMPLE BUFFER SHARED NONUNIFORM PAYLOADNV PAYLOADINNV HITATTRNV CALLDATANV CALLDATAINNV -%token COHERENT VOLATILE RESTRICT READONLY WRITEONLY DEVICECOHERENT QUEUEFAMILYCOHERENT WORKGROUPCOHERENT SUBGROUPCOHERENT NONPRIVATE %token DVEC2 DVEC3 DVEC4 DMAT2 DMAT3 DMAT4 %token F16VEC2 F16VEC3 F16VEC4 F16MAT2 F16MAT3 F16MAT4 %token F32VEC2 F32VEC3 F32VEC4 F32MAT2 F32MAT3 F32MAT4 %token F64VEC2 F64VEC3 F64VEC4 F64MAT2 F64MAT3 F64MAT4 -%token NOPERSPECTIVE FLAT SMOOTH LAYOUT EXPLICITINTERPAMD PERVERTEXNV PERPRIMITIVENV PERVIEWNV PERTASKNV - -%token MAT2X2 MAT2X3 MAT2X4 -%token MAT3X2 MAT3X3 MAT3X4 -%token MAT4X2 MAT4X3 MAT4X4 %token DMAT2X2 DMAT2X3 DMAT2X4 %token DMAT3X2 DMAT3X3 DMAT3X4 %token DMAT4X2 DMAT4X3 DMAT4X4 @@ -167,29 +200,39 @@ extern int yylex(YYSTYPE*, TParseContext&); %token F64MAT4X2 F64MAT4X3 F64MAT4X4 %token ATOMIC_UINT %token ACCSTRUCTNV -%token FCOOPMATNV +%token FCOOPMATNV ICOOPMATNV UCOOPMATNV // combined image/sampler -%token SAMPLER1D SAMPLER2D SAMPLER3D SAMPLERCUBE SAMPLER1DSHADOW SAMPLER2DSHADOW -%token SAMPLERCUBESHADOW SAMPLER1DARRAY SAMPLER2DARRAY SAMPLER1DARRAYSHADOW -%token SAMPLER2DARRAYSHADOW ISAMPLER1D ISAMPLER2D ISAMPLER3D ISAMPLERCUBE -%token ISAMPLER1DARRAY ISAMPLER2DARRAY USAMPLER1D USAMPLER2D USAMPLER3D -%token USAMPLERCUBE USAMPLER1DARRAY USAMPLER2DARRAY +%token SAMPLER1D SAMPLER1DARRAY SAMPLER1DARRAYSHADOW ISAMPLER1D SAMPLER1DSHADOW %token SAMPLER2DRECT SAMPLER2DRECTSHADOW ISAMPLER2DRECT USAMPLER2DRECT %token SAMPLERBUFFER ISAMPLERBUFFER USAMPLERBUFFER -%token SAMPLERCUBEARRAY SAMPLERCUBEARRAYSHADOW -%token ISAMPLERCUBEARRAY USAMPLERCUBEARRAY %token SAMPLER2DMS ISAMPLER2DMS USAMPLER2DMS %token SAMPLER2DMSARRAY ISAMPLER2DMSARRAY USAMPLER2DMSARRAY %token SAMPLEREXTERNALOES %token SAMPLEREXTERNAL2DY2YEXT - +%token ISAMPLER1DARRAY USAMPLER1D USAMPLER1DARRAY %token F16SAMPLER1D F16SAMPLER2D F16SAMPLER3D F16SAMPLER2DRECT F16SAMPLERCUBE %token F16SAMPLER1DARRAY F16SAMPLER2DARRAY F16SAMPLERCUBEARRAY %token F16SAMPLERBUFFER F16SAMPLER2DMS F16SAMPLER2DMSARRAY %token F16SAMPLER1DSHADOW F16SAMPLER2DSHADOW F16SAMPLER1DARRAYSHADOW F16SAMPLER2DARRAYSHADOW %token F16SAMPLER2DRECTSHADOW F16SAMPLERCUBESHADOW F16SAMPLERCUBEARRAYSHADOW +// images +%token IMAGE1D IIMAGE1D UIMAGE1D IMAGE2D IIMAGE2D +%token UIMAGE2D IMAGE3D IIMAGE3D UIMAGE3D +%token IMAGE2DRECT IIMAGE2DRECT UIMAGE2DRECT +%token IMAGECUBE IIMAGECUBE UIMAGECUBE +%token IMAGEBUFFER IIMAGEBUFFER UIMAGEBUFFER +%token IMAGE1DARRAY IIMAGE1DARRAY UIMAGE1DARRAY +%token IMAGE2DARRAY IIMAGE2DARRAY UIMAGE2DARRAY +%token IMAGECUBEARRAY IIMAGECUBEARRAY UIMAGECUBEARRAY +%token IMAGE2DMS IIMAGE2DMS UIMAGE2DMS +%token IMAGE2DMSARRAY IIMAGE2DMSARRAY UIMAGE2DMSARRAY + +%token F16IMAGE1D F16IMAGE2D F16IMAGE3D F16IMAGE2DRECT +%token F16IMAGECUBE F16IMAGE1DARRAY F16IMAGE2DARRAY F16IMAGECUBEARRAY +%token F16IMAGEBUFFER F16IMAGE2DMS F16IMAGE2DMSARRAY + // pure sampler %token SAMPLER SAMPLERSHADOW @@ -213,25 +256,8 @@ extern int yylex(YYSTYPE*, TParseContext&); %token SUBPASSINPUT SUBPASSINPUTMS ISUBPASSINPUT ISUBPASSINPUTMS USUBPASSINPUT USUBPASSINPUTMS %token F16SUBPASSINPUT F16SUBPASSINPUTMS -%token IMAGE1D IIMAGE1D UIMAGE1D IMAGE2D IIMAGE2D -%token UIMAGE2D IMAGE3D IIMAGE3D UIMAGE3D -%token IMAGE2DRECT IIMAGE2DRECT UIMAGE2DRECT -%token IMAGECUBE IIMAGECUBE UIMAGECUBE -%token IMAGEBUFFER IIMAGEBUFFER UIMAGEBUFFER -%token IMAGE1DARRAY IIMAGE1DARRAY UIMAGE1DARRAY -%token IMAGE2DARRAY IIMAGE2DARRAY UIMAGE2DARRAY -%token IMAGECUBEARRAY IIMAGECUBEARRAY UIMAGECUBEARRAY -%token IMAGE2DMS IIMAGE2DMS UIMAGE2DMS -%token IMAGE2DMSARRAY IIMAGE2DMSARRAY UIMAGE2DMSARRAY -%token F16IMAGE1D F16IMAGE2D F16IMAGE3D F16IMAGE2DRECT -%token F16IMAGECUBE F16IMAGE1DARRAY F16IMAGE2DARRAY F16IMAGECUBEARRAY -%token F16IMAGEBUFFER F16IMAGE2DMS F16IMAGE2DMSARRAY -%token STRUCT VOID WHILE - -%token IDENTIFIER TYPE_NAME -%token FLOATCONSTANT DOUBLECONSTANT INT16CONSTANT UINT16CONSTANT INT32CONSTANT UINT32CONSTANT INTCONSTANT UINTCONSTANT INT64CONSTANT UINT64CONSTANT BOOLCONSTANT FLOAT16CONSTANT %token LEFT_OP RIGHT_OP %token INC_OP DEC_OP LE_OP GE_OP EQ_OP NE_OP %token AND_OP OR_OP XOR_OP MUL_ASSIGN DIV_ASSIGN ADD_ASSIGN @@ -242,11 +268,30 @@ extern int yylex(YYSTYPE*, TParseContext&); %token COMMA COLON EQUAL SEMICOLON BANG DASH TILDE PLUS STAR SLASH PERCENT %token LEFT_ANGLE RIGHT_ANGLE VERTICAL_BAR CARET AMPERSAND QUESTION -%token INVARIANT PRECISE +%token INVARIANT %token HIGH_PRECISION MEDIUM_PRECISION LOW_PRECISION PRECISION - %token PACKED RESOURCE SUPERP +%token FLOATCONSTANT INTCONSTANT UINTCONSTANT BOOLCONSTANT +%token IDENTIFIER TYPE_NAME +%token CENTROID IN OUT INOUT +%token STRUCT VOID WHILE +%token BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT +%token UNIFORM SHARED +%token FLAT SMOOTH LAYOUT + + +%token DOUBLECONSTANT INT16CONSTANT UINT16CONSTANT FLOAT16CONSTANT INT32CONSTANT UINT32CONSTANT +%token INT64CONSTANT UINT64CONSTANT +%token SUBROUTINE DEMOTE +%token PAYLOADNV PAYLOADINNV HITATTRNV CALLDATANV CALLDATAINNV +%token PATCH SAMPLE BUFFER NONUNIFORM +%token COHERENT VOLATILE RESTRICT READONLY WRITEONLY DEVICECOHERENT QUEUEFAMILYCOHERENT WORKGROUPCOHERENT +%token SUBGROUPCOHERENT NONPRIVATE +%token NOPERSPECTIVE EXPLICITINTERPAMD PERVERTEXNV PERPRIMITIVENV PERVIEWNV PERTASKNV +%token PRECISE + + %type assignment_operator unary_operator %type variable_identifier primary_expression postfix_expression %type expression integer_expression assignment_expression @@ -255,7 +300,7 @@ extern int yylex(YYSTYPE*, TParseContext&); %type conditional_expression constant_expression %type logical_or_expression logical_xor_expression logical_and_expression %type shift_expression and_expression exclusive_or_expression inclusive_or_expression -%type function_call initializer initializer_list condition conditionopt +%type function_call initializer condition conditionopt %type translation_unit function_definition %type statement simple_statement @@ -265,15 +310,14 @@ extern int yylex(YYSTYPE*, TParseContext&); %type declaration external_declaration %type for_init_statement compound_statement_no_new_scope %type selection_rest_statement for_rest_statement -%type iteration_statement iteration_statement_nonattributed jump_statement statement_no_new_scope statement_scoped demote_statement +%type iteration_statement iteration_statement_nonattributed jump_statement statement_no_new_scope statement_scoped %type single_declaration init_declarator_list %type parameter_declaration parameter_declarator parameter_type_specifier %type array_specifier -%type precise_qualifier invariant_qualifier interpolation_qualifier storage_qualifier precision_qualifier +%type invariant_qualifier interpolation_qualifier storage_qualifier precision_qualifier %type layout_qualifier layout_qualifier_id_list layout_qualifier_id -%type non_uniform_qualifier %type type_parameter_specifier %type type_parameter_specifier_opt @@ -284,7 +328,7 @@ extern int yylex(YYSTYPE*, TParseContext&); %type type_specifier_nonarray %type struct_specifier %type struct_declarator -%type struct_declarator_list struct_declaration struct_declaration_list type_name_list +%type struct_declarator_list struct_declaration struct_declaration_list %type block_structure %type function_header function_declarator %type function_header_with_parameters @@ -293,7 +337,13 @@ extern int yylex(YYSTYPE*, TParseContext&); %type identifier_list + +%type precise_qualifier non_uniform_qualifier +%type type_name_list %type attribute attribute_list single_attribute +%type demote_statement +%type 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,9 +401,6 @@ 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.intermediate.addConstantUnion($1.d, EbtDouble, $1.loc, true); @@ -350,14 +409,7 @@ primary_expression 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 +535,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 +858,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 +1101,9 @@ single_declaration : fully_specified_type { $$.type = $1; $$.intermNode = 0; + parseContext.declareTypeDefaults($$.loc, $$.type); + } | fully_specified_type IDENTIFIER { $$.type = $1; @@ -1082,7 +1137,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 +1189,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 +1221,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 +1271,7 @@ layout_qualifier_id } ; + precise_qualifier : PRECISE { parseContext.profileRequires($$.loc, ECoreProfile | ECompatibilityProfile, 400, E_GL_ARB_gpu_shader5, "precise"); @@ -1238,6 +1281,7 @@ precise_qualifier } ; + type_qualifier : single_type_qualifier { $$ = $1; @@ -1271,6 +1315,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 +1323,7 @@ single_type_qualifier | non_uniform_qualifier { $$ = $1; } + ; storage_qualifier @@ -1285,6 +1331,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 +1400,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 +1411,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 +1507,10 @@ storage_qualifier parseContext.unimplemented($1.loc, "subroutine"); $$.init($1.loc); } + ; + non_uniform_qualifier : NONUNIFORM { $$.init($1.loc); @@ -1494,6 +1529,7 @@ type_name_list } ; + type_specifier : type_specifier_nonarray type_parameter_specifier_opt { $$ = $1; @@ -1577,6 +1613,143 @@ 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"); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -1597,15 +1770,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,25 +1810,6 @@ 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"); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -1737,36 +1882,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 +1954,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,66 +2026,6 @@ 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"); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -2278,10 +2315,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 +2328,7 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.set(EbtFloat, Esd1D); } + | SAMPLER2D { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -2308,11 +2344,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,21 +2354,28 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.set(EbtFloat, EsdCube, false, true); } + + | SAMPLER1DSHADOW { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat, Esd1D, false, true); + } | SAMPLER1DARRAY { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; $$.sampler.set(EbtFloat, Esd1D, true); } - | SAMPLER2DARRAY { - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtSampler; - $$.sampler.set(EbtFloat, Esd2D, true); - } | SAMPLER1DARRAYSHADOW { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; $$.sampler.set(EbtFloat, Esd1D, true, true); } + + | SAMPLER2DARRAY { + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat, Esd2D, true); + } | SAMPLER2DARRAYSHADOW { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -2353,115 +2391,91 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.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,11 +2491,13 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.set(EbtInt, EsdCube); } + | ISAMPLER1DARRAY { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; $$.sampler.set(EbtInt, Esd1D, true); } + | ISAMPLER2DARRAY { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -2492,11 +2508,13 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.set(EbtInt, EsdCube, true); } + | USAMPLER1D { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; $$.sampler.set(EbtUint, Esd1D); } + | USAMPLER2D { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -2512,11 +2530,13 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.set(EbtUint, EsdCube); } + | USAMPLER1DARRAY { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; $$.sampler.set(EbtUint, Esd1D, true); } + | USAMPLER2DARRAY { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -2527,6 +2547,7 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.set(EbtUint, EsdCube, true); } + | SAMPLER2DRECT { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -2538,20 +2559,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 +2586,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 +2607,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 +2628,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()); @@ -2648,12 +2659,10 @@ type_specifier_nonarray $$.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()); @@ -2661,12 +2670,10 @@ type_specifier_nonarray $$.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()); @@ -2674,12 +2681,10 @@ type_specifier_nonarray $$.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()); @@ -2687,12 +2692,10 @@ type_specifier_nonarray $$.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,12 +2703,10 @@ 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()); @@ -2713,12 +2714,10 @@ type_specifier_nonarray $$.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()); @@ -2726,12 +2725,10 @@ type_specifier_nonarray $$.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()); @@ -2809,12 +2806,10 @@ type_specifier_nonarray $$.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 +2827,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 +2848,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 +2869,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 +2890,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 +2911,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 +2932,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 +2953,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 +2974,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 +2995,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 +3016,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 +3037,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 +3058,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 +3079,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 +3100,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 +3140,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 +3183,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 +3276,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 +3298,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 +3350,7 @@ initializer : assignment_expression { $$ = $1; } + | LEFT_BRACE initializer_list RIGHT_BRACE { const char* initFeature = "{ } style initializers"; parseContext.requireProfile($1.loc, ~EEsProfile, initFeature); @@ -3386,8 +3363,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 +3376,7 @@ initializer_list } ; + declaration_statement : declaration { $$ = $1; } ; @@ -3416,9 +3396,12 @@ simple_statement | case_label { $$ = $1; } | iteration_statement { $$ = $1; } | jump_statement { $$ = $1; } + | demote_statement { $$ = $1; } + ; + demote_statement : DEMOTE SEMICOLON { parseContext.requireStage($1.loc, EShLangFragment, "demote"); @@ -3427,6 +3410,7 @@ demote_statement } ; + compound_statement : LEFT_BRACE RIGHT_BRACE { $$ = 0; } | LEFT_BRACE { @@ -3509,11 +3493,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); @@ -3554,11 +3540,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 @@ -3616,11 +3604,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) @@ -3751,11 +3741,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 @@ -3780,6 +3772,7 @@ function_definition } ; + attribute : LEFT_BRACKET LEFT_BRACKET attribute_list RIGHT_BRACKET RIGHT_BRACKET { $$ = $3; @@ -3802,4 +3795,5 @@ single_attribute $$ = parseContext.makeAttributes(*$1.string, $3); } + %% diff --git a/glslang/MachineIndependent/glslang_tab.cpp b/glslang/MachineIndependent/glslang_tab.cpp index a52b486f..523e4058 100644 --- a/glslang/MachineIndependent/glslang_tab.cpp +++ b/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,412 +123,414 @@ 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, - DEMOTE = 289, - BVEC2 = 290, - BVEC3 = 291, - BVEC4 = 292, - IVEC2 = 293, - IVEC3 = 294, - IVEC4 = 295, - UVEC2 = 296, - UVEC3 = 297, - UVEC4 = 298, - I64VEC2 = 299, - I64VEC3 = 300, - I64VEC4 = 301, - U64VEC2 = 302, - U64VEC3 = 303, - U64VEC4 = 304, - I32VEC2 = 305, - I32VEC3 = 306, - I32VEC4 = 307, - U32VEC2 = 308, - U32VEC3 = 309, - U32VEC4 = 310, - I16VEC2 = 311, - I16VEC3 = 312, - I16VEC4 = 313, - U16VEC2 = 314, - U16VEC3 = 315, - U16VEC4 = 316, - I8VEC2 = 317, - I8VEC3 = 318, - I8VEC4 = 319, - U8VEC2 = 320, - U8VEC3 = 321, - U8VEC4 = 322, - VEC2 = 323, - VEC3 = 324, - VEC4 = 325, - MAT2 = 326, - MAT3 = 327, - MAT4 = 328, - CENTROID = 329, - IN = 330, - OUT = 331, - INOUT = 332, - UNIFORM = 333, - PATCH = 334, - SAMPLE = 335, - BUFFER = 336, - SHARED = 337, - NONUNIFORM = 338, - PAYLOADNV = 339, - PAYLOADINNV = 340, - HITATTRNV = 341, - CALLDATANV = 342, - CALLDATAINNV = 343, - COHERENT = 344, - VOLATILE = 345, - RESTRICT = 346, - READONLY = 347, - WRITEONLY = 348, - DEVICECOHERENT = 349, - QUEUEFAMILYCOHERENT = 350, - WORKGROUPCOHERENT = 351, - SUBGROUPCOHERENT = 352, - NONPRIVATE = 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, - NOPERSPECTIVE = 378, - FLAT = 379, - SMOOTH = 380, - LAYOUT = 381, - EXPLICITINTERPAMD = 382, - PERVERTEXNV = 383, - PERPRIMITIVENV = 384, - PERVIEWNV = 385, - PERTASKNV = 386, - MAT2X2 = 387, - MAT2X3 = 388, - MAT2X4 = 389, - MAT3X2 = 390, - MAT3X3 = 391, - MAT3X4 = 392, - MAT4X2 = 393, - MAT4X3 = 394, - MAT4X4 = 395, - DMAT2X2 = 396, - DMAT2X3 = 397, - DMAT2X4 = 398, - DMAT3X2 = 399, - DMAT3X3 = 400, - DMAT3X4 = 401, - DMAT4X2 = 402, - DMAT4X3 = 403, - DMAT4X4 = 404, - F16MAT2X2 = 405, - F16MAT2X3 = 406, - F16MAT2X4 = 407, - F16MAT3X2 = 408, - F16MAT3X3 = 409, - F16MAT3X4 = 410, - F16MAT4X2 = 411, - F16MAT4X3 = 412, - F16MAT4X4 = 413, - F32MAT2X2 = 414, - F32MAT2X3 = 415, - F32MAT2X4 = 416, - F32MAT3X2 = 417, - F32MAT3X3 = 418, - F32MAT3X4 = 419, - F32MAT4X2 = 420, - F32MAT4X3 = 421, - F32MAT4X4 = 422, - F64MAT2X2 = 423, - F64MAT2X3 = 424, - F64MAT2X4 = 425, - F64MAT3X2 = 426, - F64MAT3X3 = 427, - F64MAT3X4 = 428, - F64MAT4X2 = 429, - F64MAT4X3 = 430, - F64MAT4X4 = 431, - ATOMIC_UINT = 432, - ACCSTRUCTNV = 433, - FCOOPMATNV = 434, - SAMPLER1D = 435, - SAMPLER2D = 436, - SAMPLER3D = 437, - SAMPLERCUBE = 438, - SAMPLER1DSHADOW = 439, - SAMPLER2DSHADOW = 440, - SAMPLERCUBESHADOW = 441, - SAMPLER1DARRAY = 442, - SAMPLER2DARRAY = 443, - SAMPLER1DARRAYSHADOW = 444, - SAMPLER2DARRAYSHADOW = 445, - ISAMPLER1D = 446, - ISAMPLER2D = 447, - ISAMPLER3D = 448, - ISAMPLERCUBE = 449, - ISAMPLER1DARRAY = 450, - ISAMPLER2DARRAY = 451, - USAMPLER1D = 452, - USAMPLER2D = 453, - USAMPLER3D = 454, - USAMPLERCUBE = 455, - USAMPLER1DARRAY = 456, - USAMPLER2DARRAY = 457, - SAMPLER2DRECT = 458, - SAMPLER2DRECTSHADOW = 459, - ISAMPLER2DRECT = 460, - USAMPLER2DRECT = 461, - SAMPLERBUFFER = 462, - ISAMPLERBUFFER = 463, - USAMPLERBUFFER = 464, - SAMPLERCUBEARRAY = 465, - SAMPLERCUBEARRAYSHADOW = 466, - ISAMPLERCUBEARRAY = 467, - USAMPLERCUBEARRAY = 468, - SAMPLER2DMS = 469, - ISAMPLER2DMS = 470, - USAMPLER2DMS = 471, - SAMPLER2DMSARRAY = 472, - ISAMPLER2DMSARRAY = 473, - USAMPLER2DMSARRAY = 474, - SAMPLEREXTERNALOES = 475, - SAMPLEREXTERNAL2DY2YEXT = 476, - F16SAMPLER1D = 477, - F16SAMPLER2D = 478, - F16SAMPLER3D = 479, - F16SAMPLER2DRECT = 480, - F16SAMPLERCUBE = 481, - F16SAMPLER1DARRAY = 482, - F16SAMPLER2DARRAY = 483, - F16SAMPLERCUBEARRAY = 484, - F16SAMPLERBUFFER = 485, - F16SAMPLER2DMS = 486, - F16SAMPLER2DMSARRAY = 487, - F16SAMPLER1DSHADOW = 488, - F16SAMPLER2DSHADOW = 489, - F16SAMPLER1DARRAYSHADOW = 490, - F16SAMPLER2DARRAYSHADOW = 491, - F16SAMPLER2DRECTSHADOW = 492, - F16SAMPLERCUBESHADOW = 493, - F16SAMPLERCUBEARRAYSHADOW = 494, - SAMPLER = 495, - SAMPLERSHADOW = 496, - TEXTURE1D = 497, - TEXTURE2D = 498, - TEXTURE3D = 499, - TEXTURECUBE = 500, - TEXTURE1DARRAY = 501, - TEXTURE2DARRAY = 502, - ITEXTURE1D = 503, - ITEXTURE2D = 504, - ITEXTURE3D = 505, - ITEXTURECUBE = 506, - ITEXTURE1DARRAY = 507, - ITEXTURE2DARRAY = 508, - UTEXTURE1D = 509, - UTEXTURE2D = 510, - UTEXTURE3D = 511, - UTEXTURECUBE = 512, - UTEXTURE1DARRAY = 513, - UTEXTURE2DARRAY = 514, - TEXTURE2DRECT = 515, - ITEXTURE2DRECT = 516, - UTEXTURE2DRECT = 517, - TEXTUREBUFFER = 518, - ITEXTUREBUFFER = 519, - UTEXTUREBUFFER = 520, - TEXTURECUBEARRAY = 521, - ITEXTURECUBEARRAY = 522, - UTEXTURECUBEARRAY = 523, - TEXTURE2DMS = 524, - ITEXTURE2DMS = 525, - UTEXTURE2DMS = 526, - TEXTURE2DMSARRAY = 527, - ITEXTURE2DMSARRAY = 528, - UTEXTURE2DMSARRAY = 529, - F16TEXTURE1D = 530, - F16TEXTURE2D = 531, - F16TEXTURE3D = 532, - F16TEXTURE2DRECT = 533, - F16TEXTURECUBE = 534, - F16TEXTURE1DARRAY = 535, - F16TEXTURE2DARRAY = 536, - F16TEXTURECUBEARRAY = 537, - F16TEXTUREBUFFER = 538, - F16TEXTURE2DMS = 539, - F16TEXTURE2DMSARRAY = 540, - SUBPASSINPUT = 541, - SUBPASSINPUTMS = 542, - ISUBPASSINPUT = 543, - ISUBPASSINPUTMS = 544, - USUBPASSINPUT = 545, - USUBPASSINPUTMS = 546, - F16SUBPASSINPUT = 547, - F16SUBPASSINPUTMS = 548, - IMAGE1D = 549, - IIMAGE1D = 550, - UIMAGE1D = 551, - IMAGE2D = 552, - IIMAGE2D = 553, - UIMAGE2D = 554, - IMAGE3D = 555, - IIMAGE3D = 556, - UIMAGE3D = 557, - IMAGE2DRECT = 558, - IIMAGE2DRECT = 559, - UIMAGE2DRECT = 560, - IMAGECUBE = 561, - IIMAGECUBE = 562, - UIMAGECUBE = 563, - IMAGEBUFFER = 564, - IIMAGEBUFFER = 565, - UIMAGEBUFFER = 566, - IMAGE1DARRAY = 567, - IIMAGE1DARRAY = 568, - UIMAGE1DARRAY = 569, - IMAGE2DARRAY = 570, - IIMAGE2DARRAY = 571, - UIMAGE2DARRAY = 572, - IMAGECUBEARRAY = 573, - IIMAGECUBEARRAY = 574, - UIMAGECUBEARRAY = 575, - IMAGE2DMS = 576, - IIMAGE2DMS = 577, - UIMAGE2DMS = 578, - IMAGE2DMSARRAY = 579, - IIMAGE2DMSARRAY = 580, - UIMAGE2DMSARRAY = 581, - F16IMAGE1D = 582, - F16IMAGE2D = 583, - F16IMAGE3D = 584, - F16IMAGE2DRECT = 585, - F16IMAGECUBE = 586, - F16IMAGE1DARRAY = 587, - F16IMAGE2DARRAY = 588, - F16IMAGECUBEARRAY = 589, - F16IMAGEBUFFER = 590, - F16IMAGE2DMS = 591, - F16IMAGE2DMSARRAY = 592, - STRUCT = 593, - VOID = 594, - WHILE = 595, - IDENTIFIER = 596, - TYPE_NAME = 597, - FLOATCONSTANT = 598, - DOUBLECONSTANT = 599, - INT16CONSTANT = 600, - UINT16CONSTANT = 601, - INT32CONSTANT = 602, - UINT32CONSTANT = 603, - INTCONSTANT = 604, - UINTCONSTANT = 605, - INT64CONSTANT = 606, - UINT64CONSTANT = 607, - BOOLCONSTANT = 608, - FLOAT16CONSTANT = 609, - LEFT_OP = 610, - RIGHT_OP = 611, - INC_OP = 612, - DEC_OP = 613, - LE_OP = 614, - GE_OP = 615, - EQ_OP = 616, - NE_OP = 617, - AND_OP = 618, - OR_OP = 619, - XOR_OP = 620, - MUL_ASSIGN = 621, - DIV_ASSIGN = 622, - ADD_ASSIGN = 623, - MOD_ASSIGN = 624, - LEFT_ASSIGN = 625, - RIGHT_ASSIGN = 626, - AND_ASSIGN = 627, - XOR_ASSIGN = 628, - OR_ASSIGN = 629, - SUB_ASSIGN = 630, - LEFT_PAREN = 631, - RIGHT_PAREN = 632, - LEFT_BRACKET = 633, - RIGHT_BRACKET = 634, - LEFT_BRACE = 635, - RIGHT_BRACE = 636, - DOT = 637, - COMMA = 638, - COLON = 639, - EQUAL = 640, - SEMICOLON = 641, - BANG = 642, - DASH = 643, - TILDE = 644, - PLUS = 645, - STAR = 646, - SLASH = 647, - PERCENT = 648, - LEFT_ANGLE = 649, - RIGHT_ANGLE = 650, - VERTICAL_BAR = 651, - CARET = 652, - AMPERSAND = 653, - QUESTION = 654, - INVARIANT = 655, - PRECISE = 656, - HIGH_PRECISION = 657, - MEDIUM_PRECISION = 658, - LOW_PRECISION = 659, - PRECISION = 660, - PACKED = 661, - RESOURCE = 662, - SUPERP = 663 + 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, + SAMPLERCUBEARRAY = 302, + SAMPLERCUBEARRAYSHADOW = 303, + ISAMPLERCUBEARRAY = 304, + USAMPLERCUBEARRAY = 305, + ATTRIBUTE = 306, + VARYING = 307, + FLOAT16_T = 308, + FLOAT32_T = 309, + DOUBLE = 310, + FLOAT64_T = 311, + INT64_T = 312, + UINT64_T = 313, + INT32_T = 314, + UINT32_T = 315, + INT16_T = 316, + UINT16_T = 317, + INT8_T = 318, + UINT8_T = 319, + I64VEC2 = 320, + I64VEC3 = 321, + I64VEC4 = 322, + U64VEC2 = 323, + U64VEC3 = 324, + U64VEC4 = 325, + I32VEC2 = 326, + I32VEC3 = 327, + I32VEC4 = 328, + U32VEC2 = 329, + U32VEC3 = 330, + U32VEC4 = 331, + I16VEC2 = 332, + I16VEC3 = 333, + I16VEC4 = 334, + U16VEC2 = 335, + U16VEC3 = 336, + U16VEC4 = 337, + I8VEC2 = 338, + I8VEC3 = 339, + I8VEC4 = 340, + U8VEC2 = 341, + U8VEC3 = 342, + U8VEC4 = 343, + DVEC2 = 344, + DVEC3 = 345, + DVEC4 = 346, + DMAT2 = 347, + DMAT3 = 348, + DMAT4 = 349, + F16VEC2 = 350, + F16VEC3 = 351, + F16VEC4 = 352, + F16MAT2 = 353, + F16MAT3 = 354, + F16MAT4 = 355, + F32VEC2 = 356, + F32VEC3 = 357, + F32VEC4 = 358, + F32MAT2 = 359, + F32MAT3 = 360, + F32MAT4 = 361, + F64VEC2 = 362, + F64VEC3 = 363, + F64VEC4 = 364, + F64MAT2 = 365, + F64MAT3 = 366, + F64MAT4 = 367, + DMAT2X2 = 368, + DMAT2X3 = 369, + DMAT2X4 = 370, + DMAT3X2 = 371, + DMAT3X3 = 372, + DMAT3X4 = 373, + DMAT4X2 = 374, + DMAT4X3 = 375, + DMAT4X4 = 376, + F16MAT2X2 = 377, + F16MAT2X3 = 378, + F16MAT2X4 = 379, + F16MAT3X2 = 380, + F16MAT3X3 = 381, + F16MAT3X4 = 382, + F16MAT4X2 = 383, + F16MAT4X3 = 384, + F16MAT4X4 = 385, + F32MAT2X2 = 386, + F32MAT2X3 = 387, + F32MAT2X4 = 388, + F32MAT3X2 = 389, + F32MAT3X3 = 390, + F32MAT3X4 = 391, + F32MAT4X2 = 392, + F32MAT4X3 = 393, + F32MAT4X4 = 394, + F64MAT2X2 = 395, + F64MAT2X3 = 396, + F64MAT2X4 = 397, + F64MAT3X2 = 398, + F64MAT3X3 = 399, + F64MAT3X4 = 400, + F64MAT4X2 = 401, + F64MAT4X3 = 402, + F64MAT4X4 = 403, + ATOMIC_UINT = 404, + ACCSTRUCTNV = 405, + FCOOPMATNV = 406, + ICOOPMATNV = 407, + UCOOPMATNV = 408, + SAMPLER1D = 409, + SAMPLER1DARRAY = 410, + SAMPLER1DARRAYSHADOW = 411, + ISAMPLER1D = 412, + SAMPLER1DSHADOW = 413, + SAMPLER2DRECT = 414, + SAMPLER2DRECTSHADOW = 415, + ISAMPLER2DRECT = 416, + USAMPLER2DRECT = 417, + SAMPLERBUFFER = 418, + ISAMPLERBUFFER = 419, + USAMPLERBUFFER = 420, + SAMPLER2DMS = 421, + ISAMPLER2DMS = 422, + USAMPLER2DMS = 423, + SAMPLER2DMSARRAY = 424, + ISAMPLER2DMSARRAY = 425, + USAMPLER2DMSARRAY = 426, + SAMPLEREXTERNALOES = 427, + SAMPLEREXTERNAL2DY2YEXT = 428, + ISAMPLER1DARRAY = 429, + USAMPLER1D = 430, + USAMPLER1DARRAY = 431, + F16SAMPLER1D = 432, + F16SAMPLER2D = 433, + F16SAMPLER3D = 434, + F16SAMPLER2DRECT = 435, + F16SAMPLERCUBE = 436, + F16SAMPLER1DARRAY = 437, + F16SAMPLER2DARRAY = 438, + F16SAMPLERCUBEARRAY = 439, + F16SAMPLERBUFFER = 440, + F16SAMPLER2DMS = 441, + F16SAMPLER2DMSARRAY = 442, + F16SAMPLER1DSHADOW = 443, + F16SAMPLER2DSHADOW = 444, + F16SAMPLER1DARRAYSHADOW = 445, + F16SAMPLER2DARRAYSHADOW = 446, + F16SAMPLER2DRECTSHADOW = 447, + F16SAMPLERCUBESHADOW = 448, + F16SAMPLERCUBEARRAYSHADOW = 449, + IMAGE1D = 450, + IIMAGE1D = 451, + UIMAGE1D = 452, + IMAGE2D = 453, + IIMAGE2D = 454, + UIMAGE2D = 455, + IMAGE3D = 456, + IIMAGE3D = 457, + UIMAGE3D = 458, + IMAGE2DRECT = 459, + IIMAGE2DRECT = 460, + UIMAGE2DRECT = 461, + IMAGECUBE = 462, + IIMAGECUBE = 463, + UIMAGECUBE = 464, + IMAGEBUFFER = 465, + IIMAGEBUFFER = 466, + UIMAGEBUFFER = 467, + IMAGE1DARRAY = 468, + IIMAGE1DARRAY = 469, + UIMAGE1DARRAY = 470, + IMAGE2DARRAY = 471, + IIMAGE2DARRAY = 472, + UIMAGE2DARRAY = 473, + IMAGECUBEARRAY = 474, + IIMAGECUBEARRAY = 475, + UIMAGECUBEARRAY = 476, + IMAGE2DMS = 477, + IIMAGE2DMS = 478, + UIMAGE2DMS = 479, + IMAGE2DMSARRAY = 480, + IIMAGE2DMSARRAY = 481, + UIMAGE2DMSARRAY = 482, + F16IMAGE1D = 483, + F16IMAGE2D = 484, + F16IMAGE3D = 485, + F16IMAGE2DRECT = 486, + F16IMAGECUBE = 487, + F16IMAGE1DARRAY = 488, + F16IMAGE2DARRAY = 489, + F16IMAGECUBEARRAY = 490, + F16IMAGEBUFFER = 491, + F16IMAGE2DMS = 492, + F16IMAGE2DMSARRAY = 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, + TEXTURE2DMS = 523, + ITEXTURE2DMS = 524, + UTEXTURE2DMS = 525, + TEXTURE2DMSARRAY = 526, + ITEXTURE2DMSARRAY = 527, + UTEXTURE2DMSARRAY = 528, + F16TEXTURE1D = 529, + F16TEXTURE2D = 530, + F16TEXTURE3D = 531, + F16TEXTURE2DRECT = 532, + F16TEXTURECUBE = 533, + F16TEXTURE1DARRAY = 534, + F16TEXTURE2DARRAY = 535, + F16TEXTURECUBEARRAY = 536, + F16TEXTUREBUFFER = 537, + F16TEXTURE2DMS = 538, + F16TEXTURE2DMSARRAY = 539, + SUBPASSINPUT = 540, + SUBPASSINPUTMS = 541, + ISUBPASSINPUT = 542, + ISUBPASSINPUTMS = 543, + USUBPASSINPUT = 544, + USUBPASSINPUTMS = 545, + F16SUBPASSINPUT = 546, + F16SUBPASSINPUTMS = 547, + 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, + FLAT = 627, + SMOOTH = 628, + LAYOUT = 629, + DOUBLECONSTANT = 630, + INT16CONSTANT = 631, + UINT16CONSTANT = 632, + FLOAT16CONSTANT = 633, + INT32CONSTANT = 634, + UINT32CONSTANT = 635, + INT64CONSTANT = 636, + UINT64CONSTANT = 637, + SUBROUTINE = 638, + DEMOTE = 639, + PAYLOADNV = 640, + PAYLOADINNV = 641, + HITATTRNV = 642, + CALLDATANV = 643, + CALLDATAINNV = 644, + PATCH = 645, + SAMPLE = 646, + BUFFER = 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 @@ -537,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; @@ -573,7 +575,7 @@ union YYSTYPE glslang::TArraySizes* typeParameters; } interm; -#line 577 "MachineIndependent/glslang_tab.cpp" /* yacc.c:355 */ +#line 579 "MachineIndependent/glslang_tab.cpp" /* yacc.c:355 */ }; typedef union YYSTYPE YYSTYPE; @@ -588,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 */ @@ -604,7 +606,7 @@ int yyparse (glslang::TParseContext* pParseContext); extern int yylex(YYSTYPE*, TParseContext&); -#line 608 "MachineIndependent/glslang_tab.cpp" /* yacc.c:358 */ +#line 610 "MachineIndependent/glslang_tab.cpp" /* yacc.c:358 */ #ifdef short # undef short @@ -844,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 9372 +#define YYLAST 9369 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 409 +#define YYNTOKENS 411 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 111 /* YYNRULES -- Number of rules. */ -#define YYNRULES 580 +#define YYNRULES 582 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 725 +#define YYNSTATES 727 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 663 +#define YYMAXUTOK 665 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -935,72 +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, 408 + 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, 3419, 3423, 3431, - 3432, 3436, 3432, 3448, 3449, 3453, 3453, 3460, 3460, 3474, - 3477, 3485, 3493, 3504, 3505, 3509, 3512, 3518, 3525, 3529, - 3537, 3541, 3554, 3557, 3563, 3563, 3583, 3586, 3592, 3604, - 3616, 3619, 3625, 3625, 3640, 3640, 3656, 3656, 3677, 3680, - 3686, 3689, 3695, 3699, 3706, 3711, 3716, 3723, 3726, 3735, - 3739, 3748, 3751, 3754, 3762, 3762, 3784, 3790, 3793, 3798, - 3801 + 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, 1364, 1372, 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, 2358, 2363, 2368, 2374, 2379, 2384, 2389, 2395, + 2401, 2407, 2413, 2419, 2425, 2431, 2437, 2443, 2449, 2455, + 2461, 2467, 2473, 2479, 2484, 2489, 2495, 2501, 2506, 2512, + 2518, 2523, 2528, 2534, 2540, 2545, 2551, 2556, 2561, 2567, + 2573, 2578, 2583, 2588, 2594, 2599, 2604, 2609, 2615, 2620, + 2625, 2630, 2636, 2641, 2646, 2651, 2656, 2661, 2667, 2672, + 2678, 2683, 2689, 2694, 2700, 2705, 2711, 2716, 2722, 2727, + 2733, 2738, 2743, 2748, 2753, 2758, 2763, 2768, 2773, 2778, + 2783, 2788, 2793, 2798, 2803, 2808, 2814, 2819, 2824, 2829, + 2835, 2840, 2845, 2850, 2856, 2861, 2866, 2871, 2877, 2882, + 2887, 2892, 2898, 2903, 2908, 2913, 2919, 2924, 2929, 2934, + 2940, 2945, 2950, 2955, 2961, 2966, 2971, 2976, 2982, 2987, + 2992, 2997, 3003, 3008, 3013, 3018, 3024, 3029, 3034, 3039, + 3045, 3050, 3055, 3060, 3066, 3071, 3076, 3081, 3087, 3092, + 3097, 3102, 3108, 3113, 3118, 3124, 3130, 3136, 3142, 3149, + 3156, 3162, 3168, 3174, 3180, 3186, 3192, 3199, 3204, 3220, + 3225, 3230, 3238, 3238, 3249, 3249, 3259, 3262, 3275, 3297, + 3324, 3328, 3334, 3339, 3350, 3354, 3360, 3371, 3374, 3381, + 3385, 3386, 3392, 3393, 3394, 3395, 3396, 3397, 3398, 3400, + 3406, 3415, 3416, 3420, 3416, 3432, 3433, 3437, 3437, 3444, + 3444, 3458, 3461, 3469, 3477, 3488, 3489, 3493, 3497, 3504, + 3511, 3515, 3523, 3527, 3540, 3544, 3551, 3551, 3571, 3574, + 3580, 3592, 3604, 3608, 3615, 3615, 3630, 3630, 3646, 3646, + 3667, 3670, 3676, 3679, 3685, 3689, 3696, 3701, 3706, 3713, + 3716, 3725, 3729, 3738, 3741, 3745, 3754, 3754, 3777, 3783, + 3786, 3791, 3794 }; #endif @@ -1009,55 +1011,57 @@ 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", "DEMOTE", "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", + "$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", + "SAMPLERCUBEARRAY", "SAMPLERCUBEARRAYSHADOW", "ISAMPLERCUBEARRAY", + "USAMPLERCUBEARRAY", "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", + "SAMPLER1D", "SAMPLER1DARRAY", "SAMPLER1DARRAYSHADOW", "ISAMPLER1D", + "SAMPLER1DSHADOW", "SAMPLER2DRECT", "SAMPLER2DRECTSHADOW", "ISAMPLER2DRECT", "USAMPLER2DRECT", "SAMPLERBUFFER", "ISAMPLERBUFFER", - "USAMPLERBUFFER", "SAMPLERCUBEARRAY", "SAMPLERCUBEARRAYSHADOW", - "ISAMPLERCUBEARRAY", "USAMPLERCUBEARRAY", "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", + "USAMPLERBUFFER", "SAMPLER2DMS", "ISAMPLER2DMS", "USAMPLER2DMS", + "SAMPLER2DMSARRAY", "ISAMPLER2DMSARRAY", "USAMPLER2DMSARRAY", + "SAMPLEREXTERNALOES", "SAMPLEREXTERNAL2DY2YEXT", "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", + "UIMAGEBUFFER", "IMAGE1DARRAY", "IIMAGE1DARRAY", "UIMAGE1DARRAY", + "IMAGE2DARRAY", "IIMAGE2DARRAY", "UIMAGE2DARRAY", "IMAGECUBEARRAY", + "IIMAGECUBEARRAY", "UIMAGECUBEARRAY", "IMAGE2DMS", "IIMAGE2DMS", + "UIMAGE2DMS", "IMAGE2DMSARRAY", "IIMAGE2DMSARRAY", "UIMAGE2DMSARRAY", + "F16IMAGE1D", "F16IMAGE2D", "F16IMAGE3D", "F16IMAGE2DRECT", + "F16IMAGECUBE", "F16IMAGE1DARRAY", "F16IMAGE2DARRAY", + "F16IMAGECUBEARRAY", "F16IMAGEBUFFER", "F16IMAGE2DMS", + "F16IMAGE2DMSARRAY", "SAMPLER", "SAMPLERSHADOW", "TEXTURE1D", "TEXTURE2D", "TEXTURE3D", "TEXTURECUBE", "TEXTURE1DARRAY", "TEXTURE2DARRAY", "ITEXTURE1D", "ITEXTURE2D", "ITEXTURE3D", "ITEXTURECUBE", "ITEXTURE1DARRAY", "ITEXTURE2DARRAY", "UTEXTURE1D", @@ -1071,34 +1075,32 @@ static const char *const yytname[] = "F16TEXTURE2DARRAY", "F16TEXTURECUBEARRAY", "F16TEXTUREBUFFER", "F16TEXTURE2DMS", "F16TEXTURE2DMSARRAY", "SUBPASSINPUT", "SUBPASSINPUTMS", "ISUBPASSINPUT", "ISUBPASSINPUTMS", "USUBPASSINPUT", - "USUBPASSINPUTMS", "F16SUBPASSINPUT", "F16SUBPASSINPUTMS", "IMAGE1D", - "IIMAGE1D", "UIMAGE1D", "IMAGE2D", "IIMAGE2D", "UIMAGE2D", "IMAGE3D", - "IIMAGE3D", "UIMAGE3D", "IMAGE2DRECT", "IIMAGE2DRECT", "UIMAGE2DRECT", - "IMAGECUBE", "IIMAGECUBE", "UIMAGECUBE", "IMAGEBUFFER", "IIMAGEBUFFER", - "UIMAGEBUFFER", "IMAGE1DARRAY", "IIMAGE1DARRAY", "UIMAGE1DARRAY", - "IMAGE2DARRAY", "IIMAGE2DARRAY", "UIMAGE2DARRAY", "IMAGECUBEARRAY", - "IIMAGECUBEARRAY", "UIMAGECUBEARRAY", "IMAGE2DMS", "IIMAGE2DMS", - "UIMAGE2DMS", "IMAGE2DMSARRAY", "IIMAGE2DMSARRAY", "UIMAGE2DMSARRAY", - "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", - "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", - "RIGHT_PAREN", "LEFT_BRACKET", "RIGHT_BRACKET", "LEFT_BRACE", - "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", + "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", "RIGHT_PAREN", "LEFT_BRACKET", + "RIGHT_BRACKET", "LEFT_BRACE", "RIGHT_BRACE", "DOT", "COMMA", "COLON", + "EQUAL", "SEMICOLON", "BANG", "DASH", "TILDE", "PLUS", "STAR", "SLASH", + "PERCENT", "LEFT_ANGLE", "RIGHT_ANGLE", "VERTICAL_BAR", "CARET", + "AMPERSAND", "QUESTION", "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", + "FLAT", "SMOOTH", "LAYOUT", "DOUBLECONSTANT", "INT16CONSTANT", + "UINT16CONSTANT", "FLOAT16CONSTANT", "INT32CONSTANT", "UINT32CONSTANT", + "INT64CONSTANT", "UINT64CONSTANT", "SUBROUTINE", "DEMOTE", "PAYLOADNV", + "PAYLOADINNV", "HITATTRNV", "CALLDATANV", "CALLDATAINNV", "PATCH", + "SAMPLE", "BUFFER", "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", @@ -1182,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, 663 + 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, + 665 }; # endif -#define YYPACT_NINF -657 +#define YYPACT_NINF -367 #define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-657))) + (!!((Yystate) == (-367))) -#define YYTABLE_NINF -526 +#define YYTABLE_NINF -528 #define yytable_value_is_error(Yytable_value) \ 0 @@ -1200,79 +1203,79 @@ static const yytype_uint16 yytoknum[] = STATE-NUM. */ static const yytype_int16 yypact[] = { - 3545, -657, -657, -657, -657, -657, -657, -657, -657, -657, - -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, - -328, -657, -657, -657, -657, -657, -657, -657, -657, -657, - -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, - -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, - -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, - -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, - -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, - -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, - -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, - -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, - -657, -657, -307, -657, -657, -657, -657, -657, -657, -657, - -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, - -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, - -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, - -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, - -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, - -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, - -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, - -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, - -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, - -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, - -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, - -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, - -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, - -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, - -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, - -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, - -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, - -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, - -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, - -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, - -657, -657, -657, -657, -318, -657, -657, -657, -657, -657, - -657, -657, -657, -259, -657, -320, -286, -236, -251, 5958, - -299, -657, -191, -657, -657, -657, -657, 4350, -657, -657, - -657, -657, -228, -657, -657, 724, -657, -657, -176, -72, - -212, -657, 9030, -352, -657, -657, -211, -657, 5958, -657, - -657, -657, 5958, -171, -169, -657, -324, -285, -657, -657, - -657, 8258, -205, -657, -657, -657, -657, -281, -657, -210, - -280, -657, -657, 5958, -208, 6714, -657, -345, 1127, -657, - -657, -657, -657, -205, -325, -657, 7100, -322, -657, -167, - -657, -271, -657, -657, -657, -657, -657, -657, -657, -657, - -657, -657, -657, -657, -657, 8258, 8258, 8258, -657, -657, - -657, -657, -657, -657, -327, -657, -657, -657, -198, -278, - 8644, -196, -657, 8258, -657, -657, -355, -197, -657, -159, - 8258, -657, -72, 5958, 5958, -158, 4752, -657, -657, -657, - -657, -245, -305, -291, -323, -209, -214, -207, -204, -178, - -177, -340, -192, 7486, -657, -193, -190, -657, -187, -182, - -189, 7872, -181, 8258, -186, -185, -174, -179, -172, -657, - -657, -293, -657, -657, -253, -657, -286, -165, -164, -657, - -657, -657, -657, -657, 1530, -657, -657, -657, -657, -657, - -657, -657, -657, -657, -19, -197, 7100, -292, 7100, -657, - -657, 7100, 5958, -657, -141, -657, -657, -657, -273, -657, - -657, 8258, -137, -657, -657, 8258, -163, -657, -657, -657, - 8258, -657, -657, -657, -657, -657, 5154, -158, -205, -252, - -657, -657, -657, 8258, 8258, 8258, 8258, 8258, 8258, 8258, - 8258, 8258, 8258, 8258, 8258, 8258, 8258, 8258, 8258, 8258, - 8258, 8258, -657, -657, -657, -166, -657, -657, 1933, -657, - 8258, -657, -657, -246, 8258, -229, -657, -657, -657, -136, - -657, 1933, -657, -657, -657, -657, -657, -657, -657, -657, - -657, -657, -657, 8258, 8258, -657, -657, -657, -657, -657, - -657, -657, 7100, -657, -232, -657, 5556, -657, -657, -142, - -145, -657, -657, -657, -657, -244, -197, -158, -657, -657, - -657, -657, -245, -245, -305, -305, -291, -291, -291, -291, - -323, -323, -209, -214, -207, -204, -178, -177, 8258, -657, - -101, 3142, -269, -657, -261, -657, 3948, -135, -344, -657, - 1933, -657, -657, -657, -657, 6328, -657, -657, -657, -657, - -227, -134, -657, -657, 3948, -140, -657, -145, -97, 5958, - -132, 8258, -133, -136, -131, -657, -657, 8258, 8258, -657, - -139, -129, 224, -128, 2739, -657, -127, -130, 2336, -126, - -657, -657, -657, -657, -254, 8258, 2336, -140, -657, -657, - 1933, 7100, -657, -657, -657, -657, -124, -145, -657, -657, - 1933, -125, -657, -657, -657 + 3994, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -13, -367, -367, -367, + -367, -367, 13, -367, -367, -367, -367, -367, 28, 40, + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -2, -1, 88, + 98, 6034, 116, -367, 74, -367, -367, -367, -367, 4402, + -367, -367, -367, -367, 104, -367, -367, 730, -367, -367, + 11, -367, 136, -25, 111, -367, 8, -367, 147, -367, + 6034, -367, -367, -367, 6034, 139, 140, -367, 61, -367, + 78, -367, -367, 8391, 155, -367, -367, -367, 149, 6034, + -367, 152, -367, -309, -367, -367, 80, 6831, -367, 27, + 1138, -367, -367, -367, -367, 155, 53, -367, 7221, 69, + -367, 141, -367, 117, 8391, 8391, 8391, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, -367, 77, -367, -367, -367, + 164, 89, 8781, 172, -367, 8391, -367, -367, -320, 176, + -367, 6034, 143, 4810, -367, 6034, 8391, -367, -25, -367, + 145, -367, -367, 138, 144, -231, 23, 65, 158, 153, + 162, 196, 197, 16, 182, 7611, -367, 185, 183, -367, + -367, 189, 180, 181, -367, 195, 198, 186, 8001, 200, + 8391, 199, 187, 122, -367, -367, 123, -367, -1, 203, + 204, -367, -367, -367, -367, -367, 1546, -367, -367, -367, + -367, -367, -367, -367, -367, -367, -353, 176, 7221, 71, + 7221, -367, -367, 7221, 6034, -367, 169, -367, -367, -367, + 91, -367, -367, 8391, 170, -367, -367, 8391, 207, -367, + -367, -367, 8391, -367, 143, 155, 125, -367, -367, -367, + 5218, -367, -367, -367, -367, 8391, 8391, 8391, 8391, 8391, + 8391, 8391, 8391, 8391, 8391, 8391, 8391, 8391, 8391, 8391, + 8391, 8391, 8391, 8391, -367, -367, -367, 206, 177, -367, + 1954, -367, -367, -367, 1954, -367, 8391, -367, -367, 135, + 8391, 60, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, -367, -367, -367, 8391, 8391, -367, -367, -367, + -367, -367, -367, -367, 7221, -367, 129, -367, 5626, -367, + -367, 209, 208, -367, -367, -367, 142, 176, 143, -367, + -367, -367, -367, -367, 138, 138, 144, 144, -231, -231, + -231, -231, 23, 23, 65, 158, 153, 162, 196, 197, + 8391, -367, 214, -314, -367, 1954, 3586, 173, 3178, 93, + -367, 96, -367, -367, -367, -367, -367, 6441, -367, -367, + -367, -367, 121, 8391, 213, 177, 215, 208, 188, 6034, + 217, 221, -367, -367, 3586, 218, -367, -367, -367, 8391, + 222, -367, -367, -367, 216, 2362, 8391, -367, 219, 226, + 190, 224, 2770, -367, 227, -367, -367, 7221, -367, -367, + -367, 100, 8391, 2362, 218, -367, -367, 1954, -367, 220, + 208, -367, -367, 1954, 228, -367, -367 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -1280,113 +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, 573, 131, 146, - 487, 488, 489, 0, 572, 0, 574, 0, 108, 107, - 0, 119, 124, 153, 152, 150, 154, 0, 147, 149, - 155, 129, 195, 151, 485, 0, 569, 571, 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, 570, 186, 0, 145, 143, - 0, 141, 490, 0, 0, 0, 97, 0, 0, 575, - 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, 554, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 520, 529, - 533, 44, 77, 90, 0, 507, 0, 155, 129, 510, - 531, 509, 517, 508, 0, 511, 512, 535, 513, 542, - 514, 515, 550, 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, 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, 335, 336, 353, 354, 355, + 357, 360, 361, 362, 364, 337, 338, 358, 365, 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, 326, 333, 334, 352, 332, 366, 367, 370, + 371, 372, 374, 375, 376, 378, 379, 380, 382, 383, + 474, 475, 356, 359, 363, 339, 340, 341, 368, 342, + 346, 347, 350, 373, 377, 381, 343, 344, 348, 349, + 369, 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, 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, 575, 131, 489, 490, 491, 0, 488, 160, 158, + 159, 157, 0, 199, 161, 162, 133, 132, 0, 183, + 169, 170, 168, 171, 172, 166, 167, 163, 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, - 0, 0, 75, 191, 192, 0, 565, 564, 0, 556, - 0, 568, 566, 0, 0, 0, 549, 518, 552, 0, - 519, 0, 80, 81, 83, 82, 85, 86, 87, 88, - 89, 84, 79, 0, 0, 534, 530, 532, 536, 543, - 551, 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, 567, 0, 548, 0, 579, 0, 577, - 521, 78, 91, 122, 503, 0, 103, 18, 497, 499, - 0, 0, 559, 558, 561, 527, 544, 540, 0, 0, - 0, 0, 0, 0, 0, 504, 506, 0, 0, 560, - 0, 0, 539, 0, 0, 537, 0, 0, 0, 0, - 576, 578, 522, 76, 0, 562, 0, 527, 526, 528, - 546, 0, 524, 553, 523, 580, 0, 563, 557, 538, - 547, 0, 541, 555, 545 + 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[] = { - -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, - -657, -657, -337, -657, -398, -395, -435, -404, -312, -310, - -309, -311, -306, -308, -657, -383, -657, -397, -657, -413, - -421, 1, -657, -657, -657, 2, -657, -657, -657, -107, - -102, -105, -657, -657, -629, -657, -657, -657, -657, -180, - -657, -336, -343, -657, 6, -657, 0, -357, -657, -657, - -657, -657, -63, -657, -657, -657, -431, -439, -276, -354, - -503, -657, -377, -484, -656, -657, -417, -657, -657, -429, - -428, -657, -657, -88, -575, -370, -657, -231, -657, -392, - -657, -230, -657, -657, -657, -657, -226, -657, -657, -657, - -657, -657, -657, -657, -657, -70, -657, -657, -657, -657, - -396 + -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, + -367, -367, 8696, -367, -81, -78, -225, -82, -20, -18, + -21, -17, -19, -16, -367, -85, -367, -98, -367, -110, + -118, 2, -367, -367, -367, 4, -367, -367, -367, 184, + 191, 192, -367, -367, -339, -367, -367, -367, -367, 102, + -367, -37, -44, -367, 9, -367, 0, -71, -367, -367, + -367, -367, 260, -367, -367, -367, -136, -137, 18, -65, + -209, -367, -94, -198, -366, -367, -134, -367, -367, -148, + -146, -367, -367, 202, -265, -87, -367, 56, -367, -111, + -367, 59, -367, -367, -367, -367, 62, -367, -367, -367, + -367, -367, -367, -367, -367, 225, -367, -367, -367, -367, + -99 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 432, 433, 434, 619, 435, 436, 437, 438, 439, - 440, 441, 491, 443, 461, 462, 463, 464, 465, 466, - 467, 468, 469, 470, 471, 492, 648, 493, 603, 494, - 544, 495, 335, 522, 411, 496, 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, 549, 550, - 520, 614, 499, 500, 501, 502, 503, 591, 684, 713, - 692, 693, 694, 714, 504, 505, 506, 507, 695, 680, - 508, 509, 696, 721, 510, 511, 512, 656, 578, 651, - 674, 690, 691, 513, 355, 356, 357, 366, 514, 658, - 659 + -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 @@ -1394,82 +1397,163 @@ 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, 519, - 388, 482, 472, 611, 528, 613, 660, 552, 615, 407, - 607, 363, 546, 360, 571, 447, 395, 678, 540, 379, - 529, 530, 372, 473, 396, 682, 560, 561, 709, 683, - 541, 474, 712, 537, 442, 678, 515, 517, 358, -34, - 712, 531, 405, 395, 395, 532, 473, 454, 460, 572, - 516, 406, 361, 521, 558, 559, 364, 543, 583, 359, - 585, 562, 563, 592, 593, 594, 595, 596, 597, 598, - 599, 600, 601, 556, 374, 557, 473, 375, 526, 527, - 575, 616, 602, 612, 650, 408, 448, 451, 409, 534, - 365, 410, 449, 452, 618, 535, 539, 552, 675, 663, - 604, 379, 524, 460, 604, 525, 676, 454, 620, 519, - 454, 519, 604, 716, 519, 636, 637, 638, 639, 604, - 604, 627, 368, 605, 628, 720, 460, 604, 622, 627, - 653, 367, 668, 330, 331, 332, 553, 554, 555, 664, - 376, 665, 564, 565, 604, 655, 604, 687, 632, 633, - 640, 641, 686, 634, 635, 386, 381, 652, 392, 398, - 403, 654, 404, 395, 523, 450, 607, 552, 458, 533, - 538, 473, 542, 548, 566, 569, 454, 573, 570, 579, - 567, 626, 568, 576, 580, 584, 577, 581, 586, 589, - 617, 587, 588, 623, 621, 657, 661, 662, 722, 590, - 454, -35, -33, 649, -28, 519, 629, 630, 631, 460, - 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, - 460, 460, 460, 460, 460, 670, 607, 667, 604, 671, - -525, 681, 688, 677, 697, 698, 700, 705, 706, 707, - 702, 715, 488, 710, 642, 711, 724, 643, 645, 644, - 699, 677, 723, 647, 646, 401, 400, 402, 519, 389, - 362, 625, 545, 669, 672, 704, 708, 718, 399, 719, - 454, 673, 689, 608, 609, 385, 0, 701, 610, 0, - 703, 0, 717, 0, 0, 0, 0, 0, 543, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 519, 0, 0, 0, 0, 0, - 679, 486, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 379, 0, 679, 373, - 0, 0, 0, 0, 460, 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, 498, 350, - 0, 0, 0, 0, 497, 0, 0, 0, 0, 0, + 353, 542, 336, 674, 338, 481, 457, 675, 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, 560, 561, 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, 374, 381, 530, 409, 609, 613, + 521, 615, 474, 449, 617, 655, 549, 678, 573, 550, + 562, 563, 365, 367, 397, 391, 293, 294, 295, 708, + 381, 361, 398, 374, 517, 519, 716, 638, 639, 640, + 641, 375, 363, 475, 539, 678, 392, 708, 366, 382, + 352, 476, 451, 574, 364, 564, 565, 353, 352, 336, + 388, 338, 297, 362, 566, 567, 352, 302, 303, 397, + 375, 551, 531, 532, 375, 407, 518, 397, 589, 352, + 591, 606, 662, 352, 408, 475, 657, 475, 618, 452, + 577, -34, 523, 533, 614, 459, 410, 534, 352, 411, + 500, 460, 412, 369, 536, 665, 620, 381, 685, 499, + 537, 686, 606, 549, 606, 719, 451, 606, 451, 370, + 521, 606, 521, 622, 378, 521, 594, 595, 596, 597, + 598, 599, 600, 601, 602, 603, 383, 376, 526, 624, + 377, 527, 606, 689, 606, 604, 628, 607, 666, 629, + 667, 544, 723, 452, 390, 452, 606, 609, 688, 660, + 352, 395, 352, 628, 352, 400, 670, 555, 556, 557, + 558, 397, 559, 450, 627, 456, 659, 634, 635, 535, + 661, 549, 636, 637, 642, 643, 540, 451, 569, 405, + 406, 525, 475, 545, 568, 554, 570, 571, 718, 575, + 572, 578, 579, 581, 582, 583, 500, 663, 664, 585, + 587, 593, 586, 451, 590, 499, 521, -35, -33, 619, + 623, 592, -28, 651, 452, 609, 669, 652, 673, 606, + 691, 681, 695, 352, 693, 696, -527, 706, 694, 707, + 672, 713, 478, 712, 725, 717, 677, 726, 644, 646, + 452, 645, 714, 648, 647, 690, 360, 649, 403, 352, + 553, 402, 626, 671, 682, 721, 404, 715, 722, 521, + 401, 683, 610, 697, 677, 611, 692, 0, 612, 0, + 500, 451, 387, 0, 500, 0, 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, 0, 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, + 304, 305, 306, 307, 308, 0, 0, 0, 0, 0, + 0, 0, 0, 309, 0, 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, 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, 455, 547, 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, 0, 0, 498, 0, 0, 0, 0, 0, - 497, 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, 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, 498, 0, - 0, 0, 0, 0, 497, 0, 0, 0, 0, 0, - 0, 498, 0, 0, 0, 0, 0, 497, 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, 0, 0, - 0, 498, 0, 0, 0, 0, 498, 497, 0, 0, - 498, 0, 497, 0, 0, 0, 497, 0, 0, 0, - 0, 0, 0, 0, 498, 0, 0, 0, 0, 380, - 497, 0, 0, 0, 0, 350, 0, 0, 0, 0, - 0, 0, 0, 0, 498, 0, 0, 0, 498, 0, - 497, 0, 0, 0, 497, 0, 498, 0, 0, 0, - 498, 0, 497, 0, 0, 0, 497, 0, 0, 0, - 498, 0, 0, 0, 384, 0, 497, 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, 0, 21, + 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, 426, 427, 428, 429, 430, 431, 432, + 433, 309, 492, 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, 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, @@ -1496,24 +1580,771 @@ static const yytype_int16 yytable[] = 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, + 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, 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, 426, 427, 428, 429, 430, 431, 432, 433, 309, + 492, 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, 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, 426, + 427, 428, 429, 430, 431, 432, 433, 309, 492, 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, 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, + 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, 426, 427, 428, + 429, 430, 431, 432, 433, 309, 492, 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, 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, 426, 427, 428, 429, 430, + 431, 432, 433, 309, 492, 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, 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, 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, 426, 427, 428, 429, 430, 431, 432, + 433, 309, 0, 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, 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, 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, 426, 427, 428, 429, 430, 431, 432, 433, 309, + 0, 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, 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, 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, 304, 305, 306, 307, 308, 0, + 0, 0, 0, 0, 0, 0, 0, 309, 0, 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, 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, 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, 0, 0, 0, + 0, 0, 0, 0, 0, 309, 0, 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, 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, + 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, 0, 0, 0, 0, 0, + 0, 0, 0, 309, 0, 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, 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, 630, 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, 0, 0, 0, 0, 0, 0, 0, + 0, 309, 0, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 309, + 0, 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, 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, 0, 0, 0, 0, 0, 0, 0, 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, 475, - 476, 477, 0, 478, 479, 480, 481, 482, 483, 484, - 20, 485, 21, 22, 23, 24, 25, 26, 27, 28, + 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, 0, + 0, 0, 0, 0, 0, 0, 0, 309, 0, 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, 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, 0, 0, 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, 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, + 0, 0, 0, 0, 0, 0, 426, 427, 428, 429, + 430, 431, 432, 433, 0, 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, 0, 0, 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, 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, 0, 0, 0, 0, 0, 426, 427, 428, 429, + 430, 431, 432, 433, 0, 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, 0, 0, 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, 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, 426, 427, 428, 429, + 430, 431, 432, 433, 0, 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, 0, 0, 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, 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, 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, 426, 427, 428, 429, + 430, 431, 432, 433, 0, 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, 0, 0, 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, 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, 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, 426, 427, 428, 429, + 430, 431, 432, 433, 0, 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, 0, 0, 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, 0, 0, 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, 0, 0, 0, 0, 0, 426, 427, 428, 429, + 430, 431, 432, 433, 0, 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, 0, 0, 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, 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, 426, 427, 428, 429, + 430, 431, 432, 433, 0, 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, 317, 0, 358, 315, 321, 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, + 49, 50, 293, 294, 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, @@ -1537,101 +2368,52 @@ static const yytype_int16 yytable[] = 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, 486, 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, 487, 0, 488, 489, 0, - 0, 0, 0, 490, 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, 485, 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, - 486, 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, 487, 0, - 488, 606, 0, 0, 0, 0, 490, 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, 485, 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, 486, 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, 487, 0, 488, 0, 0, 0, 0, 0, 490, - 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, - 485, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 289, 290, 291, 292, 341, 349, 416, 378, 506, 518, + 408, 520, 397, 384, 523, 580, 453, 656, 302, 455, + 297, 298, 324, 324, 316, 350, 339, 340, 341, 695, + 374, 318, 324, 370, 405, 406, 702, 562, 563, 564, + 565, 341, 314, 316, 442, 684, 371, 713, 350, 349, + 341, 324, 389, 337, 314, 332, 333, 357, 349, 357, + 360, 357, 351, 350, 299, 300, 357, 356, 357, 316, + 370, 456, 295, 296, 374, 314, 323, 316, 488, 370, + 490, 321, 322, 374, 323, 316, 584, 316, 524, 389, + 475, 314, 323, 316, 323, 315, 318, 320, 389, 321, + 400, 321, 324, 315, 315, 614, 315, 451, 315, 400, + 321, 315, 321, 550, 321, 315, 453, 321, 455, 321, + 518, 321, 520, 533, 350, 523, 304, 305, 306, 307, + 308, 309, 310, 311, 312, 313, 332, 321, 321, 537, + 324, 324, 321, 322, 321, 323, 321, 324, 319, 324, + 321, 451, 717, 453, 318, 455, 321, 655, 667, 324, + 451, 350, 453, 321, 455, 318, 324, 329, 330, 331, + 326, 316, 328, 324, 545, 323, 586, 558, 559, 315, + 590, 618, 560, 561, 566, 567, 314, 524, 335, 350, + 350, 350, 316, 350, 336, 350, 334, 301, 707, 317, + 303, 316, 319, 314, 324, 324, 506, 605, 606, 314, + 324, 324, 314, 550, 314, 506, 614, 314, 314, 350, + 350, 322, 315, 317, 524, 723, 317, 350, 314, 321, + 317, 358, 315, 524, 319, 314, 318, 315, 350, 323, + 650, 315, 318, 324, 324, 318, 656, 319, 568, 570, + 550, 569, 362, 572, 571, 673, 296, 573, 374, 550, + 458, 370, 544, 628, 658, 713, 374, 701, 714, 667, + 368, 658, 516, 684, 684, 516, 675, -1, 516, -1, + 580, 618, 357, -1, 584, -1, 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, @@ -1658,261 +2440,20 @@ 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, 486, 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, 487, 0, 398, 0, 0, 0, - 0, 0, 490, 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, 485, 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, 486, - 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, 487, 0, 0, - 0, 0, 0, 0, 0, 490, 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, 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, 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, 490, 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, 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, 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, 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, 0, - 0, 20, 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, 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, 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, 0, - 0, 0, 0, 20, 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, 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, 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, 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, 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, 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, 551, 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, 0, 21, + 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, -1, -1, -1, -1, -1, + -1, -1, -1, 383, -1, 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, @@ -1940,639 +2481,21 @@ static const yytype_int16 yytable[] = 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, 624, 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, - 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, - 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, 666, 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, 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, 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, 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, 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, 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, 518, 685, - 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, 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, 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, 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, - 518, 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, - 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, 574, 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, 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, 582, 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, 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, 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, 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, 536, 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, 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, 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, 0, 326 -}; - -static const yytype_int16 yycheck[] = -{ - 0, 0, 0, 339, 347, 24, 0, 26, 27, 406, - 82, 30, 395, 516, 427, 518, 591, 456, 521, 376, - 504, 341, 453, 341, 364, 382, 378, 656, 383, 372, - 357, 358, 368, 378, 386, 379, 359, 360, 694, 383, - 395, 386, 698, 440, 381, 674, 403, 404, 376, 376, - 706, 378, 376, 378, 378, 382, 378, 393, 395, 399, - 385, 385, 380, 385, 355, 356, 386, 450, 481, 376, - 483, 394, 395, 366, 367, 368, 369, 370, 371, 372, - 373, 374, 375, 388, 383, 390, 378, 386, 425, 426, - 473, 522, 385, 385, 578, 380, 377, 377, 383, 377, - 386, 386, 383, 383, 377, 383, 443, 546, 377, 612, - 383, 454, 383, 450, 383, 386, 377, 453, 531, 516, - 456, 518, 383, 377, 521, 560, 561, 562, 563, 383, - 383, 383, 383, 386, 386, 710, 473, 383, 535, 383, - 386, 377, 386, 402, 403, 404, 391, 392, 393, 381, - 341, 383, 361, 362, 383, 384, 383, 384, 556, 557, - 564, 565, 665, 558, 559, 341, 394, 580, 380, 380, - 341, 584, 341, 378, 341, 385, 660, 616, 386, 377, - 376, 378, 341, 341, 398, 363, 522, 379, 365, 376, - 397, 548, 396, 386, 376, 376, 386, 386, 384, 378, - 341, 386, 376, 540, 341, 341, 603, 604, 711, 381, - 546, 376, 376, 379, 377, 612, 553, 554, 555, 556, - 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, - 567, 568, 569, 570, 571, 648, 720, 379, 383, 340, - 380, 376, 376, 656, 341, 377, 379, 386, 377, 25, - 381, 377, 380, 380, 566, 385, 381, 567, 569, 568, - 681, 674, 386, 571, 570, 372, 368, 372, 665, 341, - 333, 547, 452, 627, 651, 688, 693, 706, 366, 707, - 616, 651, 674, 514, 514, 355, -1, 683, 514, -1, - 687, -1, 705, -1, -1, -1, -1, -1, 681, -1, + 292, -1, -1, 295, 296, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 711, -1, -1, -1, -1, -1, - 656, 340, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 679, -1, 674, 339, - -1, -1, -1, -1, 681, 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, - -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, 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, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 504, -1, -1, -1, -1, -1, - 504, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 522, -1, -1, -1, -1, -1, 522, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 546, -1, -1, -1, - -1, -1, 546, -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, 578, -1, - -1, -1, -1, -1, 578, -1, -1, -1, -1, -1, - -1, 591, -1, -1, -1, -1, -1, 591, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 616, -1, -1, -1, - -1, -1, 616, -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, 651, -1, -1, -1, -1, 656, 651, -1, -1, - 660, -1, 656, -1, -1, -1, 660, -1, -1, -1, - -1, -1, -1, -1, 674, -1, -1, -1, -1, 679, - 674, -1, -1, -1, -1, 679, -1, -1, -1, -1, - -1, -1, -1, -1, 694, -1, -1, -1, 698, -1, - 694, -1, -1, -1, 698, -1, 706, -1, -1, -1, - 710, -1, 706, -1, -1, -1, 710, -1, -1, -1, - 720, -1, -1, -1, 0, -1, 720, 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, -1, 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, -1, -1, 342, -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, - 386, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 400, 401, 402, 403, 404, 405, - 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, 354, -1, -1, 357, 358, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 376, -1, 378, -1, 380, 381, -1, - -1, -1, -1, 386, 387, 388, 389, 390, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 400, 401, 402, - 403, 404, 405, 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, 354, -1, -1, 357, 358, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 376, -1, 378, -1, - 380, 381, -1, -1, -1, -1, 386, 387, 388, 389, - 390, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 400, 401, 402, 403, 404, 405, 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, 354, -1, -1, - 357, 358, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 376, - -1, 378, -1, 380, -1, -1, -1, -1, -1, 386, - 387, 388, 389, 390, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 400, 401, 402, 403, 404, 405, 3, + -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, -1, 26, 27, 28, 29, 30, 31, 32, 33, + 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, @@ -2598,263 +2521,22 @@ static const yytype_int16 yycheck[] = 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, - 354, -1, -1, 357, 358, -1, -1, -1, -1, -1, + 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, 376, -1, 378, -1, 380, -1, -1, -1, - -1, -1, 386, 387, 388, 389, 390, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 400, 401, 402, 403, - 404, 405, 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, 354, -1, -1, 357, 358, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 376, -1, 378, -1, -1, - -1, -1, -1, -1, -1, 386, 387, 388, 389, 390, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 400, - 401, 402, 403, 404, 405, 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, -1, 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, -1, 341, 342, 343, 344, 345, 346, 347, - 348, 349, 350, 351, 352, 353, 354, -1, -1, 357, - 358, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 376, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 386, 387, - 388, 389, 390, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 400, 401, 402, 403, 404, 405, 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, -1, - 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, -1, -1, 342, -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, 386, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 400, 401, 402, 403, 404, - 405, 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, -1, 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, -1, 341, - 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, - 352, 353, 354, -1, -1, 357, 358, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 376, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 387, 388, 389, 390, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 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, -1, 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, - -1, 341, 342, -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, 386, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 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, -1, 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, -1, -1, 342, -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, 381, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 400, 401, 402, 403, 404, 3, 4, 5, + 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, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 33, -1, 35, + 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, @@ -2880,62 +2562,104 @@ static const yytype_int16 yycheck[] = 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, -1, -1, 342, -1, -1, -1, + 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, + 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, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 381, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 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, - -1, 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, -1, -1, 342, -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, 381, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 400, 401, 402, 403, - 404, 3, 4, 5, 6, 7, 8, 9, 10, 11, + -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, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 33, -1, 35, 36, 37, 38, 39, 40, 41, + 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, @@ -2961,143 +2685,31 @@ static const yytype_int16 yycheck[] = 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, -1, -1, - 342, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 292, -1, -1, 295, 296, -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, 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, 400, 401, - 402, 403, 404, 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, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 83, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, - 122, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 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, -1, 341, - 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, - 352, 353, 354, -1, -1, 357, 358, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 376, -1, -1, -1, 380, 381, - -1, -1, -1, -1, -1, 387, 388, 389, 390, 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, -1, 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, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 83, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, - 116, 117, 118, 119, 120, 121, 122, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 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, -1, 341, 342, 343, 344, 345, - 346, 347, 348, 349, 350, 351, 352, 353, 354, -1, - -1, 357, 358, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 376, -1, -1, 379, -1, -1, -1, -1, -1, -1, - -1, 387, 388, 389, 390, 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, -1, 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, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 83, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 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, - -1, 341, 342, 343, 344, 345, 346, 347, 348, 349, - 350, 351, 352, 353, 354, -1, -1, 357, 358, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 376, -1, -1, -1, - 380, -1, -1, -1, -1, -1, -1, 387, 388, 389, - 390, 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, - -1, 35, 36, 37, 38, 39, 40, 41, 42, 43, + -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, -1, 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, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 83, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 99, 100, 101, 102, 103, + 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, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 132, 133, + 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, @@ -3113,30 +2725,73 @@ static const yytype_int16 yycheck[] = 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, -1, 341, 342, 343, - 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, - 354, -1, -1, 357, 358, -1, -1, -1, -1, -1, + 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, 376, -1, -1, 379, -1, -1, -1, -1, - -1, -1, -1, 387, 388, 389, 390, 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, -1, 35, 36, 37, + 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, + -1, 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, -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, -1, + -1, -1, -1, -1, -1, -1, -1, 383, -1, 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, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 83, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 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, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 132, 133, 134, 135, 136, 137, + 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, @@ -3152,29 +2807,72 @@ static const yytype_int16 yycheck[] = 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, -1, 341, 342, 343, 344, 345, 346, 347, - 348, 349, 350, 351, 352, 353, 354, -1, -1, 357, - 358, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 376, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 386, 387, - 388, 389, 390, 5, 6, 7, 8, 9, -1, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 288, 289, 290, 291, 292, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 35, 36, 37, 38, 39, 40, 41, + -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, -1, -1, -1, + -1, -1, -1, -1, -1, 383, -1, 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, -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, -1, -1, -1, -1, -1, + -1, -1, -1, 383, -1, 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, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 83, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 99, 100, 101, + 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, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 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, @@ -3191,29 +2889,72 @@ static const yytype_int16 yycheck[] = 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, -1, 341, - 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, - 352, 353, 354, -1, -1, 357, 358, -1, -1, -1, + 292, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 376, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 387, 388, 389, 390, 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, -1, 35, + -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, -1, -1, -1, -1, -1, -1, -1, + -1, 383, -1, 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, -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, -1, -1, -1, -1, -1, -1, -1, -1, 383, + -1, 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, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 83, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 99, 100, 101, 102, 103, 104, 105, + 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, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 132, 133, 134, 135, + 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, @@ -3229,51 +2970,311 @@ static const yytype_int16 yycheck[] = 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, -1, 341, 342, 343, 344, 345, - 346, 347, 348, 349, 350, 351, 352, 353, 354, -1, - -1, 357, 358, -1, -1, -1, -1, -1, -1, -1, + 286, 287, 288, 289, 290, 291, 292, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 376, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 387, 388, 389, 390, 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, -1, 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, -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, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 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, - -1, -1, 342 + -1, -1, -1, -1, -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, -1, + -1, -1, -1, -1, -1, -1, -1, 383, -1, 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, 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, -1, -1, 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, 318, + 319, -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, + -1, -1, -1, -1, -1, -1, 375, 376, 377, 378, + 379, 380, 381, 382, -1, -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, -1, -1, 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, 317, -1, + -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, + -1, -1, -1, -1, -1, -1, 375, 376, 377, 378, + 379, 380, 381, 382, -1, -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, -1, -1, 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, 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, + -1, -1, -1, -1, -1, -1, 375, 376, 377, 378, + 379, 380, 381, 382, -1, -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, -1, -1, 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, 317, -1, + -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, + -1, -1, -1, -1, -1, -1, 375, 376, 377, 378, + 379, 380, 381, 382, -1, -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, -1, -1, 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, -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, -1, -1, 375, 376, 377, 378, + 379, 380, 381, 382, -1, -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, -1, -1, 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, -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, -1, -1, 375, 376, 377, 378, + 379, 380, 381, 382, -1, -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, -1, -1, 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, 383, + -1, -1, -1, -1, -1, -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, 375, 376, 377, 378, + 379, 380, 381, 382, -1, -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, + -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, -1, -1, -1, -1, -1, 542, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -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, -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, + -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, 673 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -3282,148 +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, 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, 342, 386, 400, 401, - 402, 403, 404, 405, 440, 441, 444, 445, 446, 447, - 451, 452, 453, 454, 455, 456, 459, 460, 461, 462, - 463, 465, 470, 471, 472, 513, 514, 515, 376, 376, - 341, 380, 471, 341, 386, 386, 516, 377, 383, 448, - 449, 450, 460, 465, 383, 386, 341, 341, 386, 461, - 465, 394, 467, 468, 0, 514, 341, 464, 82, 341, - 457, 458, 380, 474, 465, 378, 386, 466, 380, 492, - 449, 448, 450, 341, 341, 376, 385, 466, 380, 383, - 386, 443, 341, 343, 344, 345, 346, 347, 348, 349, - 350, 351, 352, 353, 354, 357, 358, 376, 387, 388, - 389, 390, 410, 411, 412, 414, 415, 416, 417, 418, - 419, 420, 421, 422, 463, 465, 469, 466, 377, 383, - 385, 377, 383, 473, 460, 465, 475, 476, 386, 379, - 421, 423, 424, 425, 426, 427, 428, 429, 430, 431, - 432, 433, 434, 378, 386, 22, 23, 24, 26, 27, - 28, 29, 30, 31, 32, 34, 340, 378, 380, 381, - 386, 421, 434, 436, 438, 440, 444, 463, 465, 481, - 482, 483, 484, 485, 493, 494, 495, 496, 499, 500, - 503, 504, 505, 512, 517, 466, 385, 466, 380, 436, - 479, 385, 442, 341, 383, 386, 421, 421, 438, 357, - 358, 378, 382, 377, 377, 383, 339, 436, 376, 421, - 383, 395, 341, 434, 439, 458, 475, 465, 341, 477, - 478, 381, 476, 391, 392, 393, 388, 390, 355, 356, - 359, 360, 394, 395, 361, 362, 398, 397, 396, 363, - 365, 364, 399, 379, 379, 434, 386, 386, 507, 376, - 376, 386, 386, 438, 376, 438, 384, 386, 376, 378, - 381, 486, 366, 367, 368, 369, 370, 371, 372, 373, - 374, 375, 385, 437, 383, 386, 381, 482, 496, 500, - 505, 479, 385, 479, 480, 479, 475, 341, 377, 413, - 438, 341, 436, 421, 381, 477, 466, 383, 386, 421, - 421, 421, 423, 423, 424, 424, 425, 425, 425, 425, - 426, 426, 427, 428, 429, 430, 431, 432, 435, 379, - 482, 508, 438, 386, 438, 384, 506, 341, 518, 519, - 493, 436, 436, 479, 381, 383, 381, 379, 386, 478, - 438, 340, 481, 494, 509, 377, 377, 438, 453, 460, - 498, 376, 379, 383, 487, 381, 479, 384, 376, 498, - 510, 511, 489, 490, 491, 497, 501, 341, 377, 439, - 379, 519, 381, 436, 438, 386, 377, 25, 485, 483, - 380, 385, 483, 488, 492, 377, 377, 438, 488, 489, - 493, 502, 479, 386, 381 + 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, 383, + 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, 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, 375, 376, 377, 378, + 379, 380, 381, 382, 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, 384, 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, 409, 410, 411, 411, 411, 411, 411, 411, 411, - 411, 411, 411, 411, 411, 411, 411, 412, 412, 412, - 412, 412, 412, 413, 414, 415, 416, 416, 417, 417, - 418, 418, 419, 420, 420, 420, 421, 421, 421, 421, - 422, 422, 422, 422, 423, 423, 423, 423, 424, 424, - 424, 425, 425, 425, 426, 426, 426, 426, 426, 427, - 427, 427, 428, 428, 429, 429, 430, 430, 431, 431, - 432, 432, 433, 433, 434, 435, 434, 436, 436, 437, - 437, 437, 437, 437, 437, 437, 437, 437, 437, 437, - 438, 438, 439, 440, 440, 440, 440, 440, 440, 440, - 440, 440, 442, 441, 443, 443, 444, 445, 445, 446, - 446, 447, 448, 448, 449, 449, 449, 449, 450, 451, - 451, 451, 451, 451, 452, 452, 452, 452, 452, 453, - 453, 454, 455, 455, 455, 455, 455, 455, 455, 455, - 456, 457, 457, 458, 458, 458, 459, 460, 460, 461, - 461, 461, 461, 461, 461, 461, 462, 462, 462, 462, - 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, - 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, - 462, 462, 462, 462, 462, 463, 464, 464, 465, 465, - 466, 466, 466, 466, 467, 467, 468, 469, 469, 470, - 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, - 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, - 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, - 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, - 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, - 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, - 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, - 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, - 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, - 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, - 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, - 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, - 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, - 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, - 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, - 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, - 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, - 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, - 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, - 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, - 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, - 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, - 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, - 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, - 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, - 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, - 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, - 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, - 470, 470, 470, 470, 470, 470, 470, 471, 471, 471, - 473, 472, 474, 472, 475, 475, 476, 476, 477, 477, - 478, 478, 479, 479, 479, 480, 480, 481, 482, 482, - 483, 483, 483, 483, 483, 483, 483, 483, 484, 485, - 486, 487, 485, 488, 488, 490, 489, 491, 489, 492, - 492, 493, 493, 494, 494, 495, 495, 496, 497, 497, - 498, 498, 499, 499, 501, 500, 502, 502, 503, 503, - 504, 504, 506, 505, 507, 505, 508, 505, 509, 509, - 510, 510, 511, 511, 512, 512, 512, 512, 512, 513, - 513, 514, 514, 514, 516, 515, 517, 518, 518, 519, - 519 + 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, @@ -3471,16 +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, 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 + 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 }; @@ -4163,250 +4164,250 @@ 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 4171 "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 4179 "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 */ - { - 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 4188 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 5: -#line 315 "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); - } -#line 4197 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 6: -#line 319 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).i, (yyvsp[0].lex).loc, true); - } -#line 4205 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 7: -#line 322 "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 4214 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 8: -#line 326 "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); - } -#line 4223 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 9: -#line 330 "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); - } -#line 4232 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 10: -#line 334 "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); - } -#line 4241 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 11: -#line 338 "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); - } -#line 4250 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 12: -#line 342 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).d, EbtFloat, (yyvsp[0].lex).loc, true); - } -#line 4258 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 13: -#line 345 "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); - } -#line 4267 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 14: -#line 349 "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); - } -#line 4276 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 15: -#line 353 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).b, (yyvsp[0].lex).loc, true); - } -#line 4284 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 16: -#line 356 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 361 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[-1].interm.intermTypedNode); if ((yyval.interm.intermTypedNode)->getAsConstantUnion()) (yyval.interm.intermTypedNode)->getAsConstantUnion()->setExpression(); } -#line 4294 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4190 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 5: +#line 366 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).d, EbtFloat, (yyvsp[0].lex).loc, true); + } +#line 4198 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 6: +#line 369 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).i, (yyvsp[0].lex).loc, true); + } +#line 4206 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 7: +#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 4215 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 8: +#line 376 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).b, (yyvsp[0].lex).loc, true); + } +#line 4223 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 9: +#line 380 "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); + } +#line 4232 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 10: +#line 384 "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); + } +#line 4241 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 11: +#line 388 "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); + } +#line 4250 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 12: +#line 392 "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); + } +#line 4259 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 13: +#line 396 "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); + } +#line 4268 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 14: +#line 400 "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); + } +#line 4277 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 15: +#line 404 "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); + } +#line 4286 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 16: +#line 408 "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); + } +#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 4302 "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 4310 "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 4318 "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 4326 "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 4336 "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 4346 "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 4355 "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 4364 "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 4372 "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 4381 "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 4390 "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 4398 "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 4406 "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()); @@ -4414,11 +4415,11 @@ yyreduce: (yyval.interm).function = (yyvsp[-1].interm).function; (yyval.interm).intermNode = (yyvsp[0].interm.intermTypedNode); } -#line 4418 "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()); @@ -4426,29 +4427,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 4430 "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 4438 "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 4448 "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. @@ -4476,50 +4477,50 @@ yyreduce: (yyval.interm).function = new TFunction(empty, TType(EbtVoid), EOpNull); } } -#line 4480 "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 4490 "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 4501 "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 4510 "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 4519 "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}; @@ -4536,179 +4537,179 @@ yyreduce: (yyval.interm.intermTypedNode)->getAsConstantUnion()->setExpression(); } } -#line 4540 "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 4546 "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 4552 "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 4558 "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 4565 "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 4571 "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 4581 "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 4591 "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 4602 "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 4608 "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 4618 "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 4628 "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 4634 "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 4645 "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 4656 "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 4662 "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 4672 "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 4682 "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 4692 "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 4702 "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 4708 "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(), "=="); @@ -4718,11 +4719,11 @@ yyreduce: if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 4722 "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(), "!="); @@ -4732,124 +4733,124 @@ yyreduce: if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 4736 "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 4742 "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 4753 "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 4759 "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 4770 "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 4776 "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 4787 "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 4793 "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 4803 "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 4809 "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 4819 "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 4825 "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 4835 "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 4841 "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 4849 "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)); @@ -4862,17 +4863,17 @@ yyreduce: (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } } -#line 4866 "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 4872 "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(), "="); @@ -4886,119 +4887,119 @@ yyreduce: (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } } -#line 4890 "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 4899 "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 4908 "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 4917 "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 4927 "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 4936 "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 4945 "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 4954 "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 4963 "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 4972 "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 4981 "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 4990 "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 4998 "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); @@ -5007,43 +5008,42 @@ yyreduce: (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } } -#line 5011 "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 5020 "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 5030 "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 5040 "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); @@ -5053,7 +5053,7 @@ yyreduce: 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; @@ -5062,7 +5062,7 @@ yyreduce: 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; @@ -5071,7 +5071,7 @@ yyreduce: 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; @@ -5080,7 +5080,7 @@ yyreduce: 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)); @@ -5090,7 +5090,7 @@ yyreduce: 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); @@ -5100,7 +5100,7 @@ yyreduce: 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); @@ -5111,13 +5111,13 @@ yyreduce: 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 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; @@ -5131,7 +5131,7 @@ yyreduce: 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); @@ -5140,7 +5140,7 @@ yyreduce: 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); @@ -5149,7 +5149,7 @@ yyreduce: 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; @@ -5158,7 +5158,7 @@ yyreduce: 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); } @@ -5166,7 +5166,7 @@ yyreduce: 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); } @@ -5174,7 +5174,7 @@ yyreduce: 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); @@ -5187,7 +5187,7 @@ yyreduce: 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 @@ -5209,7 +5209,7 @@ yyreduce: 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", @@ -5233,7 +5233,7 @@ yyreduce: 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"); @@ -5253,7 +5253,7 @@ yyreduce: 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"); @@ -5277,7 +5277,7 @@ yyreduce: 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) @@ -5293,7 +5293,7 @@ yyreduce: break; case 115: -#line 985 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1038 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm) = (yyvsp[0].interm); @@ -5305,7 +5305,7 @@ yyreduce: 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) @@ -5320,7 +5320,7 @@ yyreduce: break; case 117: -#line 1005 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1058 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm) = (yyvsp[0].interm); @@ -5332,7 +5332,7 @@ yyreduce: 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; @@ -5343,7 +5343,7 @@ yyreduce: break; case 119: -#line 1024 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1077 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm) = (yyvsp[0].interm); } @@ -5351,7 +5351,7 @@ yyreduce: 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); @@ -5360,7 +5360,7 @@ yyreduce: 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); @@ -5369,7 +5369,7 @@ yyreduce: 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)); @@ -5379,7 +5379,7 @@ yyreduce: 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)); @@ -5389,57 +5389,59 @@ yyreduce: 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 5399 "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 5409 "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 5419 "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 5429 "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 5439 "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); @@ -5448,14 +5450,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 5455 "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)); @@ -5480,22 +5481,22 @@ yyreduce: (parseContext.language == EShLangFragment && (yyval.interm.type).qualifier.storage == EvqVaryingIn))) (yyval.interm.type).qualifier.smooth = true; } -#line 5484 "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 5495 "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"); @@ -5503,11 +5504,11 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.smooth = true; } -#line 5507 "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"); @@ -5515,58 +5516,49 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.flat = true; } -#line 5519 "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 5535 "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 5549 "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 5564 "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"); @@ -5575,114 +5567,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 5581 "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 5595 "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 5609 "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 5617 "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 5625 "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 5635 "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 5644 "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 5653 "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 5663 "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 5674 "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 5682 "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) @@ -5691,80 +5678,157 @@ 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 5695 "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 5703 "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 5711 "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 5720 "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 5729 "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 5738 "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 5747 "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 5755 "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 5764 "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.globalCheck((yyvsp[0].lex).loc, "inout"); + (yyval.interm.type).init((yyvsp[0].lex).loc); + (yyval.interm.type).qualifier.storage = EvqInOut; + } +#line 5761 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 158: +#line 1339 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.globalCheck((yyvsp[0].lex).loc, "in"); + (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; + } +#line 5772 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 159: +#line 1345 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.globalCheck((yyvsp[0].lex).loc, "out"); + (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; + } +#line 5783 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 160: +#line 1351 "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"); + (yyval.interm.type).init((yyvsp[0].lex).loc); + (yyval.interm.type).qualifier.centroid = true; + } +#line 5795 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 161: +#line 1358 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.globalCheck((yyvsp[0].lex).loc, "uniform"); + (yyval.interm.type).init((yyvsp[0].lex).loc); + (yyval.interm.type).qualifier.storage = EvqUniform; + } +#line 5805 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 162: +#line 1364 "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"); + parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangComputeMask | EShLangMeshNVMask | EShLangTaskNVMask), "shared"); + (yyval.interm.type).init((yyvsp[0].lex).loc); + (yyval.interm.type).qualifier.storage = EvqShared; + } +#line 5818 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 163: +#line 1372 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.globalCheck((yyvsp[0].lex).loc, "buffer"); + (yyval.interm.type).init((yyvsp[0].lex).loc); + (yyval.interm.type).qualifier.storage = EvqBuffer; + } +#line 5828 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 164: +#line 1377 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.requireStage((yyvsp[0].lex).loc, EShLangVertex, "attribute"); parseContext.checkDeprecated((yyvsp[0].lex).loc, ECoreProfile, 130, "attribute"); @@ -5777,11 +5841,11 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqVaryingIn; } -#line 5781 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5845 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 158: -#line 1300 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 165: +#line 1389 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.checkDeprecated((yyvsp[0].lex).loc, ENoProfile, 130, "varying"); parseContext.checkDeprecated((yyvsp[0].lex).loc, ECoreProfile, 130, "varying"); @@ -5796,341 +5860,250 @@ yyreduce: else (yyval.interm.type).qualifier.storage = EvqVaryingIn; } -#line 5800 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5864 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 159: -#line 1314 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.globalCheck((yyvsp[0].lex).loc, "inout"); - (yyval.interm.type).init((yyvsp[0].lex).loc); - (yyval.interm.type).qualifier.storage = EvqInOut; - } -#line 5810 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 160: -#line 1319 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.globalCheck((yyvsp[0].lex).loc, "in"); - (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; - } -#line 5821 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 161: -#line 1325 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.globalCheck((yyvsp[0].lex).loc, "out"); - (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; - } -#line 5832 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 162: -#line 1331 "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"); - (yyval.interm.type).init((yyvsp[0].lex).loc); - (yyval.interm.type).qualifier.centroid = true; - } -#line 5844 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 163: -#line 1338 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 166: +#line 1403 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { 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.patch = true; } -#line 5855 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5875 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 164: -#line 1344 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 167: +#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 5865 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 165: -#line 1349 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.globalCheck((yyvsp[0].lex).loc, "uniform"); - (yyval.interm.type).init((yyvsp[0].lex).loc); - (yyval.interm.type).qualifier.storage = EvqUniform; - } -#line 5875 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 166: -#line 1354 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.globalCheck((yyvsp[0].lex).loc, "buffer"); - (yyval.interm.type).init((yyvsp[0].lex).loc); - (yyval.interm.type).qualifier.storage = EvqBuffer; - } #line 5885 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 167: -#line 1359 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + 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 5900 "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 5915 "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 5930 "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 5945 "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 5959 "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 5976 "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 5985 "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 5995 "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 6005 "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 6015 "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 6025 "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 6035 "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 6044 "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 6053 "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 6062 "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 6071 "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 6082 "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 6093 "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 6102 "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 6110 "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 6120 "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 6130 "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); @@ -6138,21 +6111,21 @@ yyreduce: (yyval.interm.type).typeParameters = (yyvsp[-1].interm.typeParameters); (yyval.interm.type).arraySizes = (yyvsp[0].interm).arraySizes; } -#line 6142 "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 6152 "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; @@ -6161,20 +6134,20 @@ yyreduce: parseContext.arraySizeCheck((yyvsp[-1].interm.intermTypedNode)->getLoc(), (yyvsp[-1].interm.intermTypedNode), size, "array size"); (yyval.interm).arraySizes->addInnerSize(size); } -#line 6165 "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 6174 "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); @@ -6182,35 +6155,35 @@ yyreduce: parseContext.arraySizeCheck((yyvsp[-1].interm.intermTypedNode)->getLoc(), (yyvsp[-1].interm.intermTypedNode), size, "array size"); (yyval.interm).arraySizes->addInnerSize(size); } -#line 6186 "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 6194 "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 6202 "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 6210 "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; @@ -6218,11 +6191,11 @@ 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 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); @@ -6230,3102 +6203,3038 @@ yyreduce: parseContext.arraySizeCheck((yyvsp[0].interm.intermTypedNode)->getLoc(), (yyvsp[0].interm.intermTypedNode), size, "type parameter"); (yyval.interm.typeParameters)->addInnerSize(size); } -#line 6234 "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 6243 "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 6252 "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 */ - { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtDouble; - } -#line 6262 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 202: -#line 1585 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - 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 = EbtFloat16; - } -#line 6272 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 203: -#line 1590 "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; - } -#line 6282 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 204: -#line 1595 "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; - } -#line 6292 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 205: -#line 1600 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1616 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt; } -#line 6301 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6234 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 206: -#line 1604 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 202: +#line 1620 "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; } -#line 6311 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6244 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 203: +#line 1625 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtBool; + } +#line 6253 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 204: +#line 1629 "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); + } +#line 6263 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 205: +#line 1634 "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); + } +#line 6273 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 206: +#line 1639 "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); + } +#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 */ + { + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtBool; + (yyval.interm.type).setVector(2); + } +#line 6293 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 208: +#line 1649 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtBool; + (yyval.interm.type).setVector(3); + } +#line 6303 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 209: +#line 1654 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtBool; + (yyval.interm.type).setVector(4); + } +#line 6313 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 210: +#line 1659 "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).setVector(2); + } +#line 6323 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 211: +#line 1664 "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).setVector(3); + } +#line 6333 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 212: +#line 1669 "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).setVector(4); + } +#line 6343 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 213: +#line 1674 "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 = EbtUint; + (yyval.interm.type).setVector(2); + } +#line 6354 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 214: +#line 1680 "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 = EbtUint; + (yyval.interm.type).setVector(3); + } +#line 6365 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 215: +#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 = EbtUint; + (yyval.interm.type).setVector(4); + } +#line 6376 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 216: +#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).setMatrix(2, 2); + } +#line 6386 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 217: +#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).setMatrix(3, 3); + } +#line 6396 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 218: +#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).setMatrix(4, 4); + } +#line 6406 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 219: +#line 1707 "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).setMatrix(2, 2); + } +#line 6416 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 220: +#line 1712 "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).setMatrix(2, 3); + } +#line 6426 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 221: +#line 1717 "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).setMatrix(2, 4); + } +#line 6436 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 222: +#line 1722 "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).setMatrix(3, 2); + } +#line 6446 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 223: +#line 1727 "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).setMatrix(3, 3); + } +#line 6456 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 224: +#line 1732 "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).setMatrix(3, 4); + } +#line 6466 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 225: +#line 1737 "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).setMatrix(4, 2); + } +#line 6476 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 226: +#line 1742 "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).setMatrix(4, 3); + } +#line 6486 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 227: +#line 1747 "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).setMatrix(4, 4); + } +#line 6496 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 228: +#line 1753 "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; + } +#line 6506 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 229: +#line 1758 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + 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 = EbtFloat16; + } +#line 6516 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 230: +#line 1763 "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; + } +#line 6526 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 231: +#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 = EbtDouble; + } +#line 6536 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 232: +#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 = EbtInt8; } -#line 6321 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6546 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 208: -#line 1614 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 233: +#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 = EbtUint8; } -#line 6331 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6556 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 209: -#line 1619 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 234: +#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 = EbtInt16; } -#line 6341 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6566 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 210: -#line 1624 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 235: +#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 = EbtUint16; } -#line 6351 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6576 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 211: -#line 1629 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 236: +#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; } -#line 6361 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6586 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 212: -#line 1634 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 237: +#line 1798 "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; } -#line 6371 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6596 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 213: -#line 1639 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 238: +#line 1803 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { 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 = EbtInt64; } -#line 6381 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6606 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 214: -#line 1644 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 239: +#line 1808 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { 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 = EbtUint64; } -#line 6391 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 215: -#line 1649 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtBool; - } -#line 6400 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 216: -#line 1653 "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); - } -#line 6410 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 217: -#line 1658 "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); - } -#line 6420 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 218: -#line 1663 "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); - } -#line 6430 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 219: -#line 1668 "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); - } -#line 6441 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 220: -#line 1674 "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); - } -#line 6452 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 221: -#line 1680 "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); - } -#line 6463 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 222: -#line 1686 "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); - } -#line 6474 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 223: -#line 1692 "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); - } -#line 6485 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 224: -#line 1698 "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); - } -#line 6496 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 225: -#line 1704 "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); - } -#line 6507 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 226: -#line 1710 "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); - } -#line 6518 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 227: -#line 1716 "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); - } -#line 6529 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 228: -#line 1722 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - 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 = EbtDouble; - (yyval.interm.type).setVector(2); - } -#line 6540 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 229: -#line 1728 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - 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 = EbtDouble; - (yyval.interm.type).setVector(3); - } -#line 6551 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 230: -#line 1734 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - 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 = EbtDouble; - (yyval.interm.type).setVector(4); - } -#line 6562 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 231: -#line 1740 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtBool; - (yyval.interm.type).setVector(2); - } -#line 6572 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 232: -#line 1745 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtBool; - (yyval.interm.type).setVector(3); - } -#line 6582 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 233: -#line 1750 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtBool; - (yyval.interm.type).setVector(4); - } -#line 6592 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 234: -#line 1755 "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).setVector(2); - } -#line 6602 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 235: -#line 1760 "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).setVector(3); - } -#line 6612 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 236: -#line 1765 "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).setVector(4); - } -#line 6622 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 237: -#line 1770 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - 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 = EbtInt8; - (yyval.interm.type).setVector(2); - } -#line 6633 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 238: -#line 1776 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - 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 = EbtInt8; - (yyval.interm.type).setVector(3); - } -#line 6644 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 239: -#line 1782 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - 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 = EbtInt8; - (yyval.interm.type).setVector(4); - } -#line 6655 "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.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 6666 "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.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 6677 "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.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); + } +#line 6649 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 243: +#line 1831 "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); + } +#line 6660 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 244: +#line 1837 "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); + } +#line 6671 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 245: +#line 1843 "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); + } +#line 6682 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 246: +#line 1849 "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); + } +#line 6693 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 247: +#line 1855 "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); + } +#line 6704 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 248: +#line 1861 "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); + } +#line 6715 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 249: +#line 1867 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + 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 = EbtDouble; + (yyval.interm.type).setVector(2); + } +#line 6726 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 250: +#line 1873 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + 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 = EbtDouble; + (yyval.interm.type).setVector(3); + } +#line 6737 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 251: +#line 1879 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + 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 = EbtDouble; + (yyval.interm.type).setVector(4); + } +#line 6748 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 252: +#line 1885 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + 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 = EbtInt8; + (yyval.interm.type).setVector(2); + } +#line 6759 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 253: +#line 1891 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + 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 = EbtInt8; + (yyval.interm.type).setVector(3); + } +#line 6770 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 254: +#line 1897 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + 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 = EbtInt8; + (yyval.interm.type).setVector(4); + } +#line 6781 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 255: +#line 1903 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + 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 = EbtInt16; + (yyval.interm.type).setVector(2); + } +#line 6792 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 256: +#line 1909 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + 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 = EbtInt16; + (yyval.interm.type).setVector(3); + } +#line 6803 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 257: +#line 1915 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { 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 = EbtInt16; (yyval.interm.type).setVector(4); } -#line 6688 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 243: -#line 1806 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - 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 = EbtInt; - (yyval.interm.type).setVector(2); - } -#line 6699 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 244: -#line 1812 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - 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 = EbtInt; - (yyval.interm.type).setVector(3); - } -#line 6710 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 245: -#line 1818 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - 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 = EbtInt; - (yyval.interm.type).setVector(4); - } -#line 6721 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 246: -#line 1824 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - 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 = EbtInt64; - (yyval.interm.type).setVector(2); - } -#line 6732 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 247: -#line 1830 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - 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 = EbtInt64; - (yyval.interm.type).setVector(3); - } -#line 6743 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 248: -#line 1836 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - 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 = EbtInt64; - (yyval.interm.type).setVector(4); - } -#line 6754 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 249: -#line 1842 "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 = EbtUint; - (yyval.interm.type).setVector(2); - } -#line 6765 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 250: -#line 1848 "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 = EbtUint; - (yyval.interm.type).setVector(3); - } -#line 6776 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 251: -#line 1854 "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 = EbtUint; - (yyval.interm.type).setVector(4); - } -#line 6787 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 252: -#line 1860 "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 = EbtUint8; - (yyval.interm.type).setVector(2); - } -#line 6798 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 253: -#line 1866 "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 = EbtUint8; - (yyval.interm.type).setVector(3); - } -#line 6809 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 254: -#line 1872 "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 = EbtUint8; - (yyval.interm.type).setVector(4); - } -#line 6820 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 255: -#line 1878 "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 = EbtUint16; - (yyval.interm.type).setVector(2); - } -#line 6831 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 256: -#line 1884 "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 = EbtUint16; - (yyval.interm.type).setVector(3); - } -#line 6842 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 257: -#line 1890 "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 = EbtUint16; - (yyval.interm.type).setVector(4); - } -#line 6853 "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 6864 "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 6875 "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 signed integer vector", 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 6847 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 261: +#line 1939 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + 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 = EbtInt64; + (yyval.interm.type).setVector(2); + } +#line 6858 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 262: +#line 1945 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + 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 = EbtInt64; + (yyval.interm.type).setVector(3); + } +#line 6869 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 263: +#line 1951 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + 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 = EbtInt64; + (yyval.interm.type).setVector(4); + } +#line 6880 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 264: +#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 = EbtUint8; + (yyval.interm.type).setVector(2); + } +#line 6891 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 265: +#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 = EbtUint8; + (yyval.interm.type).setVector(3); + } +#line 6902 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 266: +#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 = EbtUint8; + (yyval.interm.type).setVector(4); + } +#line 6913 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 267: +#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 = EbtUint16; + (yyval.interm.type).setVector(2); + } +#line 6924 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 268: +#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 = EbtUint16; + (yyval.interm.type).setVector(3); + } +#line 6935 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 269: +#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 = EbtUint16; + (yyval.interm.type).setVector(4); + } +#line 6946 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 270: +#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 = EbtUint; + (yyval.interm.type).setVector(2); + } +#line 6957 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 271: +#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 = EbtUint; + (yyval.interm.type).setVector(3); + } +#line 6968 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 272: +#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 = EbtUint; (yyval.interm.type).setVector(4); } -#line 6886 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 261: -#line 1914 "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 = EbtUint64; - (yyval.interm.type).setVector(2); - } -#line 6897 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 262: -#line 1920 "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 = EbtUint64; - (yyval.interm.type).setVector(3); - } -#line 6908 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 263: -#line 1926 "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 = EbtUint64; - (yyval.interm.type).setVector(4); - } -#line 6919 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 264: -#line 1932 "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).setMatrix(2, 2); - } -#line 6929 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 265: -#line 1937 "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).setMatrix(3, 3); - } -#line 6939 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 266: -#line 1942 "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).setMatrix(4, 4); - } -#line 6949 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 267: -#line 1947 "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).setMatrix(2, 2); - } -#line 6959 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 268: -#line 1952 "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).setMatrix(2, 3); - } -#line 6969 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 269: -#line 1957 "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).setMatrix(2, 4); - } #line 6979 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 270: -#line 1962 "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).setMatrix(3, 2); - } -#line 6989 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 271: -#line 1967 "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).setMatrix(3, 3); - } -#line 6999 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 272: -#line 1972 "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).setMatrix(3, 4); - } -#line 7009 "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 7019 "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 7029 "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 7039 "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"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(2, 2); } -#line 7050 "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"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(3, 3); } -#line 7061 "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"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(4, 4); } -#line 7072 "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"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(2, 2); } -#line 7083 "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"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(2, 3); } -#line 7094 "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"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(2, 4); } -#line 7105 "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"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(3, 2); } -#line 7116 "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"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(3, 3); } -#line 7127 "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"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(3, 4); } -#line 7138 "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"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(4, 2); } -#line 7149 "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"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(4, 3); } -#line 7160 "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"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(4, 4); } -#line 7171 "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 7182 "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 7193 "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 7204 "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 7215 "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 7226 "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 7237 "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 7248 "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 7259 "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 7270 "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 7281 "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 7292 "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 7303 "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 7314 "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 7325 "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 7336 "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 7347 "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 7358 "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 7369 "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 7380 "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 7391 "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 7402 "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 7413 "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 7424 "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 7435 "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 7446 "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 7457 "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 7468 "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 7479 "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 7490 "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 7501 "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 7512 "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 7523 "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 7534 "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 7545 "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 7556 "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 7567 "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 7578 "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 7588 "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 7598 "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 7608 "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 7618 "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 7628 "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 */ - { - (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); - } -#line 7638 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 331: -#line 2316 "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, Esd2D, false, true); } -#line 7648 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7609 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 332: -#line 2321 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 331: +#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, EsdCube, false, true); } -#line 7658 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7619 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 332: +#line 2358 "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); + } +#line 7629 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 333: -#line 2326 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2363 "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); } -#line 7668 "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 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtSampler; - (yyval.interm.type).sampler.set(EbtFloat, Esd2D, true); - } -#line 7678 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 335: -#line 2336 "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, Esd1D, true, true); } -#line 7688 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7649 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 335: +#line 2374 "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); + } +#line 7659 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 336: -#line 2341 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2379 "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); } -#line 7698 "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 2384 "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 7708 "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 2389 "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 7718 "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 2395 "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 7731 "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 2401 "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 7744 "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 2407 "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 7757 "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 2413 "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 7770 "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 2419 "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 7783 "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 2425 "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 7796 "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 2431 "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 7809 "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 2437 "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 7822 "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 2443 "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 7835 "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 2449 "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 7848 "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 2455 "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 7861 "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 2461 "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 7874 "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 2467 "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 7887 "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 2473 "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 7897 "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 2479 "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 7907 "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 2484 "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 7917 "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 2489 "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 7927 "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 2495 "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); } -#line 7937 "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 2501 "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); } -#line 7947 "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 2506 "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); } -#line 7957 "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 2512 "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); } -#line 7967 "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 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, Esd2D); } -#line 7977 "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 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, Esd3D); } -#line 7987 "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 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, EsdCube); } -#line 7997 "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 2534 "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 8007 "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 2540 "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); } -#line 8017 "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 2545 "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); } -#line 8027 "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 2551 "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); } -#line 8037 "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 2556 "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); } -#line 8047 "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 2561 "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 } -#line 8060 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8003 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 369: -#line 2548 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2567 "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 } -#line 8073 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8014 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 370: -#line 2556 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2573 "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); } -#line 8083 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8024 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 371: -#line 2561 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2578 "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); } -#line 8093 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8034 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 372: -#line 2566 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2583 "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); } -#line 8103 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8044 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 373: -#line 2571 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2588 "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 } -#line 8116 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8055 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 374: -#line 2579 "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(EbtInt, EsdBuffer); } -#line 8126 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8065 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 375: -#line 2584 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2599 "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); } -#line 8136 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8075 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 376: -#line 2589 "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(EbtFloat, Esd2D, false, false, true); } -#line 8146 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8085 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 377: -#line 2594 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2609 "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 } -#line 8159 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8096 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 378: -#line 2602 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2615 "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); } -#line 8169 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8106 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 379: -#line 2607 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2620 "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); } -#line 8179 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8116 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 380: -#line 2612 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2625 "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); } -#line 8189 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8126 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 381: -#line 2617 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2630 "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 } -#line 8202 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8137 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 382: -#line 2625 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2636 "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); } -#line 8212 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8147 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 383: -#line 2630 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2641 "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, false, true); } -#line 8222 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8157 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 384: -#line 2635 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2646 "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.setPureSampler(false); } -#line 8232 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8167 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 385: -#line 2640 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2651 "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.setPureSampler(true); } -#line 8242 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8177 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 386: -#line 2645 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2656 "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, Esd1D); } -#line 8252 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8187 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 387: -#line 2650 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2661 "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 } -#line 8265 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8198 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 388: -#line 2658 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2667 "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); } -#line 8275 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8208 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 389: -#line 2663 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2672 "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 } -#line 8288 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8219 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 390: -#line 2671 "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, Esd3D); } -#line 8298 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8229 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 391: -#line 2676 "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, Esd3D); -#endif } -#line 8311 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8240 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 392: -#line 2684 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2689 "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); } -#line 8321 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8250 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 393: -#line 2689 "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, EsdCube); -#endif } -#line 8334 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8261 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 394: -#line 2697 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2700 "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, Esd1D, true); } -#line 8344 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8271 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 395: -#line 2702 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2705 "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 } -#line 8357 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8282 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 396: -#line 2710 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2711 "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); } -#line 8367 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8292 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 397: -#line 2715 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2716 "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 } -#line 8380 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8303 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 398: -#line 2723 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2722 "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, true); } -#line 8390 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8313 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 399: -#line 2728 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2727 "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 } -#line 8403 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8324 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 400: -#line 2736 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2733 "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); } -#line 8413 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8334 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 401: -#line 2741 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2738 "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); } -#line 8423 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8344 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 402: -#line 2746 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2743 "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, Esd3D); } -#line 8433 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8354 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 403: -#line 2751 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2748 "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); } -#line 8443 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8364 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 404: -#line 2756 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2753 "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, true); } -#line 8453 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8374 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 405: -#line 2761 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2758 "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); } -#line 8463 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8384 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 406: -#line 2766 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2763 "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); } -#line 8473 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8394 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 407: -#line 2771 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2768 "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); } -#line 8483 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8404 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 408: -#line 2776 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2773 "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); } -#line 8493 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8414 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 409: -#line 2781 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2778 "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, Esd3D); } -#line 8503 "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 2783 "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); } -#line 8513 "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 2788 "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); } -#line 8523 "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 2793 "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); } -#line 8533 "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 2798 "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); } -#line 8543 "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 2803 "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 8553 "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 2808 "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 8566 "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 2814 "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 8576 "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 2819 "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 8586 "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 2824 "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 8596 "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 2829 "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 8609 "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 2835 "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 8619 "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 2840 "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 8629 "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 2845 "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 8639 "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 2850 "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 8652 "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 2856 "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 8662 "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 2861 "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 8672 "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 2866 "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 8682 "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 2871 "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 8695 "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 2877 "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 8705 "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 2882 "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 8715 "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 2887 "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 8725 "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 2892 "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 8738 "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 2898 "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 8748 "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 2903 "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 8758 "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 2908 "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 8768 "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 2913 "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 8781 "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 2919 "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 8791 "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 2924 "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 8801 "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 2929 "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 8811 "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 2934 "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 8824 "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 2940 "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 8834 "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 2945 "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 8844 "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 2950 "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 8854 "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 2955 "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 8867 "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 2961 "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 8877 "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 2966 "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 8887 "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 2971 "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 8897 "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 2976 "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 8910 "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 2982 "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 8920 "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 2987 "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 8930 "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 2992 "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 8940 "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 2997 "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 8953 "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 3003 "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 8963 "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 3008 "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 8973 "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 3013 "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 8983 "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 3018 "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 8996 "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 3024 "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 9006 "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 3029 "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 9016 "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 3034 "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 9026 "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 3039 "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 9039 "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 3045 "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 9049 "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 3050 "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 9059 "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 3055 "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 9069 "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 3060 "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 9082 "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 3066 "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 9092 "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 3071 "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 9102 "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 3076 "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 9112 "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 3081 "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 9125 "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 3087 "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 9135 "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 3092 "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 9145 "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 3097 "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 9155 "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 3102 "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 9168 "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 3108 "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 9178 "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 3113 "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 9188 "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 3118 "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 9199 "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 3124 "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 9210 "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 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); } -#line 9221 "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 3136 "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 9232 "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 3142 "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 9246 "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 3149 "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 9260 "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 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); } -#line 9271 "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 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(EbtInt, true); } -#line 9282 "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 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); } -#line 9293 "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 3174 "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 9304 "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 3180 "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 9315 "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 3186 "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 3192 "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 3199 "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 9325 "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 3204 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // // This is for user defined type names. The lexical phase looked up the @@ -9339,47 +9248,47 @@ yyreduce: } else parseContext.error((yyvsp[0].lex).loc, "expected type name", (yyvsp[0].lex).string->c_str(), ""); } -#line 9343 "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 3220 "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 9353 "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 3225 "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 9363 "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 3230 "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 9373 "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 3238 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.nestedStructCheck((yyvsp[-2].lex).loc); } -#line 9379 "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 3238 "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); @@ -9391,17 +9300,17 @@ yyreduce: (yyval.interm.type).userDef = structure; --parseContext.structNestingLevel; } -#line 9395 "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 3249 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.nestedStructCheck((yyvsp[-1].lex).loc); } -#line 9401 "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 3249 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { TType* structure = new TType((yyvsp[-1].interm.typeList), TString("")); (yyval.interm.type).init((yyvsp[-4].lex).loc); @@ -9409,19 +9318,19 @@ yyreduce: (yyval.interm.type).userDef = structure; --parseContext.structNestingLevel; } -#line 9413 "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 3259 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.typeList) = (yyvsp[0].interm.typeList); } -#line 9421 "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 3262 "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) { @@ -9432,16 +9341,16 @@ yyreduce: (yyval.interm.typeList)->push_back((*(yyvsp[0].interm.typeList))[i]); } } -#line 9436 "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 3275 "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); } @@ -9459,16 +9368,16 @@ yyreduce: (*(yyval.interm.typeList))[i].type->shallowCopy(type); } } -#line 9463 "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 3297 "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); } @@ -9488,38 +9397,38 @@ yyreduce: (*(yyval.interm.typeList))[i].type->shallowCopy(type); } } -#line 9492 "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 3324 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.typeList) = new TTypeList; (yyval.interm.typeList)->push_back((yyvsp[0].interm.typeLine)); } -#line 9501 "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 3328 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.typeList)->push_back((yyvsp[0].interm.typeLine)); } -#line 9509 "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 3334 "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 9519 "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 3339 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.arrayOfArrayVersionCheck((yyvsp[-1].lex).loc, (yyvsp[0].interm).arraySizes); @@ -9528,235 +9437,235 @@ yyreduce: (yyval.interm.typeLine).type->setFieldName(*(yyvsp[-1].lex).string); (yyval.interm.typeLine).type->transferArraySizes((yyvsp[0].interm).arraySizes); } -#line 9532 "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 3350 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 9540 "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 3354 "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 9551 "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 3360 "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 9562 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 505: -#line 3392 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = parseContext.intermediate.growAggregate(0, (yyvsp[0].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)->getLoc()); - } -#line 9570 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 506: -#line 3395 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = parseContext.intermediate.growAggregate((yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); - } -#line 9578 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9471 "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 9584 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 3371 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.intermTypedNode) = parseContext.intermediate.growAggregate(0, (yyvsp[0].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)->getLoc()); + } +#line 9479 "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 9590 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 3374 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.intermTypedNode) = parseContext.intermediate.growAggregate((yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); + } +#line 9487 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 509: -#line 3406 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3381 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9596 "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 3385 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9602 "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 3386 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9608 "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 3392 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9614 "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 3393 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9620 "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 3394 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9626 "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 3395 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9632 "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 3396 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9638 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9535 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 517: -#line 3419 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3397 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9644 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9541 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 518: -#line 3423 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3398 "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 3400 "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 3406 "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 9654 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9563 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 519: -#line 3431 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 521: +#line 3415 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = 0; } -#line 9660 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9569 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 520: -#line 3432 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 522: +#line 3416 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.symbolTable.push(); ++parseContext.statementNestingLevel; } -#line 9669 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9578 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 521: -#line 3436 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 523: +#line 3420 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); --parseContext.statementNestingLevel; } -#line 9678 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9587 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 522: -#line 3440 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 524: +#line 3424 "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 9688 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 523: -#line 3448 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9694 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 524: -#line 3449 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9700 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9597 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 525: -#line 3453 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - ++parseContext.controlFlowNestingLevel; - } -#line 9708 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 3432 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } +#line 9603 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 526: -#line 3456 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3433 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } +#line 9609 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 527: +#line 3437 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + ++parseContext.controlFlowNestingLevel; + } +#line 9617 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 528: +#line 3440 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { --parseContext.controlFlowNestingLevel; (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9717 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9626 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 527: -#line 3460 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 529: +#line 3444 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.symbolTable.push(); ++parseContext.statementNestingLevel; ++parseContext.controlFlowNestingLevel; } -#line 9727 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9636 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 528: -#line 3465 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 530: +#line 3449 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9738 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9647 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 529: -#line 3474 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 531: +#line 3458 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = 0; } -#line 9746 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9655 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 530: -#line 3477 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 532: +#line 3461 "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 9756 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9665 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 531: -#line 3485 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 533: +#line 3469 "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 || @@ -9765,11 +9674,11 @@ yyreduce: (yyval.interm.intermNode) = 0; // start a fresh subsequence for what's after this case } } -#line 9769 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9678 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 532: -#line 3493 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 534: +#line 3477 "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)) { @@ -9778,76 +9687,76 @@ yyreduce: } else (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[-1].interm.intermNode), (yyvsp[0].interm.intermNode)); } -#line 9782 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 533: -#line 3504 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermNode) = 0; } -#line 9788 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 534: -#line 3505 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermNode) = static_cast((yyvsp[-1].interm.intermTypedNode)); } -#line 9794 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9691 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 535: -#line 3509 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); - } -#line 9802 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 3488 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermNode) = 0; } +#line 9697 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 536: -#line 3512 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3489 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermNode) = static_cast((yyvsp[-1].interm.intermTypedNode)); } +#line 9703 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 537: +#line 3493 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); + } +#line 9711 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 538: +#line 3497 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.handleSelectionAttributes(*(yyvsp[-1].interm.attributes), (yyvsp[0].interm.intermNode)); (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9811 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9720 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 537: -#line 3518 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 539: +#line 3504 "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 9820 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9729 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 538: -#line 3525 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 540: +#line 3511 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.nodePair).node1 = (yyvsp[-2].interm.intermNode); (yyval.interm.nodePair).node2 = (yyvsp[0].interm.intermNode); } -#line 9829 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9738 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 539: -#line 3529 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 541: +#line 3515 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.nodePair).node1 = (yyvsp[0].interm.intermNode); (yyval.interm.nodePair).node2 = 0; } -#line 9838 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9747 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 540: -#line 3537 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 542: +#line 3523 "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 9847 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9756 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 541: -#line 3541 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 543: +#line 3527 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.boolCheck((yyvsp[-2].lex).loc, (yyvsp[-3].interm.type)); @@ -9858,28 +9767,28 @@ yyreduce: else (yyval.interm.intermTypedNode) = 0; } -#line 9862 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9771 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 542: -#line 3554 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 544: +#line 3540 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9870 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9779 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 543: -#line 3557 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 545: +#line 3544 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.handleSwitchAttributes(*(yyvsp[-1].interm.attributes), (yyvsp[0].interm.intermNode)); (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9879 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9788 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 544: -#line 3563 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 546: +#line 3551 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // start new switch sequence on the switch stack ++parseContext.controlFlowNestingLevel; @@ -9888,11 +9797,11 @@ yyreduce: parseContext.switchLevel.push_back(parseContext.statementNestingLevel); parseContext.symbolTable.push(); } -#line 9892 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9801 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 545: -#line 3571 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 547: +#line 3559 "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(); @@ -9902,27 +9811,27 @@ yyreduce: --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; } -#line 9906 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 546: -#line 3583 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermNode) = 0; - } -#line 9914 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 547: -#line 3586 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); - } -#line 9922 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9815 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 548: -#line 3592 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3571 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.intermNode) = 0; + } +#line 9823 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 549: +#line 3574 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); + } +#line 9831 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 550: +#line 3580 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = 0; if (parseContext.switchLevel.size() == 0) @@ -9935,11 +9844,11 @@ yyreduce: (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpCase, (yyvsp[-1].interm.intermTypedNode), (yyvsp[-2].lex).loc); } } -#line 9939 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9848 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 549: -#line 3604 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 551: +#line 3592 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = 0; if (parseContext.switchLevel.size() == 0) @@ -9949,28 +9858,28 @@ yyreduce: else (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpDefault, (yyvsp[-1].lex).loc); } -#line 9953 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9862 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 550: -#line 3616 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 552: +#line 3604 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9961 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9870 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 551: -#line 3619 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 553: +#line 3608 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.handleLoopAttributes(*(yyvsp[-1].interm.attributes), (yyvsp[0].interm.intermNode)); (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 9970 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9879 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 552: -#line 3625 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 554: +#line 3615 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if (! parseContext.limits.whileLoops) parseContext.error((yyvsp[-1].lex).loc, "while loops not available", "limitation", ""); @@ -9979,11 +9888,11 @@ yyreduce: ++parseContext.statementNestingLevel; ++parseContext.controlFlowNestingLevel; } -#line 9983 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9892 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 553: -#line 3633 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 555: +#line 3623 "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); @@ -9991,21 +9900,21 @@ yyreduce: --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; } -#line 9995 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9904 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 554: -#line 3640 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 556: +#line 3630 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { ++parseContext.loopNestingLevel; ++parseContext.statementNestingLevel; ++parseContext.controlFlowNestingLevel; } -#line 10005 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9914 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 555: -#line 3645 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 557: +#line 3635 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if (! parseContext.limits.whileLoops) parseContext.error((yyvsp[-7].lex).loc, "do-while loops not available", "limitation", ""); @@ -10017,22 +9926,22 @@ yyreduce: --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; } -#line 10021 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9930 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 556: -#line 3656 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 558: +#line 3646 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.symbolTable.push(); ++parseContext.loopNestingLevel; ++parseContext.statementNestingLevel; ++parseContext.controlFlowNestingLevel; } -#line 10032 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9941 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 557: -#line 3662 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 559: +#line 3652 "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); @@ -10045,81 +9954,81 @@ yyreduce: --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; } -#line 10049 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 558: -#line 3677 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); - } -#line 10057 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 559: -#line 3680 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); - } -#line 10065 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9958 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 560: -#line 3686 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3667 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); + (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 10073 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9966 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 561: -#line 3689 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3670 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = 0; + (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 10081 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9974 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 562: -#line 3695 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3676 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); + } +#line 9982 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 563: +#line 3679 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.intermTypedNode) = 0; + } +#line 9990 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 564: +#line 3685 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.nodePair).node1 = (yyvsp[-1].interm.intermTypedNode); (yyval.interm.nodePair).node2 = 0; } -#line 10090 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9999 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 563: -#line 3699 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 565: +#line 3689 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.nodePair).node1 = (yyvsp[-2].interm.intermTypedNode); (yyval.interm.nodePair).node2 = (yyvsp[0].interm.intermTypedNode); } -#line 10099 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10008 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 564: -#line 3706 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 566: +#line 3696 "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 10109 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10018 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 565: -#line 3711 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 567: +#line 3701 "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 10119 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10028 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 566: -#line 3716 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 568: +#line 3706 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpReturn, (yyvsp[-1].lex).loc); if (parseContext.currentFunctionType->getBasicType() != EbtVoid) @@ -10127,83 +10036,83 @@ yyreduce: if (parseContext.inMain) parseContext.postEntryPointReturn = true; } -#line 10131 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10040 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 567: -#line 3723 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 569: +#line 3713 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = parseContext.handleReturnValue((yyvsp[-2].lex).loc, (yyvsp[-1].interm.intermTypedNode)); } -#line 10139 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10048 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 568: -#line 3726 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 570: +#line 3716 "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 10148 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10057 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 569: -#line 3735 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 571: +#line 3725 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); parseContext.intermediate.setTreeRoot((yyval.interm.intermNode)); } -#line 10157 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10066 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 570: -#line 3739 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 572: +#line 3729 "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 10168 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 571: -#line 3748 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); - } -#line 10176 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 572: -#line 3751 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); - } -#line 10184 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10077 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 573: -#line 3754 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3738 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); + } +#line 10085 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 574: +#line 3741 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); + } +#line 10093 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 575: +#line 3745 "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 10194 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10103 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 574: -#line 3762 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 576: +#line 3754 "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 10203 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10112 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 575: -#line 3766 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 577: +#line 3758 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // May be best done as post process phase on intermediate code if (parseContext.currentFunctionType->getBasicType() != EbtVoid && ! parseContext.functionReturnsValue) @@ -10219,52 +10128,52 @@ yyreduce: (yyval.interm.intermNode)->getAsAggregate()->setDebug(parseContext.contextPragma.debug); (yyval.interm.intermNode)->getAsAggregate()->setPragmaTable(parseContext.contextPragma.pragmaTable); } -#line 10223 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10132 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 576: -#line 3784 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 578: +#line 3777 "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 10232 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 577: -#line 3790 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.attributes) = (yyvsp[0].interm.attributes); - } -#line 10240 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 578: -#line 3793 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.attributes) = parseContext.mergeAttributes((yyvsp[-2].interm.attributes), (yyvsp[0].interm.attributes)); - } -#line 10248 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10141 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 579: -#line 3798 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3783 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.attributes) = parseContext.makeAttributes(*(yyvsp[0].lex).string); + (yyval.interm.attributes) = (yyvsp[0].interm.attributes); } -#line 10256 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10149 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 580: -#line 3801 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 3786 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.attributes) = parseContext.mergeAttributes((yyvsp[-2].interm.attributes), (yyvsp[0].interm.attributes)); + } +#line 10157 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 581: +#line 3791 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.attributes) = parseContext.makeAttributes(*(yyvsp[0].lex).string); + } +#line 10165 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 582: +#line 3794 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.attributes) = parseContext.makeAttributes(*(yyvsp[-3].lex).string, (yyvsp[-1].interm.intermTypedNode)); } -#line 10264 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10173 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; -#line 10268 "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 @@ -10492,5 +10401,5 @@ yyreturn: #endif return yyresult; } -#line 3805 "MachineIndependent/glslang.y" /* yacc.c:1906 */ +#line 3799 "MachineIndependent/glslang.y" /* yacc.c:1906 */ diff --git a/glslang/MachineIndependent/glslang_tab.cpp.h b/glslang/MachineIndependent/glslang_tab.cpp.h index 3e67dd0d..f3f0251f 100644 --- a/glslang/MachineIndependent/glslang_tab.cpp.h +++ b/glslang/MachineIndependent/glslang_tab.cpp.h @@ -45,412 +45,414 @@ 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, - DEMOTE = 289, - BVEC2 = 290, - BVEC3 = 291, - BVEC4 = 292, - IVEC2 = 293, - IVEC3 = 294, - IVEC4 = 295, - UVEC2 = 296, - UVEC3 = 297, - UVEC4 = 298, - I64VEC2 = 299, - I64VEC3 = 300, - I64VEC4 = 301, - U64VEC2 = 302, - U64VEC3 = 303, - U64VEC4 = 304, - I32VEC2 = 305, - I32VEC3 = 306, - I32VEC4 = 307, - U32VEC2 = 308, - U32VEC3 = 309, - U32VEC4 = 310, - I16VEC2 = 311, - I16VEC3 = 312, - I16VEC4 = 313, - U16VEC2 = 314, - U16VEC3 = 315, - U16VEC4 = 316, - I8VEC2 = 317, - I8VEC3 = 318, - I8VEC4 = 319, - U8VEC2 = 320, - U8VEC3 = 321, - U8VEC4 = 322, - VEC2 = 323, - VEC3 = 324, - VEC4 = 325, - MAT2 = 326, - MAT3 = 327, - MAT4 = 328, - CENTROID = 329, - IN = 330, - OUT = 331, - INOUT = 332, - UNIFORM = 333, - PATCH = 334, - SAMPLE = 335, - BUFFER = 336, - SHARED = 337, - NONUNIFORM = 338, - PAYLOADNV = 339, - PAYLOADINNV = 340, - HITATTRNV = 341, - CALLDATANV = 342, - CALLDATAINNV = 343, - COHERENT = 344, - VOLATILE = 345, - RESTRICT = 346, - READONLY = 347, - WRITEONLY = 348, - DEVICECOHERENT = 349, - QUEUEFAMILYCOHERENT = 350, - WORKGROUPCOHERENT = 351, - SUBGROUPCOHERENT = 352, - NONPRIVATE = 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, - NOPERSPECTIVE = 378, - FLAT = 379, - SMOOTH = 380, - LAYOUT = 381, - EXPLICITINTERPAMD = 382, - PERVERTEXNV = 383, - PERPRIMITIVENV = 384, - PERVIEWNV = 385, - PERTASKNV = 386, - MAT2X2 = 387, - MAT2X3 = 388, - MAT2X4 = 389, - MAT3X2 = 390, - MAT3X3 = 391, - MAT3X4 = 392, - MAT4X2 = 393, - MAT4X3 = 394, - MAT4X4 = 395, - DMAT2X2 = 396, - DMAT2X3 = 397, - DMAT2X4 = 398, - DMAT3X2 = 399, - DMAT3X3 = 400, - DMAT3X4 = 401, - DMAT4X2 = 402, - DMAT4X3 = 403, - DMAT4X4 = 404, - F16MAT2X2 = 405, - F16MAT2X3 = 406, - F16MAT2X4 = 407, - F16MAT3X2 = 408, - F16MAT3X3 = 409, - F16MAT3X4 = 410, - F16MAT4X2 = 411, - F16MAT4X3 = 412, - F16MAT4X4 = 413, - F32MAT2X2 = 414, - F32MAT2X3 = 415, - F32MAT2X4 = 416, - F32MAT3X2 = 417, - F32MAT3X3 = 418, - F32MAT3X4 = 419, - F32MAT4X2 = 420, - F32MAT4X3 = 421, - F32MAT4X4 = 422, - F64MAT2X2 = 423, - F64MAT2X3 = 424, - F64MAT2X4 = 425, - F64MAT3X2 = 426, - F64MAT3X3 = 427, - F64MAT3X4 = 428, - F64MAT4X2 = 429, - F64MAT4X3 = 430, - F64MAT4X4 = 431, - ATOMIC_UINT = 432, - ACCSTRUCTNV = 433, - FCOOPMATNV = 434, - SAMPLER1D = 435, - SAMPLER2D = 436, - SAMPLER3D = 437, - SAMPLERCUBE = 438, - SAMPLER1DSHADOW = 439, - SAMPLER2DSHADOW = 440, - SAMPLERCUBESHADOW = 441, - SAMPLER1DARRAY = 442, - SAMPLER2DARRAY = 443, - SAMPLER1DARRAYSHADOW = 444, - SAMPLER2DARRAYSHADOW = 445, - ISAMPLER1D = 446, - ISAMPLER2D = 447, - ISAMPLER3D = 448, - ISAMPLERCUBE = 449, - ISAMPLER1DARRAY = 450, - ISAMPLER2DARRAY = 451, - USAMPLER1D = 452, - USAMPLER2D = 453, - USAMPLER3D = 454, - USAMPLERCUBE = 455, - USAMPLER1DARRAY = 456, - USAMPLER2DARRAY = 457, - SAMPLER2DRECT = 458, - SAMPLER2DRECTSHADOW = 459, - ISAMPLER2DRECT = 460, - USAMPLER2DRECT = 461, - SAMPLERBUFFER = 462, - ISAMPLERBUFFER = 463, - USAMPLERBUFFER = 464, - SAMPLERCUBEARRAY = 465, - SAMPLERCUBEARRAYSHADOW = 466, - ISAMPLERCUBEARRAY = 467, - USAMPLERCUBEARRAY = 468, - SAMPLER2DMS = 469, - ISAMPLER2DMS = 470, - USAMPLER2DMS = 471, - SAMPLER2DMSARRAY = 472, - ISAMPLER2DMSARRAY = 473, - USAMPLER2DMSARRAY = 474, - SAMPLEREXTERNALOES = 475, - SAMPLEREXTERNAL2DY2YEXT = 476, - F16SAMPLER1D = 477, - F16SAMPLER2D = 478, - F16SAMPLER3D = 479, - F16SAMPLER2DRECT = 480, - F16SAMPLERCUBE = 481, - F16SAMPLER1DARRAY = 482, - F16SAMPLER2DARRAY = 483, - F16SAMPLERCUBEARRAY = 484, - F16SAMPLERBUFFER = 485, - F16SAMPLER2DMS = 486, - F16SAMPLER2DMSARRAY = 487, - F16SAMPLER1DSHADOW = 488, - F16SAMPLER2DSHADOW = 489, - F16SAMPLER1DARRAYSHADOW = 490, - F16SAMPLER2DARRAYSHADOW = 491, - F16SAMPLER2DRECTSHADOW = 492, - F16SAMPLERCUBESHADOW = 493, - F16SAMPLERCUBEARRAYSHADOW = 494, - SAMPLER = 495, - SAMPLERSHADOW = 496, - TEXTURE1D = 497, - TEXTURE2D = 498, - TEXTURE3D = 499, - TEXTURECUBE = 500, - TEXTURE1DARRAY = 501, - TEXTURE2DARRAY = 502, - ITEXTURE1D = 503, - ITEXTURE2D = 504, - ITEXTURE3D = 505, - ITEXTURECUBE = 506, - ITEXTURE1DARRAY = 507, - ITEXTURE2DARRAY = 508, - UTEXTURE1D = 509, - UTEXTURE2D = 510, - UTEXTURE3D = 511, - UTEXTURECUBE = 512, - UTEXTURE1DARRAY = 513, - UTEXTURE2DARRAY = 514, - TEXTURE2DRECT = 515, - ITEXTURE2DRECT = 516, - UTEXTURE2DRECT = 517, - TEXTUREBUFFER = 518, - ITEXTUREBUFFER = 519, - UTEXTUREBUFFER = 520, - TEXTURECUBEARRAY = 521, - ITEXTURECUBEARRAY = 522, - UTEXTURECUBEARRAY = 523, - TEXTURE2DMS = 524, - ITEXTURE2DMS = 525, - UTEXTURE2DMS = 526, - TEXTURE2DMSARRAY = 527, - ITEXTURE2DMSARRAY = 528, - UTEXTURE2DMSARRAY = 529, - F16TEXTURE1D = 530, - F16TEXTURE2D = 531, - F16TEXTURE3D = 532, - F16TEXTURE2DRECT = 533, - F16TEXTURECUBE = 534, - F16TEXTURE1DARRAY = 535, - F16TEXTURE2DARRAY = 536, - F16TEXTURECUBEARRAY = 537, - F16TEXTUREBUFFER = 538, - F16TEXTURE2DMS = 539, - F16TEXTURE2DMSARRAY = 540, - SUBPASSINPUT = 541, - SUBPASSINPUTMS = 542, - ISUBPASSINPUT = 543, - ISUBPASSINPUTMS = 544, - USUBPASSINPUT = 545, - USUBPASSINPUTMS = 546, - F16SUBPASSINPUT = 547, - F16SUBPASSINPUTMS = 548, - IMAGE1D = 549, - IIMAGE1D = 550, - UIMAGE1D = 551, - IMAGE2D = 552, - IIMAGE2D = 553, - UIMAGE2D = 554, - IMAGE3D = 555, - IIMAGE3D = 556, - UIMAGE3D = 557, - IMAGE2DRECT = 558, - IIMAGE2DRECT = 559, - UIMAGE2DRECT = 560, - IMAGECUBE = 561, - IIMAGECUBE = 562, - UIMAGECUBE = 563, - IMAGEBUFFER = 564, - IIMAGEBUFFER = 565, - UIMAGEBUFFER = 566, - IMAGE1DARRAY = 567, - IIMAGE1DARRAY = 568, - UIMAGE1DARRAY = 569, - IMAGE2DARRAY = 570, - IIMAGE2DARRAY = 571, - UIMAGE2DARRAY = 572, - IMAGECUBEARRAY = 573, - IIMAGECUBEARRAY = 574, - UIMAGECUBEARRAY = 575, - IMAGE2DMS = 576, - IIMAGE2DMS = 577, - UIMAGE2DMS = 578, - IMAGE2DMSARRAY = 579, - IIMAGE2DMSARRAY = 580, - UIMAGE2DMSARRAY = 581, - F16IMAGE1D = 582, - F16IMAGE2D = 583, - F16IMAGE3D = 584, - F16IMAGE2DRECT = 585, - F16IMAGECUBE = 586, - F16IMAGE1DARRAY = 587, - F16IMAGE2DARRAY = 588, - F16IMAGECUBEARRAY = 589, - F16IMAGEBUFFER = 590, - F16IMAGE2DMS = 591, - F16IMAGE2DMSARRAY = 592, - STRUCT = 593, - VOID = 594, - WHILE = 595, - IDENTIFIER = 596, - TYPE_NAME = 597, - FLOATCONSTANT = 598, - DOUBLECONSTANT = 599, - INT16CONSTANT = 600, - UINT16CONSTANT = 601, - INT32CONSTANT = 602, - UINT32CONSTANT = 603, - INTCONSTANT = 604, - UINTCONSTANT = 605, - INT64CONSTANT = 606, - UINT64CONSTANT = 607, - BOOLCONSTANT = 608, - FLOAT16CONSTANT = 609, - LEFT_OP = 610, - RIGHT_OP = 611, - INC_OP = 612, - DEC_OP = 613, - LE_OP = 614, - GE_OP = 615, - EQ_OP = 616, - NE_OP = 617, - AND_OP = 618, - OR_OP = 619, - XOR_OP = 620, - MUL_ASSIGN = 621, - DIV_ASSIGN = 622, - ADD_ASSIGN = 623, - MOD_ASSIGN = 624, - LEFT_ASSIGN = 625, - RIGHT_ASSIGN = 626, - AND_ASSIGN = 627, - XOR_ASSIGN = 628, - OR_ASSIGN = 629, - SUB_ASSIGN = 630, - LEFT_PAREN = 631, - RIGHT_PAREN = 632, - LEFT_BRACKET = 633, - RIGHT_BRACKET = 634, - LEFT_BRACE = 635, - RIGHT_BRACE = 636, - DOT = 637, - COMMA = 638, - COLON = 639, - EQUAL = 640, - SEMICOLON = 641, - BANG = 642, - DASH = 643, - TILDE = 644, - PLUS = 645, - STAR = 646, - SLASH = 647, - PERCENT = 648, - LEFT_ANGLE = 649, - RIGHT_ANGLE = 650, - VERTICAL_BAR = 651, - CARET = 652, - AMPERSAND = 653, - QUESTION = 654, - INVARIANT = 655, - PRECISE = 656, - HIGH_PRECISION = 657, - MEDIUM_PRECISION = 658, - LOW_PRECISION = 659, - PRECISION = 660, - PACKED = 661, - RESOURCE = 662, - SUPERP = 663 + 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, + SAMPLERCUBEARRAY = 302, + SAMPLERCUBEARRAYSHADOW = 303, + ISAMPLERCUBEARRAY = 304, + USAMPLERCUBEARRAY = 305, + ATTRIBUTE = 306, + VARYING = 307, + FLOAT16_T = 308, + FLOAT32_T = 309, + DOUBLE = 310, + FLOAT64_T = 311, + INT64_T = 312, + UINT64_T = 313, + INT32_T = 314, + UINT32_T = 315, + INT16_T = 316, + UINT16_T = 317, + INT8_T = 318, + UINT8_T = 319, + I64VEC2 = 320, + I64VEC3 = 321, + I64VEC4 = 322, + U64VEC2 = 323, + U64VEC3 = 324, + U64VEC4 = 325, + I32VEC2 = 326, + I32VEC3 = 327, + I32VEC4 = 328, + U32VEC2 = 329, + U32VEC3 = 330, + U32VEC4 = 331, + I16VEC2 = 332, + I16VEC3 = 333, + I16VEC4 = 334, + U16VEC2 = 335, + U16VEC3 = 336, + U16VEC4 = 337, + I8VEC2 = 338, + I8VEC3 = 339, + I8VEC4 = 340, + U8VEC2 = 341, + U8VEC3 = 342, + U8VEC4 = 343, + DVEC2 = 344, + DVEC3 = 345, + DVEC4 = 346, + DMAT2 = 347, + DMAT3 = 348, + DMAT4 = 349, + F16VEC2 = 350, + F16VEC3 = 351, + F16VEC4 = 352, + F16MAT2 = 353, + F16MAT3 = 354, + F16MAT4 = 355, + F32VEC2 = 356, + F32VEC3 = 357, + F32VEC4 = 358, + F32MAT2 = 359, + F32MAT3 = 360, + F32MAT4 = 361, + F64VEC2 = 362, + F64VEC3 = 363, + F64VEC4 = 364, + F64MAT2 = 365, + F64MAT3 = 366, + F64MAT4 = 367, + DMAT2X2 = 368, + DMAT2X3 = 369, + DMAT2X4 = 370, + DMAT3X2 = 371, + DMAT3X3 = 372, + DMAT3X4 = 373, + DMAT4X2 = 374, + DMAT4X3 = 375, + DMAT4X4 = 376, + F16MAT2X2 = 377, + F16MAT2X3 = 378, + F16MAT2X4 = 379, + F16MAT3X2 = 380, + F16MAT3X3 = 381, + F16MAT3X4 = 382, + F16MAT4X2 = 383, + F16MAT4X3 = 384, + F16MAT4X4 = 385, + F32MAT2X2 = 386, + F32MAT2X3 = 387, + F32MAT2X4 = 388, + F32MAT3X2 = 389, + F32MAT3X3 = 390, + F32MAT3X4 = 391, + F32MAT4X2 = 392, + F32MAT4X3 = 393, + F32MAT4X4 = 394, + F64MAT2X2 = 395, + F64MAT2X3 = 396, + F64MAT2X4 = 397, + F64MAT3X2 = 398, + F64MAT3X3 = 399, + F64MAT3X4 = 400, + F64MAT4X2 = 401, + F64MAT4X3 = 402, + F64MAT4X4 = 403, + ATOMIC_UINT = 404, + ACCSTRUCTNV = 405, + FCOOPMATNV = 406, + ICOOPMATNV = 407, + UCOOPMATNV = 408, + SAMPLER1D = 409, + SAMPLER1DARRAY = 410, + SAMPLER1DARRAYSHADOW = 411, + ISAMPLER1D = 412, + SAMPLER1DSHADOW = 413, + SAMPLER2DRECT = 414, + SAMPLER2DRECTSHADOW = 415, + ISAMPLER2DRECT = 416, + USAMPLER2DRECT = 417, + SAMPLERBUFFER = 418, + ISAMPLERBUFFER = 419, + USAMPLERBUFFER = 420, + SAMPLER2DMS = 421, + ISAMPLER2DMS = 422, + USAMPLER2DMS = 423, + SAMPLER2DMSARRAY = 424, + ISAMPLER2DMSARRAY = 425, + USAMPLER2DMSARRAY = 426, + SAMPLEREXTERNALOES = 427, + SAMPLEREXTERNAL2DY2YEXT = 428, + ISAMPLER1DARRAY = 429, + USAMPLER1D = 430, + USAMPLER1DARRAY = 431, + F16SAMPLER1D = 432, + F16SAMPLER2D = 433, + F16SAMPLER3D = 434, + F16SAMPLER2DRECT = 435, + F16SAMPLERCUBE = 436, + F16SAMPLER1DARRAY = 437, + F16SAMPLER2DARRAY = 438, + F16SAMPLERCUBEARRAY = 439, + F16SAMPLERBUFFER = 440, + F16SAMPLER2DMS = 441, + F16SAMPLER2DMSARRAY = 442, + F16SAMPLER1DSHADOW = 443, + F16SAMPLER2DSHADOW = 444, + F16SAMPLER1DARRAYSHADOW = 445, + F16SAMPLER2DARRAYSHADOW = 446, + F16SAMPLER2DRECTSHADOW = 447, + F16SAMPLERCUBESHADOW = 448, + F16SAMPLERCUBEARRAYSHADOW = 449, + IMAGE1D = 450, + IIMAGE1D = 451, + UIMAGE1D = 452, + IMAGE2D = 453, + IIMAGE2D = 454, + UIMAGE2D = 455, + IMAGE3D = 456, + IIMAGE3D = 457, + UIMAGE3D = 458, + IMAGE2DRECT = 459, + IIMAGE2DRECT = 460, + UIMAGE2DRECT = 461, + IMAGECUBE = 462, + IIMAGECUBE = 463, + UIMAGECUBE = 464, + IMAGEBUFFER = 465, + IIMAGEBUFFER = 466, + UIMAGEBUFFER = 467, + IMAGE1DARRAY = 468, + IIMAGE1DARRAY = 469, + UIMAGE1DARRAY = 470, + IMAGE2DARRAY = 471, + IIMAGE2DARRAY = 472, + UIMAGE2DARRAY = 473, + IMAGECUBEARRAY = 474, + IIMAGECUBEARRAY = 475, + UIMAGECUBEARRAY = 476, + IMAGE2DMS = 477, + IIMAGE2DMS = 478, + UIMAGE2DMS = 479, + IMAGE2DMSARRAY = 480, + IIMAGE2DMSARRAY = 481, + UIMAGE2DMSARRAY = 482, + F16IMAGE1D = 483, + F16IMAGE2D = 484, + F16IMAGE3D = 485, + F16IMAGE2DRECT = 486, + F16IMAGECUBE = 487, + F16IMAGE1DARRAY = 488, + F16IMAGE2DARRAY = 489, + F16IMAGECUBEARRAY = 490, + F16IMAGEBUFFER = 491, + F16IMAGE2DMS = 492, + F16IMAGE2DMSARRAY = 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, + TEXTURE2DMS = 523, + ITEXTURE2DMS = 524, + UTEXTURE2DMS = 525, + TEXTURE2DMSARRAY = 526, + ITEXTURE2DMSARRAY = 527, + UTEXTURE2DMSARRAY = 528, + F16TEXTURE1D = 529, + F16TEXTURE2D = 530, + F16TEXTURE3D = 531, + F16TEXTURE2DRECT = 532, + F16TEXTURECUBE = 533, + F16TEXTURE1DARRAY = 534, + F16TEXTURE2DARRAY = 535, + F16TEXTURECUBEARRAY = 536, + F16TEXTUREBUFFER = 537, + F16TEXTURE2DMS = 538, + F16TEXTURE2DMSARRAY = 539, + SUBPASSINPUT = 540, + SUBPASSINPUTMS = 541, + ISUBPASSINPUT = 542, + ISUBPASSINPUTMS = 543, + USUBPASSINPUT = 544, + USUBPASSINPUTMS = 545, + F16SUBPASSINPUT = 546, + F16SUBPASSINPUTMS = 547, + 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, + FLAT = 627, + SMOOTH = 628, + LAYOUT = 629, + DOUBLECONSTANT = 630, + INT16CONSTANT = 631, + UINT16CONSTANT = 632, + FLOAT16CONSTANT = 633, + INT32CONSTANT = 634, + UINT32CONSTANT = 635, + INT64CONSTANT = 636, + UINT64CONSTANT = 637, + SUBROUTINE = 638, + DEMOTE = 639, + PAYLOADNV = 640, + PAYLOADINNV = 641, + HITATTRNV = 642, + CALLDATANV = 643, + CALLDATAINNV = 644, + PATCH = 645, + SAMPLE = 646, + BUFFER = 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 @@ -459,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; @@ -495,7 +497,7 @@ union YYSTYPE glslang::TArraySizes* typeParameters; } interm; -#line 499 "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/glslang/MachineIndependent/intermOut.cpp b/glslang/MachineIndependent/intermOut.cpp index 3ca3a80f..fbfede07 100644 --- a/glslang/MachineIndependent/intermOut.cpp +++ b/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; @@ -615,7 +617,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 +639,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 +648,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 +676,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 +861,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 +868,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 +905,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 +933,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 +953,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 +975,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,7 +1042,6 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* 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; @@ -1080,19 +1064,16 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node case EOpSubgroupPartitionedExclusiveAnd: out.debug << "subgroupPartitionedExclusiveAndNV"; break; case EOpSubgroupPartitionedExclusiveOr: out.debug << "subgroupPartitionedExclusiveOrNV"; break; case EOpSubgroupPartitionedExclusiveXor: out.debug << "subgroupPartitionedExclusiveXorNV"; break; -#endif 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; @@ -1509,16 +1490,13 @@ void TIntermediate::output(TInfoSink& infoSink, bool tree) 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"; { @@ -1547,3 +1525,5 @@ void TIntermediate::output(TInfoSink& infoSink, bool tree) } } // end namespace glslang + +#endif // not GLSLANG_WEB \ No newline at end of file diff --git a/glslang/MachineIndependent/iomapper.cpp b/glslang/MachineIndependent/iomapper.cpp index 46c75583..26b830e4 100644 --- a/glslang/MachineIndependent/iomapper.cpp +++ b/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 -#include +#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 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& 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& 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& 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& 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,219 +275,622 @@ 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 +// The class is used for reserving explicit uniform locations and ubo/ssbo/opaque bindings + +struct TSymbolValidater { - TDefaultIoResolverBase(const TIntermediate &intermediate) : - intermediate(intermediate), - nextUniformLocation(intermediate.getUniformLocationBase()), - nextInputLocation(0), - nextOutputLocation(0) - { } - - int getBaseBinding(TResourceType res, unsigned int set) const { - return selectBaseBinding(intermediate.getShiftBinding(res), - intermediate.getShiftBindingForSet(res, set)); + 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& getResourceSetBinding() const { return intermediate.getResourceSetBinding(); } - - bool doAutoBindingMapping() const { return intermediate.getAutoMapBindings(); } - bool doAutoLocationMapping() const { return intermediate.getAutoMapLocations(); } - - typedef std::vector TSlotSet; - typedef std::unordered_map TSlotSetMap; - TSlotSetMap slots; - - TSlotSet::iterator findSlot(int set, int slot) - { - return std::lower_bound(slots[set].begin(), slots[set].end(), slot); - } - - bool checkEmpty(int set, int slot) - { - TSlotSet::iterator at = findSlot(set, slot); - return !(at != slots[set].end() && *at == slot); - } - - int reserveSlot(int set, int slot, int size = 1) - { - 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; + inline void operator()(std::pair& 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(i); + } } - - return slot; - } - - 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); - - // look for a big enough gap - for (; at != slots[set].end(); ++at) { - if (*at - base >= size) - break; - base = *at + 1; + 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(); + } + } + } } - return reserveSlot(set, base, size); } + 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; - virtual bool validateBinding(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool /*is_live*/) override = 0; - - virtual int resolveBinding(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool is_live) override = 0; - - int resolveSet(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool /*is_live*/) override - { - if (type.getQualifier().hasSet()) - return 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 atoi(getResourceSetBinding()[0].c_str()); - - return 0; - } - 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; - - // 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; - - // 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 location = intermediate.getUniformLocationOverride(name); - if (location != -1) - return location; - - location = nextUniformLocation; - - nextUniformLocation += TIntermediate::computeTypeUniformLocationSize(type); - - return location; - } - bool validateInOut(EShLanguage /*stage*/, const char* /*name*/, const TType& /*type*/, bool /*is_live*/) override - { - return true; - } - int resolveInOutLocation(EShLanguage stage, const char* /*name*/, const TType& type, bool /*is_live*/) override - { - // kick out of not doing this - if (!doAutoLocationMapping()) - return -1; - - // no locations added if already present, or a built-in variable - if (type.getQualifier().hasLocation() || type.isBuiltIn()) - return -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); - } - nextLocation += typeLocationSize; - - return location; - } - int resolveInOutComponent(EShLanguage /*stage*/, const char* /*name*/, const TType& /*type*/, bool /*is_live*/) override - { - return -1; - } - int resolveInOutIndex(EShLanguage /*stage*/, const char* /*name*/, const TType& /*type*/, bool /*is_live*/) override - { - return -1; - } - - 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 {} - -protected: - TDefaultIoResolverBase(TDefaultIoResolverBase&); - TDefaultIoResolverBase& operator=(TDefaultIoResolverBase&); - - const TIntermediate &intermediate; - int nextUniformLocation; - int nextInputLocation; - int nextOutputLocation; - - // 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; - } +private: + TSymbolValidater& operator=(TSymbolValidater&); }; +struct TSlotCollector { + TSlotCollector(TIoMapResolver& r, TInfoSink& i) : resolver(r), infoSink(i) { } + + inline void operator()(std::pair& entKey) { + resolver.reserverStorageSlot(entKey.second, infoSink); + resolver.reserverResourceSlot(entKey.second, infoSink); + } + TIoMapResolver& resolver; + TInfoSink& infoSink; + +private: + TSlotCollector& operator=(TSlotCollector&); +}; + +TDefaultIoResolverBase::TDefaultIoResolverBase(const TIntermediate& intermediate) + : intermediate(intermediate) + , nextUniformLocation(intermediate.getUniformLocationBase()) + , nextInputLocation(0) + , nextOutputLocation(0) +{ + memset(stageMask, false, sizeof(bool) * (EShLangCount + 1)); +} + +int TDefaultIoResolverBase::getBaseBinding(TResourceType res, unsigned int set) const { + return selectBaseBinding(intermediate.getShiftBinding(res), intermediate.getShiftBindingForSet(res, set)); +} + +const std::vector& TDefaultIoResolverBase::getResourceSetBinding() const { + return intermediate.getResourceSetBinding(); +} + +bool TDefaultIoResolverBase::doAutoBindingMapping() const { return intermediate.getAutoMapBindings(); } + +bool TDefaultIoResolverBase::doAutoLocationMapping() const { return intermediate.getAutoMapLocations(); } + +TDefaultIoResolverBase::TSlotSet::iterator TDefaultIoResolverBase::findSlot(int set, int slot) { + return std::lower_bound(slots[set].begin(), slots[set].end(), slot); +} + +bool TDefaultIoResolverBase::checkEmpty(int set, int slot) { + TSlotSet::iterator at = findSlot(set, slot); + return ! (at != slots[set].end() && *at == slot); +} + +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; +} + +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; + } + return reserveSlot(set, base, size); +} + +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; +} + +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 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; +} + +int TDefaultIoResolverBase::resolveInOutComponent(EShLanguage /*stage*/, TVarEntryInfo& ent) { + return ent.newComponent = -1; +} + +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; +} + +//TDefaultGlslIoResolver +TResourceType TDefaultGlslIoResolver::getResourceType(const glslang::TType& type) { + 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; +} + +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 ent.newLocation = -1; + } + if ((*type.getStruct())[0].type->isBuiltIn()) { + return ent.newLocation = -1; + } + } + } + int location = intermediate.getUniformLocationOverride(name.c_str()); + if (location != -1) { + return ent.newLocation = location; + } + + 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; +} + +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; +} + +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; + } +} + +void TDefaultGlslIoResolver::endResolve(EShLanguage /*stage*/) { + // TODO nothing +} + +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; + } +} + +void TDefaultGlslIoResolver::endCollect(EShLanguage /*stage*/) { + // TODO nothing +} + +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; + } +} + +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()); + } + } + } +} + +//TDefaultGlslIoResolver end + /* * Basic implementation of glslang::TIoMapResolver that replaces the * previous offset behavior. @@ -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,67 @@ b - for constant buffer views (CBV) CBUFFER CONSTANTBUFFER ********************************************************************************/ -struct TDefaultHlslIoResolver : public TDefaultIoResolverBase -{ - TDefaultHlslIoResolver(const TIntermediate &intermediate) : TDefaultIoResolverBase(intermediate) { } +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; - } + bool validateBinding(EShLanguage /*stage*/, TVarEntryInfo& /*ent*/) 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); - - if (isSamplerType(type)) - return reserveSlot(set, getBaseBinding(EResSampler, set) + type.getQualifier().layoutBinding); - - 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; + if (isSrvType(type)) { + return EResTexture; + } + if (isSamplerType(type)) { + return EResSampler; + } + if (isUboType(type)) { + return EResUbo; + } + return EResCount; } -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; - } - - // 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(); - +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)); + 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 +1057,189 @@ 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(); + for (int res = 0; res < EResCount; ++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/glslang/MachineIndependent/iomapper.h b/glslang/MachineIndependent/iomapper.h index 5e0d4391..01afc5a2 100644 --- a/glslang/MachineIndependent/iomapper.h +++ b/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 +#include "LiveTraverser.h" +#include +#include // // 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 TSlotSet; + typedef std::unordered_map 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& 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 TVarSlotMap; // + typedef std::map TSlotMap; // + 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(stage) <= 0x0000ffff && static_cast(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 TVarLiveMap; + +// override function "operator=", if a vector 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 { + TVarLivePair(std::pair& _Right) : pair(_Right.first, _Right.second) {} + TVarLivePair& operator=(const TVarLivePair& _Right) { + const_cast(first) = _Right.first; + second = _Right.second; + return (*this); + }; +}; +typedef std::vector TVarLiveVector; // I/O mapper class TIoMapper { public: TIoMapper() {} virtual ~TIoMapper() {} - // grow the reflection stage by stage - bool addStage(EShLanguage, TIntermediate&, TInfoSink&, TIoMapResolver*); + 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*) 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/glslang/MachineIndependent/limits.cpp b/glslang/MachineIndependent/limits.cpp index 64d191b4..51d93003 100644 --- a/glslang/MachineIndependent/limits.cpp +++ b/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/glslang/MachineIndependent/linkValidate.cpp b/glslang/MachineIndependent/linkValidate.cpp index f935d4a6..5b920f2d 100644 --- a/glslang/MachineIndependent/linkValidate.cpp +++ b/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; @@ -224,21 +226,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 +284,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 +307,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 @@ -536,7 +530,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,13 +539,14 @@ 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; } +#ifndef GLSLANG_WEB // Memory... if (symbol.getQualifier().coherent != unitSymbol.getQualifier().coherent || symbol.getQualifier().devicecoherent != unitSymbol.getQualifier().devicecoherent || @@ -566,6 +561,7 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy error(infoSink, "Memory qualifiers must match:"); writeTypeComparison = true; } +#endif // Layouts... // TODO: 4.4 enhanced layouts: Generalize to include offset/align: current spec @@ -609,15 +605,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 +618,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 +639,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 +663,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 +676,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 +693,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 +719,6 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled) break; case EShLangCompute: break; - -#ifdef NV_EXTENSIONS case EShLangRayGenNV: case EShLangIntersectNV: case EShLangAnyHitNV: @@ -764,8 +751,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 +772,7 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled) } finalLinkTraverser; treeRoot->traverse(&finalLinkTraverser); +#endif } // @@ -973,7 +959,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 +1052,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 +1079,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. @@ -1109,7 +1098,7 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ TIoRange range(locationRange, componentRange, type.getBasicType(), qualifier.hasIndex() ? qualifier.layoutIndex : 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 +1176,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 +1258,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 +1272,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 +1292,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 +1308,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 +1341,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 +1366,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 +1375,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 +1386,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 +1706,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/glslang/MachineIndependent/localintermediate.h b/glslang/MachineIndependent/localintermediate.h index eb0cc7a4..77ed7c39 100644 --- a/glslang/MachineIndependent/localintermediate.h +++ b/glslang/MachineIndependent/localintermediate.h @@ -149,20 +149,14 @@ struct TOffsetRange { // 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 ranges; // byte offsets that have already been assigned unsigned int stride; unsigned int implicitStride; bool contains64BitType; -#ifdef AMD_EXTENSIONS bool contains32BitType; bool contains16BitType; -#endif }; // Track a set of strings describing how the module was processed. @@ -217,7 +211,6 @@ class TSymbolTable; class TSymbol; class TVariable; -#ifdef NV_EXTENSIONS // // Texture and Sampler transformation mode. // @@ -226,7 +219,6 @@ enum ComputeDerivativeMode { LayoutDerivativeGroupQuads, // derivative_group_quadsNV LayoutDerivativeGroupLinear, // derivative_group_linearNV }; -#endif // // Set of helper functions to help parse and build the tree. @@ -234,41 +226,48 @@ enum ComputeDerivativeMode { class TIntermediate { public: explicit TIntermediate(EShLanguage l, int v = 0, EProfile p = ENoProfile) : + language(l), +#ifdef ENABLE_HLSL implicitThisName("@this"), implicitCounterName("@count"), - language(l), source(EShSourceNone), profile(p), version(v), treeRoot(0), + source(EShSourceNone), +#endif + 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 + , + useVulkanMemoryModel(false), invocations(TQualifier::layoutNotSet), vertices(TQualifier::layoutNotSet), inputPrimitive(ElgNone), outputPrimitive(ElgNone), pixelCenterInteger(false), originUpperLeft(false), vertexSpacing(EvsNone), vertexOrder(EvoNone), interlockOrdering(EioNone), pointMode(false), earlyFragmentTests(false), - postDepthCoverage(false), depthLayout(EldNone), depthReplacing(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), needToLegalize(false), binaryDoubleOutput(false), usePhysicalStorageBuffer(false), - uniformLocationBase(0), - nanMinMaxClamp(false) + uniformLocationBase(0) +#endif { +#ifndef GLSLANG_WEB localSize[0] = 1; localSize[1] = 1; localSize[2] = 1; @@ -276,152 +275,9 @@ public: localSizeSpecId[1] = TQualifier::layoutNotSet; localSizeSpecId[2] = TQualifier::layoutNotSet; 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& 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& 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 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; } @@ -485,9 +341,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; } @@ -566,6 +448,152 @@ 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; } + +#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; } +#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& 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& 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 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) @@ -635,7 +663,6 @@ public: return true; } int getLocalSizeSpecId(int dim) const { return localSizeSpecId[dim]; } - void setXfbMode() { xfbMode = true; } bool getXfbMode() const { return xfbMode; } void setMultiStream() { multiStream = true; } @@ -648,14 +675,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) @@ -664,29 +687,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) @@ -696,28 +702,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) { @@ -727,28 +719,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& 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& 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& getProcesses() const { return processes.getProcesses(); } - void addUniformLocationOverride(const char* nameStr, int location) { std::string name = nameStr; @@ -768,38 +742,100 @@ public: void setUniformLocationBase(int base) { uniformLocationBase = base; } int getUniformLocationBase() const { return uniformLocationBase; } - void setNanMinMaxClamp(bool setting) { nanMinMaxClamp = setting; } - bool getNanMinMaxClamp() const { return nanMinMaxClamp; } - void setNeedsLegalization() { needToLegalize = true; } bool needsLegalization() const { return needToLegalize; } void setBinaryDoubleOutput() { binaryDoubleOutput = true; } bool getBinaryDoubleOutput() { return binaryDoubleOutput; } +#endif - 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); + + 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& 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& 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& 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) || -#ifdef AMD_EXTENSIONS extensionRequested(E_GL_AMD_gpu_shader_int16) || -#endif extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int16); } bool getArithemeticFloat16Enabled() const { return extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) || -#ifdef AMD_EXTENSIONS extensionRequested(E_GL_AMD_gpu_shader_half_float) || -#endif 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&); @@ -832,11 +868,27 @@ protected: bool isConversionAllowed(TOperator op, TIntermTyped* node) const; TIntermTyped* createConversion(TBasicType convertTo, TIntermTyped* node) const; std::tuple 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 +#ifdef ENABLE_HLSL +public: + const char* const implicitThisName; + const char* const implicitCounterName; +protected: EShSource source; // source language, known a bit later +#endif std::string entryPointName; std::string entryPointMangledName; typedef std::list TGraph; @@ -852,6 +904,12 @@ 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; +#ifndef GLSLANG_WEB + bool useVulkanMemoryModel; int invocations; int vertices; TLayoutGeometry inputPrimitive; @@ -867,21 +925,17 @@ protected: 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 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 shiftBinding; @@ -892,23 +946,29 @@ protected: std::vector resourceSetBinding; bool autoMapBindings; bool autoMapLocations; - bool invertY; bool flattenUniformArrays; bool useUnknownFormat; bool hlslOffsets; - bool useStorageBuffer; - bool useVulkanMemoryModel; bool hlslIoMapping; bool useVariablePointers; - std::set ioAccessed; // set of names of statically read/written I/O that might need extra checking - std::vector usedIo[4]; // sets of used locations, one for each of in, out, uniform, and buffers - std::vector usedAtomics; // sets of bindings used by atomic counters - std::unordered_set usedConstantId; // specialization constant ids used std::set semanticNameSet; EShTextureSamplerTransformMode textureSamplerTransformMode; + bool needToLegalize; + bool binaryDoubleOutput; + bool usePhysicalStorageBuffer; + + std::unordered_map uniformLocationOverrides; + int uniformLocationBase; +#endif + + std::unordered_set usedConstantId; // specialization constant ids used + std::vector usedAtomics; // sets of bindings used by atomic counters + std::vector 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 ioAccessed; // source code of shader, useful as part of debug information std::string sourceFile; std::string sourceText; @@ -919,14 +979,6 @@ protected: // for OpModuleProcessed, or equivalent TProcesses processes; - bool needToLegalize; - bool binaryDoubleOutput; - bool usePhysicalStorageBuffer; - - std::unordered_map uniformLocationOverrides; - int uniformLocationBase; - bool nanMinMaxClamp; // true if desiring min/max/clamp to favor non-NaN over NaN - private: void operator=(TIntermediate&); // prevent assignments }; diff --git a/glslang/MachineIndependent/parseVersions.h b/glslang/MachineIndependent/parseVersions.h index 02af76a8..aa1964fc 100755 --- a/glslang/MachineIndependent/parseVersions.h +++ b/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/glslang/MachineIndependent/preprocessor/Pp.cpp b/glslang/MachineIndependent/preprocessor/Pp.cpp index c74e44f0..d7ff485c 100755 --- a/glslang/MachineIndependent/preprocessor/Pp.cpp +++ b/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/glslang/MachineIndependent/preprocessor/PpScanner.cpp b/glslang/MachineIndependent/preprocessor/PpScanner.cpp index f6f52d7d..c293af3c 100755 --- a/glslang/MachineIndependent/preprocessor/PpScanner.cpp +++ b/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/glslang/MachineIndependent/preprocessor/PpTokens.cpp b/glslang/MachineIndependent/preprocessor/PpTokens.cpp index ac9d8ac3..7ed58703 100755 --- a/glslang/MachineIndependent/preprocessor/PpTokens.cpp +++ b/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/glslang/MachineIndependent/propagateNoContraction.cpp b/glslang/MachineIndependent/propagateNoContraction.cpp index ae95688a..83a3230f 100644 --- a/glslang/MachineIndependent/propagateNoContraction.cpp +++ b/glslang/MachineIndependent/propagateNoContraction.cpp @@ -37,6 +37,8 @@ // propagate the 'noContraction' qualifier. // +#ifndef GLSLANG_WEB + #include "propagateNoContraction.h" #include @@ -79,7 +81,7 @@ typedef std::unordered_set 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/glslang/MachineIndependent/reflection.cpp b/glslang/MachineIndependent/reflection.cpp index a09a0488..f2be2ff1 100644 --- a/glslang/MachineIndependent/reflection.cpp +++ b/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" @@ -396,7 +398,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 +556,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 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 +578,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 +706,6 @@ public: case EsdBuffer: return GL_SAMPLER_BUFFER; } -#ifdef AMD_EXTENSIONS case EbtFloat16: switch ((int)sampler.dim) { case Esd1D: @@ -730,7 +734,6 @@ public: case EsdBuffer: return GL_FLOAT16_SAMPLER_BUFFER_AMD; } -#endif case EbtInt: switch ((int)sampler.dim) { case Esd1D: @@ -793,7 +796,6 @@ public: case EsdBuffer: return GL_IMAGE_BUFFER; } -#ifdef AMD_EXTENSIONS case EbtFloat16: switch ((int)sampler.dim) { case Esd1D: @@ -812,7 +814,6 @@ public: case EsdBuffer: return GL_FLOAT16_IMAGE_BUFFER_AMD; } -#endif case EbtInt: switch ((int)sampler.dim) { case Esd1D: @@ -878,9 +879,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 +939,6 @@ public: default: return 0; } } -#ifdef AMD_EXTENSIONS case EbtFloat16: switch (type.getMatrixCols()) { case 2: @@ -965,7 +963,6 @@ public: default: return 0; } } -#endif default: return 0; } @@ -974,9 +971,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 +1088,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 +1097,7 @@ void TReflection::buildCounterIndices(const TIntermediate& intermediate) if (index >= 0) indexToUniformBlock[i].counterIndex = index; } +#endif } // build Shader Stages mask for all uniforms @@ -1198,3 +1195,5 @@ void TReflection::dump() } } // end namespace glslang + +#endif // GLSLANG_WEB diff --git a/glslang/MachineIndependent/reflection.h b/glslang/MachineIndependent/reflection.h index 44b17a05..e3561a9d 100644 --- a/glslang/MachineIndependent/reflection.h +++ b/glslang/MachineIndependent/reflection.h @@ -33,6 +33,8 @@ // POSSIBILITY OF SUCH DAMAGE. // +#ifndef GLSLANG_WEB + #ifndef _REFLECTION_INCLUDED #define _REFLECTION_INCLUDED @@ -201,3 +203,5 @@ protected: } // end namespace glslang #endif // _REFLECTION_INCLUDED + +#endif // GLSLANG_WEB \ No newline at end of file diff --git a/glslang/Public/ShaderLang.h b/glslang/Public/ShaderLang.h index 954ce8e0..a3103c65 100755 --- a/glslang/Public/ShaderLang.h +++ b/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,36 @@ 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 + 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 } EShTargetLanguageVersion; struct TInputLanguage { @@ -432,8 +432,10 @@ 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); @@ -442,6 +444,30 @@ public: // 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; @@ -459,8 +485,13 @@ public: environment.target.language = lang; environment.target.version = version; } + +#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. // @@ -611,6 +642,8 @@ private: TShader& operator=(TShader&); }; +#ifndef GLSLANG_WEB + // // A reflection database and its interface, consistent with the OpenGL API reflection queries. // @@ -646,8 +679,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. @@ -668,53 +702,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() {} + 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; + // 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(). @@ -734,14 +780,14 @@ 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); - unsigned getLocalSize(int dim) const; // return dim'th local size int getReflectionIndex(const char *name) const; - int getNumUniformVariables() const; const TObjectReflection& getUniform(int index) const; int getNumUniformBlocks() const; @@ -820,11 +866,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); @@ -834,8 +880,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/glslang/glslang.js.cpp b/glslang/glslang.js.cpp new file mode 100644 index 00000000..45b3d3f6 --- /dev/null +++ b/glslang/glslang.js.cpp @@ -0,0 +1,270 @@ +// +// 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 +#include + +#ifdef __EMSCRIPTEN__ +#include +#endif // __EMSCRIPTEN__ +#include + +#include "../SPIRV/GlslangToSpv.h" +#include "../SPIRV/doc.h" +#include "./../glslang/Public/ShaderLang.h" + +#ifndef EMSCRIPTEN_KEEPALIVE +#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(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* output = new std::vector; + 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*>(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/glslang/glslang.pre.js b/glslang/glslang.pre.js new file mode 100644 index 00000000..dd7100b3 --- /dev/null +++ b/glslang/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/glslang/updateGrammar b/glslang/updateGrammar index f8fa81da..37794587 100755 --- a/glslang/updateGrammar +++ b/glslang/updateGrammar @@ -1,3 +1,16 @@ -#!/usr/bin/env bash +#!/usr/bin/bash + +if [ "$1" = 'web' ] +then + m4 -P -DGLSLANG_WEB MachineIndependent/glslang.m4 > MachineIndependent/glslang.y +elif [ "$#" -eq 0 ] +then + m4 -P MachineIndependent/glslang.m4 > MachineIndependent/glslang.y +else + echo usage: + echo $0 web + echo $0 + exit +fi bison --defines=MachineIndependent/glslang_tab.cpp.h -t MachineIndependent/glslang.y -o MachineIndependent/glslang_tab.cpp diff --git a/gtests/AST.FromFile.cpp b/gtests/AST.FromFile.cpp index b24a4a16..50046719 100644 --- a/gtests/AST.FromFile.cpp +++ b/gtests/AST.FromFile.cpp @@ -41,9 +41,7 @@ namespace { using CompileToAstTest = GlslangTest<::testing::TestWithParam>; -#ifdef NV_EXTENSIONS using CompileToAstTestNV = GlslangTest<::testing::TestWithParam>; -#endif TEST_P(CompileToAstTest, FromFile) { @@ -52,7 +50,6 @@ TEST_P(CompileToAstTest, FromFile) Target::AST); } -#ifdef NV_EXTENSIONS // Compiling GLSL to SPIR-V under OpenGL semantics (NV extensions enabled). TEST_P(CompileToAstTestNV, FromFile) { @@ -60,7 +57,6 @@ TEST_P(CompileToAstTestNV, FromFile) Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0, Target::AST); } -#endif // clang-format off INSTANTIATE_TEST_CASE_P( @@ -125,6 +121,7 @@ INSTANTIATE_TEST_CASE_P( "310.tesc", "310.tese", "310implicitSizeArrayError.vert", + "310.inheritMemory.frag", "310AofA.vert", "310runtimeArray.vert", "320.comp", @@ -281,7 +278,6 @@ INSTANTIATE_TEST_CASE_P( FileNameAsCustomTestSuffix ); -#ifdef NV_EXTENSIONS INSTANTIATE_TEST_CASE_P( Glsl, CompileToAstTestNV, ::testing::ValuesIn(std::vector({ @@ -289,7 +285,6 @@ INSTANTIATE_TEST_CASE_P( })), FileNameAsCustomTestSuffix ); -#endif // clang-format on } // anonymous namespace diff --git a/gtests/Spv.FromFile.cpp b/gtests/Spv.FromFile.cpp index e630f56f..d12d39ac 100644 --- a/gtests/Spv.FromFile.cpp +++ b/gtests/Spv.FromFile.cpp @@ -72,12 +72,8 @@ using OpenGLSemantics = GlslangTest<::testing::TestWithParam>; using VulkanAstSemantics = GlslangTest<::testing::TestWithParam>; using HlslIoMap = GlslangTest<::testing::TestWithParam>; using GlslIoMap = GlslangTest<::testing::TestWithParam>; -#ifdef AMD_EXTENSIONS using CompileVulkanToSpirvTestAMD = GlslangTest<::testing::TestWithParam>; -#endif -#ifdef NV_EXTENSIONS using CompileVulkanToSpirvTestNV = GlslangTest<::testing::TestWithParam>; -#endif using CompileUpgradeTextureToSampledTextureAndDropSamplersTest = GlslangTest<::testing::TestWithParam>; // Compiling GLSL to SPIR-V under Vulkan semantics. Expected to successfully @@ -179,7 +175,6 @@ TEST_P(GlslIoMap, FromFile) GetParam().flattenUniforms); } -#ifdef AMD_EXTENSIONS // Compiling GLSL to SPIR-V under Vulkan semantics (AMD extensions enabled). // Expected to successfully generate SPIR-V. TEST_P(CompileVulkanToSpirvTestAMD, FromFile) @@ -188,9 +183,7 @@ TEST_P(CompileVulkanToSpirvTestAMD, FromFile) Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0, Target::Spv); } -#endif -#ifdef NV_EXTENSIONS // Compiling GLSL to SPIR-V under Vulkan semantics (NV extensions enabled). // Expected to successfully generate SPIR-V. TEST_P(CompileVulkanToSpirvTestNV, FromFile) @@ -199,7 +192,6 @@ TEST_P(CompileVulkanToSpirvTestNV, FromFile) Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0, Target::Spv); } -#endif TEST_P(CompileUpgradeTextureToSampledTextureAndDropSamplersTest, FromFile) { @@ -296,6 +288,7 @@ INSTANTIATE_TEST_CASE_P( "spv.builtInXFB.vert", "spv.conditionalDemote.frag", "spv.conditionalDiscard.frag", + "spv.constructComposite.comp", "spv.constStruct.vert", "spv.constConstruct.vert", "spv.controlFlowAttributes.frag", @@ -332,6 +325,7 @@ INSTANTIATE_TEST_CASE_P( "spv.GeometryShaderPassthrough.geom", "spv.interpOps.frag", "spv.int64.frag", + "spv.intcoopmat.comp", "spv.intOps.vert", "spv.layoutNested.vert", "spv.length.frag", @@ -484,6 +478,7 @@ INSTANTIATE_TEST_CASE_P( "spv.1.4.image.frag", "spv.1.4.sparseTexture.frag", "spv.1.4.texture.frag", + "spv.1.4.constructComposite.comp", })), FileNameAsCustomTestSuffix ); @@ -570,7 +565,6 @@ INSTANTIATE_TEST_CASE_P( FileNameAsCustomTestSuffix ); -#ifdef AMD_EXTENSIONS INSTANTIATE_TEST_CASE_P( Glsl, CompileVulkanToSpirvTestAMD, ::testing::ValuesIn(std::vector({ @@ -586,9 +580,7 @@ INSTANTIATE_TEST_CASE_P( })), FileNameAsCustomTestSuffix ); -#endif -#ifdef NV_EXTENSIONS INSTANTIATE_TEST_CASE_P( Glsl, CompileVulkanToSpirvTestNV, ::testing::ValuesIn(std::vector({ @@ -636,7 +628,6 @@ INSTANTIATE_TEST_CASE_P( })), FileNameAsCustomTestSuffix ); -#endif INSTANTIATE_TEST_CASE_P( Glsl, CompileUpgradeTextureToSampledTextureAndDropSamplersTest, diff --git a/gtests/TestFixture.cpp b/gtests/TestFixture.cpp index d899c780..baf4d16d 100644 --- a/gtests/TestFixture.cpp +++ b/gtests/TestFixture.cpp @@ -60,7 +60,6 @@ EShLanguage GetShaderStage(const std::string& stage) return EShLangFragment; } else if (stage == "comp") { return EShLangCompute; -#ifdef NV_EXTENSIONS } else if (stage == "rgen") { return EShLangRayGenNV; } else if (stage == "rint") { @@ -77,7 +76,6 @@ EShLanguage GetShaderStage(const std::string& stage) return EShLangTaskNV; } else if (stage == "mesh") { return EShLangMeshNV; -#endif } else { assert(0 && "Unknown shader stage"); return EShLangCount; diff --git a/gtests/TestFixture.h b/gtests/TestFixture.h index 4d28d321..61a8f232 100755 --- a/gtests/TestFixture.h +++ b/gtests/TestFixture.h @@ -227,7 +227,9 @@ public: shader.setAutoMapBindings(true); } shader.setTextureSamplerTransformMode(texSampTransMode); +#ifdef ENABLE_HLSL shader.setFlattenUniformArrays(flattenUniformArrays); +#endif if (controls & EShMsgSpvRules) { if (controls & EShMsgVulkanRules) { @@ -300,7 +302,9 @@ public: shader.setShiftSsboBinding(baseSsboBinding); shader.setAutoMapBindings(autoMapBindings); shader.setAutoMapLocations(true); +#ifdef ENABLE_HLSL shader.setFlattenUniformArrays(flattenUniformArrays); +#endif bool success = compile(&shader, code, entryPointName, controls); @@ -308,7 +312,9 @@ public: program.addShader(&shader); success &= program.link(controls); +#ifndef GLSLANG_WEB success &= program.mapIO(); +#endif spv::SpvBuildLogger logger; diff --git a/hlsl/hlslParseHelper.cpp b/hlsl/hlslParseHelper.cpp index a972009c..1549e3a4 100644 --- a/hlsl/hlslParseHelper.cpp +++ b/hlsl/hlslParseHelper.cpp @@ -8703,25 +8703,19 @@ void HlslParseContext::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); // "if applied to an aggregate containing a half float or 16-bit integer, the offset must also be a multiple of 2" else if (contains16BitType) RoundToPow2(nextOffset, 2); -#endif memberQualifier.layoutXfbOffset = nextOffset; } else nextOffset = memberQualifier.layoutXfbOffset;