From 4d65ee31a6ffc5abc862211af323b2e858a29f89 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Sat, 12 Mar 2016 18:17:47 -0700 Subject: [PATCH 001/140] Generalize "main" to a settable entry point name. --- SPIRV/GlslangToSpv.cpp | 8 +++++--- SPIRV/SpvBuilder.cpp | 4 ++-- SPIRV/SpvBuilder.h | 4 ++-- StandAlone/StandAlone.cpp | 18 ++++++++++++++++++ glslang/MachineIndependent/ParseHelper.cpp | 2 +- glslang/MachineIndependent/ShaderLang.cpp | 6 ++++++ glslang/MachineIndependent/localintermediate.h | 3 +++ glslang/Public/ShaderLang.h | 1 + 8 files changed, 38 insertions(+), 8 deletions(-) diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 8c1c84f9..7a7baa2b 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -590,8 +590,8 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(const glslang::TIntermediate* gls builder.setSource(TranslateSourceLanguage(glslangIntermediate->getProfile()), glslangIntermediate->getVersion()); stdBuiltins = builder.import("GLSL.std.450"); builder.setMemoryModel(spv::AddressingModelLogical, spv::MemoryModelGLSL450); - shaderEntry = builder.makeMain(); - entryPoint = builder.addEntryPoint(executionModel, shaderEntry, "main"); + shaderEntry = builder.makeEntrypoint(glslangIntermediate->getEntryPoint().c_str()); + entryPoint = builder.addEntryPoint(executionModel, shaderEntry, glslangIntermediate->getEntryPoint().c_str()); // Add the source extensions const auto& sourceExtensions = glslangIntermediate->getRequestedExtensions(); @@ -2082,7 +2082,9 @@ void TGlslangToSpvTraverser::updateMemberOffset(const glslang::TType& /*structTy bool TGlslangToSpvTraverser::isShaderEntrypoint(const glslang::TIntermAggregate* node) { - return node->getName() == "main("; + // have to ignore mangling and just look at the base name + int firstOpen = node->getName().find('('); + return node->getName().compare(0, firstOpen, glslangIntermediate->getEntryPoint()) == 0; } // Make all the functions, skeletally, without actually visiting their bodies. diff --git a/SPIRV/SpvBuilder.cpp b/SPIRV/SpvBuilder.cpp index 336d3de3..06d7a02a 100644 --- a/SPIRV/SpvBuilder.cpp +++ b/SPIRV/SpvBuilder.cpp @@ -893,7 +893,7 @@ void Builder::addMemberDecoration(Id id, unsigned int member, Decoration decorat } // Comments in header -Function* Builder::makeMain() +Function* Builder::makeEntrypoint(const char* entryPoint) { assert(! mainFunction); @@ -901,7 +901,7 @@ Function* Builder::makeMain() std::vector params; std::vector precisions; - mainFunction = makeFunctionEntry(NoPrecision, makeVoidType(), "main", params, precisions, &entry); + mainFunction = makeFunctionEntry(NoPrecision, makeVoidType(), entryPoint, params, precisions, &entry); return mainFunction; } diff --git a/SPIRV/SpvBuilder.h b/SPIRV/SpvBuilder.h index e16ba38c..162e79ef 100755 --- a/SPIRV/SpvBuilder.h +++ b/SPIRV/SpvBuilder.h @@ -205,9 +205,9 @@ public: void setBuildPoint(Block* bp) { buildPoint = bp; } Block* getBuildPoint() const { return buildPoint; } - // Make the main function. The returned pointer is only valid + // Make the entry-point function. The returned pointer is only valid // for the lifetime of this builder. - Function* makeMain(); + Function* makeEntrypoint(const char*); // Make a shader-style function, and create its entry block if entry is non-zero. // Return the function, pass back the entry. diff --git a/StandAlone/StandAlone.cpp b/StandAlone/StandAlone.cpp index cc59d389..408f114e 100644 --- a/StandAlone/StandAlone.cpp +++ b/StandAlone/StandAlone.cpp @@ -449,6 +449,7 @@ int NumWorkItems = 0; int Options = 0; const char* ExecutableName = nullptr; const char* binaryFileName = nullptr; +const char* entryPointName = nullptr; // // Create the default name for saving a binary if -o is not provided. @@ -537,6 +538,16 @@ void ProcessArguments(int argc, char* argv[]) case 'd': Options |= EOptionDefaultDesktop; break; + case 'e': + // HLSL todo: entry point handle needs much more sophistication. + // This is okay for one compilation unit with one entry point. + entryPointName = argv[1]; + if (argc > 0) { + argc--; + argv++; + } else + Error("no provided for -e"); + break; case 'h': usage(); break; @@ -693,6 +704,8 @@ void CompileAndLinkShaderUnits(std::vector compUnits) const auto &compUnit = *it; glslang::TShader* shader = new glslang::TShader(compUnit.stage); shader->setStrings(compUnit.text, 1); + if (entryPointName) // HLSL todo: this needs to be tracked per compUnits + shader->setEntryPoint(entryPointName); shaders.push_back(shader); const int defaultVersion = Options & EOptionDefaultDesktop? 110: 100; @@ -726,20 +739,24 @@ void CompileAndLinkShaderUnits(std::vector compUnits) // Program-level processing... // + // Link if (! (Options & EOptionOutputPreprocessed) && ! program.link(messages)) LinkFailed = true; + // Report if (! (Options & EOptionSuppressInfolog) && ! (Options & EOptionMemoryLeakMode)) { PutsIfNonEmpty(program.getInfoLog()); PutsIfNonEmpty(program.getInfoDebugLog()); } + // Reflect if (Options & EOptionDumpReflection) { program.buildReflection(); program.dumpReflection(); } + // Dump SPIR-V if (Options & EOptionSpv) { if (CompileFailed || LinkFailed) printf("SPIR-V is not generated for failed compile or link\n"); @@ -1030,6 +1047,7 @@ void usage() " creates the default configuration file (redirect to a .conf file)\n" " -d default to desktop (#version 110) when there is no shader #version\n" " (default is ES version 100)\n" + " -e specify entry-point name\n" " -h print this usage message\n" " -i intermediate tree (glslang AST) is printed out\n" " -l link all input files together to form a single module\n" diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 8cee3e4b..a43df95b 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -975,7 +975,7 @@ TIntermAggregate* TParseContext::handleFunctionDefinition(const TSourceLoc& loc, // // Raise error message if main function takes any parameters or returns anything other than void // - if (function.getName() == "main") { + if (function.getName() == intermediate.getEntryPoint()) { if (function.getParamCount() > 0) error(loc, "function cannot take any parameter(s)", function.getName().c_str(), ""); if (function.getType().getBasicType() != EbtVoid) diff --git a/glslang/MachineIndependent/ShaderLang.cpp b/glslang/MachineIndependent/ShaderLang.cpp index 1f835539..4b2bf832 100644 --- a/glslang/MachineIndependent/ShaderLang.cpp +++ b/glslang/MachineIndependent/ShaderLang.cpp @@ -588,6 +588,7 @@ bool ProcessDeferred( // Now we can process the full shader under proper symbols and rules. // + intermediate.setEntryPoint("main"); TParseContext parseContext(symbolTable, intermediate, false, version, profile, spv, vulkan, compiler->getLanguage(), compiler->infoSink, forwardCompatible, messages); glslang::TScanContext scanContext(parseContext); TPpContext ppContext(parseContext, includer); @@ -1355,6 +1356,11 @@ void TShader::setStringsWithLengthsAndNames( stringNames = names; } +void TShader::setEntryPoint(const char* entryPoint) +{ + intermediate->setEntryPoint(entryPoint); +} + // // Turn the shader strings into a parse tree in the TIntermediate. // diff --git a/glslang/MachineIndependent/localintermediate.h b/glslang/MachineIndependent/localintermediate.h index 99267475..b1e833ba 100644 --- a/glslang/MachineIndependent/localintermediate.h +++ b/glslang/MachineIndependent/localintermediate.h @@ -145,6 +145,8 @@ public: void output(TInfoSink&, bool tree); void removeTree(); + void setEntryPoint(const char* ep) { entryPoint = ep; } + const TString& getEntryPoint() const { return entryPoint; } void setVersion(int v) { version = v; } int getVersion() const { return version; } void setProfile(EProfile p) { profile = p; } @@ -338,6 +340,7 @@ protected: static int getBaseAlignmentScalar(const TType&, int& size); const EShLanguage language; + TString entryPoint; TIntermNode* treeRoot; EProfile profile; int version; diff --git a/glslang/Public/ShaderLang.h b/glslang/Public/ShaderLang.h index 702b66f4..7a708f2b 100644 --- a/glslang/Public/ShaderLang.h +++ b/glslang/Public/ShaderLang.h @@ -290,6 +290,7 @@ public: void setStringsWithLengthsAndNames( const char* const* s, const int* l, const char* const* names, int n); void setPreamble(const char* s) { preamble = s; } + void setEntryPoint(const char* entryPoint); // Interface to #include handlers. class Includer { From 66e2faf8444f6665ad214bbb47d90ebfb481c09f Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Sat, 12 Mar 2016 18:34:36 -0700 Subject: [PATCH 002/140] Support multiple source languages, adding HLSL as an option. --- SPIRV/GlslangToSpv.cpp | 25 ++++++++++++------- SPIRV/doc.cpp | 3 ++- SPIRV/spirv.hpp | 1 + StandAlone/StandAlone.cpp | 7 ++++++ glslang/MachineIndependent/ShaderLang.cpp | 14 +++++++++-- .../MachineIndependent/localintermediate.h | 12 ++++++--- glslang/Public/ShaderLang.h | 9 ++++++- 7 files changed, 54 insertions(+), 17 deletions(-) diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 7a7baa2b..1c6abec9 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -160,15 +160,22 @@ protected: // // Translate glslang profile to SPIR-V source language. -spv::SourceLanguage TranslateSourceLanguage(EProfile profile) +spv::SourceLanguage TranslateSourceLanguage(glslang::EShSource source, EProfile profile) { - switch (profile) { - case ENoProfile: - case ECoreProfile: - case ECompatibilityProfile: - return spv::SourceLanguageGLSL; - case EEsProfile: - return spv::SourceLanguageESSL; + switch (source) { + case glslang::EShSourceGlsl: + switch (profile) { + case ENoProfile: + case ECoreProfile: + case ECompatibilityProfile: + return spv::SourceLanguageGLSL; + case EEsProfile: + return spv::SourceLanguageESSL; + default: + return spv::SourceLanguageUnknown; + } + case glslang::EShSourceHlsl: + return spv::SourceLanguageHLSL; default: return spv::SourceLanguageUnknown; } @@ -587,7 +594,7 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(const glslang::TIntermediate* gls spv::ExecutionModel executionModel = TranslateExecutionModel(glslangIntermediate->getStage()); builder.clearAccessChain(); - builder.setSource(TranslateSourceLanguage(glslangIntermediate->getProfile()), glslangIntermediate->getVersion()); + builder.setSource(TranslateSourceLanguage(glslangIntermediate->getSource(), glslangIntermediate->getProfile()), glslangIntermediate->getVersion()); stdBuiltins = builder.import("GLSL.std.450"); builder.setMemoryModel(spv::AddressingModelLogical, spv::MemoryModelGLSL450); shaderEntry = builder.makeEntrypoint(glslangIntermediate->getEntryPoint().c_str()); diff --git a/SPIRV/doc.cpp b/SPIRV/doc.cpp index 7cf1c87f..7ee86b5b 100755 --- a/SPIRV/doc.cpp +++ b/SPIRV/doc.cpp @@ -64,7 +64,7 @@ namespace spv { // (for non-sparse mask enums, this is the number of enumurants) // -const int SourceLanguageCeiling = 5; +const int SourceLanguageCeiling = 6; // HLSL todo: need official enumerant const char* SourceString(int source) { @@ -74,6 +74,7 @@ const char* SourceString(int source) case 2: return "GLSL"; case 3: return "OpenCL_C"; case 4: return "OpenCL_CPP"; + case 5: return "HLSL"; case SourceLanguageCeiling: default: return "Bad"; diff --git a/SPIRV/spirv.hpp b/SPIRV/spirv.hpp index 5620aba7..7447fcf7 100755 --- a/SPIRV/spirv.hpp +++ b/SPIRV/spirv.hpp @@ -61,6 +61,7 @@ enum SourceLanguage { SourceLanguageGLSL = 2, SourceLanguageOpenCL_C = 3, SourceLanguageOpenCL_CPP = 4, + SourceLanguageHLSL = 5, }; enum ExecutionModel { diff --git a/StandAlone/StandAlone.cpp b/StandAlone/StandAlone.cpp index 408f114e..2e0db6d4 100644 --- a/StandAlone/StandAlone.cpp +++ b/StandAlone/StandAlone.cpp @@ -74,6 +74,7 @@ enum TOptions { EOptionVulkanRules = 0x2000, EOptionDefaultDesktop = 0x4000, EOptionOutputPreprocessed = 0x8000, + EOptionReadHlsl = 0x10000, }; // @@ -538,6 +539,9 @@ void ProcessArguments(int argc, char* argv[]) case 'd': Options |= EOptionDefaultDesktop; break; + case 'D': + Options |= EOptionReadHlsl; + break; case 'e': // HLSL todo: entry point handle needs much more sophistication. // This is okay for one compilation unit with one entry point. @@ -627,6 +631,8 @@ void SetMessageOptions(EShMessages& messages) messages = (EShMessages)(messages | EShMsgVulkanRules); if (Options & EOptionOutputPreprocessed) messages = (EShMessages)(messages | EShMsgOnlyPreprocessor); + if (Options & EOptionReadHlsl) + messages = (EShMessages)(messages | EShMsgReadHlsl); } // @@ -1047,6 +1053,7 @@ void usage() " creates the default configuration file (redirect to a .conf file)\n" " -d default to desktop (#version 110) when there is no shader #version\n" " (default is ES version 100)\n" + " -D input is HLSL\n" " -e specify entry-point name\n" " -h print this usage message\n" " -i intermediate tree (glslang AST) is printed out\n" diff --git a/glslang/MachineIndependent/ShaderLang.cpp b/glslang/MachineIndependent/ShaderLang.cpp index 4b2bf832..230929aa 100644 --- a/glslang/MachineIndependent/ShaderLang.cpp +++ b/glslang/MachineIndependent/ShaderLang.cpp @@ -307,11 +307,19 @@ void SetupBuiltinSymbolTable(int version, EProfile profile, int spv, int vulkan) glslang::ReleaseGlobalLock(); } -bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNotFirst, int defaultVersion, int& version, EProfile& profile, int spv) +// Return true if the shader was correctly specified for version/profile/stage. +bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNotFirst, int defaultVersion, + EShSource source, int& version, EProfile& profile, int spv) { const int FirstProfileVersion = 150; bool correct = true; + if (source == EShSourceHlsl) { + version = defaultVersion; + profile = ENoProfile; + return correct; + } + // Get a good version... if (version == 0) { version = defaultVersion; @@ -552,7 +560,8 @@ bool ProcessDeferred( } int spv = (messages & EShMsgSpvRules) ? 100 : 0; // TODO find path to get real version number here, for now non-0 is what matters - bool goodVersion = DeduceVersionProfile(compiler->infoSink, compiler->getLanguage(), versionNotFirst, defaultVersion, version, profile, spv); + EShSource source = (messages & EShMsgReadHlsl) ? EShSourceHlsl : EShSourceGlsl; + bool goodVersion = DeduceVersionProfile(compiler->infoSink, compiler->getLanguage(), versionNotFirst, defaultVersion, source, version, profile, spv); bool versionWillBeError = (versionNotFound || (profile == EEsProfile && version >= 300 && versionNotFirst)); bool warnVersionNotFirst = false; if (! versionWillBeError && versionNotFirstToken) { @@ -563,6 +572,7 @@ bool ProcessDeferred( } int vulkan = (messages & EShMsgVulkanRules) ? 100 : 0; // TODO find path to get real version number here, for now non-0 is what matters + intermediate.setSource(source); intermediate.setVersion(version); intermediate.setProfile(profile); intermediate.setSpv(spv); diff --git a/glslang/MachineIndependent/localintermediate.h b/glslang/MachineIndependent/localintermediate.h index b1e833ba..efffb716 100644 --- a/glslang/MachineIndependent/localintermediate.h +++ b/glslang/MachineIndependent/localintermediate.h @@ -124,7 +124,8 @@ class TVariable; // class TIntermediate { public: - explicit TIntermediate(EShLanguage l, int v = 0, EProfile p = ENoProfile) : language(l), treeRoot(0), profile(p), version(v), spv(0), + explicit TIntermediate(EShLanguage l, int v = 0, EProfile p = ENoProfile) : + source(EShSourceNone), language(l), profile(p), version(v), spv(0), treeRoot(0), numMains(0), numErrors(0), numPushConstants(0), recursive(false), invocations(TQualifier::layoutNotSet), vertices(TQualifier::layoutNotSet), inputPrimitive(ElgNone), outputPrimitive(ElgNone), pixelCenterInteger(false), originUpperLeft(false), @@ -143,8 +144,10 @@ public: bool postProcess(TIntermNode*, EShLanguage); void output(TInfoSink&, bool tree); - void removeTree(); + void removeTree(); + void setSource(EShSource s) { source = s; } + EShSource getSource() const { return source; } void setEntryPoint(const char* ep) { entryPoint = ep; } const TString& getEntryPoint() const { return entryPoint; } void setVersion(int v) { version = v; } @@ -339,12 +342,13 @@ protected: bool userOutputUsed() const; static int getBaseAlignmentScalar(const TType&, int& size); - const EShLanguage language; + const EShLanguage language; // stage, known at construction time + EShSource source; // source language, known a bit later TString entryPoint; - TIntermNode* treeRoot; EProfile profile; int version; int spv; + TIntermNode* treeRoot; std::set requestedExtensions; // cumulation of all enabled or required extensions; not connected to what subset of the shader used them TBuiltInResource resources; int numMains; diff --git a/glslang/Public/ShaderLang.h b/glslang/Public/ShaderLang.h index 7a708f2b..e676211a 100644 --- a/glslang/Public/ShaderLang.h +++ b/glslang/Public/ShaderLang.h @@ -86,7 +86,7 @@ typedef enum { EShLangFragment, EShLangCompute, EShLangCount, -} EShLanguage; +} EShLanguage; // would be better as stage, but this is ancient now typedef enum { EShLangVertexMask = (1 << EShLangVertex), @@ -99,6 +99,12 @@ typedef enum { namespace glslang { +typedef enum { + EShSourceNone, + EShSourceGlsl, + EShSourceHlsl, +} EShSource; // if EShLanguage were EShStage, this could be EShLanguage instead + const char* StageName(EShLanguage); } // end namespace glslang @@ -132,6 +138,7 @@ enum EShMessages { EShMsgSpvRules = (1 << 3), // issue messages for SPIR-V generation EShMsgVulkanRules = (1 << 4), // issue messages for Vulkan-requirements of GLSL for SPIR-V EShMsgOnlyPreprocessor = (1 << 5), // only print out errors produced by the preprocessor + EShMsgReadHlsl = (1 << 6), // use HLSL parsing rules and semantics }; // From b3dc3acd5933fd83568923a1b3b2a8f64563afde Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Sat, 12 Mar 2016 19:08:55 -0700 Subject: [PATCH 003/140] Refactor TParseContext into 3 level inheritance. Adds parseVersions.h as the base TParseVersions for versioning, and splits the remainder between TParseContextBase (sharable across parsers) and TParseContext (now the GLSL-specific part). --- glslang/CMakeLists.txt | 1 + glslang/MachineIndependent/ParseHelper.cpp | 45 +---- glslang/MachineIndependent/ParseHelper.h | 178 +++++++++--------- glslang/MachineIndependent/ScanContext.h | 4 +- glslang/MachineIndependent/ShaderLang.cpp | 10 +- glslang/MachineIndependent/Versions.cpp | 53 +++--- glslang/MachineIndependent/parseVersions.h | 134 +++++++++++++ .../preprocessor/PpContext.cpp | 2 +- .../preprocessor/PpContext.h | 4 +- 9 files changed, 272 insertions(+), 159 deletions(-) create mode 100755 glslang/MachineIndependent/parseVersions.h diff --git a/glslang/CMakeLists.txt b/glslang/CMakeLists.txt index 28f4742c..b6c70c46 100644 --- a/glslang/CMakeLists.txt +++ b/glslang/CMakeLists.txt @@ -63,6 +63,7 @@ set(HEADERS MachineIndependent/ScanContext.h MachineIndependent/SymbolTable.h MachineIndependent/Versions.h + MachineIndependent/parseVersions.h MachineIndependent/preprocessor/PpContext.h MachineIndependent/preprocessor/PpTokens.h) diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index a43df95b..f005da4e 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -48,14 +48,14 @@ extern int yyparse(glslang::TParseContext*); namespace glslang { -TParseContext::TParseContext(TSymbolTable& symt, TIntermediate& interm, bool pb, int v, EProfile p, int spv, int vulkan, EShLanguage L, TInfoSink& is, - bool fc, EShMessages m) : - intermediate(interm), symbolTable(symt), infoSink(is), language(L), - version(v), profile(p), spv(spv), vulkan(vulkan), forwardCompatible(fc), +TParseContext::TParseContext(TSymbolTable& symbolTable, TIntermediate& interm, bool parsingBuiltins, + int version, EProfile profile, int spv, int vulkan, EShLanguage language, + TInfoSink& infoSink, bool forwardCompatible, EShMessages messages) : + TParseContextBase(symbolTable, interm, version, profile, spv, vulkan, language, infoSink, forwardCompatible, messages), contextPragma(true, false), loopNestingLevel(0), structNestingLevel(0), controlFlowNestingLevel(0), statementNestingLevel(0), - postMainReturn(false), - tokensBeforeEOF(false), limits(resources.limits), messages(m), currentScanner(nullptr), - numErrors(0), parsingBuiltins(pb), afterEOF(false), + inMain(false), postMainReturn(false), currentFunctionType(nullptr), blockName(nullptr), + limits(resources.limits), parsingBuiltins(parsingBuiltins), + afterEOF(false), atomicUintOffsets(nullptr), anyIndexLimits(false) { // ensure we always have a linkage node, even if empty, to simplify tree topology algorithms @@ -3133,7 +3133,8 @@ void TParseContext::updateImplicitArraySize(const TSourceLoc& loc, TIntermNode * // Desktop, version 3.30 and later, and ES: "After processing this directive // (including its new-line), the implementation will behave as if it is compiling at line number line and // source string number source-string-number. -bool TParseContext::lineDirectiveShouldSetNextLine() const { +bool TParseContext::lineDirectiveShouldSetNextLine() const +{ return profile == EEsProfile || version >= 330; } @@ -5941,32 +5942,4 @@ TIntermNode* TParseContext::addSwitch(const TSourceLoc& loc, TIntermTyped* expre return switchNode; } -void TParseContext::notifyVersion(int line, int version, const char* type_string) -{ - if (versionCallback) { - versionCallback(line, version, type_string); - } -} - -void TParseContext::notifyErrorDirective(int line, const char* error_message) -{ - if (errorCallback) { - errorCallback(line, error_message); - } -} - -void TParseContext::notifyLineDirective(int curLineNo, int newLineNo, bool hasSource, int sourceNum, const char* sourceName) -{ - if (lineCallback) { - lineCallback(curLineNo, newLineNo, hasSource, sourceNum, sourceName); - } -} - -void TParseContext::notifyExtensionDirective(int line, const char* extension, const char* behavior) -{ - if (extensionCallback) { - extensionCallback(line, extension, behavior); - } -} - } // end namespace glslang diff --git a/glslang/MachineIndependent/ParseHelper.h b/glslang/MachineIndependent/ParseHelper.h index ac1932d5..ea5d0baf 100644 --- a/glslang/MachineIndependent/ParseHelper.h +++ b/glslang/MachineIndependent/ParseHelper.h @@ -33,10 +33,18 @@ //ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE //POSSIBILITY OF SUCH DAMAGE. // + +// +// This header defines a two-level parse-helper hierarchy, derived from +// TParseVersions: +// - TParseContextBase: sharable across multiple parsers +// - TParseContext: GLSL specific helper +// + #ifndef _PARSER_HELPER_INCLUDED_ #define _PARSER_HELPER_INCLUDED_ -#include "Versions.h" +#include "parseVersions.h" #include "../Include/ShHandle.h" #include "SymbolTable.h" #include "localintermediate.h" @@ -60,10 +68,88 @@ class TPpContext; typedef std::set TIdSetType; // -// The following are extra variables needed during parsing, grouped together so -// they can be passed to the parser without needing a global. +// Sharable code (as well as what's in TParseVersions) across +// parse helpers. // -class TParseContext { +class TParseContextBase : public TParseVersions { +public: + TParseContextBase(TSymbolTable& symbolTable, TIntermediate& interm, int version, + EProfile profile, int spv, int vulkan, EShLanguage language, + TInfoSink& infoSink, bool forwardCompatible, EShMessages messages) + : TParseVersions(interm, version, profile, spv, vulkan, language, infoSink, forwardCompatible, messages), + symbolTable(symbolTable), tokensBeforeEOF(false), + linkage(nullptr), scanContext(nullptr), ppContext(nullptr) { } + virtual ~TParseContextBase() { } + + virtual void setLimits(const TBuiltInResource&) = 0; + + EShLanguage getLanguage() const { return language; } + TIntermAggregate*& getLinkage() { return linkage; } + void setScanContext(TScanContext* c) { scanContext = c; } + TScanContext* getScanContext() const { return scanContext; } + void setPpContext(TPpContext* c) { ppContext = c; } + TPpContext* getPpContext() const { return ppContext; } + + virtual void setLineCallback(const std::function& func) { lineCallback = func; } + virtual void setExtensionCallback(const std::function& func) { extensionCallback = func; } + virtual void setVersionCallback(const std::function& func) { versionCallback = func; } + virtual void setPragmaCallback(const std::function&)>& func) { pragmaCallback = func; } + virtual void setErrorCallback(const std::function& func) { errorCallback = func; } + + virtual void reservedPpErrorCheck(const TSourceLoc&, const char* name, const char* op) = 0; + virtual bool lineContinuationCheck(const TSourceLoc&, bool endOfComment) = 0; + virtual bool lineDirectiveShouldSetNextLine() const = 0; + virtual void handlePragma(const TSourceLoc&, const TVector&) = 0; + + virtual bool parseShaderStrings(TPpContext&, TInputScanner& input, bool versionWillBeError = false) = 0; + + virtual void notifyVersion(int line, int version, const char* type_string) + { + if (versionCallback) + versionCallback(line, version, type_string); + } + virtual void notifyErrorDirective(int line, const char* error_message) + { + if (errorCallback) + errorCallback(line, error_message); + } + virtual void notifyLineDirective(int curLineNo, int newLineNo, bool hasSource, int sourceNum, const char* sourceName) + { + if (lineCallback) + lineCallback(curLineNo, newLineNo, hasSource, sourceNum, sourceName); + } + virtual void notifyExtensionDirective(int line, const char* extension, const char* behavior) + { + if (extensionCallback) + extensionCallback(line, extension, behavior); + } + + TSymbolTable& symbolTable; // symbol table that goes with the current language, version, and profile + bool tokensBeforeEOF; + +protected: + TParseContextBase(TParseContextBase&); + TParseContextBase& operator=(TParseContextBase&); + + TIntermAggregate* linkage; // aggregate node of objects the linker may need, if not referenced by the rest of the AST + TScanContext* scanContext; + TPpContext* ppContext; + + // These, if set, will be called when a line, pragma ... is preprocessed. + // They will be called with any parameters to the original directive. + std::function lineCallback; + std::function&)> pragmaCallback; + std::function versionCallback; + std::function extensionCallback; + std::function errorCallback; +}; + +// +// GLSL-specific parse helper. Should have GLSL in the name, but that's +// too big of a change for comparing branches at the moment, and perhaps +// impacts downstream consumers as well. +// +class TParseContext : public TParseContextBase { public: TParseContext(TSymbolTable&, TIntermediate&, bool parsingBuiltins, int version, EProfile, int spv, int vulkan, EShLanguage, TInfoSink&, bool forwardCompatible = false, EShMessages messages = EShMsgDefault); @@ -72,7 +158,6 @@ public: void setLimits(const TBuiltInResource&); bool parseShaderStrings(TPpContext&, TInputScanner& input, bool versionWillBeError = false); void parserError(const char* s); // for bison's yyerror - const char* getPreamble(); void C_DECL error(const TSourceLoc&, const char* szReason, const char* szToken, const char* szExtraInfoFormat, ...); @@ -83,12 +168,10 @@ public: void C_DECL ppWarn(const TSourceLoc&, const char* szReason, const char* szToken, const char* szExtraInfoFormat, ...); - bool relaxedErrors() const { return (messages & EShMsgRelaxedErrors) != 0; } - bool suppressWarnings() const { return (messages & EShMsgSuppressWarnings) != 0; } - void reservedErrorCheck(const TSourceLoc&, const TString&); void reservedPpErrorCheck(const TSourceLoc&, const char* name, const char* op); bool lineContinuationCheck(const TSourceLoc&, bool endOfComment); + bool lineDirectiveShouldSetNextLine() const; bool builtInName(const TString&); void handlePragma(const TSourceLoc&, const TVector&); @@ -210,55 +293,6 @@ public: void updateImplicitArraySize(const TSourceLoc&, TIntermNode*, int index); - void setScanContext(TScanContext* c) { scanContext = c; } - TScanContext* getScanContext() const { return scanContext; } - void setPpContext(TPpContext* c) { ppContext = c; } - TPpContext* getPpContext() const { return ppContext; } - void addError() { ++numErrors; } - int getNumErrors() const { return numErrors; } - const TSourceLoc& getCurrentLoc() const { return currentScanner->getSourceLoc(); } - void setCurrentLine(int line) { currentScanner->setLine(line); } - void setCurrentColumn(int col) { currentScanner->setColumn(col); } - void setCurrentSourceName(const char* name) { currentScanner->setFile(name); } - void setCurrentString(int string) { currentScanner->setString(string); } - void setScanner(TInputScanner* scanner) { currentScanner = scanner; } - TInputScanner* getScanner() const { return currentScanner; } - - bool lineDirectiveShouldSetNextLine() const; - - void notifyVersion(int line, int version, const char* type_string); - void notifyErrorDirective(int line, const char* error_message); - void notifyLineDirective(int curLineNo, int newLineNo, bool hasSource, int sourceNum, const char* sourceName); - void notifyExtensionDirective(int line, const char* extension, const char* behavior); - - // The following are implemented in Versions.cpp to localize version/profile/stage/extensions control - void initializeExtensionBehavior(); - void requireProfile(const TSourceLoc&, int queryProfiles, const char* featureDesc); - void profileRequires(const TSourceLoc&, int queryProfiles, int minVersion, int numExtensions, const char* const extensions[], const char* featureDesc); - void profileRequires(const TSourceLoc&, int queryProfiles, int minVersion, const char* const extension, const char* featureDesc); - void requireStage(const TSourceLoc&, EShLanguageMask, const char* featureDesc); - void requireStage(const TSourceLoc&, EShLanguage, const char* featureDesc); - 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*); - bool extensionTurnedOn(const char* const extension); - bool extensionsTurnedOn(int numExtensions, const char* const extensions[]); - void updateExtensionBehavior(int line, const char* const extension, const char* behavior); - void fullIntegerCheck(const TSourceLoc&, const char* op); - void doubleCheck(const TSourceLoc&, const char* op); - void spvRemoved(const TSourceLoc&, const char* op); - void vulkanRemoved(const TSourceLoc&, const char* op); - void requireVulkan(const TSourceLoc&, const char* op); - void requireSpv(const TSourceLoc&, const char* op); - - void setVersionCallback(const std::function& func) { versionCallback = func; } - void setPragmaCallback(const std::function&)>& func) { pragmaCallback = func; } - void setLineCallback(const std::function& func) { lineCallback = func; } - void setExtensionCallback(const std::function& func) { extensionCallback = func; } - void setErrorCallback(const std::function& func) { errorCallback = func; } - protected: void nonInitConstCheck(const TSourceLoc&, TString& identifier, TType& type); void inheritGlobalDefaults(TQualifier& dst) const; @@ -268,8 +302,6 @@ protected: TIntermNode* executeInitializer(const TSourceLoc&, TIntermTyped* initializer, TVariable* variable); TIntermTyped* convertInitializerList(const TSourceLoc&, const TType&, TIntermTyped* initializer); TOperator mapTypeToConstructorOp(const TType&) const; - bool checkExtensionsRequested(const TSourceLoc&, int numExtensions, const char* const extensions[], const char* featureDesc); - void updateExtensionBehavior(const char* const extension, TExtensionBehavior); void finalErrorCheck(); void outputMessage(const TSourceLoc&, const char* szReason, const char* szToken, const char* szExtraInfoFormat, TPrefixType prefix, @@ -280,18 +312,6 @@ public: // Generally, bison productions, the scanner, and the PP need read/write access to these; just give them direct access // - TIntermediate& intermediate; // helper for making and hooking up pieces of the parse tree - TSymbolTable& symbolTable; // symbol table that goes with the current language, version, and profile - TInfoSink& infoSink; - - // compilation mode - EShLanguage language; // vertex or fragment language - int version; // version, updated by #version in the shader - EProfile profile; // the declared profile in the shader (core by default) - int spv; // SPIR-V version; 0 means not SPIR-V - int vulkan; // Vulkan version; 0 means not vulkan - bool forwardCompatible; // true if errors are to be given for use of deprecated features - // Current state of parsing struct TPragma contextPragma; int loopNestingLevel; // 0 if outside all loops @@ -306,9 +326,7 @@ public: bool functionReturnsValue; // true if a non-void function has a return const TString* blockName; TQualifier currentBlockQualifier; - TIntermAggregate *linkage; // aggregate node of objects the linker may need, if not referenced by the rest of the AST TPrecisionQualifier defaultPrecision[EbtNumTypes]; - bool tokensBeforeEOF; TBuiltInResource resources; TLimits& limits; @@ -316,13 +334,7 @@ protected: TParseContext(TParseContext&); TParseContext& operator=(TParseContext&); - EShMessages messages; // errors/warnings/rule-sets - TScanContext* scanContext; - TPpContext* ppContext; - TInputScanner* currentScanner; - int numErrors; // number of compile-time errors encountered bool parsingBuiltins; // true if parsing built-in symbols/functions - TMap extensionBehavior; // for each extension string, what its current behavior is set to static const int maxSamplerIndex = EsdNumDims * (EbtNumTypes * (2 * 2 * 2)); // see computeSamplerTypeIndex() TPrecisionQualifier defaultSamplerPrecision[maxSamplerIndex]; bool afterEOF; @@ -369,14 +381,6 @@ protected: // array-sizing declarations // TVector ioArraySymbolResizeList; - - // These, if set, will be called when a line, pragma ... is preprocessed. - // They will be called with any parameters to the original directive. - std::function lineCallback; - std::function&)> pragmaCallback; - std::function versionCallback; - std::function extensionCallback; - std::function errorCallback; }; } // end namespace glslang diff --git a/glslang/MachineIndependent/ScanContext.h b/glslang/MachineIndependent/ScanContext.h index 5f1ffb57..f237bee9 100644 --- a/glslang/MachineIndependent/ScanContext.h +++ b/glslang/MachineIndependent/ScanContext.h @@ -48,7 +48,7 @@ class TParserToken; class TScanContext { public: - explicit TScanContext(TParseContext& pc) : parseContext(pc), afterType(false), field(false) { } + explicit TScanContext(TParseContextBase& pc) : parseContext(pc), afterType(false), field(false) { } virtual ~TScanContext() { } static void fillInKeywordMap(); @@ -72,7 +72,7 @@ protected: int firstGenerationImage(bool inEs310); int secondGenerationImage(); - TParseContext& parseContext; + TParseContextBase& parseContext; bool afterType; // true if we've recognized a type, so can only be looking for an identifier bool field; // true if we're on a field, right after a '.' TSourceLoc loc; diff --git a/glslang/MachineIndependent/ShaderLang.cpp b/glslang/MachineIndependent/ShaderLang.cpp index 230929aa..27bfc699 100644 --- a/glslang/MachineIndependent/ShaderLang.cpp +++ b/glslang/MachineIndependent/ShaderLang.cpp @@ -464,7 +464,7 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo // This is the common setup and cleanup code for PreprocessDeferred and // CompileDeferred. // It takes any callable with a signature of -// bool (TParseContext& parseContext, TPpContext& ppContext, +// bool (TParseContextBase& parseContext, TPpContext& ppContext, // TInputScanner& input, bool versionWillBeError, // TSymbolTable& , TIntermediate& , // EShOptimizationLevel , EShMessages ); @@ -717,7 +717,7 @@ private: // It places the result in the "string" argument to its constructor. struct DoPreprocessing { explicit DoPreprocessing(std::string* string): outputString(string) {} - bool operator()(TParseContext& parseContext, TPpContext& ppContext, + bool operator()(TParseContextBase& parseContext, TPpContext& ppContext, TInputScanner& input, bool versionWillBeError, TSymbolTable& , TIntermediate& , EShOptimizationLevel , EShMessages ) @@ -828,7 +828,7 @@ struct DoPreprocessing { // DoFullParse is a valid ProcessingConext template argument for fully // parsing the shader. It populates the "intermediate" with the AST. struct DoFullParse{ - bool operator()(TParseContext& parseContext, TPpContext& ppContext, + bool operator()(TParseContextBase& parseContext, TPpContext& ppContext, TInputScanner& fullInput, bool versionWillBeError, TSymbolTable& symbolTable, TIntermediate& intermediate, EShOptimizationLevel optLevel, EShMessages messages) @@ -837,13 +837,13 @@ struct DoFullParse{ // Parse the full shader. if (! parseContext.parseShaderStrings(ppContext, fullInput, versionWillBeError)) success = false; - intermediate.addSymbolLinkageNodes(parseContext.linkage, parseContext.language, symbolTable); + intermediate.addSymbolLinkageNodes(parseContext.getLinkage(), parseContext.getLanguage(), symbolTable); if (success && intermediate.getTreeRoot()) { if (optLevel == EShOptNoGeneration) parseContext.infoSink.info.message(EPrefixNone, "No errors. No code generation or linking was requested."); else - success = intermediate.postProcess(intermediate.getTreeRoot(), parseContext.language); + success = intermediate.postProcess(intermediate.getTreeRoot(), parseContext.getLanguage()); } else if (! success) { parseContext.infoSink.info.prefix(EPrefixError); parseContext.infoSink.info << parseContext.getNumErrors() << " compilation errors. No code generated.\n\n"; diff --git a/glslang/MachineIndependent/Versions.cpp b/glslang/MachineIndependent/Versions.cpp index 676f4fd6..af2f7f26 100644 --- a/glslang/MachineIndependent/Versions.cpp +++ b/glslang/MachineIndependent/Versions.cpp @@ -74,12 +74,12 @@ // // const char* const XXX_extension_X = "XXX_extension_X"; // -// 2) Add extension initialization to TParseContext::initializeExtensionBehavior(), +// 2) Add extension initialization to TParseVersions::initializeExtensionBehavior(), // the first function below: // // extensionBehavior[XXX_extension_X] = EBhDisable; // -// 3) Add any preprocessor directives etc. in the next function, TParseContext::getPreamble(): +// 3) Add any preprocessor directives etc. in the next function, TParseVersions::getPreamble(): // // "#define XXX_extension_X 1\n" // @@ -138,7 +138,8 @@ // table. (There is a different symbol table for each version.) // -#include "ParseHelper.h" +#include "parseVersions.h" +#include "localintermediate.h" namespace glslang { @@ -147,7 +148,7 @@ namespace glslang { // are incorporated into a core version, their features are supported through allowing that // core version, not through a pseudo-enablement of the extension. // -void TParseContext::initializeExtensionBehavior() +void TParseVersions::initializeExtensionBehavior() { extensionBehavior[E_GL_OES_texture_3D] = EBhDisable; extensionBehavior[E_GL_OES_standard_derivatives] = EBhDisable; @@ -213,7 +214,7 @@ void TParseContext::initializeExtensionBehavior() // 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). -const char* TParseContext::getPreamble() +const char* TParseVersions::getPreamble() { if (profile == EEsProfile) { return @@ -297,7 +298,7 @@ const char* TParseContext::getPreamble() // Operation: If the current profile is not one of the profileMask, // give an error message. // -void TParseContext::requireProfile(const TSourceLoc& loc, int profileMask, const char* featureDesc) +void TParseVersions::requireProfile(const TSourceLoc& loc, int profileMask, const char* featureDesc) { if (! (profile & profileMask)) error(loc, "not supported with this profile:", featureDesc, ProfileName(profile)); @@ -336,7 +337,7 @@ const char* StageName(EShLanguage stage) // // entry point that takes multiple extensions -void TParseContext::profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, int numExtensions, const char* const extensions[], const char* featureDesc) +void TParseVersions::profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, int numExtensions, const char* const extensions[], const char* featureDesc) { if (profile & profileMask) { bool okay = false; @@ -361,7 +362,7 @@ void TParseContext::profileRequires(const TSourceLoc& loc, int profileMask, int } // entry point for the above that takes a single extension -void TParseContext::profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, const char* extension, const char* featureDesc) +void TParseVersions::profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, const char* extension, const char* featureDesc) { profileRequires(loc, profileMask, minVersion, extension ? 1 : 0, &extension, featureDesc); } @@ -373,7 +374,7 @@ void TParseContext::profileRequires(const TSourceLoc& loc, int profileMask, int // // Operation: If the current stage is not present, give an error message. // -void TParseContext::requireStage(const TSourceLoc& loc, EShLanguageMask languageMask, const char* featureDesc) +void TParseVersions::requireStage(const TSourceLoc& loc, EShLanguageMask languageMask, const char* featureDesc) { if (((1 << language) & languageMask) == 0) error(loc, "not supported in this stage:", featureDesc, StageName(language)); @@ -381,7 +382,7 @@ void TParseContext::requireStage(const TSourceLoc& loc, EShLanguageMask language // If only one stage supports a feature, this can be called. But, all supporting stages // must be specified with one call. -void TParseContext::requireStage(const TSourceLoc& loc, EShLanguage stage, const char* featureDesc) +void TParseVersions::requireStage(const TSourceLoc& loc, EShLanguage stage, const char* featureDesc) { requireStage(loc, static_cast(1 << stage), featureDesc); } @@ -390,7 +391,7 @@ void TParseContext::requireStage(const TSourceLoc& loc, EShLanguage stage, const // 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. // -void TParseContext::checkDeprecated(const TSourceLoc& loc, int profileMask, int depVersion, const char* featureDesc) +void TParseVersions::checkDeprecated(const TSourceLoc& loc, int profileMask, int depVersion, const char* featureDesc) { if (profile & profileMask) { if (version >= depVersion) { @@ -407,7 +408,7 @@ void TParseContext::checkDeprecated(const TSourceLoc& loc, int profileMask, int // Within a set of profiles, see if a feature has now been removed and if so, give an error. // The version argument is the first version no longer having the feature. // -void TParseContext::requireNotRemoved(const TSourceLoc& loc, int profileMask, int removedVersion, const char* featureDesc) +void TParseVersions::requireNotRemoved(const TSourceLoc& loc, int profileMask, int removedVersion, const char* featureDesc) { if (profile & profileMask) { if (version >= removedVersion) { @@ -421,7 +422,7 @@ void TParseContext::requireNotRemoved(const TSourceLoc& loc, int profileMask, in // 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 TParseContext::checkExtensionsRequested(const TSourceLoc& loc, int numExtensions, const char* const extensions[], const char* featureDesc) +bool TParseVersions::checkExtensionsRequested(const TSourceLoc& loc, int numExtensions, const char* const extensions[], const char* featureDesc) { // First, see if any of the extensions are enabled for (int i = 0; i < numExtensions; ++i) { @@ -452,7 +453,7 @@ bool TParseContext::checkExtensionsRequested(const TSourceLoc& loc, int numExten // Use when there are no profile/version to check, it's just an error if one of the // extensions is not present. // -void TParseContext::requireExtensions(const TSourceLoc& loc, int numExtensions, const char* const extensions[], const char* featureDesc) +void TParseVersions::requireExtensions(const TSourceLoc& loc, int numExtensions, const char* const extensions[], const char* featureDesc) { if (checkExtensionsRequested(loc, numExtensions, extensions, featureDesc)) return; @@ -470,7 +471,7 @@ void TParseContext::requireExtensions(const TSourceLoc& loc, int numExtensions, // Use by preprocessor when there are no profile/version to check, it's just an error if one of the // extensions is not present. // -void TParseContext::ppRequireExtensions(const TSourceLoc& loc, int numExtensions, const char* const extensions[], const char* featureDesc) +void TParseVersions::ppRequireExtensions(const TSourceLoc& loc, int numExtensions, const char* const extensions[], const char* featureDesc) { if (checkExtensionsRequested(loc, numExtensions, extensions, featureDesc)) return; @@ -484,7 +485,7 @@ void TParseContext::ppRequireExtensions(const TSourceLoc& loc, int numExtensions } } -TExtensionBehavior TParseContext::getExtensionBehavior(const char* extension) +TExtensionBehavior TParseVersions::getExtensionBehavior(const char* extension) { auto iter = extensionBehavior.find(TString(extension)); if (iter == extensionBehavior.end()) @@ -494,7 +495,7 @@ TExtensionBehavior TParseContext::getExtensionBehavior(const char* extension) } // Returns true if the given extension is set to enable, require, or warn. -bool TParseContext::extensionTurnedOn(const char* const extension) +bool TParseVersions::extensionTurnedOn(const char* const extension) { switch (getExtensionBehavior(extension)) { case EBhEnable: @@ -507,7 +508,7 @@ bool TParseContext::extensionTurnedOn(const char* const extension) return false; } // See if any of the extensions are set to enable, require, or warn. -bool TParseContext::extensionsTurnedOn(int numExtensions, const char* const extensions[]) +bool TParseVersions::extensionsTurnedOn(int numExtensions, const char* const extensions[]) { for (int i = 0; i < numExtensions; ++i) { if (extensionTurnedOn(extensions[i])) return true; @@ -518,7 +519,7 @@ bool TParseContext::extensionsTurnedOn(int numExtensions, const char* const exte // // Change the current state of an extension's behavior. // -void TParseContext::updateExtensionBehavior(int line, const char* extension, const char* behaviorString) +void TParseVersions::updateExtensionBehavior(int line, const char* extension, const char* behaviorString) { // Translate from text string of extension's behavior to an enum. TExtensionBehavior behavior = EBhDisable; @@ -571,7 +572,7 @@ void TParseContext::updateExtensionBehavior(int line, const char* extension, con spv = 100; } -void TParseContext::updateExtensionBehavior(const char* extension, TExtensionBehavior behavior) +void TParseVersions::updateExtensionBehavior(const char* extension, TExtensionBehavior behavior) { // Update the current behavior if (strcmp(extension, "all") == 0) { @@ -612,14 +613,14 @@ void TParseContext::updateExtensionBehavior(const char* extension, TExtensionBeh } // Call for any operation needing full GLSL integer data-type support. -void TParseContext::fullIntegerCheck(const TSourceLoc& loc, const char* op) +void TParseVersions::fullIntegerCheck(const TSourceLoc& loc, const char* op) { profileRequires(loc, ENoProfile, 130, nullptr, op); profileRequires(loc, EEsProfile, 300, nullptr, op); } // Call for any operation needing GLSL double data-type support. -void TParseContext::doubleCheck(const TSourceLoc& loc, const char* op) +void TParseVersions::doubleCheck(const TSourceLoc& loc, const char* op) { requireProfile(loc, ECoreProfile | ECompatibilityProfile, op); profileRequires(loc, ECoreProfile, 400, nullptr, op); @@ -627,28 +628,28 @@ void TParseContext::doubleCheck(const TSourceLoc& loc, const char* op) } // Call for any operation removed because SPIR-V is in use. -void TParseContext::spvRemoved(const TSourceLoc& loc, const char* op) +void TParseVersions::spvRemoved(const TSourceLoc& loc, const char* op) { if (spv > 0) error(loc, "not allowed when generating SPIR-V", op, ""); } // Call for any operation removed because Vulkan SPIR-V is being generated. -void TParseContext::vulkanRemoved(const TSourceLoc& loc, const char* op) +void TParseVersions::vulkanRemoved(const TSourceLoc& loc, const char* op) { if (vulkan > 0) error(loc, "not allowed when using GLSL for Vulkan", op, ""); } // Call for any operation that requires Vulkan. -void TParseContext::requireVulkan(const TSourceLoc& loc, const char* op) +void TParseVersions::requireVulkan(const TSourceLoc& loc, const char* op) { if (vulkan == 0) error(loc, "only allowed when using GLSL for Vulkan", op, ""); } // Call for any operation that requires SPIR-V. -void TParseContext::requireSpv(const TSourceLoc& loc, const char* op) +void TParseVersions::requireSpv(const TSourceLoc& loc, const char* op) { if (spv == 0) error(loc, "only allowed when generating SPIR-V", op, ""); diff --git a/glslang/MachineIndependent/parseVersions.h b/glslang/MachineIndependent/parseVersions.h new file mode 100755 index 00000000..c9dfdc91 --- /dev/null +++ b/glslang/MachineIndependent/parseVersions.h @@ -0,0 +1,134 @@ +// +//Copyright (C) 2016 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. +// + +// This is implemented in Versions.cpp + +#ifndef _PARSE_VERSIONS_INCLUDED_ +#define _PARSE_VERSIONS_INCLUDED_ + +#include "../Public/ShaderLang.h" +#include "../Include/InfoSink.h" +#include "Scan.h" + +#include + +namespace glslang { + +// +// Base class for parse helpers. +// This just has version-related information and checking. +// This class should be sufficient for preprocessing. +// +class TParseVersions { +public: + TParseVersions(TIntermediate& interm, int version, EProfile profile, + int spv, int vulkan, EShLanguage language, TInfoSink& infoSink, + bool forwardCompatible, EShMessages messages) + : infoSink(infoSink), version(version), profile(profile), language(language), + spv(spv), vulkan(vulkan), forwardCompatible(forwardCompatible), + intermediate(interm), messages(messages), numErrors(0), currentScanner(0) { } + virtual ~TParseVersions() { } + 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 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 fullIntegerCheck(const TSourceLoc&, const char* op); + virtual void doubleCheck(const TSourceLoc&, const char* op); + 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 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, + const char* szExtraInfoFormat, ...) = 0; + virtual void C_DECL ppError(const TSourceLoc&, const char* szReason, const char* szToken, + const char* szExtraInfoFormat, ...) = 0; + virtual void C_DECL ppWarn(const TSourceLoc&, const char* szReason, const char* szToken, + const char* szExtraInfoFormat, ...) = 0; + + void addError() { ++numErrors; } + int getNumErrors() const { return numErrors; } + + void setScanner(TInputScanner* scanner) { currentScanner = scanner; } + TInputScanner* getScanner() const { return currentScanner; } + const TSourceLoc& getCurrentLoc() const { return currentScanner->getSourceLoc(); } + void setCurrentLine(int line) { currentScanner->setLine(line); } + void setCurrentColumn(int col) { currentScanner->setColumn(col); } + void setCurrentSourceName(const char* name) { currentScanner->setFile(name); } + void setCurrentString(int string) { currentScanner->setString(string); } + + const char* getPreamble(); + bool relaxedErrors() const { return (messages & EShMsgRelaxedErrors) != 0; } + bool suppressWarnings() const { return (messages & EShMsgSuppressWarnings) != 0; } + + 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 + int spv; // SPIR-V version; 0 means not SPIR-V + int vulkan; // Vulkan version; 0 means not vulkan + 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: + EShMessages messages; // errors/warnings/rule-sets + int numErrors; // number of compile-time errors encountered + TInputScanner* currentScanner; + +private: + TMap extensionBehavior; // for each extension string, what its current behavior is set to + explicit TParseVersions(const TParseVersions&); + TParseVersions& operator=(const TParseVersions&); +}; + +} // end namespace glslang + +#endif // _PARSE_VERSIONS_INCLUDED_ diff --git a/glslang/MachineIndependent/preprocessor/PpContext.cpp b/glslang/MachineIndependent/preprocessor/PpContext.cpp index b8d2c737..b18ba4f6 100644 --- a/glslang/MachineIndependent/preprocessor/PpContext.cpp +++ b/glslang/MachineIndependent/preprocessor/PpContext.cpp @@ -83,7 +83,7 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. namespace glslang { -TPpContext::TPpContext(TParseContext& pc, const TShader::Includer& inclr) : +TPpContext::TPpContext(TParseContextBase& pc, const TShader::Includer& inclr) : preamble(0), strings(0), parseContext(pc), includer(inclr), inComment(false) { InitAtomTable(); diff --git a/glslang/MachineIndependent/preprocessor/PpContext.h b/glslang/MachineIndependent/preprocessor/PpContext.h index f1d54691..6716c7e1 100644 --- a/glslang/MachineIndependent/preprocessor/PpContext.h +++ b/glslang/MachineIndependent/preprocessor/PpContext.h @@ -121,7 +121,7 @@ class TInputScanner; // Don't expect too much in terms of OO design. class TPpContext { public: - TPpContext(TParseContext&, const TShader::Includer&); + TPpContext(TParseContextBase&, const TShader::Includer&); virtual ~TPpContext(); void setPreamble(const char* preamble, size_t length); @@ -213,7 +213,7 @@ protected: // Scanner data: int previous_token; - TParseContext& parseContext; + TParseContextBase& parseContext; // Get the next token from *stack* of input sources, popping input sources // that are out of tokens, down until an input sources is found that has a token. From e01a9bc8c03d284a3384de06a9d31471c42f70e9 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Sat, 12 Mar 2016 20:11:22 -0700 Subject: [PATCH 004/140] HLSL: Plumb in HLSL parse context and keywords, and most basic HLSL parser and test. --- CMakeLists.txt | 1 + StandAlone/CMakeLists.txt | 1 + Test/baseResults/hlsl.frag.out | 21 + Test/hlsl.frag | 11 + Test/runtests | 18 + Test/test-hlsl-spirv-list | 4 + glslang/MachineIndependent/ShaderLang.cpp | 40 +- glslang/MachineIndependent/linkValidate.cpp | 16 +- hlsl/CMakeLists.txt | 21 + hlsl/hlslGrammar.cpp | 93 + hlsl/hlslGrammar.h | 68 + hlsl/hlslParseHelper.cpp | 3578 +++++++++++++++++++ hlsl/hlslParseHelper.h | 222 ++ hlsl/hlslScanContext.cpp | 619 ++++ hlsl/hlslScanContext.h | 102 + hlsl/hlslTokens.h | 248 ++ 16 files changed, 5047 insertions(+), 16 deletions(-) create mode 100644 Test/baseResults/hlsl.frag.out create mode 100644 Test/hlsl.frag create mode 100644 Test/test-hlsl-spirv-list create mode 100755 hlsl/CMakeLists.txt create mode 100755 hlsl/hlslGrammar.cpp create mode 100755 hlsl/hlslGrammar.h create mode 100755 hlsl/hlslParseHelper.cpp create mode 100755 hlsl/hlslParseHelper.h create mode 100755 hlsl/hlslScanContext.cpp create mode 100755 hlsl/hlslScanContext.h create mode 100755 hlsl/hlslTokens.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d723d87..c7bda517 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,3 +24,4 @@ add_subdirectory(glslang) add_subdirectory(OGLCompilersDLL) add_subdirectory(StandAlone) add_subdirectory(SPIRV) +add_subdirectory(hlsl) diff --git a/StandAlone/CMakeLists.txt b/StandAlone/CMakeLists.txt index 38cb2bdb..48fa5029 100644 --- a/StandAlone/CMakeLists.txt +++ b/StandAlone/CMakeLists.txt @@ -10,6 +10,7 @@ set(LIBRARIES glslang OGLCompiler OSDependent + HLSL SPIRV) if(WIN32) diff --git a/Test/baseResults/hlsl.frag.out b/Test/baseResults/hlsl.frag.out new file mode 100644 index 00000000..bc2e035d --- /dev/null +++ b/Test/baseResults/hlsl.frag.out @@ -0,0 +1,21 @@ +hlsl.frag + +Linked fragment stage: + + +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 6 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "PixelShaderFunction" + ExecutionMode 4 OriginUpperLeft + Source HLSL 100 + Name 4 "PixelShaderFunction" + 2: TypeVoid + 3: TypeFunction 2 +4(PixelShaderFunction): 2 Function None 3 + 5: Label + FunctionEnd diff --git a/Test/hlsl.frag b/Test/hlsl.frag new file mode 100644 index 00000000..66314041 --- /dev/null +++ b/Test/hlsl.frag @@ -0,0 +1,11 @@ +//float4x4 World; +//float4x4 View; +//float4x4 Projection; +// +//float4 AmbientColor = float4(1, 1, 1, 1); +//float AmbientIntensity = 0.1; +// +//float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 +//{ +// return AmbientColor * AmbientIntensity; +//} diff --git a/Test/runtests b/Test/runtests index c324911c..67a374cf 100755 --- a/Test/runtests +++ b/Test/runtests @@ -55,6 +55,24 @@ while read t; do done < test-spirv-list rm -f comp.spv frag.spv geom.spv tesc.spv tese.spv vert.spv +# +# HLSL -> SPIR-V code generation tests +# +while read t; do + case $t in + \#*) + # Skip comment lines in the test list file. + ;; + *) + echo Running HLSL-to-SPIR-V $t... + b=`basename $t` + $EXE -D -e PixelShaderFunction -H $t > $TARGETDIR/$b.out + diff -b $BASEDIR/$b.out $TARGETDIR/$b.out || HASERROR=1 + ;; + esac +done < test-hlsl-spirv-list +rm -f comp.spv frag.spv geom.spv tesc.spv tese.spv vert.spv + # # Preprocessor tests # diff --git a/Test/test-hlsl-spirv-list b/Test/test-hlsl-spirv-list new file mode 100644 index 00000000..d98a3cb4 --- /dev/null +++ b/Test/test-hlsl-spirv-list @@ -0,0 +1,4 @@ +# Test looping constructs. +# No tests yet for making sure break and continue from a nested loop +# goes to the innermost target. +hlsl.frag diff --git a/glslang/MachineIndependent/ShaderLang.cpp b/glslang/MachineIndependent/ShaderLang.cpp index 27bfc699..80f84a46 100644 --- a/glslang/MachineIndependent/ShaderLang.cpp +++ b/glslang/MachineIndependent/ShaderLang.cpp @@ -46,6 +46,7 @@ #include #include "SymbolTable.h" #include "ParseHelper.h" +#include "../../hlsl/hlslParseHelper.h" #include "Scan.h" #include "ScanContext.h" @@ -598,26 +599,37 @@ bool ProcessDeferred( // Now we can process the full shader under proper symbols and rules. // - intermediate.setEntryPoint("main"); - TParseContext parseContext(symbolTable, intermediate, false, version, profile, spv, vulkan, compiler->getLanguage(), compiler->infoSink, forwardCompatible, messages); - glslang::TScanContext scanContext(parseContext); - TPpContext ppContext(parseContext, includer); - parseContext.setScanContext(&scanContext); - parseContext.setPpContext(&ppContext); - parseContext.setLimits(*resources); + TParseContextBase* parseContext; + if (source == EShSourceHlsl) { + parseContext = new HlslParseContext(symbolTable, intermediate, false, version, profile, spv, vulkan, + compiler->getLanguage(), compiler->infoSink, forwardCompatible, messages); + } + else { + intermediate.setEntryPoint("main"); + parseContext = new TParseContext(symbolTable, intermediate, false, version, profile, spv, vulkan, + compiler->getLanguage(), compiler->infoSink, forwardCompatible, messages); + } + TPpContext ppContext(*parseContext, includer); + + // only GLSL (bison triggered, really) needs an externally set scan context + glslang::TScanContext scanContext(*parseContext); + if ((messages & EShMsgReadHlsl) == 0) + parseContext->setScanContext(&scanContext); + + parseContext->setPpContext(&ppContext); + parseContext->setLimits(*resources); if (! goodVersion) - parseContext.addError(); + parseContext->addError(); if (warnVersionNotFirst) { TSourceLoc loc; loc.init(); - parseContext.warn(loc, "Illegal to have non-comment, non-whitespace tokens before #version", "#version", ""); + parseContext->warn(loc, "Illegal to have non-comment, non-whitespace tokens before #version", "#version", ""); } - parseContext.initializeExtensionBehavior(); - + parseContext->initializeExtensionBehavior(); // Fill in the strings as outlined above. - strings[0] = parseContext.getPreamble(); + strings[0] = parseContext->getPreamble(); lengths[0] = strlen(strings[0]); names[0] = nullptr; strings[1] = customPreamble; @@ -635,14 +647,14 @@ bool ProcessDeferred( // Push a new symbol allocation scope that will get used for the shader's globals. symbolTable.push(); - bool success = processingContext(parseContext, ppContext, fullInput, + bool success = processingContext(*parseContext, ppContext, fullInput, versionWillBeError, symbolTable, intermediate, optLevel, messages); // Clean up the symbol table. The AST is self-sufficient now. delete symbolTableMemory; - + delete parseContext; delete [] lengths; delete [] strings; delete [] names; diff --git a/glslang/MachineIndependent/linkValidate.cpp b/glslang/MachineIndependent/linkValidate.cpp index 6fef4fb7..ef9daa87 100644 --- a/glslang/MachineIndependent/linkValidate.cpp +++ b/glslang/MachineIndependent/linkValidate.cpp @@ -69,6 +69,18 @@ void TIntermediate::error(TInfoSink& infoSink, const char* message) // void TIntermediate::merge(TInfoSink& infoSink, TIntermediate& unit) { + if (source == EShSourceNone) + source = unit.source; + + if (source != unit.source) + error(infoSink, "can't link compilation units from different source languages"); + + if (source == EShSourceHlsl && unit.entryPoint.size() > 0) { + if (entryPoint.size() > 0) + error(infoSink, "can't handle multiple entry points per stage"); + else + entryPoint = unit.entryPoint; + } numMains += unit.numMains; numErrors += unit.numErrors; numPushConstants += unit.numPushConstants; @@ -355,8 +367,8 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy // Also, lock in defaults of things not set, including array sizes. // void TIntermediate::finalCheck(TInfoSink& infoSink) -{ - if (numMains < 1) +{ + if (source == EShSourceGlsl && numMains < 1) error(infoSink, "Missing entry point: Each stage requires one \"void main()\" entry point"); if (numPushConstants > 1) diff --git a/hlsl/CMakeLists.txt b/hlsl/CMakeLists.txt new file mode 100755 index 00000000..acc69f08 --- /dev/null +++ b/hlsl/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 2.8) + +set(SOURCES + hlslParseHelper.cpp + hlslScanContext.cpp + hlslGrammar.cpp) + +set(HEADERS + hlslParseHelper.h + hlslTokens.h + hlslScanContext.h + hlslGrammar.h) + +add_library(HLSL STATIC ${SOURCES} ${HEADERS}) + +if(WIN32) + source_group("Source" FILES ${SOURCES} ${HEADERS}) +endif(WIN32) + +install(TARGETS HLSL + ARCHIVE DESTINATION lib) diff --git a/hlsl/hlslGrammar.cpp b/hlsl/hlslGrammar.cpp new file mode 100755 index 00000000..9673658c --- /dev/null +++ b/hlsl/hlslGrammar.cpp @@ -0,0 +1,93 @@ +// +//Copyright (C) 2016 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 Google, Inc., 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 "hlslTokens.h" +#include "hlslGrammar.h" + +namespace glslang { + +// Root entry point to this recursive decent parser. +// Return true if compilation unit was successfully accepted. +bool HlslGrammar::parse() +{ + advanceToken(); + return acceptCompilationUnit(); +} + +void HlslGrammar::expected(const char* syntax) +{ + parseContext.error(token.loc, "Expected", syntax, ""); +} + +// Load 'token' with the next token in the stream of tokens. +void HlslGrammar::advanceToken() +{ + scanContext.tokenize(token); +} + +// Return true and advance to the next token if the current token is the +// expected (passed in) token class. +bool HlslGrammar::acceptTokenClass(EHlslTokenClass tokenClass) +{ + if (token.tokenClass == tokenClass) { + advanceToken(); + return true; + } + + return false; +} + +// compilationUnit +// : list of externalDeclaration +// +bool HlslGrammar::acceptCompilationUnit() +{ + while (token.tokenClass != EHTokNone) { + if (! acceptDeclaration()) + return false; + } + + return true; +} + +// declaration +// : dummy stub +bool HlslGrammar::acceptDeclaration() +{ + advanceToken(); + return true; +} + +} // end namespace glslang diff --git a/hlsl/hlslGrammar.h b/hlsl/hlslGrammar.h new file mode 100755 index 00000000..c445f039 --- /dev/null +++ b/hlsl/hlslGrammar.h @@ -0,0 +1,68 @@ +// +//Copyright (C) 2016 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 Google, Inc., 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. +// + +#ifndef HLSLGRAMMAR_H_ +#define HLSLGRAMMAR_H_ + +#include "hlslScanContext.h" +#include "hlslParseHelper.h" + +namespace glslang { + + class HlslGrammar { + public: + HlslGrammar(HlslScanContext& scanContext, HlslParseContext& parseContext) + : scanContext(scanContext), parseContext(parseContext) { } + virtual ~HlslGrammar() { } + + bool parse(); + + protected: + void expected(const char*); + void advanceToken(); + bool acceptTokenClass(EHlslTokenClass); + + bool acceptCompilationUnit(); + bool acceptDeclaration(); + + HlslScanContext& scanContext; + HlslParseContext& parseContext; + + HlslToken token; + }; + +} // end namespace glslang + +#endif // HLSLGRAMMAR_H_ diff --git a/hlsl/hlslParseHelper.cpp b/hlsl/hlslParseHelper.cpp new file mode 100755 index 00000000..9a0531c7 --- /dev/null +++ b/hlsl/hlslParseHelper.cpp @@ -0,0 +1,3578 @@ +// +//Copyright (C) 2016 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 "hlslParseHelper.h" +#include "hlslScanContext.h" +#include "hlslGrammar.h" + +#include "../glslang/MachineIndependent/Scan.h" +#include "../glslang/MachineIndependent/preprocessor/PpContext.h" + +#include "../glslang/OSDependent/osinclude.h" + +#include +#include + +namespace glslang { + +HlslParseContext::HlslParseContext(TSymbolTable& symbolTable, TIntermediate& interm, bool /*parsingBuiltins*/, + int version, EProfile profile, int spv, int vulkan, EShLanguage language, TInfoSink& infoSink, + bool forwardCompatible, EShMessages messages) : + TParseContextBase(symbolTable, interm, version, profile, spv, vulkan, language, infoSink, forwardCompatible, messages), + contextPragma(true, false), loopNestingLevel(0), structNestingLevel(0), controlFlowNestingLevel(0), statementNestingLevel(0), + postMainReturn(false), + limits(resources.limits), + afterEOF(false) +{ + // ensure we always have a linkage node, even if empty, to simplify tree topology algorithms + linkage = new TIntermAggregate; + + globalUniformDefaults.clear(); + globalUniformDefaults.layoutMatrix = ElmColumnMajor; + globalUniformDefaults.layoutPacking = vulkan > 0 ? ElpStd140 : ElpShared; + + globalBufferDefaults.clear(); + globalBufferDefaults.layoutMatrix = ElmColumnMajor; + globalBufferDefaults.layoutPacking = vulkan > 0 ? ElpStd430 : ElpShared; + + globalInputDefaults.clear(); + globalOutputDefaults.clear(); + + // "Shaders in the transform + // feedback capturing mode have an initial global default of + // layout(xfb_buffer = 0) out;" + if (language == EShLangVertex || + language == EShLangTessControl || + language == EShLangTessEvaluation || + language == EShLangGeometry) + globalOutputDefaults.layoutXfbBuffer = 0; + + if (language == EShLangGeometry) + globalOutputDefaults.layoutStream = 0; +} + +HlslParseContext::~HlslParseContext() +{ +} + +void HlslParseContext::setLimits(const TBuiltInResource& r) +{ + resources = r; + intermediate.setLimits(resources); +} + +// +// Parse an array of strings using the parser in HlslRules. +// +// Returns true for successful acceptance of the shader, false if any errors. +// +bool HlslParseContext::parseShaderStrings(TPpContext& ppContext, TInputScanner& input, bool versionWillBeError) +{ + currentScanner = &input; + ppContext.setInput(input, versionWillBeError); + + HlslScanContext::fillInKeywordMap(); // TODO: right place, and include the delete too + + HlslScanContext scanContext(*this, ppContext); + HlslGrammar grammar(scanContext, *this); + if (! grammar.parse()) + printf("HLSL translation failed.\n"); + + return numErrors == 0; +} + +void HlslParseContext::handlePragma(const TSourceLoc& loc, const TVector& tokens) +{ + if (pragmaCallback) + pragmaCallback(loc.line, tokens); + + if (tokens.size() == 0) + return; +} + +// +// Look at a '.' field selector string and change it into offsets +// for a vector or scalar +// +// Returns true if there is no error. +// +bool HlslParseContext::parseVectorFields(const TSourceLoc& loc, const TString& compString, int vecSize, TVectorFields& fields) +{ + fields.num = (int)compString.size(); + if (fields.num > 4) { + error(loc, "illegal vector field selection", compString.c_str(), ""); + return false; + } + + enum { + exyzw, + ergba, + estpq, + } fieldSet[4]; + + for (int i = 0; i < fields.num; ++i) { + switch (compString[i]) { + case 'x': + fields.offsets[i] = 0; + fieldSet[i] = exyzw; + break; + case 'r': + fields.offsets[i] = 0; + fieldSet[i] = ergba; + break; + case 's': + fields.offsets[i] = 0; + fieldSet[i] = estpq; + break; + case 'y': + fields.offsets[i] = 1; + fieldSet[i] = exyzw; + break; + case 'g': + fields.offsets[i] = 1; + fieldSet[i] = ergba; + break; + case 't': + fields.offsets[i] = 1; + fieldSet[i] = estpq; + break; + case 'z': + fields.offsets[i] = 2; + fieldSet[i] = exyzw; + break; + case 'b': + fields.offsets[i] = 2; + fieldSet[i] = ergba; + break; + case 'p': + fields.offsets[i] = 2; + fieldSet[i] = estpq; + break; + + case 'w': + fields.offsets[i] = 3; + fieldSet[i] = exyzw; + break; + case 'a': + fields.offsets[i] = 3; + fieldSet[i] = ergba; + break; + case 'q': + fields.offsets[i] = 3; + fieldSet[i] = estpq; + break; + default: + error(loc, "illegal vector field selection", compString.c_str(), ""); + return false; + } + } + + for (int i = 0; i < fields.num; ++i) { + if (fields.offsets[i] >= vecSize) { + error(loc, "vector field selection out of range", compString.c_str(), ""); + return false; + } + + if (i > 0) { + if (fieldSet[i] != fieldSet[i - 1]) { + error(loc, "illegal - vector component fields not from the same set", compString.c_str(), ""); + return false; + } + } + } + + return true; +} + +// +// Used to output syntax, parsing, and semantic errors. +// + +void HlslParseContext::outputMessage(const TSourceLoc& loc, const char* szReason, + const char* szToken, + const char* szExtraInfoFormat, + TPrefixType prefix, va_list args) +{ + const int maxSize = MaxTokenLength + 200; + char szExtraInfo[maxSize]; + + safe_vsprintf(szExtraInfo, maxSize, szExtraInfoFormat, args); + + infoSink.info.prefix(prefix); + infoSink.info.location(loc); + infoSink.info << "'" << szToken << "' : " << szReason << " " << szExtraInfo << "\n"; + + if (prefix == EPrefixError) { + ++numErrors; + } +} + +void C_DECL HlslParseContext::error(const TSourceLoc& loc, const char* szReason, const char* szToken, + const char* szExtraInfoFormat, ...) +{ + if (messages & EShMsgOnlyPreprocessor) + return; + va_list args; + va_start(args, szExtraInfoFormat); + outputMessage(loc, szReason, szToken, szExtraInfoFormat, EPrefixError, args); + va_end(args); +} + +void C_DECL HlslParseContext::warn(const TSourceLoc& loc, const char* szReason, const char* szToken, + const char* szExtraInfoFormat, ...) +{ + if (suppressWarnings()) + return; + va_list args; + va_start(args, szExtraInfoFormat); + outputMessage(loc, szReason, szToken, szExtraInfoFormat, EPrefixWarning, args); + va_end(args); +} + +void C_DECL HlslParseContext::ppError(const TSourceLoc& loc, const char* szReason, const char* szToken, + const char* szExtraInfoFormat, ...) +{ + va_list args; + va_start(args, szExtraInfoFormat); + outputMessage(loc, szReason, szToken, szExtraInfoFormat, EPrefixError, args); + va_end(args); +} + +void C_DECL HlslParseContext::ppWarn(const TSourceLoc& loc, const char* szReason, const char* szToken, + const char* szExtraInfoFormat, ...) +{ + va_list args; + va_start(args, szExtraInfoFormat); + outputMessage(loc, szReason, szToken, szExtraInfoFormat, EPrefixWarning, args); + va_end(args); +} + +// +// Handle seeing a variable identifier in the grammar. +// +TIntermTyped* HlslParseContext::handleVariable(const TSourceLoc& loc, TSymbol* symbol, const TString* string) +{ + TIntermTyped* node = nullptr; + + // Error check for requiring specific extensions present. + if (symbol && symbol->getNumExtensions()) + requireExtensions(loc, symbol->getNumExtensions(), symbol->getExtensions(), symbol->getName().c_str()); + + if (symbol && symbol->isReadOnly()) { + // All shared things containing an implicitly sized array must be copied up + // on first use, so that all future references will share its array structure, + // so that editing the implicit size will effect all nodes consuming it, + // and so that editing the implicit size won't change the shared one. + // + // If this is a variable or a block, check it and all it contains, but if this + // is a member of an anonymous block, check the whole block, as the whole block + // will need to be copied up if it contains an implicitly-sized array. + if (symbol->getType().containsImplicitlySizedArray() || (symbol->getAsAnonMember() && symbol->getAsAnonMember()->getAnonContainer().getType().containsImplicitlySizedArray())) + makeEditable(symbol); + } + + const TVariable* variable; + const TAnonMember* anon = symbol ? symbol->getAsAnonMember() : nullptr; + if (anon) { + // It was a member of an anonymous container. + + // Create a subtree for its dereference. + variable = anon->getAnonContainer().getAsVariable(); + TIntermTyped* container = intermediate.addSymbol(*variable, loc); + TIntermTyped* constNode = intermediate.addConstantUnion(anon->getMemberNumber(), loc); + node = intermediate.addIndex(EOpIndexDirectStruct, container, constNode, loc); + + node->setType(*(*variable->getType().getStruct())[anon->getMemberNumber()].type); + if (node->getType().hiddenMember()) + error(loc, "member of nameless block was not redeclared", string->c_str(), ""); + } else { + // Not a member of an anonymous container. + + // The symbol table search was done in the lexical phase. + // See if it was a variable. + variable = symbol ? symbol->getAsVariable() : nullptr; + if (variable) { + if ((variable->getType().getBasicType() == EbtBlock || + variable->getType().getBasicType() == EbtStruct) && variable->getType().getStruct() == nullptr) { + error(loc, "cannot be used (maybe an instance name is needed)", string->c_str(), ""); + variable = nullptr; + } + } else { + if (symbol) + error(loc, "variable name expected", string->c_str(), ""); + } + + // Recovery, if it wasn't found or was not a variable. + if (! variable) + variable = new TVariable(string, TType(EbtVoid)); + + if (variable->getType().getQualifier().isFrontEndConstant()) + node = intermediate.addConstantUnion(variable->getConstArray(), variable->getType(), loc); + else + node = intermediate.addSymbol(*variable, loc); + } + + if (variable->getType().getQualifier().isIo()) + intermediate.addIoAccessed(*string); + + return node; +} + +// +// Handle seeing a base[index] dereference in the grammar. +// +TIntermTyped* HlslParseContext::handleBracketDereference(const TSourceLoc& loc, TIntermTyped* base, TIntermTyped* index) +{ + TIntermTyped* result = nullptr; + + int indexValue = 0; + if (index->getQualifier().storage == EvqConst) { + indexValue = index->getAsConstantUnion()->getConstArray()[0].getIConst(); + checkIndex(loc, base->getType(), indexValue); + } + + variableCheck(base); + if (! base->isArray() && ! base->isMatrix() && ! base->isVector()) { + if (base->getAsSymbolNode()) + error(loc, " left of '[' is not of type array, matrix, or vector ", base->getAsSymbolNode()->getName().c_str(), ""); + else + error(loc, " left of '[' is not of type array, matrix, or vector ", "expression", ""); + } else if (base->getType().getQualifier().storage == EvqConst && index->getQualifier().storage == EvqConst) + return intermediate.foldDereference(base, indexValue, loc); + else { + // at least one of base and index is variable... + + if (base->getAsSymbolNode() && isIoResizeArray(base->getType())) + handleIoResizeArrayAccess(loc, base); + + if (index->getQualifier().storage == EvqConst) { + if (base->getType().isImplicitlySizedArray()) + updateImplicitArraySize(loc, base, indexValue); + result = intermediate.addIndex(EOpIndexDirect, base, index, loc); + } else { + result = intermediate.addIndex(EOpIndexIndirect, base, index, loc); + } + } + + if (result == nullptr) { + // Insert dummy error-recovery result + result = intermediate.addConstantUnion(0.0, EbtFloat, loc); + } else { + // Insert valid dereferenced result + TType newType(base->getType(), 0); // dereferenced type + if (base->getType().getQualifier().storage == EvqConst && index->getQualifier().storage == EvqConst) + newType.getQualifier().storage = EvqConst; + else + newType.getQualifier().storage = EvqTemporary; + result->setType(newType); + } + + return result; +} + +void HlslParseContext::checkIndex(const TSourceLoc& loc, const TType& type, int& index) +{ + // HLSL todo: any rules for index fixups? +} + +// Make a shared symbol have a non-shared version that can be edited by the current +// compile, such that editing its type will not change the shared version and will +// effect all nodes sharing it. +void HlslParseContext::makeEditable(TSymbol*& symbol) +{ + // copyUp() does a deep copy of the type. + symbol = symbolTable.copyUp(symbol); + + // Also, see if it's tied to IO resizing + if (isIoResizeArray(symbol->getType())) + ioArraySymbolResizeList.push_back(symbol); + + // Also, save it in the AST for linker use. + intermediate.addSymbolLinkageNode(linkage, *symbol); +} + +TVariable* HlslParseContext::getEditableVariable(const char* name) +{ + bool builtIn; + TSymbol* symbol = symbolTable.find(name, &builtIn); + if (builtIn) + makeEditable(symbol); + + return symbol->getAsVariable(); +} + +// Return true if this is a geometry shader input array or tessellation control output array. +bool HlslParseContext::isIoResizeArray(const TType& type) const +{ + return type.isArray() && + ((language == EShLangGeometry && type.getQualifier().storage == EvqVaryingIn) || + (language == EShLangTessControl && type.getQualifier().storage == EvqVaryingOut && ! type.getQualifier().patch)); +} + +// If an array is not isIoResizeArray() but is an io array, make sure it has the right size +void HlslParseContext::fixIoArraySize(const TSourceLoc& loc, TType& type) +{ + if (! type.isArray() || type.getQualifier().patch || symbolTable.atBuiltInLevel()) + return; + + assert(! isIoResizeArray(type)); + + if (type.getQualifier().storage != EvqVaryingIn || type.getQualifier().patch) + return; + + if (language == EShLangTessControl || language == EShLangTessEvaluation) { + if (type.getOuterArraySize() != resources.maxPatchVertices) { + if (type.isExplicitlySizedArray()) + error(loc, "tessellation input array size must be gl_MaxPatchVertices or implicitly sized", "[]", ""); + type.changeOuterArraySize(resources.maxPatchVertices); + } + } +} + +// Handle a dereference of a geometry shader input array or tessellation control output array. +// See ioArraySymbolResizeList comment in ParseHelper.h. +// +void HlslParseContext::handleIoResizeArrayAccess(const TSourceLoc& /*loc*/, TIntermTyped* base) +{ + TIntermSymbol* symbolNode = base->getAsSymbolNode(); + assert(symbolNode); + if (! symbolNode) + return; + + // fix array size, if it can be fixed and needs to be fixed (will allow variable indexing) + if (symbolNode->getType().isImplicitlySizedArray()) { + int newSize = getIoArrayImplicitSize(); + if (newSize > 0) + symbolNode->getWritableType().changeOuterArraySize(newSize); + } +} + +// If there has been an input primitive declaration (geometry shader) or an output +// number of vertices declaration(tessellation shader), make sure all input array types +// match it in size. Types come either from nodes in the AST or symbols in the +// symbol table. +// +// Types without an array size will be given one. +// Types already having a size that is wrong will get an error. +// +void HlslParseContext::checkIoArraysConsistency(const TSourceLoc& loc, bool tailOnly) +{ + int requiredSize = getIoArrayImplicitSize(); + if (requiredSize == 0) + return; + + const char* feature; + if (language == EShLangGeometry) + feature = TQualifier::getGeometryString(intermediate.getInputPrimitive()); + else if (language == EShLangTessControl) + feature = "vertices"; + else + feature = "unknown"; + + if (tailOnly) { + checkIoArrayConsistency(loc, requiredSize, feature, ioArraySymbolResizeList.back()->getWritableType(), ioArraySymbolResizeList.back()->getName()); + return; + } + + for (size_t i = 0; i < ioArraySymbolResizeList.size(); ++i) + checkIoArrayConsistency(loc, requiredSize, feature, ioArraySymbolResizeList[i]->getWritableType(), ioArraySymbolResizeList[i]->getName()); +} + +int HlslParseContext::getIoArrayImplicitSize() const +{ + if (language == EShLangGeometry) + return TQualifier::mapGeometryToSize(intermediate.getInputPrimitive()); + else if (language == EShLangTessControl) + return intermediate.getVertices() != TQualifier::layoutNotSet ? intermediate.getVertices() : 0; + else + return 0; +} + +void HlslParseContext::checkIoArrayConsistency(const TSourceLoc& loc, int requiredSize, const char* feature, TType& type, const TString& name) +{ + if (type.isImplicitlySizedArray()) + type.changeOuterArraySize(requiredSize); +} + +// Handle seeing a binary node with a math operation. +TIntermTyped* HlslParseContext::handleBinaryMath(const TSourceLoc& loc, const char* str, TOperator op, TIntermTyped* left, TIntermTyped* right) +{ + TIntermTyped* result = intermediate.addBinaryMath(op, left, right, loc); + if (! result) + binaryOpError(loc, str, left->getCompleteString(), right->getCompleteString()); + + return result; +} + +// Handle seeing a unary node with a math operation. +TIntermTyped* HlslParseContext::handleUnaryMath(const TSourceLoc& loc, const char* str, TOperator op, TIntermTyped* childNode) +{ + TIntermTyped* result = intermediate.addUnaryMath(op, childNode, loc); + + if (result) + return result; + else + unaryOpError(loc, str, childNode->getCompleteString()); + + return childNode; +} + +// +// Handle seeing a base.field dereference in the grammar. +// +TIntermTyped* HlslParseContext::handleDotDereference(const TSourceLoc& loc, TIntermTyped* base, const TString& field) +{ + variableCheck(base); + + // + // .length() can't be resolved until we later see the function-calling syntax. + // Save away the name in the AST for now. Processing is completed in + // handleLengthMethod(). + // + if (field == "length") { + return intermediate.addMethod(base, TType(EbtInt), &field, loc); + } + + // It's not .length() if we get to here. + + if (base->isArray()) { + error(loc, "cannot apply to an array:", ".", field.c_str()); + + return base; + } + + // It's neither an array nor .length() if we get here, + // leaving swizzles and struct/block dereferences. + + TIntermTyped* result = base; + if (base->isVector() || base->isScalar()) { + TVectorFields fields; + if (! parseVectorFields(loc, field, base->getVectorSize(), fields)) { + fields.num = 1; + fields.offsets[0] = 0; + } + + if (base->isScalar()) { + if (fields.num == 1) + return result; + else { + TType type(base->getBasicType(), EvqTemporary, fields.num); + return addConstructor(loc, base, type, mapTypeToConstructorOp(type)); + } + } + + if (base->getType().getQualifier().isFrontEndConstant()) + result = intermediate.foldSwizzle(base, fields, loc); + else { + if (fields.num == 1) { + TIntermTyped* index = intermediate.addConstantUnion(fields.offsets[0], loc); + result = intermediate.addIndex(EOpIndexDirect, base, index, loc); + result->setType(TType(base->getBasicType(), EvqTemporary, base->getType().getQualifier().precision)); + } else { + TString vectorString = field; + TIntermTyped* index = intermediate.addSwizzle(fields, loc); + result = intermediate.addIndex(EOpVectorSwizzle, base, index, loc); + result->setType(TType(base->getBasicType(), EvqTemporary, base->getType().getQualifier().precision, (int)vectorString.size())); + } + } + } else if (base->getBasicType() == EbtStruct || base->getBasicType() == EbtBlock) { + const TTypeList* fields = base->getType().getStruct(); + bool fieldFound = false; + int member; + for (member = 0; member < (int)fields->size(); ++member) { + if ((*fields)[member].type->getFieldName() == field) { + fieldFound = true; + break; + } + } + if (fieldFound) { + if (base->getType().getQualifier().storage == EvqConst) + result = intermediate.foldDereference(base, member, loc); + else { + TIntermTyped* index = intermediate.addConstantUnion(member, loc); + result = intermediate.addIndex(EOpIndexDirectStruct, base, index, loc); + result->setType(*(*fields)[member].type); + } + } 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()); + + return result; +} + +// +// Handle seeing a function declarator in the grammar. This is the precursor +// to recognizing a function prototype or function definition. +// +TFunction* HlslParseContext::handleFunctionDeclarator(const TSourceLoc& loc, TFunction& function, bool prototype) +{ + // + // Multiple declarations of the same function name are allowed. + // + // If this is a definition, the definition production code will check for redefinitions + // (we don't know at this point if it's a definition or not). + // + // Redeclarations (full signature match) are allowed. But, return types and parameter qualifiers must also match. + // - except ES 100, which only allows a single prototype + // + // ES 100 does not allow redefining, but does allow overloading of built-in functions. + // ES 300 does not allow redefining or overloading of built-in functions. + // + bool builtIn; + TSymbol* symbol = symbolTable.find(function.getMangledName(), &builtIn); + const TFunction* prevDec = symbol ? symbol->getAsFunction() : 0; + + if (prototype) { + // All built-in functions are defined, even though they don't have a body. + // Count their prototype as a definition instead. + if (symbolTable.atBuiltInLevel()) + function.setDefined(); + else { + if (prevDec && ! builtIn) + symbol->getAsFunction()->setPrototyped(); // need a writable one, but like having prevDec as a const + function.setPrototyped(); + } + } + + // This insert won't actually insert it if it's a duplicate signature, but it will still check for + // other forms of name collisions. + if (! symbolTable.insert(function)) + error(loc, "function name is redeclaration of existing name", function.getName().c_str(), ""); + + // + // If this is a redeclaration, it could also be a definition, + // in which case, we need to use the parameter names from this one, and not the one that's + // being redeclared. So, pass back this declaration, not the one in the symbol table. + // + return &function; +} + +// +// Handle seeing the function prototype in front of a function definition in the grammar. +// The body is handled after this function returns. +// +TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& loc, TFunction& function) +{ + currentCaller = function.getMangledName(); + TSymbol* symbol = symbolTable.find(function.getMangledName()); + TFunction* prevDec = symbol ? symbol->getAsFunction() : nullptr; + + if (! prevDec) + error(loc, "can't find function", function.getName().c_str(), ""); + // Note: 'prevDec' could be 'function' if this is the first time we've seen function + // as it would have just been put in the symbol table. Otherwise, we're looking up + // an earlier occurrence. + + if (prevDec && prevDec->isDefined()) { + // Then this function already has a body. + error(loc, "function already has a body", function.getName().c_str(), ""); + } + if (prevDec && ! prevDec->isDefined()) { + prevDec->setDefined(); + + // Remember the return type for later checking for RETURN statements. + currentFunctionType = &(prevDec->getType()); + } else + currentFunctionType = new TType(EbtVoid); + functionReturnsValue = false; + + inEntrypoint = (function.getName() == intermediate.getEntryPoint()); + + // + // New symbol table scope for body of function plus its arguments + // + symbolTable.push(); + + // + // Insert parameters into the symbol table. + // If the parameter has no name, it's not an error, just don't insert it + // (could be used for unused args). + // + // Also, accumulate the list of parameters into the HIL, so lower level code + // knows where to find parameters. + // + TIntermAggregate* paramNodes = new TIntermAggregate; + for (int i = 0; i < function.getParamCount(); i++) { + TParameter& param = function[i]; + if (param.name != nullptr) { + TVariable *variable = new TVariable(param.name, *param.type); + + // Insert the parameters with name in the symbol table. + if (! symbolTable.insert(*variable)) + error(loc, "redefinition", variable->getName().c_str(), ""); + else { + // Transfer ownership of name pointer to symbol table. + param.name = nullptr; + + // Add the parameter to the HIL + paramNodes = intermediate.growAggregate(paramNodes, + intermediate.addSymbol(*variable, loc), + loc); + } + } else + paramNodes = intermediate.growAggregate(paramNodes, intermediate.addSymbol(0, "", *param.type, loc), loc); + } + intermediate.setAggregateOperator(paramNodes, EOpParameters, TType(EbtVoid), loc); + loopNestingLevel = 0; + statementNestingLevel = 0; + controlFlowNestingLevel = 0; + postMainReturn = false; + + return paramNodes; +} + +// +// Handle seeing function call syntax in the grammar, which could be any of +// - .length() method +// - constructor +// - a call to a built-in function mapped to an operator +// - a call to a built-in function that will remain a function call (e.g., texturing) +// - user function +// - subroutine call (not implemented yet) +// +TIntermTyped* HlslParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction* function, TIntermNode* arguments) +{ + TIntermTyped* result = nullptr; + + TOperator op = function->getBuiltInOp(); + if (op == EOpArrayLength) + result = handleLengthMethod(loc, function, arguments); + else if (op != EOpNull) { + // + // Then this should be a constructor. + // Don't go through the symbol table for constructors. + // Their parameters will be verified algorithmically. + // + TType type(EbtVoid); // use this to get the type back + if (! constructorError(loc, arguments, *function, op, type)) { + // + // It's a constructor, of type 'type'. + // + result = addConstructor(loc, arguments, type, op); + if (result == nullptr) + error(loc, "cannot construct with these arguments", type.getCompleteString().c_str(), ""); + } + } else { + // + // Find it in the symbol table. + // + const TFunction* fnCandidate; + bool builtIn; + fnCandidate = findFunction(loc, *function, builtIn); + if (fnCandidate) { + // This is a declared function that might map to + // - a built-in operator, + // - a built-in function not mapped to an operator, or + // - a user function. + + // Error check for a function requiring specific extensions present. + if (builtIn && fnCandidate->getNumExtensions()) + requireExtensions(loc, fnCandidate->getNumExtensions(), fnCandidate->getExtensions(), fnCandidate->getName().c_str()); + + if (arguments) { + // Make sure qualifications work for these arguments. + TIntermAggregate* aggregate = arguments->getAsAggregate(); + for (int i = 0; i < fnCandidate->getParamCount(); ++i) { + // At this early point there is a slight ambiguity between whether an aggregate 'arguments' + // is the single argument itself or its children are the arguments. Only one argument + // means take 'arguments' itself as the one argument. + TIntermNode* arg = fnCandidate->getParamCount() == 1 ? arguments : (aggregate ? aggregate->getSequence()[i] : arguments); + TQualifier& formalQualifier = (*fnCandidate)[i].type->getQualifier(); + TQualifier& argQualifier = arg->getAsTyped()->getQualifier(); + } + + // Convert 'in' arguments + addInputArgumentConversions(*fnCandidate, arguments); // arguments may be modified if it's just a single argument node + } + + op = fnCandidate->getBuiltInOp(); + if (builtIn && op != EOpNull) { + // A function call mapped to a built-in operation. + result = intermediate.addBuiltInFunctionCall(loc, op, fnCandidate->getParamCount() == 1, arguments, fnCandidate->getType()); + if (result == nullptr) { + error(arguments->getLoc(), " wrong operand type", "Internal Error", + "built in unary operator function. Type: %s", + static_cast(arguments)->getCompleteString().c_str()); + } else if (result->getAsOperator()) { + builtInOpCheck(loc, *fnCandidate, *result->getAsOperator()); + } + } else { + // This is a function call not mapped to built-in operator. + // It could still be a built-in function, but only if PureOperatorBuiltins == false. + result = intermediate.setAggregateOperator(arguments, EOpFunctionCall, fnCandidate->getType(), loc); + TIntermAggregate* call = result->getAsAggregate(); + call->setName(fnCandidate->getMangledName()); + + // this is how we know whether the given function is a built-in function or a user-defined function + // if builtIn == false, it's a userDefined -> could be an overloaded built-in function also + // if builtIn == true, it's definitely a built-in function with EOpNull + if (! builtIn) { + call->setUserDefined(); + intermediate.addToCallGraph(infoSink, currentCaller, fnCandidate->getMangledName()); + } + } + + // Convert 'out' arguments. If it was a constant folded built-in, it won't be an aggregate anymore. + // Built-ins with a single argument aren't called with an aggregate, but they also don't have an output. + // Also, build the qualifier list for user function calls, which are always called with an aggregate. + if (result->getAsAggregate()) { + TQualifierList& qualifierList = result->getAsAggregate()->getQualifierList(); + for (int i = 0; i < fnCandidate->getParamCount(); ++i) { + TStorageQualifier qual = (*fnCandidate)[i].type->getQualifier().storage; + qualifierList.push_back(qual); + } + result = addOutputArgumentConversions(*fnCandidate, *result->getAsAggregate()); + } + } + } + + // generic error recovery + // TODO: simplification: localize all the error recoveries that look like this, and taking type into account to reduce cascades + if (result == nullptr) + result = intermediate.addConstantUnion(0.0, EbtFloat, loc); + + return result; +} + +// Finish processing object.length(). This started earlier in handleDotDereference(), where +// the ".length" part was recognized and semantically checked, and finished here where the +// function syntax "()" is recognized. +// +// Return resulting tree node. +TIntermTyped* HlslParseContext::handleLengthMethod(const TSourceLoc& loc, TFunction* function, TIntermNode* intermNode) +{ + int length = 0; + + if (function->getParamCount() > 0) + error(loc, "method does not accept any arguments", function->getName().c_str(), ""); + else { + const TType& type = intermNode->getAsTyped()->getType(); + if (type.isArray()) { + if (type.isRuntimeSizedArray()) { + // Create a unary op and let the back end handle it + return intermediate.addBuiltInFunctionCall(loc, EOpArrayLength, true, intermNode, TType(EbtInt)); + } else if (type.isImplicitlySizedArray()) { + 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") + length = getIoArrayImplicitSize(); + } + if (length == 0) { + if (intermNode->getAsSymbolNode() && isIoResizeArray(type)) + error(loc, "", function->getName().c_str(), "array must first be sized by a redeclaration or layout qualifier"); + else + error(loc, "", function->getName().c_str(), "array must be declared with a size before using this method"); + } + } else + length = type.getOuterArraySize(); + } else if (type.isMatrix()) + length = type.getMatrixCols(); + else if (type.isVector()) + length = type.getVectorSize(); + else { + // we should not get here, because earlier semantic checking should have prevented this path + error(loc, ".length()", "unexpected use of .length()", ""); + } + } + + if (length == 0) + length = 1; + + return intermediate.addConstantUnion(length, loc); +} + +// +// Add any needed implicit conversions for function-call arguments to input parameters. +// +void HlslParseContext::addInputArgumentConversions(const TFunction& function, TIntermNode*& arguments) const +{ + TIntermAggregate* aggregate = arguments->getAsAggregate(); + + // Process each argument's conversion + for (int i = 0; i < function.getParamCount(); ++i) { + // At this early point there is a slight ambiguity between whether an aggregate 'arguments' + // is the single argument itself or its children are the arguments. Only one argument + // means take 'arguments' itself as the one argument. + TIntermTyped* arg = function.getParamCount() == 1 ? arguments->getAsTyped() : (aggregate ? aggregate->getSequence()[i]->getAsTyped() : arguments->getAsTyped()); + if (*function[i].type != arg->getType()) { + if (function[i].type->getQualifier().isParamInput()) { + // In-qualified arguments just need an extra node added above the argument to + // convert to the correct type. + arg = intermediate.addConversion(EOpFunctionCall, *function[i].type, arg); + if (arg) { + if (function.getParamCount() == 1) + arguments = arg; + else { + if (aggregate) + aggregate->getSequence()[i] = arg; + else + arguments = arg; + } + } + } + } + } +} + +// +// Add any needed implicit output conversions for function-call arguments. This +// can require a new tree topology, complicated further by whether the function +// has a return value. +// +// Returns a node of a subtree that evaluates to the return value of the function. +// +TIntermTyped* HlslParseContext::addOutputArgumentConversions(const TFunction& function, TIntermAggregate& intermNode) const +{ + TIntermSequence& arguments = intermNode.getSequence(); + + // Will there be any output conversions? + bool outputConversions = false; + for (int i = 0; i < function.getParamCount(); ++i) { + if (*function[i].type != arguments[i]->getAsTyped()->getType() && function[i].type->getQualifier().storage == EvqOut) { + outputConversions = true; + break; + } + } + + if (! outputConversions) + return &intermNode; + + // Setup for the new tree, if needed: + // + // Output conversions need a different tree topology. + // Out-qualified arguments need a temporary of the correct type, with the call + // followed by an assignment of the temporary to the original argument: + // void: function(arg, ...) -> ( function(tempArg, ...), arg = tempArg, ...) + // ret = function(arg, ...) -> ret = (tempRet = function(tempArg, ...), arg = tempArg, ..., tempRet) + // Where the "tempArg" type needs no conversion as an argument, but will convert on assignment. + TIntermTyped* conversionTree = nullptr; + TVariable* tempRet = nullptr; + if (intermNode.getBasicType() != EbtVoid) { + // do the "tempRet = function(...), " bit from above + tempRet = makeInternalVariable("tempReturn", intermNode.getType()); + TIntermSymbol* tempRetNode = intermediate.addSymbol(*tempRet, intermNode.getLoc()); + conversionTree = intermediate.addAssign(EOpAssign, tempRetNode, &intermNode, intermNode.getLoc()); + } else + conversionTree = &intermNode; + + conversionTree = intermediate.makeAggregate(conversionTree); + + // Process each argument's conversion + for (int i = 0; i < function.getParamCount(); ++i) { + if (*function[i].type != arguments[i]->getAsTyped()->getType()) { + if (function[i].type->getQualifier().isParamOutput()) { + // Out-qualified arguments need to use the topology set up above. + // do the " ...(tempArg, ...), arg = tempArg" bit from above + TVariable* tempArg = makeInternalVariable("tempArg", *function[i].type); + tempArg->getWritableType().getQualifier().makeTemporary(); + TIntermSymbol* tempArgNode = intermediate.addSymbol(*tempArg, intermNode.getLoc()); + TIntermTyped* tempAssign = intermediate.addAssign(EOpAssign, arguments[i]->getAsTyped(), tempArgNode, arguments[i]->getLoc()); + conversionTree = intermediate.growAggregate(conversionTree, tempAssign, arguments[i]->getLoc()); + // replace the argument with another node for the same tempArg variable + arguments[i] = intermediate.addSymbol(*tempArg, intermNode.getLoc()); + } + } + } + + // Finalize the tree topology (see bigger comment above). + if (tempRet) { + // do the "..., tempRet" bit from above + TIntermSymbol* tempRetNode = intermediate.addSymbol(*tempRet, intermNode.getLoc()); + conversionTree = intermediate.growAggregate(conversionTree, tempRetNode, intermNode.getLoc()); + } + conversionTree = intermediate.setAggregateOperator(conversionTree, EOpComma, intermNode.getType(), intermNode.getLoc()); + + return conversionTree; +} + +// +// Do additional checking of built-in function calls that is not caught +// by normal semantic checks on argument type, extension tagging, etc. +// +// Assumes there has been a semantically correct match to a built-in function prototype. +// +void HlslParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCandidate, TIntermOperator& callNode) +{ + // Set up convenience accessors to the argument(s). There is almost always + // multiple arguments for the cases below, but when there might be one, + // check the unaryArg first. + const TIntermSequence* argp = nullptr; // confusing to use [] syntax on a pointer, so this is to help get a reference + const TIntermTyped* unaryArg = nullptr; + const TIntermTyped* arg0 = nullptr; + if (callNode.getAsAggregate()) { + argp = &callNode.getAsAggregate()->getSequence(); + if (argp->size() > 0) + arg0 = (*argp)[0]->getAsTyped(); + } else { + assert(callNode.getAsUnaryNode()); + unaryArg = callNode.getAsUnaryNode()->getOperand(); + arg0 = unaryArg; + } + const TIntermSequence& aggArgs = *argp; // only valid when unaryArg is nullptr + + // built-in texturing functions get their return value precision from the precision of the sampler + if (fnCandidate.getType().getQualifier().precision == EpqNone && + fnCandidate.getParamCount() > 0 && fnCandidate[0].type->getBasicType() == EbtSampler) + callNode.getQualifier().precision = arg0->getQualifier().precision; + + switch (callNode.getOp()) { + case EOpTextureGather: + case EOpTextureGatherOffset: + case EOpTextureGatherOffsets: + { + // Figure out which variants are allowed by what extensions, + // and what arguments must be constant for which situations. + + TString featureString = fnCandidate.getName() + "(...)"; + const char* feature = featureString.c_str(); + int compArg = -1; // track which argument, if any, is the constant component argument + switch (callNode.getOp()) { + case EOpTextureGather: + // More than two arguments needs gpu_shader5, and rectangular or shadow needs gpu_shader5, + // otherwise, need GL_ARB_texture_gather. + if (fnCandidate.getParamCount() > 2 || fnCandidate[0].type->getSampler().dim == EsdRect || fnCandidate[0].type->getSampler().shadow) { + if (! fnCandidate[0].type->getSampler().shadow) + compArg = 2; + } + break; + case EOpTextureGatherOffset: + // GL_ARB_texture_gather is good enough for 2D non-shadow textures with no component argument + if (! fnCandidate[0].type->getSampler().shadow) + compArg = 3; + break; + case EOpTextureGatherOffsets: + if (! fnCandidate[0].type->getSampler().shadow) + compArg = 3; + break; + default: + break; + } + + if (compArg > 0 && compArg < fnCandidate.getParamCount()) { + if (aggArgs[compArg]->getAsConstantUnion()) { + int value = aggArgs[compArg]->getAsConstantUnion()->getConstArray()[0].getIConst(); + if (value < 0 || value > 3) + error(loc, "must be 0, 1, 2, or 3:", feature, "component argument"); + } else + error(loc, "must be a compile-time constant:", feature, "component argument"); + } + + break; + } + + case EOpTextureOffset: + case EOpTextureFetchOffset: + case EOpTextureProjOffset: + case EOpTextureLodOffset: + case EOpTextureProjLodOffset: + case EOpTextureGradOffset: + case EOpTextureProjGradOffset: + { + // Handle texture-offset limits checking + // Pick which argument has to hold constant offsets + int arg = -1; + switch (callNode.getOp()) { + case EOpTextureOffset: arg = 2; break; + case EOpTextureFetchOffset: arg = (arg0->getType().getSampler().dim != EsdRect) ? 3 : 2; break; + case EOpTextureProjOffset: arg = 2; break; + case EOpTextureLodOffset: arg = 3; break; + case EOpTextureProjLodOffset: arg = 3; break; + case EOpTextureGradOffset: arg = 4; break; + case EOpTextureProjGradOffset: arg = 4; break; + default: + assert(0); + break; + } + + if (arg > 0) { + if (! aggArgs[arg]->getAsConstantUnion()) + error(loc, "argument must be compile-time constant", "texel offset", ""); + else { + const TType& type = aggArgs[arg]->getAsTyped()->getType(); + for (int c = 0; c < type.getVectorSize(); ++c) { + int offset = aggArgs[arg]->getAsConstantUnion()->getConstArray()[c].getIConst(); + if (offset > resources.maxProgramTexelOffset || offset < resources.minProgramTexelOffset) + error(loc, "value is out of range:", "texel offset", "[gl_MinProgramTexelOffset, gl_MaxProgramTexelOffset]"); + } + } + } + + break; + } + + case EOpTextureQuerySamples: + case EOpImageQuerySamples: + break; + + case EOpImageAtomicAdd: + case EOpImageAtomicMin: + case EOpImageAtomicMax: + case EOpImageAtomicAnd: + case EOpImageAtomicOr: + case EOpImageAtomicXor: + case EOpImageAtomicExchange: + case EOpImageAtomicCompSwap: + break; + + case EOpInterpolateAtCentroid: + case EOpInterpolateAtSample: + case EOpInterpolateAtOffset: + // "For the interpolateAt* functions, the call will return a precision + // qualification matching the precision of the 'interpolant' argument to + // the function call." + callNode.getQualifier().precision = arg0->getQualifier().precision; + + // 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. + // + // We could check more, but the semantics of the first argument are already met; the + // only way to turn an array into a float/vec* is array dereference and swizzle. + // + // ES and desktop 4.3 and earlier: swizzles may not be used + // desktop 4.4 and later: swizzles may be used + const TIntermTyped* base = TIntermediate::findLValueBase(arg0, true); + if (base == nullptr || base->getType().getQualifier().storage != EvqVaryingIn) + error(loc, "first argument must be an interpolant, or interpolant-array element", fnCandidate.getName().c_str(), ""); + } + break; + + default: + break; + } +} + +// +// Handle seeing a built-in constructor in a grammar production. +// +TFunction* HlslParseContext::handleConstructorCall(const TSourceLoc& loc, const TPublicType& publicType) +{ + TType type(publicType); + type.getQualifier().precision = EpqNone; + + TOperator op = mapTypeToConstructorOp(type); + + if (op == EOpNull) { + error(loc, "cannot construct this type", type.getBasicString(), ""); + op = EOpConstructFloat; + TType errorType(EbtFloat); + type.shallowCopy(errorType); + } + + TString empty(""); + + return new TFunction(&empty, type, op); +} + +// +// Given a type, find what operation would fully construct it. +// +TOperator HlslParseContext::mapTypeToConstructorOp(const TType& type) const +{ + TOperator op = EOpNull; + + switch (type.getBasicType()) { + case EbtStruct: + op = EOpConstructStruct; + break; + case EbtSampler: + if (type.getSampler().combined) + op = EOpConstructTextureSampler; + break; + case EbtFloat: + if (type.isMatrix()) { + switch (type.getMatrixCols()) { + case 2: + switch (type.getMatrixRows()) { + case 2: op = EOpConstructMat2x2; break; + case 3: op = EOpConstructMat2x3; break; + case 4: op = EOpConstructMat2x4; break; + default: break; // some compilers want this + } + break; + case 3: + switch (type.getMatrixRows()) { + case 2: op = EOpConstructMat3x2; break; + case 3: op = EOpConstructMat3x3; break; + case 4: op = EOpConstructMat3x4; break; + default: break; // some compilers want this + } + break; + case 4: + switch (type.getMatrixRows()) { + case 2: op = EOpConstructMat4x2; break; + case 3: op = EOpConstructMat4x3; break; + case 4: op = EOpConstructMat4x4; break; + default: break; // some compilers want this + } + break; + default: break; // some compilers want this + } + } else { + switch (type.getVectorSize()) { + case 1: op = EOpConstructFloat; break; + case 2: op = EOpConstructVec2; break; + case 3: op = EOpConstructVec3; break; + case 4: op = EOpConstructVec4; break; + default: break; // some compilers want this + } + } + break; + case EbtDouble: + if (type.getMatrixCols()) { + switch (type.getMatrixCols()) { + case 2: + switch (type.getMatrixRows()) { + case 2: op = EOpConstructDMat2x2; break; + case 3: op = EOpConstructDMat2x3; break; + case 4: op = EOpConstructDMat2x4; break; + default: break; // some compilers want this + } + break; + case 3: + switch (type.getMatrixRows()) { + case 2: op = EOpConstructDMat3x2; break; + case 3: op = EOpConstructDMat3x3; break; + case 4: op = EOpConstructDMat3x4; break; + default: break; // some compilers want this + } + break; + case 4: + switch (type.getMatrixRows()) { + case 2: op = EOpConstructDMat4x2; break; + case 3: op = EOpConstructDMat4x3; break; + case 4: op = EOpConstructDMat4x4; break; + default: break; // some compilers want this + } + break; + } + } else { + switch (type.getVectorSize()) { + case 1: op = EOpConstructDouble; break; + case 2: op = EOpConstructDVec2; break; + case 3: op = EOpConstructDVec3; break; + case 4: op = EOpConstructDVec4; break; + default: break; // some compilers want this + } + } + break; + case EbtInt: + 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: + 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: + 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; + default: + break; + } + + return op; +} + +// +// Same error message for all places assignments don't work. +// +void HlslParseContext::assignError(const TSourceLoc& loc, const char* op, TString left, TString right) +{ + error(loc, "", op, "cannot convert from '%s' to '%s'", + right.c_str(), left.c_str()); +} + +// +// Same error message for all places unary operations don't work. +// +void HlslParseContext::unaryOpError(const TSourceLoc& loc, const char* op, TString operand) +{ + error(loc, " wrong operand type", op, + "no operation '%s' exists that takes an operand of type %s (or there is no acceptable conversion)", + op, operand.c_str()); +} + +// +// Same error message for all binary operations don't work. +// +void HlslParseContext::binaryOpError(const TSourceLoc& loc, const char* op, TString left, TString right) +{ + error(loc, " wrong operand types:", op, + "no operation '%s' exists that takes a left-hand operand of type '%s' and " + "a right operand of type '%s' (or there is no acceptable conversion)", + op, left.c_str(), right.c_str()); +} + +// +// A basic type of EbtVoid is a key that the name string was seen in the source, but +// it was not found as a variable in the symbol table. If so, give the error +// message and insert a dummy variable in the symbol table to prevent future errors. +// +void HlslParseContext::variableCheck(TIntermTyped*& nodePtr) +{ + TIntermSymbol* symbol = nodePtr->getAsSymbolNode(); + if (! symbol) + return; + + if (symbol->getType().getBasicType() == EbtVoid) { + error(symbol->getLoc(), "undeclared identifier", symbol->getName().c_str(), ""); + + // Add to symbol table to prevent future error messages on the same name + if (symbol->getName().size() > 0) { + TVariable* fakeVariable = new TVariable(&symbol->getName(), TType(EbtFloat)); + symbolTable.insert(*fakeVariable); + + // substitute a symbol node for this new variable + nodePtr = intermediate.addSymbol(*fakeVariable, symbol->getLoc()); + } + } +} + +// +// Both test, and if necessary spit out an error, to see if the node is really +// a constant. +// +void HlslParseContext::constantValueCheck(TIntermTyped* node, const char* token) +{ + if (node->getQualifier().storage != EvqConst) + error(node->getLoc(), "constant expression required", token, ""); +} + +// +// Both test, and if necessary spit out an error, to see if the node is really +// an integer. +// +void HlslParseContext::integerCheck(const TIntermTyped* node, const char* token) +{ + if ((node->getBasicType() == EbtInt || node->getBasicType() == EbtUint) && node->isScalar()) + return; + + error(node->getLoc(), "scalar integer expression required", token, ""); +} + +// +// Both test, and if necessary spit out an error, to see if we are currently +// globally scoped. +// +void HlslParseContext::globalCheck(const TSourceLoc& loc, const char* token) +{ + if (! symbolTable.atGlobalLevel()) + error(loc, "not allowed in nested scope", token, ""); +} + + +bool HlslParseContext::builtInName(const TString& identifier) +{ + return false; +} + +// +// Make sure there is enough data and not too many arguments provided to the +// constructor to build something of the type of the constructor. Also returns +// the type of the constructor. +// +// Returns true if there was an error in construction. +// +bool HlslParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, TFunction& function, TOperator op, TType& type) +{ + type.shallowCopy(function.getType()); + + bool constructingMatrix = false; + switch (op) { + case EOpConstructTextureSampler: + return constructorTextureSamplerError(loc, function); + case EOpConstructMat2x2: + case EOpConstructMat2x3: + case EOpConstructMat2x4: + case EOpConstructMat3x2: + case EOpConstructMat3x3: + case EOpConstructMat3x4: + case EOpConstructMat4x2: + case EOpConstructMat4x3: + case EOpConstructMat4x4: + case EOpConstructDMat2x2: + case EOpConstructDMat2x3: + case EOpConstructDMat2x4: + case EOpConstructDMat3x2: + case EOpConstructDMat3x3: + case EOpConstructDMat3x4: + case EOpConstructDMat4x2: + case EOpConstructDMat4x3: + case EOpConstructDMat4x4: + constructingMatrix = true; + break; + default: + break; + } + + // + // Walk the arguments for first-pass checks and collection of information. + // + + int size = 0; + bool constType = true; + bool full = false; + bool overFull = false; + bool matrixInMatrix = false; + bool arrayArg = false; + for (int arg = 0; arg < function.getParamCount(); ++arg) { + if (function[arg].type->isArray()) { + if (! function[arg].type->isExplicitlySizedArray()) { + // Can't construct from an unsized array. + error(loc, "array argument must be sized", "constructor", ""); + return true; + } + arrayArg = true; + } + if (constructingMatrix && function[arg].type->isMatrix()) + matrixInMatrix = true; + + // 'full' will go to true when enough args have been seen. If we loop + // again, there is an extra argument. + if (full) { + // For vectors and matrices, it's okay to have too many components + // available, but not okay to have unused arguments. + overFull = true; + } + + size += function[arg].type->computeNumComponents(); + if (op != EOpConstructStruct && ! type.isArray() && size >= type.computeNumComponents()) + full = true; + + if (function[arg].type->getQualifier().storage != EvqConst) + constType = false; + } + + if (constType) + type.getQualifier().storage = EvqConst; + + if (type.isArray()) { + if (function.getParamCount() == 0) { + error(loc, "array constructor must have at least one argument", "constructor", ""); + return true; + } + + if (type.isImplicitlySizedArray()) { + // auto adapt the constructor type to the number of arguments + type.changeOuterArraySize(function.getParamCount()); + } else if (type.getOuterArraySize() != function.getParamCount()) { + error(loc, "array constructor needs one argument per array element", "constructor", ""); + return true; + } + + if (type.isArrayOfArrays()) { + // Types have to match, but we're still making the type. + // Finish making the type, and the comparison is done later + // when checking for conversion. + TArraySizes& arraySizes = type.getArraySizes(); + + // At least the dimensionalities have to match. + if (! function[0].type->isArray() || arraySizes.getNumDims() != function[0].type->getArraySizes().getNumDims() + 1) { + error(loc, "array constructor argument not correct type to construct array element", "constructior", ""); + return true; + } + + if (arraySizes.isInnerImplicit()) { + // "Arrays of arrays ..., and the size for any dimension is optional" + // That means we need to adopt (from the first argument) the other array sizes into the type. + for (int d = 1; d < arraySizes.getNumDims(); ++d) { + if (arraySizes.getDimSize(d) == UnsizedArraySize) { + arraySizes.setDimSize(d, function[0].type->getArraySizes().getDimSize(d - 1)); + } + } + } + } + } + + if (arrayArg && op != EOpConstructStruct && ! type.isArrayOfArrays()) { + error(loc, "constructing non-array constituent from array argument", "constructor", ""); + return true; + } + + if (matrixInMatrix && ! type.isArray()) { + return false; + } + + if (overFull) { + error(loc, "too many arguments", "constructor", ""); + return true; + } + + if (op == EOpConstructStruct && ! type.isArray() && (int)type.getStruct()->size() != function.getParamCount()) { + error(loc, "Number of constructor parameters does not match the number of structure fields", "constructor", ""); + return true; + } + + if ((op != EOpConstructStruct && size != 1 && size < type.computeNumComponents()) || + (op == EOpConstructStruct && size < type.computeNumComponents())) { + error(loc, "not enough data provided for construction", "constructor", ""); + return true; + } + + TIntermTyped* typed = node->getAsTyped(); + + return false; +} + +// Verify all the correct semantics for constructing a combined texture/sampler. +// Return true if the semantics are incorrect. +bool HlslParseContext::constructorTextureSamplerError(const TSourceLoc& loc, const TFunction& function) +{ + TString constructorName = function.getType().getBasicTypeString(); // TODO: performance: should not be making copy; interface needs to change + const char* token = constructorName.c_str(); + + // exactly two arguments needed + if (function.getParamCount() != 2) { + error(loc, "sampler-constructor requires two arguments", token, ""); + return true; + } + + // For now, not allowing arrayed constructors, the rest of this function + // is set up to allow them, if this test is removed: + if (function.getType().isArray()) { + error(loc, "sampler-constructor cannot make an array of samplers", token, ""); + return true; + } + + // first argument + // * the constructor's first argument must be a texture type + // * the dimensionality (1D, 2D, 3D, Cube, Rect, Buffer, MS, and Array) + // of the texture type must match that of the constructed sampler type + // (that is, the suffixes of the type of the first argument and the + // type of the constructor will be spelled the same way) + if (function[0].type->getBasicType() != EbtSampler || + ! function[0].type->getSampler().isTexture() || + function[0].type->isArray()) { + error(loc, "sampler-constructor first argument must be a scalar textureXXX type", token, ""); + return true; + } + // 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.shadow = false; + if (texture != function[0].type->getSampler()) { + error(loc, "sampler-constructor first argument must match type and dimensionality of constructor type", token, ""); + return true; + } + + // second argument + // * the constructor's second argument must be a scalar of type + // *sampler* or *samplerShadow* + // * the presence or absence of depth comparison (Shadow) must match + // between the constructed sampler type and the type of the second argument + if (function[1].type->getBasicType() != EbtSampler || + ! function[1].type->getSampler().isPureSampler() || + function[1].type->isArray()) { + error(loc, "sampler-constructor second argument must be a scalar type 'sampler'", token, ""); + return true; + } + if (function.getType().getSampler().shadow != function[1].type->getSampler().shadow) { + error(loc, "sampler-constructor second argument presence of shadow must match constructor presence of shadow", token, ""); + return true; + } + + return false; +} + +// Checks to see if a void variable has been declared and raise an error message for such a case +// +// returns true in case of an error +// +bool HlslParseContext::voidErrorCheck(const TSourceLoc& loc, const TString& identifier, const TBasicType basicType) +{ + if (basicType == EbtVoid) { + error(loc, "illegal use of type 'void'", identifier.c_str(), ""); + return true; + } + + return false; +} + +// Checks to see if the node (for the expression) contains a scalar boolean expression or not +void HlslParseContext::boolCheck(const TSourceLoc& loc, const TIntermTyped* type) +{ + if (type->getBasicType() != EbtBool || type->isArray() || type->isMatrix() || type->isVector()) + error(loc, "boolean expression expected", "", ""); +} + +// This function checks to see if the node (for the expression) contains a scalar boolean expression or not +void HlslParseContext::boolCheck(const TSourceLoc& loc, const TPublicType& pType) +{ + if (pType.basicType != EbtBool || pType.arraySizes || pType.matrixCols > 1 || (pType.vectorSize > 1)) + error(loc, "boolean expression expected", "", ""); +} + +// +// Fix just a full qualifier (no variables or types yet, but qualifier is complete) at global level. +// +void HlslParseContext::globalQualifierFix(const TSourceLoc& loc, TQualifier& qualifier) +{ + // move from parameter/unknown qualifiers to pipeline in/out qualifiers + switch (qualifier.storage) { + case EvqIn: + qualifier.storage = EvqVaryingIn; + break; + case EvqOut: + qualifier.storage = EvqVaryingOut; + break; + default: + break; + } +} + +// +// Merge characteristics of the 'src' qualifier into the 'dst'. +// If there is duplication, issue error messages, unless 'force' +// is specified, which means to just override default settings. +// +// Also, when force is false, it will be assumed that 'src' follows +// 'dst', for the purpose of error checking order for versions +// that require specific orderings of qualifiers. +// +void HlslParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, const TQualifier& src, bool force) +{ + // Storage qualification + if (dst.storage == EvqTemporary || dst.storage == EvqGlobal) + dst.storage = src.storage; + else if ((dst.storage == EvqIn && src.storage == EvqOut) || + (dst.storage == EvqOut && src.storage == EvqIn)) + dst.storage = EvqInOut; + else if ((dst.storage == EvqIn && src.storage == EvqConst) || + (dst.storage == EvqConst && src.storage == EvqIn)) + dst.storage = EvqConstReadOnly; + else if (src.storage != EvqTemporary && src.storage != EvqGlobal) + error(loc, "too many storage qualifiers", GetStorageQualifierString(src.storage), ""); + + // Precision qualifiers + if (dst.precision == EpqNone || (force && src.precision != EpqNone)) + dst.precision = src.precision; + + // Layout qualifiers + mergeObjectLayoutQualifiers(dst, src, false); + + // individual qualifiers + bool repeated = false; +#define MERGE_SINGLETON(field) repeated |= dst.field && src.field; dst.field |= src.field; + MERGE_SINGLETON(invariant); + MERGE_SINGLETON(centroid); + MERGE_SINGLETON(smooth); + MERGE_SINGLETON(flat); + MERGE_SINGLETON(nopersp); + MERGE_SINGLETON(patch); + MERGE_SINGLETON(sample); + MERGE_SINGLETON(coherent); + MERGE_SINGLETON(volatil); + MERGE_SINGLETON(restrict); + MERGE_SINGLETON(readonly); + MERGE_SINGLETON(writeonly); + MERGE_SINGLETON(specConstant); +} + +// used to flatten the sampler type space into a single dimension +// correlates with the declaration of defaultSamplerPrecision[] +int HlslParseContext::computeSamplerTypeIndex(TSampler& sampler) +{ + int arrayIndex = sampler.arrayed ? 1 : 0; + int shadowIndex = sampler.shadow ? 1 : 0; + int externalIndex = sampler.external ? 1 : 0; + + return EsdNumDims * (EbtNumTypes * (2 * (2 * arrayIndex + shadowIndex) + externalIndex) + sampler.type) + sampler.dim; +} + +// +// Do size checking for an array type's size. +// +void HlslParseContext::arraySizeCheck(const TSourceLoc& loc, TIntermTyped* expr, TArraySize& sizePair) +{ + bool isConst = false; + sizePair.size = 1; + sizePair.node = nullptr; + + TIntermConstantUnion* constant = expr->getAsConstantUnion(); + if (constant) { + // handle true (non-specialization) constant + sizePair.size = constant->getConstArray()[0].getIConst(); + isConst = true; + } else { + // see if it's a specialization constant instead + if (expr->getQualifier().isSpecConstant()) { + isConst = true; + sizePair.node = expr; + TIntermSymbol* symbol = expr->getAsSymbolNode(); + if (symbol && symbol->getConstArray().size() > 0) + sizePair.size = symbol->getConstArray()[0].getIConst(); + } + } + + if (! isConst || (expr->getBasicType() != EbtInt && expr->getBasicType() != EbtUint)) { + error(loc, "array size must be a constant integer expression", "", ""); + return; + } + + if (sizePair.size <= 0) { + error(loc, "array size must be a positive integer", "", ""); + return; + } +} + +// +// Require array to be completely sized +// +void HlslParseContext::arraySizeRequiredCheck(const TSourceLoc& loc, const TArraySizes& arraySizes) +{ + if (arraySizes.isImplicit()) + error(loc, "array size required", "", ""); +} + +void HlslParseContext::structArrayCheck(const TSourceLoc& /*loc*/, const TType& type) +{ + const TTypeList& structure = *type.getStruct(); + for (int m = 0; m < (int)structure.size(); ++m) { + const TType& member = *structure[m].type; + if (member.isArray()) + arraySizeRequiredCheck(structure[m].loc, *member.getArraySizes()); + } +} + +// Merge array dimensions listed in 'sizes' onto the type's array dimensions. +// +// From the spec: "vec4[2] a[3]; // size-3 array of size-2 array of vec4" +// +// That means, the 'sizes' go in front of the 'type' as outermost sizes. +// 'type' is the type part of the declaration (to the left) +// 'sizes' is the arrayness tagged on the identifier (to the right) +// +void HlslParseContext::arrayDimMerge(TType& type, const TArraySizes* sizes) +{ + if (sizes) + type.addArrayOuterSizes(*sizes); +} + +// +// Do all the semantic checking for declaring or redeclaring an array, with and +// without a size, and make the right changes to the symbol table. +// +void HlslParseContext::declareArray(const TSourceLoc& loc, TString& identifier, const TType& type, TSymbol*& symbol, bool& newDeclaration) +{ + if (! symbol) { + bool currentScope; + symbol = symbolTable.find(identifier, nullptr, ¤tScope); + + if (symbol && builtInName(identifier) && ! symbolTable.atBuiltInLevel()) { + // bad shader (errors already reported) trying to redeclare a built-in name as an array + return; + } + if (symbol == nullptr || ! currentScope) { + // + // Successfully process a new definition. + // (Redeclarations have to take place at the same scope; otherwise they are hiding declarations) + // + symbol = new TVariable(&identifier, type); + symbolTable.insert(*symbol); + newDeclaration = true; + + if (! symbolTable.atBuiltInLevel()) { + if (isIoResizeArray(type)) { + ioArraySymbolResizeList.push_back(symbol); + checkIoArraysConsistency(loc, true); + } else + fixIoArraySize(loc, symbol->getWritableType()); + } + + return; + } + if (symbol->getAsAnonMember()) { + error(loc, "cannot redeclare a user-block member array", identifier.c_str(), ""); + symbol = nullptr; + return; + } + } + + // + // Process a redeclaration. + // + + if (! symbol) { + error(loc, "array variable name expected", identifier.c_str(), ""); + return; + } + + // redeclareBuiltinVariable() should have already done the copyUp() + TType& existingType = symbol->getWritableType(); + + + if (existingType.isExplicitlySizedArray()) { + // be more lenient for input arrays to geometry shaders and tessellation control outputs, where the redeclaration is the same size + if (! (isIoResizeArray(type) && existingType.getOuterArraySize() == type.getOuterArraySize())) + error(loc, "redeclaration of array with size", identifier.c_str(), ""); + return; + } + + existingType.updateArraySizes(type); + + if (isIoResizeArray(type)) + checkIoArraysConsistency(loc); +} + +void HlslParseContext::updateImplicitArraySize(const TSourceLoc& loc, TIntermNode *node, int index) +{ + // maybe there is nothing to do... + TIntermTyped* typedNode = node->getAsTyped(); + if (typedNode->getType().getImplicitArraySize() > index) + return; + + // something to do... + + // Figure out what symbol to lookup, as we will use its type to edit for the size change, + // as that type will be shared through shallow copies for future references. + TSymbol* symbol = nullptr; + int blockIndex = -1; + const TString* lookupName = nullptr; + if (node->getAsSymbolNode()) + lookupName = &node->getAsSymbolNode()->getName(); + else if (node->getAsBinaryNode()) { + const TIntermBinary* deref = node->getAsBinaryNode(); + // This has to be the result of a block dereference, unless it's bad shader code + // If it's a uniform block, then an error will be issued elsewhere, but + // return early now to avoid crashing later in this function. + if (! deref->getLeft()->getAsSymbolNode() || deref->getLeft()->getBasicType() != EbtBlock || + deref->getLeft()->getType().getQualifier().storage == EvqUniform || + deref->getRight()->getAsConstantUnion() == nullptr) + return; + + blockIndex = deref->getRight()->getAsConstantUnion()->getConstArray()[0].getIConst(); + + lookupName = &deref->getLeft()->getAsSymbolNode()->getName(); + if (IsAnonymous(*lookupName)) + lookupName = &(*deref->getLeft()->getType().getStruct())[blockIndex].type->getFieldName(); + } + + // Lookup the symbol, should only fail if shader code is incorrect + symbol = symbolTable.find(*lookupName); + if (symbol == nullptr) + return; + + if (symbol->getAsFunction()) { + error(loc, "array variable name expected", symbol->getName().c_str(), ""); + return; + } + + symbol->getWritableType().setImplicitArraySize(index + 1); +} + +// +// See if the identifier is a built-in symbol that can be redeclared, and if so, +// copy the symbol table's read-only built-in variable to the current +// global level, where it can be modified based on the passed in type. +// +// Returns nullptr if no redeclaration took place; meaning a normal declaration still +// needs to occur for it, not necessarily an error. +// +// Returns a redeclared and type-modified variable if a redeclared occurred. +// +TSymbol* HlslParseContext::redeclareBuiltinVariable(const TSourceLoc& loc, const TString& identifier, const TQualifier& qualifier, const TShaderQualifiers& publicType, bool& newDeclaration) +{ + if (! builtInName(identifier) || symbolTable.atBuiltInLevel() || ! symbolTable.atGlobalLevel()) + return nullptr; + + return nullptr; +} + +// +// Either redeclare the requested block, or give an error message why it can't be done. +// +// TODO: functionality: explicitly sizing members of redeclared blocks is not giving them an explicit size +void HlslParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newTypeList, const TString& blockName, const TString* instanceName, TArraySizes* arraySizes) +{ + // Redeclaring a built-in block... + + // Blocks with instance names are easy to find, lookup the instance name, + // Anonymous blocks need to be found via a member. + bool builtIn; + TSymbol* block; + if (instanceName) + block = symbolTable.find(*instanceName, &builtIn); + else + block = symbolTable.find(newTypeList.front().type->getFieldName(), &builtIn); + + // If the block was not found, this must be a version/profile/stage + // that doesn't have it, or the instance name is wrong. + const char* errorName = instanceName ? instanceName->c_str() : newTypeList.front().type->getFieldName().c_str(); + if (! block) { + error(loc, "no declaration found for redeclaration", errorName, ""); + return; + } + // Built-in blocks cannot be redeclared more than once, which if happened, + // we'd be finding the already redeclared one here, rather than the built in. + if (! builtIn) { + error(loc, "can only redeclare a built-in block once, and before any use", blockName.c_str(), ""); + return; + } + + // Copy the block to make a writable version, to insert into the block table after editing. + block = symbolTable.copyUpDeferredInsert(block); + + if (block->getType().getBasicType() != EbtBlock) { + error(loc, "cannot redeclare a non block as a block", errorName, ""); + return; + } + + // Edit and error check the container against the redeclaration + // - remove unused members + // - ensure remaining qualifiers/types match + TType& type = block->getWritableType(); + TTypeList::iterator member = type.getWritableStruct()->begin(); + size_t numOriginalMembersFound = 0; + while (member != type.getStruct()->end()) { + // look for match + bool found = false; + TTypeList::const_iterator newMember; + TSourceLoc memberLoc; + memberLoc.init(); + for (newMember = newTypeList.begin(); newMember != newTypeList.end(); ++newMember) { + if (member->type->getFieldName() == newMember->type->getFieldName()) { + found = true; + memberLoc = newMember->loc; + break; + } + } + + if (found) { + ++numOriginalMembersFound; + // - ensure match between redeclared members' types + // - check for things that can't be changed + // - update things that can be changed + TType& oldType = *member->type; + const TType& newType = *newMember->type; + if (! newType.sameElementType(oldType)) + error(memberLoc, "cannot redeclare block member with a different type", member->type->getFieldName().c_str(), ""); + if (oldType.isArray() != newType.isArray()) + error(memberLoc, "cannot change arrayness of redeclared block member", member->type->getFieldName().c_str(), ""); + else if (! oldType.sameArrayness(newType) && oldType.isExplicitlySizedArray()) + error(memberLoc, "cannot change array size of redeclared block member", member->type->getFieldName().c_str(), ""); + if (newType.getQualifier().isMemory()) + error(memberLoc, "cannot add memory qualifier to redeclared block member", member->type->getFieldName().c_str(), ""); + if (newType.getQualifier().hasLayout()) + error(memberLoc, "cannot add layout to redeclared block member", member->type->getFieldName().c_str(), ""); + if (newType.getQualifier().patch) + error(memberLoc, "cannot add patch to redeclared block member", member->type->getFieldName().c_str(), ""); + oldType.getQualifier().centroid = newType.getQualifier().centroid; + oldType.getQualifier().sample = newType.getQualifier().sample; + oldType.getQualifier().invariant = newType.getQualifier().invariant; + oldType.getQualifier().smooth = newType.getQualifier().smooth; + oldType.getQualifier().flat = newType.getQualifier().flat; + oldType.getQualifier().nopersp = newType.getQualifier().nopersp; + + // go to next member + ++member; + } else { + // For missing members of anonymous blocks that have been redeclared, + // hide the original (shared) declaration. + // Instance-named blocks can just have the member removed. + if (instanceName) + member = type.getWritableStruct()->erase(member); + else { + member->type->hideMember(); + ++member; + } + } + } + + if (numOriginalMembersFound < newTypeList.size()) + error(loc, "block redeclaration has extra members", blockName.c_str(), ""); + if (type.isArray() != (arraySizes != nullptr)) + error(loc, "cannot change arrayness of redeclared block", blockName.c_str(), ""); + else if (type.isArray()) { + if (type.isExplicitlySizedArray() && arraySizes->getOuterSize() == UnsizedArraySize) + error(loc, "block already declared with size, can't redeclare as implicitly-sized", blockName.c_str(), ""); + else if (type.isExplicitlySizedArray() && type.getArraySizes() != *arraySizes) + error(loc, "cannot change array size of redeclared block", blockName.c_str(), ""); + else if (type.isImplicitlySizedArray() && arraySizes->getOuterSize() != UnsizedArraySize) + type.changeOuterArraySize(arraySizes->getOuterSize()); + } + + symbolTable.insert(*block); + + // Tracking for implicit sizing of array + if (isIoResizeArray(block->getType())) { + ioArraySymbolResizeList.push_back(block); + checkIoArraysConsistency(loc, true); + } else if (block->getType().isArray()) + fixIoArraySize(loc, block->getWritableType()); + + // Save it in the AST for linker use. + intermediate.addSymbolLinkageNode(linkage, *block); +} + +void HlslParseContext::paramCheckFix(const TSourceLoc& loc, const TStorageQualifier& qualifier, TType& type) +{ + switch (qualifier) { + case EvqConst: + case EvqConstReadOnly: + type.getQualifier().storage = EvqConstReadOnly; + break; + case EvqIn: + case EvqOut: + case EvqInOut: + type.getQualifier().storage = qualifier; + break; + case EvqGlobal: + case EvqTemporary: + type.getQualifier().storage = EvqIn; + break; + default: + type.getQualifier().storage = EvqIn; + error(loc, "storage qualifier not allowed on function parameter", GetStorageQualifierString(qualifier), ""); + break; + } +} + +void HlslParseContext::paramCheckFix(const TSourceLoc& loc, const TQualifier& qualifier, TType& type) +{ + if (qualifier.isMemory()) { + type.getQualifier().volatil = qualifier.volatil; + type.getQualifier().coherent = qualifier.coherent; + type.getQualifier().readonly = qualifier.readonly; + type.getQualifier().writeonly = qualifier.writeonly; + type.getQualifier().restrict = qualifier.restrict; + } + + paramCheckFix(loc, qualifier.storage, type); +} + +void HlslParseContext::specializationCheck(const TSourceLoc& loc, const TType& type, const char* op) +{ + if (type.containsSpecializationSize()) + error(loc, "can't use with types containing arrays sized with a specialization constant", op, ""); +} + +// +// Layout qualifier stuff. +// + +// Put the id's layout qualification into the public type, for qualifiers not having a number set. +// This is before we know any type information for error checking. +void HlslParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publicType, TString& id) +{ + std::transform(id.begin(), id.end(), id.begin(), ::tolower); + + if (id == TQualifier::getLayoutMatrixString(ElmColumnMajor)) { + publicType.qualifier.layoutMatrix = ElmColumnMajor; + return; + } + if (id == TQualifier::getLayoutMatrixString(ElmRowMajor)) { + publicType.qualifier.layoutMatrix = ElmRowMajor; + return; + } + if (id == TQualifier::getLayoutPackingString(ElpPacked)) { + if (vulkan > 0) + vulkanRemoved(loc, "packed"); + publicType.qualifier.layoutPacking = ElpPacked; + return; + } + if (id == TQualifier::getLayoutPackingString(ElpShared)) { + if (vulkan > 0) + vulkanRemoved(loc, "shared"); + publicType.qualifier.layoutPacking = ElpShared; + return; + } + if (id == "push_constant") { + requireVulkan(loc, "push_constant"); + publicType.qualifier.layoutPushConstant = true; + return; + } + if (language == EShLangGeometry || language == EShLangTessEvaluation) { + if (id == TQualifier::getGeometryString(ElgTriangles)) { + publicType.shaderQualifiers.geometry = ElgTriangles; + return; + } + if (language == EShLangGeometry) { + if (id == TQualifier::getGeometryString(ElgPoints)) { + publicType.shaderQualifiers.geometry = ElgPoints; + return; + } + if (id == TQualifier::getGeometryString(ElgLineStrip)) { + publicType.shaderQualifiers.geometry = ElgLineStrip; + return; + } + if (id == TQualifier::getGeometryString(ElgLines)) { + publicType.shaderQualifiers.geometry = ElgLines; + return; + } + if (id == TQualifier::getGeometryString(ElgLinesAdjacency)) { + publicType.shaderQualifiers.geometry = ElgLinesAdjacency; + return; + } + if (id == TQualifier::getGeometryString(ElgTrianglesAdjacency)) { + publicType.shaderQualifiers.geometry = ElgTrianglesAdjacency; + return; + } + if (id == TQualifier::getGeometryString(ElgTriangleStrip)) { + publicType.shaderQualifiers.geometry = ElgTriangleStrip; + return; + } + } else { + assert(language == EShLangTessEvaluation); + + // input primitive + if (id == TQualifier::getGeometryString(ElgTriangles)) { + publicType.shaderQualifiers.geometry = ElgTriangles; + return; + } + if (id == TQualifier::getGeometryString(ElgQuads)) { + publicType.shaderQualifiers.geometry = ElgQuads; + return; + } + if (id == TQualifier::getGeometryString(ElgIsolines)) { + publicType.shaderQualifiers.geometry = ElgIsolines; + return; + } + + // vertex spacing + if (id == TQualifier::getVertexSpacingString(EvsEqual)) { + publicType.shaderQualifiers.spacing = EvsEqual; + return; + } + if (id == TQualifier::getVertexSpacingString(EvsFractionalEven)) { + publicType.shaderQualifiers.spacing = EvsFractionalEven; + return; + } + if (id == TQualifier::getVertexSpacingString(EvsFractionalOdd)) { + publicType.shaderQualifiers.spacing = EvsFractionalOdd; + return; + } + + // triangle order + if (id == TQualifier::getVertexOrderString(EvoCw)) { + publicType.shaderQualifiers.order = EvoCw; + return; + } + if (id == TQualifier::getVertexOrderString(EvoCcw)) { + publicType.shaderQualifiers.order = EvoCcw; + return; + } + + // point mode + if (id == "point_mode") { + publicType.shaderQualifiers.pointMode = true; + return; + } + } + } + if (language == EShLangFragment) { + if (id == "origin_upper_left") { + publicType.shaderQualifiers.originUpperLeft = true; + return; + } + if (id == "pixel_center_integer") { + publicType.shaderQualifiers.pixelCenterInteger = true; + return; + } + if (id == "early_fragment_tests") { + publicType.shaderQualifiers.earlyFragmentTests = true; + return; + } + for (TLayoutDepth depth = (TLayoutDepth)(EldNone + 1); depth < EldCount; depth = (TLayoutDepth)(depth + 1)) { + if (id == TQualifier::getLayoutDepthString(depth)) { + publicType.shaderQualifiers.layoutDepth = depth; + return; + } + } + if (id.compare(0, 13, "blend_support") == 0) { + bool found = false; + for (TBlendEquationShift be = (TBlendEquationShift)0; be < EBlendCount; be = (TBlendEquationShift)(be + 1)) { + if (id == TQualifier::getBlendEquationString(be)) { + requireExtensions(loc, 1, &E_GL_KHR_blend_equation_advanced, "blend equation"); + intermediate.addBlendEquation(be); + publicType.shaderQualifiers.blendEquation = true; + found = true; + break; + } + } + if (! found) + error(loc, "unknown blend equation", "blend_support", ""); + return; + } + } + error(loc, "unrecognized layout identifier, or qualifier requires assignment (e.g., binding = 4)", id.c_str(), ""); +} + +// Put the id's layout qualifier value into the public type, for qualifiers having a number set. +// This is before we know any type information for error checking. +void HlslParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publicType, TString& id, const TIntermTyped* node) +{ + const char* feature = "layout-id value"; + const char* nonLiteralFeature = "non-literal layout-id value"; + + integerCheck(node, feature); + const TIntermConstantUnion* constUnion = node->getAsConstantUnion(); + int value = 0; + if (constUnion) { + value = constUnion->getConstArray()[0].getIConst(); + } + + std::transform(id.begin(), id.end(), id.begin(), ::tolower); + + if (id == "offset") { + publicType.qualifier.layoutOffset = value; + return; + } else if (id == "align") { + // "The specified alignment must be a power of 2, or a compile-time error results." + if (! IsPow2(value)) + error(loc, "must be a power of 2", "align", ""); + else + publicType.qualifier.layoutAlign = value; + return; + } else if (id == "location") { + if ((unsigned int)value >= TQualifier::layoutLocationEnd) + error(loc, "location is too large", id.c_str(), ""); + else + publicType.qualifier.layoutLocation = value; + return; + } else if (id == "set") { + if ((unsigned int)value >= TQualifier::layoutSetEnd) + error(loc, "set is too large", id.c_str(), ""); + else + publicType.qualifier.layoutSet = value; + return; + } else if (id == "binding") { + if ((unsigned int)value >= TQualifier::layoutBindingEnd) + error(loc, "binding is too large", id.c_str(), ""); + else + publicType.qualifier.layoutBinding = value; + return; + } else if (id == "component") { + if ((unsigned)value >= TQualifier::layoutComponentEnd) + error(loc, "component is too large", id.c_str(), ""); + else + publicType.qualifier.layoutComponent = value; + return; + } else 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 + // setup." + intermediate.setXfbMode(); + if (id == "xfb_buffer") { + // "It is a compile-time error to specify an *xfb_buffer* that is greater than + // the implementation-dependent constant gl_MaxTransformFeedbackBuffers." + if (value >= resources.maxTransformFeedbackBuffers) + error(loc, "buffer is too large:", id.c_str(), "gl_MaxTransformFeedbackBuffers is %d", resources.maxTransformFeedbackBuffers); + if (value >= (int)TQualifier::layoutXfbBufferEnd) + error(loc, "buffer is too large:", id.c_str(), "internal max is %d", TQualifier::layoutXfbBufferEnd - 1); + else + publicType.qualifier.layoutXfbBuffer = value; + return; + } else if (id == "xfb_offset") { + if (value >= (int)TQualifier::layoutXfbOffsetEnd) + error(loc, "offset is too large:", id.c_str(), "internal max is %d", TQualifier::layoutXfbOffsetEnd - 1); + else + publicType.qualifier.layoutXfbOffset = value; + return; + } else if (id == "xfb_stride") { + // "The resulting stride (implicit or explicit), when divided by 4, must be less than or equal to the + // implementation-dependent constant gl_MaxTransformFeedbackInterleavedComponents." + if (value > 4 * resources.maxTransformFeedbackInterleavedComponents) + error(loc, "1/4 stride is too large:", id.c_str(), "gl_MaxTransformFeedbackInterleavedComponents is %d", resources.maxTransformFeedbackInterleavedComponents); + else if (value >= (int)TQualifier::layoutXfbStrideEnd) + error(loc, "stride is too large:", id.c_str(), "internal max is %d", TQualifier::layoutXfbStrideEnd - 1); + if (value < (int)TQualifier::layoutXfbStrideEnd) + publicType.qualifier.layoutXfbStride = value; + return; + } + } + + if (id == "input_attachment_index") { + requireVulkan(loc, "input_attachment_index"); + if (value >= (int)TQualifier::layoutAttachmentEnd) + error(loc, "attachment index is too large", id.c_str(), ""); + else + publicType.qualifier.layoutAttachment = value; + 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(), ""); + } + return; + } + + switch (language) { + case EShLangVertex: + break; + + case EShLangTessControl: + if (id == "vertices") { + if (value == 0) + error(loc, "must be greater than 0", "vertices", ""); + else + publicType.shaderQualifiers.vertices = value; + return; + } + break; + + case EShLangTessEvaluation: + break; + + case EShLangGeometry: + if (id == "invocations") { + if (value == 0) + error(loc, "must be at least 1", "invocations", ""); + else + publicType.shaderQualifiers.invocations = value; + return; + } + if (id == "max_vertices") { + publicType.shaderQualifiers.vertices = value; + if (value > resources.maxGeometryOutputVertices) + error(loc, "too large, must be less than gl_MaxGeometryOutputVertices", "max_vertices", ""); + return; + } + if (id == "stream") { + publicType.qualifier.layoutStream = value; + return; + } + break; + + case EShLangFragment: + if (id == "index") { + const char* exts[2] = { E_GL_ARB_separate_shader_objects, E_GL_ARB_explicit_attrib_location }; + publicType.qualifier.layoutIndex = value; + return; + } + break; + + case EShLangCompute: + if (id.compare(0, 11, "local_size_") == 0) { + if (id == "local_size_x") { + publicType.shaderQualifiers.localSize[0] = value; + return; + } + if (id == "local_size_y") { + publicType.shaderQualifiers.localSize[1] = value; + return; + } + if (id == "local_size_z") { + publicType.shaderQualifiers.localSize[2] = value; + return; + } + if (spv > 0) { + if (id == "local_size_x_id") { + publicType.shaderQualifiers.localSizeSpecId[0] = value; + return; + } + if (id == "local_size_y_id") { + publicType.shaderQualifiers.localSizeSpecId[1] = value; + return; + } + if (id == "local_size_z_id") { + publicType.shaderQualifiers.localSizeSpecId[2] = value; + return; + } + } + } + break; + + default: + break; + } + + error(loc, "there is no such layout identifier for this stage taking an assigned value", id.c_str(), ""); +} + +// Merge any layout qualifier information from src into dst, leaving everything else in dst alone +// +// "More than one layout qualifier may appear in a single declaration. +// Additionally, the same layout-qualifier-name can occur multiple times +// within a layout qualifier or across multiple layout qualifiers in the +// same declaration. When the same layout-qualifier-name occurs +// multiple times, in a single declaration, the last occurrence overrides +// the former occurrence(s). Further, if such a layout-qualifier-name +// will effect subsequent declarations or other observable behavior, it +// is only the last occurrence that will have any effect, behaving as if +// the earlier occurrence(s) within the declaration are not present. +// This is also true for overriding layout-qualifier-names, where one +// overrides the other (e.g., row_major vs. column_major); only the last +// occurrence has any effect." +// +void HlslParseContext::mergeObjectLayoutQualifiers(TQualifier& dst, const TQualifier& src, bool inheritOnly) +{ + if (src.hasMatrix()) + dst.layoutMatrix = src.layoutMatrix; + if (src.hasPacking()) + dst.layoutPacking = src.layoutPacking; + + if (src.hasStream()) + dst.layoutStream = src.layoutStream; + + if (src.hasFormat()) + dst.layoutFormat = src.layoutFormat; + + if (src.hasXfbBuffer()) + dst.layoutXfbBuffer = src.layoutXfbBuffer; + + if (src.hasAlign()) + dst.layoutAlign = src.layoutAlign; + + 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.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; + } +} + +// +// Look up a function name in the symbol table, and make sure it is a function. +// +// Return the function symbol if found, otherwise nullptr. +// +const TFunction* HlslParseContext::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; + } + + // first, look for an exact match + TSymbol* symbol = symbolTable.find(call.getMangledName(), &builtIn); + if (symbol) + return symbol->getAsFunction(); + + // exact match not found, look through a list of overloaded functions of the same name + + const TFunction* candidate = nullptr; + TVector candidateList; + symbolTable.findFunctionNameList(call.getMangledName(), candidateList, builtIn); + + for (TVector::const_iterator it = candidateList.begin(); it != candidateList.end(); ++it) { + const TFunction& function = *(*it); + + // to even be a potential match, number of arguments has to match + if (call.getParamCount() != function.getParamCount()) + continue; + + bool possibleMatch = true; + for (int i = 0; i < function.getParamCount(); ++i) { + // same types is easy + if (*function[i].type == *call[i].type) + continue; + + // We have a mismatch in type, see if it is implicitly convertible + + if (function[i].type->isArray() || call[i].type->isArray() || + ! function[i].type->sameElementShape(*call[i].type)) + possibleMatch = false; + else { + // do direction-specific checks for conversion of basic type + if (function[i].type->getQualifier().isParamInput()) { + if (! intermediate.canImplicitlyPromote(call[i].type->getBasicType(), function[i].type->getBasicType())) + possibleMatch = false; + } + if (function[i].type->getQualifier().isParamOutput()) { + if (! intermediate.canImplicitlyPromote(function[i].type->getBasicType(), call[i].type->getBasicType())) + possibleMatch = false; + } + } + if (! possibleMatch) + break; + } + if (possibleMatch) { + if (candidate) { + // our second match, meaning ambiguity + error(loc, "ambiguous function signature match: multiple signatures match under implicit type conversion", call.getName().c_str(), ""); + } else + candidate = &function; + } + } + + if (candidate == nullptr) + error(loc, "no matching overloaded function found", call.getName().c_str(), ""); + + return candidate; +} + +// +// Do everything necessary to handle a variable (non-block) declaration. +// Either redeclaring a variable, or making a new one, updating the symbol +// table, and all error checking. +// +// Returns a subtree node that computes an initializer, if needed. +// Returns nullptr if there is no code to execute for initialization. +// +// 'publicType' is the type part of the declaration (to the left) +// 'arraySizes' is the arrayness tagged on the identifier (to the right) +// +TIntermNode* HlslParseContext::declareVariable(const TSourceLoc& loc, TString& identifier, const TType& parseType, TArraySizes* arraySizes, TIntermTyped* initializer) +{ + TType type; + type.shallowCopy(parseType); + if (type.isImplicitlySizedArray()) { + // Because "int[] a = int[2](...), b = int[3](...)" makes two arrays a and b + // of different sizes, for this case sharing the shallow copy of arrayness + // with the publicType oversubscribes it, so get a deep copy of the arrayness. + type.newArraySizes(*parseType.getArraySizes()); + } + + if (voidErrorCheck(loc, identifier, type.getBasicType())) + return nullptr; + + // Check for redeclaration of built-ins and/or attempting to declare a reserved name + bool newDeclaration = false; // true if a new entry gets added to the symbol table + TSymbol* symbol = nullptr; // = redeclareBuiltinVariable(loc, identifier, type.getQualifier(), publicType.shaderQualifiers, newDeclaration); + + inheritGlobalDefaults(type.getQualifier()); + + // Declare the variable + if (arraySizes || type.isArray()) { + // Arrayness is potentially coming both from the type and from the + // variable: "int[] a[];" or just one or the other. + // Merge it all to the type, so all arrayness is part of the type. + arrayDimMerge(type, arraySizes); + declareArray(loc, identifier, type, symbol, newDeclaration); + } else { + // non-array case + if (! symbol) + symbol = declareNonArray(loc, identifier, type, newDeclaration); + else if (type != symbol->getType()) + error(loc, "cannot change the type of", "redeclaration", symbol->getName().c_str()); + } + + if (! symbol) + return nullptr; + + // Deal with initializer + TIntermNode* initNode = nullptr; + if (symbol && initializer) { + TVariable* variable = symbol->getAsVariable(); + if (! variable) { + error(loc, "initializer requires a variable, not a member", identifier.c_str(), ""); + return nullptr; + } + initNode = executeInitializer(loc, initializer, variable); + } + + // see if it's a linker-level object to track + if (newDeclaration && symbolTable.atGlobalLevel()) + intermediate.addSymbolLinkageNode(linkage, *symbol); + + return initNode; +} + +// Pick up global defaults from the provide global defaults into dst. +void HlslParseContext::inheritGlobalDefaults(TQualifier& dst) const +{ + if (dst.storage == EvqVaryingOut) { + if (! dst.hasStream() && language == EShLangGeometry) + dst.layoutStream = globalOutputDefaults.layoutStream; + if (! dst.hasXfbBuffer()) + dst.layoutXfbBuffer = globalOutputDefaults.layoutXfbBuffer; + } +} + +// +// Make an internal-only variable whose name is for debug purposes only +// and won't be searched for. Callers will only use the return value to use +// the variable, not the name to look it up. It is okay if the name +// is the same as other names; there won't be any conflict. +// +TVariable* HlslParseContext::makeInternalVariable(const char* name, const TType& type) const +{ + TString* nameString = new TString(name); + TVariable* variable = new TVariable(nameString, type); + symbolTable.makeInternalVariable(*variable); + + return variable; +} + +// +// Declare a non-array variable, the main point being there is no redeclaration +// for resizing allowed. +// +// Return the successfully declared variable. +// +TVariable* HlslParseContext::declareNonArray(const TSourceLoc& loc, TString& identifier, TType& type, bool& newDeclaration) +{ + // make a new variable + TVariable* variable = new TVariable(&identifier, type); + + // add variable to symbol table + if (! symbolTable.insert(*variable)) { + error(loc, "redefinition", variable->getName().c_str(), ""); + return nullptr; + } else { + newDeclaration = true; + return variable; + } +} + +// +// Handle all types of initializers from the grammar. +// +// Returning nullptr just means there is no code to execute to handle the +// initializer, which will, for example, be the case for constant initializers. +// +TIntermNode* HlslParseContext::executeInitializer(const TSourceLoc& loc, TIntermTyped* initializer, TVariable* variable) +{ + // + // Identifier must be of type constant, a global, or a temporary, and + // starting at version 120, desktop allows uniforms to have initializers. + // + TStorageQualifier qualifier = variable->getType().getQualifier().storage; + + // + // If the initializer was from braces { ... }, we convert the whole subtree to a + // constructor-style subtree, allowing the rest of the code to operate + // identically for both kinds of initializers. + // + initializer = convertInitializerList(loc, variable->getType(), initializer); + if (! initializer) { + // error recovery; don't leave const without constant values + if (qualifier == EvqConst) + variable->getWritableType().getQualifier().storage = EvqTemporary; + return nullptr; + } + + // Fix outer arrayness if variable is unsized, getting size from the initializer + if (initializer->getType().isExplicitlySizedArray() && + variable->getType().isImplicitlySizedArray()) + variable->getWritableType().changeOuterArraySize(initializer->getType().getOuterArraySize()); + + // Inner arrayness can also get set by an initializer + if (initializer->getType().isArrayOfArrays() && variable->getType().isArrayOfArrays() && + initializer->getType().getArraySizes()->getNumDims() == + variable->getType().getArraySizes()->getNumDims()) { + // adopt unsized sizes from the initializer's sizes + for (int d = 1; d < variable->getType().getArraySizes()->getNumDims(); ++d) { + if (variable->getType().getArraySizes()->getDimSize(d) == UnsizedArraySize) + variable->getWritableType().getArraySizes().setDimSize(d, initializer->getType().getArraySizes()->getDimSize(d)); + } + } + + // Uniform and global consts require a constant initializer + if (qualifier == EvqUniform && initializer->getType().getQualifier().storage != EvqConst) { + error(loc, "uniform initializers must be constant", "=", "'%s'", variable->getType().getCompleteString().c_str()); + variable->getWritableType().getQualifier().storage = EvqTemporary; + return nullptr; + } + if (qualifier == EvqConst && symbolTable.atGlobalLevel() && initializer->getType().getQualifier().storage != EvqConst) { + error(loc, "global const initializers must be constant", "=", "'%s'", variable->getType().getCompleteString().c_str()); + variable->getWritableType().getQualifier().storage = EvqTemporary; + return nullptr; + } + + // Const variables require a constant initializer, depending on version + if (qualifier == EvqConst) { + if (initializer->getType().getQualifier().storage != EvqConst) { + variable->getWritableType().getQualifier().storage = EvqConstReadOnly; + qualifier = EvqConstReadOnly; + } + } + + if (qualifier == EvqConst || qualifier == EvqUniform) { + // Compile-time tagging of the variable with its constant value... + + initializer = intermediate.addConversion(EOpAssign, variable->getType(), initializer); + if (! initializer || ! initializer->getAsConstantUnion() || variable->getType() != initializer->getType()) { + error(loc, "non-matching or non-convertible constant type for const initializer", + variable->getType().getStorageQualifierString(), ""); + variable->getWritableType().getQualifier().storage = EvqTemporary; + return nullptr; + } + + variable->setConstArray(initializer->getAsConstantUnion()->getConstArray()); + } else { + // normal assigning of a value to a variable... + specializationCheck(loc, initializer->getType(), "initializer"); + TIntermSymbol* intermSymbol = intermediate.addSymbol(*variable, loc); + TIntermNode* initNode = intermediate.addAssign(EOpAssign, intermSymbol, initializer, loc); + if (! initNode) + assignError(loc, "=", intermSymbol->getCompleteString(), initializer->getCompleteString()); + + return initNode; + } + + return nullptr; +} + +// +// Reprocess any initializer-list { ... } parts of the initializer. +// Need to hierarchically assign correct types and implicit +// conversions. Will do this mimicking the same process used for +// creating a constructor-style initializer, ensuring we get the +// same form. +// +TIntermTyped* HlslParseContext::convertInitializerList(const TSourceLoc& loc, const TType& type, TIntermTyped* initializer) +{ + // Will operate recursively. Once a subtree is found that is constructor style, + // everything below it is already good: Only the "top part" of the initializer + // can be an initializer list, where "top part" can extend for several (or all) levels. + + // see if we have bottomed out in the tree within the initializer-list part + TIntermAggregate* initList = initializer->getAsAggregate(); + if (! initList || initList->getOp() != EOpNull) + return initializer; + + // Of the initializer-list set of nodes, need to process bottom up, + // so recurse deep, then process on the way up. + + // Go down the tree here... + if (type.isArray()) { + // The type's array might be unsized, which could be okay, so base sizes on the size of the aggregate. + // Later on, initializer execution code will deal with array size logic. + TType arrayType; + arrayType.shallowCopy(type); // sharing struct stuff is fine + arrayType.newArraySizes(*type.getArraySizes()); // but get a fresh copy of the array information, to edit below + + // edit array sizes to fill in unsized dimensions + arrayType.changeOuterArraySize((int)initList->getSequence().size()); + TIntermTyped* firstInit = initList->getSequence()[0]->getAsTyped(); + if (arrayType.isArrayOfArrays() && firstInit->getType().isArray() && + arrayType.getArraySizes().getNumDims() == firstInit->getType().getArraySizes()->getNumDims() + 1) { + for (int d = 1; d < arrayType.getArraySizes().getNumDims(); ++d) { + if (arrayType.getArraySizes().getDimSize(d) == UnsizedArraySize) + arrayType.getArraySizes().setDimSize(d, firstInit->getType().getArraySizes()->getDimSize(d - 1)); + } + } + + TType elementType(arrayType, 0); // dereferenced type + for (size_t i = 0; i < initList->getSequence().size(); ++i) { + initList->getSequence()[i] = convertInitializerList(loc, elementType, initList->getSequence()[i]->getAsTyped()); + if (initList->getSequence()[i] == nullptr) + return nullptr; + } + + return addConstructor(loc, initList, arrayType, mapTypeToConstructorOp(arrayType)); + } else if (type.isStruct()) { + if (type.getStruct()->size() != initList->getSequence().size()) { + error(loc, "wrong number of structure members", "initializer list", ""); + return nullptr; + } + for (size_t i = 0; i < type.getStruct()->size(); ++i) { + initList->getSequence()[i] = convertInitializerList(loc, *(*type.getStruct())[i].type, initList->getSequence()[i]->getAsTyped()); + if (initList->getSequence()[i] == nullptr) + return nullptr; + } + } else if (type.isMatrix()) { + if (type.getMatrixCols() != (int)initList->getSequence().size()) { + error(loc, "wrong number of matrix columns:", "initializer list", type.getCompleteString().c_str()); + return nullptr; + } + TType vectorType(type, 0); // dereferenced type + for (int i = 0; i < type.getMatrixCols(); ++i) { + initList->getSequence()[i] = convertInitializerList(loc, vectorType, initList->getSequence()[i]->getAsTyped()); + if (initList->getSequence()[i] == nullptr) + return nullptr; + } + } else if (type.isVector()) { + if (type.getVectorSize() != (int)initList->getSequence().size()) { + error(loc, "wrong vector size (or rows in a matrix column):", "initializer list", type.getCompleteString().c_str()); + return nullptr; + } + } else { + error(loc, "unexpected initializer-list type:", "initializer list", type.getCompleteString().c_str()); + return nullptr; + } + + // now that the subtree is processed, process this node + return addConstructor(loc, initList, type, mapTypeToConstructorOp(type)); +} + +// +// Test for the correctness of the parameters passed to various constructor functions +// and also convert them to the right data type, if allowed and required. +// +// Returns nullptr for an error or the constructed node (aggregate or typed) for no error. +// +TIntermTyped* HlslParseContext::addConstructor(const TSourceLoc& loc, TIntermNode* node, const TType& type, TOperator op) +{ + if (node == nullptr || node->getAsTyped() == nullptr) + return nullptr; + + TIntermAggregate* aggrNode = node->getAsAggregate(); + + // Combined texture-sampler constructors are completely semantic checked + // in constructorTextureSamplerError() + if (op == EOpConstructTextureSampler) + return intermediate.setAggregateOperator(aggrNode, op, type, loc); + + TTypeList::const_iterator memberTypes; + if (op == EOpConstructStruct) + memberTypes = type.getStruct()->begin(); + + TType elementType; + if (type.isArray()) { + TType dereferenced(type, 0); + elementType.shallowCopy(dereferenced); + } else + elementType.shallowCopy(type); + + bool singleArg; + if (aggrNode) { + if (aggrNode->getOp() != EOpNull || aggrNode->getSequence().size() == 1) + singleArg = true; + else + singleArg = false; + } else + singleArg = true; + + TIntermTyped *newNode; + if (singleArg) { + // If structure constructor or array constructor is being called + // for only one parameter inside the structure, we need to call constructAggregate function once. + if (type.isArray()) + newNode = constructAggregate(node, elementType, 1, node->getLoc()); + else if (op == EOpConstructStruct) + newNode = constructAggregate(node, *(*memberTypes).type, 1, node->getLoc()); + else + newNode = constructBuiltIn(type, op, node->getAsTyped(), node->getLoc(), false); + + if (newNode && (type.isArray() || op == EOpConstructStruct)) + newNode = intermediate.setAggregateOperator(newNode, EOpConstructStruct, type, loc); + + return newNode; + } + + // + // Handle list of arguments. + // + TIntermSequence &sequenceVector = aggrNode->getSequence(); // Stores the information about the parameter to the constructor + // if the structure constructor contains more than one parameter, then construct + // each parameter + + int paramCount = 0; // keeps a track of the constructor parameter number being checked + + // for each parameter to the constructor call, check to see if the right type is passed or convert them + // to the right type if possible (and allowed). + // for structure constructors, just check if the right type is passed, no conversion is allowed. + + for (TIntermSequence::iterator p = sequenceVector.begin(); + p != sequenceVector.end(); p++, paramCount++) { + if (type.isArray()) + newNode = constructAggregate(*p, elementType, paramCount + 1, node->getLoc()); + else if (op == EOpConstructStruct) + newNode = constructAggregate(*p, *(memberTypes[paramCount]).type, paramCount + 1, node->getLoc()); + else + newNode = constructBuiltIn(type, op, (*p)->getAsTyped(), node->getLoc(), true); + + if (newNode) + *p = newNode; + else + return nullptr; + } + + TIntermTyped* constructor = intermediate.setAggregateOperator(aggrNode, op, type, loc); + + return constructor; +} + +// Function for constructor implementation. Calls addUnaryMath with appropriate EOp value +// for the parameter to the constructor (passed to this function). Essentially, it converts +// the parameter types correctly. If a constructor expects an int (like ivec2) and is passed a +// float, then float is converted to int. +// +// Returns nullptr for an error or the constructed node. +// +TIntermTyped* HlslParseContext::constructBuiltIn(const TType& type, TOperator op, TIntermTyped* node, const TSourceLoc& loc, bool subset) +{ + TIntermTyped* newNode; + TOperator basicOp; + + // + // First, convert types as needed. + // + switch (op) { + case EOpConstructVec2: + case EOpConstructVec3: + case EOpConstructVec4: + case EOpConstructMat2x2: + case EOpConstructMat2x3: + case EOpConstructMat2x4: + case EOpConstructMat3x2: + case EOpConstructMat3x3: + case EOpConstructMat3x4: + case EOpConstructMat4x2: + case EOpConstructMat4x3: + case EOpConstructMat4x4: + case EOpConstructFloat: + basicOp = EOpConstructFloat; + break; + + case EOpConstructDVec2: + case EOpConstructDVec3: + case EOpConstructDVec4: + case EOpConstructDMat2x2: + case EOpConstructDMat2x3: + case EOpConstructDMat2x4: + case EOpConstructDMat3x2: + case EOpConstructDMat3x3: + case EOpConstructDMat3x4: + case EOpConstructDMat4x2: + case EOpConstructDMat4x3: + case EOpConstructDMat4x4: + case EOpConstructDouble: + basicOp = EOpConstructDouble; + 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; + + default: + error(loc, "unsupported construction", "", ""); + + return nullptr; + } + newNode = intermediate.addUnaryMath(basicOp, node, node->getLoc()); + if (newNode == nullptr) { + error(loc, "can't convert", "constructor", ""); + return nullptr; + } + + // + // Now, if there still isn't an operation to do the construction, and we need one, add one. + // + + // Otherwise, skip out early. + if (subset || (newNode != node && newNode->getType() == type)) + return newNode; + + // setAggregateOperator will insert a new node for the constructor, as needed. + return intermediate.setAggregateOperator(newNode, op, type, loc); +} + +// This function tests for the type of the parameters to the structure or array constructor. Raises +// an error message if the expected type does not match the parameter passed to the constructor. +// +// Returns nullptr for an error or the input node itself if the expected and the given parameter types match. +// +TIntermTyped* HlslParseContext::constructAggregate(TIntermNode* node, const TType& type, int paramCount, const TSourceLoc& loc) +{ + TIntermTyped* converted = intermediate.addConversion(EOpConstructStruct, type, node->getAsTyped()); + if (! converted || converted->getType() != type) { + error(loc, "", "constructor", "cannot convert parameter %d from '%s' to '%s'", paramCount, + node->getAsTyped()->getType().getCompleteString().c_str(), type.getCompleteString().c_str()); + + return nullptr; + } + + return converted; +} + +// +// Do everything needed to add an interface block. +// +void HlslParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, const TString* instanceName, TArraySizes* arraySizes) +{ + // fix and check for member storage qualifiers and types that don't belong within a block + for (unsigned int member = 0; member < typeList.size(); ++member) { + TType& memberType = *typeList[member].type; + TQualifier& memberQualifier = memberType.getQualifier(); + const TSourceLoc& memberLoc = typeList[member].loc; + globalQualifierFix(memberLoc, memberQualifier); + memberQualifier.storage = currentBlockQualifier.storage; + } + + // This might be a redeclaration of a built-in block. If so, redeclareBuiltinBlock() will + // do all the rest. + if (! symbolTable.atBuiltInLevel() && builtInName(*blockName)) { + redeclareBuiltinBlock(loc, typeList, *blockName, instanceName, arraySizes); + return; + } + + // Make default block qualification, and adjust the member qualifications + + TQualifier defaultQualification; + switch (currentBlockQualifier.storage) { + case EvqUniform: defaultQualification = globalUniformDefaults; break; + case EvqBuffer: defaultQualification = globalBufferDefaults; break; + case EvqVaryingIn: defaultQualification = globalInputDefaults; break; + case EvqVaryingOut: defaultQualification = globalOutputDefaults; break; + default: defaultQualification.clear(); break; + } + + // 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()) + currentBlockQualifier.layoutPacking = ElpStd430; + + // fix and check for member layout qualifiers + + mergeObjectLayoutQualifiers(defaultQualification, currentBlockQualifier, true); + + bool memberWithLocation = false; + bool memberWithoutLocation = false; + for (unsigned int member = 0; member < typeList.size(); ++member) { + TQualifier& memberQualifier = typeList[member].type->getQualifier(); + const TSourceLoc& memberLoc = typeList[member].loc; + if (memberQualifier.hasStream()) { + if (defaultQualification.layoutStream != memberQualifier.layoutStream) + error(memberLoc, "member cannot contradict block", "stream", ""); + } + + // "This includes a block's inheritance of the + // current global default buffer, a block member's inheritance of the block's + // buffer, and the requirement that any *xfb_buffer* declared on a block + // member must match the buffer inherited from the block." + if (memberQualifier.hasXfbBuffer()) { + if (defaultQualification.layoutXfbBuffer != memberQualifier.layoutXfbBuffer) + error(memberLoc, "member cannot contradict block (or what block inherited from global)", "xfb_buffer", ""); + } + + if (memberQualifier.hasPacking()) + error(memberLoc, "member of block cannot have a packing layout qualifier", typeList[member].type->getFieldName().c_str(), ""); + if (memberQualifier.hasLocation()) { + switch (currentBlockQualifier.storage) { + case EvqVaryingIn: + case EvqVaryingOut: + memberWithLocation = true; + break; + default: + break; + } + } else + memberWithoutLocation = true; + if (memberQualifier.hasAlign()) { + if (defaultQualification.layoutPacking != ElpStd140 && defaultQualification.layoutPacking != ElpStd430) + error(memberLoc, "can only be used with std140 or std430 layout packing", "align", ""); + } + + TQualifier newMemberQualification = defaultQualification; + mergeQualifiers(memberLoc, newMemberQualification, memberQualifier, false); + memberQualifier = newMemberQualification; + } + + // Process the members + fixBlockLocations(loc, currentBlockQualifier, typeList, memberWithLocation, memberWithoutLocation); + fixBlockXfbOffsets(currentBlockQualifier, typeList); + fixBlockUniformOffsets(currentBlockQualifier, typeList); + + // reverse merge, so that currentBlockQualifier now has all layout information + // (can't use defaultQualification directly, it's missing other non-layout-default-class qualifiers) + mergeObjectLayoutQualifiers(currentBlockQualifier, defaultQualification, true); + + // + // Build and add the interface block as a new type named 'blockName' + // + + TType blockType(&typeList, *blockName, currentBlockQualifier); + if (arraySizes) + blockType.newArraySizes(*arraySizes); + + // + // 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. + // + // "Block names have no other use within a shader + // beyond interface matching; it is a compile-time error to use a block name at global scope for anything + // other than as a block name (e.g., use of a block name for a global variable name or function name is + // currently reserved)." + // + // Use the symbol table to prevent normal reuse of the block's name, as a variable entry, + // whose type is EbtBlock, but without all the structure; that will come from the type + // the instances point to. + // + TType blockNameType(EbtBlock, blockType.getQualifier().storage); + TVariable* blockNameVar = new TVariable(blockName, blockNameType); + if (! symbolTable.insert(*blockNameVar)) { + TSymbol* existingName = symbolTable.find(*blockName); + if (existingName->getType().getBasicType() == EbtBlock) { + if (existingName->getType().getQualifier().storage == blockType.getQualifier().storage) { + error(loc, "Cannot reuse block name within the same interface:", blockName->c_str(), blockType.getStorageQualifierString()); + return; + } + } else { + error(loc, "block name cannot redefine a non-block name", blockName->c_str(), ""); + return; + } + } + + // Add the variable, as anonymous or named instanceName. + // Make an anonymous variable if no name was provided. + if (! instanceName) + instanceName = NewPoolTString(""); + + TVariable& variable = *new TVariable(instanceName, blockType); + if (! symbolTable.insert(variable)) { + if (*instanceName == "") + error(loc, "nameless block contains a member that already has a name at global scope", blockName->c_str(), ""); + else + error(loc, "block instance name redefinition", variable.getName().c_str(), ""); + + return; + } + + if (isIoResizeArray(blockType)) { + ioArraySymbolResizeList.push_back(&variable); + checkIoArraysConsistency(loc, true); + } else + fixIoArraySize(loc, variable.getWritableType()); + + // Save it in the AST for linker use. + intermediate.addSymbolLinkageNode(linkage, variable); +} + +// +// "For a block, this process applies to the entire block, or until the first member +// is reached that has a location layout qualifier. When a block member is declared with a location +// qualifier, its location comes from that qualifier: The member's location qualifier overrides the block-level +// declaration. Subsequent members are again assigned consecutive locations, based on the newest location, +// until the next member declared with a location qualifier. The values used for locations do not have to be +// declared in increasing order." +void HlslParseContext::fixBlockLocations(const TSourceLoc& loc, TQualifier& qualifier, TTypeList& typeList, bool memberWithLocation, bool memberWithoutLocation) +{ + // "If a block has no block-level location layout qualifier, it is required that either all or none of its members + // have a location layout qualifier, or a compile-time error results." + if (! qualifier.hasLocation() && memberWithLocation && memberWithoutLocation) + error(loc, "either the block needs a location, or all members need a location, or no members have a location", "location", ""); + else { + if (memberWithLocation) { + // remove any block-level location and make it per *every* member + int nextLocation = 0; // by the rule above, initial value is not relevant + if (qualifier.hasAnyLocation()) { + nextLocation = qualifier.layoutLocation; + qualifier.layoutLocation = TQualifier::layoutLocationEnd; + if (qualifier.hasComponent()) { + // "It is a compile-time error to apply the *component* qualifier to a ... block" + error(loc, "cannot apply to a block", "component", ""); + } + if (qualifier.hasIndex()) { + error(loc, "cannot apply to a block", "index", ""); + } + } + for (unsigned int member = 0; member < typeList.size(); ++member) { + TQualifier& memberQualifier = typeList[member].type->getQualifier(); + const TSourceLoc& memberLoc = typeList[member].loc; + if (! memberQualifier.hasLocation()) { + if (nextLocation >= (int)TQualifier::layoutLocationEnd) + error(memberLoc, "location is too large", "location", ""); + memberQualifier.layoutLocation = nextLocation; + memberQualifier.layoutComponent = 0; + } + nextLocation = memberQualifier.layoutLocation + intermediate.computeTypeLocationSize(*typeList[member].type); + } + } + } +} + +void HlslParseContext::fixBlockXfbOffsets(TQualifier& qualifier, TTypeList& typeList) +{ + // "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 + // offsets." + + if (! qualifier.hasXfbBuffer() || ! qualifier.hasXfbOffset()) + return; + + int nextOffset = qualifier.layoutXfbOffset; + for (unsigned int member = 0; member < typeList.size(); ++member) { + TQualifier& memberQualifier = typeList[member].type->getQualifier(); + bool containsDouble = false; + int memberSize = intermediate.computeTypeXfbSize(*typeList[member].type, containsDouble); + // see if we need to auto-assign an offset to this member + if (! memberQualifier.hasXfbOffset()) { + // "if applied to an aggregate containing a double, the offset must also be a multiple of 8" + if (containsDouble) + RoundToPow2(nextOffset, 8); + memberQualifier.layoutXfbOffset = nextOffset; + } else + nextOffset = memberQualifier.layoutXfbOffset; + nextOffset += memberSize; + } + + // 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; +} + +// Calculate and save the offset of each block member, using the recursively +// defined block offset rules and the user-provided offset and align. +// +// Also, compute and save the total size of the block. For the block's size, arrayness +// is not taken into account, as each element is backed by a separate buffer. +// +void HlslParseContext::fixBlockUniformOffsets(TQualifier& qualifier, TTypeList& typeList) +{ + if (! qualifier.isUniformOrBuffer()) + return; + if (qualifier.layoutPacking != ElpStd140 && qualifier.layoutPacking != ElpStd430) + return; + + int offset = 0; + int memberSize; + for (unsigned int member = 0; member < typeList.size(); ++member) { + TQualifier& memberQualifier = typeList[member].type->getQualifier(); + const TSourceLoc& memberLoc = typeList[member].loc; + + // "When align is applied to an array, it effects only the start of the array, not the array's internal stride." + + // modify just the children's view of matrix layout, if there is one for this member + TLayoutMatrix subMatrixLayout = typeList[member].type->getQualifier().layoutMatrix; + int dummyStride; + int memberAlignment = intermediate.getBaseAlignment(*typeList[member].type, memberSize, dummyStride, qualifier.layoutPacking == ElpStd140, + subMatrixLayout != ElmNone ? subMatrixLayout == ElmRowMajor : qualifier.layoutMatrix == ElmRowMajor); + if (memberQualifier.hasOffset()) { + // "The specified offset must be a multiple + // of the base alignment of the type of the block member it qualifies, or a compile-time error results." + if (! IsMultipleOfPow2(memberQualifier.layoutOffset, memberAlignment)) + error(memberLoc, "must be a multiple of the member's alignment", "offset", ""); + + // "It is a compile-time error to specify an offset that is smaller than the offset of the previous + // member in the block or that lies within the previous member of the block" + if (memberQualifier.layoutOffset < offset) + error(memberLoc, "cannot lie in previous members", "offset", ""); + + // "The offset qualifier forces the qualified member to start at or after the specified + // integral-constant expression, which will be its byte offset from the beginning of the buffer. + // "The actual offset of a member is computed as + // follows: If offset was declared, start with that offset, otherwise start with the next available offset." + offset = std::max(offset, memberQualifier.layoutOffset); + } + + // "The actual alignment of a member will be the greater of the specified align alignment and the standard + // (e.g., std140) base alignment for the member's type." + if (memberQualifier.hasAlign()) + memberAlignment = std::max(memberAlignment, memberQualifier.layoutAlign); + + // "If the resulting offset is not a multiple of the actual alignment, + // increase it to the first offset that is a multiple of + // the actual alignment." + RoundToPow2(offset, memberAlignment); + typeList[member].type->getQualifier().layoutOffset = offset; + offset += memberSize; + } +} + +// For an identifier that is already declared, add more qualification to it. +void HlslParseContext::addQualifierToExisting(const TSourceLoc& loc, TQualifier qualifier, const TString& identifier) +{ + TSymbol* symbol = symbolTable.find(identifier); + if (! symbol) { + error(loc, "identifier not previously declared", identifier.c_str(), ""); + return; + } + if (symbol->getAsFunction()) { + error(loc, "cannot re-qualify a function name", identifier.c_str(), ""); + return; + } + + if (qualifier.isAuxiliary() || + qualifier.isMemory() || + qualifier.isInterpolation() || + qualifier.hasLayout() || + qualifier.storage != EvqTemporary || + qualifier.precision != EpqNone) { + error(loc, "cannot add storage, auxiliary, memory, interpolation, layout, or precision qualifier to an existing variable", identifier.c_str(), ""); + return; + } + + // For read-only built-ins, add a new symbol for holding the modified qualifier. + // This will bring up an entire block, if a block type has to be modified (e.g., gl_Position inside a block) + if (symbol->isReadOnly()) + symbol = symbolTable.copyUp(symbol); + + if (qualifier.invariant) { + if (intermediate.inIoAccessed(identifier)) + error(loc, "cannot change qualification after use", "invariant", ""); + symbol->getWritableType().getQualifier().invariant = true; + } else + warn(loc, "unknown requalification", "", ""); +} + +void HlslParseContext::addQualifierToExisting(const TSourceLoc& loc, TQualifier qualifier, TIdentifierList& identifiers) +{ + for (unsigned int i = 0; i < identifiers.size(); ++i) + addQualifierToExisting(loc, qualifier, *identifiers[i]); +} + +// +// Updating default qualifier for the case of a declaration with just a qualifier, +// no type, block, or identifier. +// +void HlslParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, const TPublicType& publicType) +{ + if (publicType.shaderQualifiers.vertices != TQualifier::layoutNotSet) { + assert(language == EShLangTessControl || language == EShLangGeometry); + const char* id = (language == EShLangTessControl) ? "vertices" : "max_vertices"; + + if (language == EShLangTessControl) + checkIoArraysConsistency(loc); + } + if (publicType.shaderQualifiers.invocations != TQualifier::layoutNotSet) { + if (! intermediate.setInvocations(publicType.shaderQualifiers.invocations)) + error(loc, "cannot change previously set layout value", "invocations", ""); + } + if (publicType.shaderQualifiers.geometry != ElgNone) { + if (publicType.qualifier.storage == EvqVaryingIn) { + switch (publicType.shaderQualifiers.geometry) { + case ElgPoints: + case ElgLines: + case ElgLinesAdjacency: + case ElgTriangles: + case ElgTrianglesAdjacency: + case ElgQuads: + case ElgIsolines: + if (intermediate.setInputPrimitive(publicType.shaderQualifiers.geometry)) { + if (language == EShLangGeometry) + checkIoArraysConsistency(loc); + } else + error(loc, "cannot change previously set input primitive", TQualifier::getGeometryString(publicType.shaderQualifiers.geometry), ""); + break; + default: + error(loc, "cannot apply to input", TQualifier::getGeometryString(publicType.shaderQualifiers.geometry), ""); + } + } else if (publicType.qualifier.storage == EvqVaryingOut) { + switch (publicType.shaderQualifiers.geometry) { + case ElgPoints: + case ElgLineStrip: + case ElgTriangleStrip: + if (! intermediate.setOutputPrimitive(publicType.shaderQualifiers.geometry)) + error(loc, "cannot change previously set output primitive", TQualifier::getGeometryString(publicType.shaderQualifiers.geometry), ""); + break; + default: + error(loc, "cannot apply to 'out'", TQualifier::getGeometryString(publicType.shaderQualifiers.geometry), ""); + } + } else + error(loc, "cannot apply to:", TQualifier::getGeometryString(publicType.shaderQualifiers.geometry), GetStorageQualifierString(publicType.qualifier.storage)); + } + if (publicType.shaderQualifiers.spacing != EvsNone) + intermediate.setVertexSpacing(publicType.shaderQualifiers.spacing); + if (publicType.shaderQualifiers.order != EvoNone) + intermediate.setVertexOrder(publicType.shaderQualifiers.order); + if (publicType.shaderQualifiers.pointMode) + intermediate.setPointMode(); + for (int i = 0; i < 3; ++i) { + if (publicType.shaderQualifiers.localSize[i] > 1) { + int max = 0; + switch (i) { + case 0: max = resources.maxComputeWorkGroupSizeX; break; + case 1: max = resources.maxComputeWorkGroupSizeY; break; + case 2: max = resources.maxComputeWorkGroupSizeZ; break; + default: break; + } + if (intermediate.getLocalSize(i) > (unsigned int)max) + error(loc, "too large; see gl_MaxComputeWorkGroupSize", "local_size", ""); + + // Fix the existing constant gl_WorkGroupSize with this new information. + TVariable* workGroupSize = getEditableVariable("gl_WorkGroupSize"); + workGroupSize->getWritableConstArray()[i].setUConst(intermediate.getLocalSize(i)); + } + if (publicType.shaderQualifiers.localSizeSpecId[i] != TQualifier::layoutNotSet) { + intermediate.setLocalSizeSpecId(i, publicType.shaderQualifiers.localSizeSpecId[i]); + // Set the workgroup built-in variable as a specialization constant + TVariable* workGroupSize = getEditableVariable("gl_WorkGroupSize"); + workGroupSize->getWritableType().getQualifier().specConstant = true; + } + } + if (publicType.shaderQualifiers.earlyFragmentTests) + intermediate.setEarlyFragmentTests(); + + const TQualifier& qualifier = publicType.qualifier; + + switch (qualifier.storage) { + case EvqUniform: + if (qualifier.hasMatrix()) + globalUniformDefaults.layoutMatrix = qualifier.layoutMatrix; + if (qualifier.hasPacking()) + globalUniformDefaults.layoutPacking = qualifier.layoutPacking; + break; + case EvqBuffer: + if (qualifier.hasMatrix()) + globalBufferDefaults.layoutMatrix = qualifier.layoutMatrix; + if (qualifier.hasPacking()) + globalBufferDefaults.layoutPacking = qualifier.layoutPacking; + break; + case EvqVaryingIn: + break; + case EvqVaryingOut: + if (qualifier.hasStream()) + globalOutputDefaults.layoutStream = qualifier.layoutStream; + if (qualifier.hasXfbBuffer()) + globalOutputDefaults.layoutXfbBuffer = qualifier.layoutXfbBuffer; + if (globalOutputDefaults.hasXfbBuffer() && qualifier.hasXfbStride()) { + if (! intermediate.setXfbBufferStride(globalOutputDefaults.layoutXfbBuffer, qualifier.layoutXfbStride)) + error(loc, "all stride settings must match for xfb buffer", "xfb_stride", "%d", qualifier.layoutXfbBuffer); + } + break; + default: + error(loc, "default qualifier requires 'uniform', 'buffer', 'in', or 'out' storage qualification", "", ""); + return; + } +} + +// +// Take the sequence of statements that has been built up since the last case/default, +// put it on the list of top-level nodes for the current (inner-most) switch statement, +// and follow that by the case/default we are on now. (See switch topology comment on +// TIntermSwitch.) +// +void HlslParseContext::wrapupSwitchSubsequence(TIntermAggregate* statements, TIntermNode* branchNode) +{ + TIntermSequence* switchSequence = switchSequenceStack.back(); + + if (statements) { + if (switchSequence->size() == 0) + error(statements->getLoc(), "cannot have statements before first case/default label", "switch", ""); + statements->setOperator(EOpSequence); + switchSequence->push_back(statements); + } + if (branchNode) { + // check all previous cases for the same label (or both are 'default') + for (unsigned int s = 0; s < switchSequence->size(); ++s) { + TIntermBranch* prevBranch = (*switchSequence)[s]->getAsBranchNode(); + if (prevBranch) { + TIntermTyped* prevExpression = prevBranch->getExpression(); + TIntermTyped* newExpression = branchNode->getAsBranchNode()->getExpression(); + if (prevExpression == nullptr && newExpression == nullptr) + error(branchNode->getLoc(), "duplicate label", "default", ""); + else if (prevExpression != nullptr && + newExpression != nullptr && + prevExpression->getAsConstantUnion() && + newExpression->getAsConstantUnion() && + prevExpression->getAsConstantUnion()->getConstArray()[0].getIConst() == + newExpression->getAsConstantUnion()->getConstArray()[0].getIConst()) + error(branchNode->getLoc(), "duplicated value", "case", ""); + } + } + switchSequence->push_back(branchNode); + } +} + +// +// Turn the top-level node sequence built up of wrapupSwitchSubsequence +// into a switch node. +// +TIntermNode* HlslParseContext::addSwitch(const TSourceLoc& loc, TIntermTyped* expression, TIntermAggregate* lastStatements) +{ + wrapupSwitchSubsequence(lastStatements, nullptr); + + if (expression == nullptr || + (expression->getBasicType() != EbtInt && expression->getBasicType() != EbtUint) || + expression->getType().isArray() || expression->getType().isMatrix() || expression->getType().isVector()) + error(loc, "condition must be a scalar integer expression", "switch", ""); + + // If there is nothing to do, drop the switch but still execute the expression + TIntermSequence* switchSequence = switchSequenceStack.back(); + if (switchSequence->size() == 0) + return expression; + + if (lastStatements == nullptr) { + // emulate a break for error recovery + lastStatements = intermediate.makeAggregate(intermediate.addBranch(EOpBreak, loc)); + lastStatements->setOperator(EOpSequence); + switchSequence->push_back(lastStatements); + } + + TIntermAggregate* body = new TIntermAggregate(EOpSequence); + body->getSequence() = *switchSequenceStack.back(); + body->setLoc(loc); + + TIntermSwitch* switchNode = new TIntermSwitch(expression, body); + switchNode->setLoc(loc); + + return switchNode; +} + +} // end namespace glslang diff --git a/hlsl/hlslParseHelper.h b/hlsl/hlslParseHelper.h new file mode 100755 index 00000000..1537cfc8 --- /dev/null +++ b/hlsl/hlslParseHelper.h @@ -0,0 +1,222 @@ +// +//Copyright (C) 2016 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. +// +#ifndef HLSL_PARSE_INCLUDED_ +#define HLSL_PARSE_INCLUDED_ + +#include "../glslang/MachineIndependent/parseVersions.h" +#include "../glslang/MachineIndependent/ParseHelper.h" + +namespace glslang { + +class HlslParseContext : public TParseContextBase { +public: + HlslParseContext(TSymbolTable&, TIntermediate&, bool parsingBuiltins, + int version, EProfile, int spv, int vulkan, EShLanguage, TInfoSink&, + bool forwardCompatible = false, EShMessages messages = EShMsgDefault); + virtual ~HlslParseContext(); + void setLimits(const TBuiltInResource&); + bool parseShaderStrings(TPpContext&, TInputScanner& input, bool versionWillBeError = false); + const char* getPreamble(); + + void C_DECL error(const TSourceLoc&, const char* szReason, const char* szToken, + const char* szExtraInfoFormat, ...); + 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, ...); + void C_DECL ppWarn(const TSourceLoc&, const char* szReason, const char* szToken, + const char* szExtraInfoFormat, ...); + + void reservedPpErrorCheck(const TSourceLoc&, const char* name, const char* op) { } + bool lineContinuationCheck(const TSourceLoc&, bool endOfComment) { return true; } + bool lineDirectiveShouldSetNextLine() const { return true; } + bool builtInName(const TString&); + + void handlePragma(const TSourceLoc&, const TVector&); + TIntermTyped* handleVariable(const TSourceLoc&, TSymbol* symbol, const TString* string); + TIntermTyped* handleBracketDereference(const TSourceLoc&, TIntermTyped* base, TIntermTyped* index); + void checkIndex(const TSourceLoc&, const TType&, int& index); + + void makeEditable(TSymbol*&); + TVariable* getEditableVariable(const char* name); + bool isIoResizeArray(const TType&) const; + void fixIoArraySize(const TSourceLoc&, TType&); + void handleIoResizeArrayAccess(const TSourceLoc&, TIntermTyped* base); + void checkIoArraysConsistency(const TSourceLoc&, bool tailOnly = false); + int getIoArrayImplicitSize() const; + void checkIoArrayConsistency(const TSourceLoc&, int requiredSize, const char* feature, TType&, const TString&); + + TIntermTyped* handleBinaryMath(const TSourceLoc&, const char* str, TOperator op, TIntermTyped* left, TIntermTyped* right); + TIntermTyped* handleUnaryMath(const TSourceLoc&, const char* str, TOperator op, TIntermTyped* childNode); + TIntermTyped* handleDotDereference(const TSourceLoc&, TIntermTyped* base, const TString& field); + TFunction* handleFunctionDeclarator(const TSourceLoc&, TFunction& function, bool prototype); + TIntermAggregate* handleFunctionDefinition(const TSourceLoc&, TFunction&); + TIntermTyped* handleFunctionCall(const TSourceLoc&, TFunction*, TIntermNode*); + TIntermTyped* handleLengthMethod(const TSourceLoc&, TFunction*, TIntermNode*); + void addInputArgumentConversions(const TFunction&, TIntermNode*&) const; + TIntermTyped* addOutputArgumentConversions(const TFunction&, TIntermAggregate&) const; + void builtInOpCheck(const TSourceLoc&, const TFunction&, TIntermOperator&); + TFunction* handleConstructorCall(const TSourceLoc&, const TPublicType&); + + bool parseVectorFields(const TSourceLoc&, const TString&, int vecSize, TVectorFields&); + void assignError(const TSourceLoc&, const char* op, TString left, TString right); + void unaryOpError(const TSourceLoc&, const char* op, TString operand); + void binaryOpError(const TSourceLoc&, const char* op, TString left, TString right); + void variableCheck(TIntermTyped*& nodePtr); + void constantValueCheck(TIntermTyped* node, const char* token); + void integerCheck(const TIntermTyped* node, const char* token); + void globalCheck(const TSourceLoc&, const char* token); + bool constructorError(const TSourceLoc&, TIntermNode*, TFunction&, TOperator, TType&); + bool constructorTextureSamplerError(const TSourceLoc&, const TFunction&); + void arraySizeCheck(const TSourceLoc&, TIntermTyped* expr, TArraySize&); + void arraySizeRequiredCheck(const TSourceLoc&, const TArraySizes&); + void structArrayCheck(const TSourceLoc&, const TType& structure); + void arrayDimMerge(TType& type, const TArraySizes* sizes); + bool voidErrorCheck(const TSourceLoc&, const TString&, TBasicType); + void boolCheck(const TSourceLoc&, const TIntermTyped*); + void boolCheck(const TSourceLoc&, const TPublicType&); + void globalQualifierFix(const TSourceLoc&, TQualifier&); + bool structQualifierErrorCheck(const TSourceLoc&, const TPublicType& pType); + void mergeQualifiers(const TSourceLoc&, TQualifier& dst, const TQualifier& src, bool force); + int computeSamplerTypeIndex(TSampler&); + TSymbol* redeclareBuiltinVariable(const TSourceLoc&, const TString&, const TQualifier&, const TShaderQualifiers&, bool& newDeclaration); + void redeclareBuiltinBlock(const TSourceLoc&, TTypeList& typeList, const TString& blockName, const TString* instanceName, TArraySizes* arraySizes); + void paramCheckFix(const TSourceLoc&, const TStorageQualifier&, TType& type); + void paramCheckFix(const TSourceLoc&, const TQualifier&, TType& type); + void specializationCheck(const TSourceLoc&, const TType&, const char* op); + + void setLayoutQualifier(const TSourceLoc&, TPublicType&, TString&); + void setLayoutQualifier(const TSourceLoc&, TPublicType&, TString&, const TIntermTyped*); + void mergeObjectLayoutQualifiers(TQualifier& dest, const TQualifier& src, bool inheritOnly); + void checkNoShaderLayouts(const TSourceLoc&, const TShaderQualifiers&); + + const TFunction* findFunction(const TSourceLoc& loc, const TFunction& call, bool& builtIn); + TIntermNode* declareVariable(const TSourceLoc&, TString& identifier, const TType&, TArraySizes* typeArray = 0, TIntermTyped* initializer = 0); + TIntermTyped* addConstructor(const TSourceLoc&, TIntermNode*, const TType&, TOperator); + TIntermTyped* constructAggregate(TIntermNode*, const TType&, int, const TSourceLoc&); + TIntermTyped* constructBuiltIn(const TType&, TOperator, TIntermTyped*, const TSourceLoc&, bool subset); + void declareBlock(const TSourceLoc&, TTypeList& typeList, const TString* instanceName = 0, TArraySizes* arraySizes = 0); + void fixBlockLocations(const TSourceLoc&, TQualifier&, TTypeList&, bool memberWithLocation, bool memberWithoutLocation); + void fixBlockXfbOffsets(TQualifier&, TTypeList&); + void fixBlockUniformOffsets(TQualifier&, TTypeList&); + void addQualifierToExisting(const TSourceLoc&, TQualifier, const TString& identifier); + void addQualifierToExisting(const TSourceLoc&, TQualifier, TIdentifierList&); + void updateStandaloneQualifierDefaults(const TSourceLoc&, const TPublicType&); + void wrapupSwitchSubsequence(TIntermAggregate* statements, TIntermNode* branchNode); + TIntermNode* addSwitch(const TSourceLoc&, TIntermTyped* expression, TIntermAggregate* body); + + void updateImplicitArraySize(const TSourceLoc&, TIntermNode*, int index); + +protected: + void inheritGlobalDefaults(TQualifier& dst) const; + TVariable* makeInternalVariable(const char* name, const TType&) const; + TVariable* declareNonArray(const TSourceLoc&, TString& identifier, TType&, bool& newDeclaration); + void declareArray(const TSourceLoc&, TString& identifier, const TType&, TSymbol*&, bool& newDeclaration); + TIntermNode* executeInitializer(const TSourceLoc&, TIntermTyped* initializer, TVariable* variable); + TIntermTyped* convertInitializerList(const TSourceLoc&, const TType&, TIntermTyped* initializer); + TOperator mapTypeToConstructorOp(const TType&) const; + void outputMessage(const TSourceLoc&, const char* szReason, const char* szToken, + const char* szExtraInfoFormat, TPrefixType prefix, + va_list args); + + // Current state of parsing + struct TPragma contextPragma; + int loopNestingLevel; // 0 if outside all loops + int structNestingLevel; // 0 if outside blocks and structures + int controlFlowNestingLevel; // 0 if outside all flow control + int statementNestingLevel; // 0 if outside all flow control or compound statements + TList switchSequenceStack; // case, node, case, case, node, ...; ensure only one node between cases; stack of them for nesting + TList switchLevel; // the statementNestingLevel the current switch statement is at, which must match the level of its case statements + bool inEntrypoint; // if inside a function, true if the function is the entry point + bool postMainReturn; // if inside a function, true if the function is the entry point and this is after a return statement + const TType* currentFunctionType; // the return type of the function that's currently being parsed + bool functionReturnsValue; // true if a non-void function has a return + const TString* blockName; + TQualifier currentBlockQualifier; + TBuiltInResource resources; + TLimits& limits; + + HlslParseContext(HlslParseContext&); + HlslParseContext& operator=(HlslParseContext&); + + TMap extensionBehavior; // for each extension string, what its current behavior is set to + static const int maxSamplerIndex = EsdNumDims * (EbtNumTypes * (2 * 2 * 2)); // see computeSamplerTypeIndex() + bool afterEOF; + TQualifier globalBufferDefaults; + TQualifier globalUniformDefaults; + TQualifier globalInputDefaults; + TQualifier globalOutputDefaults; + TString currentCaller; // name of last function body entered (not valid when at global scope) + TIdSetType inductiveLoopIds; + TVector needsIndexLimitationChecking; + + // + // Geometry shader input arrays: + // - array sizing is based on input primitive and/or explicit size + // + // Tessellation control output arrays: + // - array sizing is based on output layout(vertices=...) and/or explicit size + // + // Both: + // - array sizing is retroactive + // - built-in block redeclarations interact with this + // + // Design: + // - use a per-context "resize-list", a list of symbols whose array sizes + // can be fixed + // + // - the resize-list starts empty at beginning of user-shader compilation, it does + // not have built-ins in it + // + // - on built-in array use: copyUp() symbol and add it to the resize-list + // + // - on user array declaration: add it to the resize-list + // + // - on block redeclaration: copyUp() symbol and add it to the resize-list + // * note, that appropriately gives an error if redeclaring a block that + // was already used and hence already copied-up + // + // - on seeing a layout declaration that sizes the array, fix everything in the + // resize-list, giving errors for mismatch + // + // - on seeing an array size declaration, give errors on mismatch between it and previous + // array-sizing declarations + // + TVector ioArraySymbolResizeList; +}; + +} // end namespace glslang + +#endif // HLSL_PARSE_INCLUDED_ diff --git a/hlsl/hlslScanContext.cpp b/hlsl/hlslScanContext.cpp new file mode 100755 index 00000000..b2c85be7 --- /dev/null +++ b/hlsl/hlslScanContext.cpp @@ -0,0 +1,619 @@ +// +//Copyright (C) 2016 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 Google, Inc., 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. +// + +// +// HLSL scanning, leveraging the scanning done by the preprocessor. +// + +#include +#include +#include + +#include "../glslang/Include/Types.h" +#include "../glslang/MachineIndependent/SymbolTable.h" +#include "../glslang/MachineIndependent/ParseHelper.h" +#include "hlslScanContext.h" +#include "hlslTokens.h" +//#include "Scan.h" + +// preprocessor includes +#include "../glslang/MachineIndependent/preprocessor/PpContext.h" +#include "../glslang/MachineIndependent/preprocessor/PpTokens.h" + +namespace { + +struct str_eq +{ + bool operator()(const char* lhs, const char* rhs) const + { + return strcmp(lhs, rhs) == 0; + } +}; + +struct str_hash +{ + size_t operator()(const char* str) const + { + // djb2 + unsigned long hash = 5381; + int c; + + while ((c = *str++) != 0) + hash = ((hash << 5) + hash) + c; + + return 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; +std::unordered_set* ReservedSet = nullptr; + +}; + +namespace glslang { + +void HlslScanContext::fillInKeywordMap() +{ + if (KeywordMap != nullptr) { + // this is really an error, as this should called only once per process + // but, the only risk is if two threads called simultaneously + return; + } + KeywordMap = new std::unordered_map; + + (*KeywordMap)["static"] = EHTokStatic; + (*KeywordMap)["const"] = EHTokConst; + (*KeywordMap)["unorm"] = EHTokUnorm; + (*KeywordMap)["snorm"] = EHTokSNorm; + (*KeywordMap)["extern"] = EHTokExtern; + (*KeywordMap)["uniform"] = EHTokUniform; + (*KeywordMap)["volatile"] = EHTokVolatile; + (*KeywordMap)["shared"] = EHTokShared; + (*KeywordMap)["groupshared"] = EHTokGroupShared; + (*KeywordMap)["linear"] = EHTokLinear; + (*KeywordMap)["centroid"] = EHTokCentroid; + (*KeywordMap)["nointerpolation"] = EHTokNointerpolation; + (*KeywordMap)["noperspective"] = EHTokNoperspective; + (*KeywordMap)["sample"] = EHTokSample; + (*KeywordMap)["row_major"] = EHTokRowMajor; + (*KeywordMap)["column_major"] = EHTokColumnMajor; + (*KeywordMap)["packoffset"] = EHTokPackOffset; + + (*KeywordMap)["Buffer"] = EHTokBuffer; + (*KeywordMap)["vector"] = EHTokVector; + (*KeywordMap)["matrix"] = EHTokMatrix; + + (*KeywordMap)["void"] = EHTokVoid; + (*KeywordMap)["bool"] = EHTokBool; + (*KeywordMap)["int"] = EHTokInt; + (*KeywordMap)["uint"] = EHTokUint; + (*KeywordMap)["dword"] = EHTokDword; + (*KeywordMap)["half"] = EHTokHalf; + (*KeywordMap)["float"] = EHTokFloat; + (*KeywordMap)["double"] = EHTokDouble; + (*KeywordMap)["min16float"] = EHTokMin16float; + (*KeywordMap)["min10float"] = EHTokMin10float; + (*KeywordMap)["min16int"] = EHTokMin16int; + (*KeywordMap)["min12int"] = EHTokMin12int; + (*KeywordMap)["min16uint"] = EHTokMin16int; + + (*KeywordMap)["bool1"] = EHTokBool1; + (*KeywordMap)["bool2"] = EHTokBool2; + (*KeywordMap)["bool3"] = EHTokBool3; + (*KeywordMap)["bool4"] = EHTokBool4; + (*KeywordMap)["float1"] = EHTokFloat1; + (*KeywordMap)["float2"] = EHTokFloat2; + (*KeywordMap)["float3"] = EHTokFloat3; + (*KeywordMap)["float4"] = EHTokFloat4; + (*KeywordMap)["int1"] = EHTokInt1; + (*KeywordMap)["int2"] = EHTokInt2; + (*KeywordMap)["int3"] = EHTokInt3; + (*KeywordMap)["int4"] = EHTokInt4; + (*KeywordMap)["double1"] = EHTokDouble1; + (*KeywordMap)["double2"] = EHTokDouble2; + (*KeywordMap)["double3"] = EHTokDouble3; + (*KeywordMap)["double4"] = EHTokDouble4; + (*KeywordMap)["uint1"] = EHTokUint1; + (*KeywordMap)["uint2"] = EHTokUint2; + (*KeywordMap)["uint3"] = EHTokUint3; + (*KeywordMap)["uint4"] = EHTokUint4; + + (*KeywordMap)["int1x1"] = EHTokInt1x1; + (*KeywordMap)["int1x2"] = EHTokInt1x2; + (*KeywordMap)["int1x3"] = EHTokInt1x3; + (*KeywordMap)["int1x4"] = EHTokInt1x4; + (*KeywordMap)["int2x1"] = EHTokInt2x1; + (*KeywordMap)["int2x2"] = EHTokInt2x2; + (*KeywordMap)["int2x3"] = EHTokInt2x3; + (*KeywordMap)["int2x4"] = EHTokInt2x4; + (*KeywordMap)["int3x1"] = EHTokInt3x1; + (*KeywordMap)["int3x2"] = EHTokInt3x2; + (*KeywordMap)["int3x3"] = EHTokInt3x3; + (*KeywordMap)["int3x4"] = EHTokInt3x4; + (*KeywordMap)["int4x1"] = EHTokInt4x1; + (*KeywordMap)["int4x2"] = EHTokInt4x2; + (*KeywordMap)["int4x3"] = EHTokInt4x3; + (*KeywordMap)["int4x4"] = EHTokInt4x4; + (*KeywordMap)["float1x1"] = EHTokFloat1x1; + (*KeywordMap)["float1x2"] = EHTokFloat1x2; + (*KeywordMap)["float1x3"] = EHTokFloat1x3; + (*KeywordMap)["float1x4"] = EHTokFloat1x4; + (*KeywordMap)["float2x1"] = EHTokFloat2x1; + (*KeywordMap)["float2x2"] = EHTokFloat2x2; + (*KeywordMap)["float2x3"] = EHTokFloat2x3; + (*KeywordMap)["float2x4"] = EHTokFloat2x4; + (*KeywordMap)["float3x1"] = EHTokFloat3x1; + (*KeywordMap)["float3x2"] = EHTokFloat3x2; + (*KeywordMap)["float3x3"] = EHTokFloat3x3; + (*KeywordMap)["float3x4"] = EHTokFloat3x4; + (*KeywordMap)["float4x1"] = EHTokFloat4x1; + (*KeywordMap)["float4x2"] = EHTokFloat4x2; + (*KeywordMap)["float4x3"] = EHTokFloat4x3; + (*KeywordMap)["float4x4"] = EHTokFloat4x4; + (*KeywordMap)["double1x1"] = EHTokDouble1x1; + (*KeywordMap)["double1x2"] = EHTokDouble1x2; + (*KeywordMap)["double1x3"] = EHTokDouble1x3; + (*KeywordMap)["double1x4"] = EHTokDouble1x4; + (*KeywordMap)["double2x1"] = EHTokDouble2x1; + (*KeywordMap)["double2x2"] = EHTokDouble2x2; + (*KeywordMap)["double2x3"] = EHTokDouble2x3; + (*KeywordMap)["double2x4"] = EHTokDouble2x4; + (*KeywordMap)["double3x1"] = EHTokDouble3x1; + (*KeywordMap)["double3x2"] = EHTokDouble3x2; + (*KeywordMap)["double3x3"] = EHTokDouble3x3; + (*KeywordMap)["double3x4"] = EHTokDouble3x4; + (*KeywordMap)["double4x1"] = EHTokDouble4x1; + (*KeywordMap)["double4x2"] = EHTokDouble4x2; + (*KeywordMap)["double4x3"] = EHTokDouble4x3; + (*KeywordMap)["double4x4"] = EHTokDouble4x4; + + (*KeywordMap)["sampler"] = EHTokSampler; + (*KeywordMap)["sampler1D"] = EHTokSampler1d; + (*KeywordMap)["sampler2D"] = EHTokSampler2d; + (*KeywordMap)["sampler3D"] = EHTokSampler3d; + (*KeywordMap)["samplerCube"] = EHTokSamplerCube; + (*KeywordMap)["sampler_state"] = EHTokSamplerState; + (*KeywordMap)["SamplerState"] = EHTokSamplerState; + (*KeywordMap)["SamplerComparisonState"] = EHTokSamplerComparisonState; + (*KeywordMap)["texture"] = EHTokTexture; + (*KeywordMap)["Texture1D"] = EHTokTexture1d; + (*KeywordMap)["Texture1DArray"] = EHTokTexture1darray; + (*KeywordMap)["Texture2D"] = EHTokTexture2d; + (*KeywordMap)["Texture2DArray"] = EHTokTexture2darray; + (*KeywordMap)["Texture3D"] = EHTokTexture3d; + (*KeywordMap)["TextureCube"] = EHTokTextureCube; + + (*KeywordMap)["struct"] = EHTokStruct; + (*KeywordMap)["typedef"] = EHTokTypedef; + + (*KeywordMap)["true"] = EHTokBoolConstant; + (*KeywordMap)["false"] = EHTokBoolConstant; + + (*KeywordMap)["for"] = EHTokFor; + (*KeywordMap)["do"] = EHTokDo; + (*KeywordMap)["while"] = EHTokWhile; + (*KeywordMap)["break"] = EHTokBreak; + (*KeywordMap)["continue"] = EHTokContinue; + (*KeywordMap)["if"] = EHTokIf; + (*KeywordMap)["else"] = EHTokElse; + (*KeywordMap)["discard"] = EHTokDiscard; + (*KeywordMap)["return"] = EHTokReturn; + (*KeywordMap)["switch"] = EHTokSwitch; + (*KeywordMap)["case"] = EHTokCase; + (*KeywordMap)["default"] = EHTokDefault; + + // TODO: get correct set here + ReservedSet = new std::unordered_set; + + ReservedSet->insert("common"); + ReservedSet->insert("partition"); + ReservedSet->insert("active"); + ReservedSet->insert("asm"); + ReservedSet->insert("class"); + ReservedSet->insert("union"); + ReservedSet->insert("enum"); + ReservedSet->insert("template"); + ReservedSet->insert("this"); + ReservedSet->insert("goto"); + ReservedSet->insert("inline"); + ReservedSet->insert("noinline"); + ReservedSet->insert("public"); + ReservedSet->insert("extern"); + ReservedSet->insert("external"); + ReservedSet->insert("interface"); + ReservedSet->insert("long"); + ReservedSet->insert("short"); + ReservedSet->insert("half"); + ReservedSet->insert("fixed"); + ReservedSet->insert("unsigned"); + ReservedSet->insert("input"); + ReservedSet->insert("output"); + ReservedSet->insert("filter"); + ReservedSet->insert("sizeof"); + ReservedSet->insert("cast"); + ReservedSet->insert("namespace"); + ReservedSet->insert("using"); +} + +void HlslScanContext::deleteKeywordMap() +{ + delete KeywordMap; + KeywordMap = nullptr; + delete ReservedSet; + ReservedSet = nullptr; +} + +// Wrapper for tokenizeClass()"] = to get everything inside the token. +void HlslScanContext::tokenize(HlslToken& token) +{ + token.isType = false; + EHlslTokenClass tokenClass = tokenizeClass(token); + token.tokenClass = tokenClass; + if (token.isType) + afterType = true; +} + +// +// Fill in token information for the next token, except for the token class. +// Returns the enum value of the token class of the next token found. +// Return 0 (EndOfTokens) on end of input. +// +EHlslTokenClass HlslScanContext::tokenizeClass(HlslToken& token) +{ + do { + parserToken = &token; + TPpToken ppToken; + tokenText = ppContext.tokenize(&ppToken); + if (tokenText == nullptr) + return EHTokNone; + + loc = ppToken.loc; + parserToken->loc = loc; + switch (ppToken.token) { + case ';': afterType = false; return EHTokSemicolon; + case ',': afterType = false; return EHTokComma; + case ':': return EHTokColon; + case '=': afterType = false; return EHTokEqual; + case '(': afterType = false; return EHTokLeftParen; + case ')': afterType = false; return EHTokRightParen; + case '.': field = true; return EHTokDot; + case '!': return EHTokBang; + case '-': return EHTokDash; + case '~': return EHTokTilde; + case '+': return EHTokPlus; + case '*': return EHTokStar; + case '/': return EHTokSlash; + case '%': return EHTokPercent; + case '<': return EHTokLeftAngle; + case '>': return EHTokRightAngle; + case '|': return EHTokVerticalBar; + case '^': return EHTokCaret; + case '&': return EHTokAmpersand; + case '?': return EHTokQuestion; + case '[': return EHTokLeftBracket; + case ']': return EHTokRightBracket; + case '{': return EHTokLeftBrace; + case '}': return EHTokRightBrace; + case '\\': + parseContext.error(loc, "illegal use of escape character", "\\", ""); + break; + + case PpAtomAdd: return EHTokAddAssign; + case PpAtomSub: return EHTokSubAssign; + case PpAtomMul: return EHTokMulAssign; + case PpAtomDiv: return EHTokDivAssign; + case PpAtomMod: return EHTokModAssign; + + case PpAtomRight: return EHTokRightOp; + case PpAtomLeft: return EHTokLeftOp; + + case PpAtomRightAssign: return EHTokRightAssign; + case PpAtomLeftAssign: return EHTokLeftAssign; + case PpAtomAndAssign: return EHTokAndAssign; + case PpAtomOrAssign: return EHTokOrAssign; + case PpAtomXorAssign: return EHTokXorAssign; + + case PpAtomAnd: return EHTokAndOp; + case PpAtomOr: return EHTokOrOp; + case PpAtomXor: return EHTokXorOp; + + case PpAtomEQ: return EHTokEqOp; + case PpAtomGE: return EHTokGeOp; + case PpAtomNE: return EHTokNeOp; + case PpAtomLE: return EHTokLeOp; + + case PpAtomDecrement: return EHTokDecOp; + case PpAtomIncrement: return EHTokIncOp; + + case PpAtomConstInt: parserToken->i = ppToken.ival; return EHTokIntConstant; + case PpAtomConstUint: parserToken->i = ppToken.ival; return EHTokUintConstant; + case PpAtomConstFloat: parserToken->d = ppToken.dval; return EHTokFloatConstant; + case PpAtomConstDouble: parserToken->d = ppToken.dval; return EHTokDoubleConstant; + case PpAtomIdentifier: + { + EHlslTokenClass token = tokenizeIdentifier(); + field = false; + return token; + } + + case EndOfInput: return EHTokNone; + + default: + char buf[2]; + buf[0] = (char)ppToken.token; + buf[1] = 0; + parseContext.error(loc, "unexpected token", buf, ""); + break; + } + } while (true); +} + +EHlslTokenClass HlslScanContext::tokenizeIdentifier() +{ + if (ReservedSet->find(tokenText) != ReservedSet->end()) + return reservedWord(); + + auto it = KeywordMap->find(tokenText); + if (it == KeywordMap->end()) { + // Should have an identifier of some sort + return identifierOrType(); + } + keyword = it->second; + + switch (keyword) { + + // qualifiers + case EHTokStatic: + case EHTokConst: + case EHTokSNorm: + case EHTokUnorm: + case EHTokExtern: + case EHTokUniform: + case EHTokVolatile: + case EHTokShared: + case EHTokGroupShared: + case EHTokLinear: + case EHTokCentroid: + case EHTokNointerpolation: + case EHTokNoperspective: + case EHTokSample: + case EHTokRowMajor: + case EHTokColumnMajor: + case EHTokPackOffset: + return keyword; + + // template types + case EHTokBuffer: + case EHTokVector: + case EHTokMatrix: + return keyword; + + // scalar types + case EHTokVoid: + case EHTokBool: + case EHTokInt: + case EHTokUint: + case EHTokDword: + case EHTokHalf: + case EHTokFloat: + case EHTokDouble: + case EHTokMin16float: + case EHTokMin10float: + case EHTokMin16int: + case EHTokMin12int: + case EHTokMin16uint: + + // vector types + case EHTokBool1: + case EHTokBool2: + case EHTokBool3: + case EHTokBool4: + case EHTokFloat1: + case EHTokFloat2: + case EHTokFloat3: + case EHTokFloat4: + case EHTokInt1: + case EHTokInt2: + case EHTokInt3: + case EHTokInt4: + case EHTokDouble1: + case EHTokDouble2: + case EHTokDouble3: + case EHTokDouble4: + case EHTokUint1: + case EHTokUint2: + case EHTokUint3: + case EHTokUint4: + + // matrix types + case EHTokInt1x1: + case EHTokInt1x2: + case EHTokInt1x3: + case EHTokInt1x4: + case EHTokInt2x1: + case EHTokInt2x2: + case EHTokInt2x3: + case EHTokInt2x4: + case EHTokInt3x1: + case EHTokInt3x2: + case EHTokInt3x3: + case EHTokInt3x4: + case EHTokInt4x1: + case EHTokInt4x2: + case EHTokInt4x3: + case EHTokInt4x4: + case EHTokFloat1x1: + case EHTokFloat1x2: + case EHTokFloat1x3: + case EHTokFloat1x4: + case EHTokFloat2x1: + case EHTokFloat2x2: + case EHTokFloat2x3: + case EHTokFloat2x4: + case EHTokFloat3x1: + case EHTokFloat3x2: + case EHTokFloat3x3: + case EHTokFloat3x4: + case EHTokFloat4x1: + case EHTokFloat4x2: + case EHTokFloat4x3: + case EHTokFloat4x4: + case EHTokDouble1x1: + case EHTokDouble1x2: + case EHTokDouble1x3: + case EHTokDouble1x4: + case EHTokDouble2x1: + case EHTokDouble2x2: + case EHTokDouble2x3: + case EHTokDouble2x4: + case EHTokDouble3x1: + case EHTokDouble3x2: + case EHTokDouble3x3: + case EHTokDouble3x4: + case EHTokDouble4x1: + case EHTokDouble4x2: + case EHTokDouble4x3: + case EHTokDouble4x4: + parserToken->isType = true; + return keyword; + + // texturing types + case EHTokSampler: + case EHTokSampler1d: + case EHTokSampler2d: + case EHTokSampler3d: + case EHTokSamplerCube: + case EHTokSamplerState: + case EHTokSamplerComparisonState: + case EHTokTexture: + case EHTokTexture1d: + case EHTokTexture1darray: + case EHTokTexture2d: + case EHTokTexture2darray: + case EHTokTexture3d: + case EHTokTextureCube: + parserToken->isType = true; + return keyword; + + // variable, user type, ... + case EHTokStruct: + case EHTokTypedef: + + case EHTokBoolConstant: + if (strcmp("true", tokenText) == 0) + parserToken->b = true; + else + parserToken->b = false; + return keyword; + + // control flow + case EHTokFor: + case EHTokDo: + case EHTokWhile: + case EHTokBreak: + case EHTokContinue: + case EHTokIf: + case EHTokElse: + case EHTokDiscard: + case EHTokReturn: + case EHTokCase: + case EHTokSwitch: + case EHTokDefault: + return keyword; + + default: + parseContext.infoSink.info.message(EPrefixInternalError, "Unknown glslang keyword", loc); + return EHTokNone; + } +} + +EHlslTokenClass HlslScanContext::identifierOrType() +{ + parserToken->string = NewPoolTString(tokenText); + if (field) + return EHTokIdentifier; + + parserToken->symbol = parseContext.symbolTable.find(*parserToken->string); + if (afterType == false && parserToken->symbol) { + if (const TVariable* variable = parserToken->symbol->getAsVariable()) { + if (variable->isUserType()) { + afterType = true; + + return EHTokTypeName; + } + } + } + + return EHTokIdentifier; +} + +// Give an error for use of a reserved symbol. +// However, allow built-in declarations to use reserved words, to allow +// extension support before the extension is enabled. +EHlslTokenClass HlslScanContext::reservedWord() +{ + if (! parseContext.symbolTable.atBuiltInLevel()) + parseContext.error(loc, "Reserved word.", tokenText, "", ""); + + return EHTokNone; +} + +EHlslTokenClass HlslScanContext::identifierOrReserved(bool reserved) +{ + if (reserved) { + reservedWord(); + + return EHTokNone; + } + + if (parseContext.forwardCompatible) + parseContext.warn(loc, "using future reserved keyword", tokenText, ""); + + return identifierOrType(); +} + +// For a keyword that was never reserved, until it suddenly +// showed up. +EHlslTokenClass HlslScanContext::nonreservedKeyword(int version) +{ + if (parseContext.version < version) + return identifierOrType(); + + return keyword; +} + +} // end namespace glslang diff --git a/hlsl/hlslScanContext.h b/hlsl/hlslScanContext.h new file mode 100755 index 00000000..df0d2bc6 --- /dev/null +++ b/hlsl/hlslScanContext.h @@ -0,0 +1,102 @@ +// +//Copyright (C) 2016 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 Google, Inc., 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. +// + +// +// This holds context specific to the GLSL scanner, which +// sits between the preprocessor scanner and parser. +// + +#ifndef HLSLSCANCONTEXT_H_ +#define HLSLSCANCONTEXT_H_ + +#include "../glslang/MachineIndependent/ParseHelper.h" +#include "hlslTokens.h" + +namespace glslang { + +class TPpContext; +class TPpToken; + +struct HlslToken { + TSourceLoc loc; + EHlslTokenClass tokenClass; + bool isType; + union { + glslang::TString *string; + int i; + unsigned int u; + bool b; + double d; + }; + glslang::TSymbol* symbol; +}; + +class HlslScanContext { +public: + HlslScanContext(TParseContextBase& parseContext, TPpContext& ppContext) + : parseContext(parseContext), ppContext(ppContext), afterType(false), field(false) { } + virtual ~HlslScanContext() { } + + static void fillInKeywordMap(); + static void deleteKeywordMap(); + + void tokenize(HlslToken&); + +protected: + HlslScanContext(HlslScanContext&); + HlslScanContext& operator=(HlslScanContext&); + + EHlslTokenClass tokenizeClass(HlslToken&); + EHlslTokenClass tokenizeIdentifier(); + EHlslTokenClass identifierOrType(); + EHlslTokenClass reservedWord(); + EHlslTokenClass identifierOrReserved(bool reserved); + EHlslTokenClass nonreservedKeyword(int version); + + TParseContextBase& parseContext; + TPpContext& ppContext; + bool afterType; // true if we've recognized a type, so can only be looking for an identifier + bool field; // true if we're on a field, right after a '.' + TSourceLoc loc; + TPpToken* ppToken; + HlslToken* parserToken; + + const char* tokenText; + EHlslTokenClass keyword; +}; + +} // end namespace glslang + +#endif // HLSLSCANCONTEXT_H_ diff --git a/hlsl/hlslTokens.h b/hlsl/hlslTokens.h new file mode 100755 index 00000000..b118f2e0 --- /dev/null +++ b/hlsl/hlslTokens.h @@ -0,0 +1,248 @@ +// +//Copyright (C) 2016 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 Google, Inc., 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. +// + +#ifndef EHLSLTOKENS_H_ +#define EHLSLTOKENS_H_ + +namespace glslang { + +enum EHlslTokenClass { + EHTokNone = 0, + + // qualifiers + EHTokStatic, + EHTokConst, + EHTokSNorm, + EHTokUnorm, + EHTokExtern, + EHTokUniform, + EHTokVolatile, + EHTokShared, + EHTokGroupShared, + EHTokLinear, + EHTokCentroid, + EHTokNointerpolation, + EHTokNoperspective, + EHTokSample, + EHTokRowMajor, + EHTokColumnMajor, + EHTokPackOffset, + + // template types + EHTokBuffer, + EHTokVector, + EHTokMatrix, + + // scalar types + EHTokVoid, + EHTokBool, + EHTokInt, + EHTokUint, + EHTokDword, + EHTokHalf, + EHTokFloat, + EHTokDouble, + EHTokMin16float, + EHTokMin10float, + EHTokMin16int, + EHTokMin12int, + EHTokMin16uint, + + // vector types + EHTokBool1, + EHTokBool2, + EHTokBool3, + EHTokBool4, + EHTokFloat1, + EHTokFloat2, + EHTokFloat3, + EHTokFloat4, + EHTokInt1, + EHTokInt2, + EHTokInt3, + EHTokInt4, + EHTokDouble1, + EHTokDouble2, + EHTokDouble3, + EHTokDouble4, + EHTokUint1, + EHTokUint2, + EHTokUint3, + EHTokUint4, + + // matrix types + EHTokInt1x1, + EHTokInt1x2, + EHTokInt1x3, + EHTokInt1x4, + EHTokInt2x1, + EHTokInt2x2, + EHTokInt2x3, + EHTokInt2x4, + EHTokInt3x1, + EHTokInt3x2, + EHTokInt3x3, + EHTokInt3x4, + EHTokInt4x1, + EHTokInt4x2, + EHTokInt4x3, + EHTokInt4x4, + EHTokFloat1x1, + EHTokFloat1x2, + EHTokFloat1x3, + EHTokFloat1x4, + EHTokFloat2x1, + EHTokFloat2x2, + EHTokFloat2x3, + EHTokFloat2x4, + EHTokFloat3x1, + EHTokFloat3x2, + EHTokFloat3x3, + EHTokFloat3x4, + EHTokFloat4x1, + EHTokFloat4x2, + EHTokFloat4x3, + EHTokFloat4x4, + EHTokDouble1x1, + EHTokDouble1x2, + EHTokDouble1x3, + EHTokDouble1x4, + EHTokDouble2x1, + EHTokDouble2x2, + EHTokDouble2x3, + EHTokDouble2x4, + EHTokDouble3x1, + EHTokDouble3x2, + EHTokDouble3x3, + EHTokDouble3x4, + EHTokDouble4x1, + EHTokDouble4x2, + EHTokDouble4x3, + EHTokDouble4x4, + + // texturing types + EHTokSampler, + EHTokSampler1d, + EHTokSampler2d, + EHTokSampler3d, + EHTokSamplerCube, + EHTokSamplerState, + EHTokSamplerComparisonState, + EHTokTexture, + EHTokTexture1d, + EHTokTexture1darray, + EHTokTexture2d, + EHTokTexture2darray, + EHTokTexture3d, + EHTokTextureCube, + + // variable, user type, ... + EHTokIdentifier, + EHTokTypeName, + EHTokStruct, + EHTokTypedef, + + // constant + EHTokFloatConstant, + EHTokDoubleConstant, + EHTokIntConstant, + EHTokUintConstant, + EHTokBoolConstant, + + // control flow + EHTokFor, + EHTokDo, + EHTokWhile, + EHTokBreak, + EHTokContinue, + EHTokIf, + EHTokElse, + EHTokDiscard, + EHTokReturn, + EHTokSwitch, + EHTokCase, + EHTokDefault, + + // expressions + EHTokLeftOp, + EHTokRightOp, + EHTokIncOp, + EHTokDecOp, + EHTokLeOp, + EHTokGeOp, + EHTokEqOp, + EHTokNeOp, + EHTokAndOp, + EHTokOrOp, + EHTokXorOp, + EHTokMulAssign, + EHTokDivAssign, + EHTokAddAssign, + EHTokModAssign, + EHTokLeftAssign, + EHTokRightAssign, + EHTokAndAssign, + EHTokXorAssign, + EHTokOrAssign, + EHTokSubAssign, + EHTokLeftParen, + EHTokRightParen, + EHTokLeftBracket, + EHTokRightBracket, + EHTokLeftBrace, + EHTokRightBrace, + EHTokDot, + EHTokComma, + EHTokColon, + EHTokEqual, + EHTokSemicolon, + EHTokBang, + EHTokDash, + EHTokTilde, + EHTokPlus, + EHTokStar, + EHTokSlash, + EHTokPercent, + EHTokLeftAngle, + EHTokRightAngle, + EHTokVerticalBar, + EHTokCaret, + EHTokAmpersand, + EHTokQuestion, +}; + +} // end namespace glslang + +#endif // EHLSLTOKENS_H_ \ No newline at end of file From 87142c71fbb16b77d187c00fa6f390677483d806 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Sat, 12 Mar 2016 20:24:24 -0700 Subject: [PATCH 005/140] HLSL: Add basic declaration syntax and AST generation. --- Test/baseResults/hlsl.frag.out | 18 +- Test/hlsl.frag | 22 +-- hlsl/hlslGrammar.cpp | 301 ++++++++++++++++++++++++++++++++- hlsl/hlslGrammar.h | 8 + 4 files changed, 335 insertions(+), 14 deletions(-) diff --git a/Test/baseResults/hlsl.frag.out b/Test/baseResults/hlsl.frag.out index bc2e035d..bb5e5a7c 100644 --- a/Test/baseResults/hlsl.frag.out +++ b/Test/baseResults/hlsl.frag.out @@ -5,7 +5,7 @@ Linked fragment stage: // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 6 +// Id's are bound by 17 Capability Shader 1: ExtInstImport "GLSL.std.450" @@ -14,8 +14,24 @@ Linked fragment stage: ExecutionMode 4 OriginUpperLeft Source HLSL 100 Name 4 "PixelShaderFunction" + Name 10 "World" + Name 11 "View" + Name 12 "Projection" + Name 14 "AmbientColor" + Name 16 "AmbientIntensity" 2: TypeVoid 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypeMatrix 7(fvec4) 4 + 9: TypePointer Function 8 + 13: TypePointer Function 7(fvec4) + 15: TypePointer Function 6(float) 4(PixelShaderFunction): 2 Function None 3 5: Label + 10(World): 9(ptr) Variable Function + 11(View): 9(ptr) Variable Function + 12(Projection): 9(ptr) Variable Function +14(AmbientColor): 13(ptr) Variable Function +16(AmbientIntensity): 15(ptr) Variable Function FunctionEnd diff --git a/Test/hlsl.frag b/Test/hlsl.frag index 66314041..8ed18aa8 100644 --- a/Test/hlsl.frag +++ b/Test/hlsl.frag @@ -1,11 +1,11 @@ -//float4x4 World; -//float4x4 View; -//float4x4 Projection; -// -//float4 AmbientColor = float4(1, 1, 1, 1); -//float AmbientIntensity = 0.1; -// -//float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 -//{ -// return AmbientColor * AmbientIntensity; -//} +float4x4 World; +float4x4 View; +float4x4 Projection; + +float4 AmbientColor = float4(1, 1, 1, 1); +float AmbientIntensity = 0.1; + +//float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 +//{ +// return AmbientColor * AmbientIntensity; +//} diff --git a/hlsl/hlslGrammar.cpp b/hlsl/hlslGrammar.cpp index 9673658c..bbf3c999 100755 --- a/hlsl/hlslGrammar.cpp +++ b/hlsl/hlslGrammar.cpp @@ -83,11 +83,308 @@ bool HlslGrammar::acceptCompilationUnit() } // declaration -// : dummy stub +// : SEMICOLON +// : fully_specified_type ; +// | fully_specified_type identifier ; +// | fully_specified_type identifier = expression ; +// | fully_specified_type identifier function_parameters ; // function prototype +// | fully_specified_type function_parameters compound_statement // function definition +// bool HlslGrammar::acceptDeclaration() { - advanceToken(); + // fully_specified_type + TType type; + if (! acceptFullySpecifiedType(type)) + return false; + + // identifier + if (token.tokenClass == EHTokIdentifier) { + TSourceLoc declLoc = token.loc; + TString* declName = token.string; + advanceToken(); + + // = expression + TIntermTyped* expressionNode = nullptr; + if (acceptTokenClass(EHTokEqual)) { + if (! acceptExpression(expressionNode)) { + expected("initializer"); + return false; + } + } + + // ; + if (acceptTokenClass(EHTokSemicolon)) { + parseContext.declareVariable(declLoc, *declName, type, 0, expressionNode); + return true; + } + } + + // no identifier, just ; + if (acceptTokenClass(EHTokSemicolon)) + return true; + return true; } +// fully_specified_type +// : type_specifier +// | type_qualifier type_specifier +// +bool HlslGrammar::acceptFullySpecifiedType(TType& type) +{ + // type_qualifier + TQualifier qualifier; + qualifier.clear(); + acceptQualifier(qualifier); + + // type_specifier + if (! acceptType(type)) + return false; + type.getQualifier() = qualifier; + + return true; +} + +// If token is a qualifier, return its token class and advance to the next +// qualifier. Otherwise, return false, and don't advance. +void HlslGrammar::acceptQualifier(TQualifier& qualifier) +{ + switch (token.tokenClass) { + case EHTokUniform: + qualifier.storage = EvqUniform; + break; + case EHTokConst: + qualifier.storage = EvqConst; + break; + default: + return; + } + + advanceToken(); +} + +// If token is for a type, update 'type' with the type information, +// and return true and advance. +// Otherwise, return false, and don't advance +bool HlslGrammar::acceptType(TType& type) +{ + if (! token.isType) + return false; + + switch (token.tokenClass) { + case EHTokInt: + case EHTokInt1: + case EHTokDword: + new(&type) TType(EbtInt); + break; + case EHTokFloat: + case EHTokFloat1: + new(&type) TType(EbtFloat); + break; + + case EHTokFloat2: + new(&type) TType(EbtFloat, EvqTemporary, 2); + break; + case EHTokFloat3: + new(&type) TType(EbtFloat, EvqTemporary, 3); + break; + case EHTokFloat4: + new(&type) TType(EbtFloat, EvqTemporary, 4); + break; + + case EHTokInt2: + new(&type) TType(EbtInt, EvqTemporary, 2); + break; + case EHTokInt3: + new(&type) TType(EbtInt, EvqTemporary, 3); + break; + case EHTokInt4: + new(&type) TType(EbtInt, EvqTemporary, 4); + break; + + case EHTokBool2: + new(&type) TType(EbtBool, EvqTemporary, 2); + break; + case EHTokBool3: + new(&type) TType(EbtBool, EvqTemporary, 3); + break; + case EHTokBool4: + new(&type) TType(EbtBool, EvqTemporary, 4); + break; + + case EHTokFloat2x2: + new(&type) TType(EbtFloat, EvqTemporary, 0, 2, 2); + break; + case EHTokFloat2x3: + new(&type) TType(EbtFloat, EvqTemporary, 0, 3, 2); + break; + case EHTokFloat2x4: + new(&type) TType(EbtFloat, EvqTemporary, 0, 4, 2); + break; + case EHTokFloat3x2: + new(&type) TType(EbtFloat, EvqTemporary, 0, 2, 3); + break; + case EHTokFloat3x3: + new(&type) TType(EbtFloat, EvqTemporary, 0, 3, 3); + break; + case EHTokFloat3x4: + new(&type) TType(EbtFloat, EvqTemporary, 0, 4, 3); + break; + case EHTokFloat4x2: + new(&type) TType(EbtFloat, EvqTemporary, 0, 2, 4); + break; + case EHTokFloat4x3: + new(&type) TType(EbtFloat, EvqTemporary, 0, 3, 4); + break; + case EHTokFloat4x4: + new(&type) TType(EbtFloat, EvqTemporary, 0, 4, 4); + break; + + default: + return false; + } + + advanceToken(); + + return true; +} + +// expression +// : identifier +// | ( expression ) +// | type(...) // constructor +// | literal +// | identifier + identifier +// +bool HlslGrammar::acceptExpression(TIntermTyped*& node) +{ + // identifier + if (token.tokenClass == EHTokIdentifier) { + node = parseContext.handleVariable(token.loc, token.symbol, token.string); + return true; + } + + // ( expression ) + if (acceptTokenClass(EHTokLeftParen)) { + if (! acceptExpression(node)) { + expected("expression"); + return false; + } + if (! acceptTokenClass(EHTokRightParen)) { + expected("right parenthesis"); + return false; + } + + return true; + } + + // literal + if (acceptLiteral(node)) + return true; + + // type(...) // constructor + TType type; + if (acceptType(type)) { + TIntermSequence* arguments; + if (! acceptArguments(arguments)) { + expected("constructor arguments"); + return false; + } + + return true; + } + + // identifier + identifier + if (token.tokenClass == EHTokIdentifier) { + TIntermTyped* left = parseContext.handleVariable(token.loc, token.symbol, token.string); + advanceToken(); + + // operator + TOperator op; + if (! acceptOperator(op)) + return false; + TSourceLoc loc = token.loc; + + // right + if (token.tokenClass == EHTokIdentifier) { + TIntermTyped* right = parseContext.handleVariable(token.loc, token.symbol, token.string); + advanceToken(); + node = parseContext.intermediate.addBinaryMath(op, left, right, loc); + } else + return false; + } else + return false; + + return true; +} + +// arguments +// : ( expression , expression, ... ) +// +bool HlslGrammar::acceptArguments(TIntermSequence*& arguments) +{ + if (! acceptTokenClass(EHTokLeftParen)) + return false; + + do { + TIntermTyped* arg; + if (! acceptExpression(arg)) + break; + if (! acceptTokenClass(EHTokComma)) + break; + } while (true); + + if (! acceptTokenClass(EHTokRightParen)) { + expected("right parenthesis"); + return false; + } + + return true; +} + +bool HlslGrammar::acceptLiteral(TIntermTyped*& node) +{ + switch (token.tokenClass) { + case EHTokIntConstant: + node = parseContext.intermediate.addConstantUnion(token.i, token.loc, true); + break; + case EHTokFloatConstant: + node = parseContext.intermediate.addConstantUnion(token.d, EbtFloat, token.loc, true); + break; + case EHTokDoubleConstant: + node = parseContext.intermediate.addConstantUnion(token.d, EbtDouble, token.loc, true); + break; + case EHTokBoolConstant: + node = parseContext.intermediate.addConstantUnion(token.b, token.loc, true); + break; + + default: + return false; + } + + advanceToken(); + + return true; +} + +bool HlslGrammar::acceptOperator(TOperator& op) +{ + switch (token.tokenClass) { + case EHTokPlus: + op = EOpAdd; + break; + default: + return false; + } + + advanceToken(); + + return true; +} + +bool HlslGrammar::acceptCompoundStatement() +{ + return false; +} + } // end namespace glslang diff --git a/hlsl/hlslGrammar.h b/hlsl/hlslGrammar.h index c445f039..3e042ffe 100755 --- a/hlsl/hlslGrammar.h +++ b/hlsl/hlslGrammar.h @@ -56,6 +56,14 @@ namespace glslang { bool acceptCompilationUnit(); bool acceptDeclaration(); + bool acceptFullySpecifiedType(TType&); + void acceptQualifier(TQualifier&); + bool acceptType(TType&); + bool acceptCompoundStatement(); + bool acceptExpression(TIntermTyped*&); + bool acceptArguments(TIntermSequence*&); + bool acceptLiteral(TIntermTyped*&); + bool acceptOperator(TOperator& op); HlslScanContext& scanContext; HlslParseContext& parseContext; From d016be19fb76eb693c698ec151e94f19d5e67189 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Sun, 13 Mar 2016 11:24:20 -0600 Subject: [PATCH 006/140] HLSL: Hook up constructor expressions through the AST. --- Test/baseResults/hlsl.frag.out | 42 +++++++++++++++ Test/hlsl.frag | 2 +- Test/runtests | 2 +- hlsl/hlslGrammar.cpp | 97 ++++++++++++++++++++++++++++------ hlsl/hlslGrammar.h | 5 +- hlsl/hlslParseHelper.cpp | 17 +++--- hlsl/hlslParseHelper.h | 3 +- 7 files changed, 139 insertions(+), 29 deletions(-) diff --git a/Test/baseResults/hlsl.frag.out b/Test/baseResults/hlsl.frag.out index bb5e5a7c..b96e2acd 100644 --- a/Test/baseResults/hlsl.frag.out +++ b/Test/baseResults/hlsl.frag.out @@ -1,8 +1,50 @@ hlsl.frag +Shader version: 100 +gl_FragCoord origin is upper left +0:? Sequence +0:5 move second child to first child (temp 4-component vector of float) +0:5 'AmbientColor' (temp 4-component vector of float) +0:? Constant: +0:? 1.000000 +0:? 0.500000 +0:? 0.000000 +0:? 1.000000 +0:6 move second child to first child (temp float) +0:6 'AmbientIntensity' (temp float) +0:6 Constant: +0:6 0.100000 +0:? Linker Objects +0:? 'World' (temp 4X4 matrix of float) +0:? 'View' (temp 4X4 matrix of float) +0:? 'Projection' (temp 4X4 matrix of float) +0:? 'AmbientColor' (temp 4-component vector of float) +0:? 'AmbientIntensity' (temp float) + Linked fragment stage: +Shader version: 100 +gl_FragCoord origin is upper left +0:? Sequence +0:5 move second child to first child (temp 4-component vector of float) +0:5 'AmbientColor' (temp 4-component vector of float) +0:? Constant: +0:? 1.000000 +0:? 0.500000 +0:? 0.000000 +0:? 1.000000 +0:6 move second child to first child (temp float) +0:6 'AmbientIntensity' (temp float) +0:6 Constant: +0:6 0.100000 +0:? Linker Objects +0:? 'World' (temp 4X4 matrix of float) +0:? 'View' (temp 4X4 matrix of float) +0:? 'Projection' (temp 4X4 matrix of float) +0:? 'AmbientColor' (temp 4-component vector of float) +0:? 'AmbientIntensity' (temp float) + // Module Version 10000 // Generated by (magic number): 80001 // Id's are bound by 17 diff --git a/Test/hlsl.frag b/Test/hlsl.frag index 8ed18aa8..9107248f 100644 --- a/Test/hlsl.frag +++ b/Test/hlsl.frag @@ -2,7 +2,7 @@ float4x4 World; float4x4 View; float4x4 Projection; -float4 AmbientColor = float4(1, 1, 1, 1); +float4 AmbientColor = float4(1, 0.5, 0, 1); float AmbientIntensity = 0.1; //float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 diff --git a/Test/runtests b/Test/runtests index 67a374cf..d5099a91 100755 --- a/Test/runtests +++ b/Test/runtests @@ -66,7 +66,7 @@ while read t; do *) echo Running HLSL-to-SPIR-V $t... b=`basename $t` - $EXE -D -e PixelShaderFunction -H $t > $TARGETDIR/$b.out + $EXE -D -e PixelShaderFunction -H -i $t > $TARGETDIR/$b.out diff -b $BASEDIR/$b.out $TARGETDIR/$b.out || HASERROR=1 ;; esac diff --git a/hlsl/hlslGrammar.cpp b/hlsl/hlslGrammar.cpp index bbf3c999..20d7bb3f 100755 --- a/hlsl/hlslGrammar.cpp +++ b/hlsl/hlslGrammar.cpp @@ -33,6 +33,23 @@ //POSSIBILITY OF SUCH DAMAGE. // +// +// This is a set of mutually recursive methods implementing the HLSL grammar. +// Generally, each returns +// - through an argument: a type specifically appropriate to which rule it +// recognized +// - through the return value: true/false to indicate whether or not it +// recognized its rule +// +// As much as possible, only grammar recognition should happen in this file, +// with all other work being farmed out to hlslParseHelper.cpp, which it turn +// will build the AST. +// +// The next token, yet to be "accepted" is always sitting in 'token'. +// When a method says it accepts a rule, that means all tokens involved +// in the rule will have been consumed, and none left in 'token'. +// + #include "hlslTokens.h" #include "hlslGrammar.h" @@ -74,11 +91,21 @@ bool HlslGrammar::acceptTokenClass(EHlslTokenClass tokenClass) // bool HlslGrammar::acceptCompilationUnit() { + TIntermNode* unitNode = nullptr; + while (token.tokenClass != EHTokNone) { - if (! acceptDeclaration()) + // externalDeclaration + TIntermNode* declarationNode; + if (! acceptDeclaration(declarationNode)) return false; + + // hook it up + unitNode = parseContext.intermediate.growAggregate(unitNode, declarationNode); } + // set root of AST + parseContext.intermediate.setTreeRoot(unitNode); + return true; } @@ -90,8 +117,13 @@ bool HlslGrammar::acceptCompilationUnit() // | fully_specified_type identifier function_parameters ; // function prototype // | fully_specified_type function_parameters compound_statement // function definition // -bool HlslGrammar::acceptDeclaration() +// 'node' could get created if the declaration creates code, like an initializer +// or a function body. +// +bool HlslGrammar::acceptDeclaration(TIntermNode*& node) { + node = nullptr; + // fully_specified_type TType type; if (! acceptFullySpecifiedType(type)) @@ -114,7 +146,7 @@ bool HlslGrammar::acceptDeclaration() // ; if (acceptTokenClass(EHTokSemicolon)) { - parseContext.declareVariable(declLoc, *declName, type, 0, expressionNode); + node = parseContext.declareVariable(declLoc, *declName, type, 0, expressionNode); return true; } } @@ -252,9 +284,9 @@ bool HlslGrammar::acceptType(TType& type) // expression // : identifier // | ( expression ) -// | type(...) // constructor +// | type(...) // constructor // | literal -// | identifier + identifier +// | identifier operator identifier // to be generalized to all expressions // bool HlslGrammar::acceptExpression(TIntermTyped*& node) { @@ -282,19 +314,11 @@ bool HlslGrammar::acceptExpression(TIntermTyped*& node) if (acceptLiteral(node)) return true; - // type(...) // constructor - TType type; - if (acceptType(type)) { - TIntermSequence* arguments; - if (! acceptArguments(arguments)) { - expected("constructor arguments"); - return false; - } - + // type(...) // constructor + if (acceptConstructor(node)) return true; - } - // identifier + identifier + // identifier operator identifier if (token.tokenClass == EHTokIdentifier) { TIntermTyped* left = parseContext.handleVariable(token.loc, token.symbol, token.string); advanceToken(); @@ -318,22 +342,61 @@ bool HlslGrammar::acceptExpression(TIntermTyped*& node) return true; } +// constructor +// : type arguments +// +bool HlslGrammar::acceptConstructor(TIntermTyped*& node) +{ + // type + TType type; + if (acceptType(type)) { + TFunction* constructorFunction = parseContext.handleConstructorCall(token.loc, type); + if (constructorFunction == nullptr) + return false; + + // arguments + TIntermAggregate* arguments = nullptr; + if (! acceptArguments(constructorFunction, arguments)) { + expected("constructor arguments"); + return false; + } + + // hook it up + node = parseContext.handleFunctionCall(arguments->getLoc(), constructorFunction, arguments); + + return true; + } + + return false; +} + // arguments // : ( expression , expression, ... ) // -bool HlslGrammar::acceptArguments(TIntermSequence*& arguments) +// The arguments are pushed onto the 'function' argument list and +// onto the 'arguments' aggregate. +// +bool HlslGrammar::acceptArguments(TFunction* function, TIntermAggregate*& arguments) { + // ( if (! acceptTokenClass(EHTokLeftParen)) return false; do { + // expression TIntermTyped* arg; if (! acceptExpression(arg)) break; + + // hook it up + parseContext.handleFunctionArgument(function, arguments, arg); + + // , if (! acceptTokenClass(EHTokComma)) break; } while (true); + // ) if (! acceptTokenClass(EHTokRightParen)) { expected("right parenthesis"); return false; diff --git a/hlsl/hlslGrammar.h b/hlsl/hlslGrammar.h index 3e042ffe..8239d3e9 100755 --- a/hlsl/hlslGrammar.h +++ b/hlsl/hlslGrammar.h @@ -55,13 +55,14 @@ namespace glslang { bool acceptTokenClass(EHlslTokenClass); bool acceptCompilationUnit(); - bool acceptDeclaration(); + bool acceptDeclaration(TIntermNode*& node); bool acceptFullySpecifiedType(TType&); void acceptQualifier(TQualifier&); bool acceptType(TType&); bool acceptCompoundStatement(); bool acceptExpression(TIntermTyped*&); - bool acceptArguments(TIntermSequence*&); + bool acceptConstructor(TIntermTyped*&); + bool acceptArguments(TFunction*, TIntermAggregate*&); bool acceptLiteral(TIntermTyped*&); bool acceptOperator(TOperator& op); diff --git a/hlsl/hlslParseHelper.cpp b/hlsl/hlslParseHelper.cpp index 9a0531c7..95a266fd 100755 --- a/hlsl/hlslParseHelper.cpp +++ b/hlsl/hlslParseHelper.cpp @@ -754,6 +754,14 @@ TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& l return paramNodes; } +void HlslParseContext::handleFunctionArgument(TFunction* function, TIntermAggregate*& arguments, TIntermTyped* arg) +{ + TParameter param = { 0, new TType }; + param.type->shallowCopy(arg->getType()); + function->addParameter(param); + arguments = intermediate.growAggregate(arguments, arg); +} + // // Handle seeing function call syntax in the grammar, which could be any of // - .length() method @@ -1182,18 +1190,13 @@ void HlslParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fn // // Handle seeing a built-in constructor in a grammar production. // -TFunction* HlslParseContext::handleConstructorCall(const TSourceLoc& loc, const TPublicType& publicType) +TFunction* HlslParseContext::handleConstructorCall(const TSourceLoc& loc, const TType& type) { - TType type(publicType); - type.getQualifier().precision = EpqNone; - TOperator op = mapTypeToConstructorOp(type); if (op == EOpNull) { error(loc, "cannot construct this type", type.getBasicString(), ""); - op = EOpConstructFloat; - TType errorType(EbtFloat); - type.shallowCopy(errorType); + return nullptr; } TString empty(""); diff --git a/hlsl/hlslParseHelper.h b/hlsl/hlslParseHelper.h index 1537cfc8..88a3fe2f 100755 --- a/hlsl/hlslParseHelper.h +++ b/hlsl/hlslParseHelper.h @@ -83,12 +83,13 @@ public: TIntermTyped* handleDotDereference(const TSourceLoc&, TIntermTyped* base, const TString& field); TFunction* handleFunctionDeclarator(const TSourceLoc&, TFunction& function, bool prototype); TIntermAggregate* handleFunctionDefinition(const TSourceLoc&, TFunction&); + void handleFunctionArgument(TFunction*, TIntermAggregate*&, TIntermTyped*); TIntermTyped* handleFunctionCall(const TSourceLoc&, TFunction*, TIntermNode*); TIntermTyped* handleLengthMethod(const TSourceLoc&, TFunction*, TIntermNode*); void addInputArgumentConversions(const TFunction&, TIntermNode*&) const; TIntermTyped* addOutputArgumentConversions(const TFunction&, TIntermAggregate&) const; void builtInOpCheck(const TSourceLoc&, const TFunction&, TIntermOperator&); - TFunction* handleConstructorCall(const TSourceLoc&, const TPublicType&); + TFunction* handleConstructorCall(const TSourceLoc&, const TType&); bool parseVectorFields(const TSourceLoc&, const TString&, int vecSize, TVectorFields&); void assignError(const TSourceLoc&, const char* op, TString left, TString right); From 48882ef5a8d1c68851389d0e06dcce1f0a86e1b7 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Sun, 13 Mar 2016 12:22:00 -0600 Subject: [PATCH 007/140] HLSL: Get correct set of reserved words. --- hlsl/hlslScanContext.cpp | 46 +++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/hlsl/hlslScanContext.cpp b/hlsl/hlslScanContext.cpp index b2c85be7..50277cfd 100755 --- a/hlsl/hlslScanContext.cpp +++ b/hlsl/hlslScanContext.cpp @@ -239,34 +239,36 @@ void HlslScanContext::fillInKeywordMap() // TODO: get correct set here ReservedSet = new std::unordered_set; - ReservedSet->insert("common"); - ReservedSet->insert("partition"); - ReservedSet->insert("active"); - ReservedSet->insert("asm"); + ReservedSet->insert("auto"); + ReservedSet->insert("catch"); + ReservedSet->insert("char"); ReservedSet->insert("class"); - ReservedSet->insert("union"); + ReservedSet->insert("const_cast"); ReservedSet->insert("enum"); + ReservedSet->insert("explicit"); + ReservedSet->insert("friend"); + ReservedSet->insert("goto"); + ReservedSet->insert("long"); + ReservedSet->insert("mutable"); + ReservedSet->insert("new"); + ReservedSet->insert("operator"); + ReservedSet->insert("private"); + ReservedSet->insert("protected"); + ReservedSet->insert("public"); + ReservedSet->insert("reinterpret_cast"); + ReservedSet->insert("short"); + ReservedSet->insert("signed"); + ReservedSet->insert("sizeof"); + ReservedSet->insert("static_cast"); ReservedSet->insert("template"); ReservedSet->insert("this"); - ReservedSet->insert("goto"); - ReservedSet->insert("inline"); - ReservedSet->insert("noinline"); - ReservedSet->insert("public"); - ReservedSet->insert("extern"); - ReservedSet->insert("external"); - ReservedSet->insert("interface"); - ReservedSet->insert("long"); - ReservedSet->insert("short"); - ReservedSet->insert("half"); - ReservedSet->insert("fixed"); + ReservedSet->insert("throw"); + ReservedSet->insert("try"); + ReservedSet->insert("typename"); + ReservedSet->insert("union"); ReservedSet->insert("unsigned"); - ReservedSet->insert("input"); - ReservedSet->insert("output"); - ReservedSet->insert("filter"); - ReservedSet->insert("sizeof"); - ReservedSet->insert("cast"); - ReservedSet->insert("namespace"); ReservedSet->insert("using"); + ReservedSet->insert("virtual"); } void HlslScanContext::deleteKeywordMap() From 5f934b039a0dfa1803805f8a7eceb776fe4f7049 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Sun, 13 Mar 2016 17:58:25 -0600 Subject: [PATCH 008/140] HLSL: Accept basic funtion definitions. (Not yet mapping input/output for entry point.) --- Test/baseResults/hlsl.frag.out | 65 +++++----- Test/hlsl.frag | 14 +- hlsl/hlslGrammar.cpp | 231 ++++++++++++++++++++++++++++----- hlsl/hlslGrammar.h | 6 +- 4 files changed, 240 insertions(+), 76 deletions(-) diff --git a/Test/baseResults/hlsl.frag.out b/Test/baseResults/hlsl.frag.out index b96e2acd..0fae4aea 100644 --- a/Test/baseResults/hlsl.frag.out +++ b/Test/baseResults/hlsl.frag.out @@ -2,23 +2,23 @@ hlsl.frag Shader version: 100 gl_FragCoord origin is upper left 0:? Sequence -0:5 move second child to first child (temp 4-component vector of float) -0:5 'AmbientColor' (temp 4-component vector of float) +0:1 move second child to first child (temp 4-component vector of float) +0:1 'AmbientColor' (temp 4-component vector of float) 0:? Constant: 0:? 1.000000 0:? 0.500000 0:? 0.000000 0:? 1.000000 -0:6 move second child to first child (temp float) -0:6 'AmbientIntensity' (temp float) -0:6 Constant: -0:6 0.100000 +0:8 Function Definition: PixelShaderFunction(vf4; (temp 4-component vector of float) +0:5 Function Parameters: +0:5 'input' (temp 4-component vector of float) +0:? Sequence +0:6 Branch: Return with expression +0:6 add (temp 4-component vector of float) +0:6 'input' (temp 4-component vector of float) +0:6 'AmbientColor' (temp 4-component vector of float) 0:? Linker Objects -0:? 'World' (temp 4X4 matrix of float) -0:? 'View' (temp 4X4 matrix of float) -0:? 'Projection' (temp 4X4 matrix of float) 0:? 'AmbientColor' (temp 4-component vector of float) -0:? 'AmbientIntensity' (temp float) Linked fragment stage: @@ -27,27 +27,27 @@ Linked fragment stage: Shader version: 100 gl_FragCoord origin is upper left 0:? Sequence -0:5 move second child to first child (temp 4-component vector of float) -0:5 'AmbientColor' (temp 4-component vector of float) +0:1 move second child to first child (temp 4-component vector of float) +0:1 'AmbientColor' (temp 4-component vector of float) 0:? Constant: 0:? 1.000000 0:? 0.500000 0:? 0.000000 0:? 1.000000 -0:6 move second child to first child (temp float) -0:6 'AmbientIntensity' (temp float) -0:6 Constant: -0:6 0.100000 +0:8 Function Definition: PixelShaderFunction(vf4; (temp 4-component vector of float) +0:5 Function Parameters: +0:5 'input' (temp 4-component vector of float) +0:? Sequence +0:6 Branch: Return with expression +0:6 add (temp 4-component vector of float) +0:6 'input' (temp 4-component vector of float) +0:6 'AmbientColor' (temp 4-component vector of float) 0:? Linker Objects -0:? 'World' (temp 4X4 matrix of float) -0:? 'View' (temp 4X4 matrix of float) -0:? 'Projection' (temp 4X4 matrix of float) 0:? 'AmbientColor' (temp 4-component vector of float) -0:? 'AmbientIntensity' (temp float) // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 17 +// Id's are bound by 15 Capability Shader 1: ExtInstImport "GLSL.std.450" @@ -56,24 +56,19 @@ gl_FragCoord origin is upper left ExecutionMode 4 OriginUpperLeft Source HLSL 100 Name 4 "PixelShaderFunction" - Name 10 "World" - Name 11 "View" - Name 12 "Projection" - Name 14 "AmbientColor" - Name 16 "AmbientIntensity" + Name 9 "input" + Name 11 "AmbientColor" 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 7: TypeVector 6(float) 4 - 8: TypeMatrix 7(fvec4) 4 - 9: TypePointer Function 8 - 13: TypePointer Function 7(fvec4) - 15: TypePointer Function 6(float) + 8: TypePointer Function 7(fvec4) 4(PixelShaderFunction): 2 Function None 3 5: Label - 10(World): 9(ptr) Variable Function - 11(View): 9(ptr) Variable Function - 12(Projection): 9(ptr) Variable Function -14(AmbientColor): 13(ptr) Variable Function -16(AmbientIntensity): 15(ptr) Variable Function + 9(input): 8(ptr) Variable Function +11(AmbientColor): 8(ptr) Variable Function + 10: 7(fvec4) Load 9(input) + 12: 7(fvec4) Load 11(AmbientColor) + 13: 7(fvec4) FAdd 10 12 + ReturnValue 13 FunctionEnd diff --git a/Test/hlsl.frag b/Test/hlsl.frag index 9107248f..7ee58499 100644 --- a/Test/hlsl.frag +++ b/Test/hlsl.frag @@ -1,11 +1,7 @@ -float4x4 World; -float4x4 View; -float4x4 Projection; - float4 AmbientColor = float4(1, 0.5, 0, 1); -float AmbientIntensity = 0.1; +//float AmbientIntensity = 0.1; -//float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 -//{ -// return AmbientColor * AmbientIntensity; -//} +float4 PixelShaderFunction(float4 input) : COLOR0 +{ + return input /* * AmbientIntensity */ + AmbientColor; +} diff --git a/hlsl/hlslGrammar.cpp b/hlsl/hlslGrammar.cpp index 20d7bb3f..86c27eec 100755 --- a/hlsl/hlslGrammar.cpp +++ b/hlsl/hlslGrammar.cpp @@ -110,12 +110,12 @@ bool HlslGrammar::acceptCompilationUnit() } // declaration -// : SEMICOLON +// : ; // : fully_specified_type ; // | fully_specified_type identifier ; // | fully_specified_type identifier = expression ; -// | fully_specified_type identifier function_parameters ; // function prototype -// | fully_specified_type function_parameters compound_statement // function definition +// | fully_specified_type identifier function_parameters ; // function prototype +// | fully_specified_type identifier function_parameters : semantic compound_statement // function definition // // 'node' could get created if the declaration creates code, like an initializer // or a function body. @@ -149,9 +149,34 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& node) node = parseContext.declareVariable(declLoc, *declName, type, 0, expressionNode); return true; } + + // function_parameters + TFunction* function = new TFunction(declName, type); + if (acceptFunctionParameters(*function)) { + // : + if (acceptTokenClass(EHTokColon)) { + // semantic + if (token.tokenClass == EHTokIdentifier) { + TString* semantic = token.string; + advanceToken(); + } else { + expected("semantic"); + return false; + } + } + // compound_statement + if (token.tokenClass == EHTokLeftBrace) + return acceptFunctionDefinition(*function, node); + + // ; + if (acceptTokenClass(EHTokSemicolon)) + return true; + + return false; + } } - // no identifier, just ; + // ; [ no identifier, just ; ] if (acceptTokenClass(EHTokSemicolon)) return true; @@ -281,19 +306,110 @@ bool HlslGrammar::acceptType(TType& type) return true; } +// function_parameters +// : ( parameter_declaration , parameter_declaration ... ) +// +bool HlslGrammar::acceptFunctionParameters(TFunction& function) +{ + // ( + if (! acceptTokenClass(EHTokLeftParen)) + return false; + + do { + // parameter_declaration + if (! acceptParameterDeclaration(function)) + break; + + // , + if (! acceptTokenClass(EHTokComma)) + break; + } while (true); + + // ) + if (! acceptTokenClass(EHTokRightParen)) { + expected("right parenthesis"); + return false; + } + + return true; +} + +// parameter_declaration +// : fully_specified_type +// | fully_specified_type identifier +// +bool HlslGrammar::acceptParameterDeclaration(TFunction& function) +{ + // fully_specified_type + TType* type = new TType; + if (! acceptFullySpecifiedType(*type)) + return false; + + // identifier + TString name; + if (token.tokenClass == EHTokIdentifier) { + name = *token.string; + advanceToken(); + } + + TParameter param = { token.string, type }; + function.addParameter(param); + + return true; +} + +// Do the work to create the function definition in addition to +// parsing the body (compound_statement). +bool HlslGrammar::acceptFunctionDefinition(TFunction& function, TIntermNode*& node) +{ + TFunction* functionDeclarator = parseContext.handleFunctionDeclarator(token.loc, function, false /* not prototype */); + + // This does a symbol table push + node = parseContext.handleFunctionDefinition(token.loc, *functionDeclarator); + + // compound_statement + TIntermAggregate* functionBody = nullptr; + if (acceptCompoundStatement(functionBody)) { + node = parseContext.intermediate.growAggregate(node, functionBody); + parseContext.intermediate.setAggregateOperator(node, EOpFunction, functionDeclarator->getType(), token.loc); + node->getAsAggregate()->setName(functionDeclarator->getMangledName().c_str()); + parseContext.symbolTable.pop(nullptr); + + return true; + } + + return false; +} + // expression // : identifier +// | identifier operator identifier // to be generalized to all expressions // | ( expression ) // | type(...) // constructor // | literal -// | identifier operator identifier // to be generalized to all expressions // bool HlslGrammar::acceptExpression(TIntermTyped*& node) { // identifier if (token.tokenClass == EHTokIdentifier) { - node = parseContext.handleVariable(token.loc, token.symbol, token.string); - return true; + TIntermTyped* left = parseContext.handleVariable(token.loc, token.symbol, token.string); + advanceToken(); + + // operator? + TOperator op; + if (! acceptOperator(op)) + return true; + TSourceLoc loc = token.loc; + + // identifier + if (token.tokenClass == EHTokIdentifier) { + TIntermTyped* right = parseContext.handleVariable(token.loc, token.symbol, token.string); + advanceToken(); + node = parseContext.intermediate.addBinaryMath(op, left, right, loc); + return true; + } + + return false; } // ( expression ) @@ -318,28 +434,7 @@ bool HlslGrammar::acceptExpression(TIntermTyped*& node) if (acceptConstructor(node)) return true; - // identifier operator identifier - if (token.tokenClass == EHTokIdentifier) { - TIntermTyped* left = parseContext.handleVariable(token.loc, token.symbol, token.string); - advanceToken(); - - // operator - TOperator op; - if (! acceptOperator(op)) - return false; - TSourceLoc loc = token.loc; - - // right - if (token.tokenClass == EHTokIdentifier) { - TIntermTyped* right = parseContext.handleVariable(token.loc, token.symbol, token.string); - advanceToken(); - node = parseContext.intermediate.addBinaryMath(op, left, right, loc); - } else - return false; - } else - return false; - - return true; + return false; } // constructor @@ -430,12 +525,26 @@ bool HlslGrammar::acceptLiteral(TIntermTyped*& node) return true; } +// operator +// : + | - | * | / | ... bool HlslGrammar::acceptOperator(TOperator& op) { switch (token.tokenClass) { + case EHTokEqual: + op = EOpAssign; + break; case EHTokPlus: op = EOpAdd; break; + case EHTokDash: + op = EOpSub; + break; + case EHTokStar: + op = EOpMul; + break; + case EHTokSlash: + op = EOpDiv; + break; default: return false; } @@ -445,9 +554,69 @@ bool HlslGrammar::acceptOperator(TOperator& op) return true; } -bool HlslGrammar::acceptCompoundStatement() +// compound_statement +// : { statement statement ... } +// +bool HlslGrammar::acceptCompoundStatement(TIntermAggregate*& compoundStatement) { - return false; + // { + if (! acceptTokenClass(EHTokLeftBrace)) + return false; + + // statement statement ... + TIntermNode* statement = nullptr; + while (acceptStatement(statement)) { + // hook it up + compoundStatement = parseContext.intermediate.growAggregate(compoundStatement, statement); + } + compoundStatement->setOperator(EOpSequence); + + // } + return acceptTokenClass(EHTokRightBrace); +} + +// statement +// : compound_statement +// | return ; +// | return expression ; +// | expression ; +// +bool HlslGrammar::acceptStatement(TIntermNode*& statement) +{ + // compound_statement + TIntermAggregate* compoundStatement = nullptr; + if (acceptCompoundStatement(compoundStatement)) { + statement = compoundStatement; + return true; + } + + // return + if (acceptTokenClass(EHTokReturn)) { + // expression + TIntermTyped* node; + if (acceptExpression(node)) { + // hook it up + statement = parseContext.intermediate.addBranch(EOpReturn, node, token.loc); + } else + statement = parseContext.intermediate.addBranch(EOpReturn, token.loc); + + // ; + if (! acceptTokenClass(EHTokSemicolon)) + return false; + + return true; + } + + // expression + TIntermTyped* node; + if (acceptExpression(node)) + statement = node; + + // ; + if (! acceptTokenClass(EHTokSemicolon)) + return false; + + return true; } } // end namespace glslang diff --git a/hlsl/hlslGrammar.h b/hlsl/hlslGrammar.h index 8239d3e9..baea5fed 100755 --- a/hlsl/hlslGrammar.h +++ b/hlsl/hlslGrammar.h @@ -59,12 +59,16 @@ namespace glslang { bool acceptFullySpecifiedType(TType&); void acceptQualifier(TQualifier&); bool acceptType(TType&); - bool acceptCompoundStatement(); + bool acceptFunctionParameters(TFunction&); + bool acceptParameterDeclaration(TFunction&); + bool acceptFunctionDefinition(TFunction&, TIntermNode*&); bool acceptExpression(TIntermTyped*&); bool acceptConstructor(TIntermTyped*&); bool acceptArguments(TFunction*, TIntermAggregate*&); bool acceptLiteral(TIntermTyped*&); bool acceptOperator(TOperator& op); + bool acceptCompoundStatement(TIntermAggregate*&); + bool acceptStatement(TIntermNode*&); HlslScanContext& scanContext; HlslParseContext& parseContext; From 078d7f24bdb16d4a27fcab4127b8c90444a9b8a4 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Mon, 14 Mar 2016 10:02:11 -0600 Subject: [PATCH 009/140] HLSL: Simplify appearances a bit to make easier to read. --- hlsl/hlslGrammar.cpp | 137 ++++++++++++++++++++++++------------------- hlsl/hlslGrammar.h | 17 ++++-- 2 files changed, 89 insertions(+), 65 deletions(-) diff --git a/hlsl/hlslGrammar.cpp b/hlsl/hlslGrammar.cpp index 86c27eec..2ebb271d 100755 --- a/hlsl/hlslGrammar.cpp +++ b/hlsl/hlslGrammar.cpp @@ -42,7 +42,7 @@ // recognized its rule // // As much as possible, only grammar recognition should happen in this file, -// with all other work being farmed out to hlslParseHelper.cpp, which it turn +// with all other work being farmed out to hlslParseHelper.cpp, which in turn // will build the AST. // // The next token, yet to be "accepted" is always sitting in 'token'. @@ -71,7 +71,7 @@ void HlslGrammar::expected(const char* syntax) // Load 'token' with the next token in the stream of tokens. void HlslGrammar::advanceToken() { - scanContext.tokenize(token); + scanner.tokenize(token); } // Return true and advance to the next token if the current token is the @@ -86,6 +86,13 @@ bool HlslGrammar::acceptTokenClass(EHlslTokenClass tokenClass) return false; } +// Return true, without advancing to the next token, if the current token is +// the expected (passed in) token class. +bool HlslGrammar::peekTokenClass(EHlslTokenClass tokenClass) +{ + return token.tokenClass == tokenClass; +} + // compilationUnit // : list of externalDeclaration // @@ -100,22 +107,22 @@ bool HlslGrammar::acceptCompilationUnit() return false; // hook it up - unitNode = parseContext.intermediate.growAggregate(unitNode, declarationNode); + unitNode = intermediate.growAggregate(unitNode, declarationNode); } // set root of AST - parseContext.intermediate.setTreeRoot(unitNode); + intermediate.setTreeRoot(unitNode); return true; } // declaration -// : ; -// : fully_specified_type ; -// | fully_specified_type identifier ; -// | fully_specified_type identifier = expression ; -// | fully_specified_type identifier function_parameters ; // function prototype -// | fully_specified_type identifier function_parameters : semantic compound_statement // function definition +// : SEMICOLON +// : fully_specified_type SEMICOLON +// | fully_specified_type identifier SEMICOLON +// | fully_specified_type identifier = expression SEMICOLON +// | fully_specified_type identifier function_parameters SEMICOLON // function prototype +// | fully_specified_type identifier function_parameters COLON semantic compound_statement // function definition // // 'node' could get created if the declaration creates code, like an initializer // or a function body. @@ -130,7 +137,7 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& node) return false; // identifier - if (token.tokenClass == EHTokIdentifier) { + if (peekTokenClass(EHTokIdentifier)) { TSourceLoc declLoc = token.loc; TString* declName = token.string; advanceToken(); @@ -144,7 +151,7 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& node) } } - // ; + // SEMICOLON if (acceptTokenClass(EHTokSemicolon)) { node = parseContext.declareVariable(declLoc, *declName, type, 0, expressionNode); return true; @@ -153,22 +160,14 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& node) // function_parameters TFunction* function = new TFunction(declName, type); if (acceptFunctionParameters(*function)) { - // : - if (acceptTokenClass(EHTokColon)) { - // semantic - if (token.tokenClass == EHTokIdentifier) { - TString* semantic = token.string; - advanceToken(); - } else { - expected("semantic"); - return false; - } - } + // COLON semantic + acceptSemantic(); + // compound_statement - if (token.tokenClass == EHTokLeftBrace) + if (peekTokenClass(EHTokLeftBrace)) return acceptFunctionDefinition(*function, node); - // ; + // SEMICOLON if (acceptTokenClass(EHTokSemicolon)) return true; @@ -176,7 +175,7 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& node) } } - // ; [ no identifier, just ; ] + // SEMICOLON if (acceptTokenClass(EHTokSemicolon)) return true; @@ -307,11 +306,11 @@ bool HlslGrammar::acceptType(TType& type) } // function_parameters -// : ( parameter_declaration , parameter_declaration ... ) +// : LEFT_PAREN parameter_declaration COMMA parameter_declaration ... RIGHT_PAREN // bool HlslGrammar::acceptFunctionParameters(TFunction& function) { - // ( + // LEFT_PAREN if (! acceptTokenClass(EHTokLeftParen)) return false; @@ -320,12 +319,12 @@ bool HlslGrammar::acceptFunctionParameters(TFunction& function) if (! acceptParameterDeclaration(function)) break; - // , + // COMMA if (! acceptTokenClass(EHTokComma)) break; } while (true); - // ) + // RIGHT_PAREN if (! acceptTokenClass(EHTokRightParen)) { expected("right parenthesis"); return false; @@ -347,7 +346,7 @@ bool HlslGrammar::acceptParameterDeclaration(TFunction& function) // identifier TString name; - if (token.tokenClass == EHTokIdentifier) { + if (peekTokenClass(EHTokIdentifier)) { name = *token.string; advanceToken(); } @@ -370,8 +369,8 @@ bool HlslGrammar::acceptFunctionDefinition(TFunction& function, TIntermNode*& no // compound_statement TIntermAggregate* functionBody = nullptr; if (acceptCompoundStatement(functionBody)) { - node = parseContext.intermediate.growAggregate(node, functionBody); - parseContext.intermediate.setAggregateOperator(node, EOpFunction, functionDeclarator->getType(), token.loc); + node = intermediate.growAggregate(node, functionBody); + intermediate.setAggregateOperator(node, EOpFunction, functionDeclarator->getType(), token.loc); node->getAsAggregate()->setName(functionDeclarator->getMangledName().c_str()); parseContext.symbolTable.pop(nullptr); @@ -383,15 +382,15 @@ bool HlslGrammar::acceptFunctionDefinition(TFunction& function, TIntermNode*& no // expression // : identifier -// | identifier operator identifier // to be generalized to all expressions -// | ( expression ) -// | type(...) // constructor +// | identifier operator identifier // todo: generalize to all expressions +// | LEFT_PAREN expression RIGHT_PAREN +// | constructor // | literal // bool HlslGrammar::acceptExpression(TIntermTyped*& node) { // identifier - if (token.tokenClass == EHTokIdentifier) { + if (peekTokenClass(EHTokIdentifier)) { TIntermTyped* left = parseContext.handleVariable(token.loc, token.symbol, token.string); advanceToken(); @@ -402,17 +401,17 @@ bool HlslGrammar::acceptExpression(TIntermTyped*& node) TSourceLoc loc = token.loc; // identifier - if (token.tokenClass == EHTokIdentifier) { + if (peekTokenClass(EHTokIdentifier)) { TIntermTyped* right = parseContext.handleVariable(token.loc, token.symbol, token.string); advanceToken(); - node = parseContext.intermediate.addBinaryMath(op, left, right, loc); + node = intermediate.addBinaryMath(op, left, right, loc); return true; } return false; } - // ( expression ) + // LEFT_PAREN expression RIGHT_PAREN if (acceptTokenClass(EHTokLeftParen)) { if (! acceptExpression(node)) { expected("expression"); @@ -430,7 +429,7 @@ bool HlslGrammar::acceptExpression(TIntermTyped*& node) if (acceptLiteral(node)) return true; - // type(...) // constructor + // constructor if (acceptConstructor(node)) return true; @@ -438,7 +437,7 @@ bool HlslGrammar::acceptExpression(TIntermTyped*& node) } // constructor -// : type arguments +// : type argument_list // bool HlslGrammar::acceptConstructor(TIntermTyped*& node) { @@ -466,14 +465,14 @@ bool HlslGrammar::acceptConstructor(TIntermTyped*& node) } // arguments -// : ( expression , expression, ... ) +// : LEFT_PAREN expression COMMA expression COMMA ... RIGHT_PAREN // // The arguments are pushed onto the 'function' argument list and // onto the 'arguments' aggregate. // bool HlslGrammar::acceptArguments(TFunction* function, TIntermAggregate*& arguments) { - // ( + // LEFT_PAREN if (! acceptTokenClass(EHTokLeftParen)) return false; @@ -486,12 +485,12 @@ bool HlslGrammar::acceptArguments(TFunction* function, TIntermAggregate*& argume // hook it up parseContext.handleFunctionArgument(function, arguments, arg); - // , + // COMMA if (! acceptTokenClass(EHTokComma)) break; } while (true); - // ) + // RIGHT_PAREN if (! acceptTokenClass(EHTokRightParen)) { expected("right parenthesis"); return false; @@ -504,16 +503,16 @@ bool HlslGrammar::acceptLiteral(TIntermTyped*& node) { switch (token.tokenClass) { case EHTokIntConstant: - node = parseContext.intermediate.addConstantUnion(token.i, token.loc, true); + node = intermediate.addConstantUnion(token.i, token.loc, true); break; case EHTokFloatConstant: - node = parseContext.intermediate.addConstantUnion(token.d, EbtFloat, token.loc, true); + node = intermediate.addConstantUnion(token.d, EbtFloat, token.loc, true); break; case EHTokDoubleConstant: - node = parseContext.intermediate.addConstantUnion(token.d, EbtDouble, token.loc, true); + node = intermediate.addConstantUnion(token.d, EbtDouble, token.loc, true); break; case EHTokBoolConstant: - node = parseContext.intermediate.addConstantUnion(token.b, token.loc, true); + node = intermediate.addConstantUnion(token.b, token.loc, true); break; default: @@ -526,7 +525,7 @@ bool HlslGrammar::acceptLiteral(TIntermTyped*& node) } // operator -// : + | - | * | / | ... +// : PLUS | DASH | STAR | SLASH | ... bool HlslGrammar::acceptOperator(TOperator& op) { switch (token.tokenClass) { @@ -567,7 +566,7 @@ bool HlslGrammar::acceptCompoundStatement(TIntermAggregate*& compoundStatement) TIntermNode* statement = nullptr; while (acceptStatement(statement)) { // hook it up - compoundStatement = parseContext.intermediate.growAggregate(compoundStatement, statement); + compoundStatement = intermediate.growAggregate(compoundStatement, statement); } compoundStatement->setOperator(EOpSequence); @@ -577,9 +576,9 @@ bool HlslGrammar::acceptCompoundStatement(TIntermAggregate*& compoundStatement) // statement // : compound_statement -// | return ; -// | return expression ; -// | expression ; +// | return SEMICOLON +// | return expression SEMICOLON +// | expression SEMICOLON // bool HlslGrammar::acceptStatement(TIntermNode*& statement) { @@ -590,17 +589,17 @@ bool HlslGrammar::acceptStatement(TIntermNode*& statement) return true; } - // return + // RETURN if (acceptTokenClass(EHTokReturn)) { // expression TIntermTyped* node; if (acceptExpression(node)) { // hook it up - statement = parseContext.intermediate.addBranch(EOpReturn, node, token.loc); + statement = intermediate.addBranch(EOpReturn, node, token.loc); } else - statement = parseContext.intermediate.addBranch(EOpReturn, token.loc); + statement = intermediate.addBranch(EOpReturn, token.loc); - // ; + // SEMICOLON if (! acceptTokenClass(EHTokSemicolon)) return false; @@ -612,11 +611,29 @@ bool HlslGrammar::acceptStatement(TIntermNode*& statement) if (acceptExpression(node)) statement = node; - // ; + // SEMICOLON if (! acceptTokenClass(EHTokSemicolon)) return false; return true; } +// COLON semantic +bool HlslGrammar::acceptSemantic() +{ + // COLON + if (acceptTokenClass(EHTokColon)) { + // semantic + if (peekTokenClass(EHTokIdentifier)) { + TString* semantic = token.string; + advanceToken(); + } else { + expected("semantic"); + return false; + } + } + + return true; +} + } // end namespace glslang diff --git a/hlsl/hlslGrammar.h b/hlsl/hlslGrammar.h index baea5fed..d60f3777 100755 --- a/hlsl/hlslGrammar.h +++ b/hlsl/hlslGrammar.h @@ -41,10 +41,13 @@ namespace glslang { + // Should just be the grammar aspect of HLSL. + // Described in more detail in hlslGrammar.cpp. + class HlslGrammar { public: - HlslGrammar(HlslScanContext& scanContext, HlslParseContext& parseContext) - : scanContext(scanContext), parseContext(parseContext) { } + HlslGrammar(HlslScanContext& scanner, HlslParseContext& parseContext) + : scanner(scanner), parseContext(parseContext), intermediate(parseContext.intermediate) { } virtual ~HlslGrammar() { } bool parse(); @@ -53,6 +56,8 @@ namespace glslang { void expected(const char*); void advanceToken(); bool acceptTokenClass(EHlslTokenClass); + bool peekTokenClass(EHlslTokenClass); + bool lookAheadTokenClass(EHlslTokenClass); bool acceptCompilationUnit(); bool acceptDeclaration(TIntermNode*& node); @@ -69,11 +74,13 @@ namespace glslang { bool acceptOperator(TOperator& op); bool acceptCompoundStatement(TIntermAggregate*&); bool acceptStatement(TIntermNode*&); + bool acceptSemantic(); - HlslScanContext& scanContext; - HlslParseContext& parseContext; + HlslScanContext& scanner; // lexical scanner, to get next token + HlslParseContext& parseContext; // state of parsing and helper functions for building the intermediate + TIntermediate& intermediate; // the final product, the intermediate representation, includes the AST - HlslToken token; + HlslToken token; // the current token we are processing }; } // end namespace glslang From aecd497c968d7538a23f3551c6967ecb77f47ed7 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Mon, 14 Mar 2016 10:46:34 -0600 Subject: [PATCH 010/140] HLSL: Abstract accepting an identifier. --- hlsl/hlslGrammar.cpp | 50 +++++++++++++++++++++++------------------- hlsl/hlslGrammar.h | 2 +- hlsl/hlslScanContext.h | 28 +++++++++++++++-------- 3 files changed, 47 insertions(+), 33 deletions(-) diff --git a/hlsl/hlslGrammar.cpp b/hlsl/hlslGrammar.cpp index 2ebb271d..4528a191 100755 --- a/hlsl/hlslGrammar.cpp +++ b/hlsl/hlslGrammar.cpp @@ -93,6 +93,19 @@ bool HlslGrammar::peekTokenClass(EHlslTokenClass tokenClass) return token.tokenClass == tokenClass; } +// Only process the next token if it is an identifier. +// Return true if it was an identifier. +bool HlslGrammar::acceptIdentifier(HlslToken& idToken) +{ + if (peekTokenClass(EHTokIdentifier)) { + idToken = token; + advanceToken(); + return true; + } + + return false; +} + // compilationUnit // : list of externalDeclaration // @@ -137,11 +150,8 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& node) return false; // identifier - if (peekTokenClass(EHTokIdentifier)) { - TSourceLoc declLoc = token.loc; - TString* declName = token.string; - advanceToken(); - + HlslToken idToken; + if (acceptIdentifier(idToken)) { // = expression TIntermTyped* expressionNode = nullptr; if (acceptTokenClass(EHTokEqual)) { @@ -153,12 +163,12 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& node) // SEMICOLON if (acceptTokenClass(EHTokSemicolon)) { - node = parseContext.declareVariable(declLoc, *declName, type, 0, expressionNode); + node = parseContext.declareVariable(idToken.loc, *idToken.string, type, 0, expressionNode); return true; } // function_parameters - TFunction* function = new TFunction(declName, type); + TFunction* function = new TFunction(idToken.string, type); if (acceptFunctionParameters(*function)) { // COLON semantic acceptSemantic(); @@ -345,13 +355,10 @@ bool HlslGrammar::acceptParameterDeclaration(TFunction& function) return false; // identifier - TString name; - if (peekTokenClass(EHTokIdentifier)) { - name = *token.string; - advanceToken(); - } + HlslToken idToken; + acceptIdentifier(idToken); - TParameter param = { token.string, type }; + TParameter param = { idToken.string, type }; function.addParameter(param); return true; @@ -390,9 +397,9 @@ bool HlslGrammar::acceptFunctionDefinition(TFunction& function, TIntermNode*& no bool HlslGrammar::acceptExpression(TIntermTyped*& node) { // identifier - if (peekTokenClass(EHTokIdentifier)) { - TIntermTyped* left = parseContext.handleVariable(token.loc, token.symbol, token.string); - advanceToken(); + HlslToken idToken; + if (acceptIdentifier(idToken)) { + TIntermTyped* left = parseContext.handleVariable(idToken.loc, idToken.symbol, token.string); // operator? TOperator op; @@ -401,9 +408,8 @@ bool HlslGrammar::acceptExpression(TIntermTyped*& node) TSourceLoc loc = token.loc; // identifier - if (peekTokenClass(EHTokIdentifier)) { - TIntermTyped* right = parseContext.handleVariable(token.loc, token.symbol, token.string); - advanceToken(); + if (acceptIdentifier(idToken)) { + TIntermTyped* right = parseContext.handleVariable(idToken.loc, idToken.symbol, token.string); node = intermediate.addBinaryMath(op, left, right, loc); return true; } @@ -624,10 +630,8 @@ bool HlslGrammar::acceptSemantic() // COLON if (acceptTokenClass(EHTokColon)) { // semantic - if (peekTokenClass(EHTokIdentifier)) { - TString* semantic = token.string; - advanceToken(); - } else { + HlslToken idToken; + if (! acceptIdentifier(idToken)) { expected("semantic"); return false; } diff --git a/hlsl/hlslGrammar.h b/hlsl/hlslGrammar.h index d60f3777..902ba228 100755 --- a/hlsl/hlslGrammar.h +++ b/hlsl/hlslGrammar.h @@ -57,7 +57,7 @@ namespace glslang { void advanceToken(); bool acceptTokenClass(EHlslTokenClass); bool peekTokenClass(EHlslTokenClass); - bool lookAheadTokenClass(EHlslTokenClass); + bool acceptIdentifier(HlslToken&); bool acceptCompilationUnit(); bool acceptDeclaration(TIntermNode*& node); diff --git a/hlsl/hlslScanContext.h b/hlsl/hlslScanContext.h index df0d2bc6..04f24383 100755 --- a/hlsl/hlslScanContext.h +++ b/hlsl/hlslScanContext.h @@ -34,8 +34,8 @@ // // -// This holds context specific to the GLSL scanner, which -// sits between the preprocessor scanner and parser. +// This holds context specific to the HLSL scanner, which +// sits between the preprocessor scanner and HLSL parser. // #ifndef HLSLSCANCONTEXT_H_ @@ -49,20 +49,30 @@ namespace glslang { class TPpContext; class TPpToken; + +// +// Everything needed to fully describe a token. +// struct HlslToken { - TSourceLoc loc; - EHlslTokenClass tokenClass; - bool isType; - union { - glslang::TString *string; - int i; + HlslToken() : isType(false), string(nullptr), symbol(nullptr) { loc.init(); } + TSourceLoc loc; // location of token in the source + EHlslTokenClass tokenClass; // what kind of token it is + bool isType; // true if the token represents a user type + union { // what data the token holds + glslang::TString *string; // for identifiers + int i; // for literals unsigned int u; bool b; double d; }; - glslang::TSymbol* symbol; + glslang::TSymbol* symbol; // if a symbol table lookup was done already, this is the result }; +// +// The state of scanning and translating raw tokens to slightly richer +// semantics, like knowing if an identifier is an existing symbol, or +// user-defined type. +// class HlslScanContext { public: HlslScanContext(TParseContextBase& parseContext, TPpContext& ppContext) From cb0e471ad4e24a9ec655edf77c08f9e38dda5f39 Mon Sep 17 00:00:00 2001 From: Rex Xu Date: Sun, 27 Mar 2016 08:42:23 +0800 Subject: [PATCH 011/140] Parser: Update array size of gl_ClipDistance/gl_CullDistance in gl_in[]. --- Test/baseResults/150.geom.out | 16 +- Test/baseResults/150.tesc.out | 106 ++++---- Test/baseResults/400.tesc.out | 34 +-- Test/baseResults/400.tese.out | 16 +- Test/baseResults/420.tesc.out | 14 +- Test/baseResults/450.geom.out | 8 +- Test/baseResults/450.tesc.out | 16 +- Test/baseResults/450.tese.out | 8 +- Test/baseResults/spv.400.tesc.out | 273 +++++++++++---------- Test/baseResults/spv.400.tese.out | 132 +++++----- glslang/MachineIndependent/ParseHelper.cpp | 24 +- 11 files changed, 330 insertions(+), 317 deletions(-) diff --git a/Test/baseResults/150.geom.out b/Test/baseResults/150.geom.out index aa00868d..48b7925f 100644 --- a/Test/baseResults/150.geom.out +++ b/Test/baseResults/150.geom.out @@ -215,9 +215,9 @@ ERROR: node is still EOpNull! 0:33 Constant: 0:33 3 (const int) 0:33 direct index (temp float ClipDistance) -0:33 gl_ClipDistance: direct index for structure (in 1-element array of float ClipDistance) -0:33 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) -0:33 'gl_in' (in 4-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:33 gl_ClipDistance: direct index for structure (in 3-element array of float ClipDistance) +0:33 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) +0:33 'gl_in' (in 4-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) 0:33 Constant: 0:33 1 (const int) 0:33 Constant: @@ -230,8 +230,8 @@ ERROR: node is still EOpNull! 0:34 Constant: 0:34 0 (const uint) 0:34 gl_Position: direct index for structure (in 4-component vector of float Position) -0:34 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) -0:34 'gl_in' (in 4-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:34 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) +0:34 'gl_in' (in 4-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) 0:34 Constant: 0:34 0 (const int) 0:34 Constant: @@ -242,8 +242,8 @@ ERROR: node is still EOpNull! 0:35 Constant: 0:35 1 (const uint) 0:35 gl_PointSize: direct index for structure (in float PointSize) -0:35 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) -0:35 'gl_in' (in 4-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:35 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) +0:35 'gl_in' (in 4-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) 0:35 Constant: 0:35 3 (const int) 0:35 Constant: @@ -293,7 +293,7 @@ ERROR: node is still EOpNull! 0:? 'toF' (layout(stream=0 ) out block{layout(stream=0 ) out 3-component vector of float color}) 0:? 'anon@0' (layout(stream=0 ) out block{layout(stream=0 ) out 3-component vector of float color}) 0:? 'anon@1' (layout(stream=0 ) out block{layout(stream=0 ) gl_Position 4-component vector of float Position gl_Position, layout(stream=0 ) gl_PointSize float PointSize gl_PointSize, layout(stream=0 ) out 4-element array of float ClipDistance gl_ClipDistance}) -0:? 'gl_in' (in 4-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:? 'gl_in' (in 4-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) 0:? 'ov0' (layout(stream=0 ) out 4-component vector of float) 0:? 'ov4' (layout(stream=4 ) out 4-component vector of float) 0:? 'o1v0' (layout(stream=0 ) out 4-component vector of float) diff --git a/Test/baseResults/150.tesc.out b/Test/baseResults/150.tesc.out index a5289c93..8b7ab7dc 100644 --- a/Test/baseResults/150.tesc.out +++ b/Test/baseResults/150.tesc.out @@ -932,8 +932,8 @@ vertices = 4 0:20 move second child to first child (temp 4-component vector of float) 0:20 'p' (temp 4-component vector of float) 0:20 gl_Position: direct index for structure (in 4-component vector of float Position) -0:20 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) -0:20 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:20 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) +0:20 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) 0:20 Constant: 0:20 1 (const int) 0:20 Constant: @@ -942,8 +942,8 @@ vertices = 4 0:21 move second child to first child (temp float) 0:21 'ps' (temp float) 0:21 gl_PointSize: direct index for structure (in float PointSize) -0:21 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) -0:21 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:21 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) +0:21 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) 0:21 Constant: 0:21 1 (const int) 0:21 Constant: @@ -952,9 +952,9 @@ vertices = 4 0:22 move second child to first child (temp float) 0:22 'cd' (temp float) 0:22 direct index (temp float ClipDistance) -0:22 gl_ClipDistance: direct index for structure (in 1-element array of float ClipDistance) -0:22 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) -0:22 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:22 gl_ClipDistance: direct index for structure (in 3-element array of float ClipDistance) +0:22 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) +0:22 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) 0:22 Constant: 0:22 1 (const int) 0:22 Constant: @@ -975,25 +975,25 @@ vertices = 4 0:26 'gl_InvocationID' (in int InvocationID) 0:28 move second child to first child (temp 4-component vector of float) 0:28 gl_Position: direct index for structure (out 4-component vector of float Position) -0:28 indirect index (temp block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance}) -0:28 'gl_out' (out 4-element array of block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance}) +0:28 indirect index (temp block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 2-element array of float ClipDistance gl_ClipDistance}) +0:28 'gl_out' (out 4-element array of block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 2-element array of float ClipDistance gl_ClipDistance}) 0:28 'gl_InvocationID' (in int InvocationID) 0:28 Constant: 0:28 0 (const int) 0:28 'p' (temp 4-component vector of float) 0:29 move second child to first child (temp float) 0:29 gl_PointSize: direct index for structure (out float PointSize) -0:29 indirect index (temp block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance}) -0:29 'gl_out' (out 4-element array of block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance}) +0:29 indirect index (temp block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 2-element array of float ClipDistance gl_ClipDistance}) +0:29 'gl_out' (out 4-element array of block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 2-element array of float ClipDistance gl_ClipDistance}) 0:29 'gl_InvocationID' (in int InvocationID) 0:29 Constant: 0:29 1 (const int) 0:29 'ps' (temp float) 0:30 move second child to first child (temp float) 0:30 direct index (temp float ClipDistance) -0:30 gl_ClipDistance: direct index for structure (out 1-element array of float ClipDistance) -0:30 indirect index (temp block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance}) -0:30 'gl_out' (out 4-element array of block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance}) +0:30 gl_ClipDistance: direct index for structure (out 2-element array of float ClipDistance) +0:30 indirect index (temp block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 2-element array of float ClipDistance gl_ClipDistance}) +0:30 'gl_out' (out 4-element array of block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 2-element array of float ClipDistance gl_ClipDistance}) 0:30 'gl_InvocationID' (in int InvocationID) 0:30 Constant: 0:30 2 (const int) @@ -1027,8 +1027,8 @@ vertices = 4 0:23 move second child to first child (temp 4-component vector of float) 0:23 'p' (temp 4-component vector of float) 0:23 gl_Position: direct index for structure (in 4-component vector of float Position) -0:23 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) -0:23 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:23 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) +0:23 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) 0:23 Constant: 0:23 1 (const int) 0:23 Constant: @@ -1037,8 +1037,8 @@ vertices = 4 0:24 move second child to first child (temp float) 0:24 'ps' (temp float) 0:24 gl_PointSize: direct index for structure (in float PointSize) -0:24 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) -0:24 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:24 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) +0:24 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) 0:24 Constant: 0:24 1 (const int) 0:24 Constant: @@ -1047,9 +1047,9 @@ vertices = 4 0:25 move second child to first child (temp float) 0:25 'cd' (temp float) 0:25 direct index (temp float ClipDistance) -0:25 gl_ClipDistance: direct index for structure (in 1-element array of float ClipDistance) -0:25 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) -0:25 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:25 gl_ClipDistance: direct index for structure (in 3-element array of float ClipDistance) +0:25 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) +0:25 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) 0:25 Constant: 0:25 1 (const int) 0:25 Constant: @@ -1070,25 +1070,25 @@ vertices = 4 0:29 'gl_InvocationID' (in int InvocationID) 0:31 move second child to first child (temp 4-component vector of float) 0:31 gl_Position: direct index for structure (out 4-component vector of float Position) -0:31 indirect index (temp block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance}) -0:31 'gl_out' (out 4-element array of block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance}) +0:31 indirect index (temp block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 2-element array of float ClipDistance gl_ClipDistance}) +0:31 'gl_out' (out 4-element array of block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 2-element array of float ClipDistance gl_ClipDistance}) 0:31 'gl_InvocationID' (in int InvocationID) 0:31 Constant: 0:31 0 (const int) 0:31 'p' (temp 4-component vector of float) 0:32 move second child to first child (temp float) 0:32 gl_PointSize: direct index for structure (out float PointSize) -0:32 indirect index (temp block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance}) -0:32 'gl_out' (out 4-element array of block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance}) +0:32 indirect index (temp block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 2-element array of float ClipDistance gl_ClipDistance}) +0:32 'gl_out' (out 4-element array of block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 2-element array of float ClipDistance gl_ClipDistance}) 0:32 'gl_InvocationID' (in int InvocationID) 0:32 Constant: 0:32 1 (const int) 0:32 'ps' (temp float) 0:33 move second child to first child (temp float) 0:33 direct index (temp float ClipDistance) -0:33 gl_ClipDistance: direct index for structure (out 1-element array of float ClipDistance) -0:33 indirect index (temp block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance}) -0:33 'gl_out' (out 4-element array of block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance}) +0:33 gl_ClipDistance: direct index for structure (out 2-element array of float ClipDistance) +0:33 indirect index (temp block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 2-element array of float ClipDistance gl_ClipDistance}) +0:33 'gl_out' (out 4-element array of block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 2-element array of float ClipDistance gl_ClipDistance}) 0:33 'gl_InvocationID' (in int InvocationID) 0:33 Constant: 0:33 2 (const int) @@ -1158,8 +1158,8 @@ vertices = 4 0:67 Function Parameters: 0:69 Sequence 0:69 gl_PointSize: direct index for structure (out float PointSize) -0:69 direct index (temp block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance}) -0:69 'gl_out' (out 4-element array of block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance}) +0:69 direct index (temp block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 2-element array of float ClipDistance gl_ClipDistance}) +0:69 'gl_out' (out 4-element array of block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 2-element array of float ClipDistance gl_ClipDistance}) 0:69 Constant: 0:69 4 (const int) 0:69 Constant: @@ -1192,8 +1192,8 @@ vertices = 4 0:17 move second child to first child (temp 4-component vector of float) 0:17 'p' (temp 4-component vector of float) 0:17 gl_Position: direct index for structure (in 4-component vector of float Position) -0:17 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) -0:17 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:17 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) +0:17 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) 0:17 Constant: 0:17 1 (const int) 0:17 Constant: @@ -1202,8 +1202,8 @@ vertices = 4 0:18 move second child to first child (temp float) 0:18 'ps' (temp float) 0:18 gl_PointSize: direct index for structure (in float PointSize) -0:18 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) -0:18 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:18 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) +0:18 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) 0:18 Constant: 0:18 1 (const int) 0:18 Constant: @@ -1212,9 +1212,9 @@ vertices = 4 0:19 move second child to first child (temp float) 0:19 'cd' (temp float) 0:19 direct index (temp float ClipDistance) -0:19 gl_ClipDistance: direct index for structure (in 1-element array of float ClipDistance) -0:19 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) -0:19 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:19 gl_ClipDistance: direct index for structure (in 3-element array of float ClipDistance) +0:19 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) +0:19 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) 0:19 Constant: 0:19 1 (const int) 0:19 Constant: @@ -1280,7 +1280,7 @@ vertices = 4 0:37 0 (const int) 0:36 true case is null 0:? Linker Objects -0:? 'gl_out' (out 4-element array of block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance}) +0:? 'gl_out' (out 4-element array of block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 2-element array of float ClipDistance gl_ClipDistance}) 0:? 'outa' (global 4-element array of int) 0:? 'patchOut' (patch out 4-component vector of float) 0:? 'patchIn' (patch in 4-component vector of float) @@ -1324,8 +1324,8 @@ ERROR: node is still EOpNull! 0:22 move second child to first child (temp 4-component vector of float) 0:22 'p' (temp 4-component vector of float) 0:22 gl_Position: direct index for structure (in 4-component vector of float Position) -0:22 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) -0:22 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:22 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) +0:22 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) 0:22 Constant: 0:22 1 (const int) 0:22 Constant: @@ -1334,8 +1334,8 @@ ERROR: node is still EOpNull! 0:23 move second child to first child (temp float) 0:23 'ps' (temp float) 0:23 gl_PointSize: direct index for structure (in float PointSize) -0:23 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) -0:23 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:23 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) +0:23 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) 0:23 Constant: 0:23 1 (const int) 0:23 Constant: @@ -1344,9 +1344,9 @@ ERROR: node is still EOpNull! 0:24 move second child to first child (temp float) 0:24 'cd' (temp float) 0:24 direct index (temp float ClipDistance) -0:24 gl_ClipDistance: direct index for structure (in 1-element array of float ClipDistance) -0:24 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) -0:24 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:24 gl_ClipDistance: direct index for structure (in 3-element array of float ClipDistance) +0:24 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) +0:24 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) 0:24 Constant: 0:24 1 (const int) 0:24 Constant: @@ -1414,8 +1414,8 @@ ERROR: node is still EOpNull! 0:32 move second child to first child (temp 4-component vector of float) 0:32 'p' (temp 4-component vector of float) 0:32 gl_Position: direct index for structure (in 4-component vector of float Position) -0:32 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) -0:32 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:32 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) +0:32 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) 0:32 Constant: 0:32 1 (const int) 0:32 Constant: @@ -1424,8 +1424,8 @@ ERROR: node is still EOpNull! 0:33 move second child to first child (temp float) 0:33 'ps' (temp float) 0:33 gl_PointSize: direct index for structure (in float PointSize) -0:33 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) -0:33 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:33 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) +0:33 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) 0:33 Constant: 0:33 1 (const int) 0:33 Constant: @@ -1434,9 +1434,9 @@ ERROR: node is still EOpNull! 0:34 move second child to first child (temp float) 0:34 'cd' (temp float) 0:34 direct index (temp float ClipDistance) -0:34 gl_ClipDistance: direct index for structure (in 1-element array of float ClipDistance) -0:34 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) -0:34 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:34 gl_ClipDistance: direct index for structure (in 3-element array of float ClipDistance) +0:34 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) +0:34 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) 0:34 Constant: 0:34 1 (const int) 0:34 Constant: @@ -1572,7 +1572,7 @@ ERROR: node is still EOpNull! 0:? 'badp2' (flat patch in 4-component vector of float) 0:? 'badp3' (noperspective patch in 4-component vector of float) 0:? 'badp4' (patch sample in 3-component vector of float) -0:? 'gl_in' (in 32-element array of block{in 1-element array of float ClipDistance gl_ClipDistance}) +0:? 'gl_in' (in 32-element array of block{in 3-element array of float ClipDistance gl_ClipDistance}) 0:? 'ina' (in 2-component vector of float) 0:? 'inb' (in 32-element array of 2-component vector of float) 0:? 'inc' (in 32-element array of 2-component vector of float) diff --git a/Test/baseResults/400.tesc.out b/Test/baseResults/400.tesc.out index 6a0b895a..99867ca5 100644 --- a/Test/baseResults/400.tesc.out +++ b/Test/baseResults/400.tesc.out @@ -233,8 +233,8 @@ ERROR: node is still EOpNull! 0:23 move second child to first child (temp 4-component vector of float) 0:23 'p' (temp 4-component vector of float) 0:23 gl_Position: direct index for structure (in 4-component vector of float Position) -0:23 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) -0:23 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:23 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) +0:23 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) 0:23 Constant: 0:23 1 (const int) 0:23 Constant: @@ -243,8 +243,8 @@ ERROR: node is still EOpNull! 0:24 move second child to first child (temp float) 0:24 'ps' (temp float) 0:24 gl_PointSize: direct index for structure (in float PointSize) -0:24 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) -0:24 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:24 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) +0:24 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) 0:24 Constant: 0:24 1 (const int) 0:24 Constant: @@ -253,9 +253,9 @@ ERROR: node is still EOpNull! 0:25 move second child to first child (temp float) 0:25 'cd' (temp float) 0:25 direct index (temp float ClipDistance) -0:25 gl_ClipDistance: direct index for structure (in 1-element array of float ClipDistance) -0:25 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) -0:25 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:25 gl_ClipDistance: direct index for structure (in 3-element array of float ClipDistance) +0:25 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) +0:25 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) 0:25 Constant: 0:25 1 (const int) 0:25 Constant: @@ -276,25 +276,25 @@ ERROR: node is still EOpNull! 0:29 'gl_InvocationID' (in int InvocationID) 0:31 move second child to first child (temp 4-component vector of float) 0:31 gl_Position: direct index for structure (out 4-component vector of float Position) -0:31 indirect index (temp block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance}) -0:31 'gl_out' (out 4-element array of block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance}) +0:31 indirect index (temp block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 2-element array of float ClipDistance gl_ClipDistance}) +0:31 'gl_out' (out 4-element array of block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 2-element array of float ClipDistance gl_ClipDistance}) 0:31 'gl_InvocationID' (in int InvocationID) 0:31 Constant: 0:31 0 (const int) 0:31 'p' (temp 4-component vector of float) 0:32 move second child to first child (temp float) 0:32 gl_PointSize: direct index for structure (out float PointSize) -0:32 indirect index (temp block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance}) -0:32 'gl_out' (out 4-element array of block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance}) +0:32 indirect index (temp block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 2-element array of float ClipDistance gl_ClipDistance}) +0:32 'gl_out' (out 4-element array of block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 2-element array of float ClipDistance gl_ClipDistance}) 0:32 'gl_InvocationID' (in int InvocationID) 0:32 Constant: 0:32 1 (const int) 0:32 'ps' (temp float) 0:33 move second child to first child (temp float) 0:33 direct index (temp float ClipDistance) -0:33 gl_ClipDistance: direct index for structure (out 1-element array of float ClipDistance) -0:33 indirect index (temp block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance}) -0:33 'gl_out' (out 4-element array of block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance}) +0:33 gl_ClipDistance: direct index for structure (out 2-element array of float ClipDistance) +0:33 indirect index (temp block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 2-element array of float ClipDistance gl_ClipDistance}) +0:33 'gl_out' (out 4-element array of block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 2-element array of float ClipDistance gl_ClipDistance}) 0:33 'gl_InvocationID' (in int InvocationID) 0:33 Constant: 0:33 2 (const int) @@ -364,8 +364,8 @@ ERROR: node is still EOpNull! 0:67 Function Parameters: 0:69 Sequence 0:69 gl_PointSize: direct index for structure (out float PointSize) -0:69 direct index (temp block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance}) -0:69 'gl_out' (out 4-element array of block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance}) +0:69 direct index (temp block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 2-element array of float ClipDistance gl_ClipDistance}) +0:69 'gl_out' (out 4-element array of block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 2-element array of float ClipDistance gl_ClipDistance}) 0:69 Constant: 0:69 4 (const int) 0:69 Constant: @@ -390,7 +390,7 @@ ERROR: node is still EOpNull! 0:97 'd' (temp double) 0:97 'd' (temp double) 0:? Linker Objects -0:? 'gl_out' (out 4-element array of block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance}) +0:? 'gl_out' (out 4-element array of block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 2-element array of float ClipDistance gl_ClipDistance}) 0:? 'outa' (global 4-element array of int) 0:? 'patchIn' (patch in 4-component vector of float) 0:? 'patchOut' (patch out 4-component vector of float) diff --git a/Test/baseResults/400.tese.out b/Test/baseResults/400.tese.out index 55670f87..76883aa7 100644 --- a/Test/baseResults/400.tese.out +++ b/Test/baseResults/400.tese.out @@ -179,8 +179,8 @@ ERROR: node is still EOpNull! 0:32 move second child to first child (temp 4-component vector of float) 0:32 'p' (temp 4-component vector of float) 0:32 gl_Position: direct index for structure (in 4-component vector of float Position) -0:32 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) -0:32 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:32 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) +0:32 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) 0:32 Constant: 0:32 1 (const int) 0:32 Constant: @@ -189,8 +189,8 @@ ERROR: node is still EOpNull! 0:33 move second child to first child (temp float) 0:33 'ps' (temp float) 0:33 gl_PointSize: direct index for structure (in float PointSize) -0:33 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) -0:33 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:33 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) +0:33 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) 0:33 Constant: 0:33 1 (const int) 0:33 Constant: @@ -199,9 +199,9 @@ ERROR: node is still EOpNull! 0:34 move second child to first child (temp float) 0:34 'cd' (temp float) 0:34 direct index (temp float ClipDistance) -0:34 gl_ClipDistance: direct index for structure (in 1-element array of float ClipDistance) -0:34 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) -0:34 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:34 gl_ClipDistance: direct index for structure (in 3-element array of float ClipDistance) +0:34 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) +0:34 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) 0:34 Constant: 0:34 1 (const int) 0:34 Constant: @@ -263,7 +263,7 @@ ERROR: node is still EOpNull! 0:? 'badp2' (flat patch in 4-component vector of float) 0:? 'badp3' (noperspective patch in 4-component vector of float) 0:? 'badp4' (patch sample in 3-component vector of float) -0:? 'gl_in' (in 32-element array of block{in 1-element array of float ClipDistance gl_ClipDistance}) +0:? 'gl_in' (in 32-element array of block{in 3-element array of float ClipDistance gl_ClipDistance}) 0:? 'ina' (in 2-component vector of float) 0:? 'inb' (in 32-element array of 2-component vector of float) 0:? 'inc' (in 32-element array of 2-component vector of float) diff --git a/Test/baseResults/420.tesc.out b/Test/baseResults/420.tesc.out index db65fd99..594e1302 100644 --- a/Test/baseResults/420.tesc.out +++ b/Test/baseResults/420.tesc.out @@ -132,8 +132,8 @@ ERROR: node is still EOpNull! 0:17 move second child to first child (temp 4-component vector of float) 0:17 'p' (temp 4-component vector of float) 0:17 gl_Position: direct index for structure (in 4-component vector of float Position) -0:17 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) -0:17 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:17 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) +0:17 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) 0:17 Constant: 0:17 1 (const int) 0:17 Constant: @@ -142,8 +142,8 @@ ERROR: node is still EOpNull! 0:18 move second child to first child (temp float) 0:18 'ps' (temp float) 0:18 gl_PointSize: direct index for structure (in float PointSize) -0:18 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) -0:18 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:18 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) +0:18 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) 0:18 Constant: 0:18 1 (const int) 0:18 Constant: @@ -152,9 +152,9 @@ ERROR: node is still EOpNull! 0:19 move second child to first child (temp float) 0:19 'cd' (temp float) 0:19 direct index (temp float ClipDistance) -0:19 gl_ClipDistance: direct index for structure (in 1-element array of float ClipDistance) -0:19 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) -0:19 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 1-element array of float ClipDistance gl_ClipDistance}) +0:19 gl_ClipDistance: direct index for structure (in 3-element array of float ClipDistance) +0:19 direct index (temp block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) +0:19 'gl_in' (in 32-element array of block{in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in 3-element array of float ClipDistance gl_ClipDistance}) 0:19 Constant: 0:19 1 (const int) 0:19 Constant: diff --git a/Test/baseResults/450.geom.out b/Test/baseResults/450.geom.out index fd98d088..1579e18d 100644 --- a/Test/baseResults/450.geom.out +++ b/Test/baseResults/450.geom.out @@ -57,9 +57,9 @@ output primitive = none 0:13 Constant: 0:13 2 (const int) 0:13 direct index (temp float CullDistance) -0:13 gl_CullDistance: direct index for structure (in 1-element array of float CullDistance) -0:13 direct index (temp block{in 1-element array of float CullDistance gl_CullDistance}) -0:13 'gl_in' (in 2-element array of block{in 1-element array of float CullDistance gl_CullDistance}) +0:13 gl_CullDistance: direct index for structure (in 3-element array of float CullDistance) +0:13 direct index (temp block{in 3-element array of float CullDistance gl_CullDistance}) +0:13 'gl_in' (in 2-element array of block{in 3-element array of float CullDistance gl_CullDistance}) 0:13 Constant: 0:13 1 (const int) 0:13 Constant: @@ -67,6 +67,6 @@ output primitive = none 0:13 Constant: 0:13 2 (const int) 0:? Linker Objects -0:? 'gl_in' (in 2-element array of block{in 1-element array of float CullDistance gl_CullDistance}) +0:? 'gl_in' (in 2-element array of block{in 3-element array of float CullDistance gl_CullDistance}) 0:? 'anon@0' (layout(stream=0 ) out block{layout(stream=0 ) out 3-element array of float CullDistance gl_CullDistance}) diff --git a/Test/baseResults/450.tesc.out b/Test/baseResults/450.tesc.out index 8a8e9fbf..66cd5c26 100644 --- a/Test/baseResults/450.tesc.out +++ b/Test/baseResults/450.tesc.out @@ -44,18 +44,18 @@ vertices = -1 0:13 Sequence 0:13 move second child to first child (temp float) 0:13 direct index (temp float CullDistance) -0:13 gl_CullDistance: direct index for structure (out 1-element array of float CullDistance) -0:13 indirect index (temp block{out 1-element array of float CullDistance gl_CullDistance}) -0:13 'gl_out' (out 4-element array of block{out 1-element array of float CullDistance gl_CullDistance}) +0:13 gl_CullDistance: direct index for structure (out 3-element array of float CullDistance) +0:13 indirect index (temp block{out 3-element array of float CullDistance gl_CullDistance}) +0:13 'gl_out' (out 4-element array of block{out 3-element array of float CullDistance gl_CullDistance}) 0:13 'gl_InvocationID' (in int InvocationID) 0:13 Constant: 0:13 0 (const int) 0:13 Constant: 0:13 2 (const int) 0:13 direct index (temp float CullDistance) -0:13 gl_CullDistance: direct index for structure (in 1-element array of float CullDistance) -0:13 direct index (temp block{in 1-element array of float CullDistance gl_CullDistance}) -0:13 'gl_in' (in 32-element array of block{in 1-element array of float CullDistance gl_CullDistance}) +0:13 gl_CullDistance: direct index for structure (in 3-element array of float CullDistance) +0:13 direct index (temp block{in 3-element array of float CullDistance gl_CullDistance}) +0:13 'gl_in' (in 32-element array of block{in 3-element array of float CullDistance gl_CullDistance}) 0:13 Constant: 0:13 1 (const int) 0:13 Constant: @@ -63,6 +63,6 @@ vertices = -1 0:13 Constant: 0:13 2 (const int) 0:? Linker Objects -0:? 'gl_in' (in 32-element array of block{in 1-element array of float CullDistance gl_CullDistance}) -0:? 'gl_out' (out 4-element array of block{out 1-element array of float CullDistance gl_CullDistance}) +0:? 'gl_in' (in 32-element array of block{in 3-element array of float CullDistance gl_CullDistance}) +0:? 'gl_out' (out 4-element array of block{out 3-element array of float CullDistance gl_CullDistance}) diff --git a/Test/baseResults/450.tese.out b/Test/baseResults/450.tese.out index c6e97b8d..a1116b40 100644 --- a/Test/baseResults/450.tese.out +++ b/Test/baseResults/450.tese.out @@ -53,9 +53,9 @@ triangle order = ccw 0:13 Constant: 0:13 2 (const int) 0:13 direct index (temp float CullDistance) -0:13 gl_CullDistance: direct index for structure (in 1-element array of float CullDistance) -0:13 direct index (temp block{in 1-element array of float CullDistance gl_CullDistance}) -0:13 'gl_in' (in 32-element array of block{in 1-element array of float CullDistance gl_CullDistance}) +0:13 gl_CullDistance: direct index for structure (in 3-element array of float CullDistance) +0:13 direct index (temp block{in 3-element array of float CullDistance gl_CullDistance}) +0:13 'gl_in' (in 32-element array of block{in 3-element array of float CullDistance gl_CullDistance}) 0:13 Constant: 0:13 1 (const int) 0:13 Constant: @@ -63,6 +63,6 @@ triangle order = ccw 0:13 Constant: 0:13 2 (const int) 0:? Linker Objects -0:? 'gl_in' (in 32-element array of block{in 1-element array of float CullDistance gl_CullDistance}) +0:? 'gl_in' (in 32-element array of block{in 3-element array of float CullDistance gl_CullDistance}) 0:? 'anon@0' (out block{out 3-element array of float CullDistance gl_CullDistance}) diff --git a/Test/baseResults/spv.400.tesc.out b/Test/baseResults/spv.400.tesc.out index eea07ce7..290a19cd 100755 --- a/Test/baseResults/spv.400.tesc.out +++ b/Test/baseResults/spv.400.tesc.out @@ -7,68 +7,68 @@ Linked tessellation control stage: // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 93 +// Id's are bound by 94 Capability Tessellation Capability TessellationPointSize Capability ClipDistance 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint TessellationControl 4 "main" 23 40 43 46 52 66 73 79 83 84 87 88 91 92 + EntryPoint TessellationControl 4 "main" 24 41 44 47 55 69 74 80 84 85 88 89 92 93 ExecutionMode 4 OutputVertices 4 Source GLSL 400 SourceExtension "GL_ARB_separate_shader_objects" Name 4 "main" Name 12 "a" Name 17 "p" - Name 19 "gl_PerVertex" - MemberName 19(gl_PerVertex) 0 "gl_Position" - MemberName 19(gl_PerVertex) 1 "gl_PointSize" - MemberName 19(gl_PerVertex) 2 "gl_ClipDistance" - Name 23 "gl_in" - Name 30 "ps" - Name 34 "cd" - Name 38 "pvi" - Name 40 "gl_PatchVerticesIn" - Name 42 "pid" - Name 43 "gl_PrimitiveID" - Name 45 "iid" - Name 46 "gl_InvocationID" - Name 48 "gl_PerVertex" - MemberName 48(gl_PerVertex) 0 "gl_Position" - MemberName 48(gl_PerVertex) 1 "gl_PointSize" - MemberName 48(gl_PerVertex) 2 "gl_ClipDistance" - Name 52 "gl_out" - Name 66 "gl_TessLevelOuter" - Name 73 "gl_TessLevelInner" - Name 78 "outa" - Name 79 "patchOut" - Name 83 "inb" - Name 84 "ind" - Name 87 "ivla" - Name 88 "ivlb" - Name 91 "ovla" - Name 92 "ovlb" - MemberDecorate 19(gl_PerVertex) 0 BuiltIn Position - MemberDecorate 19(gl_PerVertex) 1 BuiltIn PointSize - MemberDecorate 19(gl_PerVertex) 2 BuiltIn ClipDistance - Decorate 19(gl_PerVertex) Block - Decorate 40(gl_PatchVerticesIn) BuiltIn PatchVertices - Decorate 43(gl_PrimitiveID) BuiltIn PrimitiveId - Decorate 46(gl_InvocationID) BuiltIn InvocationId - MemberDecorate 48(gl_PerVertex) 0 BuiltIn Position - MemberDecorate 48(gl_PerVertex) 1 BuiltIn PointSize - MemberDecorate 48(gl_PerVertex) 2 BuiltIn ClipDistance - Decorate 48(gl_PerVertex) Block - Decorate 66(gl_TessLevelOuter) Patch - Decorate 66(gl_TessLevelOuter) BuiltIn TessLevelOuter - Decorate 73(gl_TessLevelInner) Patch - Decorate 73(gl_TessLevelInner) BuiltIn TessLevelInner - Decorate 79(patchOut) Patch - Decorate 87(ivla) Location 3 - Decorate 88(ivlb) Location 4 - Decorate 91(ovla) Location 3 - Decorate 92(ovlb) Location 4 + Name 20 "gl_PerVertex" + MemberName 20(gl_PerVertex) 0 "gl_Position" + MemberName 20(gl_PerVertex) 1 "gl_PointSize" + MemberName 20(gl_PerVertex) 2 "gl_ClipDistance" + Name 24 "gl_in" + Name 31 "ps" + Name 35 "cd" + Name 39 "pvi" + Name 41 "gl_PatchVerticesIn" + Name 43 "pid" + Name 44 "gl_PrimitiveID" + Name 46 "iid" + Name 47 "gl_InvocationID" + Name 51 "gl_PerVertex" + MemberName 51(gl_PerVertex) 0 "gl_Position" + MemberName 51(gl_PerVertex) 1 "gl_PointSize" + MemberName 51(gl_PerVertex) 2 "gl_ClipDistance" + Name 55 "gl_out" + Name 69 "gl_TessLevelOuter" + Name 74 "gl_TessLevelInner" + Name 79 "outa" + Name 80 "patchOut" + Name 84 "inb" + Name 85 "ind" + Name 88 "ivla" + Name 89 "ivlb" + Name 92 "ovla" + Name 93 "ovlb" + MemberDecorate 20(gl_PerVertex) 0 BuiltIn Position + MemberDecorate 20(gl_PerVertex) 1 BuiltIn PointSize + MemberDecorate 20(gl_PerVertex) 2 BuiltIn ClipDistance + Decorate 20(gl_PerVertex) Block + Decorate 41(gl_PatchVerticesIn) BuiltIn PatchVertices + Decorate 44(gl_PrimitiveID) BuiltIn PrimitiveId + Decorate 47(gl_InvocationID) BuiltIn InvocationId + MemberDecorate 51(gl_PerVertex) 0 BuiltIn Position + MemberDecorate 51(gl_PerVertex) 1 BuiltIn PointSize + MemberDecorate 51(gl_PerVertex) 2 BuiltIn ClipDistance + Decorate 51(gl_PerVertex) Block + Decorate 69(gl_TessLevelOuter) Patch + Decorate 69(gl_TessLevelOuter) BuiltIn TessLevelOuter + Decorate 74(gl_TessLevelInner) Patch + Decorate 74(gl_TessLevelInner) BuiltIn TessLevelInner + Decorate 80(patchOut) Patch + Decorate 88(ivla) Location 3 + Decorate 89(ivlb) Location 4 + Decorate 92(ovla) Location 3 + Decorate 93(ovlb) Location 4 2: TypeVoid 3: TypeFunction 2 6: TypeInt 32 0 @@ -81,98 +81,99 @@ Linked tessellation control stage: 14: TypeFloat 32 15: TypeVector 14(float) 4 16: TypePointer Function 15(fvec4) - 18: TypeArray 14(float) 7 -19(gl_PerVertex): TypeStruct 15(fvec4) 14(float) 18 - 20: 6(int) Constant 32 - 21: TypeArray 19(gl_PerVertex) 20 - 22: TypePointer Input 21 - 23(gl_in): 22(ptr) Variable Input - 24: 10(int) Constant 1 - 25: 10(int) Constant 0 - 26: TypePointer Input 15(fvec4) - 29: TypePointer Function 14(float) - 31: TypePointer Input 14(float) - 35: 10(int) Constant 2 - 39: TypePointer Input 10(int) -40(gl_PatchVerticesIn): 39(ptr) Variable Input -43(gl_PrimitiveID): 39(ptr) Variable Input -46(gl_InvocationID): 39(ptr) Variable Input -48(gl_PerVertex): TypeStruct 15(fvec4) 14(float) 18 - 49: 6(int) Constant 4 - 50: TypeArray 48(gl_PerVertex) 49 - 51: TypePointer Output 50 - 52(gl_out): 51(ptr) Variable Output - 55: TypePointer Output 15(fvec4) - 59: TypePointer Output 14(float) - 64: TypeArray 14(float) 49 - 65: TypePointer Output 64 -66(gl_TessLevelOuter): 65(ptr) Variable Output - 67: 10(int) Constant 3 - 68: 14(float) Constant 1078774989 - 70: 6(int) Constant 2 - 71: TypeArray 14(float) 70 - 72: TypePointer Output 71 -73(gl_TessLevelInner): 72(ptr) Variable Output - 74: 14(float) Constant 1067869798 - 76: TypeArray 10(int) 49 - 77: TypePointer Private 76 - 78(outa): 77(ptr) Variable Private - 79(patchOut): 55(ptr) Variable Output - 80: TypeVector 14(float) 2 - 81: TypeArray 80(fvec2) 20 - 82: TypePointer Input 81 - 83(inb): 82(ptr) Variable Input - 84(ind): 82(ptr) Variable Input - 85: TypeArray 15(fvec4) 20 - 86: TypePointer Input 85 - 87(ivla): 86(ptr) Variable Input - 88(ivlb): 86(ptr) Variable Input - 89: TypeArray 15(fvec4) 49 - 90: TypePointer Output 89 - 91(ovla): 90(ptr) Variable Output - 92(ovlb): 90(ptr) Variable Output + 18: 6(int) Constant 3 + 19: TypeArray 14(float) 18 +20(gl_PerVertex): TypeStruct 15(fvec4) 14(float) 19 + 21: 6(int) Constant 32 + 22: TypeArray 20(gl_PerVertex) 21 + 23: TypePointer Input 22 + 24(gl_in): 23(ptr) Variable Input + 25: 10(int) Constant 1 + 26: 10(int) Constant 0 + 27: TypePointer Input 15(fvec4) + 30: TypePointer Function 14(float) + 32: TypePointer Input 14(float) + 36: 10(int) Constant 2 + 40: TypePointer Input 10(int) +41(gl_PatchVerticesIn): 40(ptr) Variable Input +44(gl_PrimitiveID): 40(ptr) Variable Input +47(gl_InvocationID): 40(ptr) Variable Input + 49: 6(int) Constant 2 + 50: TypeArray 14(float) 49 +51(gl_PerVertex): TypeStruct 15(fvec4) 14(float) 50 + 52: 6(int) Constant 4 + 53: TypeArray 51(gl_PerVertex) 52 + 54: TypePointer Output 53 + 55(gl_out): 54(ptr) Variable Output + 58: TypePointer Output 15(fvec4) + 62: TypePointer Output 14(float) + 67: TypeArray 14(float) 52 + 68: TypePointer Output 67 +69(gl_TessLevelOuter): 68(ptr) Variable Output + 70: 10(int) Constant 3 + 71: 14(float) Constant 1078774989 + 73: TypePointer Output 50 +74(gl_TessLevelInner): 73(ptr) Variable Output + 75: 14(float) Constant 1067869798 + 77: TypeArray 10(int) 52 + 78: TypePointer Private 77 + 79(outa): 78(ptr) Variable Private + 80(patchOut): 58(ptr) Variable Output + 81: TypeVector 14(float) 2 + 82: TypeArray 81(fvec2) 21 + 83: TypePointer Input 82 + 84(inb): 83(ptr) Variable Input + 85(ind): 83(ptr) Variable Input + 86: TypeArray 15(fvec4) 21 + 87: TypePointer Input 86 + 88(ivla): 87(ptr) Variable Input + 89(ivlb): 87(ptr) Variable Input + 90: TypeArray 15(fvec4) 52 + 91: TypePointer Output 90 + 92(ovla): 91(ptr) Variable Output + 93(ovlb): 91(ptr) Variable Output 4(main): 2 Function None 3 5: Label 12(a): 11(ptr) Variable Function 17(p): 16(ptr) Variable Function - 30(ps): 29(ptr) Variable Function - 34(cd): 29(ptr) Variable Function - 38(pvi): 11(ptr) Variable Function - 42(pid): 11(ptr) Variable Function - 45(iid): 11(ptr) Variable Function + 31(ps): 30(ptr) Variable Function + 35(cd): 30(ptr) Variable Function + 39(pvi): 11(ptr) Variable Function + 43(pid): 11(ptr) Variable Function + 46(iid): 11(ptr) Variable Function MemoryBarrier 7 8 ControlBarrier 7 7 9 Store 12(a) 13 - 27: 26(ptr) AccessChain 23(gl_in) 24 25 - 28: 15(fvec4) Load 27 - Store 17(p) 28 - 32: 31(ptr) AccessChain 23(gl_in) 24 24 - 33: 14(float) Load 32 - Store 30(ps) 33 - 36: 31(ptr) AccessChain 23(gl_in) 24 35 35 - 37: 14(float) Load 36 - Store 34(cd) 37 - 41: 10(int) Load 40(gl_PatchVerticesIn) - Store 38(pvi) 41 - 44: 10(int) Load 43(gl_PrimitiveID) - Store 42(pid) 44 - 47: 10(int) Load 46(gl_InvocationID) - Store 45(iid) 47 - 53: 10(int) Load 46(gl_InvocationID) - 54: 15(fvec4) Load 17(p) - 56: 55(ptr) AccessChain 52(gl_out) 53 25 - Store 56 54 - 57: 10(int) Load 46(gl_InvocationID) - 58: 14(float) Load 30(ps) - 60: 59(ptr) AccessChain 52(gl_out) 57 24 - Store 60 58 - 61: 10(int) Load 46(gl_InvocationID) - 62: 14(float) Load 34(cd) - 63: 59(ptr) AccessChain 52(gl_out) 61 35 24 - Store 63 62 - 69: 59(ptr) AccessChain 66(gl_TessLevelOuter) 67 - Store 69 68 - 75: 59(ptr) AccessChain 73(gl_TessLevelInner) 24 - Store 75 74 + 28: 27(ptr) AccessChain 24(gl_in) 25 26 + 29: 15(fvec4) Load 28 + Store 17(p) 29 + 33: 32(ptr) AccessChain 24(gl_in) 25 25 + 34: 14(float) Load 33 + Store 31(ps) 34 + 37: 32(ptr) AccessChain 24(gl_in) 25 36 36 + 38: 14(float) Load 37 + Store 35(cd) 38 + 42: 10(int) Load 41(gl_PatchVerticesIn) + Store 39(pvi) 42 + 45: 10(int) Load 44(gl_PrimitiveID) + Store 43(pid) 45 + 48: 10(int) Load 47(gl_InvocationID) + Store 46(iid) 48 + 56: 10(int) Load 47(gl_InvocationID) + 57: 15(fvec4) Load 17(p) + 59: 58(ptr) AccessChain 55(gl_out) 56 26 + Store 59 57 + 60: 10(int) Load 47(gl_InvocationID) + 61: 14(float) Load 31(ps) + 63: 62(ptr) AccessChain 55(gl_out) 60 25 + Store 63 61 + 64: 10(int) Load 47(gl_InvocationID) + 65: 14(float) Load 35(cd) + 66: 62(ptr) AccessChain 55(gl_out) 64 36 25 + Store 66 65 + 72: 62(ptr) AccessChain 69(gl_TessLevelOuter) 70 + Store 72 71 + 76: 62(ptr) AccessChain 74(gl_TessLevelInner) 25 + Store 76 75 Return FunctionEnd diff --git a/Test/baseResults/spv.400.tese.out b/Test/baseResults/spv.400.tese.out index 03e181ce..51534b12 100755 --- a/Test/baseResults/spv.400.tese.out +++ b/Test/baseResults/spv.400.tese.out @@ -7,14 +7,14 @@ Linked tessellation evaluation stage: // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 98 +// Id's are bound by 96 Capability Tessellation Capability TessellationPointSize Capability ClipDistance 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint TessellationEvaluation 4 "main" 21 38 41 47 53 61 68 77 81 82 86 90 93 94 97 + EntryPoint TessellationEvaluation 4 "main" 21 38 41 47 53 61 66 75 79 80 84 88 91 92 95 ExecutionMode 4 Triangles ExecutionMode 4 SpacingFractionalOdd ExecutionMode 4 VertexOrderCcw @@ -41,23 +41,23 @@ Linked tessellation evaluation stage: Name 53 "gl_TessLevelOuter" Name 57 "tli" Name 61 "gl_TessLevelInner" - Name 66 "gl_PerVertex" - MemberName 66(gl_PerVertex) 0 "gl_Position" - MemberName 66(gl_PerVertex) 1 "gl_PointSize" - MemberName 66(gl_PerVertex) 2 "gl_ClipDistance" - Name 68 "" - Name 77 "patchIn" - Name 81 "inb" - Name 82 "ind" - Name 83 "testblb" - MemberName 83(testblb) 0 "f" - Name 86 "blb" - Name 87 "testbld" - MemberName 87(testbld) 0 "f" - Name 90 "bld" - Name 93 "ivla" - Name 94 "ivlb" - Name 97 "ovla" + Name 64 "gl_PerVertex" + MemberName 64(gl_PerVertex) 0 "gl_Position" + MemberName 64(gl_PerVertex) 1 "gl_PointSize" + MemberName 64(gl_PerVertex) 2 "gl_ClipDistance" + Name 66 "" + Name 75 "patchIn" + Name 79 "inb" + Name 80 "ind" + Name 81 "testblb" + MemberName 81(testblb) 0 "f" + Name 84 "blb" + Name 85 "testbld" + MemberName 85(testbld) 0 "f" + Name 88 "bld" + Name 91 "ivla" + Name 92 "ivlb" + Name 95 "ovla" MemberDecorate 17(gl_PerVertex) 0 BuiltIn Position MemberDecorate 17(gl_PerVertex) 1 BuiltIn PointSize MemberDecorate 17(gl_PerVertex) 2 BuiltIn ClipDistance @@ -69,16 +69,16 @@ Linked tessellation evaluation stage: Decorate 53(gl_TessLevelOuter) BuiltIn TessLevelOuter Decorate 61(gl_TessLevelInner) Patch Decorate 61(gl_TessLevelInner) BuiltIn TessLevelInner - MemberDecorate 66(gl_PerVertex) 0 BuiltIn Position - MemberDecorate 66(gl_PerVertex) 1 BuiltIn PointSize - MemberDecorate 66(gl_PerVertex) 2 BuiltIn ClipDistance - Decorate 66(gl_PerVertex) Block - Decorate 77(patchIn) Patch - Decorate 83(testblb) Block - Decorate 87(testbld) Block - Decorate 93(ivla) Location 23 - Decorate 94(ivlb) Location 24 - Decorate 97(ovla) Location 23 + MemberDecorate 64(gl_PerVertex) 0 BuiltIn Position + MemberDecorate 64(gl_PerVertex) 1 BuiltIn PointSize + MemberDecorate 64(gl_PerVertex) 2 BuiltIn ClipDistance + Decorate 64(gl_PerVertex) Block + Decorate 75(patchIn) Patch + Decorate 81(testblb) Block + Decorate 85(testbld) Block + Decorate 91(ivla) Location 23 + Decorate 92(ivlb) Location 24 + Decorate 95(ovla) Location 23 2: TypeVoid 3: TypeFunction 2 6: TypeInt 32 1 @@ -88,7 +88,7 @@ Linked tessellation evaluation stage: 11: TypeVector 10(float) 4 12: TypePointer Function 11(fvec4) 14: TypeInt 32 0 - 15: 14(int) Constant 1 + 15: 14(int) Constant 3 16: TypeArray 10(float) 15 17(gl_PerVertex): TypeStruct 11(fvec4) 10(float) 16 18: 14(int) Constant 32 @@ -117,34 +117,32 @@ Linked tessellation evaluation stage: 59: TypeArray 10(float) 58 60: TypePointer Input 59 61(gl_TessLevelInner): 60(ptr) Variable Input - 64: 14(int) Constant 3 - 65: TypeArray 10(float) 64 -66(gl_PerVertex): TypeStruct 11(fvec4) 10(float) 65 - 67: TypePointer Output 66(gl_PerVertex) - 68: 67(ptr) Variable Output - 70: TypePointer Output 11(fvec4) - 73: TypePointer Output 10(float) - 77(patchIn): 24(ptr) Variable Input - 78: TypeVector 10(float) 2 - 79: TypeArray 78(fvec2) 18 - 80: TypePointer Input 79 - 81(inb): 80(ptr) Variable Input - 82(ind): 80(ptr) Variable Input - 83(testblb): TypeStruct 6(int) - 84: TypeArray 83(testblb) 18 - 85: TypePointer Input 84 - 86(blb): 85(ptr) Variable Input - 87(testbld): TypeStruct 6(int) - 88: TypeArray 87(testbld) 18 - 89: TypePointer Input 88 - 90(bld): 89(ptr) Variable Input - 91: TypeArray 11(fvec4) 18 - 92: TypePointer Input 91 - 93(ivla): 92(ptr) Variable Input - 94(ivlb): 92(ptr) Variable Input - 95: TypeArray 11(fvec4) 58 - 96: TypePointer Output 95 - 97(ovla): 96(ptr) Variable Output +64(gl_PerVertex): TypeStruct 11(fvec4) 10(float) 16 + 65: TypePointer Output 64(gl_PerVertex) + 66: 65(ptr) Variable Output + 68: TypePointer Output 11(fvec4) + 71: TypePointer Output 10(float) + 75(patchIn): 24(ptr) Variable Input + 76: TypeVector 10(float) 2 + 77: TypeArray 76(fvec2) 18 + 78: TypePointer Input 77 + 79(inb): 78(ptr) Variable Input + 80(ind): 78(ptr) Variable Input + 81(testblb): TypeStruct 6(int) + 82: TypeArray 81(testblb) 18 + 83: TypePointer Input 82 + 84(blb): 83(ptr) Variable Input + 85(testbld): TypeStruct 6(int) + 86: TypeArray 85(testbld) 18 + 87: TypePointer Input 86 + 88(bld): 87(ptr) Variable Input + 89: TypeArray 11(fvec4) 18 + 90: TypePointer Input 89 + 91(ivla): 90(ptr) Variable Input + 92(ivlb): 90(ptr) Variable Input + 93: TypeArray 11(fvec4) 58 + 94: TypePointer Output 93 + 95(ovla): 94(ptr) Variable Output 4(main): 2 Function None 3 5: Label 8(a): 7(ptr) Variable Function @@ -178,14 +176,14 @@ Linked tessellation evaluation stage: 62: 29(ptr) AccessChain 61(gl_TessLevelInner) 22 63: 10(float) Load 62 Store 57(tli) 63 - 69: 11(fvec4) Load 13(p) - 71: 70(ptr) AccessChain 68 23 - Store 71 69 - 72: 10(float) Load 28(ps) - 74: 73(ptr) AccessChain 68 22 - Store 74 72 - 75: 10(float) Load 32(cd) - 76: 73(ptr) AccessChain 68 33 33 - Store 76 75 + 67: 11(fvec4) Load 13(p) + 69: 68(ptr) AccessChain 66 23 + Store 69 67 + 70: 10(float) Load 28(ps) + 72: 71(ptr) AccessChain 66 22 + Store 72 70 + 73: 10(float) Load 32(cd) + 74: 71(ptr) AccessChain 66 33 33 + Store 74 73 Return FunctionEnd diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 5de89e1b..bb8bdb62 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -3122,16 +3122,27 @@ void TParseContext::updateImplicitArraySize(const TSourceLoc& loc, TIntermNode * // This has to be the result of a block dereference, unless it's bad shader code // If it's a uniform block, then an error will be issued elsewhere, but // return early now to avoid crashing later in this function. - if (! deref->getLeft()->getAsSymbolNode() || deref->getLeft()->getBasicType() != EbtBlock || + if (deref->getLeft()->getBasicType() != EbtBlock || deref->getLeft()->getType().getQualifier().storage == EvqUniform || deref->getRight()->getAsConstantUnion() == nullptr) return; - blockIndex = deref->getRight()->getAsConstantUnion()->getConstArray()[0].getIConst(); + const TIntermTyped* left = deref->getLeft(); + const TIntermTyped* right = deref->getRight(); - lookupName = &deref->getLeft()->getAsSymbolNode()->getName(); + if (left->getAsBinaryNode()) { + left = left->getAsBinaryNode()->getLeft(); // Block array access + assert(left->isArray()); + } + + if (! left->getAsSymbolNode()) + return; + + blockIndex = right->getAsConstantUnion()->getConstArray()[0].getIConst(); + + lookupName = &left->getAsSymbolNode()->getName(); if (IsAnonymous(*lookupName)) - lookupName = &(*deref->getLeft()->getType().getStruct())[blockIndex].type->getFieldName(); + lookupName = &(*left->getType().getStruct())[blockIndex].type->getFieldName(); } // Lookup the symbol, should only fail if shader code is incorrect @@ -3144,7 +3155,10 @@ void TParseContext::updateImplicitArraySize(const TSourceLoc& loc, TIntermNode * return; } - symbol->getWritableType().setImplicitArraySize(index + 1); + if (symbol->getType().isStruct() && blockIndex != -1) + (*symbol->getWritableType().getStruct())[blockIndex].type->setImplicitArraySize(index + 1); + else + symbol->getWritableType().setImplicitArraySize(index + 1); } // Returns true if the first argument to the #line directive is the line number for the next line. From 135452061aca1346936aa7a28ebb138341052229 Mon Sep 17 00:00:00 2001 From: qining Date: Mon, 21 Mar 2016 09:51:37 -0400 Subject: [PATCH 012/140] Spec Constant Operations Approach: Add a flag in `Builder` to indicate 'spec constant mode' and 'normal mode'. When the builder is in 'normal mode', nothing changed. When the builder is in 'spec constant mode', binary, unary and other instruction creation rountines will be redirected to `createSpecConstantOp()` to create instrution at module level with `OpSpecConstantOp `. 'spec constant mode' should be enabled if and only if we are creating spec constants. So a flager setter/recover guard is added when handling binary/unary nodes in `createSpvConstantsFromConstSubTree()`. Note when handling spec constants which are represented as ConstantUnion Node, we should not use `OpSpecConstantOp` to initialize the composite constant, so builder is set to 'normal mode'. Tests: Tests are added in Test/spv.specConstantOperations.vert, including: 1) Arithmetic, shift opeations for both scalar and composite type spec constants. 2) Size conversion from/to float and double for both scalar and vector. 3) Bitwise and/or/xor for both scalar and vector. 4) Unary negate/not for both scalar and vector. 5) Vector swizzles. 6) Comparisons for scalars. 7) == and != for composite type spec constants Issues: 1) To implement == and != for composite type spec constants, the Spec needs to allow OpAll, OpAny, OpFOrdEqual, OpFUnordEqual, OpOrdNotEqual, OpFUnordNotEqual. Currently none of them are allowed in the Spec. --- SPIRV/GlslangToSpv.cpp | 48 ++++- SPIRV/SpvBuilder.cpp | 143 ++++++++++++- SPIRV/SpvBuilder.h | 9 + .../spv.specConstantOperations.vert.out | 191 ++++++++++++++++++ Test/spv.specConstantOperations.vert | 127 ++++++++++++ Test/test-spirv-list | 1 + 6 files changed, 506 insertions(+), 13 deletions(-) create mode 100644 Test/baseResults/spv.specConstantOperations.vert.out create mode 100644 Test/spv.specConstantOperations.vert diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index dd5afd4b..ee48b3c1 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -130,7 +130,7 @@ protected: void addMemberDecoration(spv::Id id, int member, spv::Decoration dec, unsigned value); spv::Id createSpvConstant(const glslang::TIntermTyped&); spv::Id createSpvConstantFromConstUnionArray(const glslang::TType& type, const glslang::TConstUnionArray&, int& nextConst, bool specConstant); - spv::Id createSpvConstantFromConstSubTree(const glslang::TIntermTyped* subTree); + spv::Id createSpvConstantFromConstSubTree(glslang::TIntermTyped* subTree); bool isTrivialLeaf(const glslang::TIntermTyped* node); bool isTrivial(const glslang::TIntermTyped* node); spv::Id createShortCircuit(glslang::TOperator, glslang::TIntermTyped& left, glslang::TIntermTyped& right); @@ -3854,15 +3854,37 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstUnionArray(const glsla return builder.makeCompositeConstant(typeId, spvConsts); } +namespace { +class SpecConstOpCodeGenerationSettingGuard{ + public: + SpecConstOpCodeGenerationSettingGuard(spv::Builder* builder, + bool shouldGeneratingForSpecConst) + : builder_(builder) { + previous_flag_ = builder->isInSpecConstCodeGenMode(); + shouldGeneratingForSpecConst ? builder->setToSpecConstCodeGenMode() + : builder->setToNormalCodeGenMode(); + } + ~SpecConstOpCodeGenerationSettingGuard() { + previous_flag_ ? builder_->setToSpecConstCodeGenMode() + : builder_->setToNormalCodeGenMode(); + } + + private: + spv::Builder* builder_; + bool previous_flag_; +}; +} + // Create constant ID from const initializer sub tree. spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstSubTree( - const glslang::TIntermTyped* subTree) { + glslang::TIntermTyped* subTree) { const glslang::TType& glslangType = subTree->getType(); spv::Id typeId = convertGlslangToSpvType(glslangType); bool is_spec_const = subTree->getType().getQualifier().isSpecConstant(); if (const glslang::TIntermAggregate* an = subTree->getAsAggregate()) { // Aggregate node, we should generate OpConstantComposite or // OpSpecConstantComposite instruction. + std::vector const_constituents; for (auto NI = an->getSequence().begin(); NI != an->getSequence().end(); NI++) { @@ -3881,17 +3903,27 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstSubTree( return const_constituents.front(); } - } else if (const glslang::TIntermBinary* bn = subTree->getAsBinaryNode()) { + } else if (glslang::TIntermBinary* bn = subTree->getAsBinaryNode()) { // Binary operation node, we should generate OpSpecConstantOp // This case should only happen when Specialization Constants are involved. - spv::MissingFunctionality("OpSpecConstantOp not implemented"); - return spv::NoResult; - } else if (const glslang::TIntermUnary* un = subTree->getAsUnaryNode()) { + // Spec constants defined with binary operations and other constants requires + // OpSpecConstantOp instruction. + SpecConstOpCodeGenerationSettingGuard set_to_spec_const_mode(&builder, true); + + bn->traverse(this); + return accessChainLoad(bn->getType()); + + } else if (glslang::TIntermUnary* un = subTree->getAsUnaryNode()) { // Unary operation node, similar to binary operation node, should only // happen when specialization constants are involved. - spv::MissingFunctionality("OpSpecConstantOp not implemented"); - return spv::NoResult; + + // Spec constants defined with unary operations and other constants requires + // OpSpecConstantOp instruction. + SpecConstOpCodeGenerationSettingGuard set_to_spec_const_mode(&builder, true); + + un->traverse(this); + return accessChainLoad(un->getType()); } else if (const glslang::TIntermConstantUnion* cn = subTree->getAsConstantUnion()) { // ConstantUnion node, should redirect to diff --git a/SPIRV/SpvBuilder.cpp b/SPIRV/SpvBuilder.cpp index 336d3de3..3c0e2f63 100644 --- a/SPIRV/SpvBuilder.cpp +++ b/SPIRV/SpvBuilder.cpp @@ -64,7 +64,8 @@ Builder::Builder(unsigned int magicNumber) : builderNumber(magicNumber), buildPoint(0), uniqueId(0), - mainFunction(0) + mainFunction(0), + generatingOpCodeForSpecConst(false) { clearAccessChain(); } @@ -1063,6 +1064,11 @@ Id Builder::createArrayLength(Id base, unsigned int member) Id Builder::createCompositeExtract(Id composite, Id typeId, unsigned index) { + // Generate code for spec constants if in spec constant operation + // generation mode. + if (generatingOpCodeForSpecConst) { + return createSpecConstantOp(OpCompositeExtract, typeId, {composite}, {index}); + } Instruction* extract = new Instruction(getUniqueId(), typeId, OpCompositeExtract); extract->addIdOperand(composite); extract->addImmediateOperand(index); @@ -1073,6 +1079,11 @@ Id Builder::createCompositeExtract(Id composite, Id typeId, unsigned index) Id Builder::createCompositeExtract(Id composite, Id typeId, std::vector& indexes) { + // Generate code for spec constants if in spec constant operation + // generation mode. + if (generatingOpCodeForSpecConst) { + return createSpecConstantOp(OpCompositeExtract, typeId, {composite}, indexes); + } Instruction* extract = new Instruction(getUniqueId(), typeId, OpCompositeExtract); extract->addIdOperand(composite); for (int i = 0; i < (int)indexes.size(); ++i) @@ -1170,6 +1181,11 @@ void Builder::createMemoryBarrier(unsigned executionScope, unsigned memorySemant // An opcode that has one operands, a result id, and a type Id Builder::createUnaryOp(Op opCode, Id typeId, Id operand) { + // Generate code for spec constants if in spec constant operation + // generation mode. + if (generatingOpCodeForSpecConst) { + return createSpecConstantOp(opCode, typeId, {operand}, {}); + } Instruction* op = new Instruction(getUniqueId(), typeId, opCode); op->addIdOperand(operand); buildPoint->addInstruction(std::unique_ptr(op)); @@ -1179,6 +1195,11 @@ Id Builder::createUnaryOp(Op opCode, Id typeId, Id operand) Id Builder::createBinOp(Op opCode, Id typeId, Id left, Id right) { + // Generate code for spec constants if in spec constant operation + // generation mode. + if (generatingOpCodeForSpecConst) { + return createSpecConstantOp(opCode, typeId, {left, right}, {}); + } Instruction* op = new Instruction(getUniqueId(), typeId, opCode); op->addIdOperand(left); op->addIdOperand(right); @@ -1208,6 +1229,102 @@ Id Builder::createOp(Op opCode, Id typeId, const std::vector& operands) return op->getResultId(); } +Id Builder::createSpecConstantOp(Op opCode, Id typeId, const std::vector& operands, const std::vector& literals) { + switch(opCode) { + // OpCodes that do not need any capababilities. + case OpSConvert: + case OpFConvert: + case OpSNegate: + case OpNot: + case OpIAdd: + case OpISub: + case OpIMul: + case OpUDiv: + case OpSDiv: + case OpUMod: + case OpSRem: + case OpSMod: + case OpShiftRightLogical: + case OpShiftRightArithmetic: + case OpShiftLeftLogical: + case OpBitwiseOr: + case OpBitwiseXor: + case OpBitwiseAnd: + case OpVectorShuffle: + case OpCompositeExtract: + case OpCompositeInsert: + case OpLogicalOr: + case OpLogicalAnd: + case OpLogicalNot: + case OpLogicalEqual: + case OpLogicalNotEqual: + case OpSelect: + case OpIEqual: + case OpULessThan: + case OpSLessThan: + case OpUGreaterThan: + case OpSGreaterThan: + case OpULessThanEqual: + case OpSLessThanEqual: + case OpUGreaterThanEqual: + case OpSGreaterThanEqual: + // Added temporarily to enable compsite type spec constants comparison. + // Remove this comment after Spec being updated. + case OpAll: + case OpAny: + case OpFOrdEqual: + case OpFUnordEqual: + case OpFOrdNotEqual: + case OpFUnordNotEqual: + break; + + // OpCodes that need Shader capability. + case OpQuantizeToF16: + addCapability(CapabilityShader); + break; + + // OpCodes that need Kernel capability. + case OpConvertFToS: + case OpConvertSToF: + case OpConvertFToU: + case OpConvertUToF: + case OpUConvert: + case OpConvertPtrToU: + case OpConvertUToPtr: + case OpGenericCastToPtr: + case OpPtrCastToGeneric: + case OpBitcast: + case OpFNegate: + case OpFAdd: + case OpFSub: + case OpFMul: + case OpFDiv: + case OpFRem: + case OpFMod: + case OpAccessChain: + case OpInBoundsAccessChain: + case OpPtrAccessChain: + case OpInBoundsPtrAccessChain: + addCapability(CapabilityKernel); + break; + + default: + // Invalid OpCode for Spec Constant operations. + return NoResult; + } + + Instruction* op = new Instruction(getUniqueId(), typeId, OpSpecConstantOp); + op->addImmediateOperand((unsigned) opCode); + for (auto it = operands.cbegin(); it != operands.cend(); ++it) + op->addIdOperand(*it); + for (auto it = literals.cbegin(); it != literals.cend(); ++it) + op->addImmediateOperand(*it); + module.mapInstruction(op); + constantsTypesGlobals.push_back(std::unique_ptr(op)); + + return op->getResultId(); +} + Id Builder::createFunctionCall(spv::Function* function, std::vector& args) { Instruction* op = new Instruction(getUniqueId(), function->getReturnType(), OpFunctionCall); @@ -1225,6 +1342,9 @@ Id Builder::createRvalueSwizzle(Decoration precision, Id typeId, Id source, std: if (channels.size() == 1) return setPrecision(createCompositeExtract(source, typeId, channels.front()), precision); + if (generatingOpCodeForSpecConst) { + return setPrecision(createSpecConstantOp(OpVectorShuffle, typeId, {source, source}, channels), precision); + } Instruction* swizzle = new Instruction(getUniqueId(), typeId, OpVectorShuffle); assert(isVector(source)); swizzle->addIdOperand(source); @@ -1290,10 +1410,23 @@ Id Builder::smearScalar(Decoration precision, Id scalar, Id vectorType) if (numComponents == 1) return scalar; - Instruction* smear = new Instruction(getUniqueId(), vectorType, OpCompositeConstruct); - for (int c = 0; c < numComponents; ++c) - smear->addIdOperand(scalar); - buildPoint->addInstruction(std::unique_ptr(smear)); + Instruction* smear = nullptr; + if (generatingOpCodeForSpecConst) { + auto members = std::vector(numComponents, scalar); + // 'scalar' can not be spec constant here. All spec constant involved + // promotion is done in createSpvConstantFromConstUnionArray(). This + // 'if' branch is only accessed when 'scalar' is used in the def-chain + // of other vector type spec constants. In such cases, all the + // instructions needed to promote 'scalar' to a vector type constants + // should be added at module level. + auto result_id = makeCompositeConstant(vectorType, members, false); + smear = module.getInstruction(result_id); + } else { + smear = new Instruction(getUniqueId(), vectorType, OpCompositeConstruct); + for (int c = 0; c < numComponents; ++c) + smear->addIdOperand(scalar); + buildPoint->addInstruction(std::unique_ptr(smear)); + } return setPrecision(smear->getResultId(), precision); } diff --git a/SPIRV/SpvBuilder.h b/SPIRV/SpvBuilder.h index e16ba38c..46bdee84 100755 --- a/SPIRV/SpvBuilder.h +++ b/SPIRV/SpvBuilder.h @@ -262,6 +262,7 @@ public: Id createTriOp(Op, Id typeId, Id operand1, Id operand2, Id operand3); Id createOp(Op, Id typeId, const std::vector& operands); Id createFunctionCall(spv::Function*, std::vector&); + Id createSpecConstantOp(Op, Id typeId, const std::vector& operands, const std::vector& literals); // Take an rvalue (source) and a set of channels to extract from it to // make a new rvalue, which is returned. @@ -521,6 +522,13 @@ public: void createConditionalBranch(Id condition, Block* thenBlock, Block* elseBlock); void createLoopMerge(Block* mergeBlock, Block* continueBlock, unsigned int control); + // Sets to generate opcode for specialization constants. + void setToSpecConstCodeGenMode() { generatingOpCodeForSpecConst = true; } + // Sets to generate opcode for non-specialization constants (normal mode). + void setToNormalCodeGenMode() { generatingOpCodeForSpecConst = false; } + // Check if the builder is generating code for spec constants. + bool isInSpecConstCodeGenMode() { return generatingOpCodeForSpecConst; } + protected: Id makeIntConstant(Id typeId, unsigned value, bool specConstant); Id findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned value) const; @@ -544,6 +552,7 @@ public: Block* buildPoint; Id uniqueId; Function* mainFunction; + bool generatingOpCodeForSpecConst; AccessChain accessChain; // special blocks of instructions for output diff --git a/Test/baseResults/spv.specConstantOperations.vert.out b/Test/baseResults/spv.specConstantOperations.vert.out new file mode 100644 index 00000000..c3eaedd5 --- /dev/null +++ b/Test/baseResults/spv.specConstantOperations.vert.out @@ -0,0 +1,191 @@ +spv.specConstantOperations.vert +Warning, version 450 is not yet complete; most version-specific features are present, but some are missing. + + +Linked vertex stage: + + +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 163 + + Capability Shader + Capability Kernel + Capability Float64 + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" + Source GLSL 450 + Name 4 "main" + Name 108 "int_float_double_vec2" + MemberName 108(int_float_double_vec2) 0 "i" + MemberName 108(int_float_double_vec2) 1 "f" + MemberName 108(int_float_double_vec2) 2 "d" + MemberName 108(int_float_double_vec2) 3 "v" + Decorate 7 SpecId 200 + Decorate 9 SpecId 201 + Decorate 11 SpecId 202 + Decorate 12 SpecId 203 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: 6(float) SpecConstant 1078530010 + 8: TypeInt 32 1 + 9: 8(int) SpecConstant 10 + 10: TypeInt 32 0 + 11: 10(int) SpecConstant 100 + 12: 8(int) SpecConstant 4294967286 + 13: TypeFloat 64 + 14: 13(float) SpecConstantOp 115 7 + 15: 6(float) SpecConstantOp 115 14 + 16: 8(int) SpecConstantOp 126 9 + 17: 8(int) SpecConstantOp 200 9 + 18: 8(int) Constant 2 + 19: 8(int) SpecConstantOp 128 9 18 + 20: 8(int) SpecConstantOp 128 9 18 + 21: 8(int) Constant 3 + 22: 8(int) SpecConstantOp 130 20 21 + 23: 8(int) Constant 4 + 24: 8(int) SpecConstantOp 130 19 23 + 25: 8(int) SpecConstantOp 132 12 18 + 26: 10(int) Constant 2 + 27: 10(int) SpecConstantOp 132 11 26 + 28: 8(int) Constant 5 + 29: 8(int) SpecConstantOp 135 25 28 + 30: 10(int) Constant 5 + 31: 10(int) SpecConstantOp 134 27 30 + 32: 8(int) SpecConstantOp 139 12 23 + 33: 10(int) Constant 4 + 34: 10(int) SpecConstantOp 137 11 33 + 35: 8(int) SpecConstantOp 132 12 21 + 36: 8(int) SpecConstantOp 135 35 28 + 37: 8(int) Constant 10 + 38: 8(int) SpecConstantOp 195 12 37 + 39: 8(int) Constant 20 + 40: 10(int) SpecConstantOp 194 11 39 + 41: 8(int) Constant 1 + 42: 8(int) SpecConstantOp 196 12 41 + 43: 10(int) SpecConstantOp 196 11 18 + 44: 8(int) Constant 256 + 45: 8(int) SpecConstantOp 197 12 44 + 46: 10(int) Constant 512 + 47: 10(int) SpecConstantOp 198 11 46 + 48: 8(int) SpecConstantOp 124 11 + 49: 8(int) SpecConstantOp 199 12 48 + 50: TypeBool + 51: 50(bool) SpecConstantOp 177 9 12 + 52: 10(int) SpecConstantOp 124 12 + 53: 50(bool) SpecConstantOp 176 11 52 + 54: 10(int) SpecConstantOp 124 12 + 55: 50(bool) SpecConstantOp 176 54 11 + 56: TypeVector 8(int) 4 + 57: 8(int) Constant 30 + 58: 56(ivec4) SpecConstantComposite 39 57 9 9 + 59: TypeVector 10(int) 4 + 60: 10(int) Constant 4294967295 + 61: 10(int) Constant 4294967294 + 62: 59(ivec4) SpecConstantComposite 11 11 60 61 + 63: TypeVector 6(float) 4 + 64: 6(float) Constant 1067450368 + 65: 63(fvec4) SpecConstantComposite 7 64 7 64 + 66: TypeVector 13(float) 4 + 67: 66(fvec4) SpecConstantOp 115 65 + 68: 63(fvec4) SpecConstantOp 115 67 + 69: 56(ivec4) SpecConstantOp 200 58 + 70: 63(fvec4) SpecConstantOp 111 69 + 71: 56(ivec4) SpecConstantOp 126 58 + 72: 56(ivec4) ConstantComposite 18 18 18 18 + 73: 56(ivec4) SpecConstantOp 128 58 72 + 74: 56(ivec4) SpecConstantOp 128 58 72 + 75: 56(ivec4) ConstantComposite 21 21 21 21 + 76: 56(ivec4) SpecConstantOp 130 74 75 + 77: 56(ivec4) ConstantComposite 23 23 23 23 + 78: 56(ivec4) SpecConstantOp 130 76 77 + 79: 56(ivec4) SpecConstantOp 132 58 72 + 80: 56(ivec4) ConstantComposite 28 28 28 28 + 81: 56(ivec4) SpecConstantOp 135 79 80 + 82: 56(ivec4) SpecConstantOp 139 58 77 + 83: 56(ivec4) ConstantComposite 37 37 37 37 + 84: 56(ivec4) SpecConstantOp 195 58 83 + 85: 56(ivec4) SpecConstantOp 196 58 72 + 86: 8(int) Constant 1024 + 87: 56(ivec4) ConstantComposite 86 86 86 86 + 88: 56(ivec4) SpecConstantOp 197 58 87 + 89: 10(int) Constant 2048 + 90: 59(ivec4) ConstantComposite 89 89 89 89 + 91: 59(ivec4) SpecConstantOp 198 62 90 + 92: 56(ivec4) SpecConstantOp 124 62 + 93: 56(ivec4) SpecConstantOp 199 58 92 + 94: 10(int) Constant 0 + 95: 8(int) SpecConstantOp 81 58 0 + 96: TypeVector 8(int) 2 + 97: 96(ivec2) SpecConstantOp 79 58 58 1(GLSL.std.450) 0 + 98: TypeVector 8(int) 3 + 99: 98(ivec3) SpecConstantOp 79 58 58 2 1(GLSL.std.450) 0 + 100: 56(ivec4) SpecConstantOp 79 58 58 1(GLSL.std.450) 2 0 3 + 101: 59(ivec4) SpecConstantOp 124 58 + 102: TypeVector 50(bool) 4 + 103: 102(bvec4) SpecConstantOp 170 101 62 + 104: 50(bool) SpecConstantOp 155 103 + 105: 59(ivec4) SpecConstantOp 124 58 + 106: 50(bool) SpecConstantOp 154 0 + 107: TypeVector 6(float) 2 +108(int_float_double_vec2): TypeStruct 8(int) 6(float) 13(float) 107(fvec2) + 109: 6(float) Constant 1065353216 + 110: 107(fvec2) SpecConstantComposite 15 109 + 111:108(int_float_double_vec2) SpecConstantComposite 9 7 14 110 + 112: 107(fvec2) SpecConstantComposite 15 109 + 113:108(int_float_double_vec2) SpecConstantComposite 9 7 14 112 + 114: 8(int) SpecConstantOp 81 111 0 + 115: 8(int) SpecConstantOp 81 113 0 + 116: 50(bool) SpecConstantOp 170 114 115 + 117: 6(float) SpecConstantOp 81 111 1(GLSL.std.450) + 118: 6(float) SpecConstantOp 81 113 1(GLSL.std.450) + 119: 50(bool) SpecConstantOp 180 117 118 + 120: 50(bool) SpecConstantOp 167 116 119 + 121: 13(float) SpecConstantOp 81 111 2 + 122: 13(float) SpecConstantOp 81 113 2 + 123: 50(bool) SpecConstantOp 180 121 122 + 124: 50(bool) SpecConstantOp 167 120 123 + 125: 107(fvec2) SpecConstantOp 81 111 3 + 126: 107(fvec2) SpecConstantOp 81 113 3 + 127: TypeVector 50(bool) 2 + 128: 127(bvec2) SpecConstantOp 180 125 126 + 129: 50(bool) SpecConstantOp 155 128 + 130: 50(bool) SpecConstantOp 167 124 129 + 131: 8(int) SpecConstantOp 81 111 0 + 132: 8(int) SpecConstantOp 81 113 0 + 133: 6(float) SpecConstantOp 81 111 1(GLSL.std.450) + 134: 6(float) SpecConstantOp 81 113 1(GLSL.std.450) + 135: 50(bool) SpecConstantOp 182 133 134 + 136: 50(bool) SpecConstantOp 166 0 135 + 137: 13(float) SpecConstantOp 81 111 2 + 138: 13(float) SpecConstantOp 81 113 2 + 139: 50(bool) SpecConstantOp 182 137 138 + 140: 50(bool) SpecConstantOp 166 136 139 + 141: 107(fvec2) SpecConstantOp 81 111 3 + 142: 107(fvec2) SpecConstantOp 81 113 3 + 143: 127(bvec2) SpecConstantOp 182 141 142 + 144: 50(bool) SpecConstantOp 154 143 + 145: 50(bool) SpecConstantOp 166 140 144 + 146: TypeArray 6(float) 26 + 147: 146 SpecConstantComposite 7 7 + 148: 146 SpecConstantComposite 7 7 + 149: 6(float) SpecConstantOp 81 147 0 + 150: 6(float) SpecConstantOp 81 148 0 + 151: 50(bool) SpecConstantOp 180 149 150 + 152: 6(float) SpecConstantOp 81 147 1(GLSL.std.450) + 153: 6(float) SpecConstantOp 81 148 1(GLSL.std.450) + 154: 50(bool) SpecConstantOp 180 152 153 + 155: 50(bool) SpecConstantOp 167 151 154 + 156: 6(float) SpecConstantOp 81 147 0 + 157: 6(float) SpecConstantOp 81 148 0 + 158: 50(bool) SpecConstantOp 182 156 157 + 159: 6(float) SpecConstantOp 81 147 1(GLSL.std.450) + 160: 6(float) SpecConstantOp 81 148 1(GLSL.std.450) + 161: 50(bool) SpecConstantOp 182 159 160 + 162: 50(bool) SpecConstantOp 166 158 161 + 4(main): 2 Function None 3 + 5: Label + Return + FunctionEnd diff --git a/Test/spv.specConstantOperations.vert b/Test/spv.specConstantOperations.vert new file mode 100644 index 00000000..93588bf8 --- /dev/null +++ b/Test/spv.specConstantOperations.vert @@ -0,0 +1,127 @@ +#version 450 + +layout(constant_id = 200) const float sp_float = 3.1415926; +layout(constant_id = 201) const int sp_int = 10; +layout(constant_id = 202) const uint sp_uint = 100; +layout(constant_id = 203) const int sp_sint = -10; + + +// +// Scalars +// + +// Size convert +const double float_to_double = double(sp_float); +const float double_to_float = float(float_to_double); + +// Negate and Not +const int negate_int = -sp_int; +const int not_int = ~sp_int; + +// Add and Subtract +const int sp_int_add_two = sp_int + 2; +const int sp_int_add_two_sub_three = sp_int + 2 - 3; +const int sp_int_add_two_sub_four = sp_int_add_two - 4; + +// Mul, Div and Rem +const int sp_sint_mul_two = sp_sint * 2; +const uint sp_uint_mul_two = sp_uint * 2; +const int sp_sint_mul_two_div_five = sp_sint_mul_two / 5; +const uint sp_uint_mul_two_div_five = sp_uint_mul_two / 5; +const int sp_sint_rem_four = sp_sint % 4; +const uint sp_uint_rem_four = sp_uint % 4; +const int sp_sint_mul_three_div_five = sp_sint * 3 / 5; + +// Shift +const int sp_sint_shift_right_arithmetic = sp_sint >> 10; +const uint sp_uint_shift_right_arithmetic = sp_uint >> 20; +const int sp_sint_shift_left = sp_sint << 1; +const uint sp_uint_shift_left = sp_uint << 2; + +// Bitwise And, Or, Xor +const int sp_sint_or_256 = sp_sint | 0x100; +const uint sp_uint_xor_512 = sp_uint ^ 0x200; +const int sp_sint_and_sp_uint = sp_sint & int(sp_uint); + +// Scalar comparison +const bool sp_int_lt_sp_sint = sp_int < sp_sint; +const bool sp_uint_lt_sp_sint = sp_uint < sp_sint; +const bool sp_sint_lt_sp_uint = sp_sint < sp_uint; + +// +// Vectors +// +const ivec4 iv = ivec4(20, 30, sp_int, sp_int); +const uvec4 uv = uvec4(sp_uint, sp_uint, -1, -2); +const vec4 fv = vec4(sp_float, 1.25, sp_float, 1.25); + +// Size convert +const dvec4 fv_to_dv = dvec4(fv); +const vec4 dv_to_fv = vec4(fv_to_dv); + +// Negate and Not +const vec4 not_iv = ~iv; +const ivec4 negate_iv = -iv; + +// Add and Subtract +const ivec4 iv_add_two = iv + 2; +const ivec4 iv_add_two_sub_three = iv + 2 - 3; +const ivec4 iv_add_two_sub_four = iv_add_two_sub_three - 4; + +// Mul, Div and Rem +const ivec4 iv_mul_two = iv * 2; +const ivec4 iv_mul_two_div_five = iv_mul_two / 5; +const ivec4 iv_rem_four = iv % 4; + +// Shift +const ivec4 iv_shift_right_arithmetic = iv >> 10; +const ivec4 iv_shift_left = iv << 2; + +// Bitwise And, Or, Xor +const ivec4 iv_or_1024 = iv | 0x400; +const uvec4 uv_xor_2048 = uv ^ 0x800; +const ivec4 iv_and_uv = iv & ivec4(uv); + +// Swizzles +const int iv_x = iv.x; +const ivec2 iv_yx = iv.yx; +const ivec3 iv_zyx = iv.zyx; +const ivec4 iv_yzxw = iv.yzxw; + +// Vector comparison, only == and != are supported and allowd. +const bool iv_equal_uv = iv == uv; +const bool iv_not_equal_uv = iv != uv; + +// +// Composite types other than vectors +// + +// Struct +struct int_float_double_vec2 { + int i; + float f; + double d; + vec2 v; +}; + +const int_float_double_vec2 sp_struct_a = { + sp_int, sp_float, float_to_double, + vec2(double_to_float, 1.0) +}; + +const int_float_double_vec2 sp_struct_b = { + sp_int, sp_float, float_to_double, + vec2(double_to_float, 1.0) +}; + +const bool struct_a_equal_struct_b = sp_struct_a == sp_struct_b; +const bool struct_a_not_equal_struct_b = sp_struct_a != sp_struct_b; + +// Array +const float array_a[2] = {sp_float, sp_float}; +const float array_b[2] = {sp_float, sp_float}; +const bool array_a_equal_array_b = array_a == array_b; +const bool array_a_not_equal_array_b = array_a != array_b; + +void main() {} + diff --git a/Test/test-spirv-list b/Test/test-spirv-list index 4534132f..b7dfd537 100644 --- a/Test/test-spirv-list +++ b/Test/test-spirv-list @@ -103,6 +103,7 @@ spv.subpass.frag spv.specConstant.vert spv.specConstant.comp spv.specConstantComposite.vert +spv.specConstantOperations.vert # GLSL-level semantics vulkan.frag vulkan.vert From 414eb604825888d0b7a981027b675e77a6bd298b Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Fri, 4 Mar 2016 16:22:34 -0500 Subject: [PATCH 013/140] Link in Google Test framework. The existing test harness is a homemade shell script. All the tests and the expected results are written in plain text files. The harness just reads in a test, invoke the glslangValidator binary on it, and compare the result with the golden file. All tests are kinda integration tests. This patch add Google Test as an external project, which provides a new harness for reading shader source files, compile to SPIR-V, and then compare with the expected output. --- .gitignore | 1 + CMakeLists.txt | 7 + External/CMakeLists.txt | 16 ++ README.md | 12 +- StandAlone/CMakeLists.txt | 11 +- StandAlone/DefaultResourceLimits.cpp | 239 +++++++++++++++++++++ StandAlone/DefaultResourceLimits.h | 54 +++++ StandAlone/StandAlone.cpp | 108 +--------- Test/baseResults/spv.330.geom.out | 0 Test/baseResults/spv.test.frag.out | 0 Test/baseResults/spv.test.vert.out | 0 gtests/AST.FromFile.cpp | 191 +++++++++++++++++ gtests/BuiltInResource.FromFile.cpp | 57 +++++ gtests/CMakeLists.txt | 32 +++ gtests/Initializer.h | 119 +++++++++++ gtests/Pp.FromFile.cpp | 74 +++++++ gtests/README.md | 26 +++ gtests/Settings.cpp | 41 ++++ gtests/Settings.h | 54 +++++ gtests/Spv.FromFile.cpp | 188 ++++++++++++++++ gtests/TestFixture.cpp | 124 +++++++++++ gtests/TestFixture.h | 307 +++++++++++++++++++++++++++ gtests/main.cpp | 63 ++++++ 23 files changed, 1618 insertions(+), 106 deletions(-) create mode 100644 External/CMakeLists.txt create mode 100644 StandAlone/DefaultResourceLimits.cpp create mode 100644 StandAlone/DefaultResourceLimits.h mode change 100755 => 100644 Test/baseResults/spv.330.geom.out mode change 100755 => 100644 Test/baseResults/spv.test.frag.out mode change 100755 => 100644 Test/baseResults/spv.test.vert.out create mode 100644 gtests/AST.FromFile.cpp create mode 100644 gtests/BuiltInResource.FromFile.cpp create mode 100644 gtests/CMakeLists.txt create mode 100644 gtests/Initializer.h create mode 100644 gtests/Pp.FromFile.cpp create mode 100644 gtests/README.md create mode 100644 gtests/Settings.cpp create mode 100644 gtests/Settings.h create mode 100644 gtests/Spv.FromFile.cpp create mode 100644 gtests/TestFixture.cpp create mode 100644 gtests/TestFixture.h create mode 100644 gtests/main.cpp diff --git a/.gitignore b/.gitignore index d93c2022..66cbff97 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ build/ Test/localResults/ Test/multiThread.out Test/singleThread.out +External/googletest diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d723d87..ac756f55 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,7 @@ cmake_minimum_required(VERSION 2.8) +enable_testing() + set(CMAKE_INSTALL_PREFIX "install" CACHE STRING "prefix") project(glslang) @@ -20,7 +22,12 @@ elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") add_definitions(-std=c++11) endif() +# We depend on these for later projects, so they should come first. +add_subdirectory(External) + add_subdirectory(glslang) add_subdirectory(OGLCompilersDLL) add_subdirectory(StandAlone) add_subdirectory(SPIRV) + +add_subdirectory(gtests) diff --git a/External/CMakeLists.txt b/External/CMakeLists.txt new file mode 100644 index 00000000..d43cf9d0 --- /dev/null +++ b/External/CMakeLists.txt @@ -0,0 +1,16 @@ +# Suppress all warnings from external projects. +set_property(DIRECTORY APPEND PROPERTY COMPILE_OPTIONS -w) + +if (TARGET gmock) + message(STATUS "Google Mock already configured - use it") +elseif(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/googletest) + # We need to make sure Google Test does not mess up with the + # global CRT settings on Windows. + if(WIN32) + set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) + endif(WIN32) + add_subdirectory(googletest) +else() + message(STATUS + "Google Mock was not found - tests based on that will not build") +endif() diff --git a/README.md b/README.md index 7a60e280..77508774 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,12 @@ bison --defines=MachineIndependent/glslang_tab.cpp.h -o MachineIndependent/glslang_tab.cpp ``` +Glslang is adding the ability to test with +[Google Test](https://github.com/google/googletest) framework. If you want to +build and run those tests, please make sure you have a copy of Google Tests +checked out in the `External/` directory: +`git clone https://github.com/google/googletest.git`. + Programmatic Interfaces ----------------------- @@ -118,7 +124,11 @@ Testing ------- Test results should always be included with a pull request that modifies -functionality. There is a simple process for doing this, described here: +functionality. And since glslang is adding the ability to test with +[Google Test](https://github.com/google/googletest) framework, +please write your new tests using Google Test. + +The old (deprecated) testing process is: `Test` is an active test directory that contains test input and a subdirectory `baseResults` that contains the expected results of the diff --git a/StandAlone/CMakeLists.txt b/StandAlone/CMakeLists.txt index 38cb2bdb..51f332a6 100644 --- a/StandAlone/CMakeLists.txt +++ b/StandAlone/CMakeLists.txt @@ -1,5 +1,13 @@ cmake_minimum_required(VERSION 2.8) +add_library(glslang-default-resource-limits + ${CMAKE_CURRENT_SOURCE_DIR}/DefaultResourceLimits.cpp +) +target_include_directories(glslang-default-resource-limits + PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} + PUBLIC ${PROJECT_SOURCE_DIR} +) + set(SOURCES StandAlone.cpp) set(REMAPPER_SOURCES spirv-remap.cpp) @@ -10,7 +18,8 @@ set(LIBRARIES glslang OGLCompiler OSDependent - SPIRV) + SPIRV + glslang-default-resource-limits) if(WIN32) set(LIBRARIES ${LIBRARIES} psapi) diff --git a/StandAlone/DefaultResourceLimits.cpp b/StandAlone/DefaultResourceLimits.cpp new file mode 100644 index 00000000..66032de1 --- /dev/null +++ b/StandAlone/DefaultResourceLimits.cpp @@ -0,0 +1,239 @@ +// +// Copyright (C) 2016 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 Google Inc. 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 "DefaultResourceLimits.h" + +namespace glslang { + +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, + /* .limits = */ { + /* .nonInductiveForLoops = */ 1, + /* .whileLoops = */ 1, + /* .doWhileLoops = */ 1, + /* .generalUniformIndexing = */ 1, + /* .generalAttributeMatrixVectorIndexing = */ 1, + /* .generalVaryingIndexing = */ 1, + /* .generalSamplerIndexing = */ 1, + /* .generalVariableIndexing = */ 1, + /* .generalConstantMatrixVectorIndexing = */ 1, + }}; + +std::string GetDefaultTBuiltInResourceString() +{ + std::ostringstream ostream; + + ostream << "MaxLights " << DefaultTBuiltInResource.maxLights << "\n" + << "MaxClipPlanes " << DefaultTBuiltInResource.maxClipPlanes << "\n" + << "MaxTextureUnits " << DefaultTBuiltInResource.maxTextureUnits << "\n" + << "MaxTextureCoords " << DefaultTBuiltInResource.maxTextureCoords << "\n" + << "MaxVertexAttribs " << DefaultTBuiltInResource.maxVertexAttribs << "\n" + << "MaxVertexUniformComponents " << DefaultTBuiltInResource.maxVertexUniformComponents << "\n" + << "MaxVaryingFloats " << DefaultTBuiltInResource.maxVaryingFloats << "\n" + << "MaxVertexTextureImageUnits " << DefaultTBuiltInResource.maxVertexTextureImageUnits << "\n" + << "MaxCombinedTextureImageUnits " << DefaultTBuiltInResource.maxCombinedTextureImageUnits << "\n" + << "MaxTextureImageUnits " << DefaultTBuiltInResource.maxTextureImageUnits << "\n" + << "MaxFragmentUniformComponents " << DefaultTBuiltInResource.maxFragmentUniformComponents << "\n" + << "MaxDrawBuffers " << DefaultTBuiltInResource.maxDrawBuffers << "\n" + << "MaxVertexUniformVectors " << DefaultTBuiltInResource.maxVertexUniformVectors << "\n" + << "MaxVaryingVectors " << DefaultTBuiltInResource.maxVaryingVectors << "\n" + << "MaxFragmentUniformVectors " << DefaultTBuiltInResource.maxFragmentUniformVectors << "\n" + << "MaxVertexOutputVectors " << DefaultTBuiltInResource.maxVertexOutputVectors << "\n" + << "MaxFragmentInputVectors " << DefaultTBuiltInResource.maxFragmentInputVectors << "\n" + << "MinProgramTexelOffset " << DefaultTBuiltInResource.minProgramTexelOffset << "\n" + << "MaxProgramTexelOffset " << DefaultTBuiltInResource.maxProgramTexelOffset << "\n" + << "MaxClipDistances " << DefaultTBuiltInResource.maxClipDistances << "\n" + << "MaxComputeWorkGroupCountX " << DefaultTBuiltInResource.maxComputeWorkGroupCountX << "\n" + << "MaxComputeWorkGroupCountY " << DefaultTBuiltInResource.maxComputeWorkGroupCountY << "\n" + << "MaxComputeWorkGroupCountZ " << DefaultTBuiltInResource.maxComputeWorkGroupCountZ << "\n" + << "MaxComputeWorkGroupSizeX " << DefaultTBuiltInResource.maxComputeWorkGroupSizeX << "\n" + << "MaxComputeWorkGroupSizeY " << DefaultTBuiltInResource.maxComputeWorkGroupSizeY << "\n" + << "MaxComputeWorkGroupSizeZ " << DefaultTBuiltInResource.maxComputeWorkGroupSizeZ << "\n" + << "MaxComputeUniformComponents " << DefaultTBuiltInResource.maxComputeUniformComponents << "\n" + << "MaxComputeTextureImageUnits " << DefaultTBuiltInResource.maxComputeTextureImageUnits << "\n" + << "MaxComputeImageUniforms " << DefaultTBuiltInResource.maxComputeImageUniforms << "\n" + << "MaxComputeAtomicCounters " << DefaultTBuiltInResource.maxComputeAtomicCounters << "\n" + << "MaxComputeAtomicCounterBuffers " << DefaultTBuiltInResource.maxComputeAtomicCounterBuffers << "\n" + << "MaxVaryingComponents " << DefaultTBuiltInResource.maxVaryingComponents << "\n" + << "MaxVertexOutputComponents " << DefaultTBuiltInResource.maxVertexOutputComponents << "\n" + << "MaxGeometryInputComponents " << DefaultTBuiltInResource.maxGeometryInputComponents << "\n" + << "MaxGeometryOutputComponents " << DefaultTBuiltInResource.maxGeometryOutputComponents << "\n" + << "MaxFragmentInputComponents " << DefaultTBuiltInResource.maxFragmentInputComponents << "\n" + << "MaxImageUnits " << DefaultTBuiltInResource.maxImageUnits << "\n" + << "MaxCombinedImageUnitsAndFragmentOutputs " << DefaultTBuiltInResource.maxCombinedImageUnitsAndFragmentOutputs << "\n" + << "MaxCombinedShaderOutputResources " << DefaultTBuiltInResource.maxCombinedShaderOutputResources << "\n" + << "MaxImageSamples " << DefaultTBuiltInResource.maxImageSamples << "\n" + << "MaxVertexImageUniforms " << DefaultTBuiltInResource.maxVertexImageUniforms << "\n" + << "MaxTessControlImageUniforms " << DefaultTBuiltInResource.maxTessControlImageUniforms << "\n" + << "MaxTessEvaluationImageUniforms " << DefaultTBuiltInResource.maxTessEvaluationImageUniforms << "\n" + << "MaxGeometryImageUniforms " << DefaultTBuiltInResource.maxGeometryImageUniforms << "\n" + << "MaxFragmentImageUniforms " << DefaultTBuiltInResource.maxFragmentImageUniforms << "\n" + << "MaxCombinedImageUniforms " << DefaultTBuiltInResource.maxCombinedImageUniforms << "\n" + << "MaxGeometryTextureImageUnits " << DefaultTBuiltInResource.maxGeometryTextureImageUnits << "\n" + << "MaxGeometryOutputVertices " << DefaultTBuiltInResource.maxGeometryOutputVertices << "\n" + << "MaxGeometryTotalOutputComponents " << DefaultTBuiltInResource.maxGeometryTotalOutputComponents << "\n" + << "MaxGeometryUniformComponents " << DefaultTBuiltInResource.maxGeometryUniformComponents << "\n" + << "MaxGeometryVaryingComponents " << DefaultTBuiltInResource.maxGeometryVaryingComponents << "\n" + << "MaxTessControlInputComponents " << DefaultTBuiltInResource.maxTessControlInputComponents << "\n" + << "MaxTessControlOutputComponents " << DefaultTBuiltInResource.maxTessControlOutputComponents << "\n" + << "MaxTessControlTextureImageUnits " << DefaultTBuiltInResource.maxTessControlTextureImageUnits << "\n" + << "MaxTessControlUniformComponents " << DefaultTBuiltInResource.maxTessControlUniformComponents << "\n" + << "MaxTessControlTotalOutputComponents " << DefaultTBuiltInResource.maxTessControlTotalOutputComponents << "\n" + << "MaxTessEvaluationInputComponents " << DefaultTBuiltInResource.maxTessEvaluationInputComponents << "\n" + << "MaxTessEvaluationOutputComponents " << DefaultTBuiltInResource.maxTessEvaluationOutputComponents << "\n" + << "MaxTessEvaluationTextureImageUnits " << DefaultTBuiltInResource.maxTessEvaluationTextureImageUnits << "\n" + << "MaxTessEvaluationUniformComponents " << DefaultTBuiltInResource.maxTessEvaluationUniformComponents << "\n" + << "MaxTessPatchComponents " << DefaultTBuiltInResource.maxTessPatchComponents << "\n" + << "MaxPatchVertices " << DefaultTBuiltInResource.maxPatchVertices << "\n" + << "MaxTessGenLevel " << DefaultTBuiltInResource.maxTessGenLevel << "\n" + << "MaxViewports " << DefaultTBuiltInResource.maxViewports << "\n" + << "MaxVertexAtomicCounters " << DefaultTBuiltInResource.maxVertexAtomicCounters << "\n" + << "MaxTessControlAtomicCounters " << DefaultTBuiltInResource.maxTessControlAtomicCounters << "\n" + << "MaxTessEvaluationAtomicCounters " << DefaultTBuiltInResource.maxTessEvaluationAtomicCounters << "\n" + << "MaxGeometryAtomicCounters " << DefaultTBuiltInResource.maxGeometryAtomicCounters << "\n" + << "MaxFragmentAtomicCounters " << DefaultTBuiltInResource.maxFragmentAtomicCounters << "\n" + << "MaxCombinedAtomicCounters " << DefaultTBuiltInResource.maxCombinedAtomicCounters << "\n" + << "MaxAtomicCounterBindings " << DefaultTBuiltInResource.maxAtomicCounterBindings << "\n" + << "MaxVertexAtomicCounterBuffers " << DefaultTBuiltInResource.maxVertexAtomicCounterBuffers << "\n" + << "MaxTessControlAtomicCounterBuffers " << DefaultTBuiltInResource.maxTessControlAtomicCounterBuffers << "\n" + << "MaxTessEvaluationAtomicCounterBuffers " << DefaultTBuiltInResource.maxTessEvaluationAtomicCounterBuffers << "\n" + << "MaxGeometryAtomicCounterBuffers " << DefaultTBuiltInResource.maxGeometryAtomicCounterBuffers << "\n" + << "MaxFragmentAtomicCounterBuffers " << DefaultTBuiltInResource.maxFragmentAtomicCounterBuffers << "\n" + << "MaxCombinedAtomicCounterBuffers " << DefaultTBuiltInResource.maxCombinedAtomicCounterBuffers << "\n" + << "MaxAtomicCounterBufferSize " << DefaultTBuiltInResource.maxAtomicCounterBufferSize << "\n" + << "MaxTransformFeedbackBuffers " << DefaultTBuiltInResource.maxTransformFeedbackBuffers << "\n" + << "MaxTransformFeedbackInterleavedComponents " << DefaultTBuiltInResource.maxTransformFeedbackInterleavedComponents << "\n" + << "MaxCullDistances " << DefaultTBuiltInResource.maxCullDistances << "\n" + << "MaxCombinedClipAndCullDistances " << DefaultTBuiltInResource.maxCombinedClipAndCullDistances << "\n" + << "MaxSamples " << DefaultTBuiltInResource.maxSamples << "\n" + + << "nonInductiveForLoops " << DefaultTBuiltInResource.limits.nonInductiveForLoops << "\n" + << "whileLoops " << DefaultTBuiltInResource.limits.whileLoops << "\n" + << "doWhileLoops " << DefaultTBuiltInResource.limits.doWhileLoops << "\n" + << "generalUniformIndexing " << DefaultTBuiltInResource.limits.generalUniformIndexing << "\n" + << "generalAttributeMatrixVectorIndexing " << DefaultTBuiltInResource.limits.generalAttributeMatrixVectorIndexing << "\n" + << "generalVaryingIndexing " << DefaultTBuiltInResource.limits.generalVaryingIndexing << "\n" + << "generalSamplerIndexing " << DefaultTBuiltInResource.limits.generalSamplerIndexing << "\n" + << "generalVariableIndexing " << DefaultTBuiltInResource.limits.generalVariableIndexing << "\n" + << "generalConstantMatrixVectorIndexing " << DefaultTBuiltInResource.limits.generalConstantMatrixVectorIndexing << "\n" + ; + + return ostream.str(); +} + +} // end namespace glslang diff --git a/StandAlone/DefaultResourceLimits.h b/StandAlone/DefaultResourceLimits.h new file mode 100644 index 00000000..fa52a2a7 --- /dev/null +++ b/StandAlone/DefaultResourceLimits.h @@ -0,0 +1,54 @@ +// +// Copyright (C) 2016 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 Google Inc. 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. + +#ifndef _DEFAULT_RESOURCE_LIMITS_INCLUDED_ +#define _DEFAULT_RESOURCE_LIMITS_INCLUDED_ + +#include + +#include "glslang/Include/ResourceLimits.h" + +namespace glslang { + +// These are the default resources for TBuiltInResources, used for both +// - parsing this string for the case where the user didn't supply one, +// - dumping out a template for user construction of a config file. +extern const TBuiltInResource DefaultTBuiltInResource; + +// Returns the DefaultTBuiltInResource as a human-readable string. +std::string GetDefaultTBuiltInResourceString(); + +} // end namespace glslang + +#endif // _DEFAULT_RESOURCE_LIMITS_INCLUDED_ diff --git a/StandAlone/StandAlone.cpp b/StandAlone/StandAlone.cpp index 6ebdb7f5..e8ab7b56 100644 --- a/StandAlone/StandAlone.cpp +++ b/StandAlone/StandAlone.cpp @@ -37,6 +37,7 @@ // this only applies to the standalone wrapper, not the front end in general #define _CRT_SECURE_NO_WARNINGS +#include "DefaultResourceLimits.h" #include "Worklist.h" #include "./../glslang/Include/ShHandle.h" #include "./../glslang/Include/revision.h" @@ -110,107 +111,6 @@ int NumShaderStrings; TBuiltInResource Resources; std::string ConfigFile; -// -// These are the default resources for TBuiltInResources, used for both -// - parsing this string for the case where the user didn't supply one -// - dumping out a template for user construction of a config file -// -const char* DefaultConfig = - "MaxLights 32\n" - "MaxClipPlanes 6\n" - "MaxTextureUnits 32\n" - "MaxTextureCoords 32\n" - "MaxVertexAttribs 64\n" - "MaxVertexUniformComponents 4096\n" - "MaxVaryingFloats 64\n" - "MaxVertexTextureImageUnits 32\n" - "MaxCombinedTextureImageUnits 80\n" - "MaxTextureImageUnits 32\n" - "MaxFragmentUniformComponents 4096\n" - "MaxDrawBuffers 32\n" - "MaxVertexUniformVectors 128\n" - "MaxVaryingVectors 8\n" - "MaxFragmentUniformVectors 16\n" - "MaxVertexOutputVectors 16\n" - "MaxFragmentInputVectors 15\n" - "MinProgramTexelOffset -8\n" - "MaxProgramTexelOffset 7\n" - "MaxClipDistances 8\n" - "MaxComputeWorkGroupCountX 65535\n" - "MaxComputeWorkGroupCountY 65535\n" - "MaxComputeWorkGroupCountZ 65535\n" - "MaxComputeWorkGroupSizeX 1024\n" - "MaxComputeWorkGroupSizeY 1024\n" - "MaxComputeWorkGroupSizeZ 64\n" - "MaxComputeUniformComponents 1024\n" - "MaxComputeTextureImageUnits 16\n" - "MaxComputeImageUniforms 8\n" - "MaxComputeAtomicCounters 8\n" - "MaxComputeAtomicCounterBuffers 1\n" - "MaxVaryingComponents 60\n" - "MaxVertexOutputComponents 64\n" - "MaxGeometryInputComponents 64\n" - "MaxGeometryOutputComponents 128\n" - "MaxFragmentInputComponents 128\n" - "MaxImageUnits 8\n" - "MaxCombinedImageUnitsAndFragmentOutputs 8\n" - "MaxCombinedShaderOutputResources 8\n" - "MaxImageSamples 0\n" - "MaxVertexImageUniforms 0\n" - "MaxTessControlImageUniforms 0\n" - "MaxTessEvaluationImageUniforms 0\n" - "MaxGeometryImageUniforms 0\n" - "MaxFragmentImageUniforms 8\n" - "MaxCombinedImageUniforms 8\n" - "MaxGeometryTextureImageUnits 16\n" - "MaxGeometryOutputVertices 256\n" - "MaxGeometryTotalOutputComponents 1024\n" - "MaxGeometryUniformComponents 1024\n" - "MaxGeometryVaryingComponents 64\n" - "MaxTessControlInputComponents 128\n" - "MaxTessControlOutputComponents 128\n" - "MaxTessControlTextureImageUnits 16\n" - "MaxTessControlUniformComponents 1024\n" - "MaxTessControlTotalOutputComponents 4096\n" - "MaxTessEvaluationInputComponents 128\n" - "MaxTessEvaluationOutputComponents 128\n" - "MaxTessEvaluationTextureImageUnits 16\n" - "MaxTessEvaluationUniformComponents 1024\n" - "MaxTessPatchComponents 120\n" - "MaxPatchVertices 32\n" - "MaxTessGenLevel 64\n" - "MaxViewports 16\n" - "MaxVertexAtomicCounters 0\n" - "MaxTessControlAtomicCounters 0\n" - "MaxTessEvaluationAtomicCounters 0\n" - "MaxGeometryAtomicCounters 0\n" - "MaxFragmentAtomicCounters 8\n" - "MaxCombinedAtomicCounters 8\n" - "MaxAtomicCounterBindings 1\n" - "MaxVertexAtomicCounterBuffers 0\n" - "MaxTessControlAtomicCounterBuffers 0\n" - "MaxTessEvaluationAtomicCounterBuffers 0\n" - "MaxGeometryAtomicCounterBuffers 0\n" - "MaxFragmentAtomicCounterBuffers 1\n" - "MaxCombinedAtomicCounterBuffers 1\n" - "MaxAtomicCounterBufferSize 16384\n" - "MaxTransformFeedbackBuffers 4\n" - "MaxTransformFeedbackInterleavedComponents 64\n" - "MaxCullDistances 8\n" - "MaxCombinedClipAndCullDistances 8\n" - "MaxSamples 4\n" - - "nonInductiveForLoops 1\n" - "whileLoops 1\n" - "doWhileLoops 1\n" - "generalUniformIndexing 1\n" - "generalAttributeMatrixVectorIndexing 1\n" - "generalVaryingIndexing 1\n" - "generalSamplerIndexing 1\n" - "generalVariableIndexing 1\n" - "generalConstantMatrixVectorIndexing 1\n" - ; - // // Parse either a .conf file provided by the user or the default string above. // @@ -229,8 +129,8 @@ void ProcessConfigFile() } if (config == 0) { - config = new char[strlen(DefaultConfig) + 1]; - strcpy(config, DefaultConfig); + Resources = glslang::DefaultTBuiltInResource; + return; } const char* delims = " \t\n\r"; @@ -832,7 +732,7 @@ int C_DECL main(int argc, char* argv[]) ProcessArguments(argc, argv); if (Options & EOptionDumpConfig) { - printf("%s", DefaultConfig); + printf("%s", glslang::GetDefaultTBuiltInResourceString().c_str()); if (Worklist.empty()) return ESuccess; } diff --git a/Test/baseResults/spv.330.geom.out b/Test/baseResults/spv.330.geom.out old mode 100755 new mode 100644 diff --git a/Test/baseResults/spv.test.frag.out b/Test/baseResults/spv.test.frag.out old mode 100755 new mode 100644 diff --git a/Test/baseResults/spv.test.vert.out b/Test/baseResults/spv.test.vert.out old mode 100755 new mode 100644 diff --git a/gtests/AST.FromFile.cpp b/gtests/AST.FromFile.cpp new file mode 100644 index 00000000..5e0b31e9 --- /dev/null +++ b/gtests/AST.FromFile.cpp @@ -0,0 +1,191 @@ +// +// Copyright (C) 2016 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 Google Inc. 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 "TestFixture.h" + +namespace glslangtest { +namespace { + +using CompileToAstTest = GlslangTest<::testing::TestWithParam>; + +TEST_P(CompileToAstTest, FromFile) +{ + loadFileCompileAndCheck(GLSLANG_TEST_DIRECTORY, GetParam(), + Semantics::OpenGL, Target::AST); +} + +// clang-format off +INSTANTIATE_TEST_CASE_P( + Glsl, CompileToAstTest, + ::testing::ValuesIn(std::vector({ + "sample.frag", + "sample.vert", + "decls.frag", + "specExamples.frag", + "specExamples.vert", + "versionsClean.frag", + "versionsClean.vert", + "versionsErrors.frag", + "versionsErrors.vert", + "100.frag", + "120.vert", + "120.frag", + "130.vert", + "130.frag", + "140.vert", + "140.frag", + "150.vert", + "150.geom", + "150.frag", + "precision.frag", + "precision.vert", + "nonSquare.vert", + "matrixError.vert", + "cppSimple.vert", + "cppIndent.vert", + "cppNest.vert", + "cppComplexExpr.vert", + "badChars.frag", + "pointCoord.frag", + "array.frag", + "array100.frag", + "comment.frag", + "300.vert", + "300.frag", + "300BuiltIns.frag", + "300layout.vert", + "300layout.frag", + "300operations.frag", + "300block.frag", + "310.comp", + "310.vert", + "310.geom", + "310.frag", + "310.tesc", + "310.tese", + "310implicitSizeArrayError.vert", + "310AofA.vert", + "330.frag", + "330comp.frag", + "constErrors.frag", + "constFold.frag", + "errors.frag", + "forwardRef.frag", + "uint.frag", + "switch.frag", + "tokenLength.vert", + "100Limits.vert", + "100scope.vert", + "110scope.vert", + "300scope.vert", + "400.frag", + "420.frag", + "420.vert", + "420.geom", + "420_size_gl_in.geom", + "430scope.vert", + "lineContinuation100.vert", + "lineContinuation.vert", + "numeral.frag", + "400.geom", + "400.tesc", + "400.tese", + "410.tesc", + "420.tesc", + "420.tese", + "410.geom", + "430.vert", + "430.comp", + "430AofA.frag", + "440.vert", + "440.frag", + "450.vert", + "450.geom", + "450.tesc", + "450.tese", + "450.frag", + "450.comp", + "dce.frag", + "atomic_uint.frag", + "aggOps.frag", + "always-discard.frag", + "always-discard2.frag", + "conditionalDiscard.frag", + "conversion.frag", + "dataOut.frag", + "dataOutIndirect.frag", + "deepRvalue.frag", + "depthOut.frag", + "discard-dce.frag", + "doWhileLoop.frag", + "earlyReturnDiscard.frag", + "flowControl.frag", + "forLoop.frag", + "functionCall.frag", + "functionSemantics.frag", + "length.frag", + "localAggregates.frag", + "loops.frag", + "loopsArtificial.frag", + "matrix.frag", + "matrix2.frag", + "newTexture.frag", + "Operations.frag", + "prepost.frag", + "simpleFunctionCall.frag", + "structAssignment.frag", + "structDeref.frag", + "structure.frag", + "swizzle.frag", + "syntaxError.frag", + "test.frag", + "texture.frag", + "types.frag", + "uniformArray.frag", + "variableArrayIndex.frag", + "varyingArray.frag", + "varyingArrayIndirect.frag", + "voidFunction.frag", + "whileLoop.frag", + "nonVulkan.frag", + "spv.atomic.comp", + })), + FileNameAsCustomTestName +); +// clang-format on + +} // anonymous namespace +} // namespace glslangtest diff --git a/gtests/BuiltInResource.FromFile.cpp b/gtests/BuiltInResource.FromFile.cpp new file mode 100644 index 00000000..c2d2b8b6 --- /dev/null +++ b/gtests/BuiltInResource.FromFile.cpp @@ -0,0 +1,57 @@ +// +// Copyright (C) 2016 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 Google Inc. 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 + +#include "StandAlone/DefaultResourceLimits.h" +#include "TestFixture.h" + +namespace glslangtest { +namespace { + +using DefaultResourceTest = GlslangTest<::testing::Test>; + +TEST_F(DefaultResourceTest, FromFile) +{ + const std::string path = GLSLANG_TEST_DIRECTORY "/baseResults/test.conf"; + std::string expectedConfig; + tryLoadFile(path, "expected resource limit", &expectedConfig); + const std::string realConfig = glslang::GetDefaultTBuiltInResourceString(); + ASSERT_EQ(expectedConfig, realConfig); +} + +} // anonymous namespace +} // namespace glslangtest diff --git a/gtests/CMakeLists.txt b/gtests/CMakeLists.txt new file mode 100644 index 00000000..57378cea --- /dev/null +++ b/gtests/CMakeLists.txt @@ -0,0 +1,32 @@ +if (TARGET gmock) + message(STATUS "Google Mock found - building tests") + + set(TEST_SOURCES + # Framework related source files + ${CMAKE_CURRENT_SOURCE_DIR}/Initializer.h + ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Settings.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Settings.h + ${CMAKE_CURRENT_SOURCE_DIR}/TestFixture.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/TestFixture.h + + # Test related source files + ${CMAKE_CURRENT_SOURCE_DIR}/AST.FromFile.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/BuiltInResource.FromFile.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Pp.FromFile.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Spv.FromFile.cpp + ) + + add_executable(glslangtests ${TEST_SOURCES}) + target_compile_definitions(glslangtests + PRIVATE GLSLANG_TEST_DIRECTORY="${CMAKE_CURRENT_SOURCE_DIR}/../Test") + target_include_directories(glslangtests PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} + ${PROJECT_SOURCE_DIR} + ${gmock_SOURCE_DIR}/include + ${gtest_SOURCE_DIR}/include) + target_link_libraries(glslangtests PRIVATE + glslang OSDependent OGLCompiler glslang + SPIRV glslang-default-resource-limits gmock) + add_test(NAME glslang-gtests COMMAND glslangtests) +endif() diff --git a/gtests/Initializer.h b/gtests/Initializer.h new file mode 100644 index 00000000..e8fa30d1 --- /dev/null +++ b/gtests/Initializer.h @@ -0,0 +1,119 @@ +// +// Copyright (C) 2016 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 Google Inc. 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. + +#ifndef GLSLANG_GTESTS_INITIALIZER_H +#define GLSLANG_GTESTS_INITIALIZER_H + +#include + +#include "glslang/Public/ShaderLang.h" + +namespace glslangtest { + +// Initializes glslang on creation, and destroys it on completion. +// And provides .Acquire() as a way to reinitialize glslang if semantics change. +// This object is expected to be a singleton, so that internal glslang state +// can be correctly handled. +// +// TODO(antiagainst): It's a known bug that some of the internal states need to +// be reset if semantics change: +// https://github.com/KhronosGroup/glslang/issues/166 +// Therefore, the following mechanism is needed. Remove this once the above bug +// gets fixed. +class GlslangInitializer { +public: + GlslangInitializer() : lastMessages(EShMsgDefault) + { + glslang::InitializeProcess(); + } + + ~GlslangInitializer() { glslang::FinalizeProcess(); } + + // A token indicates that the glslang is reinitialized (if necessary) to the + // required semantics. And that won't change until the token is destroyed. + class InitializationToken { + public: + InitializationToken() : initializer(nullptr) {} + ~InitializationToken() + { + if (initializer) { + initializer->release(); + } + } + + InitializationToken(InitializationToken&& other) + : initializer(other.initializer) + { + other.initializer = nullptr; + } + + InitializationToken(const InitializationToken&) = delete; + + private: + InitializationToken(GlslangInitializer* initializer) + : initializer(initializer) {} + + friend class GlslangInitializer; + GlslangInitializer* initializer; + }; + + // Obtains exclusive access to the glslang state. The state remains + // exclusive until the Initialization Token has been destroyed. + // Re-initializes glsl state iff the previous messages and the current + // messages are incompatible. + InitializationToken acquire(EShMessages new_messages) + { + stateLock.lock(); + + if ((lastMessages ^ new_messages) & + (EShMsgVulkanRules | EShMsgSpvRules)) { + glslang::FinalizeProcess(); + glslang::InitializeProcess(); + } + lastMessages = new_messages; + return InitializationToken(this); + } + +private: + void release() { stateLock.unlock(); } + + friend class InitializationToken; + + EShMessages lastMessages; + std::mutex stateLock; +}; + +} // namespace glslangtest + +#endif // GLSLANG_GTESTS_INITIALIZER_H diff --git a/gtests/Pp.FromFile.cpp b/gtests/Pp.FromFile.cpp new file mode 100644 index 00000000..cfd987ba --- /dev/null +++ b/gtests/Pp.FromFile.cpp @@ -0,0 +1,74 @@ +// +// Copyright (C) 2016 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 Google Inc. 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 "TestFixture.h" + +namespace glslangtest { +namespace { + +using PreprocessingTest = GlslangTest<::testing::TestWithParam>; + +TEST_P(PreprocessingTest, FromFile) +{ + loadFilePreprocessAndCheck(GLSLANG_TEST_DIRECTORY, GetParam()); +} + +// clang-format off +INSTANTIATE_TEST_CASE_P( + Glsl, PreprocessingTest, + ::testing::ValuesIn(std::vector({ + "preprocessor.cpp_style_line_directive.vert", + "preprocessor.cpp_style___FILE__.vert", + "preprocessor.edge_cases.vert", + "preprocessor.errors.vert", + "preprocessor.extensions.vert", + "preprocessor.function_macro.vert", + "preprocessor.include.enabled.vert", + "preprocessor.include.disabled.vert", + "preprocessor.line.vert", + "preprocessor.line.frag", + "preprocessor.pragma.vert", + "preprocessor.simple.vert", + "preprocessor.success_if_parse_would_fail.vert", + "preprocessor.defined.vert", + "preprocessor.many.endif.vert", + })), + FileNameAsCustomTestName +); +// clang-format on + +} // anonymous namespace +} // namespace glslangtest diff --git a/gtests/README.md b/gtests/README.md new file mode 100644 index 00000000..c8261cc4 --- /dev/null +++ b/gtests/README.md @@ -0,0 +1,26 @@ +Glslang Tests based on the Google Test Framework +================================================ + +This directory contains [Google Test][gtest] based test fixture and test +cases for glslang. + +Apart from typical unit tests, necessary utility methods are added into +the [`GlslangTests`](TestFixture.h) fixture to provide the ability to do +file-based integration tests. Various `*.FromFile.cpp` files lists names +of files containing input shader code in the `Test/` directory. Utility +methods will load the input shader source, compile them, and compare with +the corresponding expected output in the `Test/baseResults/` directory. + +How to run the tests +-------------------- + +Please make sure you have a copy of [Google Test][gtest] checked out under +the `External` directory before building. After building, just run the +`ctest` command or the `gtests/glslangtests` binary in your build directory. + +The `gtests/glslangtests` binary also provides an `--update-mode` command +line option, which, if supplied, will overwrite the golden files under +the `Test/baseResults/` directory with real output from that invocation. +This serves as an easy way to update golden files. + +[gtest]: https://github.com/google/googletest diff --git a/gtests/Settings.cpp b/gtests/Settings.cpp new file mode 100644 index 00000000..4ba7989b --- /dev/null +++ b/gtests/Settings.cpp @@ -0,0 +1,41 @@ +// +// Copyright (C) 2016 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 Google Inc. 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 "Settings.h" + +namespace glslangtest { + +GTestSettings GlobalTestSettings = {nullptr, false}; + +} // namespace glslangtest diff --git a/gtests/Settings.h b/gtests/Settings.h new file mode 100644 index 00000000..30056a7b --- /dev/null +++ b/gtests/Settings.h @@ -0,0 +1,54 @@ +// +// Copyright (C) 2016 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 Google Inc. 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. + +#ifndef GLSLANG_GTESTS_SETTINGS_H +#define GLSLANG_GTESTS_SETTINGS_H + +namespace glslangtest { + +class GlslangInitializer; + +struct GTestSettings { + // A handle to GlslangInitializer instance. + GlslangInitializer* initializer; + // An indicator of whether GTest should write real output to the file for + // the expected output. + bool updateMode; +}; + +extern GTestSettings GlobalTestSettings; + +} // namespace glslangtest + +#endif // GLSLANG_GTESTS_SETTINGS_H diff --git a/gtests/Spv.FromFile.cpp b/gtests/Spv.FromFile.cpp new file mode 100644 index 00000000..9cd0787a --- /dev/null +++ b/gtests/Spv.FromFile.cpp @@ -0,0 +1,188 @@ +// +// Copyright (C) 2016 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 Google Inc. 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 + +#include "TestFixture.h" + +namespace glslangtest { +namespace { + +using CompileToSpirvTest = GlslangTest<::testing::TestWithParam>; +using VulkanSemantics = GlslangTest<::testing::TestWithParam>; + +// Compiling GLSL to SPIR-V under Vulkan semantics. Expected to successfully +// generate SPIR-V. +TEST_P(CompileToSpirvTest, FromFile) +{ + loadFileCompileAndCheck(GLSLANG_TEST_DIRECTORY, GetParam(), + Semantics::Vulkan, Target::Spirv); +} + +// GLSL-level Vulkan semantics test. Expected to error out before generating +// SPIR-V. +TEST_P(VulkanSemantics, FromFile) +{ + loadFileCompileAndCheck(GLSLANG_TEST_DIRECTORY, GetParam(), + Semantics::Vulkan, Target::Spirv); +} + +// clang-format off +INSTANTIATE_TEST_CASE_P( + Glsl, CompileToSpirvTest, + ::testing::ValuesIn(std::vector({ + // Test looping constructs. + // No tests yet for making sure break and continue from a nested loop + // goes to the innermost target. + "spv.do-simple.vert", + "spv.do-while-continue-break.vert", + "spv.for-complex-condition.vert", + "spv.for-continue-break.vert", + "spv.for-simple.vert", + "spv.for-notest.vert", + "spv.for-nobody.vert", + "spv.while-continue-break.vert", + "spv.while-simple.vert", + // vulkan-specific tests + "spv.set.vert", + "spv.double.comp", + "spv.100ops.frag", + "spv.130.frag", + "spv.140.frag", + "spv.150.geom", + "spv.150.vert", + "spv.300BuiltIns.vert", + "spv.300layout.frag", + "spv.300layout.vert", + "spv.300layoutp.vert", + "spv.310.comp", + "spv.330.geom", + "spv.400.frag", + "spv.400.tesc", + "spv.400.tese", + "spv.420.geom", + "spv.430.vert", + "spv.accessChain.frag", + "spv.aggOps.frag", + "spv.always-discard.frag", + "spv.always-discard2.frag", + "spv.bitCast.frag", + "spv.bool.vert", + "spv.boolInBlock.frag", + "spv.branch-return.vert", + "spv.conditionalDiscard.frag", + "spv.conversion.frag", + "spv.dataOut.frag", + "spv.dataOutIndirect.frag", + "spv.dataOutIndirect.vert", + "spv.deepRvalue.frag", + "spv.depthOut.frag", + "spv.discard-dce.frag", + "spv.doWhileLoop.frag", + "spv.earlyReturnDiscard.frag", + "spv.flowControl.frag", + "spv.forLoop.frag", + "spv.forwardFun.frag", + "spv.functionCall.frag", + "spv.functionSemantics.frag", + "spv.interpOps.frag", + "spv.layoutNested.vert", + "spv.length.frag", + "spv.localAggregates.frag", + "spv.loops.frag", + "spv.loopsArtificial.frag", + "spv.matFun.vert", + "spv.matrix.frag", + "spv.matrix2.frag", + "spv.memoryQualifier.frag", + "spv.merge-unreachable.frag", + "spv.newTexture.frag", + "spv.noDeadDecorations.vert", + "spv.nonSquare.vert", + "spv.Operations.frag", + "spv.intOps.vert", + "spv.precision.frag", + "spv.prepost.frag", + "spv.qualifiers.vert", + "spv.shiftOps.frag", + "spv.simpleFunctionCall.frag", + "spv.simpleMat.vert", + "spv.sparseTexture.frag", + "spv.sparseTextureClamp.frag", + "spv.structAssignment.frag", + "spv.structDeref.frag", + "spv.structure.frag", + "spv.switch.frag", + "spv.swizzle.frag", + "spv.test.frag", + "spv.test.vert", + "spv.texture.frag", + "spv.texture.vert", + "spv.image.frag", + "spv.types.frag", + "spv.uint.frag", + "spv.uniformArray.frag", + "spv.variableArrayIndex.frag", + "spv.varyingArray.frag", + "spv.varyingArrayIndirect.frag", + "spv.voidFunction.frag", + "spv.whileLoop.frag", + "spv.AofA.frag", + "spv.queryL.frag", + "spv.separate.frag", + "spv.shortCircuit.frag", + "spv.pushConstant.vert", + "spv.subpass.frag", + "spv.specConstant.vert", + "spv.specConstant.comp", + "spv.specConstantComposite.vert", + })), + FileNameAsCustomTestName +); + +INSTANTIATE_TEST_CASE_P( + Glsl, VulkanSemantics, + ::testing::ValuesIn(std::vector({ + "vulkan.frag", + "vulkan.vert", + "vulkan.comp", + })), + FileNameAsCustomTestName +); +// clang-format on + +} // anonymous namespace +} // namespace glslangtest diff --git a/gtests/TestFixture.cpp b/gtests/TestFixture.cpp new file mode 100644 index 00000000..744fa558 --- /dev/null +++ b/gtests/TestFixture.cpp @@ -0,0 +1,124 @@ +// +// Copyright (C) 2016 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 Google Inc. 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 "TestFixture.h" + +namespace glslangtest { + +std::string FileNameAsCustomTestName( + const ::testing::TestParamInfo& info) +{ + std::string name = info.param; + // A valid test case suffix cannot have '.' and '-' inside. + std::replace(name.begin(), name.end(), '.', '_'); + std::replace(name.begin(), name.end(), '-', '_'); + return name; +} + +EShLanguage GetGlslLanguageForStage(const std::string& stage) +{ + if (stage == "vert") { + return EShLangVertex; + } else if (stage == "tesc") { + return EShLangTessControl; + } else if (stage == "tese") { + return EShLangTessEvaluation; + } else if (stage == "geom") { + return EShLangGeometry; + } else if (stage == "frag") { + return EShLangFragment; + } else if (stage == "comp") { + return EShLangCompute; + } else { + assert(0 && "Unknown shader stage"); + return EShLangCount; + } +} + +EShMessages GetSpirvMessageOptionsForSemanticsAndTarget(Semantics semantics, + Target target) +{ + EShMessages result = EShMsgDefault; + + switch (target) { + case Target::AST: + result = EShMsgAST; + break; + case Target::Spirv: + result = EShMsgSpvRules; + break; + }; + + switch (semantics) { + case Semantics::OpenGL: + break; + case Semantics::Vulkan: + result = static_cast(result | EShMsgVulkanRules); + break; + } + + return result; +} + +std::pair ReadFile(const std::string& path) +{ + std::ifstream fstream(path, std::ios::in); + if (fstream) { + std::string contents; + fstream.seekg(0, std::ios::end); + contents.reserve(fstream.tellg()); + fstream.seekg(0, std::ios::beg); + contents.assign((std::istreambuf_iterator(fstream)), + std::istreambuf_iterator()); + return std::make_pair(true, contents); + } + return std::make_pair(false, ""); +} + +bool WriteFile(const std::string& path, const std::string& contents) +{ + std::ofstream fstream(path, std::ios::out); + if (!fstream) return false; + fstream << contents; + fstream.flush(); + return true; +} + +std::string GetSuffix(const std::string& name) +{ + const size_t pos = name.rfind('.'); + return (pos == std::string::npos) ? "" : name.substr(name.rfind('.') + 1); +} + +} // namespace glslangtest diff --git a/gtests/TestFixture.h b/gtests/TestFixture.h new file mode 100644 index 00000000..87a365b5 --- /dev/null +++ b/gtests/TestFixture.h @@ -0,0 +1,307 @@ +// +// Copyright (C) 2016 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 Google Inc. 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. + +#ifndef GLSLANG_GTESTS_TEST_FIXTURE_H +#define GLSLANG_GTESTS_TEST_FIXTURE_H + +#include +#include +#include +#include +#include + +#include + +#include "SPIRV/GlslangToSpv.h" +#include "SPIRV/disassemble.h" +#include "SPIRV/doc.h" +#include "StandAlone/DefaultResourceLimits.h" +#include "glslang/Public/ShaderLang.h" + +#include "Initializer.h" +#include "Settings.h" + +// We need CMake to provide us the absolute path to the directory containing +// test files, so we are certain to find those files no matter where the test +// harness binary is generated. This provides out-of-source build capability. +#ifndef GLSLANG_TEST_DIRECTORY +#error \ + "GLSLANG_TEST_DIRECTORY needs to be defined for gtest to locate test files." +#endif + +namespace glslangtest { + +// This function is used to provide custom test name suffixes based on the +// shader source file names. Otherwise, the test name suffixes will just be +// numbers, which are not quite obvious. +std::string FileNameAsCustomTestName( + const ::testing::TestParamInfo& info); + +// Enum for shader compilation semantics. +enum class Semantics { + OpenGL, + Vulkan, +}; + +// Enum for compilation target. +enum class Target { + AST, + Spirv, +}; + +EShLanguage GetGlslLanguageForStage(const std::string& stage); + +EShMessages GetSpirvMessageOptionsForSemanticsAndTarget(Semantics semantics, + Target target); + +// Reads the content of the file at the given |path|. On success, returns true +// and the contents; otherwise, returns false and an empty string. +std::pair ReadFile(const std::string& path); + +// Writes the given |contents| into the file at the given |path|. Returns true +// on successful output. +bool WriteFile(const std::string& path, const std::string& contents); + +// Returns the suffix of the given |name|. +std::string GetSuffix(const std::string& name); + +// Base class for glslang integration tests. It contains many handy utility-like +// methods such as reading shader source files, compiling into AST/SPIR-V, and +// comparing with expected outputs. +// +// To write value-Parameterized tests: +// using ValueParamTest = GlslangTest<::testing::TestWithParam>; +// To use as normal fixture: +// using FixtureTest = GlslangTest<::testing::Test>; +template +class GlslangTest : public GT { +public: + GlslangTest() + : defaultVersion(100), + defaultProfile(ENoProfile), + forceVersionProfile(false), + isForwardCompatible(false) {} + + // Tries to load the contents from the file at the given |path|. On success, + // writes the contents into |contents|. On failure, errors out. + void tryLoadFile(const std::string& path, const std::string& tag, + std::string* contents) + { + bool fileReadOk; + std::tie(fileReadOk, *contents) = ReadFile(path); + ASSERT_TRUE(fileReadOk) << "Cannot open " << tag << " file: " << path; + } + + // Checks the equality of |expected| and |real|. If they are not equal, + // write + // |real| to the given file named as |fname| if update mode is on. + void checkEqAndUpdateIfRequested(const std::string& expected, + const std::string& real, + const std::string& fname) + { + // In order to output the message we want under proper circumstances, we + // need the following operator<< stuff. + EXPECT_EQ(expected, real) + << (GlobalTestSettings.updateMode + ? ("Mismatch found and update mode turned on - " + "flushing expected result output.") + : ""); + + // Update the expected output file if requested. + // It looks weird to duplicate the comparison between expected_output + // and + // stream.str(). However, if creating a variable for the comparison + // result, + // we cannot have pretty print of the string diff in the above. + if (GlobalTestSettings.updateMode && expected != real) { + EXPECT_TRUE(WriteFile(fname, real)) << "Flushing failed"; + } + } + + // A struct for holding all the information returned by glslang compilation + // and linking. + struct GlslangResult { + const std::string compilationOutput; + const std::string compilationError; + const std::string linkingOutput; + const std::string linkingError; + const std::string spirv; // Optional SPIR-V disassembly text. + }; + + // Compiles and linkes the given GLSL |source| code of the given shader + // |stage| into the given |target| under the given |semantics|. Returns + // a GlslangResult instance containing all the information generated + // during the process. If |target| is Target::Spirv, also disassembles + // the result and returns disassembly text. + GlslangResult compileGlsl(const std::string& source, + const std::string& stage, Semantics semantics, + Target target) + { + const char* shaderStrings = source.data(); + const int shaderLengths = static_cast(source.size()); + const EShLanguage language = GetGlslLanguageForStage(stage); + + glslang::TShader shader(language); + shader.setStringsWithLengths(&shaderStrings, &shaderLengths, 1); + const EShMessages messages = + GetSpirvMessageOptionsForSemanticsAndTarget(semantics, target); + // Reinitialize glslang if the semantics change. + GlslangInitializer::InitializationToken token = + GlobalTestSettings.initializer->acquire(messages); + bool success = + shader.parse(&glslang::DefaultTBuiltInResource, defaultVersion, + isForwardCompatible, messages); + + glslang::TProgram program; + program.addShader(&shader); + success &= program.link(messages); + + if (success && target == Target::Spirv) { + std::vector spirv_binary; + glslang::GlslangToSpv(*program.getIntermediate(language), + spirv_binary); + + std::ostringstream disassembly_stream; + spv::Parameterize(); + spv::Disassemble(disassembly_stream, spirv_binary); + return {shader.getInfoLog(), shader.getInfoDebugLog(), + program.getInfoLog(), program.getInfoDebugLog(), + disassembly_stream.str()}; + } else { + return {shader.getInfoLog(), shader.getInfoDebugLog(), + program.getInfoLog(), program.getInfoDebugLog(), ""}; + } + } + + void loadFileCompileAndCheck(const std::string& testDir, + const std::string& testName, + Semantics semantics, Target target) + { + const std::string inputFname = testDir + "/" + testName; + const std::string expectedOutputFname = + testDir + "/baseResults/" + testName + ".out"; + std::string input, expectedOutput; + + tryLoadFile(inputFname, "input", &input); + tryLoadFile(expectedOutputFname, "expected output", &expectedOutput); + + GlslangResult result = + compileGlsl(input, GetSuffix(testName), semantics, target); + + // Generate the hybrid output in the way of glslangValidator. + std::ostringstream stream; + + const auto outputIfNotEmpty = [&stream](const std::string& str) { + if (!str.empty()) stream << str << "\n"; + }; + + stream << testName << "\n"; + outputIfNotEmpty(result.compilationOutput); + outputIfNotEmpty(result.compilationError); + outputIfNotEmpty(result.linkingOutput); + outputIfNotEmpty(result.linkingError); + if (target == Target::Spirv) { + stream + << (result.spirv.empty() + ? "SPIR-V is not generated for failed compile or link\n" + : result.spirv); + } + + checkEqAndUpdateIfRequested(expectedOutput, stream.str(), + expectedOutputFname); + } + + // Preprocesses the given GLSL |source| code. On success, returns true, the + // preprocessed shader, and warning messages. Otherwise, returns false, an + // empty string, and error messages. + std::tuple preprocessGlsl( + const std::string& source) + { + const char* shaderStrings = source.data(); + const int shaderLengths = static_cast(source.size()); + + glslang::TShader shader(EShLangVertex); + shader.setStringsWithLengths(&shaderStrings, &shaderLengths, 1); + std::string ppShader; + glslang::TShader::ForbidInclude includer; + const bool success = shader.preprocess( + &glslang::DefaultTBuiltInResource, defaultVersion, defaultProfile, + forceVersionProfile, isForwardCompatible, EShMsgOnlyPreprocessor, + &ppShader, includer); + + std::string log = shader.getInfoLog(); + log += shader.getInfoDebugLog(); + if (success) { + return std::make_tuple(true, ppShader, log); + } else { + return std::make_tuple(false, "", log); + } + } + + void loadFilePreprocessAndCheck(const std::string& testDir, + const std::string& testName) + { + const std::string inputFname = testDir + "/" + testName; + const std::string expectedOutputFname = + testDir + "/baseResults/" + testName + ".out"; + const std::string expectedErrorFname = + testDir + "/baseResults/" + testName + ".err"; + std::string input, expectedOutput, expectedError; + + tryLoadFile(inputFname, "input", &input); + tryLoadFile(expectedOutputFname, "expected output", &expectedOutput); + tryLoadFile(expectedErrorFname, "expected error", &expectedError); + + bool ppOk; + std::string output, error; + std::tie(ppOk, output, error) = preprocessGlsl(input); + if (!output.empty()) output += '\n'; + if (!error.empty()) error += '\n'; + + checkEqAndUpdateIfRequested(expectedOutput, output, + expectedOutputFname); + checkEqAndUpdateIfRequested(expectedError, error, + expectedErrorFname); + } + +private: + const int defaultVersion; + const EProfile defaultProfile; + const bool forceVersionProfile; + const bool isForwardCompatible; +}; + +} // namespace glslangtest + +#endif // GLSLANG_GTESTS_TEST_FIXTURE_H diff --git a/gtests/main.cpp b/gtests/main.cpp new file mode 100644 index 00000000..b9806aa2 --- /dev/null +++ b/gtests/main.cpp @@ -0,0 +1,63 @@ +// +// Copyright (C) 2016 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 Google Inc. 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 + +#include "Initializer.h" +#include "Settings.h" + +int main(int argc, char** argv) +{ + ::testing::InitGoogleTest(&argc, argv); + + std::unique_ptr initializer( + new glslangtest::GlslangInitializer); + + glslangtest::GlobalTestSettings.initializer = initializer.get(); + + for (int i = 1; i < argc; ++i) { + if (!strncmp("--update-mode", argv[i], 13)) { + glslangtest::GlobalTestSettings.updateMode = true; + break; + } + } + + const int result = RUN_ALL_TESTS(); + + glslangtest::GlobalTestSettings.initializer = nullptr; + + return result; +} From 5c61d8e0f95981359db3353383677773040509ca Mon Sep 17 00:00:00 2001 From: qining Date: Thu, 31 Mar 2016 13:57:28 -0400 Subject: [PATCH 014/140] fix format; remove unnecessary parameters; rename some spec op mode guard class; remove support of float point comparison and composite type comparison; update the tests. --- SPIRV/GlslangToSpv.cpp | 21 ++- SPIRV/SpvBuilder.cpp | 86 +-------- .../spv.specConstantOperations.vert.out | 169 +++++------------- Test/spv.specConstantOperations.vert | 45 +---- 4 files changed, 63 insertions(+), 258 deletions(-) diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index ee48b3c1..9622a775 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -3855,21 +3855,19 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstUnionArray(const glsla } namespace { -class SpecConstOpCodeGenerationSettingGuard{ - public: - SpecConstOpCodeGenerationSettingGuard(spv::Builder* builder, - bool shouldGeneratingForSpecConst) +class SpecConstantOpModeGuard { +public: + SpecConstantOpModeGuard(spv::Builder* builder) : builder_(builder) { previous_flag_ = builder->isInSpecConstCodeGenMode(); - shouldGeneratingForSpecConst ? builder->setToSpecConstCodeGenMode() - : builder->setToNormalCodeGenMode(); + builder->setToSpecConstCodeGenMode(); } - ~SpecConstOpCodeGenerationSettingGuard() { + ~SpecConstantOpModeGuard() { previous_flag_ ? builder_->setToSpecConstCodeGenMode() : builder_->setToNormalCodeGenMode(); } - private: +private: spv::Builder* builder_; bool previous_flag_; }; @@ -3877,7 +3875,8 @@ class SpecConstOpCodeGenerationSettingGuard{ // Create constant ID from const initializer sub tree. spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstSubTree( - glslang::TIntermTyped* subTree) { + glslang::TIntermTyped* subTree) +{ const glslang::TType& glslangType = subTree->getType(); spv::Id typeId = convertGlslangToSpvType(glslangType); bool is_spec_const = subTree->getType().getQualifier().isSpecConstant(); @@ -3909,7 +3908,7 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstSubTree( // Spec constants defined with binary operations and other constants requires // OpSpecConstantOp instruction. - SpecConstOpCodeGenerationSettingGuard set_to_spec_const_mode(&builder, true); + SpecConstantOpModeGuard set_to_spec_const_mode(&builder); bn->traverse(this); return accessChainLoad(bn->getType()); @@ -3920,7 +3919,7 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstSubTree( // Spec constants defined with unary operations and other constants requires // OpSpecConstantOp instruction. - SpecConstOpCodeGenerationSettingGuard set_to_spec_const_mode(&builder, true); + SpecConstantOpModeGuard set_to_spec_const_mode(&builder); un->traverse(this); return accessChainLoad(un->getType()); diff --git a/SPIRV/SpvBuilder.cpp b/SPIRV/SpvBuilder.cpp index 3c0e2f63..4235f273 100644 --- a/SPIRV/SpvBuilder.cpp +++ b/SPIRV/SpvBuilder.cpp @@ -1229,90 +1229,8 @@ Id Builder::createOp(Op opCode, Id typeId, const std::vector& operands) return op->getResultId(); } -Id Builder::createSpecConstantOp(Op opCode, Id typeId, const std::vector& operands, const std::vector& literals) { - switch(opCode) { - // OpCodes that do not need any capababilities. - case OpSConvert: - case OpFConvert: - case OpSNegate: - case OpNot: - case OpIAdd: - case OpISub: - case OpIMul: - case OpUDiv: - case OpSDiv: - case OpUMod: - case OpSRem: - case OpSMod: - case OpShiftRightLogical: - case OpShiftRightArithmetic: - case OpShiftLeftLogical: - case OpBitwiseOr: - case OpBitwiseXor: - case OpBitwiseAnd: - case OpVectorShuffle: - case OpCompositeExtract: - case OpCompositeInsert: - case OpLogicalOr: - case OpLogicalAnd: - case OpLogicalNot: - case OpLogicalEqual: - case OpLogicalNotEqual: - case OpSelect: - case OpIEqual: - case OpULessThan: - case OpSLessThan: - case OpUGreaterThan: - case OpSGreaterThan: - case OpULessThanEqual: - case OpSLessThanEqual: - case OpUGreaterThanEqual: - case OpSGreaterThanEqual: - // Added temporarily to enable compsite type spec constants comparison. - // Remove this comment after Spec being updated. - case OpAll: - case OpAny: - case OpFOrdEqual: - case OpFUnordEqual: - case OpFOrdNotEqual: - case OpFUnordNotEqual: - break; - - // OpCodes that need Shader capability. - case OpQuantizeToF16: - addCapability(CapabilityShader); - break; - - // OpCodes that need Kernel capability. - case OpConvertFToS: - case OpConvertSToF: - case OpConvertFToU: - case OpConvertUToF: - case OpUConvert: - case OpConvertPtrToU: - case OpConvertUToPtr: - case OpGenericCastToPtr: - case OpPtrCastToGeneric: - case OpBitcast: - case OpFNegate: - case OpFAdd: - case OpFSub: - case OpFMul: - case OpFDiv: - case OpFRem: - case OpFMod: - case OpAccessChain: - case OpInBoundsAccessChain: - case OpPtrAccessChain: - case OpInBoundsPtrAccessChain: - addCapability(CapabilityKernel); - break; - - default: - // Invalid OpCode for Spec Constant operations. - return NoResult; - } - +Id Builder::createSpecConstantOp(Op opCode, Id typeId, const std::vector& operands, const std::vector& literals) +{ Instruction* op = new Instruction(getUniqueId(), typeId, OpSpecConstantOp); op->addImmediateOperand((unsigned) opCode); for (auto it = operands.cbegin(); it != operands.cend(); ++it) diff --git a/Test/baseResults/spv.specConstantOperations.vert.out b/Test/baseResults/spv.specConstantOperations.vert.out index c3eaedd5..476efc90 100644 --- a/Test/baseResults/spv.specConstantOperations.vert.out +++ b/Test/baseResults/spv.specConstantOperations.vert.out @@ -7,21 +7,15 @@ Linked vertex stage: // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 163 +// Id's are bound by 94 Capability Shader - Capability Kernel Capability Float64 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 EntryPoint Vertex 4 "main" Source GLSL 450 Name 4 "main" - Name 108 "int_float_double_vec2" - MemberName 108(int_float_double_vec2) 0 "i" - MemberName 108(int_float_double_vec2) 1 "f" - MemberName 108(int_float_double_vec2) 2 "d" - MemberName 108(int_float_double_vec2) 3 "v" Decorate 7 SpecId 200 Decorate 9 SpecId 201 Decorate 11 SpecId 202 @@ -70,121 +64,52 @@ Linked vertex stage: 45: 8(int) SpecConstantOp 197 12 44 46: 10(int) Constant 512 47: 10(int) SpecConstantOp 198 11 46 - 48: 8(int) SpecConstantOp 124 11 - 49: 8(int) SpecConstantOp 199 12 48 - 50: TypeBool - 51: 50(bool) SpecConstantOp 177 9 12 - 52: 10(int) SpecConstantOp 124 12 - 53: 50(bool) SpecConstantOp 176 11 52 - 54: 10(int) SpecConstantOp 124 12 - 55: 50(bool) SpecConstantOp 176 54 11 - 56: TypeVector 8(int) 4 - 57: 8(int) Constant 30 - 58: 56(ivec4) SpecConstantComposite 39 57 9 9 - 59: TypeVector 10(int) 4 - 60: 10(int) Constant 4294967295 - 61: 10(int) Constant 4294967294 - 62: 59(ivec4) SpecConstantComposite 11 11 60 61 - 63: TypeVector 6(float) 4 - 64: 6(float) Constant 1067450368 - 65: 63(fvec4) SpecConstantComposite 7 64 7 64 - 66: TypeVector 13(float) 4 - 67: 66(fvec4) SpecConstantOp 115 65 - 68: 63(fvec4) SpecConstantOp 115 67 - 69: 56(ivec4) SpecConstantOp 200 58 - 70: 63(fvec4) SpecConstantOp 111 69 - 71: 56(ivec4) SpecConstantOp 126 58 - 72: 56(ivec4) ConstantComposite 18 18 18 18 - 73: 56(ivec4) SpecConstantOp 128 58 72 - 74: 56(ivec4) SpecConstantOp 128 58 72 - 75: 56(ivec4) ConstantComposite 21 21 21 21 - 76: 56(ivec4) SpecConstantOp 130 74 75 - 77: 56(ivec4) ConstantComposite 23 23 23 23 - 78: 56(ivec4) SpecConstantOp 130 76 77 - 79: 56(ivec4) SpecConstantOp 132 58 72 - 80: 56(ivec4) ConstantComposite 28 28 28 28 - 81: 56(ivec4) SpecConstantOp 135 79 80 - 82: 56(ivec4) SpecConstantOp 139 58 77 - 83: 56(ivec4) ConstantComposite 37 37 37 37 - 84: 56(ivec4) SpecConstantOp 195 58 83 - 85: 56(ivec4) SpecConstantOp 196 58 72 - 86: 8(int) Constant 1024 - 87: 56(ivec4) ConstantComposite 86 86 86 86 - 88: 56(ivec4) SpecConstantOp 197 58 87 - 89: 10(int) Constant 2048 - 90: 59(ivec4) ConstantComposite 89 89 89 89 - 91: 59(ivec4) SpecConstantOp 198 62 90 - 92: 56(ivec4) SpecConstantOp 124 62 - 93: 56(ivec4) SpecConstantOp 199 58 92 - 94: 10(int) Constant 0 - 95: 8(int) SpecConstantOp 81 58 0 - 96: TypeVector 8(int) 2 - 97: 96(ivec2) SpecConstantOp 79 58 58 1(GLSL.std.450) 0 - 98: TypeVector 8(int) 3 - 99: 98(ivec3) SpecConstantOp 79 58 58 2 1(GLSL.std.450) 0 - 100: 56(ivec4) SpecConstantOp 79 58 58 1(GLSL.std.450) 2 0 3 - 101: 59(ivec4) SpecConstantOp 124 58 - 102: TypeVector 50(bool) 4 - 103: 102(bvec4) SpecConstantOp 170 101 62 - 104: 50(bool) SpecConstantOp 155 103 - 105: 59(ivec4) SpecConstantOp 124 58 - 106: 50(bool) SpecConstantOp 154 0 - 107: TypeVector 6(float) 2 -108(int_float_double_vec2): TypeStruct 8(int) 6(float) 13(float) 107(fvec2) - 109: 6(float) Constant 1065353216 - 110: 107(fvec2) SpecConstantComposite 15 109 - 111:108(int_float_double_vec2) SpecConstantComposite 9 7 14 110 - 112: 107(fvec2) SpecConstantComposite 15 109 - 113:108(int_float_double_vec2) SpecConstantComposite 9 7 14 112 - 114: 8(int) SpecConstantOp 81 111 0 - 115: 8(int) SpecConstantOp 81 113 0 - 116: 50(bool) SpecConstantOp 170 114 115 - 117: 6(float) SpecConstantOp 81 111 1(GLSL.std.450) - 118: 6(float) SpecConstantOp 81 113 1(GLSL.std.450) - 119: 50(bool) SpecConstantOp 180 117 118 - 120: 50(bool) SpecConstantOp 167 116 119 - 121: 13(float) SpecConstantOp 81 111 2 - 122: 13(float) SpecConstantOp 81 113 2 - 123: 50(bool) SpecConstantOp 180 121 122 - 124: 50(bool) SpecConstantOp 167 120 123 - 125: 107(fvec2) SpecConstantOp 81 111 3 - 126: 107(fvec2) SpecConstantOp 81 113 3 - 127: TypeVector 50(bool) 2 - 128: 127(bvec2) SpecConstantOp 180 125 126 - 129: 50(bool) SpecConstantOp 155 128 - 130: 50(bool) SpecConstantOp 167 124 129 - 131: 8(int) SpecConstantOp 81 111 0 - 132: 8(int) SpecConstantOp 81 113 0 - 133: 6(float) SpecConstantOp 81 111 1(GLSL.std.450) - 134: 6(float) SpecConstantOp 81 113 1(GLSL.std.450) - 135: 50(bool) SpecConstantOp 182 133 134 - 136: 50(bool) SpecConstantOp 166 0 135 - 137: 13(float) SpecConstantOp 81 111 2 - 138: 13(float) SpecConstantOp 81 113 2 - 139: 50(bool) SpecConstantOp 182 137 138 - 140: 50(bool) SpecConstantOp 166 136 139 - 141: 107(fvec2) SpecConstantOp 81 111 3 - 142: 107(fvec2) SpecConstantOp 81 113 3 - 143: 127(bvec2) SpecConstantOp 182 141 142 - 144: 50(bool) SpecConstantOp 154 143 - 145: 50(bool) SpecConstantOp 166 140 144 - 146: TypeArray 6(float) 26 - 147: 146 SpecConstantComposite 7 7 - 148: 146 SpecConstantComposite 7 7 - 149: 6(float) SpecConstantOp 81 147 0 - 150: 6(float) SpecConstantOp 81 148 0 - 151: 50(bool) SpecConstantOp 180 149 150 - 152: 6(float) SpecConstantOp 81 147 1(GLSL.std.450) - 153: 6(float) SpecConstantOp 81 148 1(GLSL.std.450) - 154: 50(bool) SpecConstantOp 180 152 153 - 155: 50(bool) SpecConstantOp 167 151 154 - 156: 6(float) SpecConstantOp 81 147 0 - 157: 6(float) SpecConstantOp 81 148 0 - 158: 50(bool) SpecConstantOp 182 156 157 - 159: 6(float) SpecConstantOp 81 147 1(GLSL.std.450) - 160: 6(float) SpecConstantOp 81 148 1(GLSL.std.450) - 161: 50(bool) SpecConstantOp 182 159 160 - 162: 50(bool) SpecConstantOp 166 158 161 + 48: TypeBool + 49: 48(bool) SpecConstantOp 177 9 12 + 50: 48(bool) SpecConstantOp 170 11 11 + 51: 48(bool) SpecConstantOp 173 9 12 + 52: TypeVector 8(int) 4 + 53: 8(int) Constant 30 + 54: 52(ivec4) SpecConstantComposite 39 53 9 9 + 55: TypeVector 10(int) 4 + 56: 10(int) Constant 4294967295 + 57: 10(int) Constant 4294967294 + 58: 55(ivec4) SpecConstantComposite 11 11 56 57 + 59: TypeVector 6(float) 4 + 60: 6(float) Constant 1067450368 + 61: 59(fvec4) SpecConstantComposite 7 60 7 60 + 62: TypeVector 13(float) 4 + 63: 62(fvec4) SpecConstantOp 115 61 + 64: 59(fvec4) SpecConstantOp 115 63 + 65: 52(ivec4) SpecConstantOp 200 54 + 66: 52(ivec4) SpecConstantOp 126 54 + 67: 52(ivec4) ConstantComposite 18 18 18 18 + 68: 52(ivec4) SpecConstantOp 128 54 67 + 69: 52(ivec4) SpecConstantOp 128 54 67 + 70: 52(ivec4) ConstantComposite 21 21 21 21 + 71: 52(ivec4) SpecConstantOp 130 69 70 + 72: 52(ivec4) ConstantComposite 23 23 23 23 + 73: 52(ivec4) SpecConstantOp 130 71 72 + 74: 52(ivec4) SpecConstantOp 132 54 67 + 75: 52(ivec4) ConstantComposite 28 28 28 28 + 76: 52(ivec4) SpecConstantOp 135 74 75 + 77: 52(ivec4) SpecConstantOp 139 54 72 + 78: 52(ivec4) ConstantComposite 37 37 37 37 + 79: 52(ivec4) SpecConstantOp 195 54 78 + 80: 52(ivec4) SpecConstantOp 196 54 67 + 81: 8(int) Constant 1024 + 82: 52(ivec4) ConstantComposite 81 81 81 81 + 83: 52(ivec4) SpecConstantOp 197 54 82 + 84: 10(int) Constant 2048 + 85: 55(ivec4) ConstantComposite 84 84 84 84 + 86: 55(ivec4) SpecConstantOp 198 58 85 + 87: 10(int) Constant 0 + 88: 8(int) SpecConstantOp 81 54 0 + 89: TypeVector 8(int) 2 + 90: 89(ivec2) SpecConstantOp 79 54 54 1(GLSL.std.450) 0 + 91: TypeVector 8(int) 3 + 92: 91(ivec3) SpecConstantOp 79 54 54 2 1(GLSL.std.450) 0 + 93: 52(ivec4) SpecConstantOp 79 54 54 1(GLSL.std.450) 2 0 3 4(main): 2 Function None 3 5: Label Return diff --git a/Test/spv.specConstantOperations.vert b/Test/spv.specConstantOperations.vert index 93588bf8..9de96aee 100644 --- a/Test/spv.specConstantOperations.vert +++ b/Test/spv.specConstantOperations.vert @@ -41,12 +41,11 @@ const uint sp_uint_shift_left = sp_uint << 2; // Bitwise And, Or, Xor const int sp_sint_or_256 = sp_sint | 0x100; const uint sp_uint_xor_512 = sp_uint ^ 0x200; -const int sp_sint_and_sp_uint = sp_sint & int(sp_uint); -// Scalar comparison +/* // Scalar comparison */ const bool sp_int_lt_sp_sint = sp_int < sp_sint; -const bool sp_uint_lt_sp_sint = sp_uint < sp_sint; -const bool sp_sint_lt_sp_uint = sp_sint < sp_uint; +const bool sp_uint_equal_sp_uint = sp_uint == sp_uint; +const bool sp_int_gt_sp_sint = sp_int > sp_sint; // // Vectors @@ -60,7 +59,7 @@ const dvec4 fv_to_dv = dvec4(fv); const vec4 dv_to_fv = vec4(fv_to_dv); // Negate and Not -const vec4 not_iv = ~iv; +const ivec4 not_iv = ~iv; const ivec4 negate_iv = -iv; // Add and Subtract @@ -80,7 +79,6 @@ const ivec4 iv_shift_left = iv << 2; // Bitwise And, Or, Xor const ivec4 iv_or_1024 = iv | 0x400; const uvec4 uv_xor_2048 = uv ^ 0x800; -const ivec4 iv_and_uv = iv & ivec4(uv); // Swizzles const int iv_x = iv.x; @@ -88,40 +86,5 @@ const ivec2 iv_yx = iv.yx; const ivec3 iv_zyx = iv.zyx; const ivec4 iv_yzxw = iv.yzxw; -// Vector comparison, only == and != are supported and allowd. -const bool iv_equal_uv = iv == uv; -const bool iv_not_equal_uv = iv != uv; - -// -// Composite types other than vectors -// - -// Struct -struct int_float_double_vec2 { - int i; - float f; - double d; - vec2 v; -}; - -const int_float_double_vec2 sp_struct_a = { - sp_int, sp_float, float_to_double, - vec2(double_to_float, 1.0) -}; - -const int_float_double_vec2 sp_struct_b = { - sp_int, sp_float, float_to_double, - vec2(double_to_float, 1.0) -}; - -const bool struct_a_equal_struct_b = sp_struct_a == sp_struct_b; -const bool struct_a_not_equal_struct_b = sp_struct_a != sp_struct_b; - -// Array -const float array_a[2] = {sp_float, sp_float}; -const float array_b[2] = {sp_float, sp_float}; -const bool array_a_equal_array_b = array_a == array_b; -const bool array_a_not_equal_array_b = array_a != array_b; - void main() {} From 0dfbe3f90d35e298b0160a16656eb69fa8023ca2 Mon Sep 17 00:00:00 2001 From: baldurk Date: Sat, 2 Apr 2016 13:38:28 +0200 Subject: [PATCH 015/140] Change {parameter} lists into explicit std::vector temporaries --- SPIRV/SpvBuilder.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/SPIRV/SpvBuilder.cpp b/SPIRV/SpvBuilder.cpp index 4235f273..9437c9e4 100644 --- a/SPIRV/SpvBuilder.cpp +++ b/SPIRV/SpvBuilder.cpp @@ -1067,7 +1067,7 @@ Id Builder::createCompositeExtract(Id composite, Id typeId, unsigned index) // Generate code for spec constants if in spec constant operation // generation mode. if (generatingOpCodeForSpecConst) { - return createSpecConstantOp(OpCompositeExtract, typeId, {composite}, {index}); + return createSpecConstantOp(OpCompositeExtract, typeId, std::vector(1, composite), std::vector(1, index)); } Instruction* extract = new Instruction(getUniqueId(), typeId, OpCompositeExtract); extract->addIdOperand(composite); @@ -1082,7 +1082,7 @@ Id Builder::createCompositeExtract(Id composite, Id typeId, std::vector(1, composite), indexes); } Instruction* extract = new Instruction(getUniqueId(), typeId, OpCompositeExtract); extract->addIdOperand(composite); @@ -1184,7 +1184,7 @@ Id Builder::createUnaryOp(Op opCode, Id typeId, Id operand) // Generate code for spec constants if in spec constant operation // generation mode. if (generatingOpCodeForSpecConst) { - return createSpecConstantOp(opCode, typeId, {operand}, {}); + return createSpecConstantOp(opCode, typeId, std::vector(1, operand), std::vector()); } Instruction* op = new Instruction(getUniqueId(), typeId, opCode); op->addIdOperand(operand); @@ -1198,7 +1198,9 @@ Id Builder::createBinOp(Op opCode, Id typeId, Id left, Id right) // Generate code for spec constants if in spec constant operation // generation mode. if (generatingOpCodeForSpecConst) { - return createSpecConstantOp(opCode, typeId, {left, right}, {}); + std::vector operands(2); + operands[0] = left; operands[1] = right; + return createSpecConstantOp(opCode, typeId, operands, std::vector()); } Instruction* op = new Instruction(getUniqueId(), typeId, opCode); op->addIdOperand(left); @@ -1261,7 +1263,9 @@ Id Builder::createRvalueSwizzle(Decoration precision, Id typeId, Id source, std: return setPrecision(createCompositeExtract(source, typeId, channels.front()), precision); if (generatingOpCodeForSpecConst) { - return setPrecision(createSpecConstantOp(OpVectorShuffle, typeId, {source, source}, channels), precision); + std::vector operands(2); + operands[0] = operands[1] = source; + return setPrecision(createSpecConstantOp(OpVectorShuffle, typeId, operands, channels), precision); } Instruction* swizzle = new Instruction(getUniqueId(), typeId, OpVectorShuffle); assert(isVector(source)); From bd9f8351f4fafd16fbe26f07e5150f18460f05ca Mon Sep 17 00:00:00 2001 From: baldurk Date: Sat, 2 Apr 2016 13:38:42 +0200 Subject: [PATCH 016/140] Specify explicit return type on lambda function --- SPIRV/SpvBuilder.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SPIRV/SpvBuilder.cpp b/SPIRV/SpvBuilder.cpp index 9437c9e4..dda6bb09 100644 --- a/SPIRV/SpvBuilder.cpp +++ b/SPIRV/SpvBuilder.cpp @@ -2213,7 +2213,7 @@ void Builder::eliminateDeadDecorations() { } } decorations.erase(std::remove_if(decorations.begin(), decorations.end(), - [&unreachable_definitions](std::unique_ptr& I) { + [&unreachable_definitions](std::unique_ptr& I) -> bool { Instruction* inst = I.get(); Id decoration_id = inst->getIdOperand(0); return unreachable_definitions.count(decoration_id) != 0; From f0bcb0aaf4287ce5170886e71b75c7c18ce4f398 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Sat, 2 Apr 2016 13:09:14 -0600 Subject: [PATCH 017/140] Comment: fix comment from gtest check in. --- StandAlone/StandAlone.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/StandAlone/StandAlone.cpp b/StandAlone/StandAlone.cpp index e8ab7b56..94eceaff 100644 --- a/StandAlone/StandAlone.cpp +++ b/StandAlone/StandAlone.cpp @@ -112,7 +112,7 @@ TBuiltInResource Resources; std::string ConfigFile; // -// Parse either a .conf file provided by the user or the default string above. +// Parse either a .conf file provided by the user or the default from glslang::DefaultTBuiltInResource // void ProcessConfigFile() { From 6a6d6dda956332b3a8f16b1feebdcf4c19fac8b3 Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Sun, 3 Apr 2016 01:17:13 +0100 Subject: [PATCH 018/140] fix spelling mistakes --- CMakeLists.txt | 2 +- README.md | 4 ++-- SPIRV/SPVRemapper.cpp | 2 +- SPIRV/SpvBuilder.cpp | 2 +- glslang/Include/InfoSink.h | 2 +- glslang/Include/PoolAlloc.h | 6 +++--- glslang/OSDependent/Unix/ossource.cpp | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ac756f55..12655f78 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ elseif(UNIX) add_definitions(-fPIC) add_definitions(-DGLSLANG_OSINCLUDE_UNIX) else(WIN32) - message("unkown platform") + message("unknown platform") endif(WIN32) if(CMAKE_COMPILER_IS_GNUCXX) diff --git a/README.md b/README.md index 77508774..56bdeec9 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ class TProgram See `ShaderLang.h` and the usage of it in `StandAlone/StandAlone.cpp` for more details. -### C Functional Interface (orginal) +### C Functional Interface (orignal) This interface is in roughly the first 2/3 of `ShaderLang.h`, and referred to as the `Sh*()` interface, as all the entry points start `Sh`. @@ -118,7 +118,7 @@ ShCompile(shader, compiler) -> compiler(AST) -> ``` In practice, `ShCompile()` takes shader strings, default version, and -warning/error and other options for controling compilation. +warning/error and other options for controlling compilation. Testing ------- diff --git a/SPIRV/SPVRemapper.cpp b/SPIRV/SPVRemapper.cpp index 965867ef..35dda17b 100755 --- a/SPIRV/SPVRemapper.cpp +++ b/SPIRV/SPVRemapper.cpp @@ -573,7 +573,7 @@ namespace spv { op_fn_nop); // Window size for context-sensitive canonicalization values - // Emperical best size from a single data set. TODO: Would be a good tunable. + // Empirical best size from a single data set. TODO: Would be a good tunable. // We essentially perform a little convolution around each instruction, // to capture the flavor of nearby code, to hopefully match to similar // code in other modules. diff --git a/SPIRV/SpvBuilder.cpp b/SPIRV/SpvBuilder.cpp index 4235f273..e347fe38 100644 --- a/SPIRV/SpvBuilder.cpp +++ b/SPIRV/SpvBuilder.cpp @@ -2319,7 +2319,7 @@ void Builder::simplifyAccessChainSwizzle() // To the extent any swizzling can become part of the chain // of accesses instead of a post operation, make it so. -// If 'dynamic' is true, include transfering a non-static component index, +// If 'dynamic' is true, include transferring a non-static component index, // otherwise, only transfer static indexes. // // Also, Boolean vectors are likely to be special. While diff --git a/glslang/Include/InfoSink.h b/glslang/Include/InfoSink.h index a321ebcc..5862e5d8 100644 --- a/glslang/Include/InfoSink.h +++ b/glslang/Include/InfoSink.h @@ -92,7 +92,7 @@ public: case EPrefixInternalError: append("INTERNAL ERROR: "); break; case EPrefixUnimplemented: append("UNIMPLEMENTED: "); break; case EPrefixNote: append("NOTE: "); break; - default: append("UNKOWN ERROR: "); break; + default: append("UNKNOWN ERROR: "); break; } } void location(const TSourceLoc& loc) { diff --git a/glslang/Include/PoolAlloc.h b/glslang/Include/PoolAlloc.h index de41053f..c3bebc63 100644 --- a/glslang/Include/PoolAlloc.h +++ b/glslang/Include/PoolAlloc.h @@ -95,7 +95,7 @@ public: void checkAllocList() const; - // Return total size needed to accomodate user buffer of 'size', + // Return total size needed to accommodate user buffer of 'size', // plus our tracking data. inline static size_t allocationSize(size_t size) { return size + 2 * guardBlockSize + headerSize(); @@ -241,8 +241,8 @@ protected: int numCalls; // just an interesting statistic size_t totalBytes; // just an interesting statistic private: - TPoolAllocator& operator=(const TPoolAllocator&); // dont allow assignment operator - TPoolAllocator(const TPoolAllocator&); // dont allow default copy constructor + TPoolAllocator& operator=(const TPoolAllocator&); // don't allow assignment operator + TPoolAllocator(const TPoolAllocator&); // don't allow default copy constructor }; diff --git a/glslang/OSDependent/Unix/ossource.cpp b/glslang/OSDependent/Unix/ossource.cpp index 5ce882ab..3bd725ea 100644 --- a/glslang/OSDependent/Unix/ossource.cpp +++ b/glslang/OSDependent/Unix/ossource.cpp @@ -61,7 +61,7 @@ static void DetachThreadLinux(void *) // -// Registers cleanup handler, sets cancel type and state, and excecutes the thread specific +// Registers cleanup handler, sets cancel type and state, and executes the thread specific // cleanup handler. This function will be called in the Standalone.cpp for regression // testing. When OpenGL applications are run with the driver code, Linux OS does the // thread cleanup. From 4f4bb81cd9ad9275eb8fce15baa8538d1ad2c685 Mon Sep 17 00:00:00 2001 From: qining Date: Sun, 3 Apr 2016 23:55:17 -0400 Subject: [PATCH 019/140] Built-in values declared as specialization constant Support declaring built-in values as spec constants. Refine the code in createSpvConstant(). --- SPIRV/GlslangToSpv.cpp | 51 +++--- Test/baseResults/spv.specConstant.vert.out | 187 +++++++++++---------- Test/spv.specConstant.vert | 8 + glslang/MachineIndependent/ParseHelper.cpp | 4 + 4 files changed, 140 insertions(+), 110 deletions(-) diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 9622a775..205e9247 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -3735,6 +3735,7 @@ spv::Id TGlslangToSpvTraverser::createSpvConstant(const glslang::TIntermTyped& n { assert(node.getQualifier().isConstant()); + // Handle front-end constants first (non-specialization constants). if (! node.getQualifier().specConstant) { // hand off to the non-spec-constant path assert(node.getAsConstantUnion() != nullptr || node.getAsSymbolNode() != nullptr); @@ -3745,31 +3746,35 @@ spv::Id TGlslangToSpvTraverser::createSpvConstant(const glslang::TIntermTyped& n // We now know we have a specialization constant to build - if (node.getAsSymbolNode() && node.getQualifier().hasSpecConstantId()) { - // this is a direct literal assigned to a layout(constant_id=) declaration - int nextConst = 0; - return createSpvConstantFromConstUnionArray(node.getType(), node.getAsConstantUnion() ? node.getAsConstantUnion()->getConstArray() : node.getAsSymbolNode()->getConstArray(), - nextConst, true); - } else { - // 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) { - std::vector dimConstId; - for (int dim = 0; dim < 3; ++dim) { - bool specConst = (glslangIntermediate->getLocalSizeSpecId(dim) != glslang::TQualifier::layoutNotSet); - dimConstId.push_back(builder.makeUintConstant(glslangIntermediate->getLocalSize(dim), specConst)); - if (specConst) - addDecoration(dimConstId.back(), spv::DecorationSpecId, glslangIntermediate->getLocalSizeSpecId(dim)); - } - return builder.makeCompositeConstant(builder.makeVectorType(builder.makeUintType(32), 3), dimConstId, true); - } else if (auto* sn = node.getAsSymbolNode()){ - return createSpvConstantFromConstSubTree(sn->getConstSubtree()); - } else { - spv::MissingFunctionality("Neither a front-end constant nor a spec constant."); - exit(1); - return spv::NoResult; + // 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) { + std::vector dimConstId; + for (int dim = 0; dim < 3; ++dim) { + bool specConst = (glslangIntermediate->getLocalSizeSpecId(dim) != glslang::TQualifier::layoutNotSet); + dimConstId.push_back(builder.makeUintConstant(glslangIntermediate->getLocalSize(dim), specConst)); + if (specConst) + addDecoration(dimConstId.back(), spv::DecorationSpecId, glslangIntermediate->getLocalSizeSpecId(dim)); + } + return builder.makeCompositeConstant(builder.makeVectorType(builder.makeUintType(32), 3), dimConstId, true); + } + + // 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. + if (auto* sn = node.getAsSymbolNode()) { + if (auto* sub_tree = sn->getConstSubtree()) { + return createSpvConstantFromConstSubTree(sub_tree); + } else if (auto* const_union_array = &sn->getConstArray()){ + int nextConst = 0; + return createSpvConstantFromConstUnionArray(sn->getType(), *const_union_array, nextConst, true); } } + + // Neither a front-end constant node, nor a specialization constant node with constant union array or + // constant sub tree as initializer. + spv::MissingFunctionality("Neither a front-end constant nor a spec constant."); + exit(1); + return spv::NoResult; } // Use 'consts' as the flattened glslang source of scalar constants to recursively diff --git a/Test/baseResults/spv.specConstant.vert.out b/Test/baseResults/spv.specConstant.vert.out index 862dc19a..dadab07c 100644 --- a/Test/baseResults/spv.specConstant.vert.out +++ b/Test/baseResults/spv.specConstant.vert.out @@ -7,32 +7,35 @@ Linked vertex stage: // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 72 +// Id's are bound by 81 Capability Shader Capability Float64 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Vertex 4 "main" 17 19 25 50 + EntryPoint Vertex 4 "main" 20 22 28 53 Source GLSL 400 Name 4 "main" Name 14 "foo(vf4[s1498];" Name 13 "p" - Name 17 "color" - Name 19 "ucol" - Name 25 "size" - Name 44 "param" - Name 50 "dupUcol" + Name 17 "builtin_spec_constant(" + Name 20 "color" + Name 22 "ucol" + Name 28 "size" + Name 47 "param" + Name 53 "dupUcol" + Name 76 "result" Decorate 9 SpecId 16 - Decorate 27 SpecId 17 - Decorate 31 SpecId 22 - Decorate 36 SpecId 19 - Decorate 37 SpecId 18 - Decorate 47 SpecId 116 - Decorate 57 SpecId 117 - Decorate 60 SpecId 122 - Decorate 64 SpecId 119 - Decorate 65 SpecId 118 + Decorate 30 SpecId 17 + Decorate 34 SpecId 22 + Decorate 39 SpecId 19 + Decorate 40 SpecId 18 + Decorate 50 SpecId 116 + Decorate 60 SpecId 117 + Decorate 63 SpecId 122 + Decorate 67 SpecId 119 + Decorate 68 SpecId 118 + Decorate 77 SpecId 24 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -42,83 +45,93 @@ Linked vertex stage: 10: TypeArray 7(fvec4) 9 11: TypePointer Function 10 12: TypeFunction 2 11(ptr) - 16: TypePointer Output 7(fvec4) - 17(color): 16(ptr) Variable Output - 18: TypePointer Input 10 - 19(ucol): 18(ptr) Variable Input - 20: 8(int) Constant 2 - 21: TypePointer Input 7(fvec4) - 24: TypePointer Output 8(int) - 25(size): 24(ptr) Variable Output - 26: TypeBool - 27: 26(bool) SpecConstantTrue - 30: TypeInt 32 0 - 31: 30(int) SpecConstant 2 - 35: TypeFloat 64 - 36: 35(float) SpecConstant 1413754136 1074340347 - 37: 6(float) SpecConstant 1078523331 - 47: 8(int) SpecConstant 12 - 48: TypeArray 7(fvec4) 47 - 49: TypePointer Input 48 - 50(dupUcol): 49(ptr) Variable Input - 57: 26(bool) SpecConstantTrue - 60: 30(int) SpecConstant 2 - 64: 35(float) SpecConstant 1413754136 1074340347 - 65: 6(float) SpecConstant 1078523331 + 16: TypeFunction 8(int) + 19: TypePointer Output 7(fvec4) + 20(color): 19(ptr) Variable Output + 21: TypePointer Input 10 + 22(ucol): 21(ptr) Variable Input + 23: 8(int) Constant 2 + 24: TypePointer Input 7(fvec4) + 27: TypePointer Output 8(int) + 28(size): 27(ptr) Variable Output + 29: TypeBool + 30: 29(bool) SpecConstantTrue + 33: TypeInt 32 0 + 34: 33(int) SpecConstant 2 + 38: TypeFloat 64 + 39: 38(float) SpecConstant 1413754136 1074340347 + 40: 6(float) SpecConstant 1078523331 + 50: 8(int) SpecConstant 12 + 51: TypeArray 7(fvec4) 50 + 52: TypePointer Input 51 + 53(dupUcol): 52(ptr) Variable Input + 60: 29(bool) SpecConstantTrue + 63: 33(int) SpecConstant 2 + 67: 38(float) SpecConstant 1413754136 1074340347 + 68: 6(float) SpecConstant 1078523331 + 75: TypePointer Function 8(int) + 77: 8(int) SpecConstant 8 4(main): 2 Function None 3 5: Label - 44(param): 11(ptr) Variable Function - 22: 21(ptr) AccessChain 19(ucol) 20 - 23: 7(fvec4) Load 22 - Store 17(color) 23 - Store 25(size) 9 - SelectionMerge 29 None - BranchConditional 27 28 29 - 28: Label - 32: 6(float) ConvertUToF 31 - 33: 7(fvec4) Load 17(color) - 34: 7(fvec4) VectorTimesScalar 33 32 - Store 17(color) 34 - Branch 29 - 29: Label - 38: 35(float) FConvert 37 - 39: 35(float) FDiv 36 38 - 40: 6(float) FConvert 39 - 41: 7(fvec4) Load 17(color) - 42: 7(fvec4) CompositeConstruct 40 40 40 40 - 43: 7(fvec4) FAdd 41 42 - Store 17(color) 43 - 45: 10 Load 19(ucol) - Store 44(param) 45 - 46: 2 FunctionCall 14(foo(vf4[s1498];) 44(param) + 47(param): 11(ptr) Variable Function + 25: 24(ptr) AccessChain 22(ucol) 23 + 26: 7(fvec4) Load 25 + Store 20(color) 26 + Store 28(size) 9 + SelectionMerge 32 None + BranchConditional 30 31 32 + 31: Label + 35: 6(float) ConvertUToF 34 + 36: 7(fvec4) Load 20(color) + 37: 7(fvec4) VectorTimesScalar 36 35 + Store 20(color) 37 + Branch 32 + 32: Label + 41: 38(float) FConvert 40 + 42: 38(float) FDiv 39 41 + 43: 6(float) FConvert 42 + 44: 7(fvec4) Load 20(color) + 45: 7(fvec4) CompositeConstruct 43 43 43 43 + 46: 7(fvec4) FAdd 44 45 + Store 20(color) 46 + 48: 10 Load 22(ucol) + Store 47(param) 48 + 49: 2 FunctionCall 14(foo(vf4[s1498];) 47(param) Return FunctionEnd 14(foo(vf4[s1498];): 2 Function None 12 13(p): 11(ptr) FunctionParameter 15: Label - 51: 21(ptr) AccessChain 50(dupUcol) 20 - 52: 7(fvec4) Load 51 - 53: 7(fvec4) Load 17(color) - 54: 7(fvec4) FAdd 53 52 - Store 17(color) 54 - 55: 8(int) Load 25(size) - 56: 8(int) IAdd 55 47 - Store 25(size) 56 - SelectionMerge 59 None - BranchConditional 57 58 59 - 58: Label - 61: 6(float) ConvertUToF 60 - 62: 7(fvec4) Load 17(color) - 63: 7(fvec4) VectorTimesScalar 62 61 - Store 17(color) 63 - Branch 59 - 59: Label - 66: 35(float) FConvert 65 - 67: 35(float) FDiv 64 66 - 68: 6(float) FConvert 67 - 69: 7(fvec4) Load 17(color) - 70: 7(fvec4) CompositeConstruct 68 68 68 68 - 71: 7(fvec4) FAdd 69 70 - Store 17(color) 71 + 54: 24(ptr) AccessChain 53(dupUcol) 23 + 55: 7(fvec4) Load 54 + 56: 7(fvec4) Load 20(color) + 57: 7(fvec4) FAdd 56 55 + Store 20(color) 57 + 58: 8(int) Load 28(size) + 59: 8(int) IAdd 58 50 + Store 28(size) 59 + SelectionMerge 62 None + BranchConditional 60 61 62 + 61: Label + 64: 6(float) ConvertUToF 63 + 65: 7(fvec4) Load 20(color) + 66: 7(fvec4) VectorTimesScalar 65 64 + Store 20(color) 66 + Branch 62 + 62: Label + 69: 38(float) FConvert 68 + 70: 38(float) FDiv 67 69 + 71: 6(float) FConvert 70 + 72: 7(fvec4) Load 20(color) + 73: 7(fvec4) CompositeConstruct 71 71 71 71 + 74: 7(fvec4) FAdd 72 73 + Store 20(color) 74 Return FunctionEnd +17(builtin_spec_constant(): 8(int) Function None 16 + 18: Label + 76(result): 75(ptr) Variable Function + Store 76(result) 77 + 78: 8(int) Load 76(result) + ReturnValue 78 + FunctionEnd diff --git a/Test/spv.specConstant.vert b/Test/spv.specConstant.vert index 0f9764d4..9813bf5f 100644 --- a/Test/spv.specConstant.vert +++ b/Test/spv.specConstant.vert @@ -8,6 +8,8 @@ layout(constant_id = 18) const float spFloat = 3.14; layout(constant_id = 19) const double spDouble = 3.1415926535897932384626433832795; layout(constant_id = 22) const uint scale = 2; +layout(constant_id = 24) gl_MaxImageUnits; + out vec4 color; out int size; @@ -41,3 +43,9 @@ void foo(vec4 p[arraySize]) color *= dupScale; color += float(spDupDouble / spDupFloat); } + +int builtin_spec_constant() +{ + int result = gl_MaxImageUnits; + return result; +} diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index bb8bdb62..a167d3a6 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -5713,6 +5713,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.specConstant) { + symbol->getWritableType().getQualifier().makeSpecConstant(); + if (qualifier.hasSpecConstantId()) + symbol->getWritableType().getQualifier().layoutSpecConstantId = qualifier.layoutSpecConstantId; } else warn(loc, "unknown requalification", "", ""); } From 4c9126153d1d253f5177da772141aee8a6530ef2 Mon Sep 17 00:00:00 2001 From: qining Date: Fri, 1 Apr 2016 10:35:16 -0400 Subject: [PATCH 020/140] fix the wrong generated code when a non-constant array is declared with its size derived from spec constant operations --- SPIRV/GlslangToSpv.cpp | 39 ++-- .../spv.specConstantOperations.vert.out | 201 ++++++++++-------- Test/spv.specConstantOperations.vert | 5 + 3 files changed, 133 insertions(+), 112 deletions(-) diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 81486ca5..63c3d40e 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -66,6 +66,25 @@ namespace { // or a different instruction sequence to do something gets used). const int GeneratorVersion = 1; +namespace { +class SpecConstantOpModeGuard { +public: + SpecConstantOpModeGuard(spv::Builder* builder) + : builder_(builder) { + previous_flag_ = builder->isInSpecConstCodeGenMode(); + builder->setToSpecConstCodeGenMode(); + } + ~SpecConstantOpModeGuard() { + previous_flag_ ? builder_->setToSpecConstCodeGenMode() + : builder_->setToNormalCodeGenMode(); + } + +private: + spv::Builder* builder_; + bool previous_flag_; +}; +} + // // The main holder of information for translating glslang to SPIR-V. // @@ -1927,6 +1946,7 @@ spv::Id TGlslangToSpvTraverser::makeArraySizeId(const glslang::TArraySizes& arra glslang::TIntermTyped* specNode = arraySizes.getDimNode(dim); if (specNode != nullptr) { builder.clearAccessChain(); + SpecConstantOpModeGuard set_to_spec_const_mode(&builder); specNode->traverse(this); return accessChainLoad(specNode->getAsTyped()->getType()); } @@ -3868,25 +3888,6 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstUnionArray(const glsla return builder.makeCompositeConstant(typeId, spvConsts); } -namespace { -class SpecConstantOpModeGuard { -public: - SpecConstantOpModeGuard(spv::Builder* builder) - : builder_(builder) { - previous_flag_ = builder->isInSpecConstCodeGenMode(); - builder->setToSpecConstCodeGenMode(); - } - ~SpecConstantOpModeGuard() { - previous_flag_ ? builder_->setToSpecConstCodeGenMode() - : builder_->setToNormalCodeGenMode(); - } - -private: - spv::Builder* builder_; - bool previous_flag_; -}; -} - // Create constant ID from const initializer sub tree. spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstSubTree( glslang::TIntermTyped* subTree) diff --git a/Test/baseResults/spv.specConstantOperations.vert.out b/Test/baseResults/spv.specConstantOperations.vert.out index 476efc90..88da0270 100644 --- a/Test/baseResults/spv.specConstantOperations.vert.out +++ b/Test/baseResults/spv.specConstantOperations.vert.out @@ -7,7 +7,7 @@ Linked vertex stage: // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 94 +// Id's are bound by 107 Capability Shader Capability Float64 @@ -16,101 +16,116 @@ Linked vertex stage: EntryPoint Vertex 4 "main" Source GLSL 450 Name 4 "main" - Decorate 7 SpecId 200 - Decorate 9 SpecId 201 - Decorate 11 SpecId 202 - Decorate 12 SpecId 203 + Name 8 "non_const_array_size_from_spec_const(" + Name 15 "array" + Decorate 10 SpecId 201 + Decorate 24 SpecId 200 + Decorate 26 SpecId 202 + Decorate 27 SpecId 203 2: TypeVoid 3: TypeFunction 2 - 6: TypeFloat 32 - 7: 6(float) SpecConstant 1078530010 - 8: TypeInt 32 1 - 9: 8(int) SpecConstant 10 - 10: TypeInt 32 0 - 11: 10(int) SpecConstant 100 - 12: 8(int) SpecConstant 4294967286 - 13: TypeFloat 64 - 14: 13(float) SpecConstantOp 115 7 - 15: 6(float) SpecConstantOp 115 14 - 16: 8(int) SpecConstantOp 126 9 - 17: 8(int) SpecConstantOp 200 9 - 18: 8(int) Constant 2 - 19: 8(int) SpecConstantOp 128 9 18 - 20: 8(int) SpecConstantOp 128 9 18 - 21: 8(int) Constant 3 - 22: 8(int) SpecConstantOp 130 20 21 - 23: 8(int) Constant 4 - 24: 8(int) SpecConstantOp 130 19 23 - 25: 8(int) SpecConstantOp 132 12 18 - 26: 10(int) Constant 2 - 27: 10(int) SpecConstantOp 132 11 26 - 28: 8(int) Constant 5 - 29: 8(int) SpecConstantOp 135 25 28 - 30: 10(int) Constant 5 - 31: 10(int) SpecConstantOp 134 27 30 - 32: 8(int) SpecConstantOp 139 12 23 - 33: 10(int) Constant 4 - 34: 10(int) SpecConstantOp 137 11 33 - 35: 8(int) SpecConstantOp 132 12 21 - 36: 8(int) SpecConstantOp 135 35 28 - 37: 8(int) Constant 10 - 38: 8(int) SpecConstantOp 195 12 37 - 39: 8(int) Constant 20 - 40: 10(int) SpecConstantOp 194 11 39 - 41: 8(int) Constant 1 - 42: 8(int) SpecConstantOp 196 12 41 - 43: 10(int) SpecConstantOp 196 11 18 - 44: 8(int) Constant 256 - 45: 8(int) SpecConstantOp 197 12 44 - 46: 10(int) Constant 512 - 47: 10(int) SpecConstantOp 198 11 46 - 48: TypeBool - 49: 48(bool) SpecConstantOp 177 9 12 - 50: 48(bool) SpecConstantOp 170 11 11 - 51: 48(bool) SpecConstantOp 173 9 12 - 52: TypeVector 8(int) 4 - 53: 8(int) Constant 30 - 54: 52(ivec4) SpecConstantComposite 39 53 9 9 - 55: TypeVector 10(int) 4 - 56: 10(int) Constant 4294967295 - 57: 10(int) Constant 4294967294 - 58: 55(ivec4) SpecConstantComposite 11 11 56 57 - 59: TypeVector 6(float) 4 - 60: 6(float) Constant 1067450368 - 61: 59(fvec4) SpecConstantComposite 7 60 7 60 - 62: TypeVector 13(float) 4 - 63: 62(fvec4) SpecConstantOp 115 61 - 64: 59(fvec4) SpecConstantOp 115 63 - 65: 52(ivec4) SpecConstantOp 200 54 - 66: 52(ivec4) SpecConstantOp 126 54 - 67: 52(ivec4) ConstantComposite 18 18 18 18 - 68: 52(ivec4) SpecConstantOp 128 54 67 - 69: 52(ivec4) SpecConstantOp 128 54 67 - 70: 52(ivec4) ConstantComposite 21 21 21 21 - 71: 52(ivec4) SpecConstantOp 130 69 70 - 72: 52(ivec4) ConstantComposite 23 23 23 23 - 73: 52(ivec4) SpecConstantOp 130 71 72 - 74: 52(ivec4) SpecConstantOp 132 54 67 - 75: 52(ivec4) ConstantComposite 28 28 28 28 - 76: 52(ivec4) SpecConstantOp 135 74 75 - 77: 52(ivec4) SpecConstantOp 139 54 72 - 78: 52(ivec4) ConstantComposite 37 37 37 37 - 79: 52(ivec4) SpecConstantOp 195 54 78 - 80: 52(ivec4) SpecConstantOp 196 54 67 - 81: 8(int) Constant 1024 - 82: 52(ivec4) ConstantComposite 81 81 81 81 - 83: 52(ivec4) SpecConstantOp 197 54 82 - 84: 10(int) Constant 2048 - 85: 55(ivec4) ConstantComposite 84 84 84 84 - 86: 55(ivec4) SpecConstantOp 198 58 85 - 87: 10(int) Constant 0 - 88: 8(int) SpecConstantOp 81 54 0 - 89: TypeVector 8(int) 2 - 90: 89(ivec2) SpecConstantOp 79 54 54 1(GLSL.std.450) 0 - 91: TypeVector 8(int) 3 - 92: 91(ivec3) SpecConstantOp 79 54 54 2 1(GLSL.std.450) 0 - 93: 52(ivec4) SpecConstantOp 79 54 54 1(GLSL.std.450) 2 0 3 + 6: TypeInt 32 1 + 7: TypeFunction 6(int) + 10: 6(int) SpecConstant 10 + 11: 6(int) Constant 2 + 12: 6(int) SpecConstantOp 128 10 11 + 13: TypeArray 6(int) 12 + 14: TypePointer Function 13 + 16: 6(int) Constant 1 + 18: TypePointer Function 6(int) + 23: TypeFloat 32 + 24: 23(float) SpecConstant 1078530010 + 25: TypeInt 32 0 + 26: 25(int) SpecConstant 100 + 27: 6(int) SpecConstant 4294967286 + 28: TypeFloat 64 + 29: 28(float) SpecConstantOp 115 24 + 30: 23(float) SpecConstantOp 115 29 + 31: 6(int) SpecConstantOp 126 10 + 32: 6(int) SpecConstantOp 200 10 + 33: 6(int) SpecConstantOp 128 10 11 + 34: 6(int) SpecConstantOp 128 10 11 + 35: 6(int) Constant 3 + 36: 6(int) SpecConstantOp 130 34 35 + 37: 6(int) Constant 4 + 38: 6(int) SpecConstantOp 130 33 37 + 39: 6(int) SpecConstantOp 132 27 11 + 40: 25(int) Constant 2 + 41: 25(int) SpecConstantOp 132 26 40 + 42: 6(int) Constant 5 + 43: 6(int) SpecConstantOp 135 39 42 + 44: 25(int) Constant 5 + 45: 25(int) SpecConstantOp 134 41 44 + 46: 6(int) SpecConstantOp 139 27 37 + 47: 25(int) Constant 4 + 48: 25(int) SpecConstantOp 137 26 47 + 49: 6(int) SpecConstantOp 132 27 35 + 50: 6(int) SpecConstantOp 135 49 42 + 51: 6(int) Constant 10 + 52: 6(int) SpecConstantOp 195 27 51 + 53: 6(int) Constant 20 + 54: 25(int) SpecConstantOp 194 26 53 + 55: 6(int) SpecConstantOp 196 27 16 + 56: 25(int) SpecConstantOp 196 26 11 + 57: 6(int) Constant 256 + 58: 6(int) SpecConstantOp 197 27 57 + 59: 25(int) Constant 512 + 60: 25(int) SpecConstantOp 198 26 59 + 61: TypeBool + 62: 61(bool) SpecConstantOp 177 10 27 + 63: 61(bool) SpecConstantOp 170 26 26 + 64: 61(bool) SpecConstantOp 173 10 27 + 65: TypeVector 6(int) 4 + 66: 6(int) Constant 30 + 67: 65(ivec4) SpecConstantComposite 53 66 10 10 + 68: TypeVector 25(int) 4 + 69: 25(int) Constant 4294967295 + 70: 25(int) Constant 4294967294 + 71: 68(ivec4) SpecConstantComposite 26 26 69 70 + 72: TypeVector 23(float) 4 + 73: 23(float) Constant 1067450368 + 74: 72(fvec4) SpecConstantComposite 24 73 24 73 + 75: TypeVector 28(float) 4 + 76: 75(fvec4) SpecConstantOp 115 74 + 77: 72(fvec4) SpecConstantOp 115 76 + 78: 65(ivec4) SpecConstantOp 200 67 + 79: 65(ivec4) SpecConstantOp 126 67 + 80: 65(ivec4) ConstantComposite 11 11 11 11 + 81: 65(ivec4) SpecConstantOp 128 67 80 + 82: 65(ivec4) SpecConstantOp 128 67 80 + 83: 65(ivec4) ConstantComposite 35 35 35 35 + 84: 65(ivec4) SpecConstantOp 130 82 83 + 85: 65(ivec4) ConstantComposite 37 37 37 37 + 86: 65(ivec4) SpecConstantOp 130 84 85 + 87: 65(ivec4) SpecConstantOp 132 67 80 + 88: 65(ivec4) ConstantComposite 42 42 42 42 + 89: 65(ivec4) SpecConstantOp 135 87 88 + 90: 65(ivec4) SpecConstantOp 139 67 85 + 91: 65(ivec4) ConstantComposite 51 51 51 51 + 92: 65(ivec4) SpecConstantOp 195 67 91 + 93: 65(ivec4) SpecConstantOp 196 67 80 + 94: 6(int) Constant 1024 + 95: 65(ivec4) ConstantComposite 94 94 94 94 + 96: 65(ivec4) SpecConstantOp 197 67 95 + 97: 25(int) Constant 2048 + 98: 68(ivec4) ConstantComposite 97 97 97 97 + 99: 68(ivec4) SpecConstantOp 198 71 98 + 100: 25(int) Constant 0 + 101: 6(int) SpecConstantOp 81 67 0 + 102: TypeVector 6(int) 2 + 103: 102(ivec2) SpecConstantOp 79 67 67 1(GLSL.std.450) 0 + 104: TypeVector 6(int) 3 + 105: 104(ivec3) SpecConstantOp 79 67 67 2 1(GLSL.std.450) 0 + 106: 65(ivec4) SpecConstantOp 79 67 67 1(GLSL.std.450) 2 0 3 4(main): 2 Function None 3 5: Label Return FunctionEnd +8(non_const_array_size_from_spec_const(): 6(int) Function None 7 + 9: Label + 15(array): 14(ptr) Variable Function + 17: 6(int) IAdd 10 16 + 19: 18(ptr) AccessChain 15(array) 17 + 20: 6(int) Load 19 + ReturnValue 20 + FunctionEnd diff --git a/Test/spv.specConstantOperations.vert b/Test/spv.specConstantOperations.vert index 9de96aee..9311270f 100644 --- a/Test/spv.specConstantOperations.vert +++ b/Test/spv.specConstantOperations.vert @@ -86,5 +86,10 @@ const ivec2 iv_yx = iv.yx; const ivec3 iv_zyx = iv.zyx; const ivec4 iv_yzxw = iv.yzxw; +int non_const_array_size_from_spec_const() { + int array[sp_int + 2]; + return array[sp_int + 1]; +} + void main() {} From 408876600f03c19c50f1201ab8f5f28d2cd8d3fb Mon Sep 17 00:00:00 2001 From: qining Date: Sun, 3 Apr 2016 22:20:42 -0400 Subject: [PATCH 021/140] Turn on SpecConstantOpMode based on node qualifier Move SpecConstantOpModeGuard from makeSpvConstantFromConstSubTree() to visitbinary() and visitunary(). Checking if the visiting node is a spec constants, if so, turn on the SpecConstantOpMode, otherwise, stay in the normal mode. --- SPIRV/GlslangToSpv.cpp | 24 +++++++++---------- Test/baseResults/spv.specConstant.comp.out | 10 ++++---- Test/baseResults/spv.specConstant.vert.out | 16 ++++++------- .../spv.specConstantComposite.vert.out | 4 ++-- .../spv.specConstantOperations.vert.out | 10 ++++---- 5 files changed, 32 insertions(+), 32 deletions(-) diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 63c3d40e..147a4bd0 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -72,12 +72,14 @@ public: SpecConstantOpModeGuard(spv::Builder* builder) : builder_(builder) { previous_flag_ = builder->isInSpecConstCodeGenMode(); - builder->setToSpecConstCodeGenMode(); } ~SpecConstantOpModeGuard() { previous_flag_ ? builder_->setToSpecConstCodeGenMode() : builder_->setToNormalCodeGenMode(); } + void turnOnSpecConstantOpMode() { + builder_->setToSpecConstCodeGenMode(); + } private: spv::Builder* builder_; @@ -813,6 +815,10 @@ void TGlslangToSpvTraverser::visitSymbol(glslang::TIntermSymbol* symbol) bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::TIntermBinary* node) { + SpecConstantOpModeGuard spec_constant_op_mode_setter(&builder); + if (node->getType().getQualifier().isSpecConstant()) + spec_constant_op_mode_setter.turnOnSpecConstantOpMode(); + // First, handle special cases switch (node->getOp()) { case glslang::EOpAssign: @@ -985,6 +991,10 @@ bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::T bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TIntermUnary* node) { + SpecConstantOpModeGuard spec_constant_op_mode_setter(&builder); + if (node->getType().getQualifier().isSpecConstant()) + spec_constant_op_mode_setter.turnOnSpecConstantOpMode(); + spv::Id result = spv::NoResult; // try texturing first @@ -1946,7 +1956,7 @@ spv::Id TGlslangToSpvTraverser::makeArraySizeId(const glslang::TArraySizes& arra glslang::TIntermTyped* specNode = arraySizes.getDimNode(dim); if (specNode != nullptr) { builder.clearAccessChain(); - SpecConstantOpModeGuard set_to_spec_const_mode(&builder); + // SpecConstantOpModeGuard set_to_spec_const_mode(&builder); specNode->traverse(this); return accessChainLoad(specNode->getAsTyped()->getType()); } @@ -3920,22 +3930,12 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstSubTree( } else if (glslang::TIntermBinary* bn = subTree->getAsBinaryNode()) { // Binary operation node, we should generate OpSpecConstantOp // This case should only happen when Specialization Constants are involved. - - // Spec constants defined with binary operations and other constants requires - // OpSpecConstantOp instruction. - SpecConstantOpModeGuard set_to_spec_const_mode(&builder); - bn->traverse(this); return accessChainLoad(bn->getType()); } else if (glslang::TIntermUnary* un = subTree->getAsUnaryNode()) { // Unary operation node, similar to binary operation node, should only // happen when specialization constants are involved. - - // Spec constants defined with unary operations and other constants requires - // OpSpecConstantOp instruction. - SpecConstantOpModeGuard set_to_spec_const_mode(&builder); - un->traverse(this); return accessChainLoad(un->getType()); diff --git a/Test/baseResults/spv.specConstant.comp.out b/Test/baseResults/spv.specConstant.comp.out index d1c9b0a6..2f16f04d 100644 --- a/Test/baseResults/spv.specConstant.comp.out +++ b/Test/baseResults/spv.specConstant.comp.out @@ -39,16 +39,16 @@ Linked compute stage: 15: TypeVector 6(int) 3 16: 15(ivec3) SpecConstantComposite 12 13 14 17: 6(int) Constant 0 + 18: 6(int) SpecConstantOp 81 16 0 19: 6(int) Constant 1 + 20: 6(int) SpecConstantOp 81 16 1(GLSL.std.450) + 21: 6(int) SpecConstantOp 132 18 20 22: 6(int) Constant 2 + 23: 6(int) SpecConstantOp 81 16 2 + 24: 6(int) SpecConstantOp 132 21 23 25: TypePointer Uniform 6(int) 4(main): 2 Function None 3 5: Label - 18: 6(int) CompositeExtract 16 0 - 20: 6(int) CompositeExtract 16 1 - 21: 6(int) IMul 18 20 - 23: 6(int) CompositeExtract 16 2 - 24: 6(int) IMul 21 23 26: 25(ptr) AccessChain 9(bi) 11 Store 26 24 Return diff --git a/Test/baseResults/spv.specConstant.vert.out b/Test/baseResults/spv.specConstant.vert.out index dadab07c..9deec593 100644 --- a/Test/baseResults/spv.specConstant.vert.out +++ b/Test/baseResults/spv.specConstant.vert.out @@ -58,17 +58,25 @@ Linked vertex stage: 30: 29(bool) SpecConstantTrue 33: TypeInt 32 0 34: 33(int) SpecConstant 2 + 35: 6(float) SpecConstantOp 112 34 38: TypeFloat 64 39: 38(float) SpecConstant 1413754136 1074340347 40: 6(float) SpecConstant 1078523331 + 41: 38(float) SpecConstantOp 115 40 + 42: 38(float) SpecConstantOp 136 39 41 + 43: 6(float) SpecConstantOp 115 42 50: 8(int) SpecConstant 12 51: TypeArray 7(fvec4) 50 52: TypePointer Input 51 53(dupUcol): 52(ptr) Variable Input 60: 29(bool) SpecConstantTrue 63: 33(int) SpecConstant 2 + 64: 6(float) SpecConstantOp 112 63 67: 38(float) SpecConstant 1413754136 1074340347 68: 6(float) SpecConstant 1078523331 + 69: 38(float) SpecConstantOp 115 68 + 70: 38(float) SpecConstantOp 136 67 69 + 71: 6(float) SpecConstantOp 115 70 75: TypePointer Function 8(int) 77: 8(int) SpecConstant 8 4(main): 2 Function None 3 @@ -81,15 +89,11 @@ Linked vertex stage: SelectionMerge 32 None BranchConditional 30 31 32 31: Label - 35: 6(float) ConvertUToF 34 36: 7(fvec4) Load 20(color) 37: 7(fvec4) VectorTimesScalar 36 35 Store 20(color) 37 Branch 32 32: Label - 41: 38(float) FConvert 40 - 42: 38(float) FDiv 39 41 - 43: 6(float) FConvert 42 44: 7(fvec4) Load 20(color) 45: 7(fvec4) CompositeConstruct 43 43 43 43 46: 7(fvec4) FAdd 44 45 @@ -113,15 +117,11 @@ Linked vertex stage: SelectionMerge 62 None BranchConditional 60 61 62 61: Label - 64: 6(float) ConvertUToF 63 65: 7(fvec4) Load 20(color) 66: 7(fvec4) VectorTimesScalar 65 64 Store 20(color) 66 Branch 62 62: Label - 69: 38(float) FConvert 68 - 70: 38(float) FDiv 67 69 - 71: 6(float) FConvert 70 72: 7(fvec4) Load 20(color) 73: 7(fvec4) CompositeConstruct 71 71 71 71 74: 7(fvec4) FAdd 72 73 diff --git a/Test/baseResults/spv.specConstantComposite.vert.out b/Test/baseResults/spv.specConstantComposite.vert.out index 5e2dfa4a..b8dfd11b 100644 --- a/Test/baseResults/spv.specConstantComposite.vert.out +++ b/Test/baseResults/spv.specConstantComposite.vert.out @@ -51,6 +51,7 @@ Linked vertex stage: 26: TypePointer Output 25(fvec4) 27(color): 26(ptr) Variable Output 28: 14(int) SpecConstant 3 + 29: 24(float) SpecConstantOp 111 28 32: 24(float) SpecConstant 1078523331 33: 25(fvec4) SpecConstantComposite 32 32 32 32 36: 24(float) Constant 1133908460 @@ -76,6 +77,7 @@ Linked vertex stage: 70: 68 SpecConstantComposite 28 28 63 46 69 71: TypePointer Function 68 73: TypePointer Function 14(int) + 79: 24(float) SpecConstantOp 111 78 87: 24(float) Constant 1106321080 88:41(flat_struct) SpecConstantComposite 69 87 43 21 89: 14(int) Constant 10 @@ -99,7 +101,6 @@ Linked vertex stage: SelectionMerge 23 None BranchConditional 21 22 23 22: Label - 29: 24(float) ConvertSToF 28 30: 25(fvec4) Load 27(color) 31: 25(fvec4) VectorTimesScalar 30 29 Store 27(color) 31 @@ -146,7 +147,6 @@ Linked vertex stage: Store 76(indexable) 70 77: 73(ptr) AccessChain 76(indexable) 75 78: 14(int) Load 77 - 79: 24(float) ConvertSToF 78 80: 25(fvec4) Load 27(color) 81: 25(fvec4) CompositeConstruct 79 79 79 79 82: 25(fvec4) FDiv 80 81 diff --git a/Test/baseResults/spv.specConstantOperations.vert.out b/Test/baseResults/spv.specConstantOperations.vert.out index 88da0270..98925df2 100644 --- a/Test/baseResults/spv.specConstantOperations.vert.out +++ b/Test/baseResults/spv.specConstantOperations.vert.out @@ -32,6 +32,7 @@ Linked vertex stage: 13: TypeArray 6(int) 12 14: TypePointer Function 13 16: 6(int) Constant 1 + 17: 6(int) SpecConstantOp 128 10 16 18: TypePointer Function 6(int) 23: TypeFloat 32 24: 23(float) SpecConstant 1078530010 @@ -111,20 +112,19 @@ Linked vertex stage: 98: 68(ivec4) ConstantComposite 97 97 97 97 99: 68(ivec4) SpecConstantOp 198 71 98 100: 25(int) Constant 0 - 101: 6(int) SpecConstantOp 81 67 0 102: TypeVector 6(int) 2 - 103: 102(ivec2) SpecConstantOp 79 67 67 1(GLSL.std.450) 0 104: TypeVector 6(int) 3 - 105: 104(ivec3) SpecConstantOp 79 67 67 2 1(GLSL.std.450) 0 - 106: 65(ivec4) SpecConstantOp 79 67 67 1(GLSL.std.450) 2 0 3 4(main): 2 Function None 3 5: Label Return + 101: 6(int) CompositeExtract 67 0 + 103: 102(ivec2) VectorShuffle 67 67 1 0 + 105: 104(ivec3) VectorShuffle 67 67 2 1 0 + 106: 65(ivec4) VectorShuffle 67 67 1 2 0 3 FunctionEnd 8(non_const_array_size_from_spec_const(): 6(int) Function None 7 9: Label 15(array): 14(ptr) Variable Function - 17: 6(int) IAdd 10 16 19: 18(ptr) AccessChain 15(array) 17 20: 6(int) Load 19 ReturnValue 20 From 75d1d8010960ea4bf6b36939a178cc54d49b32ec Mon Sep 17 00:00:00 2001 From: qining Date: Wed, 6 Apr 2016 14:42:01 -0400 Subject: [PATCH 022/140] add SpecConstantOpModeGuard to GlslangToSpvTraverser::visitSymbol() --- SPIRV/GlslangToSpv.cpp | 4 ++++ Test/baseResults/spv.specConstantOperations.vert.out | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 147a4bd0..6a86e21d 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -778,6 +778,10 @@ TGlslangToSpvTraverser::~TGlslangToSpvTraverser() // void TGlslangToSpvTraverser::visitSymbol(glslang::TIntermSymbol* symbol) { + SpecConstantOpModeGuard spec_constant_op_mode_setter(&builder); + if (symbol->getType().getQualifier().isSpecConstant()) + spec_constant_op_mode_setter.turnOnSpecConstantOpMode(); + // getSymbolId() will set up all the IO decorations on the first call. // Formal function parameters were mapped during makeFunctions(). spv::Id id = getSymbolId(symbol); diff --git a/Test/baseResults/spv.specConstantOperations.vert.out b/Test/baseResults/spv.specConstantOperations.vert.out index 98925df2..a6c5993c 100644 --- a/Test/baseResults/spv.specConstantOperations.vert.out +++ b/Test/baseResults/spv.specConstantOperations.vert.out @@ -112,15 +112,15 @@ Linked vertex stage: 98: 68(ivec4) ConstantComposite 97 97 97 97 99: 68(ivec4) SpecConstantOp 198 71 98 100: 25(int) Constant 0 + 101: 6(int) SpecConstantOp 81 67 0 102: TypeVector 6(int) 2 + 103: 102(ivec2) SpecConstantOp 79 67 67 1(GLSL.std.450) 0 104: TypeVector 6(int) 3 + 105: 104(ivec3) SpecConstantOp 79 67 67 2 1(GLSL.std.450) 0 + 106: 65(ivec4) SpecConstantOp 79 67 67 1(GLSL.std.450) 2 0 3 4(main): 2 Function None 3 5: Label Return - 101: 6(int) CompositeExtract 67 0 - 103: 102(ivec2) VectorShuffle 67 67 1 0 - 105: 104(ivec3) VectorShuffle 67 67 2 1 0 - 106: 65(ivec4) VectorShuffle 67 67 1 2 0 3 FunctionEnd 8(non_const_array_size_from_spec_const(): 6(int) Function None 7 9: Label From 78a6b788103c95ef77722c1688082e3ceb384b11 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Wed, 6 Apr 2016 13:32:44 -0600 Subject: [PATCH 023/140] Front-end: Get the right set of nodes marked as spec-const. This is according to the expected KHR_vulkan_glsl without floating point. So, floating-point spec-const operations no longer work, and that's reflected in the tests. --- Test/baseResults/spv.specConstant.vert.out | 16 +- .../spv.specConstantComposite.vert.out | 4 +- .../spv.specConstantOperations.vert.out | 155 +++++++++--------- Test/spv.specConstantOperations.vert | 8 +- glslang/MachineIndependent/Intermediate.cpp | 96 ++++++++++- .../MachineIndependent/localintermediate.h | 2 + 6 files changed, 180 insertions(+), 101 deletions(-) diff --git a/Test/baseResults/spv.specConstant.vert.out b/Test/baseResults/spv.specConstant.vert.out index 9deec593..dadab07c 100644 --- a/Test/baseResults/spv.specConstant.vert.out +++ b/Test/baseResults/spv.specConstant.vert.out @@ -58,25 +58,17 @@ Linked vertex stage: 30: 29(bool) SpecConstantTrue 33: TypeInt 32 0 34: 33(int) SpecConstant 2 - 35: 6(float) SpecConstantOp 112 34 38: TypeFloat 64 39: 38(float) SpecConstant 1413754136 1074340347 40: 6(float) SpecConstant 1078523331 - 41: 38(float) SpecConstantOp 115 40 - 42: 38(float) SpecConstantOp 136 39 41 - 43: 6(float) SpecConstantOp 115 42 50: 8(int) SpecConstant 12 51: TypeArray 7(fvec4) 50 52: TypePointer Input 51 53(dupUcol): 52(ptr) Variable Input 60: 29(bool) SpecConstantTrue 63: 33(int) SpecConstant 2 - 64: 6(float) SpecConstantOp 112 63 67: 38(float) SpecConstant 1413754136 1074340347 68: 6(float) SpecConstant 1078523331 - 69: 38(float) SpecConstantOp 115 68 - 70: 38(float) SpecConstantOp 136 67 69 - 71: 6(float) SpecConstantOp 115 70 75: TypePointer Function 8(int) 77: 8(int) SpecConstant 8 4(main): 2 Function None 3 @@ -89,11 +81,15 @@ Linked vertex stage: SelectionMerge 32 None BranchConditional 30 31 32 31: Label + 35: 6(float) ConvertUToF 34 36: 7(fvec4) Load 20(color) 37: 7(fvec4) VectorTimesScalar 36 35 Store 20(color) 37 Branch 32 32: Label + 41: 38(float) FConvert 40 + 42: 38(float) FDiv 39 41 + 43: 6(float) FConvert 42 44: 7(fvec4) Load 20(color) 45: 7(fvec4) CompositeConstruct 43 43 43 43 46: 7(fvec4) FAdd 44 45 @@ -117,11 +113,15 @@ Linked vertex stage: SelectionMerge 62 None BranchConditional 60 61 62 61: Label + 64: 6(float) ConvertUToF 63 65: 7(fvec4) Load 20(color) 66: 7(fvec4) VectorTimesScalar 65 64 Store 20(color) 66 Branch 62 62: Label + 69: 38(float) FConvert 68 + 70: 38(float) FDiv 67 69 + 71: 6(float) FConvert 70 72: 7(fvec4) Load 20(color) 73: 7(fvec4) CompositeConstruct 71 71 71 71 74: 7(fvec4) FAdd 72 73 diff --git a/Test/baseResults/spv.specConstantComposite.vert.out b/Test/baseResults/spv.specConstantComposite.vert.out index b8dfd11b..5e2dfa4a 100644 --- a/Test/baseResults/spv.specConstantComposite.vert.out +++ b/Test/baseResults/spv.specConstantComposite.vert.out @@ -51,7 +51,6 @@ Linked vertex stage: 26: TypePointer Output 25(fvec4) 27(color): 26(ptr) Variable Output 28: 14(int) SpecConstant 3 - 29: 24(float) SpecConstantOp 111 28 32: 24(float) SpecConstant 1078523331 33: 25(fvec4) SpecConstantComposite 32 32 32 32 36: 24(float) Constant 1133908460 @@ -77,7 +76,6 @@ Linked vertex stage: 70: 68 SpecConstantComposite 28 28 63 46 69 71: TypePointer Function 68 73: TypePointer Function 14(int) - 79: 24(float) SpecConstantOp 111 78 87: 24(float) Constant 1106321080 88:41(flat_struct) SpecConstantComposite 69 87 43 21 89: 14(int) Constant 10 @@ -101,6 +99,7 @@ Linked vertex stage: SelectionMerge 23 None BranchConditional 21 22 23 22: Label + 29: 24(float) ConvertSToF 28 30: 25(fvec4) Load 27(color) 31: 25(fvec4) VectorTimesScalar 30 29 Store 27(color) 31 @@ -147,6 +146,7 @@ Linked vertex stage: Store 76(indexable) 70 77: 73(ptr) AccessChain 76(indexable) 75 78: 14(int) Load 77 + 79: 24(float) ConvertSToF 78 80: 25(fvec4) Load 27(color) 81: 25(fvec4) CompositeConstruct 79 79 79 79 82: 25(fvec4) FDiv 80 81 diff --git a/Test/baseResults/spv.specConstantOperations.vert.out b/Test/baseResults/spv.specConstantOperations.vert.out index a6c5993c..76853d6f 100644 --- a/Test/baseResults/spv.specConstantOperations.vert.out +++ b/Test/baseResults/spv.specConstantOperations.vert.out @@ -7,10 +7,9 @@ Linked vertex stage: // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 107 +// Id's are bound by 101 Capability Shader - Capability Float64 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 EntryPoint Vertex 4 "main" @@ -39,85 +38,79 @@ Linked vertex stage: 25: TypeInt 32 0 26: 25(int) SpecConstant 100 27: 6(int) SpecConstant 4294967286 - 28: TypeFloat 64 - 29: 28(float) SpecConstantOp 115 24 - 30: 23(float) SpecConstantOp 115 29 - 31: 6(int) SpecConstantOp 126 10 - 32: 6(int) SpecConstantOp 200 10 - 33: 6(int) SpecConstantOp 128 10 11 - 34: 6(int) SpecConstantOp 128 10 11 - 35: 6(int) Constant 3 - 36: 6(int) SpecConstantOp 130 34 35 - 37: 6(int) Constant 4 - 38: 6(int) SpecConstantOp 130 33 37 - 39: 6(int) SpecConstantOp 132 27 11 - 40: 25(int) Constant 2 - 41: 25(int) SpecConstantOp 132 26 40 - 42: 6(int) Constant 5 - 43: 6(int) SpecConstantOp 135 39 42 - 44: 25(int) Constant 5 - 45: 25(int) SpecConstantOp 134 41 44 - 46: 6(int) SpecConstantOp 139 27 37 - 47: 25(int) Constant 4 - 48: 25(int) SpecConstantOp 137 26 47 - 49: 6(int) SpecConstantOp 132 27 35 - 50: 6(int) SpecConstantOp 135 49 42 - 51: 6(int) Constant 10 - 52: 6(int) SpecConstantOp 195 27 51 - 53: 6(int) Constant 20 - 54: 25(int) SpecConstantOp 194 26 53 - 55: 6(int) SpecConstantOp 196 27 16 - 56: 25(int) SpecConstantOp 196 26 11 - 57: 6(int) Constant 256 - 58: 6(int) SpecConstantOp 197 27 57 - 59: 25(int) Constant 512 - 60: 25(int) SpecConstantOp 198 26 59 - 61: TypeBool - 62: 61(bool) SpecConstantOp 177 10 27 - 63: 61(bool) SpecConstantOp 170 26 26 - 64: 61(bool) SpecConstantOp 173 10 27 - 65: TypeVector 6(int) 4 - 66: 6(int) Constant 30 - 67: 65(ivec4) SpecConstantComposite 53 66 10 10 - 68: TypeVector 25(int) 4 - 69: 25(int) Constant 4294967295 - 70: 25(int) Constant 4294967294 - 71: 68(ivec4) SpecConstantComposite 26 26 69 70 - 72: TypeVector 23(float) 4 - 73: 23(float) Constant 1067450368 - 74: 72(fvec4) SpecConstantComposite 24 73 24 73 - 75: TypeVector 28(float) 4 - 76: 75(fvec4) SpecConstantOp 115 74 - 77: 72(fvec4) SpecConstantOp 115 76 - 78: 65(ivec4) SpecConstantOp 200 67 - 79: 65(ivec4) SpecConstantOp 126 67 - 80: 65(ivec4) ConstantComposite 11 11 11 11 - 81: 65(ivec4) SpecConstantOp 128 67 80 - 82: 65(ivec4) SpecConstantOp 128 67 80 - 83: 65(ivec4) ConstantComposite 35 35 35 35 - 84: 65(ivec4) SpecConstantOp 130 82 83 - 85: 65(ivec4) ConstantComposite 37 37 37 37 - 86: 65(ivec4) SpecConstantOp 130 84 85 - 87: 65(ivec4) SpecConstantOp 132 67 80 - 88: 65(ivec4) ConstantComposite 42 42 42 42 - 89: 65(ivec4) SpecConstantOp 135 87 88 - 90: 65(ivec4) SpecConstantOp 139 67 85 - 91: 65(ivec4) ConstantComposite 51 51 51 51 - 92: 65(ivec4) SpecConstantOp 195 67 91 - 93: 65(ivec4) SpecConstantOp 196 67 80 - 94: 6(int) Constant 1024 - 95: 65(ivec4) ConstantComposite 94 94 94 94 - 96: 65(ivec4) SpecConstantOp 197 67 95 - 97: 25(int) Constant 2048 - 98: 68(ivec4) ConstantComposite 97 97 97 97 - 99: 68(ivec4) SpecConstantOp 198 71 98 - 100: 25(int) Constant 0 - 101: 6(int) SpecConstantOp 81 67 0 - 102: TypeVector 6(int) 2 - 103: 102(ivec2) SpecConstantOp 79 67 67 1(GLSL.std.450) 0 - 104: TypeVector 6(int) 3 - 105: 104(ivec3) SpecConstantOp 79 67 67 2 1(GLSL.std.450) 0 - 106: 65(ivec4) SpecConstantOp 79 67 67 1(GLSL.std.450) 2 0 3 + 28: 6(int) SpecConstantOp 126 10 + 29: 6(int) SpecConstantOp 200 10 + 30: 6(int) SpecConstantOp 128 10 11 + 31: 6(int) SpecConstantOp 128 10 11 + 32: 6(int) Constant 3 + 33: 6(int) SpecConstantOp 130 31 32 + 34: 6(int) Constant 4 + 35: 6(int) SpecConstantOp 130 30 34 + 36: 6(int) SpecConstantOp 132 27 11 + 37: 25(int) Constant 2 + 38: 25(int) SpecConstantOp 132 26 37 + 39: 6(int) Constant 5 + 40: 6(int) SpecConstantOp 135 36 39 + 41: 25(int) Constant 5 + 42: 25(int) SpecConstantOp 134 38 41 + 43: 6(int) SpecConstantOp 139 27 34 + 44: 25(int) Constant 4 + 45: 25(int) SpecConstantOp 137 26 44 + 46: 6(int) SpecConstantOp 132 27 32 + 47: 6(int) SpecConstantOp 135 46 39 + 48: 6(int) Constant 10 + 49: 6(int) SpecConstantOp 195 27 48 + 50: 6(int) Constant 20 + 51: 25(int) SpecConstantOp 194 26 50 + 52: 6(int) SpecConstantOp 196 27 16 + 53: 25(int) SpecConstantOp 196 26 11 + 54: 6(int) Constant 256 + 55: 6(int) SpecConstantOp 197 27 54 + 56: 25(int) Constant 512 + 57: 25(int) SpecConstantOp 198 26 56 + 58: TypeBool + 59: 58(bool) SpecConstantOp 177 10 27 + 60: 58(bool) SpecConstantOp 170 26 26 + 61: 58(bool) SpecConstantOp 173 10 27 + 62: TypeVector 6(int) 4 + 63: 6(int) Constant 30 + 64: 62(ivec4) SpecConstantComposite 50 63 10 10 + 65: TypeVector 25(int) 4 + 66: 25(int) Constant 4294967295 + 67: 25(int) Constant 4294967294 + 68: 65(ivec4) SpecConstantComposite 26 26 66 67 + 69: TypeVector 23(float) 4 + 70: 23(float) Constant 1067450368 + 71: 69(fvec4) SpecConstantComposite 24 70 24 70 + 72: 62(ivec4) SpecConstantOp 200 64 + 73: 62(ivec4) SpecConstantOp 126 64 + 74: 62(ivec4) ConstantComposite 11 11 11 11 + 75: 62(ivec4) SpecConstantOp 128 64 74 + 76: 62(ivec4) SpecConstantOp 128 64 74 + 77: 62(ivec4) ConstantComposite 32 32 32 32 + 78: 62(ivec4) SpecConstantOp 130 76 77 + 79: 62(ivec4) ConstantComposite 34 34 34 34 + 80: 62(ivec4) SpecConstantOp 130 78 79 + 81: 62(ivec4) SpecConstantOp 132 64 74 + 82: 62(ivec4) ConstantComposite 39 39 39 39 + 83: 62(ivec4) SpecConstantOp 135 81 82 + 84: 62(ivec4) SpecConstantOp 139 64 79 + 85: 62(ivec4) ConstantComposite 48 48 48 48 + 86: 62(ivec4) SpecConstantOp 195 64 85 + 87: 62(ivec4) SpecConstantOp 196 64 74 + 88: 6(int) Constant 1024 + 89: 62(ivec4) ConstantComposite 88 88 88 88 + 90: 62(ivec4) SpecConstantOp 197 64 89 + 91: 25(int) Constant 2048 + 92: 65(ivec4) ConstantComposite 91 91 91 91 + 93: 65(ivec4) SpecConstantOp 198 68 92 + 94: 25(int) Constant 0 + 95: 6(int) SpecConstantOp 81 64 0 + 96: TypeVector 6(int) 2 + 97: 96(ivec2) SpecConstantOp 79 64 64 1(GLSL.std.450) 0 + 98: TypeVector 6(int) 3 + 99: 98(ivec3) SpecConstantOp 79 64 64 2 1(GLSL.std.450) 0 + 100: 62(ivec4) SpecConstantOp 79 64 64 1(GLSL.std.450) 2 0 3 4(main): 2 Function None 3 5: Label Return diff --git a/Test/spv.specConstantOperations.vert b/Test/spv.specConstantOperations.vert index 9311270f..91920cf2 100644 --- a/Test/spv.specConstantOperations.vert +++ b/Test/spv.specConstantOperations.vert @@ -11,8 +11,8 @@ layout(constant_id = 203) const int sp_sint = -10; // // Size convert -const double float_to_double = double(sp_float); -const float double_to_float = float(float_to_double); +//const double float_to_double = double(sp_float); +//const float double_to_float = float(float_to_double); // Negate and Not const int negate_int = -sp_int; @@ -55,8 +55,8 @@ const uvec4 uv = uvec4(sp_uint, sp_uint, -1, -2); const vec4 fv = vec4(sp_float, 1.25, sp_float, 1.25); // Size convert -const dvec4 fv_to_dv = dvec4(fv); -const vec4 dv_to_fv = vec4(fv_to_dv); +//const dvec4 fv_to_dv = dvec4(fv); +//const vec4 dv_to_fv = vec4(fv_to_dv); // Negate and Not const ivec4 not_iv = ~iv; diff --git a/glslang/MachineIndependent/Intermediate.cpp b/glslang/MachineIndependent/Intermediate.cpp index 777de2d6..d0fa74e5 100644 --- a/glslang/MachineIndependent/Intermediate.cpp +++ b/glslang/MachineIndependent/Intermediate.cpp @@ -145,10 +145,12 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn // If either is a specialization constant, while the other is // a constant (or specialization constant), the result is still - // a specialization constant. + // a specialization constant, if the operation is an allowed + // specialization-constant operation. if (( left->getType().getQualifier().isSpecConstant() && right->getType().getQualifier().isConstant()) || (right->getType().getQualifier().isSpecConstant() && left->getType().getQualifier().isConstant())) - node->getWritableType().getQualifier().makeSpecConstant(); + if (isSpecializationOperation(*node)) + node->getWritableType().getQualifier().makeSpecConstant(); return node; } @@ -292,8 +294,9 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo if (child->getAsConstantUnion()) return child->getAsConstantUnion()->fold(op, node->getType()); - // If it's a specialization constant, the result is too. - if (child->getType().getQualifier().isSpecConstant()) + // If it's a specialization constant, the result is too, + // if the operation is allowed for specialization constants. + if (child->getType().getQualifier().isSpecConstant() && isSpecializationOperation(*node)) node->getWritableType().getQualifier().makeSpecConstant(); return node; @@ -619,8 +622,8 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt // TODO: it seems that some unary folding operations should occur here, but are not - // Propagate specialization-constant-ness. - if (node->getType().getQualifier().isSpecConstant()) + // Propagate specialization-constant-ness, if allowed + if (node->getType().getQualifier().isSpecConstant() && isSpecializationOperation(*newNode)) newNode->getWritableType().getQualifier().makeSpecConstant(); return newNode; @@ -1065,6 +1068,87 @@ void TIntermediate::removeTree() RemoveAllTreeNodes(treeRoot); } +// +// Implement the part of KHR_vulkan_glsl that lists the set of operations +// that can result in a specialization constant operation. +// +// "5.x Specialization Constant Operations" +// +// ... +// +// It also needs to allow basic construction, swizzling, and indexing +// operations. +// +bool TIntermediate::isSpecializationOperation(const TIntermOperator& node) const +{ + // allow construction + if (node.isConstructor()) + return true; + + // The set for floating point is quite limited + if (node.getBasicType() == EbtFloat || + node.getBasicType() == EbtDouble) { + switch (node.getOp()) { + case EOpIndexDirect: + case EOpIndexIndirect: + case EOpIndexDirectStruct: + case EOpVectorSwizzle: + return true; + default: + return false; + } + } + + // Floating-point is out of the way. + // Now check for integer/bool-based operations + switch (node.getOp()) { + + // dereference/swizzle + case EOpIndexDirect: + case EOpIndexIndirect: + case EOpIndexDirectStruct: + case EOpVectorSwizzle: + + // conversion constructors + case EOpConvIntToBool: + case EOpConvUintToBool: + case EOpConvUintToInt: + case EOpConvBoolToInt: + case EOpConvIntToUint: + case EOpConvBoolToUint: + + // unary operations + case EOpNegative: + case EOpLogicalNot: + case EOpBitwiseNot: + + // binary operations + case EOpAdd: + case EOpSub: + case EOpMul: + case EOpVectorTimesScalar: + case EOpDiv: + case EOpMod: + case EOpRightShift: + case EOpLeftShift: + case EOpAnd: + case EOpInclusiveOr: + case EOpExclusiveOr: + case EOpLogicalOr: + case EOpLogicalXor: + case EOpLogicalAnd: + case EOpEqual: + case EOpNotEqual: + case EOpLessThan: + case EOpGreaterThan: + case EOpLessThanEqual: + case EOpGreaterThanEqual: + return true; + default: + return false; + } +} + //////////////////////////////////////////////////////////////// // // Member functions of the nodes used for building the tree. diff --git a/glslang/MachineIndependent/localintermediate.h b/glslang/MachineIndependent/localintermediate.h index 42be8b90..895bd3e2 100644 --- a/glslang/MachineIndependent/localintermediate.h +++ b/glslang/MachineIndependent/localintermediate.h @@ -342,6 +342,8 @@ protected: TIntermSequence& findLinkerObjects() const; bool userOutputUsed() const; static int getBaseAlignmentScalar(const TType&, int& size); + bool isSpecializationOperation(const TIntermOperator&) const; + const EShLanguage language; // stage, known at construction time EShSource source; // source language, known a bit later From 7e3e48634429785092ef872068a95ef7834e50c8 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Wed, 6 Apr 2016 19:03:15 -0600 Subject: [PATCH 024/140] Memory: Don't use pool memory to store the entry point name in the intermediate representation. This might address issue #221, which I couldn't reproduce. --- SPIRV/GlslangToSpv.cpp | 2 +- glslang/MachineIndependent/ParseHelper.cpp | 2 +- glslang/MachineIndependent/localintermediate.h | 4 ++-- hlsl/hlslParseHelper.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 6a86e21d..8dfc681d 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -2126,7 +2126,7 @@ bool TGlslangToSpvTraverser::isShaderEntrypoint(const glslang::TIntermAggregate* { // have to ignore mangling and just look at the base name int firstOpen = node->getName().find('('); - return node->getName().compare(0, firstOpen, glslangIntermediate->getEntryPoint()) == 0; + return node->getName().compare(0, firstOpen, glslangIntermediate->getEntryPoint().c_str()) == 0; } // Make all the functions, skeletally, without actually visiting their bodies. diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 945327df..4c1b7a0c 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -986,7 +986,7 @@ TIntermAggregate* TParseContext::handleFunctionDefinition(const TSourceLoc& loc, // // Raise error message if main function takes any parameters or returns anything other than void // - if (function.getName() == intermediate.getEntryPoint()) { + if (function.getName() == intermediate.getEntryPoint().c_str()) { if (function.getParamCount() > 0) error(loc, "function cannot take any parameter(s)", function.getName().c_str(), ""); if (function.getType().getBasicType() != EbtVoid) diff --git a/glslang/MachineIndependent/localintermediate.h b/glslang/MachineIndependent/localintermediate.h index 895bd3e2..c2d0c74a 100644 --- a/glslang/MachineIndependent/localintermediate.h +++ b/glslang/MachineIndependent/localintermediate.h @@ -149,7 +149,7 @@ public: void setSource(EShSource s) { source = s; } EShSource getSource() const { return source; } void setEntryPoint(const char* ep) { entryPoint = ep; } - const TString& getEntryPoint() const { return entryPoint; } + const std::string& getEntryPoint() const { return entryPoint; } void setVersion(int v) { version = v; } int getVersion() const { return version; } void setProfile(EProfile p) { profile = p; } @@ -347,7 +347,7 @@ protected: const EShLanguage language; // stage, known at construction time EShSource source; // source language, known a bit later - TString entryPoint; + std::string entryPoint; EProfile profile; int version; int spv; diff --git a/hlsl/hlslParseHelper.cpp b/hlsl/hlslParseHelper.cpp index 534174d0..e05f01f1 100755 --- a/hlsl/hlslParseHelper.cpp +++ b/hlsl/hlslParseHelper.cpp @@ -709,7 +709,7 @@ TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& l currentFunctionType = new TType(EbtVoid); functionReturnsValue = false; - inEntrypoint = (function.getName() == intermediate.getEntryPoint()); + inEntrypoint = (function.getName() == intermediate.getEntryPoint().c_str()); // // New symbol table scope for body of function plus its arguments From 6e620c4674483390c13d1e96eb46ba6e42859530 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Thu, 7 Apr 2016 09:10:47 -0600 Subject: [PATCH 025/140] Nonfunctional: Remove stray ';' and fix Google Test sentence in README. --- README.md | 2 +- SPIRV/GlslangToSpv.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 56bdeec9..d669e50d 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,7 @@ Testing ------- Test results should always be included with a pull request that modifies -functionality. And since glslang is adding the ability to test with +functionality. And since glslang added the ability to test with [Google Test](https://github.com/google/googletest) framework, please write your new tests using Google Test. diff --git a/SPIRV/GlslangToSpv.h b/SPIRV/GlslangToSpv.h index d8a18893..ea753404 100644 --- a/SPIRV/GlslangToSpv.h +++ b/SPIRV/GlslangToSpv.h @@ -40,4 +40,4 @@ void GetSpirvVersion(std::string&); void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector& spirv); void OutputSpv(const std::vector& spirv, const char* baseName); -}; +} From 3cb57d373151f775733565639499be35fd04eb0a Mon Sep 17 00:00:00 2001 From: baldurk Date: Sat, 9 Apr 2016 13:07:12 +0200 Subject: [PATCH 026/140] Fix warning about losing information, use size_t instead of int --- SPIRV/GlslangToSpv.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 8dfc681d..92495746 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -2125,7 +2125,7 @@ void TGlslangToSpvTraverser::updateMemberOffset(const glslang::TType& /*structTy bool TGlslangToSpvTraverser::isShaderEntrypoint(const glslang::TIntermAggregate* node) { // have to ignore mangling and just look at the base name - int firstOpen = node->getName().find('('); + size_t firstOpen = node->getName().find('('); return node->getName().compare(0, firstOpen, glslangIntermediate->getEntryPoint().c_str()) == 0; } From 40289165dd8b41a441e8e2abd2ec790e987722da Mon Sep 17 00:00:00 2001 From: baldurk Date: Sat, 9 Apr 2016 13:07:25 +0200 Subject: [PATCH 027/140] Fix warning about function parameter shadowing class member variable --- glslang/Include/Types.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glslang/Include/Types.h b/glslang/Include/Types.h index bff7e9a9..e28e5b29 100644 --- a/glslang/Include/Types.h +++ b/glslang/Include/Types.h @@ -999,9 +999,9 @@ public: qualifier.storage = EvqGlobal; } - void init(const TSourceLoc& loc, bool global = false) + void init(const TSourceLoc& l, bool global = false) { - initType(loc); + initType(l); sampler.clear(); initQualifiers(global); shaderQualifiers.init(); From 51eb91f27257181028beee5f20deda5ed1b179db Mon Sep 17 00:00:00 2001 From: Dejan Mircevski Date: Tue, 12 Apr 2016 12:07:27 -0400 Subject: [PATCH 028/140] Make two more IncludeResult members const. --- glslang/Public/ShaderLang.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glslang/Public/ShaderLang.h b/glslang/Public/ShaderLang.h index c9182618..5ab602bd 100644 --- a/glslang/Public/ShaderLang.h +++ b/glslang/Public/ShaderLang.h @@ -320,13 +320,13 @@ public: // include. For example, in a filesystem-based includer, full resolution // should convert a relative path name into an absolute path name. // For a failed inclusion, this is an empty string. - std::string file_name; + const std::string file_name; // The content and byte length of the requested inclusion. The // Includer producing this IncludeResult retains ownership of the // storage. // For a failed inclusion, the file_data // field points to a string containing error details. - const char* file_data; + const char* const file_data; const size_t file_length; // Include resolver's context. void* user_data; From c0792105f18ac3aa9da012990612c2f451862df7 Mon Sep 17 00:00:00 2001 From: David Neto Date: Tue, 12 Apr 2016 19:54:02 -0400 Subject: [PATCH 029/140] Unit test executable should link to libHLSL No unit tests exercise it. --- gtests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtests/CMakeLists.txt b/gtests/CMakeLists.txt index 57378cea..7f477d61 100644 --- a/gtests/CMakeLists.txt +++ b/gtests/CMakeLists.txt @@ -26,7 +26,7 @@ if (TARGET gmock) ${gmock_SOURCE_DIR}/include ${gtest_SOURCE_DIR}/include) target_link_libraries(glslangtests PRIVATE - glslang OSDependent OGLCompiler glslang + glslang OSDependent OGLCompiler HLSL glslang SPIRV glslang-default-resource-limits gmock) add_test(NAME glslang-gtests COMMAND glslangtests) endif() From 6f29a1bb3b276bf9586e04ea69dc0b629a6c7689 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Tue, 12 Apr 2016 18:35:12 -0600 Subject: [PATCH 030/140] SPV for OpenGL: Issue #229: don't allow gl_VertexIndex or gl_InstanceIndex under -G. --- glslang/MachineIndependent/Initialize.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp index 2e094f02..446c51c9 100644 --- a/glslang/MachineIndependent/Initialize.cpp +++ b/glslang/MachineIndependent/Initialize.cpp @@ -1708,7 +1708,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan) stageBuiltins[EShLangVertex].append( "int gl_InstanceID;" // needs qualifier fixed later ); - if (spv > 0 && version >= 140) + if (vulkan > 0 && version >= 140) stageBuiltins[EShLangVertex].append( "in int gl_VertexIndex;" "in int gl_InstanceIndex;" @@ -1733,7 +1733,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan) "in highp int gl_VertexID;" // needs qualifier fixed later "in highp int gl_InstanceID;" // needs qualifier fixed later ); - if (spv > 0) + if (vulkan > 0) stageBuiltins[EShLangVertex].append( "in highp int gl_VertexIndex;" "in highp int gl_InstanceIndex;" From e24aa5edbb1abbfe01c1de30d22d586c019b0c7b Mon Sep 17 00:00:00 2001 From: qining Date: Thu, 7 Apr 2016 15:40:27 -0400 Subject: [PATCH 031/140] SpecOp bool->uint/int and uint<->int conversion Bool -> uint/int with OpSpecConstantOp OpSelect instruction. uint <-> int conversion with OpSpecConstantOp OpIAdd instruction. Note, implicit conversion: `const uint = an_int_spec_constant` is not supported. Explicit type casting is required: `const uint = uint(an_int_spec_constant)` --- SPIRV/GlslangToSpv.cpp | 21 +- SPIRV/SpvBuilder.cpp | 8 + .../spv.specConstantOperations.vert.out | 235 +++++++++++------- Test/spv.specConstantOperations.vert | 27 +- 4 files changed, 188 insertions(+), 103 deletions(-) diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 92495746..0240d8d4 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -1960,7 +1960,6 @@ spv::Id TGlslangToSpvTraverser::makeArraySizeId(const glslang::TArraySizes& arra glslang::TIntermTyped* specNode = arraySizes.getDimNode(dim); if (specNode != nullptr) { builder.clearAccessChain(); - // SpecConstantOpModeGuard set_to_spec_const_mode(&builder); specNode->traverse(this); return accessChainLoad(specNode->getAsTyped()->getType()); } @@ -3307,7 +3306,27 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Dec break; case glslang::EOpConvUintToInt: + if (builder.isInSpecConstCodeGenMode()) { + // Build zero scalar or vector for OpIAdd to do the conversion when + // generating for OpSpecConstantOp instruction. + zero = builder.makeIntConstant(0); + zero = makeSmearedConstant(zero, vectorSize); + } + // Don't 'break' here as this case should be grouped together with + // EOpConvIntToUint when generating normal run-time conversion + // instruction. case glslang::EOpConvIntToUint: + if (builder.isInSpecConstCodeGenMode()) { + // Build zero scalar or vector for OpIAdd. + if (zero == 0) { + zero = builder.makeUintConstant(0); + zero = makeSmearedConstant(zero, vectorSize); + } + // Use OpIAdd, instead of OpBitcast to do the conversion when + // generating for OpSpecConstantOp instruction. + return builder.createBinOp(spv::OpIAdd, destType, operand, zero); + } + // For normal run-time conversion instruction, use OpBitcast. convOp = spv::OpBitcast; break; diff --git a/SPIRV/SpvBuilder.cpp b/SPIRV/SpvBuilder.cpp index f69e7feb..df87e9c2 100644 --- a/SPIRV/SpvBuilder.cpp +++ b/SPIRV/SpvBuilder.cpp @@ -1212,6 +1212,14 @@ Id Builder::createBinOp(Op opCode, Id typeId, Id left, Id right) Id Builder::createTriOp(Op opCode, Id typeId, Id op1, Id op2, Id op3) { + // Generate code for spec constants if in spec constant operation + // generation mode. + if (generatingOpCodeForSpecConst) { + std::vector operands(3); + operands[0] = op1; operands[1] = op2; operands[2] = op3; + return createSpecConstantOp( + opCode, typeId, operands, std::vector()); + } Instruction* op = new Instruction(getUniqueId(), typeId, opCode); op->addIdOperand(op1); op->addIdOperand(op2); diff --git a/Test/baseResults/spv.specConstantOperations.vert.out b/Test/baseResults/spv.specConstantOperations.vert.out index 76853d6f..7544b32f 100644 --- a/Test/baseResults/spv.specConstantOperations.vert.out +++ b/Test/baseResults/spv.specConstantOperations.vert.out @@ -7,7 +7,7 @@ Linked vertex stage: // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 101 +// Id's are bound by 134 Capability Shader 1: ExtInstImport "GLSL.std.450" @@ -16,109 +16,152 @@ Linked vertex stage: Source GLSL 450 Name 4 "main" Name 8 "non_const_array_size_from_spec_const(" - Name 15 "array" - Decorate 10 SpecId 201 - Decorate 24 SpecId 200 - Decorate 26 SpecId 202 - Decorate 27 SpecId 203 + Name 11 "i" + Name 27 "array" + Decorate 19 SpecId 201 + Decorate 40 SpecId 200 + Decorate 42 SpecId 202 + Decorate 43 SpecId 203 2: TypeVoid 3: TypeFunction 2 6: TypeInt 32 1 7: TypeFunction 6(int) - 10: 6(int) SpecConstant 10 - 11: 6(int) Constant 2 - 12: 6(int) SpecConstantOp 128 10 11 - 13: TypeArray 6(int) 12 - 14: TypePointer Function 13 - 16: 6(int) Constant 1 - 17: 6(int) SpecConstantOp 128 10 16 - 18: TypePointer Function 6(int) - 23: TypeFloat 32 - 24: 23(float) SpecConstant 1078530010 - 25: TypeInt 32 0 - 26: 25(int) SpecConstant 100 - 27: 6(int) SpecConstant 4294967286 - 28: 6(int) SpecConstantOp 126 10 - 29: 6(int) SpecConstantOp 200 10 - 30: 6(int) SpecConstantOp 128 10 11 - 31: 6(int) SpecConstantOp 128 10 11 - 32: 6(int) Constant 3 - 33: 6(int) SpecConstantOp 130 31 32 - 34: 6(int) Constant 4 - 35: 6(int) SpecConstantOp 130 30 34 - 36: 6(int) SpecConstantOp 132 27 11 - 37: 25(int) Constant 2 - 38: 25(int) SpecConstantOp 132 26 37 - 39: 6(int) Constant 5 - 40: 6(int) SpecConstantOp 135 36 39 - 41: 25(int) Constant 5 - 42: 25(int) SpecConstantOp 134 38 41 - 43: 6(int) SpecConstantOp 139 27 34 - 44: 25(int) Constant 4 - 45: 25(int) SpecConstantOp 137 26 44 - 46: 6(int) SpecConstantOp 132 27 32 - 47: 6(int) SpecConstantOp 135 46 39 - 48: 6(int) Constant 10 - 49: 6(int) SpecConstantOp 195 27 48 - 50: 6(int) Constant 20 - 51: 25(int) SpecConstantOp 194 26 50 - 52: 6(int) SpecConstantOp 196 27 16 - 53: 25(int) SpecConstantOp 196 26 11 - 54: 6(int) Constant 256 - 55: 6(int) SpecConstantOp 197 27 54 - 56: 25(int) Constant 512 - 57: 25(int) SpecConstantOp 198 26 56 - 58: TypeBool - 59: 58(bool) SpecConstantOp 177 10 27 - 60: 58(bool) SpecConstantOp 170 26 26 - 61: 58(bool) SpecConstantOp 173 10 27 - 62: TypeVector 6(int) 4 - 63: 6(int) Constant 30 - 64: 62(ivec4) SpecConstantComposite 50 63 10 10 - 65: TypeVector 25(int) 4 - 66: 25(int) Constant 4294967295 - 67: 25(int) Constant 4294967294 - 68: 65(ivec4) SpecConstantComposite 26 26 66 67 - 69: TypeVector 23(float) 4 - 70: 23(float) Constant 1067450368 - 71: 69(fvec4) SpecConstantComposite 24 70 24 70 - 72: 62(ivec4) SpecConstantOp 200 64 - 73: 62(ivec4) SpecConstantOp 126 64 - 74: 62(ivec4) ConstantComposite 11 11 11 11 - 75: 62(ivec4) SpecConstantOp 128 64 74 - 76: 62(ivec4) SpecConstantOp 128 64 74 - 77: 62(ivec4) ConstantComposite 32 32 32 32 - 78: 62(ivec4) SpecConstantOp 130 76 77 - 79: 62(ivec4) ConstantComposite 34 34 34 34 - 80: 62(ivec4) SpecConstantOp 130 78 79 - 81: 62(ivec4) SpecConstantOp 132 64 74 - 82: 62(ivec4) ConstantComposite 39 39 39 39 - 83: 62(ivec4) SpecConstantOp 135 81 82 - 84: 62(ivec4) SpecConstantOp 139 64 79 - 85: 62(ivec4) ConstantComposite 48 48 48 48 - 86: 62(ivec4) SpecConstantOp 195 64 85 - 87: 62(ivec4) SpecConstantOp 196 64 74 - 88: 6(int) Constant 1024 - 89: 62(ivec4) ConstantComposite 88 88 88 88 - 90: 62(ivec4) SpecConstantOp 197 64 89 - 91: 25(int) Constant 2048 - 92: 65(ivec4) ConstantComposite 91 91 91 91 - 93: 65(ivec4) SpecConstantOp 198 68 92 - 94: 25(int) Constant 0 - 95: 6(int) SpecConstantOp 81 64 0 - 96: TypeVector 6(int) 2 - 97: 96(ivec2) SpecConstantOp 79 64 64 1(GLSL.std.450) 0 - 98: TypeVector 6(int) 3 - 99: 98(ivec3) SpecConstantOp 79 64 64 2 1(GLSL.std.450) 0 - 100: 62(ivec4) SpecConstantOp 79 64 64 1(GLSL.std.450) 2 0 3 + 10: TypePointer Function 6(int) + 12: 6(int) Constant 0 + 19: 6(int) SpecConstant 10 + 20: 6(int) Constant 2 + 21: 6(int) SpecConstantOp 128 19 20 + 22: TypeBool + 24: 6(int) SpecConstantOp 128 19 20 + 25: TypeArray 6(int) 24 + 26: TypePointer Function 25 + 29: 6(int) Constant 1023 + 32: 6(int) Constant 1 + 34: 6(int) SpecConstantOp 128 19 32 + 39: TypeFloat 32 + 40: 39(float) SpecConstant 1078530010 + 41: TypeInt 32 0 + 42: 41(int) SpecConstant 100 + 43: 6(int) SpecConstant 4294967286 + 44: 41(int) Constant 0 + 45: 22(bool) SpecConstantOp 171 19 44 + 46: 22(bool) SpecConstantOp 171 42 44 + 47: 6(int) SpecConstantOp 169 45 32 12 + 48: 41(int) Constant 1 + 49: 41(int) SpecConstantOp 169 45 48 44 + 50: 41(int) SpecConstantOp 128 43 44 + 51: 6(int) SpecConstantOp 128 42 12 + 52: 6(int) SpecConstantOp 126 19 + 53: 6(int) SpecConstantOp 200 19 + 54: 6(int) SpecConstantOp 128 19 20 + 55: 6(int) SpecConstantOp 128 19 20 + 56: 6(int) Constant 3 + 57: 6(int) SpecConstantOp 130 55 56 + 58: 6(int) Constant 4 + 59: 6(int) SpecConstantOp 130 54 58 + 60: 6(int) SpecConstantOp 132 43 20 + 61: 41(int) Constant 2 + 62: 41(int) SpecConstantOp 132 42 61 + 63: 6(int) Constant 5 + 64: 6(int) SpecConstantOp 135 60 63 + 65: 41(int) Constant 5 + 66: 41(int) SpecConstantOp 134 62 65 + 67: 6(int) SpecConstantOp 139 43 58 + 68: 41(int) Constant 4 + 69: 41(int) SpecConstantOp 137 42 68 + 70: 6(int) SpecConstantOp 132 43 56 + 71: 6(int) SpecConstantOp 135 70 63 + 72: 6(int) Constant 10 + 73: 6(int) SpecConstantOp 195 43 72 + 74: 6(int) Constant 20 + 75: 41(int) SpecConstantOp 194 42 74 + 76: 6(int) SpecConstantOp 196 43 32 + 77: 41(int) SpecConstantOp 196 42 20 + 78: 6(int) Constant 256 + 79: 6(int) SpecConstantOp 197 43 78 + 80: 41(int) Constant 512 + 81: 41(int) SpecConstantOp 198 42 80 + 82: 22(bool) SpecConstantOp 177 19 43 + 83: 22(bool) SpecConstantOp 170 42 42 + 84: 22(bool) SpecConstantOp 173 19 43 + 85: TypeVector 6(int) 4 + 86: 6(int) Constant 30 + 87: 85(ivec4) SpecConstantComposite 74 86 19 19 + 88: TypeVector 41(int) 4 + 89: 41(int) Constant 4294967295 + 90: 41(int) Constant 4294967294 + 91: 88(ivec4) SpecConstantComposite 42 42 89 90 + 92: TypeVector 39(float) 4 + 93: 39(float) Constant 1067450368 + 94: 92(fvec4) SpecConstantComposite 40 93 40 93 + 95: TypeVector 22(bool) 4 + 96: 88(ivec4) ConstantComposite 44 44 44 44 + 97: 95(bvec4) SpecConstantOp 171 87 96 + 98: 95(bvec4) SpecConstantOp 171 91 96 + 99: 85(ivec4) ConstantComposite 12 12 12 12 + 100: 85(ivec4) ConstantComposite 32 32 32 32 + 101: 85(ivec4) SpecConstantOp 169 97 100 99 + 102: 88(ivec4) ConstantComposite 48 48 48 48 + 103: 88(ivec4) SpecConstantOp 169 97 102 96 + 104: 88(ivec4) SpecConstantOp 128 87 96 + 105: 85(ivec4) SpecConstantOp 128 91 99 + 106: 85(ivec4) SpecConstantOp 200 87 + 107: 85(ivec4) SpecConstantOp 126 87 + 108: 85(ivec4) ConstantComposite 20 20 20 20 + 109: 85(ivec4) SpecConstantOp 128 87 108 + 110: 85(ivec4) SpecConstantOp 128 87 108 + 111: 85(ivec4) ConstantComposite 56 56 56 56 + 112: 85(ivec4) SpecConstantOp 130 110 111 + 113: 85(ivec4) ConstantComposite 58 58 58 58 + 114: 85(ivec4) SpecConstantOp 130 112 113 + 115: 85(ivec4) SpecConstantOp 132 87 108 + 116: 85(ivec4) ConstantComposite 63 63 63 63 + 117: 85(ivec4) SpecConstantOp 135 115 116 + 118: 85(ivec4) SpecConstantOp 139 87 113 + 119: 85(ivec4) ConstantComposite 72 72 72 72 + 120: 85(ivec4) SpecConstantOp 195 87 119 + 121: 85(ivec4) SpecConstantOp 196 87 108 + 122: 6(int) Constant 1024 + 123: 85(ivec4) ConstantComposite 122 122 122 122 + 124: 85(ivec4) SpecConstantOp 197 87 123 + 125: 41(int) Constant 2048 + 126: 88(ivec4) ConstantComposite 125 125 125 125 + 127: 88(ivec4) SpecConstantOp 198 91 126 + 128: 6(int) SpecConstantOp 81 87 0 + 129: TypeVector 6(int) 2 + 130: 129(ivec2) SpecConstantOp 79 87 87 1(GLSL.std.450) 0 + 131: TypeVector 6(int) 3 + 132: 131(ivec3) SpecConstantOp 79 87 87 2 1(GLSL.std.450) 0 + 133: 85(ivec4) SpecConstantOp 79 87 87 1(GLSL.std.450) 2 0 3 4(main): 2 Function None 3 5: Label Return FunctionEnd 8(non_const_array_size_from_spec_const(): 6(int) Function None 7 9: Label - 15(array): 14(ptr) Variable Function - 19: 18(ptr) AccessChain 15(array) 17 - 20: 6(int) Load 19 - ReturnValue 20 + 11(i): 10(ptr) Variable Function + 27(array): 26(ptr) Variable Function + Store 11(i) 12 + Branch 13 + 13: Label + LoopMerge 15 16 None + Branch 17 + 17: Label + 18: 6(int) Load 11(i) + 23: 22(bool) SLessThan 18 21 + BranchConditional 23 14 15 + 14: Label + 28: 6(int) Load 11(i) + 30: 10(ptr) AccessChain 27(array) 28 + Store 30 29 + Branch 16 + 16: Label + 31: 6(int) Load 11(i) + 33: 6(int) IAdd 31 32 + Store 11(i) 33 + Branch 13 + 15: Label + 35: 10(ptr) AccessChain 27(array) 34 + 36: 6(int) Load 35 + ReturnValue 36 FunctionEnd diff --git a/Test/spv.specConstantOperations.vert b/Test/spv.specConstantOperations.vert index 91920cf2..f2d57bf0 100644 --- a/Test/spv.specConstantOperations.vert +++ b/Test/spv.specConstantOperations.vert @@ -10,9 +10,15 @@ layout(constant_id = 203) const int sp_sint = -10; // Scalars // -// Size convert -//const double float_to_double = double(sp_float); -//const float double_to_float = float(float_to_double); +// uint/int <-> bool conversion +const bool bool_from_int = bool(sp_int); +const bool bool_from_uint = bool(sp_uint); +const int int_from_bool = int(bool_from_int); +const uint uint_from_bool = uint(bool_from_int); + +// uint <-> int +const uint sp_uint_from_sint = uint(sp_sint); +const int sp_sint_from_uint = int(sp_uint); // Negate and Not const int negate_int = -sp_int; @@ -54,9 +60,15 @@ const ivec4 iv = ivec4(20, 30, sp_int, sp_int); const uvec4 uv = uvec4(sp_uint, sp_uint, -1, -2); const vec4 fv = vec4(sp_float, 1.25, sp_float, 1.25); -// Size convert -//const dvec4 fv_to_dv = dvec4(fv); -//const vec4 dv_to_fv = vec4(fv_to_dv); +// uint/int <-> bool conversion +const bvec4 bv_from_iv = bvec4(iv); +const bvec4 bv_from_uv = bvec4(uv); +const ivec4 iv_from_bv = ivec4(bv_from_iv); +const uvec4 uv_from_bv = uvec4(bv_from_iv); + +// uint <-> int +const uvec4 uv_from_iv = uvec4(iv); +const ivec4 iv_from_uv = ivec4(uv); // Negate and Not const ivec4 not_iv = ~iv; @@ -88,6 +100,9 @@ const ivec4 iv_yzxw = iv.yzxw; int non_const_array_size_from_spec_const() { int array[sp_int + 2]; + for (int i = 0; i < sp_int + 2; i++) { + array[i] = 1023; + } return array[sp_int + 1]; } From 189b2033a44ae231fd6045f23778771cd6986f9c Mon Sep 17 00:00:00 2001 From: qining Date: Tue, 12 Apr 2016 23:16:20 -0400 Subject: [PATCH 032/140] Refine the code and address comments --- SPIRV/GlslangToSpv.cpp | 15 ++------------- SPIRV/SpvBuilder.cpp | 4 +++- .../spv.specConstantOperations.vert.out | 4 ++-- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 0240d8d4..39f3b8bc 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -3306,22 +3306,11 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Dec break; case glslang::EOpConvUintToInt: - if (builder.isInSpecConstCodeGenMode()) { - // Build zero scalar or vector for OpIAdd to do the conversion when - // generating for OpSpecConstantOp instruction. - zero = builder.makeIntConstant(0); - zero = makeSmearedConstant(zero, vectorSize); - } - // Don't 'break' here as this case should be grouped together with - // EOpConvIntToUint when generating normal run-time conversion - // instruction. case glslang::EOpConvIntToUint: if (builder.isInSpecConstCodeGenMode()) { // Build zero scalar or vector for OpIAdd. - if (zero == 0) { - zero = builder.makeUintConstant(0); - zero = makeSmearedConstant(zero, vectorSize); - } + zero = builder.makeUintConstant(0); + zero = makeSmearedConstant(zero, vectorSize); // Use OpIAdd, instead of OpBitcast to do the conversion when // generating for OpSpecConstantOp instruction. return builder.createBinOp(spv::OpIAdd, destType, operand, zero); diff --git a/SPIRV/SpvBuilder.cpp b/SPIRV/SpvBuilder.cpp index df87e9c2..7896deb4 100644 --- a/SPIRV/SpvBuilder.cpp +++ b/SPIRV/SpvBuilder.cpp @@ -1216,7 +1216,9 @@ Id Builder::createTriOp(Op opCode, Id typeId, Id op1, Id op2, Id op3) // generation mode. if (generatingOpCodeForSpecConst) { std::vector operands(3); - operands[0] = op1; operands[1] = op2; operands[2] = op3; + operands[0] = op1; + operands[1] = op2; + operands[2] = op3; return createSpecConstantOp( opCode, typeId, operands, std::vector()); } diff --git a/Test/baseResults/spv.specConstantOperations.vert.out b/Test/baseResults/spv.specConstantOperations.vert.out index 7544b32f..eedbea5c 100644 --- a/Test/baseResults/spv.specConstantOperations.vert.out +++ b/Test/baseResults/spv.specConstantOperations.vert.out @@ -50,7 +50,7 @@ Linked vertex stage: 48: 41(int) Constant 1 49: 41(int) SpecConstantOp 169 45 48 44 50: 41(int) SpecConstantOp 128 43 44 - 51: 6(int) SpecConstantOp 128 42 12 + 51: 6(int) SpecConstantOp 128 42 44 52: 6(int) SpecConstantOp 126 19 53: 6(int) SpecConstantOp 200 19 54: 6(int) SpecConstantOp 128 19 20 @@ -104,7 +104,7 @@ Linked vertex stage: 102: 88(ivec4) ConstantComposite 48 48 48 48 103: 88(ivec4) SpecConstantOp 169 97 102 96 104: 88(ivec4) SpecConstantOp 128 87 96 - 105: 85(ivec4) SpecConstantOp 128 91 99 + 105: 85(ivec4) SpecConstantOp 128 91 96 106: 85(ivec4) SpecConstantOp 200 87 107: 85(ivec4) SpecConstantOp 126 87 108: 85(ivec4) ConstantComposite 20 20 20 20 From 27e04a004dea9dd373de1e944551dc67c2eb73a1 Mon Sep 17 00:00:00 2001 From: qining Date: Thu, 14 Apr 2016 16:40:20 -0400 Subject: [PATCH 033/140] Fix spec const construtor for matrix and vector Fix issue: #237 1. The code generated for matrix constructor should 1) build column vectors first, 2) build matrix with the vectors. 2. When there is only one scalar type constituent in vector's constructor, we should populate the constituent to fill all the slots in the vector. As for matrix, the single constituent should be populated to the diagonal positions (top-left to bottom-right diagonal). remove createSpvConstantFromConstSubTree() --- SPIRV/GlslangToSpv.cpp | 73 ++-------------- SPIRV/SpvBuilder.cpp | 29 +++++-- SPIRV/SpvBuilder.h | 2 + .../spv.specConstantComposite.vert.out | 87 +++++++++++-------- .../spv.specConstantOperations.vert.out | 78 ++++++++--------- Test/spv.specConstantComposite.vert | 5 ++ 6 files changed, 127 insertions(+), 147 deletions(-) diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 39f3b8bc..9d4dc590 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -151,7 +151,6 @@ protected: void addMemberDecoration(spv::Id id, int member, spv::Decoration dec, unsigned value); spv::Id createSpvConstant(const glslang::TIntermTyped&); spv::Id createSpvConstantFromConstUnionArray(const glslang::TType& type, const glslang::TConstUnionArray&, int& nextConst, bool specConstant); - spv::Id createSpvConstantFromConstSubTree(glslang::TIntermTyped* subTree); bool isTrivialLeaf(const glslang::TIntermTyped* node); bool isTrivial(const glslang::TIntermTyped* node); spv::Id createShortCircuit(glslang::TOperator, glslang::TIntermTyped& left, glslang::TIntermTyped& right); @@ -1113,6 +1112,10 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TIntermAggregate* node) { + SpecConstantOpModeGuard spec_constant_op_mode_setter(&builder); + if (node->getType().getQualifier().isSpecConstant()) + spec_constant_op_mode_setter.turnOnSpecConstantOpMode(); + spv::Id result = spv::NoResult; // try texturing @@ -3814,7 +3817,11 @@ spv::Id TGlslangToSpvTraverser::createSpvConstant(const glslang::TIntermTyped& n // Its initializer should either be a sub tree with constant nodes, or a constant union array. if (auto* sn = node.getAsSymbolNode()) { if (auto* sub_tree = sn->getConstSubtree()) { - return createSpvConstantFromConstSubTree(sub_tree); + // Traverse the constant constructor sub tree like generating normal run-time instructions. + // During the AST traversal, if the node is marked as 'specConstant', SpecConstantOpModeGuard + // will set the builder into spec constant op instruction generating mode. + sub_tree->traverse(this); + return accessChainLoad(sub_tree->getType()); } else if (auto* const_union_array = &sn->getConstArray()){ int nextConst = 0; return createSpvConstantFromConstUnionArray(sn->getType(), *const_union_array, nextConst, true); @@ -3910,68 +3917,6 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstUnionArray(const glsla return builder.makeCompositeConstant(typeId, spvConsts); } -// Create constant ID from const initializer sub tree. -spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstSubTree( - glslang::TIntermTyped* subTree) -{ - const glslang::TType& glslangType = subTree->getType(); - spv::Id typeId = convertGlslangToSpvType(glslangType); - bool is_spec_const = subTree->getType().getQualifier().isSpecConstant(); - if (const glslang::TIntermAggregate* an = subTree->getAsAggregate()) { - // Aggregate node, we should generate OpConstantComposite or - // OpSpecConstantComposite instruction. - - std::vector const_constituents; - for (auto NI = an->getSequence().begin(); NI != an->getSequence().end(); - NI++) { - const_constituents.push_back( - createSpvConstantFromConstSubTree((*NI)->getAsTyped())); - } - // Note that constructors are aggregate nodes, so expressions like: - // float x = float(y) will become an aggregate node. If 'x' is declared - // as a constant, the aggregate node representing 'float(y)' will be - // processed here. - if (builder.isVectorType(typeId) || builder.isMatrixType(typeId) || - builder.isAggregateType(typeId)) { - return builder.makeCompositeConstant(typeId, const_constituents, is_spec_const); - } else { - assert(builder.isScalarType(typeId) && const_constituents.size() == 1); - return const_constituents.front(); - } - - } else if (glslang::TIntermBinary* bn = subTree->getAsBinaryNode()) { - // Binary operation node, we should generate OpSpecConstantOp - // This case should only happen when Specialization Constants are involved. - bn->traverse(this); - return accessChainLoad(bn->getType()); - - } else if (glslang::TIntermUnary* un = subTree->getAsUnaryNode()) { - // Unary operation node, similar to binary operation node, should only - // happen when specialization constants are involved. - un->traverse(this); - return accessChainLoad(un->getType()); - - } else if (const glslang::TIntermConstantUnion* cn = subTree->getAsConstantUnion()) { - // ConstantUnion node, should redirect to - // createSpvConstantFromConstUnionArray - int nextConst = 0; - return createSpvConstantFromConstUnionArray( - glslangType, cn->getConstArray(), nextConst, is_spec_const); - - } else if (const glslang::TIntermSymbol* sn = subTree->getAsSymbolNode()) { - // Symbol node. Call getSymbolId(). This should cover both cases 1) the - // symbol has already been assigned an ID, 2) need a new ID for this - // symbol. - return getSymbolId(sn); - - } else { - spv::MissingFunctionality( - "createSpvConstantFromConstSubTree() not covered TIntermTyped* const " - "initializer subtree."); - return spv::NoResult; - } -} - // Return true if the node is a constant or symbol whose reading has no // non-trivial observable cost or effect. bool TGlslangToSpvTraverser::isTrivialLeaf(const glslang::TIntermTyped* node) diff --git a/SPIRV/SpvBuilder.cpp b/SPIRV/SpvBuilder.cpp index 7896deb4..5768196c 100644 --- a/SPIRV/SpvBuilder.cpp +++ b/SPIRV/SpvBuilder.cpp @@ -645,6 +645,21 @@ bool Builder::isConstantOpCode(Op opcode) const } } +// Return true if consuming 'opcode' means consuming a specialization constant. +bool Builder::isSpecConstantOpCode(Op opcode) const +{ + switch (opcode) { + case OpSpecConstantTrue: + case OpSpecConstantFalse: + case OpSpecConstant: + case OpSpecConstantComposite: + case OpSpecConstantOp: + return true; + default: + return false; + } +} + Id Builder::makeBoolConstant(bool b, bool specConstant) { Id typeId = makeBoolType(); @@ -1345,13 +1360,9 @@ Id Builder::smearScalar(Decoration precision, Id scalar, Id vectorType) Instruction* smear = nullptr; if (generatingOpCodeForSpecConst) { auto members = std::vector(numComponents, scalar); - // 'scalar' can not be spec constant here. All spec constant involved - // promotion is done in createSpvConstantFromConstUnionArray(). This - // 'if' branch is only accessed when 'scalar' is used in the def-chain - // of other vector type spec constants. In such cases, all the - // instructions needed to promote 'scalar' to a vector type constants - // should be added at module level. - auto result_id = makeCompositeConstant(vectorType, members, false); + // "generatingOpCodeForSpecConst == true" does not mean the generated vector + // is a spec constant vector. It depends on the scalar. + auto result_id = makeCompositeConstant(vectorType, members, isSpecConstant(scalar)); smear = module.getInstruction(result_id); } else { smear = new Instruction(getUniqueId(), vectorType, OpCompositeConstruct); @@ -1714,6 +1725,10 @@ Id Builder::createCompositeConstruct(Id typeId, std::vector& constituents) { assert(isAggregateType(typeId) || (getNumTypeConstituents(typeId) > 1 && getNumTypeConstituents(typeId) == (int)constituents.size())); + if (generatingOpCodeForSpecConst) { + return makeCompositeConstant(typeId, constituents, true); + } + Instruction* op = new Instruction(getUniqueId(), typeId, OpCompositeConstruct); for (int c = 0; c < (int)constituents.size(); ++c) op->addIdOperand(constituents[c]); diff --git a/SPIRV/SpvBuilder.h b/SPIRV/SpvBuilder.h index 62f6775e..661bb115 100755 --- a/SPIRV/SpvBuilder.h +++ b/SPIRV/SpvBuilder.h @@ -147,8 +147,10 @@ public: bool isSampledImageType(Id typeId) const { return getTypeClass(typeId) == OpTypeSampledImage; } bool isConstantOpCode(Op opcode) const; + bool isSpecConstantOpCode(Op opcode) const; bool isConstant(Id resultId) const { return isConstantOpCode(getOpCode(resultId)); } bool isConstantScalar(Id resultId) const { return getOpCode(resultId) == OpConstant; } + bool isSpecConstant(Id resultId) const { return isSpecConstantOpCode(getOpCode(resultId)); } unsigned int getConstantScalar(Id resultId) const { return module.getInstruction(resultId)->getImmediateOperand(0); } StorageClass getStorageClass(Id resultId) const { return getTypeStorageClass(getTypeId(resultId)); } diff --git a/Test/baseResults/spv.specConstantComposite.vert.out b/Test/baseResults/spv.specConstantComposite.vert.out index 5e2dfa4a..4654c700 100644 --- a/Test/baseResults/spv.specConstantComposite.vert.out +++ b/Test/baseResults/spv.specConstantComposite.vert.out @@ -7,13 +7,13 @@ Linked vertex stage: // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 106 +// Id's are bound by 119 Capability Shader Capability Float64 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Vertex 4 "main" 27 105 + EntryPoint Vertex 4 "main" 27 118 Source GLSL 450 Name 4 "main" Name 6 "refer_primary_spec_const(" @@ -23,23 +23,23 @@ Linked vertex stage: Name 16 "refer_spec_const_array_length(" Name 18 "declare_spec_const_in_func(" Name 27 "color" - Name 41 "flat_struct" - MemberName 41(flat_struct) 0 "i" - MemberName 41(flat_struct) 1 "f" - MemberName 41(flat_struct) 2 "d" - MemberName 41(flat_struct) 3 "b" - Name 42 "nesting_struct" - MemberName 42(nesting_struct) 0 "nested" - MemberName 42(nesting_struct) 1 "v" - MemberName 42(nesting_struct) 2 "i" + Name 42 "flat_struct" + MemberName 42(flat_struct) 0 "i" + MemberName 42(flat_struct) 1 "f" + MemberName 42(flat_struct) 2 "d" + MemberName 42(flat_struct) 3 "b" + Name 44 "nesting_struct" + MemberName 44(nesting_struct) 0 "nested" + MemberName 44(nesting_struct) 1 "v" + MemberName 44(nesting_struct) 2 "i" Name 72 "indexable" Name 76 "indexable" Name 83 "len" - Name 105 "global_vec4_array_with_spec_length" + Name 118 "global_vec4_array_with_spec_length" Decorate 21 SpecId 203 Decorate 28 SpecId 200 Decorate 32 SpecId 201 - Decorate 43 SpecId 202 + Decorate 41 SpecId 202 2: TypeVoid 3: TypeFunction 2 14: TypeInt 32 1 @@ -56,40 +56,53 @@ Linked vertex stage: 36: 24(float) Constant 1133908460 37: 25(fvec4) SpecConstantComposite 32 32 36 36 40: TypeFloat 64 - 41(flat_struct): TypeStruct 14(int) 24(float) 40(float) 20(bool) -42(nesting_struct): TypeStruct 41(flat_struct) 25(fvec4) 14(int) - 43: 40(float) SpecConstant 1413754136 1074340347 - 44:41(flat_struct) SpecConstantComposite 28 32 43 21 - 45:42(nesting_struct) SpecConstantComposite 44 33 28 + 41: 40(float) SpecConstant 1413754136 1074340347 + 42(flat_struct): TypeStruct 14(int) 24(float) 40(float) 20(bool) + 43:42(flat_struct) SpecConstantComposite 28 32 41 21 +44(nesting_struct): TypeStruct 42(flat_struct) 25(fvec4) 14(int) + 45:44(nesting_struct) SpecConstantComposite 43 33 28 46: 14(int) Constant 2 51: TypeInt 32 0 52: 51(int) Constant 0 - 57: 51(int) Constant 5 - 58: TypeArray 24(float) 57 - 59: 24(float) Constant 1065353216 - 60: 24(float) Constant 1073741824 - 61: 24(float) Constant 1077936128 - 62: 58 SpecConstantComposite 32 32 59 60 61 + 57: 24(float) Constant 1065353216 + 58: 24(float) Constant 1073741824 + 59: 24(float) Constant 1077936128 + 60: 51(int) Constant 5 + 61: TypeArray 24(float) 60 + 62: 61 SpecConstantComposite 32 32 57 58 59 63: 14(int) Constant 1 - 68: TypeArray 14(int) 57 - 69: 14(int) Constant 30 - 70: 68 SpecConstantComposite 28 28 63 46 69 - 71: TypePointer Function 68 + 68: 14(int) Constant 30 + 69: TypeArray 14(int) 60 + 70: 69 SpecConstantComposite 28 28 63 46 68 + 71: TypePointer Function 69 73: TypePointer Function 14(int) 87: 24(float) Constant 1106321080 - 88:41(flat_struct) SpecConstantComposite 69 87 43 21 + 88:42(flat_struct) SpecConstantComposite 68 87 41 21 89: 14(int) Constant 10 - 90:42(nesting_struct) SpecConstantComposite 88 37 89 + 90:44(nesting_struct) SpecConstantComposite 88 37 89 96: 20(bool) ConstantFalse - 97:41(flat_struct) SpecConstantComposite 28 32 43 96 + 97:42(flat_struct) SpecConstantComposite 28 32 41 96 98: 24(float) Constant 1036831949 99: 25(fvec4) ConstantComposite 98 98 98 98 - 100:42(nesting_struct) SpecConstantComposite 97 99 28 - 101: 14(int) Constant 3000 - 102:42(nesting_struct) SpecConstantComposite 88 37 101 - 103: TypeArray 25(fvec4) 28 - 104: TypePointer Input 103 -105(global_vec4_array_with_spec_length): 104(ptr) Variable Input + 100:44(nesting_struct) SpecConstantComposite 97 99 28 + 101: 25(fvec4) SpecConstantComposite 32 32 32 32 + 102: 24(float) Constant 1066192077 + 103: 24(float) Constant 1074580685 + 104: 24(float) Constant 1079194419 + 105: TypeVector 24(float) 3 + 106: TypeMatrix 105(fvec3) 2 + 107: 24(float) Constant 0 + 108: 105(fvec3) SpecConstantComposite 32 32 32 + 109: 105(fvec3) SpecConstantComposite 102 103 104 + 110: 106 SpecConstantComposite 108 109 + 111: 105(fvec3) SpecConstantComposite 32 107 107 + 112: 105(fvec3) SpecConstantComposite 107 32 107 + 113: 106 SpecConstantComposite 111 112 + 114: 14(int) Constant 3000 + 115:44(nesting_struct) SpecConstantComposite 88 37 114 + 116: TypeArray 25(fvec4) 28 + 117: TypePointer Input 116 +118(global_vec4_array_with_spec_length): 117(ptr) Variable Input 4(main): 2 Function None 3 5: Label Return diff --git a/Test/baseResults/spv.specConstantOperations.vert.out b/Test/baseResults/spv.specConstantOperations.vert.out index eedbea5c..39de987d 100644 --- a/Test/baseResults/spv.specConstantOperations.vert.out +++ b/Test/baseResults/spv.specConstantOperations.vert.out @@ -84,55 +84,55 @@ Linked vertex stage: 82: 22(bool) SpecConstantOp 177 19 43 83: 22(bool) SpecConstantOp 170 42 42 84: 22(bool) SpecConstantOp 173 19 43 - 85: TypeVector 6(int) 4 - 86: 6(int) Constant 30 - 87: 85(ivec4) SpecConstantComposite 74 86 19 19 - 88: TypeVector 41(int) 4 - 89: 41(int) Constant 4294967295 - 90: 41(int) Constant 4294967294 - 91: 88(ivec4) SpecConstantComposite 42 42 89 90 - 92: TypeVector 39(float) 4 - 93: 39(float) Constant 1067450368 - 94: 92(fvec4) SpecConstantComposite 40 93 40 93 + 85: 6(int) Constant 30 + 86: TypeVector 6(int) 4 + 87: 86(ivec4) SpecConstantComposite 74 85 19 19 + 88: 41(int) Constant 4294967295 + 89: 41(int) Constant 4294967294 + 90: TypeVector 41(int) 4 + 91: 90(ivec4) SpecConstantComposite 42 42 88 89 + 92: 39(float) Constant 1067450368 + 93: TypeVector 39(float) 4 + 94: 93(fvec4) SpecConstantComposite 40 92 40 92 95: TypeVector 22(bool) 4 - 96: 88(ivec4) ConstantComposite 44 44 44 44 + 96: 90(ivec4) ConstantComposite 44 44 44 44 97: 95(bvec4) SpecConstantOp 171 87 96 98: 95(bvec4) SpecConstantOp 171 91 96 - 99: 85(ivec4) ConstantComposite 12 12 12 12 - 100: 85(ivec4) ConstantComposite 32 32 32 32 - 101: 85(ivec4) SpecConstantOp 169 97 100 99 - 102: 88(ivec4) ConstantComposite 48 48 48 48 - 103: 88(ivec4) SpecConstantOp 169 97 102 96 - 104: 88(ivec4) SpecConstantOp 128 87 96 - 105: 85(ivec4) SpecConstantOp 128 91 96 - 106: 85(ivec4) SpecConstantOp 200 87 - 107: 85(ivec4) SpecConstantOp 126 87 - 108: 85(ivec4) ConstantComposite 20 20 20 20 - 109: 85(ivec4) SpecConstantOp 128 87 108 - 110: 85(ivec4) SpecConstantOp 128 87 108 - 111: 85(ivec4) ConstantComposite 56 56 56 56 - 112: 85(ivec4) SpecConstantOp 130 110 111 - 113: 85(ivec4) ConstantComposite 58 58 58 58 - 114: 85(ivec4) SpecConstantOp 130 112 113 - 115: 85(ivec4) SpecConstantOp 132 87 108 - 116: 85(ivec4) ConstantComposite 63 63 63 63 - 117: 85(ivec4) SpecConstantOp 135 115 116 - 118: 85(ivec4) SpecConstantOp 139 87 113 - 119: 85(ivec4) ConstantComposite 72 72 72 72 - 120: 85(ivec4) SpecConstantOp 195 87 119 - 121: 85(ivec4) SpecConstantOp 196 87 108 + 99: 86(ivec4) ConstantComposite 12 12 12 12 + 100: 86(ivec4) ConstantComposite 32 32 32 32 + 101: 86(ivec4) SpecConstantOp 169 97 100 99 + 102: 90(ivec4) ConstantComposite 48 48 48 48 + 103: 90(ivec4) SpecConstantOp 169 97 102 96 + 104: 90(ivec4) SpecConstantOp 128 87 96 + 105: 86(ivec4) SpecConstantOp 128 91 96 + 106: 86(ivec4) SpecConstantOp 200 87 + 107: 86(ivec4) SpecConstantOp 126 87 + 108: 86(ivec4) ConstantComposite 20 20 20 20 + 109: 86(ivec4) SpecConstantOp 128 87 108 + 110: 86(ivec4) SpecConstantOp 128 87 108 + 111: 86(ivec4) ConstantComposite 56 56 56 56 + 112: 86(ivec4) SpecConstantOp 130 110 111 + 113: 86(ivec4) ConstantComposite 58 58 58 58 + 114: 86(ivec4) SpecConstantOp 130 112 113 + 115: 86(ivec4) SpecConstantOp 132 87 108 + 116: 86(ivec4) ConstantComposite 63 63 63 63 + 117: 86(ivec4) SpecConstantOp 135 115 116 + 118: 86(ivec4) SpecConstantOp 139 87 113 + 119: 86(ivec4) ConstantComposite 72 72 72 72 + 120: 86(ivec4) SpecConstantOp 195 87 119 + 121: 86(ivec4) SpecConstantOp 196 87 108 122: 6(int) Constant 1024 - 123: 85(ivec4) ConstantComposite 122 122 122 122 - 124: 85(ivec4) SpecConstantOp 197 87 123 + 123: 86(ivec4) ConstantComposite 122 122 122 122 + 124: 86(ivec4) SpecConstantOp 197 87 123 125: 41(int) Constant 2048 - 126: 88(ivec4) ConstantComposite 125 125 125 125 - 127: 88(ivec4) SpecConstantOp 198 91 126 + 126: 90(ivec4) ConstantComposite 125 125 125 125 + 127: 90(ivec4) SpecConstantOp 198 91 126 128: 6(int) SpecConstantOp 81 87 0 129: TypeVector 6(int) 2 130: 129(ivec2) SpecConstantOp 79 87 87 1(GLSL.std.450) 0 131: TypeVector 6(int) 3 132: 131(ivec3) SpecConstantOp 79 87 87 2 1(GLSL.std.450) 0 - 133: 85(ivec4) SpecConstantOp 79 87 87 1(GLSL.std.450) 2 0 3 + 133: 86(ivec4) SpecConstantOp 79 87 87 1(GLSL.std.450) 2 0 3 4(main): 2 Function None 3 5: Label Return diff --git a/Test/spv.specConstantComposite.vert b/Test/spv.specConstantComposite.vert index 4450ddd6..01103302 100644 --- a/Test/spv.specConstantComposite.vert +++ b/Test/spv.specConstantComposite.vert @@ -42,6 +42,11 @@ const vec4 spec_vec4_all_spec = vec4(spec_float, spec_float, spec_float, spec_float); const vec4 spec_vec4_partial_spec = vec4(spec_float, spec_float, 300.14, 300.14); +const vec4 spec_vec4_from_one_scalar = vec4(spec_float); + +// Matrix constructor +const mat2x3 spec_mat2x3 = mat2x3(spec_float, spec_float, spec_float, 1.1, 2.2, 3.3); +const mat2x3 spec_mat2x3_from_one_scalar = mat2x3(spec_float); // Struct nesting constructor const nesting_struct spec_nesting_struct_all_spec = { From 1f2820a3d3f510b1d1aeb80526c68505390192db Mon Sep 17 00:00:00 2001 From: qining Date: Thu, 14 Apr 2016 18:34:27 -0400 Subject: [PATCH 034/140] fix the problem that spec constant composite instruction being used when only front-end constants are used in the constructor --- SPIRV/SpvBuilder.cpp | 23 ++++++++++++++++--- .../spv.specConstantComposite.vert.out | 2 +- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/SPIRV/SpvBuilder.cpp b/SPIRV/SpvBuilder.cpp index 5768196c..bbb30c35 100644 --- a/SPIRV/SpvBuilder.cpp +++ b/SPIRV/SpvBuilder.cpp @@ -47,6 +47,7 @@ #include #include +#include #include "SpvBuilder.h" @@ -1360,8 +1361,14 @@ Id Builder::smearScalar(Decoration precision, Id scalar, Id vectorType) Instruction* smear = nullptr; if (generatingOpCodeForSpecConst) { auto members = std::vector(numComponents, scalar); - // "generatingOpCodeForSpecConst == true" does not mean the generated vector - // is a spec constant vector. It depends on the scalar. + // Sometime even in spec-constant-op mode, the temporary vector created by + // promoting a scalar might not be a spec constant. This should depend on + // the scalar. + // e.g.: + // const vec2 spec_const_result = a_spec_const_vec2 + a_front_end_const_scalar; + // In such cases, the temporary vector created from a_front_end_const_scalar + // is not a spec constant vector, even though the binary operation node is marked + // as 'specConstant' and we are in spec-constant-op mode. auto result_id = makeCompositeConstant(vectorType, members, isSpecConstant(scalar)); smear = module.getInstruction(result_id); } else { @@ -1726,7 +1733,17 @@ Id Builder::createCompositeConstruct(Id typeId, std::vector& constituents) assert(isAggregateType(typeId) || (getNumTypeConstituents(typeId) > 1 && getNumTypeConstituents(typeId) == (int)constituents.size())); if (generatingOpCodeForSpecConst) { - return makeCompositeConstant(typeId, constituents, true); + // Sometime, even in spec-constant-op mode, the constant composite to be + // constructed may not be a specialization constant. + // e.g.: + // const mat2 m2 = mat2(a_spec_const, a_front_end_const, another_front_end_const, third_front_end_const); + // The first column vector should be a spec constant one, as a_spec_const is a spec constant. + // The second column vector should NOT be spec constant, as it does not contain any spec constants. + // To handle such cases, we check the constituents of the constant vector to determine whether this + // vector should be created as a spec constant. + return makeCompositeConstant(typeId, constituents, + std::any_of(constituents.begin(), constituents.end(), + [&](spv::Id id) { return isSpecConstant(id); })); } Instruction* op = new Instruction(getUniqueId(), typeId, OpCompositeConstruct); diff --git a/Test/baseResults/spv.specConstantComposite.vert.out b/Test/baseResults/spv.specConstantComposite.vert.out index 4654c700..ac101f28 100644 --- a/Test/baseResults/spv.specConstantComposite.vert.out +++ b/Test/baseResults/spv.specConstantComposite.vert.out @@ -93,7 +93,7 @@ Linked vertex stage: 106: TypeMatrix 105(fvec3) 2 107: 24(float) Constant 0 108: 105(fvec3) SpecConstantComposite 32 32 32 - 109: 105(fvec3) SpecConstantComposite 102 103 104 + 109: 105(fvec3) ConstantComposite 102 103 104 110: 106 SpecConstantComposite 108 109 111: 105(fvec3) SpecConstantComposite 32 107 107 112: 105(fvec3) SpecConstantComposite 107 32 107 From 10223e886c130c23aba65168e344c2f6eb28657d Mon Sep 17 00:00:00 2001 From: David Neto Date: Thu, 21 Apr 2016 15:46:11 -0400 Subject: [PATCH 035/140] Remove use of std::mutex in gtest code. Gtest runs in single-threaded mode. So the GlslangInitializer object in the test code doesn't have to do its own synchronization. --- gtests/Initializer.h | 38 +++----------------------------------- 1 file changed, 3 insertions(+), 35 deletions(-) diff --git a/gtests/Initializer.h b/gtests/Initializer.h index e8fa30d1..3cd91a08 100644 --- a/gtests/Initializer.h +++ b/gtests/Initializer.h @@ -35,8 +35,6 @@ #ifndef GLSLANG_GTESTS_INITIALIZER_H #define GLSLANG_GTESTS_INITIALIZER_H -#include - #include "glslang/Public/ShaderLang.h" namespace glslangtest { @@ -63,55 +61,25 @@ public: // A token indicates that the glslang is reinitialized (if necessary) to the // required semantics. And that won't change until the token is destroyed. class InitializationToken { - public: - InitializationToken() : initializer(nullptr) {} - ~InitializationToken() - { - if (initializer) { - initializer->release(); - } - } - - InitializationToken(InitializationToken&& other) - : initializer(other.initializer) - { - other.initializer = nullptr; - } - - InitializationToken(const InitializationToken&) = delete; - - private: - InitializationToken(GlslangInitializer* initializer) - : initializer(initializer) {} - - friend class GlslangInitializer; - GlslangInitializer* initializer; }; - // Obtains exclusive access to the glslang state. The state remains - // exclusive until the Initialization Token has been destroyed. // Re-initializes glsl state iff the previous messages and the current - // messages are incompatible. + // messages are incompatible. We assume external synchronization, i.e. + // there is at most one acquired token at any one time. InitializationToken acquire(EShMessages new_messages) { - stateLock.lock(); - if ((lastMessages ^ new_messages) & (EShMsgVulkanRules | EShMsgSpvRules)) { glslang::FinalizeProcess(); glslang::InitializeProcess(); } lastMessages = new_messages; - return InitializationToken(this); + return InitializationToken(); } private: - void release() { stateLock.unlock(); } - - friend class InitializationToken; EShMessages lastMessages; - std::mutex stateLock; }; } // namespace glslangtest From c7d3656ddeb415e24e4b763ee55bc4ba6d445b21 Mon Sep 17 00:00:00 2001 From: Rex Xu Date: Wed, 27 Apr 2016 08:15:37 +0800 Subject: [PATCH 036/140] SPV: Use OpLogicalEqual/OpLogicalNotEqual for boolean type comparison. --- SPIRV/GlslangToSpv.cpp | 5 +++++ Test/baseResults/spv.Operations.frag.out | 4 ++-- Test/baseResults/spv.bool.vert.out | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 9d4dc590..07ed51cf 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -2633,6 +2633,7 @@ spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, spv { bool isUnsigned = typeProxy == glslang::EbtUint; bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble; + bool isBool = typeProxy == glslang::EbtBool; spv::Op binOp = spv::OpNop; bool needMatchingVectors = true; // for non-matrix ops, would a scalar need to smear to match a vector? @@ -2820,6 +2821,8 @@ spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, spv case glslang::EOpVectorEqual: if (isFloat) binOp = spv::OpFOrdEqual; + else if (isBool) + binOp = spv::OpLogicalEqual; else binOp = spv::OpIEqual; break; @@ -2827,6 +2830,8 @@ spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, spv case glslang::EOpVectorNotEqual: if (isFloat) binOp = spv::OpFOrdNotEqual; + else if (isBool) + binOp = spv::OpLogicalNotEqual; else binOp = spv::OpINotEqual; break; diff --git a/Test/baseResults/spv.Operations.frag.out b/Test/baseResults/spv.Operations.frag.out index a5863729..f8b666d5 100755 --- a/Test/baseResults/spv.Operations.frag.out +++ b/Test/baseResults/spv.Operations.frag.out @@ -470,7 +470,7 @@ Linked fragment stage: 339: Label 341: 179(bvec4) Load 181(ub41) 343: 179(bvec4) Load 342(ub42) - 344: 179(bvec4) IEqual 341 343 + 344: 179(bvec4) LogicalEqual 341 343 345: 178(bool) Any 344 Branch 340 340: Label @@ -482,7 +482,7 @@ Linked fragment stage: 348: Label 350: 179(bvec4) Load 181(ub41) 351: 179(bvec4) Load 342(ub42) - 352: 179(bvec4) INotEqual 350 351 + 352: 179(bvec4) LogicalNotEqual 350 351 353: 178(bool) Any 352 Branch 349 349: Label diff --git a/Test/baseResults/spv.bool.vert.out b/Test/baseResults/spv.bool.vert.out index f11fe398..b6960f94 100644 --- a/Test/baseResults/spv.bool.vert.out +++ b/Test/baseResults/spv.bool.vert.out @@ -91,6 +91,6 @@ Linked vertex stage: 9(b): 7(ptr) FunctionParameter 11: Label 12: 6(bool) Load 9(b) - 14: 6(bool) INotEqual 12 13 + 14: 6(bool) LogicalNotEqual 12 13 ReturnValue 14 FunctionEnd From 19647a32b952b88ce6ee37073ba84e37cdad0c6f Mon Sep 17 00:00:00 2001 From: qining Date: Mon, 11 Apr 2016 19:12:17 -0400 Subject: [PATCH 037/140] Fix the infinite loop when an input file lacks EOF The input scanner can be trapped in an infinite loop if the given input file does not have EOF (and is not ended with a 'whitespace'). The problem is caused by unget(), which keeps rolling back the scanner pointer without hitting an EOF at the end of the file. This makes getch() function keep returning the last character of the file and never ends, and the effect of advance() is always counteracted by unget(). --- .../baseResults/preprocessor.eof_missing.vert.out | 2 ++ Test/preprocessor.eof_missing.vert | 1 + Test/test-preprocessor-list | 1 + glslang/MachineIndependent/Scan.h | 15 ++++++++++----- 4 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 Test/baseResults/preprocessor.eof_missing.vert.out create mode 100644 Test/preprocessor.eof_missing.vert diff --git a/Test/baseResults/preprocessor.eof_missing.vert.out b/Test/baseResults/preprocessor.eof_missing.vert.out new file mode 100644 index 00000000..bf09d53e --- /dev/null +++ b/Test/baseResults/preprocessor.eof_missing.vert.out @@ -0,0 +1,2 @@ +noEOF + diff --git a/Test/preprocessor.eof_missing.vert b/Test/preprocessor.eof_missing.vert new file mode 100644 index 00000000..91773148 --- /dev/null +++ b/Test/preprocessor.eof_missing.vert @@ -0,0 +1 @@ +noEOF \ No newline at end of file diff --git a/Test/test-preprocessor-list b/Test/test-preprocessor-list index 80d4b225..bd7e963b 100644 --- a/Test/test-preprocessor-list +++ b/Test/test-preprocessor-list @@ -13,3 +13,4 @@ preprocessor.simple.vert preprocessor.success_if_parse_would_fail.vert preprocessor.defined.vert preprocessor.many.endif.vert +preprocessor.eof_missing.vert diff --git a/glslang/MachineIndependent/Scan.h b/glslang/MachineIndependent/Scan.h index 219049be..5532fc31 100644 --- a/glslang/MachineIndependent/Scan.h +++ b/glslang/MachineIndependent/Scan.h @@ -54,7 +54,7 @@ public: TInputScanner(int n, const char* const s[], size_t L[], const char* const* names = nullptr, int b = 0, int f = 0, bool single = false) : numSources(n), sources(reinterpret_cast(s)), // up to this point, common usage is "char*", but now we need positive 8-bit characters - lengths(L), currentSource(0), currentChar(0), stringBias(b), finale(f), singleLogical(single) + lengths(L), currentSource(0), currentChar(0), stringBias(b), finale(f), singleLogical(single), endOfFileReached(false) { loc = new TSourceLoc[numSources]; for (int i = 0; i < numSources; ++i) { @@ -81,10 +81,8 @@ public: // retrieve the next character and advance one character int get() { - if (currentSource >= numSources) - return EndOfInput; - int ret = peek(); + if (ret == EndOfInput) return ret; ++loc[currentSource].column; ++logicalSourceLoc.column; if (ret == '\n') { @@ -101,8 +99,10 @@ public: // retrieve the next character, no advance int peek() { - if (currentSource >= numSources) + if (currentSource >= numSources) { + endOfFileReached = true; return EndOfInput; + } // Make sure we do not read off the end of a string. // N.B. Sources can have a length of 0. int sourceToRead = currentSource; @@ -122,6 +122,9 @@ public: // go back one character void unget() { + // Do not roll back if we reached the end of the file. + if (endOfFileReached) return; + if (currentChar > 0) { --currentChar; --loc[currentSource].column; @@ -251,6 +254,8 @@ protected: TSourceLoc logicalSourceLoc; bool singleLogical; // treats the strings as a single logical string. // locations will be reported from the first string. + + bool endOfFileReached; // set to true once peak() returns EndOfFile. }; } // end namespace glslang From 94a89d51f353c330cddf4112803d21a99a55225c Mon Sep 17 00:00:00 2001 From: qining Date: Wed, 27 Apr 2016 10:17:30 -0400 Subject: [PATCH 038/140] add .err file for eof_missing test --- Test/baseResults/preprocessor.eof_missing.vert.err | 0 glslang/MachineIndependent/Scan.h | 6 ++++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 Test/baseResults/preprocessor.eof_missing.vert.err diff --git a/Test/baseResults/preprocessor.eof_missing.vert.err b/Test/baseResults/preprocessor.eof_missing.vert.err new file mode 100644 index 00000000..e69de29b diff --git a/glslang/MachineIndependent/Scan.h b/glslang/MachineIndependent/Scan.h index 5532fc31..1cc437cb 100644 --- a/glslang/MachineIndependent/Scan.h +++ b/glslang/MachineIndependent/Scan.h @@ -122,7 +122,7 @@ public: // go back one character void unget() { - // Do not roll back if we reached the end of the file. + // Do not roll back once we've reached the end of the file. if (endOfFileReached) return; if (currentChar > 0) { @@ -255,7 +255,9 @@ protected: bool singleLogical; // treats the strings as a single logical string. // locations will be reported from the first string. - bool endOfFileReached; // set to true once peak() returns EndOfFile. + // set to true once peak() returns EndOfFile, so that we won't roll back + // once we've reached EndOfFile. + bool endOfFileReached; }; } // end namespace glslang From 00422441ea16da57250e6f3df28f52d941ad40e5 Mon Sep 17 00:00:00 2001 From: David Yen Date: Fri, 29 Apr 2016 10:38:52 -0700 Subject: [PATCH 039/140] Added missing headers to SetupLinux.sh and index.php. Some license information were missing for some of the files, I have added the proper licensing information as well as author information for both files. --- SetupLinux.sh | 37 +++++++++++++++++++++++++++++++++++++ index.php | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) diff --git a/SetupLinux.sh b/SetupLinux.sh index 2a6ff6a4..b0c39793 100755 --- a/SetupLinux.sh +++ b/SetupLinux.sh @@ -1,4 +1,41 @@ #!/bin/bash +# Copyright (C) 2014-2015 LunarG, 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. + +# +# Author: John Kessenich, LunarG +# + rm -rf build mkdir build pushd build diff --git a/index.php b/index.php index 9a4bbcd9..df13df3e 100644 --- a/index.php +++ b/index.php @@ -1,3 +1,41 @@ + From 8ff43de89133e33d96ba165872d7c37e1aec3a12 Mon Sep 17 00:00:00 2001 From: Rex Xu Date: Fri, 22 Apr 2016 16:51:45 +0800 Subject: [PATCH 040/140] Implement the extension GL_ARB_gpu_shader_int64 - Add new keyword int64_t/uint64_t/i64vec/u64vec. - Support 64-bit integer literals (dec/hex/oct). - Support built-in operators for 64-bit integer type. - Add implicit and explicit type conversion for 64-bit integer type. - Add new built-in functions defined in this extension. --- SPIRV/GlslangToSpv.cpp | 144 +- SPIRV/SpvBuilder.cpp | 27 +- SPIRV/SpvBuilder.h | 3 + Test/baseResults/spv.int64.frag.out | 629 ++ Test/spv.int64.frag | 228 + Test/test-spirv-list | 1 + glslang/Include/BaseTypes.h | 2 + glslang/Include/ConstantUnion.h | 176 +- glslang/Include/Types.h | 6 + glslang/Include/intermediate.h | 38 + glslang/MachineIndependent/Constant.cpp | 78 +- glslang/MachineIndependent/Initialize.cpp | 150 + glslang/MachineIndependent/Intermediate.cpp | 183 +- glslang/MachineIndependent/ParseHelper.cpp | 48 +- glslang/MachineIndependent/Scan.cpp | 31 +- glslang/MachineIndependent/SymbolTable.cpp | 2 + glslang/MachineIndependent/Versions.cpp | 13 + glslang/MachineIndependent/Versions.h | 1 + glslang/MachineIndependent/gl_types.h | 10 + glslang/MachineIndependent/glslang.y | 62 +- glslang/MachineIndependent/glslang_tab.cpp | 5504 +++++++++-------- glslang/MachineIndependent/glslang_tab.cpp.h | 520 +- glslang/MachineIndependent/intermOut.cpp | 57 + glslang/MachineIndependent/linkValidate.cpp | 2 + .../MachineIndependent/localintermediate.h | 2 + glslang/MachineIndependent/parseVersions.h | 1 + .../MachineIndependent/preprocessor/Pp.cpp | 5 +- .../preprocessor/PpContext.h | 1 + .../preprocessor/PpScanner.cpp | 111 +- .../preprocessor/PpTokens.cpp | 14 + .../preprocessor/PpTokens.h | 2 + glslang/MachineIndependent/reflection.cpp | 4 + gtests/Spv.FromFile.cpp | 1 + 33 files changed, 5047 insertions(+), 3009 deletions(-) create mode 100644 Test/baseResults/spv.int64.frag.out create mode 100644 Test/spv.int64.frag diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 07ed51cf..0c62d52e 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -1069,9 +1069,13 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI case glslang::EOpPreDecrement: { // we need the integer value "1" or the floating point "1.0" to add/subtract - spv::Id one = node->getBasicType() == glslang::EbtFloat ? - builder.makeFloatConstant(1.0F) : - builder.makeIntConstant(1); + spv::Id one = 0; + if (node->getBasicType() == glslang::EbtFloat) + one = builder.makeFloatConstant(1.0F); + else if (node->getBasicType() == glslang::EbtInt64 || node->getBasicType() == glslang::EbtUint64) + one = builder.makeInt64Constant(1); + else + one = builder.makeIntConstant(1); glslang::TOperator op; if (node->getOp() == glslang::EOpPreIncrement || node->getOp() == glslang::EOpPostIncrement) @@ -1080,8 +1084,8 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI op = glslang::EOpSub; spv::Id result = createBinaryOperation(op, TranslatePrecisionDecoration(node->getType()), - convertGlslangToSpvType(node->getType()), operand, one, - node->getType().getBasicType()); + convertGlslangToSpvType(node->getType()), operand, one, + node->getType().getBasicType()); assert(result != spv::NoResult); // The result of operation is always stored, but conditionally the @@ -1260,6 +1264,14 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt case glslang::EOpConstructUVec2: case glslang::EOpConstructUVec3: case glslang::EOpConstructUVec4: + case glslang::EOpConstructInt64: + case glslang::EOpConstructI64Vec2: + case glslang::EOpConstructI64Vec3: + case glslang::EOpConstructI64Vec4: + case glslang::EOpConstructUint64: + case glslang::EOpConstructU64Vec2: + case glslang::EOpConstructU64Vec3: + case glslang::EOpConstructU64Vec4: case glslang::EOpConstructStruct: case glslang::EOpConstructTextureSampler: { @@ -1740,6 +1752,14 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty case glslang::EbtUint: spvType = builder.makeUintType(32); break; + case glslang::EbtInt64: + builder.addCapability(spv::CapabilityInt64); + spvType = builder.makeIntType(64); + break; + case glslang::EbtUint64: + builder.addCapability(spv::CapabilityInt64); + spvType = builder.makeUintType(64); + break; case glslang::EbtAtomicUint: spv::TbdFunctionality("Is atomic_uint an opaque handle in the uniform storage class, or an addresses in the atomic storage class?"); spvType = builder.makeUintType(32); @@ -2631,7 +2651,7 @@ spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, spv spv::Id typeId, spv::Id left, spv::Id right, glslang::TBasicType typeProxy, bool reduceComparison) { - bool isUnsigned = typeProxy == glslang::EbtUint; + bool isUnsigned = typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64; bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble; bool isBool = typeProxy == glslang::EbtBool; @@ -2948,7 +2968,7 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv: { spv::Op unaryOp = spv::OpNop; int libCall = -1; - bool isUnsigned = typeProxy == glslang::EbtUint; + bool isUnsigned = typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64; bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble; switch (op) { @@ -3079,6 +3099,10 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv: case glslang::EOpFloatBitsToUint: case glslang::EOpIntBitsToFloat: case glslang::EOpUintBitsToFloat: + case glslang::EOpDoubleBitsToInt64: + case glslang::EOpDoubleBitsToUint64: + case glslang::EOpInt64BitsToDouble: + case glslang::EOpUint64BitsToDouble: unaryOp = spv::OpBitcast; break; @@ -3119,6 +3143,14 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv: libCall = spv::GLSLstd450UnpackDouble2x32; break; + case glslang::EOpPackInt2x32: + case glslang::EOpUnpackInt2x32: + case glslang::EOpPackUint2x32: + case glslang::EOpUnpackUint2x32: + spv::MissingFunctionality("shader int64"); + libCall = spv::GLSLstd450Bad; // TODO: This is a placeholder. + break; + case glslang::EOpDPdx: unaryOp = spv::OpDPdx; break; @@ -3252,13 +3284,17 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Dec spv::Op convOp = spv::OpNop; spv::Id zero = 0; spv::Id one = 0; + spv::Id type = 0; int vectorSize = builder.isVectorType(destType) ? builder.getNumTypeComponents(destType) : 0; switch (op) { case glslang::EOpConvIntToBool: case glslang::EOpConvUintToBool: - zero = builder.makeUintConstant(0); + case glslang::EOpConvInt64ToBool: + case glslang::EOpConvUint64ToBool: + zero = (op == glslang::EOpConvInt64ToBool || + op == glslang::EOpConvUint64ToBool) ? builder.makeUint64Constant(0) : builder.makeUintConstant(0); zero = makeSmearedConstant(zero, vectorSize); return builder.createBinOp(spv::OpINotEqual, destType, operand, zero); @@ -3283,23 +3319,29 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Dec one = builder.makeDoubleConstant(1.0); break; case glslang::EOpConvBoolToInt: - zero = builder.makeIntConstant(0); - one = builder.makeIntConstant(1); + case glslang::EOpConvBoolToInt64: + zero = (op == glslang::EOpConvBoolToInt64) ? builder.makeInt64Constant(0) : builder.makeIntConstant(0); + one = (op == glslang::EOpConvBoolToInt64) ? builder.makeInt64Constant(1) : builder.makeIntConstant(1); convOp = spv::OpSelect; break; case glslang::EOpConvBoolToUint: - zero = builder.makeUintConstant(0); - one = builder.makeUintConstant(1); + case glslang::EOpConvBoolToUint64: + zero = (op == glslang::EOpConvBoolToUint64) ? builder.makeUint64Constant(0) : builder.makeUintConstant(0); + one = (op == glslang::EOpConvBoolToUint64) ? builder.makeUint64Constant(1) : builder.makeUintConstant(1); convOp = spv::OpSelect; break; case glslang::EOpConvIntToFloat: case glslang::EOpConvIntToDouble: + case glslang::EOpConvInt64ToFloat: + case glslang::EOpConvInt64ToDouble: convOp = spv::OpConvertSToF; break; case glslang::EOpConvUintToFloat: case glslang::EOpConvUintToDouble: + case glslang::EOpConvUint64ToFloat: + case glslang::EOpConvUint64ToDouble: convOp = spv::OpConvertUToF; break; @@ -3310,14 +3352,19 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Dec case glslang::EOpConvFloatToInt: case glslang::EOpConvDoubleToInt: + case glslang::EOpConvFloatToInt64: + case glslang::EOpConvDoubleToInt64: convOp = spv::OpConvertFToS; break; case glslang::EOpConvUintToInt: case glslang::EOpConvIntToUint: + case glslang::EOpConvUint64ToInt64: + case glslang::EOpConvInt64ToUint64: if (builder.isInSpecConstCodeGenMode()) { // Build zero scalar or vector for OpIAdd. - zero = builder.makeUintConstant(0); + zero = (op == glslang::EOpConvUintToInt64 || + op == glslang::EOpConvIntToUint64) ? builder.makeUint64Constant(0) : builder.makeUintConstant(0); zero = makeSmearedConstant(zero, vectorSize); // Use OpIAdd, instead of OpBitcast to do the conversion when // generating for OpSpecConstantOp instruction. @@ -3329,8 +3376,65 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Dec case glslang::EOpConvFloatToUint: case glslang::EOpConvDoubleToUint: + case glslang::EOpConvFloatToUint64: + case glslang::EOpConvDoubleToUint64: convOp = spv::OpConvertFToU; break; + + case glslang::EOpConvIntToInt64: + case glslang::EOpConvInt64ToInt: + convOp = spv::OpSConvert; + break; + + case glslang::EOpConvUintToUint64: + case glslang::EOpConvUint64ToUint: + convOp = spv::OpUConvert; + break; + + case glslang::EOpConvIntToUint64: + case glslang::EOpConvInt64ToUint: + case glslang::EOpConvUint64ToInt: + case glslang::EOpConvUintToInt64: + // OpSConvert/OpUConvert + OpBitCast + switch (op) { + case glslang::EOpConvIntToUint64: + convOp = spv::OpSConvert; + type = builder.makeIntType(64); + break; + case glslang::EOpConvInt64ToUint: + convOp = spv::OpSConvert; + type = builder.makeIntType(32); + break; + case glslang::EOpConvUint64ToInt: + convOp = spv::OpUConvert; + type = builder.makeUintType(32); + break; + case glslang::EOpConvUintToInt64: + convOp = spv::OpUConvert; + type = builder.makeUintType(64); + break; + default: + assert(0); + break; + } + + if (vectorSize > 0) + type = builder.makeVectorType(type, vectorSize); + + operand = builder.createUnaryOp(convOp, type, operand); + + if (builder.isInSpecConstCodeGenMode()) { + // Build zero scalar or vector for OpIAdd. + zero = (op == glslang::EOpConvIntToUint64 || + op == glslang::EOpConvUintToInt64) ? builder.makeUint64Constant(0) : builder.makeUintConstant(0); + zero = makeSmearedConstant(zero, vectorSize); + // Use OpIAdd, instead of OpBitcast to do the conversion when + // generating for OpSpecConstantOp instruction. + return builder.createBinOp(spv::OpIAdd, destType, operand, zero); + } + // For normal run-time conversion instruction, use OpBitcast. + convOp = spv::OpBitcast; + break; default: break; } @@ -3441,7 +3545,7 @@ spv::Id TGlslangToSpvTraverser::createAtomicOperation(glslang::TOperator op, spv spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, std::vector& operands, glslang::TBasicType typeProxy) { - bool isUnsigned = typeProxy == glslang::EbtUint; + bool isUnsigned = typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64; bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble; spv::Op opCode = spv::OpNop; @@ -3876,6 +3980,12 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstUnionArray(const glsla 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; @@ -3902,6 +4012,12 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstUnionArray(const glsla 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; diff --git a/SPIRV/SpvBuilder.cpp b/SPIRV/SpvBuilder.cpp index bbb30c35..0171b15e 100644 --- a/SPIRV/SpvBuilder.cpp +++ b/SPIRV/SpvBuilder.cpp @@ -606,7 +606,7 @@ Id Builder::findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned valu return 0; } -// Version of findScalarConstant (see above) for scalars that take two operands (e.g. a 'double'). +// Version of findScalarConstant (see above) for scalars that take two operands (e.g. a 'double' or 'int64'). Id Builder::findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned v1, unsigned v2) const { Instruction* constant; @@ -711,6 +711,31 @@ Id Builder::makeIntConstant(Id typeId, unsigned value, bool specConstant) return c->getResultId(); } +Id Builder::makeInt64Constant(Id typeId, unsigned long long value, bool specConstant) +{ + Op opcode = specConstant ? OpSpecConstant : OpConstant; + + unsigned op1 = value & 0xFFFFFFFF; + unsigned op2 = value >> 32; + + // See if we already made it. Applies only to regular constants, because specialization constants + // must remain distinct for the purpose of applying a SpecId decoration. + if (! specConstant) { + Id existing = findScalarConstant(OpTypeInt, opcode, typeId, op1, op2); + if (existing) + return existing; + } + + Instruction* c = new Instruction(getUniqueId(), typeId, opcode); + c->addImmediateOperand(op1); + c->addImmediateOperand(op2); + constantsTypesGlobals.push_back(std::unique_ptr(c)); + groupedConstants[OpTypeInt].push_back(c); + module.mapInstruction(c); + + return c->getResultId(); +} + Id Builder::makeFloatConstant(float f, bool specConstant) { Op opcode = specConstant ? OpSpecConstant : OpConstant; diff --git a/SPIRV/SpvBuilder.h b/SPIRV/SpvBuilder.h index 661bb115..8c05f4e5 100755 --- a/SPIRV/SpvBuilder.h +++ b/SPIRV/SpvBuilder.h @@ -188,6 +188,8 @@ public: Id makeBoolConstant(bool b, bool specConstant = false); Id makeIntConstant(int i, bool specConstant = false) { return makeIntConstant(makeIntType(32), (unsigned)i, specConstant); } Id makeUintConstant(unsigned u, bool specConstant = false) { return makeIntConstant(makeUintType(32), u, specConstant); } + Id makeInt64Constant(long long i, bool specConstant = false) { return makeInt64Constant(makeIntType(64), (unsigned long long)i, specConstant); } + Id makeUint64Constant(unsigned long long u, bool specConstant = false) { return makeInt64Constant(makeUintType(64), u, specConstant); } Id makeFloatConstant(float f, bool specConstant = false); Id makeDoubleConstant(double d, bool specConstant = false); @@ -533,6 +535,7 @@ public: protected: Id makeIntConstant(Id typeId, unsigned value, bool specConstant); + Id makeInt64Constant(Id typeId, unsigned long long value, bool specConstant); Id findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned value) const; Id findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned v1, unsigned v2) const; Id findCompositeConstant(Op typeClass, std::vector& comps) const; diff --git a/Test/baseResults/spv.int64.frag.out b/Test/baseResults/spv.int64.frag.out new file mode 100644 index 00000000..5088469e --- /dev/null +++ b/Test/baseResults/spv.int64.frag.out @@ -0,0 +1,629 @@ +spv.int64.frag +Warning, version 450 is not yet complete; most version-specific features are present, but some are missing. + + +Linked fragment stage: + + +Missing functionality: shader int64 +Missing functionality: shader int64 +Missing functionality: shader int64 +Missing functionality: shader int64 +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 455 + + Capability Shader + Capability Float64 + Capability Int64 + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + SourceExtension "GL_ARB_gpu_shader_int64" + Name 4 "main" + Name 6 "literal(" + Name 8 "typeCast(" + Name 10 "operators(" + Name 12 "builtinFuncs(" + Name 16 "i64" + Name 24 "Uniforms" + MemberName 24(Uniforms) 0 "index" + Name 26 "" + Name 33 "indexable" + Name 38 "u64" + Name 47 "indexable" + Name 52 "i64v" + Name 56 "bv" + Name 65 "u64v" + Name 74 "iv" + Name 81 "uv" + Name 89 "fv" + Name 95 "dv" + Name 132 "u64v" + Name 137 "i64" + Name 157 "i" + Name 164 "uv" + Name 216 "b" + Name 276 "i64v" + Name 279 "i64" + Name 289 "u64v" + Name 291 "u64" + Name 363 "dv" + Name 382 "iv" + Name 387 "uv" + Name 391 "bv" + Name 452 "Block" + MemberName 452(Block) 0 "i64v" + MemberName 452(Block) 1 "u64" + Name 454 "block" + MemberDecorate 24(Uniforms) 0 Offset 0 + Decorate 24(Uniforms) Block + Decorate 26 DescriptorSet 0 + Decorate 26 Binding 0 + MemberDecorate 452(Block) 0 Offset 0 + MemberDecorate 452(Block) 1 Offset 24 + Decorate 452(Block) Block + Decorate 454(block) DescriptorSet 0 + Decorate 454(block) Binding 1 + 2: TypeVoid + 3: TypeFunction 2 + 14: TypeInt 64 1 + 15: TypePointer Function 14(int) + 17: TypeInt 32 0 + 18: 17(int) Constant 3 + 19: TypeArray 14(int) 18 + 20: 14(int) Constant 4008636143 4008636142 + 21: 14(int) Constant 4294967295 4294967295 + 22: 14(int) Constant 0 1 + 23: 19 ConstantComposite 20 21 22 + 24(Uniforms): TypeStruct 17(int) + 25: TypePointer Uniform 24(Uniforms) + 26: 25(ptr) Variable Uniform + 27: TypeInt 32 1 + 28: 27(int) Constant 0 + 29: TypePointer Uniform 17(int) + 32: TypePointer Function 19 + 36: TypeInt 64 0 + 37: TypePointer Function 36(int) + 39: TypeArray 36(int) 18 + 40: 36(int) Constant 4294967295 4294967295 + 41: 36(int) Constant 0 1 + 42: 36(int) Constant 4294967295 1 + 43: 39 ConstantComposite 40 41 42 + 46: TypePointer Function 39 + 50: TypeVector 14(int) 2 + 51: TypePointer Function 50(ivec2) + 53: TypeBool + 54: TypeVector 53(bool) 2 + 55: TypePointer Function 54(bvec2) + 58: 14(int) Constant 0 0 + 59: 14(int) Constant 1 0 + 60: 50(ivec2) ConstantComposite 58 58 + 61: 50(ivec2) ConstantComposite 59 59 + 63: TypeVector 36(int) 2 + 64: TypePointer Function 63(ivec2) + 67: 36(int) Constant 0 0 + 68: 36(int) Constant 1 0 + 69: 63(ivec2) ConstantComposite 67 67 + 70: 63(ivec2) ConstantComposite 68 68 + 72: TypeVector 27(int) 2 + 73: TypePointer Function 72(ivec2) + 79: TypeVector 17(int) 2 + 80: TypePointer Function 79(ivec2) + 86: TypeFloat 32 + 87: TypeVector 86(float) 2 + 88: TypePointer Function 87(fvec2) + 92: TypeFloat 64 + 93: TypeVector 92(float) 2 + 94: TypePointer Function 93(fvec2) + 130: TypeVector 36(int) 3 + 131: TypePointer Function 130(ivec3) + 134: TypeVector 14(int) 3 + 156: TypePointer Function 27(int) + 162: TypeVector 17(int) 3 + 163: TypePointer Function 162(ivec3) + 197: TypeVector 27(int) 3 + 200: 17(int) Constant 1 + 201: TypePointer Function 17(int) + 207: 17(int) Constant 2 + 215: TypePointer Function 53(bool) + 217: 17(int) Constant 0 + 287: 50(ivec2) ConstantComposite 21 21 + 296: 130(ivec3) ConstantComposite 67 67 67 + 338: 53(bool) ConstantTrue + 345: 53(bool) ConstantFalse + 346: 54(bvec2) ConstantComposite 345 345 + 358: TypeVector 53(bool) 3 + 359: 358(bvec3) ConstantComposite 345 345 345 + 361: TypeVector 92(float) 3 + 362: TypePointer Function 361(fvec3) + 367: TypePointer Function 92(float) + 378: 27(int) Constant 1 + 379: 27(int) Constant 2 + 380: 72(ivec2) ConstantComposite 378 379 + 385: 79(ivec2) ConstantComposite 207 18 + 390: TypePointer Function 358(bvec3) + 452(Block): TypeStruct 134(ivec3) 36(int) + 453: TypePointer Uniform 452(Block) + 454(block): 453(ptr) Variable Uniform + 4(main): 2 Function None 3 + 5: Label + Return + FunctionEnd + 6(literal(): 2 Function None 3 + 7: Label + 16(i64): 15(ptr) Variable Function + 33(indexable): 32(ptr) Variable Function + 38(u64): 37(ptr) Variable Function + 47(indexable): 46(ptr) Variable Function + 30: 29(ptr) AccessChain 26 28 + 31: 17(int) Load 30 + Store 33(indexable) 23 + 34: 15(ptr) AccessChain 33(indexable) 31 + 35: 14(int) Load 34 + Store 16(i64) 35 + 44: 29(ptr) AccessChain 26 28 + 45: 17(int) Load 44 + Store 47(indexable) 43 + 48: 37(ptr) AccessChain 47(indexable) 45 + 49: 36(int) Load 48 + Store 38(u64) 49 + Return + FunctionEnd + 8(typeCast(): 2 Function None 3 + 9: Label + 52(i64v): 51(ptr) Variable Function + 56(bv): 55(ptr) Variable Function + 65(u64v): 64(ptr) Variable Function + 74(iv): 73(ptr) Variable Function + 81(uv): 80(ptr) Variable Function + 89(fv): 88(ptr) Variable Function + 95(dv): 94(ptr) Variable Function + 57: 54(bvec2) Load 56(bv) + 62: 50(ivec2) Select 57 61 60 + Store 52(i64v) 62 + 66: 54(bvec2) Load 56(bv) + 71: 63(ivec2) Select 66 70 69 + Store 65(u64v) 71 + 75: 72(ivec2) Load 74(iv) + 76: 50(ivec2) SConvert 75 + Store 52(i64v) 76 + 77: 50(ivec2) Load 52(i64v) + 78: 72(ivec2) SConvert 77 + Store 74(iv) 78 + 82: 79(ivec2) Load 81(uv) + 83: 63(ivec2) UConvert 82 + Store 65(u64v) 83 + 84: 63(ivec2) Load 65(u64v) + 85: 79(ivec2) UConvert 84 + Store 81(uv) 85 + 90: 50(ivec2) Load 52(i64v) + 91: 87(fvec2) ConvertSToF 90 + Store 89(fv) 91 + 96: 50(ivec2) Load 52(i64v) + 97: 93(fvec2) ConvertSToF 96 + Store 95(dv) 97 + 98: 63(ivec2) Load 65(u64v) + 99: 87(fvec2) ConvertUToF 98 + Store 89(fv) 99 + 100: 63(ivec2) Load 65(u64v) + 101: 93(fvec2) ConvertUToF 100 + Store 95(dv) 101 + 102: 87(fvec2) Load 89(fv) + 103: 50(ivec2) ConvertFToS 102 + Store 52(i64v) 103 + 104: 93(fvec2) Load 95(dv) + 105: 50(ivec2) ConvertFToS 104 + Store 52(i64v) 105 + 106: 87(fvec2) Load 89(fv) + 107: 63(ivec2) ConvertFToU 106 + Store 65(u64v) 107 + 108: 93(fvec2) Load 95(dv) + 109: 63(ivec2) ConvertFToU 108 + Store 65(u64v) 109 + 110: 50(ivec2) Load 52(i64v) + 111: 54(bvec2) INotEqual 110 69 + Store 56(bv) 111 + 112: 63(ivec2) Load 65(u64v) + 113: 54(bvec2) INotEqual 112 69 + Store 56(bv) 113 + 114: 50(ivec2) Load 52(i64v) + 115: 63(ivec2) Bitcast 114 + Store 65(u64v) 115 + 116: 63(ivec2) Load 65(u64v) + 117: 50(ivec2) Bitcast 116 + Store 52(i64v) 117 + 118: 50(ivec2) Load 52(i64v) + 119: 72(ivec2) SConvert 118 + 120: 79(ivec2) Bitcast 119 + Store 81(uv) 120 + 121: 79(ivec2) Load 81(uv) + 122: 63(ivec2) UConvert 121 + 123: 50(ivec2) Bitcast 122 + Store 52(i64v) 123 + 124: 63(ivec2) Load 65(u64v) + 125: 79(ivec2) UConvert 124 + 126: 72(ivec2) Bitcast 125 + Store 74(iv) 126 + 127: 72(ivec2) Load 74(iv) + 128: 50(ivec2) SConvert 127 + 129: 63(ivec2) Bitcast 128 + Store 65(u64v) 129 + Return + FunctionEnd + 10(operators(): 2 Function None 3 + 11: Label + 132(u64v): 131(ptr) Variable Function + 137(i64): 15(ptr) Variable Function + 157(i): 156(ptr) Variable Function + 164(uv): 163(ptr) Variable Function + 216(b): 215(ptr) Variable Function + 133: 130(ivec3) Load 132(u64v) + 135: 134(ivec3) CompositeConstruct 59 59 59 + 136: 130(ivec3) IAdd 133 135 + Store 132(u64v) 136 + 138: 14(int) Load 137(i64) + 139: 14(int) ISub 138 59 + Store 137(i64) 139 + 140: 14(int) Load 137(i64) + 141: 14(int) IAdd 140 59 + Store 137(i64) 141 + 142: 130(ivec3) Load 132(u64v) + 143: 134(ivec3) CompositeConstruct 59 59 59 + 144: 130(ivec3) ISub 142 143 + Store 132(u64v) 144 + 145: 130(ivec3) Load 132(u64v) + 146: 130(ivec3) Not 145 + Store 132(u64v) 146 + 147: 14(int) Load 137(i64) + Store 137(i64) 147 + 148: 130(ivec3) Load 132(u64v) + 149: 130(ivec3) SNegate 148 + Store 132(u64v) 149 + 150: 14(int) Load 137(i64) + 151: 14(int) Load 137(i64) + 152: 14(int) IAdd 151 150 + Store 137(i64) 152 + 153: 130(ivec3) Load 132(u64v) + 154: 130(ivec3) Load 132(u64v) + 155: 130(ivec3) ISub 154 153 + Store 132(u64v) 155 + 158: 27(int) Load 157(i) + 159: 14(int) SConvert 158 + 160: 14(int) Load 137(i64) + 161: 14(int) IMul 160 159 + Store 137(i64) 161 + 165: 162(ivec3) Load 164(uv) + 166: 130(ivec3) UConvert 165 + 167: 130(ivec3) Load 132(u64v) + 168: 130(ivec3) UDiv 167 166 + Store 132(u64v) 168 + 169: 27(int) Load 157(i) + 170: 14(int) SConvert 169 + 171: 36(int) Bitcast 170 + 172: 130(ivec3) Load 132(u64v) + 173: 130(ivec3) CompositeConstruct 171 171 171 + 174: 130(ivec3) UMod 172 173 + Store 132(u64v) 174 + 175: 130(ivec3) Load 132(u64v) + 176: 162(ivec3) Load 164(uv) + 177: 130(ivec3) UConvert 176 + 178: 130(ivec3) IAdd 175 177 + Store 132(u64v) 178 + 179: 14(int) Load 137(i64) + 180: 27(int) Load 157(i) + 181: 14(int) SConvert 180 + 182: 14(int) ISub 179 181 + Store 137(i64) 182 + 183: 130(ivec3) Load 132(u64v) + 184: 162(ivec3) Load 164(uv) + 185: 130(ivec3) UConvert 184 + 186: 130(ivec3) IMul 183 185 + Store 132(u64v) 186 + 187: 14(int) Load 137(i64) + 188: 27(int) Load 157(i) + 189: 14(int) SConvert 188 + 190: 14(int) IMul 187 189 + Store 137(i64) 190 + 191: 14(int) Load 137(i64) + 192: 27(int) Load 157(i) + 193: 14(int) SConvert 192 + 194: 14(int) SMod 191 193 + Store 137(i64) 194 + 195: 27(int) Load 157(i) + 196: 130(ivec3) Load 132(u64v) + 198: 197(ivec3) CompositeConstruct 195 195 195 + 199: 130(ivec3) ShiftLeftLogical 196 198 + Store 132(u64v) 199 + 202: 201(ptr) AccessChain 164(uv) 200 + 203: 17(int) Load 202 + 204: 14(int) Load 137(i64) + 205: 14(int) ShiftRightArithmetic 204 203 + Store 137(i64) 205 + 206: 14(int) Load 137(i64) + 208: 37(ptr) AccessChain 132(u64v) 207 + 209: 36(int) Load 208 + 210: 14(int) ShiftLeftLogical 206 209 + Store 137(i64) 210 + 211: 130(ivec3) Load 132(u64v) + 212: 14(int) Load 137(i64) + 213: 134(ivec3) CompositeConstruct 212 212 212 + 214: 130(ivec3) ShiftLeftLogical 211 213 + Store 132(u64v) 214 + 218: 37(ptr) AccessChain 132(u64v) 217 + 219: 36(int) Load 218 + 220: 14(int) Load 137(i64) + 221: 36(int) Bitcast 220 + 222: 53(bool) INotEqual 219 221 + Store 216(b) 222 + 223: 14(int) Load 137(i64) + 224: 36(int) Bitcast 223 + 225: 37(ptr) AccessChain 132(u64v) 217 + 226: 36(int) Load 225 + 227: 53(bool) IEqual 224 226 + Store 216(b) 227 + 228: 37(ptr) AccessChain 132(u64v) 217 + 229: 36(int) Load 228 + 230: 201(ptr) AccessChain 164(uv) 200 + 231: 17(int) Load 230 + 232: 36(int) UConvert 231 + 233: 53(bool) UGreaterThan 229 232 + Store 216(b) 233 + 234: 14(int) Load 137(i64) + 235: 27(int) Load 157(i) + 236: 14(int) SConvert 235 + 237: 53(bool) SLessThan 234 236 + Store 216(b) 237 + 238: 37(ptr) AccessChain 132(u64v) 200 + 239: 36(int) Load 238 + 240: 201(ptr) AccessChain 164(uv) 217 + 241: 17(int) Load 240 + 242: 36(int) UConvert 241 + 243: 53(bool) UGreaterThanEqual 239 242 + Store 216(b) 243 + 244: 14(int) Load 137(i64) + 245: 27(int) Load 157(i) + 246: 14(int) SConvert 245 + 247: 53(bool) SLessThanEqual 244 246 + Store 216(b) 247 + 248: 27(int) Load 157(i) + 249: 14(int) SConvert 248 + 250: 36(int) Bitcast 249 + 251: 130(ivec3) Load 132(u64v) + 252: 130(ivec3) CompositeConstruct 250 250 250 + 253: 130(ivec3) BitwiseOr 251 252 + Store 132(u64v) 253 + 254: 14(int) Load 137(i64) + 255: 27(int) Load 157(i) + 256: 14(int) SConvert 255 + 257: 14(int) BitwiseOr 254 256 + Store 137(i64) 257 + 258: 27(int) Load 157(i) + 259: 14(int) SConvert 258 + 260: 14(int) Load 137(i64) + 261: 14(int) BitwiseAnd 260 259 + Store 137(i64) 261 + 262: 130(ivec3) Load 132(u64v) + 263: 162(ivec3) Load 164(uv) + 264: 130(ivec3) UConvert 263 + 265: 130(ivec3) BitwiseAnd 262 264 + Store 132(u64v) 265 + 266: 14(int) Load 137(i64) + 267: 36(int) Bitcast 266 + 268: 130(ivec3) Load 132(u64v) + 269: 130(ivec3) CompositeConstruct 267 267 267 + 270: 130(ivec3) BitwiseXor 268 269 + Store 132(u64v) 270 + 271: 130(ivec3) Load 132(u64v) + 272: 14(int) Load 137(i64) + 273: 36(int) Bitcast 272 + 274: 130(ivec3) CompositeConstruct 273 273 273 + 275: 130(ivec3) BitwiseXor 271 274 + Store 132(u64v) 275 + Return + FunctionEnd +12(builtinFuncs(): 2 Function None 3 + 13: Label + 276(i64v): 51(ptr) Variable Function + 279(i64): 15(ptr) Variable Function + 289(u64v): 131(ptr) Variable Function + 291(u64): 37(ptr) Variable Function + 363(dv): 362(ptr) Variable Function + 382(iv): 73(ptr) Variable Function + 387(uv): 80(ptr) Variable Function + 391(bv): 390(ptr) Variable Function + 277: 50(ivec2) Load 276(i64v) + 278: 50(ivec2) ExtInst 1(GLSL.std.450) 5(SAbs) 277 + Store 276(i64v) 278 + 280: 14(int) Load 279(i64) + 281: 14(int) ExtInst 1(GLSL.std.450) 7(SSign) 280 + Store 279(i64) 281 + 282: 50(ivec2) Load 276(i64v) + 283: 14(int) Load 279(i64) + 284: 50(ivec2) CompositeConstruct 283 283 + 285: 50(ivec2) ExtInst 1(GLSL.std.450) 39(SMin) 282 284 + Store 276(i64v) 285 + 286: 50(ivec2) Load 276(i64v) + 288: 50(ivec2) ExtInst 1(GLSL.std.450) 39(SMin) 286 287 + Store 276(i64v) 288 + 290: 130(ivec3) Load 289(u64v) + 292: 36(int) Load 291(u64) + 293: 130(ivec3) CompositeConstruct 292 292 292 + 294: 130(ivec3) ExtInst 1(GLSL.std.450) 38(UMin) 290 293 + Store 289(u64v) 294 + 295: 130(ivec3) Load 289(u64v) + 297: 130(ivec3) ExtInst 1(GLSL.std.450) 38(UMin) 295 296 + Store 289(u64v) 297 + 298: 50(ivec2) Load 276(i64v) + 299: 14(int) Load 279(i64) + 300: 50(ivec2) CompositeConstruct 299 299 + 301: 50(ivec2) ExtInst 1(GLSL.std.450) 42(SMax) 298 300 + Store 276(i64v) 301 + 302: 50(ivec2) Load 276(i64v) + 303: 50(ivec2) ExtInst 1(GLSL.std.450) 42(SMax) 302 287 + Store 276(i64v) 303 + 304: 130(ivec3) Load 289(u64v) + 305: 36(int) Load 291(u64) + 306: 130(ivec3) CompositeConstruct 305 305 305 + 307: 130(ivec3) ExtInst 1(GLSL.std.450) 41(UMax) 304 306 + Store 289(u64v) 307 + 308: 130(ivec3) Load 289(u64v) + 309: 130(ivec3) ExtInst 1(GLSL.std.450) 41(UMax) 308 296 + Store 289(u64v) 309 + 310: 50(ivec2) Load 276(i64v) + 311: 14(int) Load 279(i64) + 312: 14(int) SNegate 311 + 313: 14(int) Load 279(i64) + 314: 50(ivec2) CompositeConstruct 312 312 + 315: 50(ivec2) CompositeConstruct 313 313 + 316: 50(ivec2) ExtInst 1(GLSL.std.450) 45(SClamp) 310 314 315 + Store 276(i64v) 316 + 317: 50(ivec2) Load 276(i64v) + 318: 50(ivec2) Load 276(i64v) + 319: 50(ivec2) SNegate 318 + 320: 50(ivec2) Load 276(i64v) + 321: 50(ivec2) ExtInst 1(GLSL.std.450) 45(SClamp) 317 319 320 + Store 276(i64v) 321 + 322: 130(ivec3) Load 289(u64v) + 323: 36(int) Load 291(u64) + 324: 36(int) SNegate 323 + 325: 36(int) Load 291(u64) + 326: 130(ivec3) CompositeConstruct 324 324 324 + 327: 130(ivec3) CompositeConstruct 325 325 325 + 328: 130(ivec3) ExtInst 1(GLSL.std.450) 44(UClamp) 322 326 327 + Store 289(u64v) 328 + 329: 130(ivec3) Load 289(u64v) + 330: 130(ivec3) Load 289(u64v) + 331: 130(ivec3) SNegate 330 + 332: 130(ivec3) Load 289(u64v) + 333: 130(ivec3) ExtInst 1(GLSL.std.450) 44(UClamp) 329 331 332 + Store 289(u64v) 333 + 334: 15(ptr) AccessChain 276(i64v) 217 + 335: 14(int) Load 334 + 336: 15(ptr) AccessChain 276(i64v) 200 + 337: 14(int) Load 336 + 339: 14(int) Select 338 337 335 + Store 279(i64) 339 + 340: 14(int) Load 279(i64) + 341: 50(ivec2) CompositeConstruct 340 340 + 342: 14(int) Load 279(i64) + 343: 14(int) SNegate 342 + 344: 50(ivec2) CompositeConstruct 343 343 + 347: 50(ivec2) Select 346 344 341 + Store 276(i64v) 347 + 348: 37(ptr) AccessChain 289(u64v) 217 + 349: 36(int) Load 348 + 350: 37(ptr) AccessChain 289(u64v) 200 + 351: 36(int) Load 350 + 352: 36(int) Select 338 351 349 + Store 291(u64) 352 + 353: 36(int) Load 291(u64) + 354: 130(ivec3) CompositeConstruct 353 353 353 + 355: 36(int) Load 291(u64) + 356: 36(int) SNegate 355 + 357: 130(ivec3) CompositeConstruct 356 356 356 + 360: 130(ivec3) Select 359 357 354 + Store 289(u64v) 360 + 364: 361(fvec3) Load 363(dv) + 365: 93(fvec2) VectorShuffle 364 364 0 1 + 366: 50(ivec2) Bitcast 365 + Store 276(i64v) 366 + 368: 367(ptr) AccessChain 363(dv) 207 + 369: 92(float) Load 368 + 370: 36(int) Bitcast 369 + 371: 37(ptr) AccessChain 289(u64v) 217 + Store 371 370 + 372: 50(ivec2) Load 276(i64v) + 373: 93(fvec2) Bitcast 372 + 374: 361(fvec3) Load 363(dv) + 375: 361(fvec3) VectorShuffle 374 373 3 4 2 + Store 363(dv) 375 + 376: 130(ivec3) Load 289(u64v) + 377: 361(fvec3) Bitcast 376 + Store 363(dv) 377 + 381: 14(int) ExtInst 1(GLSL.std.450) 0(Unknown) 380 + Store 279(i64) 381 + 383: 14(int) Load 279(i64) + 384: 72(ivec2) ExtInst 1(GLSL.std.450) 0(Unknown) 383 + Store 382(iv) 384 + 386: 36(int) ExtInst 1(GLSL.std.450) 0(Unknown) 385 + Store 291(u64) 386 + 388: 36(int) Load 291(u64) + 389: 79(ivec2) ExtInst 1(GLSL.std.450) 0(Unknown) 388 + Store 387(uv) 389 + 392: 130(ivec3) Load 289(u64v) + 393: 36(int) Load 291(u64) + 394: 130(ivec3) CompositeConstruct 393 393 393 + 395: 358(bvec3) ULessThan 392 394 + Store 391(bv) 395 + 396: 50(ivec2) Load 276(i64v) + 397: 14(int) Load 279(i64) + 398: 50(ivec2) CompositeConstruct 397 397 + 399: 54(bvec2) SLessThan 396 398 + 400: 358(bvec3) Load 391(bv) + 401: 358(bvec3) VectorShuffle 400 399 3 4 2 + Store 391(bv) 401 + 402: 130(ivec3) Load 289(u64v) + 403: 36(int) Load 291(u64) + 404: 130(ivec3) CompositeConstruct 403 403 403 + 405: 358(bvec3) ULessThanEqual 402 404 + Store 391(bv) 405 + 406: 50(ivec2) Load 276(i64v) + 407: 14(int) Load 279(i64) + 408: 50(ivec2) CompositeConstruct 407 407 + 409: 54(bvec2) SLessThanEqual 406 408 + 410: 358(bvec3) Load 391(bv) + 411: 358(bvec3) VectorShuffle 410 409 3 4 2 + Store 391(bv) 411 + 412: 130(ivec3) Load 289(u64v) + 413: 36(int) Load 291(u64) + 414: 130(ivec3) CompositeConstruct 413 413 413 + 415: 358(bvec3) UGreaterThan 412 414 + Store 391(bv) 415 + 416: 50(ivec2) Load 276(i64v) + 417: 14(int) Load 279(i64) + 418: 50(ivec2) CompositeConstruct 417 417 + 419: 54(bvec2) SGreaterThan 416 418 + 420: 358(bvec3) Load 391(bv) + 421: 358(bvec3) VectorShuffle 420 419 3 4 2 + Store 391(bv) 421 + 422: 130(ivec3) Load 289(u64v) + 423: 36(int) Load 291(u64) + 424: 130(ivec3) CompositeConstruct 423 423 423 + 425: 358(bvec3) UGreaterThanEqual 422 424 + Store 391(bv) 425 + 426: 50(ivec2) Load 276(i64v) + 427: 14(int) Load 279(i64) + 428: 50(ivec2) CompositeConstruct 427 427 + 429: 54(bvec2) SGreaterThanEqual 426 428 + 430: 358(bvec3) Load 391(bv) + 431: 358(bvec3) VectorShuffle 430 429 3 4 2 + Store 391(bv) 431 + 432: 130(ivec3) Load 289(u64v) + 433: 36(int) Load 291(u64) + 434: 130(ivec3) CompositeConstruct 433 433 433 + 435: 358(bvec3) IEqual 432 434 + Store 391(bv) 435 + 436: 50(ivec2) Load 276(i64v) + 437: 14(int) Load 279(i64) + 438: 50(ivec2) CompositeConstruct 437 437 + 439: 54(bvec2) IEqual 436 438 + 440: 358(bvec3) Load 391(bv) + 441: 358(bvec3) VectorShuffle 440 439 3 4 2 + Store 391(bv) 441 + 442: 130(ivec3) Load 289(u64v) + 443: 36(int) Load 291(u64) + 444: 130(ivec3) CompositeConstruct 443 443 443 + 445: 358(bvec3) INotEqual 442 444 + Store 391(bv) 445 + 446: 50(ivec2) Load 276(i64v) + 447: 14(int) Load 279(i64) + 448: 50(ivec2) CompositeConstruct 447 447 + 449: 54(bvec2) INotEqual 446 448 + 450: 358(bvec3) Load 391(bv) + 451: 358(bvec3) VectorShuffle 450 449 3 4 2 + Store 391(bv) 451 + Return + FunctionEnd diff --git a/Test/spv.int64.frag b/Test/spv.int64.frag new file mode 100644 index 00000000..527bfeff --- /dev/null +++ b/Test/spv.int64.frag @@ -0,0 +1,228 @@ +#version 450 + +#extension GL_ARB_gpu_shader_int64: enable + +layout(binding = 0) uniform Uniforms +{ + uint index; +}; + +layout(std140, binding = 1) uniform Block +{ + i64vec3 i64v; + uint64_t u64; +} block; + +void main() +{ +} + +void literal() +{ + const int64_t i64Const[3] = + { + -0x1111111111111111l, // Hex + -1l, // Dec + 040000000000l, // Oct + }; + + int64_t i64 = i64Const[index]; + + const uint64_t u64Const[] = + { + 0xFFFFFFFFFFFFFFFFul, // Hex + 4294967296UL, // Dec + 077777777777ul, // Oct + }; + + uint64_t u64 = u64Const[index]; +} + +void typeCast() +{ + bvec2 bv; + ivec2 iv; + uvec2 uv; + vec2 fv; + dvec2 dv; + + i64vec2 i64v; + u64vec2 u64v; + + i64v = i64vec2(bv); // bool -> int64 + u64v = u64vec2(bv); // bool -> uint64 + + i64v = iv; // int -> int64 + iv = ivec2(i64v); // int64 -> int + + u64v = uv; // uint -> uint64 + uv = uvec2(u64v); // uint64 -> uint + + fv = vec2(i64v); // int64 -> float + dv = i64v; // int64 -> double + + fv = vec2(u64v); // uint64 -> float + dv = u64v; // uint64 -> double + + i64v = i64vec2(fv); // float -> int64 + i64v = i64vec2(dv); // double -> int64 + + u64v = u64vec2(fv); // float -> uint64 + u64v = u64vec2(dv); // double -> uint64 + + bv = bvec2(i64v); // int64 -> bool + bv = bvec2(u64v); // uint64 -> bool + + u64v = i64v; // int64 -> uint64 + i64v = i64vec2(u64v); // uint64 -> int64 + + uv = uvec2(i64v); // int64 -> uint + i64v = i64vec2(uv); // uint -> int64 + iv = ivec2(u64v); // uint64 -> int + u64v = iv; // int -> uint64 +} + +void operators() +{ + u64vec3 u64v; + int64_t i64; + uvec3 uv; + int i; + bool b; + + // Unary + u64v++; + i64--; + ++i64; + --u64v; + + u64v = ~u64v; + + i64 = +i64; + u64v = -u64v; + + // Arithmetic + i64 += i64; + u64v -= u64v; + i64 *= i; + u64v /= uv; + u64v %= i; + + u64v = u64v + uv; + i64 = i64 - i; + u64v = u64v * uv; + i64 = i64 * i; + i64 = i64 % i; + + // Shift + u64v <<= i; + i64 >>= uv.y; + + i64 = i64 << u64v.z; + u64v = u64v << i64; + + // Relational + b = (u64v.x != i64); + b = (i64 == u64v.x); + b = (u64v.x > uv.y); + b = (i64 < i); + b = (u64v.y >= uv.x); + b = (i64 <= i); + + // Bitwise + u64v |= i; + i64 = i64 | i; + i64 &= i; + u64v = u64v & uv; + u64v ^= i64; + u64v = u64v ^ i64; +} + +void builtinFuncs() +{ + i64vec2 i64v; + u64vec3 u64v; + dvec3 dv; + bvec3 bv; + + int64_t i64; + uint64_t u64; + + // abs() + i64v = abs(i64v); + + // sign() + i64 = sign(i64); + + // min() + i64v = min(i64v, i64); + i64v = min(i64v, i64vec2(-1)); + u64v = min(u64v, u64); + u64v = min(u64v, u64vec3(0)); + + // max() + i64v = max(i64v, i64); + i64v = max(i64v, i64vec2(-1)); + u64v = max(u64v, u64); + u64v = max(u64v, u64vec3(0)); + + // clamp() + i64v = clamp(i64v, -i64, i64); + i64v = clamp(i64v, -i64v, i64v); + u64v = clamp(u64v, -u64, u64); + u64v = clamp(u64v, -u64v, u64v); + + // mix() + i64 = mix(i64v.x, i64v.y, true); + i64v = mix(i64vec2(i64), i64vec2(-i64), bvec2(false)); + u64 = mix(u64v.x, u64v.y, true); + u64v = mix(u64vec3(u64), u64vec3(-u64), bvec3(false)); + + // doubleBitsToInt64() + i64v = doubleBitsToInt64(dv.xy); + + // doubleBitsToUint64() + u64v.x = doubleBitsToUint64(dv.z); + + // int64BitsToDouble() + dv.xy = int64BitsToDouble(i64v); + + // uint64BitsToDouble() + dv = uint64BitsToDouble(u64v); + + // packInt2x32() + i64 = packInt2x32(ivec2(1, 2)); + + // unpackInt2x32() + ivec2 iv = unpackInt2x32(i64); + + // packUint2x32() + u64 = packUint2x32(uvec2(2, 3)); + + // unpackUint2x32() + uvec2 uv = unpackUint2x32(u64); + + // lessThan() + bv = lessThan(u64v, u64vec3(u64)); + bv.xy = lessThan(i64v, i64vec2(i64)); + + // lessThanEqual() + bv = lessThanEqual(u64v, u64vec3(u64)); + bv.xy = lessThanEqual(i64v, i64vec2(i64)); + + // greaterThan() + bv = greaterThan(u64v, u64vec3(u64)); + bv.xy = greaterThan(i64v, i64vec2(i64)); + + // greaterThanEqual() + bv = greaterThanEqual(u64v, u64vec3(u64)); + bv.xy = greaterThanEqual(i64v, i64vec2(i64)); + + // equal() + bv = equal(u64v, u64vec3(u64)); + bv.xy = equal(i64v, i64vec2(i64)); + + // notEqual() + bv = notEqual(u64v, u64vec3(u64)); + bv.xy = notEqual(i64v, i64vec2(i64)); +} \ No newline at end of file diff --git a/Test/test-spirv-list b/Test/test-spirv-list index b7dfd537..dfc6db7b 100644 --- a/Test/test-spirv-list +++ b/Test/test-spirv-list @@ -53,6 +53,7 @@ spv.forwardFun.frag spv.functionCall.frag spv.functionSemantics.frag spv.interpOps.frag +spv.int64.frag spv.layoutNested.vert spv.length.frag spv.localAggregates.frag diff --git a/glslang/Include/BaseTypes.h b/glslang/Include/BaseTypes.h index 5a57664f..ff4b560c 100644 --- a/glslang/Include/BaseTypes.h +++ b/glslang/Include/BaseTypes.h @@ -48,6 +48,8 @@ enum TBasicType { EbtDouble, EbtInt, EbtUint, + EbtInt64, + EbtUint64, EbtBool, EbtAtomicUint, EbtSampler, diff --git a/glslang/Include/ConstantUnion.h b/glslang/Include/ConstantUnion.h index c53870d9..8ee2c84c 100644 --- a/glslang/Include/ConstantUnion.h +++ b/glslang/Include/ConstantUnion.h @@ -57,6 +57,18 @@ public: type = EbtUint; } + void setI64Const(long long i64) + { + i64Const = i64; + type = EbtInt64; + } + + void setU64Const(unsigned long long u64) + { + u64Const = u64; + type = EbtUint64; + } + void setDConst(double d) { dConst = d; @@ -69,10 +81,12 @@ public: type = EbtBool; } - int getIConst() const { return iConst; } - unsigned int getUConst() const { return uConst; } - double getDConst() const { return dConst; } - bool getBConst() const { return bConst; } + int getIConst() const { return iConst; } + unsigned int getUConst() const { return uConst; } + long long getI64Const() const { return i64Const; } + unsigned long long getU64Const() const { return u64Const; } + double getDConst() const { return dConst; } + bool getBConst() const { return bConst; } bool operator==(const int i) const { @@ -82,7 +96,7 @@ public: return false; } - bool operator==(unsigned const int u) const + bool operator==(const unsigned int u) const { if (u == uConst) return true; @@ -90,6 +104,22 @@ public: return false; } + bool operator==(const long long i64) const + { + if (i64 == i64Const) + return true; + + return false; + } + + bool operator==(const unsigned long long u64) const + { + if (u64 == u64Const) + return true; + + return false; + } + bool operator==(const double d) const { if (d == dConst) @@ -121,6 +151,16 @@ public: if (constant.uConst == uConst) return true; + break; + case EbtInt64: + if (constant.i64Const == i64Const) + return true; + + break; + case EbtUint64: + if (constant.u64Const == u64Const) + return true; + break; case EbtDouble: if (constant.dConst == dConst) @@ -149,6 +189,16 @@ public: return !operator==(u); } + bool operator!=(const long long i) const + { + return !operator==(i); + } + + bool operator!=(const unsigned long long u) const + { + return !operator==(u); + } + bool operator!=(const float f) const { return !operator==(f); @@ -177,6 +227,16 @@ public: if (uConst > constant.uConst) return true; + return false; + case EbtInt64: + if (i64Const > constant.i64Const) + return true; + + return false; + case EbtUint64: + if (u64Const > constant.u64Const) + return true; + return false; case EbtDouble: if (dConst > constant.dConst) @@ -202,6 +262,16 @@ public: if (uConst < constant.uConst) return true; + return false; + case EbtInt64: + if (i64Const < constant.i64Const) + return true; + + return false; + case EbtUint64: + if (u64Const < constant.u64Const) + return true; + return false; case EbtDouble: if (dConst < constant.dConst) @@ -220,7 +290,9 @@ public: assert(type == constant.type); switch (type) { case EbtInt: returnValue.setIConst(iConst + constant.iConst); break; + case EbtInt64: returnValue.setI64Const(i64Const + constant.i64Const); 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; default: assert(false && "Default missing"); } @@ -234,7 +306,9 @@ public: assert(type == constant.type); switch (type) { case EbtInt: returnValue.setIConst(iConst - constant.iConst); break; + case EbtInt64: returnValue.setI64Const(i64Const - constant.i64Const); 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; default: assert(false && "Default missing"); } @@ -248,7 +322,9 @@ public: assert(type == constant.type); switch (type) { case EbtInt: returnValue.setIConst(iConst * constant.iConst); break; + case EbtInt64: returnValue.setI64Const(i64Const * constant.i64Const); 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; default: assert(false && "Default missing"); } @@ -261,8 +337,10 @@ public: TConstUnion returnValue; assert(type == constant.type); switch (type) { - case EbtInt: returnValue.setIConst(iConst % constant.iConst); break; + case EbtInt: returnValue.setIConst(iConst % constant.iConst); break; + case EbtInt64: returnValue.setI64Const(i64Const % constant.i64Const); break; case EbtUint: returnValue.setUConst(uConst % constant.uConst); break; + case EbtUint64: returnValue.setU64Const(u64Const % constant.u64Const); break; default: assert(false && "Default missing"); } @@ -275,16 +353,38 @@ public: switch (type) { case EbtInt: switch (constant.type) { - case EbtInt: returnValue.setIConst(iConst >> constant.iConst); break; - case EbtUint: returnValue.setIConst(iConst >> constant.uConst); break; - default: assert(false && "Default missing"); + 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 EbtInt: returnValue.setUConst(uConst >> constant.iConst); break; - case EbtUint: returnValue.setUConst(uConst >> constant.uConst); break; - default: assert(false && "Default missing"); + 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 EbtInt: returnValue.setI64Const(i64Const >> constant.iConst); break; + case EbtUint: returnValue.setI64Const(i64Const >> constant.uConst); break; + case EbtInt64: returnValue.setI64Const(i64Const >> constant.i64Const); break; + case EbtUint64: returnValue.setI64Const(i64Const >> constant.u64Const); break; + default: assert(false && "Default missing"); + } + break; + case EbtUint64: + switch (constant.type) { + case EbtInt: returnValue.setU64Const(u64Const >> constant.iConst); break; + case EbtUint: returnValue.setU64Const(u64Const >> constant.uConst); break; + case EbtInt64: returnValue.setU64Const(u64Const >> constant.i64Const); break; + case EbtUint64: returnValue.setU64Const(u64Const >> constant.u64Const); break; + default: assert(false && "Default missing"); } break; default: assert(false && "Default missing"); @@ -299,16 +399,38 @@ public: switch (type) { case EbtInt: switch (constant.type) { - case EbtInt: returnValue.setIConst(iConst << constant.iConst); break; - case EbtUint: returnValue.setIConst(iConst << constant.uConst); break; - default: assert(false && "Default missing"); + 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 EbtInt: returnValue.setUConst(uConst << constant.iConst); break; - case EbtUint: returnValue.setUConst(uConst << constant.uConst); break; - default: assert(false && "Default missing"); + 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 EbtInt: returnValue.setI64Const(i64Const << constant.iConst); break; + case EbtUint: returnValue.setI64Const(i64Const << constant.uConst); break; + case EbtInt64: returnValue.setI64Const(i64Const << constant.i64Const); break; + case EbtUint64: returnValue.setI64Const(i64Const << constant.u64Const); break; + default: assert(false && "Default missing"); + } + break; + case EbtUint64: + switch (constant.type) { + case EbtInt: returnValue.setU64Const(u64Const << constant.iConst); break; + case EbtUint: returnValue.setU64Const(u64Const << constant.uConst); break; + case EbtInt64: returnValue.setU64Const(u64Const << constant.i64Const); break; + case EbtUint64: returnValue.setU64Const(u64Const << constant.u64Const); break; + default: assert(false && "Default missing"); } break; default: assert(false && "Default missing"); @@ -324,6 +446,8 @@ public: switch (type) { 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; default: assert(false && "Default missing"); } @@ -337,6 +461,8 @@ public: switch (type) { 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; default: assert(false && "Default missing"); } @@ -350,6 +476,8 @@ public: switch (type) { 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; default: assert(false && "Default missing"); } @@ -362,6 +490,8 @@ public: switch (type) { case EbtInt: returnValue.setIConst(~iConst); break; case EbtUint: returnValue.setUConst(~uConst); break; + case EbtInt64: returnValue.setI64Const(~i64Const); break; + case EbtUint64: returnValue.setU64Const(~u64Const); break; default: assert(false && "Default missing"); } @@ -396,10 +526,12 @@ public: private: union { - int iConst; // used for ivec, scalar ints - unsigned int uConst; // used for uvec, scalar uints - bool bConst; // used for bvec, scalar bools - double dConst; // used for vec, dvec, mat, dmat, scalar floats and doubles + int iConst; // used for ivec, scalar ints + unsigned int uConst; // used for uvec, scalar uints + long long i64Const; // used for i64vec, scalar int64s + unsigned long long u64Const; // used for u64vec, scalar uint64s + bool bConst; // used for bvec, scalar bools + double dConst; // used for vec, dvec, mat, dmat, scalar floats and doubles }; TBasicType type; diff --git a/glslang/Include/Types.h b/glslang/Include/Types.h index e28e5b29..38a27d4e 100644 --- a/glslang/Include/Types.h +++ b/glslang/Include/Types.h @@ -182,6 +182,8 @@ struct TSampler { // misnomer now; includes images, textures without sampler, case EbtFloat: break; case EbtInt: s.append("i"); break; case EbtUint: s.append("u"); break; + case EbtInt64: s.append("i64"); break; + case EbtUint64: s.append("u64"); break; default: break; // some compilers want this } if (image) { @@ -1319,6 +1321,8 @@ public: case EbtDouble: case EbtInt: case EbtUint: + case EbtInt64: + case EbtUint64: case EbtBool: return true; default: @@ -1409,6 +1413,8 @@ public: case EbtDouble: return "double"; case EbtInt: return "int"; case EbtUint: return "uint"; + case EbtInt64: return "int64_t"; + case EbtUint64: return "uint64_t"; case EbtBool: return "bool"; case EbtAtomicUint: return "atomic_uint"; case EbtSampler: return "sampler/image"; diff --git a/glslang/Include/intermediate.h b/glslang/Include/intermediate.h index ab177011..1dd55a7b 100644 --- a/glslang/Include/intermediate.h +++ b/glslang/Include/intermediate.h @@ -81,22 +81,44 @@ enum TOperator { EOpConvUintToBool, EOpConvFloatToBool, EOpConvDoubleToBool, + EOpConvInt64ToBool, + EOpConvUint64ToBool, EOpConvBoolToFloat, EOpConvIntToFloat, EOpConvUintToFloat, EOpConvDoubleToFloat, + EOpConvInt64ToFloat, + EOpConvUint64ToFloat, EOpConvUintToInt, EOpConvFloatToInt, EOpConvBoolToInt, EOpConvDoubleToInt, + EOpConvInt64ToInt, + EOpConvUint64ToInt, EOpConvIntToUint, EOpConvFloatToUint, EOpConvBoolToUint, EOpConvDoubleToUint, + EOpConvInt64ToUint, + EOpConvUint64ToUint, EOpConvIntToDouble, EOpConvUintToDouble, EOpConvFloatToDouble, EOpConvBoolToDouble, + EOpConvInt64ToDouble, + EOpConvUint64ToDouble, + EOpConvBoolToInt64, + EOpConvIntToInt64, + EOpConvUintToInt64, + EOpConvFloatToInt64, + EOpConvDoubleToInt64, + EOpConvUint64ToInt64, + EOpConvBoolToUint64, + EOpConvIntToUint64, + EOpConvUintToUint64, + EOpConvFloatToUint64, + EOpConvDoubleToUint64, + EOpConvInt64ToUint64, // // binary operations @@ -194,6 +216,10 @@ enum TOperator { EOpFloatBitsToUint, EOpIntBitsToFloat, EOpUintBitsToFloat, + EOpDoubleBitsToInt64, + EOpDoubleBitsToUint64, + EOpInt64BitsToDouble, + EOpUint64BitsToDouble, EOpPackSnorm2x16, EOpUnpackSnorm2x16, EOpPackUnorm2x16, @@ -206,6 +232,10 @@ enum TOperator { EOpUnpackHalf2x16, EOpPackDouble2x32, EOpUnpackDouble2x32, + EOpPackInt2x32, + EOpUnpackInt2x32, + EOpPackUint2x32, + EOpUnpackUint2x32, EOpLength, EOpDistance, @@ -287,6 +317,8 @@ enum TOperator { EOpConstructGuardStart, EOpConstructInt, // these first scalar forms also identify what implicit conversion is needed EOpConstructUint, + EOpConstructInt64, + EOpConstructUint64, EOpConstructBool, EOpConstructFloat, EOpConstructDouble, @@ -305,6 +337,12 @@ enum TOperator { EOpConstructUVec2, EOpConstructUVec3, EOpConstructUVec4, + EOpConstructI64Vec2, + EOpConstructI64Vec3, + EOpConstructI64Vec4, + EOpConstructU64Vec2, + EOpConstructU64Vec3, + EOpConstructU64Vec4, EOpConstructMat2x2, EOpConstructMat2x3, EOpConstructMat2x4, diff --git a/glslang/MachineIndependent/Constant.cpp b/glslang/MachineIndependent/Constant.cpp index db2f70da..03033bce 100644 --- a/glslang/MachineIndependent/Constant.cpp +++ b/glslang/MachineIndependent/Constant.cpp @@ -194,6 +194,22 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right } else newConstArray[i].setUConst(leftUnionArray[i].getUConst() / rightUnionArray[i].getUConst()); break; + + case EbtInt64: + if (rightUnionArray[i] == 0) + newConstArray[i].setI64Const(0x7FFFFFFFFFFFFFFFll); + else if (rightUnionArray[i].getI64Const() == -1 && leftUnionArray[i].getI64Const() == (long long)0x8000000000000000) + newConstArray[i].setI64Const(0x8000000000000000); + else + newConstArray[i].setI64Const(leftUnionArray[i].getI64Const() / rightUnionArray[i].getI64Const()); + break; + + case EbtUint64: + if (rightUnionArray[i] == 0) { + newConstArray[i].setU64Const(0xFFFFFFFFFFFFFFFFull); + } else + newConstArray[i].setU64Const(leftUnionArray[i].getU64Const() / rightUnionArray[i].getU64Const()); + break; default: return 0; } @@ -419,6 +435,8 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) 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; + case EbtInt64: newConstArray[i].setI64Const(-unionArray[i].getI64Const()); break; + case EbtUint64: newConstArray[i].setU64Const(static_cast(-static_cast(unionArray[i].getU64Const()))); break; default: return 0; } @@ -566,6 +584,8 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) case EOpFloatBitsToUint: case EOpIntBitsToFloat: case EOpUintBitsToFloat: + case EOpDoubleBitsToInt64: + case EOpDoubleBitsToUint64: default: return 0; @@ -651,7 +671,10 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode) bool isFloatingPoint = children[0]->getAsTyped()->getBasicType() == EbtFloat || children[0]->getAsTyped()->getBasicType() == EbtDouble; - bool isSigned = children[0]->getAsTyped()->getBasicType() == EbtInt; + bool isSigned = children[0]->getAsTyped()->getBasicType() == EbtInt || + children[0]->getAsTyped()->getBasicType() == EbtInt64; + bool isInt64 = children[0]->getAsTyped()->getBasicType() == EbtInt64 || + children[0]->getAsTyped()->getBasicType() == EbtUint64; if (componentwise) { for (int comp = 0; comp < objectSize; comp++) { @@ -674,29 +697,52 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode) case EOpMin: if (isFloatingPoint) newConstArray[comp].setDConst(std::min(childConstUnions[0][arg0comp].getDConst(), childConstUnions[1][arg1comp].getDConst())); - else if (isSigned) - newConstArray[comp].setIConst(std::min(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst())); - else - newConstArray[comp].setUConst(std::min(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst())); + else if (isSigned) { + if (isInt64) + newConstArray[comp].setI64Const(std::min(childConstUnions[0][arg0comp].getI64Const(), childConstUnions[1][arg1comp].getI64Const())); + else + newConstArray[comp].setIConst(std::min(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst())); + } else { + if (isInt64) + newConstArray[comp].setU64Const(std::min(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const())); + else + newConstArray[comp].setUConst(std::min(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst())); + } break; case EOpMax: if (isFloatingPoint) newConstArray[comp].setDConst(std::max(childConstUnions[0][arg0comp].getDConst(), childConstUnions[1][arg1comp].getDConst())); - else if (isSigned) - newConstArray[comp].setIConst(std::max(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst())); - else - newConstArray[comp].setUConst(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst())); + else if (isSigned) { + if (isInt64) + newConstArray[comp].setI64Const(std::max(childConstUnions[0][arg0comp].getI64Const(), childConstUnions[1][arg1comp].getI64Const())); + else + newConstArray[comp].setIConst(std::max(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst())); + } else { + if (isInt64) + newConstArray[comp].setU64Const(std::max(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const())); + else + newConstArray[comp].setUConst(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst())); + } break; case EOpClamp: if (isFloatingPoint) - newConstArray[comp].setDConst(std::min(std::max(childConstUnions[0][arg0comp].getDConst(), childConstUnions[1][arg1comp].getDConst()), + newConstArray[comp].setDConst(std::min(std::max(childConstUnions[0][arg0comp].getDConst(), childConstUnions[1][arg1comp].getDConst()), childConstUnions[2][arg2comp].getDConst())); - else if (isSigned) - newConstArray[comp].setIConst(std::min(std::max(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst()), - childConstUnions[2][arg2comp].getIConst())); - else - newConstArray[comp].setUConst(std::min(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst()), - childConstUnions[2][arg2comp].getUConst())); + else if (isSigned) { + if (isInt64) + newConstArray[comp].setI64Const(std::min(std::max(childConstUnions[0][arg0comp].getI64Const(), childConstUnions[1][arg1comp].getI64Const()), + childConstUnions[2][arg2comp].getI64Const())); + else + newConstArray[comp].setIConst(std::min(std::max(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst()), + childConstUnions[2][arg2comp].getIConst())); + } else { + if (isInt64) + newConstArray[comp].setU64Const(std::min(std::max(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const()), + childConstUnions[2][arg2comp].getU64Const())); + else + newConstArray[comp].setUConst(std::min(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst()), + childConstUnions[2][arg2comp].getUConst())); + } break; case EOpLessThan: newConstArray[comp].setBConst(childConstUnions[0][arg0comp] < childConstUnions[1][arg1comp]); diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp index 446c51c9..e2bd4531 100644 --- a/glslang/MachineIndependent/Initialize.cpp +++ b/glslang/MachineIndependent/Initialize.cpp @@ -75,6 +75,8 @@ TBuiltIns::TBuiltIns() prefixes[EbtFloat] = ""; prefixes[EbtInt] = "i"; prefixes[EbtUint] = "u"; + prefixes[EbtInt64] = "i64"; + prefixes[EbtUint64] = "u64"; postfixes[2] = "2"; postfixes[3] = "3"; postfixes[4] = "4"; @@ -626,6 +628,145 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan) "dmat2 inverse(dmat2);" "dmat3 inverse(dmat3);" "dmat4 inverse(dmat4);" + + "\n"); + } + + if (profile != EEsProfile && version >= 450) { + commonBuiltins.append( + + "int64_t abs(int64_t);" + "i64vec2 abs(i64vec2);" + "i64vec3 abs(i64vec3);" + "i64vec4 abs(i64vec4);" + + "int64_t sign(int64_t);" + "i64vec2 sign(i64vec2);" + "i64vec3 sign(i64vec3);" + "i64vec4 sign(i64vec4);" + + "int64_t min(int64_t, int64_t);" + "i64vec2 min(i64vec2, int64_t);" + "i64vec3 min(i64vec3, int64_t);" + "i64vec4 min(i64vec4, int64_t);" + "i64vec2 min(i64vec2, i64vec2);" + "i64vec3 min(i64vec3, i64vec3);" + "i64vec4 min(i64vec4, i64vec4);" + "uint64_t min(uint64_t, uint64_t);" + "u64vec2 min(u64vec2, uint64_t);" + "u64vec3 min(u64vec3, uint64_t);" + "u64vec4 min(u64vec4, uint64_t);" + "u64vec2 min(u64vec2, u64vec2);" + "u64vec3 min(u64vec3, u64vec3);" + "u64vec4 min(u64vec4, u64vec4);" + + "int64_t max(int64_t, int64_t);" + "i64vec2 max(i64vec2, int64_t);" + "i64vec3 max(i64vec3, int64_t);" + "i64vec4 max(i64vec4, int64_t);" + "i64vec2 max(i64vec2, i64vec2);" + "i64vec3 max(i64vec3, i64vec3);" + "i64vec4 max(i64vec4, i64vec4);" + "uint64_t max(uint64_t, uint64_t);" + "u64vec2 max(u64vec2, uint64_t);" + "u64vec3 max(u64vec3, uint64_t);" + "u64vec4 max(u64vec4, uint64_t);" + "u64vec2 max(u64vec2, u64vec2);" + "u64vec3 max(u64vec3, u64vec3);" + "u64vec4 max(u64vec4, u64vec4);" + + "int64_t clamp(int64_t, int64_t, int64_t);" + "i64vec2 clamp(i64vec2, int64_t, int64_t);" + "i64vec3 clamp(i64vec3, int64_t, int64_t);" + "i64vec4 clamp(i64vec4, int64_t, int64_t);" + "i64vec2 clamp(i64vec2, i64vec2, i64vec2);" + "i64vec3 clamp(i64vec3, i64vec3, i64vec3);" + "i64vec4 clamp(i64vec4, i64vec4, i64vec4);" + "uint64_t clamp(uint64_t, uint64_t, uint64_t);" + "u64vec2 clamp(u64vec2, uint64_t, uint64_t);" + "u64vec3 clamp(u64vec3, uint64_t, uint64_t);" + "u64vec4 clamp(u64vec4, uint64_t, uint64_t);" + "u64vec2 clamp(u64vec2, u64vec2, u64vec2);" + "u64vec3 clamp(u64vec3, u64vec3, u64vec3);" + "u64vec4 clamp(u64vec4, u64vec4, u64vec4);" + + "int64_t mix(int64_t, int64_t, bool);" + "i64vec2 mix(i64vec2, i64vec2, bvec2);" + "i64vec3 mix(i64vec3, i64vec3, bvec3);" + "i64vec4 mix(i64vec4, i64vec4, bvec4);" + "uint64_t mix(uint64_t, uint64_t, bool);" + "u64vec2 mix(u64vec2, u64vec2, bvec2);" + "u64vec3 mix(u64vec3, u64vec3, bvec3);" + "u64vec4 mix(u64vec4, u64vec4, bvec4);" + + "int64_t doubleBitsToInt64(double);" + "i64vec2 doubleBitsToInt64(dvec2);" + "i64vec3 doubleBitsToInt64(dvec3);" + "i64vec4 doubleBitsToInt64(dvec4);" + + "uint64_t doubleBitsToUint64(double);" + "u64vec2 doubleBitsToUint64(dvec2);" + "u64vec3 doubleBitsToUint64(dvec3);" + "u64vec4 doubleBitsToUint64(dvec4);" + + "double int64BitsToDouble(int64_t);" + "dvec2 int64BitsToDouble(i64vec2);" + "dvec3 int64BitsToDouble(i64vec3);" + "dvec4 int64BitsToDouble(i64vec4);" + + "double uint64BitsToDouble(uint64_t);" + "dvec2 uint64BitsToDouble(u64vec2);" + "dvec3 uint64BitsToDouble(u64vec3);" + "dvec4 uint64BitsToDouble(u64vec4);" + + "int64_t packInt2x32(ivec2);" + "uint64_t packUint2x32(uvec2);" + "ivec2 unpackInt2x32(int64_t);" + "uvec2 unpackUint2x32(uint64_t);" + + "bvec2 lessThan(i64vec2, i64vec2);" + "bvec3 lessThan(i64vec3, i64vec3);" + "bvec4 lessThan(i64vec4, i64vec4);" + "bvec2 lessThan(u64vec2, u64vec2);" + "bvec3 lessThan(u64vec3, u64vec3);" + "bvec4 lessThan(u64vec4, u64vec4);" + + "bvec2 lessThanEqual(i64vec2, i64vec2);" + "bvec3 lessThanEqual(i64vec3, i64vec3);" + "bvec4 lessThanEqual(i64vec4, i64vec4);" + "bvec2 lessThanEqual(u64vec2, u64vec2);" + "bvec3 lessThanEqual(u64vec3, u64vec3);" + "bvec4 lessThanEqual(u64vec4, u64vec4);" + + "bvec2 greaterThan(i64vec2, i64vec2);" + "bvec3 greaterThan(i64vec3, i64vec3);" + "bvec4 greaterThan(i64vec4, i64vec4);" + "bvec2 greaterThan(u64vec2, u64vec2);" + "bvec3 greaterThan(u64vec3, u64vec3);" + "bvec4 greaterThan(u64vec4, u64vec4);" + + "bvec2 greaterThanEqual(i64vec2, i64vec2);" + "bvec3 greaterThanEqual(i64vec3, i64vec3);" + "bvec4 greaterThanEqual(i64vec4, i64vec4);" + "bvec2 greaterThanEqual(u64vec2, u64vec2);" + "bvec3 greaterThanEqual(u64vec3, u64vec3);" + "bvec4 greaterThanEqual(u64vec4, u64vec4);" + + "bvec2 equal(i64vec2, i64vec2);" + "bvec3 equal(i64vec3, i64vec3);" + "bvec4 equal(i64vec4, i64vec4);" + "bvec2 equal(u64vec2, u64vec2);" + "bvec3 equal(u64vec3, u64vec3);" + "bvec4 equal(u64vec4, u64vec4);" + + "bvec2 notEqual(i64vec2, i64vec2);" + "bvec3 notEqual(i64vec3, i64vec3);" + "bvec4 notEqual(i64vec4, i64vec4);" + "bvec2 notEqual(u64vec2, u64vec2);" + "bvec3 notEqual(u64vec3, u64vec3);" + "bvec4 notEqual(u64vec4, u64vec4);" + + "\n" ); } @@ -3650,6 +3791,10 @@ void IdentifyBuiltIns(int version, EProfile profile, int spv, int vulkan, EShLan symbolTable.relateToOperator("floatBitsToUint", EOpFloatBitsToUint); symbolTable.relateToOperator("intBitsToFloat", EOpIntBitsToFloat); symbolTable.relateToOperator("uintBitsToFloat", EOpUintBitsToFloat); + symbolTable.relateToOperator("doubleBitsToInt64", EOpDoubleBitsToInt64); + symbolTable.relateToOperator("doubleBitsToUint64", EOpDoubleBitsToUint64); + symbolTable.relateToOperator("int64BitsToDouble", EOpInt64BitsToDouble); + symbolTable.relateToOperator("uint64BitsToDouble", EOpUint64BitsToDouble); symbolTable.relateToOperator("packSnorm2x16", EOpPackSnorm2x16); symbolTable.relateToOperator("unpackSnorm2x16", EOpUnpackSnorm2x16); @@ -3667,6 +3812,11 @@ void IdentifyBuiltIns(int version, EProfile profile, int spv, int vulkan, EShLan symbolTable.relateToOperator("packHalf2x16", EOpPackHalf2x16); symbolTable.relateToOperator("unpackHalf2x16", EOpUnpackHalf2x16); + symbolTable.relateToOperator("packInt2x32", EOpPackInt2x32); + symbolTable.relateToOperator("unpackInt2x32", EOpUnpackInt2x32); + symbolTable.relateToOperator("packUint2x32", EOpPackUint2x32); + symbolTable.relateToOperator("unpackUint2x32", EOpUnpackUint2x32); + symbolTable.relateToOperator("length", EOpLength); symbolTable.relateToOperator("distance", EOpDistance); symbolTable.relateToOperator("dot", EOpDot); diff --git a/glslang/MachineIndependent/Intermediate.cpp b/glslang/MachineIndependent/Intermediate.cpp index d0fa74e5..47a93670 100644 --- a/glslang/MachineIndependent/Intermediate.cpp +++ b/glslang/MachineIndependent/Intermediate.cpp @@ -247,6 +247,8 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo switch (op) { 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 EOpConstructDouble: newType = EbtDouble; break; @@ -269,6 +271,8 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo switch (op) { case EOpConstructInt: case EOpConstructUint: + case EOpConstructInt64: + case EOpConstructUint64: case EOpConstructBool: case EOpConstructFloat: case EOpConstructDouble: @@ -472,6 +476,12 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt case EOpConstructUint: promoteTo = EbtUint; break; + case EOpConstructInt64: + promoteTo = EbtInt64; + break; + case EOpConstructUint64: + promoteTo = EbtUint64; + break; // // List all the binary ops that can implicitly convert one operand to the other's type; @@ -498,6 +508,9 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt case EOpAnd: case EOpInclusiveOr: case EOpExclusiveOr: + case EOpAndAssign: + case EOpInclusiveOrAssign: + case EOpExclusiveOrAssign: case EOpFunctionCall: case EOpReturn: @@ -531,9 +544,13 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt case EOpLeftShiftAssign: case EOpRightShiftAssign: if ((type.getBasicType() == EbtInt || - type.getBasicType() == EbtUint) && + type.getBasicType() == EbtUint || + type.getBasicType() == EbtInt64 || + type.getBasicType() == EbtUint64) && (node->getType().getBasicType() == EbtInt || - node->getType().getBasicType() == EbtUint)) + node->getType().getBasicType() == EbtUint || + node->getType().getBasicType() == EbtInt64 || + node->getType().getBasicType() == EbtUint64)) return node; else @@ -567,6 +584,8 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt case EbtUint: newOp = EOpConvUintToDouble; break; case EbtBool: newOp = EOpConvBoolToDouble; break; case EbtFloat: newOp = EOpConvFloatToDouble; break; + case EbtInt64: newOp = EOpConvInt64ToDouble; break; + case EbtUint64: newOp = EOpConvUint64ToDouble; break; default: return 0; } @@ -577,6 +596,8 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt case EbtUint: newOp = EOpConvUintToFloat; break; case EbtBool: newOp = EOpConvBoolToFloat; break; case EbtDouble: newOp = EOpConvDoubleToFloat; break; + case EbtInt64: newOp = EOpConvInt64ToFloat; break; + case EbtUint64: newOp = EOpConvUint64ToFloat; break; default: return 0; } @@ -587,6 +608,8 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt case EbtUint: newOp = EOpConvUintToBool; break; case EbtFloat: newOp = EOpConvFloatToBool; break; case EbtDouble: newOp = EOpConvDoubleToBool; break; + case EbtInt64: newOp = EOpConvInt64ToBool; break; + case EbtUint64: newOp = EOpConvUint64ToBool; break; default: return 0; } @@ -597,6 +620,8 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt case EbtBool: newOp = EOpConvBoolToInt; break; case EbtFloat: newOp = EOpConvFloatToInt; break; case EbtDouble: newOp = EOpConvDoubleToInt; break; + case EbtInt64: newOp = EOpConvInt64ToInt; break; + case EbtUint64: newOp = EOpConvUint64ToInt; break; default: return 0; } @@ -607,6 +632,32 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt case EbtBool: newOp = EOpConvBoolToUint; break; case EbtFloat: newOp = EOpConvFloatToUint; break; case EbtDouble: newOp = EOpConvDoubleToUint; break; + case EbtInt64: newOp = EOpConvInt64ToUint; break; + case EbtUint64: newOp = EOpConvUint64ToUint; break; + default: + return 0; + } + break; + case EbtInt64: + switch (node->getBasicType()) { + case EbtInt: newOp = EOpConvIntToInt64; break; + case EbtUint: newOp = EOpConvUintToInt64; break; + case EbtBool: newOp = EOpConvBoolToInt64; break; + case EbtFloat: newOp = EOpConvFloatToInt64; break; + case EbtDouble: newOp = EOpConvDoubleToInt64; break; + case EbtUint64: newOp = EOpConvUint64ToInt64; break; + default: + return 0; + } + break; + case EbtUint64: + switch (node->getBasicType()) { + case EbtInt: newOp = EOpConvIntToUint64; break; + case EbtUint: newOp = EOpConvUintToUint64; break; + case EbtBool: newOp = EOpConvBoolToUint64; break; + case EbtFloat: newOp = EOpConvFloatToUint64; break; + case EbtDouble: newOp = EOpConvDoubleToUint64; break; + case EbtInt64: newOp = EOpConvInt64ToUint64; break; default: return 0; } @@ -643,6 +694,8 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to) const switch (from) { case EbtInt: case EbtUint: + case EbtInt64: + case EbtUint64: case EbtFloat: case EbtDouble: return true; @@ -674,6 +727,24 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to) const default: return false; } + case EbtUint64: + switch (from) { + case EbtInt: + case EbtUint: + case EbtInt64: + case EbtUint64: + return true; + default: + return false; + } + case EbtInt64: + switch (from) { + case EbtInt: + case EbtInt64: + return true; + default: + return false; + } default: return false; } @@ -873,6 +944,22 @@ TIntermConstantUnion* TIntermediate::addConstantUnion(unsigned int u, const TSou return addConstantUnion(unionArray, TType(EbtUint, EvqConst), loc, literal); } +TIntermConstantUnion* TIntermediate::addConstantUnion(long long i64, const TSourceLoc& loc, bool literal) const +{ + TConstUnionArray unionArray(1); + unionArray[0].setI64Const(i64); + + return addConstantUnion(unionArray, TType(EbtInt64, EvqConst), loc, literal); +} + +TIntermConstantUnion* TIntermediate::addConstantUnion(unsigned long long u64, const TSourceLoc& loc, bool literal) const +{ + TConstUnionArray unionArray(1); + unionArray[0].setU64Const(u64); + + return addConstantUnion(unionArray, TType(EbtUint64, EvqConst), loc, literal); +} + TIntermConstantUnion* TIntermediate::addConstantUnion(bool b, const TSourceLoc& loc, bool literal) const { TConstUnionArray unionArray(1); @@ -1212,7 +1299,9 @@ bool TIntermUnary::promote() break; case EOpBitwiseNot: if (operand->getBasicType() != EbtInt && - operand->getBasicType() != EbtUint) + operand->getBasicType() != EbtUint && + operand->getBasicType() != EbtInt64 && + operand->getBasicType() != EbtUint64) return false; break; @@ -1223,6 +1312,8 @@ bool TIntermUnary::promote() case EOpPreDecrement: if (operand->getBasicType() != EbtInt && operand->getBasicType() != EbtUint && + operand->getBasicType() != EbtInt64 && + operand->getBasicType() != EbtUint64 && operand->getBasicType() != EbtFloat && operand->getBasicType() != EbtDouble) @@ -1340,8 +1431,10 @@ bool TIntermBinary::promote() case EOpInclusiveOrAssign: case EOpExclusiveOrAssign: // Check for integer-only operands. - if (( left->getBasicType() != EbtInt && left->getBasicType() != EbtUint) || - (right->getBasicType() != EbtInt && right->getBasicType() != EbtUint)) + if ((left->getBasicType() != EbtInt && left->getBasicType() != EbtUint && + left->getBasicType() != EbtInt64 && left->getBasicType() != EbtUint64) || + (right->getBasicType() != EbtInt && right->getBasicType() != EbtUint && + right->getBasicType() != EbtInt64 && right->getBasicType() != EbtUint64)) return false; if (left->isMatrix() || right->isMatrix()) return false; @@ -1643,6 +1736,12 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC case EbtUint: leftUnionArray[i].setDConst(static_cast(rightUnionArray[i].getUConst())); break; + case EbtInt64: + leftUnionArray[i].setDConst(static_cast(rightUnionArray[i].getI64Const())); + break; + case EbtUint64: + leftUnionArray[i].setDConst(static_cast(rightUnionArray[i].getU64Const())); + break; case EbtBool: leftUnionArray[i].setDConst(static_cast(rightUnionArray[i].getBConst())); break; @@ -1664,6 +1763,12 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC case EbtUint: leftUnionArray[i].setDConst(static_cast(rightUnionArray[i].getUConst())); break; + case EbtInt64: + leftUnionArray[i].setDConst(static_cast(rightUnionArray[i].getI64Const())); + break; + case EbtUint64: + leftUnionArray[i].setDConst(static_cast(rightUnionArray[i].getU64Const())); + break; case EbtBool: leftUnionArray[i].setDConst(static_cast(rightUnionArray[i].getBConst())); break; @@ -1683,6 +1788,12 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC case EbtUint: leftUnionArray[i].setIConst(static_cast(rightUnionArray[i].getUConst())); break; + case EbtInt64: + leftUnionArray[i].setIConst(static_cast(rightUnionArray[i].getI64Const())); + break; + case EbtUint64: + leftUnionArray[i].setIConst(static_cast(rightUnionArray[i].getU64Const())); + break; case EbtBool: leftUnionArray[i].setIConst(static_cast(rightUnionArray[i].getBConst())); break; @@ -1702,6 +1813,12 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC case EbtUint: leftUnionArray[i] = rightUnionArray[i]; break; + case EbtInt64: + leftUnionArray[i].setUConst(static_cast(rightUnionArray[i].getI64Const())); + break; + case EbtUint64: + leftUnionArray[i].setUConst(static_cast(rightUnionArray[i].getU64Const())); + break; case EbtBool: leftUnionArray[i].setUConst(static_cast(rightUnionArray[i].getBConst())); break; @@ -1721,6 +1838,12 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC case EbtUint: leftUnionArray[i].setBConst(rightUnionArray[i].getUConst() != 0); break; + case EbtInt64: + leftUnionArray[i].setBConst(rightUnionArray[i].getI64Const() != 0); + break; + case EbtUint64: + leftUnionArray[i].setBConst(rightUnionArray[i].getU64Const() != 0); + break; case EbtBool: leftUnionArray[i] = rightUnionArray[i]; break; @@ -1732,6 +1855,56 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC return node; } break; + case EbtInt64: + switch (node->getType().getBasicType()) { + case EbtInt: + leftUnionArray[i].setI64Const(static_cast(rightUnionArray[i].getIConst())); + break; + case EbtUint: + leftUnionArray[i].setI64Const(static_cast(rightUnionArray[i].getUConst())); + break; + case EbtInt64: + leftUnionArray[i] = rightUnionArray[i]; + break; + case EbtUint64: + leftUnionArray[i].setI64Const(static_cast(rightUnionArray[i].getU64Const())); + break; + case EbtBool: + leftUnionArray[i].setI64Const(static_cast(rightUnionArray[i].getBConst())); + break; + case EbtFloat: + case EbtDouble: + leftUnionArray[i].setI64Const(static_cast(rightUnionArray[i].getDConst())); + break; + default: + return node; + } + break; + case EbtUint64: + switch (node->getType().getBasicType()) { + case EbtInt: + leftUnionArray[i].setU64Const(static_cast(rightUnionArray[i].getIConst())); + break; + case EbtUint: + leftUnionArray[i].setU64Const(static_cast(rightUnionArray[i].getUConst())); + break; + case EbtInt64: + leftUnionArray[i].setU64Const(static_cast(rightUnionArray[i].getI64Const())); + break; + case EbtUint64: + leftUnionArray[i] = rightUnionArray[i]; + break; + case EbtBool: + leftUnionArray[i].setU64Const(static_cast(rightUnionArray[i].getBConst())); + break; + case EbtFloat: + case EbtDouble: + leftUnionArray[i].setU64Const(static_cast(rightUnionArray[i].getDConst())); + break; + default: + return node; + } + break; default: return node; } diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 4c1b7a0c..c9ca5d30 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -1812,6 +1812,24 @@ TOperator TParseContext::mapTypeToConstructorOp(const TType& type) const default: break; // some compilers want this } break; + case EbtInt64: + switch(type.getVectorSize()) { + case 1: op = EOpConstructInt64; break; + case 2: op = EOpConstructI64Vec2; break; + case 3: op = EOpConstructI64Vec3; break; + case 4: op = EOpConstructI64Vec4; break; + default: break; // some compilers want this + } + break; + case EbtUint64: + switch(type.getVectorSize()) { + case 1: op = EOpConstructUint64; break; + case 2: op = EOpConstructU64Vec2; break; + case 3: op = EOpConstructU64Vec3; break; + case 4: op = EOpConstructU64Vec4; break; + default: break; // some compilers want this + } + break; case EbtBool: switch(type.getVectorSize()) { case 1: op = EOpConstructBool; break; @@ -2534,13 +2552,19 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali return; } - if (publicType.basicType == EbtInt || publicType.basicType == EbtUint || publicType.basicType == EbtDouble) + if (publicType.basicType == EbtInt || publicType.basicType == EbtUint || + publicType.basicType == EbtInt64 || publicType.basicType == EbtUint64 || + publicType.basicType == EbtDouble) profileRequires(loc, EEsProfile, 300, nullptr, "shader input/output"); if (! qualifier.flat) { - if (publicType.basicType == EbtInt || publicType.basicType == EbtUint || publicType.basicType == EbtDouble || - (publicType.userDef && (publicType.userDef->containsBasicType(EbtInt) || - publicType.userDef->containsBasicType(EbtUint) || + if (publicType.basicType == EbtInt || publicType.basicType == EbtUint || + publicType.basicType == EbtInt64 || publicType.basicType == EbtUint64 || + publicType.basicType == EbtDouble || + (publicType.userDef && (publicType.userDef->containsBasicType(EbtInt) || + publicType.userDef->containsBasicType(EbtUint) || + publicType.userDef->containsBasicType(EbtInt64) || + publicType.userDef->containsBasicType(EbtUint64) || publicType.userDef->containsBasicType(EbtDouble)))) { if (qualifier.storage == EvqVaryingIn && language == EShLangFragment) error(loc, "must be qualified as flat", TType::getBasicString(publicType.basicType), GetStorageQualifierString(qualifier.storage)); @@ -4415,6 +4439,8 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type) { case EbtInt: case EbtUint: + case EbtInt64: + case EbtUint64: case EbtBool: case EbtFloat: case EbtDouble: @@ -5226,6 +5252,20 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T basicOp = EOpConstructUint; break; + case EOpConstructI64Vec2: + case EOpConstructI64Vec3: + case EOpConstructI64Vec4: + case EOpConstructInt64: + basicOp = EOpConstructInt64; + break; + + case EOpConstructU64Vec2: + case EOpConstructU64Vec3: + case EOpConstructU64Vec4: + case EOpConstructUint64: + basicOp = EOpConstructUint64; + break; + case EOpConstructBVec2: case EOpConstructBVec3: case EOpConstructBVec4: diff --git a/glslang/MachineIndependent/Scan.cpp b/glslang/MachineIndependent/Scan.cpp index 098f0bd0..762fb86c 100644 --- a/glslang/MachineIndependent/Scan.cpp +++ b/glslang/MachineIndependent/Scan.cpp @@ -454,6 +454,15 @@ void TScanContext::fillInKeywordMap() (*KeywordMap)["uvec3"] = UVEC3; (*KeywordMap)["uvec4"] = UVEC4; + (*KeywordMap)["int64_t"] = INT64_T; + (*KeywordMap)["uint64_t"] = UINT64_T; + (*KeywordMap)["i64vec2"] = I64VEC2; + (*KeywordMap)["i64vec3"] = I64VEC3; + (*KeywordMap)["i64vec4"] = I64VEC4; + (*KeywordMap)["u64vec2"] = U64VEC2; + (*KeywordMap)["u64vec3"] = U64VEC3; + (*KeywordMap)["u64vec4"] = U64VEC4; + (*KeywordMap)["sampler2D"] = SAMPLER2D; (*KeywordMap)["samplerCube"] = SAMPLERCUBE; (*KeywordMap)["samplerCubeArray"] = SAMPLERCUBEARRAY; @@ -667,10 +676,12 @@ int TScanContext::tokenize(TPpContext* pp, TParserToken& token) case PpAtomDecrement: return DEC_OP; case PpAtomIncrement: return INC_OP; - 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; - case PpAtomConstDouble: parserToken->sType.lex.d = ppToken.dval; return DOUBLECONSTANT; + case PpAtomConstInt: parserToken->sType.lex.i = ppToken.ival; return INTCONSTANT; + case PpAtomConstUint: parserToken->sType.lex.i = ppToken.ival; return UINTCONSTANT; + 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 PpAtomIdentifier: { int token = tokenizeIdentifier(); @@ -914,6 +925,18 @@ int TScanContext::tokenizeIdentifier() reservedWord(); return keyword; + case INT64_T: + case UINT64_T: + case I64VEC2: + case I64VEC3: + case I64VEC4: + case U64VEC2: + case U64VEC3: + case U64VEC4: + if (parseContext.profile != EEsProfile && parseContext.version >= 450) + return keyword; + return identifierOrType(); + case SAMPLERCUBEARRAY: case SAMPLERCUBEARRAYSHADOW: case ISAMPLERCUBEARRAY: diff --git a/glslang/MachineIndependent/SymbolTable.cpp b/glslang/MachineIndependent/SymbolTable.cpp index 75f50402..4c9b0e2c 100644 --- a/glslang/MachineIndependent/SymbolTable.cpp +++ b/glslang/MachineIndependent/SymbolTable.cpp @@ -62,6 +62,8 @@ void TType::buildMangledName(TString& mangledName) case EbtDouble: mangledName += 'd'; break; case EbtInt: mangledName += 'i'; break; case EbtUint: mangledName += 'u'; break; + case EbtInt64: mangledName += "i64"; break; + case EbtUint64: mangledName += "u64"; break; case EbtBool: mangledName += 'b'; break; case EbtAtomicUint: mangledName += "au"; break; case EbtSampler: diff --git a/glslang/MachineIndependent/Versions.cpp b/glslang/MachineIndependent/Versions.cpp index af2f7f26..019caf9b 100644 --- a/glslang/MachineIndependent/Versions.cpp +++ b/glslang/MachineIndependent/Versions.cpp @@ -174,6 +174,7 @@ void TParseVersions::initializeExtensionBehavior() extensionBehavior[E_GL_ARB_derivative_control] = EBhDisable; extensionBehavior[E_GL_ARB_shader_texture_image_samples] = EBhDisable; extensionBehavior[E_GL_ARB_viewport_array] = EBhDisable; + extensionBehavior[E_GL_ARB_gpu_shader_int64] = EBhDisable; extensionBehavior[E_GL_ARB_gl_spirv] = EBhDisable; extensionBehavior[E_GL_ARB_sparse_texture2] = EBhDisable; extensionBehavior[E_GL_ARB_sparse_texture_clamp] = EBhDisable; @@ -278,6 +279,7 @@ const char* TParseVersions::getPreamble() "#define GL_ARB_derivative_control 1\n" "#define GL_ARB_shader_texture_image_samples 1\n" "#define GL_ARB_viewport_array 1\n" + "#define GL_ARB_gpu_shader_int64 1\n" "#define GL_ARB_gl_spirv 1\n" "#define GL_ARB_sparse_texture2 1\n" "#define GL_ARB_sparse_texture_clamp 1\n" @@ -627,6 +629,17 @@ void TParseVersions::doubleCheck(const TSourceLoc& loc, const char* op) profileRequires(loc, ECompatibilityProfile, 400, nullptr, op); } +// Call for any operation needing GLSL 64-bit integer data-type support. +void TParseVersions::int64Check(const TSourceLoc& loc, const char* op, bool builtIn) +{ + if (! builtIn) { + requireExtensions(loc, 1, &E_GL_ARB_gpu_shader_int64, "shader int64"); + requireProfile(loc, ECoreProfile | ECompatibilityProfile, op); + profileRequires(loc, ECoreProfile, 450, nullptr, op); + profileRequires(loc, ECompatibilityProfile, 450, nullptr, op); + } +} + // Call for any operation removed because SPIR-V is in use. void TParseVersions::spvRemoved(const TSourceLoc& loc, const char* op) { diff --git a/glslang/MachineIndependent/Versions.h b/glslang/MachineIndependent/Versions.h index d022d876..779ba9f2 100644 --- a/glslang/MachineIndependent/Versions.h +++ b/glslang/MachineIndependent/Versions.h @@ -111,6 +111,7 @@ const char* const E_GL_ARB_shader_draw_parameters = "GL_ARB_shader_draw_pa const char* const E_GL_ARB_derivative_control = "GL_ARB_derivative_control"; const char* const E_GL_ARB_shader_texture_image_samples = "GL_ARB_shader_texture_image_samples"; const char* const E_GL_ARB_viewport_array = "GL_ARB_viewport_array"; +const char* const E_GL_ARB_gpu_shader_int64 = "GL_ARB_gpu_shader_int64"; const char* const E_GL_ARB_gl_spirv = "GL_ARB_gl_spirv"; const char* const E_GL_ARB_sparse_texture2 = "GL_ARB_sparse_texture2"; const char* const E_GL_ARB_sparse_texture_clamp = "GL_ARB_sparse_texture_clamp"; diff --git a/glslang/MachineIndependent/gl_types.h b/glslang/MachineIndependent/gl_types.h index 91603b5b..9e877d37 100644 --- a/glslang/MachineIndependent/gl_types.h +++ b/glslang/MachineIndependent/gl_types.h @@ -41,6 +41,16 @@ #define GL_UNSIGNED_INT_VEC3 0x8DC7 #define GL_UNSIGNED_INT_VEC4 0x8DC8 +#define GL_INT64_ARB 0x140E +#define GL_INT64_VEC2_ARB 0x8FE9 +#define GL_INT64_VEC3_ARB 0x8FEA +#define GL_INT64_VEC4_ARB 0x8FEB + +#define GL_UNSIGNED_INT64_ARB 0x140F +#define GL_UNSIGNED_INT64_VEC2_ARB 0x8FE5 +#define GL_UNSIGNED_INT64_VEC3_ARB 0x8FE6 +#define GL_UNSIGNED_INT64_VEC4_ARB 0x8FE7 + #define GL_BOOL 0x8B56 #define GL_BOOL_VEC2 0x8B57 #define GL_BOOL_VEC3 0x8B58 diff --git a/glslang/MachineIndependent/glslang.y b/glslang/MachineIndependent/glslang.y index 847bcc9a..976c9952 100644 --- a/glslang/MachineIndependent/glslang.y +++ b/glslang/MachineIndependent/glslang.y @@ -70,6 +70,8 @@ using namespace glslang; glslang::TString *string; int i; unsigned int u; + long long i64; + unsigned long long u64; bool b; double d; }; @@ -117,9 +119,9 @@ extern int yylex(YYSTYPE*, TParseContext&); %expect 1 // One shift reduce conflict because of if | else %token ATTRIBUTE VARYING -%token CONST BOOL FLOAT DOUBLE INT UINT +%token CONST BOOL FLOAT DOUBLE INT UINT INT64_T UINT64_T %token BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT SUBROUTINE -%token BVEC2 BVEC3 BVEC4 IVEC2 IVEC3 IVEC4 UVEC2 UVEC3 UVEC4 VEC2 VEC3 VEC4 +%token BVEC2 BVEC3 BVEC4 IVEC2 IVEC3 IVEC4 I64VEC2 I64VEC3 I64VEC4 UVEC2 UVEC3 UVEC4 U64VEC2 U64VEC3 U64VEC4 VEC2 VEC3 VEC4 %token MAT2 MAT3 MAT4 CENTROID IN OUT INOUT %token UNIFORM PATCH SAMPLE BUFFER SHARED %token COHERENT VOLATILE RESTRICT READONLY WRITEONLY @@ -180,7 +182,7 @@ extern int yylex(YYSTYPE*, TParseContext&); %token STRUCT VOID WHILE %token IDENTIFIER TYPE_NAME -%token FLOATCONSTANT DOUBLECONSTANT INTCONSTANT UINTCONSTANT BOOLCONSTANT +%token FLOATCONSTANT DOUBLECONSTANT INTCONSTANT UINTCONSTANT INT64CONSTANT UINT64CONSTANT BOOLCONSTANT %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 @@ -257,6 +259,14 @@ primary_expression parseContext.fullIntegerCheck($1.loc, "unsigned 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); + } | FLOATCONSTANT { $$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat, $1.loc, true); } @@ -1309,6 +1319,16 @@ type_specifier_nonarray $$.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; + } | BOOL { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtBool; @@ -1376,6 +1396,24 @@ type_specifier_nonarray $$.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); + } | UVEC2 { parseContext.fullIntegerCheck($1.loc, "unsigned integer vector"); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -1394,6 +1432,24 @@ type_specifier_nonarray $$.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); + } | MAT2 { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtFloat; diff --git a/glslang/MachineIndependent/glslang_tab.cpp b/glslang/MachineIndependent/glslang_tab.cpp index d435aa80..18c1a2fa 100644 --- a/glslang/MachineIndependent/glslang_tab.cpp +++ b/glslang/MachineIndependent/glslang_tab.cpp @@ -63,7 +63,7 @@ /* Copy the first part of user declarations. */ /* Line 371 of yacc.c */ -#line 41 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 41 "glslang.y" /* Based on: @@ -89,7 +89,7 @@ using namespace glslang; /* Line 371 of yacc.c */ -#line 93 "C:/Projects/glslang/glslang/MachineIndependent/glslang_tab.cpp" +#line 93 "glslang_tab.cpp" # ifndef YY_NULL # if defined __cplusplus && 201103L <= __cplusplus @@ -109,8 +109,8 @@ using namespace glslang; /* In a future release of Bison, this section will be replaced by #include "glslang_tab.cpp.h". */ -#ifndef YY_YY_C_PROJECTS_GLSLANG_GLSLANG_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED -# define YY_YY_C_PROJECTS_GLSLANG_GLSLANG_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED +#ifndef YY_YY_GLSLANG_TAB_CPP_H_INCLUDED +# define YY_YY_GLSLANG_TAB_CPP_H_INCLUDED /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 1 @@ -133,255 +133,265 @@ extern int yydebug; DOUBLE = 263, INT = 264, UINT = 265, - BREAK = 266, - CONTINUE = 267, - DO = 268, - ELSE = 269, - FOR = 270, - IF = 271, - DISCARD = 272, - RETURN = 273, - SWITCH = 274, - CASE = 275, - DEFAULT = 276, - SUBROUTINE = 277, - BVEC2 = 278, - BVEC3 = 279, - BVEC4 = 280, - IVEC2 = 281, - IVEC3 = 282, - IVEC4 = 283, - UVEC2 = 284, - UVEC3 = 285, - UVEC4 = 286, - VEC2 = 287, - VEC3 = 288, - VEC4 = 289, - MAT2 = 290, - MAT3 = 291, - MAT4 = 292, - CENTROID = 293, - IN = 294, - OUT = 295, - INOUT = 296, - UNIFORM = 297, - PATCH = 298, - SAMPLE = 299, - BUFFER = 300, - SHARED = 301, - COHERENT = 302, - VOLATILE = 303, - RESTRICT = 304, - READONLY = 305, - WRITEONLY = 306, - DVEC2 = 307, - DVEC3 = 308, - DVEC4 = 309, - DMAT2 = 310, - DMAT3 = 311, - DMAT4 = 312, - NOPERSPECTIVE = 313, - FLAT = 314, - SMOOTH = 315, - LAYOUT = 316, - MAT2X2 = 317, - MAT2X3 = 318, - MAT2X4 = 319, - MAT3X2 = 320, - MAT3X3 = 321, - MAT3X4 = 322, - MAT4X2 = 323, - MAT4X3 = 324, - MAT4X4 = 325, - DMAT2X2 = 326, - DMAT2X3 = 327, - DMAT2X4 = 328, - DMAT3X2 = 329, - DMAT3X3 = 330, - DMAT3X4 = 331, - DMAT4X2 = 332, - DMAT4X3 = 333, - DMAT4X4 = 334, - ATOMIC_UINT = 335, - SAMPLER1D = 336, - SAMPLER2D = 337, - SAMPLER3D = 338, - SAMPLERCUBE = 339, - SAMPLER1DSHADOW = 340, - SAMPLER2DSHADOW = 341, - SAMPLERCUBESHADOW = 342, - SAMPLER1DARRAY = 343, - SAMPLER2DARRAY = 344, - SAMPLER1DARRAYSHADOW = 345, - SAMPLER2DARRAYSHADOW = 346, - ISAMPLER1D = 347, - ISAMPLER2D = 348, - ISAMPLER3D = 349, - ISAMPLERCUBE = 350, - ISAMPLER1DARRAY = 351, - ISAMPLER2DARRAY = 352, - USAMPLER1D = 353, - USAMPLER2D = 354, - USAMPLER3D = 355, - USAMPLERCUBE = 356, - USAMPLER1DARRAY = 357, - USAMPLER2DARRAY = 358, - SAMPLER2DRECT = 359, - SAMPLER2DRECTSHADOW = 360, - ISAMPLER2DRECT = 361, - USAMPLER2DRECT = 362, - SAMPLERBUFFER = 363, - ISAMPLERBUFFER = 364, - USAMPLERBUFFER = 365, - SAMPLERCUBEARRAY = 366, - SAMPLERCUBEARRAYSHADOW = 367, - ISAMPLERCUBEARRAY = 368, - USAMPLERCUBEARRAY = 369, - SAMPLER2DMS = 370, - ISAMPLER2DMS = 371, - USAMPLER2DMS = 372, - SAMPLER2DMSARRAY = 373, - ISAMPLER2DMSARRAY = 374, - USAMPLER2DMSARRAY = 375, - SAMPLEREXTERNALOES = 376, - SAMPLER = 377, - SAMPLERSHADOW = 378, - TEXTURE1D = 379, - TEXTURE2D = 380, - TEXTURE3D = 381, - TEXTURECUBE = 382, - TEXTURE1DARRAY = 383, - TEXTURE2DARRAY = 384, - ITEXTURE1D = 385, - ITEXTURE2D = 386, - ITEXTURE3D = 387, - ITEXTURECUBE = 388, - ITEXTURE1DARRAY = 389, - ITEXTURE2DARRAY = 390, - UTEXTURE1D = 391, - UTEXTURE2D = 392, - UTEXTURE3D = 393, - UTEXTURECUBE = 394, - UTEXTURE1DARRAY = 395, - UTEXTURE2DARRAY = 396, - TEXTURE2DRECT = 397, - ITEXTURE2DRECT = 398, - UTEXTURE2DRECT = 399, - TEXTUREBUFFER = 400, - ITEXTUREBUFFER = 401, - UTEXTUREBUFFER = 402, - TEXTURECUBEARRAY = 403, - ITEXTURECUBEARRAY = 404, - UTEXTURECUBEARRAY = 405, - TEXTURE2DMS = 406, - ITEXTURE2DMS = 407, - UTEXTURE2DMS = 408, - TEXTURE2DMSARRAY = 409, - ITEXTURE2DMSARRAY = 410, - UTEXTURE2DMSARRAY = 411, - SUBPASSINPUT = 412, - SUBPASSINPUTMS = 413, - ISUBPASSINPUT = 414, - ISUBPASSINPUTMS = 415, - USUBPASSINPUT = 416, - USUBPASSINPUTMS = 417, - IMAGE1D = 418, - IIMAGE1D = 419, - UIMAGE1D = 420, - IMAGE2D = 421, - IIMAGE2D = 422, - UIMAGE2D = 423, - IMAGE3D = 424, - IIMAGE3D = 425, - UIMAGE3D = 426, - IMAGE2DRECT = 427, - IIMAGE2DRECT = 428, - UIMAGE2DRECT = 429, - IMAGECUBE = 430, - IIMAGECUBE = 431, - UIMAGECUBE = 432, - IMAGEBUFFER = 433, - IIMAGEBUFFER = 434, - UIMAGEBUFFER = 435, - IMAGE1DARRAY = 436, - IIMAGE1DARRAY = 437, - UIMAGE1DARRAY = 438, - IMAGE2DARRAY = 439, - IIMAGE2DARRAY = 440, - UIMAGE2DARRAY = 441, - IMAGECUBEARRAY = 442, - IIMAGECUBEARRAY = 443, - UIMAGECUBEARRAY = 444, - IMAGE2DMS = 445, - IIMAGE2DMS = 446, - UIMAGE2DMS = 447, - IMAGE2DMSARRAY = 448, - IIMAGE2DMSARRAY = 449, - UIMAGE2DMSARRAY = 450, - STRUCT = 451, - VOID = 452, - WHILE = 453, - IDENTIFIER = 454, - TYPE_NAME = 455, - FLOATCONSTANT = 456, - DOUBLECONSTANT = 457, - INTCONSTANT = 458, - UINTCONSTANT = 459, - BOOLCONSTANT = 460, - LEFT_OP = 461, - RIGHT_OP = 462, - INC_OP = 463, - DEC_OP = 464, - LE_OP = 465, - GE_OP = 466, - EQ_OP = 467, - NE_OP = 468, - AND_OP = 469, - OR_OP = 470, - XOR_OP = 471, - MUL_ASSIGN = 472, - DIV_ASSIGN = 473, - ADD_ASSIGN = 474, - MOD_ASSIGN = 475, - LEFT_ASSIGN = 476, - RIGHT_ASSIGN = 477, - AND_ASSIGN = 478, - XOR_ASSIGN = 479, - OR_ASSIGN = 480, - SUB_ASSIGN = 481, - LEFT_PAREN = 482, - RIGHT_PAREN = 483, - LEFT_BRACKET = 484, - RIGHT_BRACKET = 485, - LEFT_BRACE = 486, - RIGHT_BRACE = 487, - DOT = 488, - COMMA = 489, - COLON = 490, - EQUAL = 491, - SEMICOLON = 492, - BANG = 493, - DASH = 494, - TILDE = 495, - PLUS = 496, - STAR = 497, - SLASH = 498, - PERCENT = 499, - LEFT_ANGLE = 500, - RIGHT_ANGLE = 501, - VERTICAL_BAR = 502, - CARET = 503, - AMPERSAND = 504, - QUESTION = 505, - INVARIANT = 506, - PRECISE = 507, - HIGH_PRECISION = 508, - MEDIUM_PRECISION = 509, - LOW_PRECISION = 510, - PRECISION = 511, - PACKED = 512, - RESOURCE = 513, - SUPERP = 514 + INT64_T = 266, + UINT64_T = 267, + BREAK = 268, + CONTINUE = 269, + DO = 270, + ELSE = 271, + FOR = 272, + IF = 273, + DISCARD = 274, + RETURN = 275, + SWITCH = 276, + CASE = 277, + DEFAULT = 278, + SUBROUTINE = 279, + BVEC2 = 280, + BVEC3 = 281, + BVEC4 = 282, + IVEC2 = 283, + IVEC3 = 284, + IVEC4 = 285, + I64VEC2 = 286, + I64VEC3 = 287, + I64VEC4 = 288, + UVEC2 = 289, + UVEC3 = 290, + UVEC4 = 291, + U64VEC2 = 292, + U64VEC3 = 293, + U64VEC4 = 294, + VEC2 = 295, + VEC3 = 296, + VEC4 = 297, + MAT2 = 298, + MAT3 = 299, + MAT4 = 300, + CENTROID = 301, + IN = 302, + OUT = 303, + INOUT = 304, + UNIFORM = 305, + PATCH = 306, + SAMPLE = 307, + BUFFER = 308, + SHARED = 309, + COHERENT = 310, + VOLATILE = 311, + RESTRICT = 312, + READONLY = 313, + WRITEONLY = 314, + DVEC2 = 315, + DVEC3 = 316, + DVEC4 = 317, + DMAT2 = 318, + DMAT3 = 319, + DMAT4 = 320, + NOPERSPECTIVE = 321, + FLAT = 322, + SMOOTH = 323, + LAYOUT = 324, + MAT2X2 = 325, + MAT2X3 = 326, + MAT2X4 = 327, + MAT3X2 = 328, + MAT3X3 = 329, + MAT3X4 = 330, + MAT4X2 = 331, + MAT4X3 = 332, + MAT4X4 = 333, + DMAT2X2 = 334, + DMAT2X3 = 335, + DMAT2X4 = 336, + DMAT3X2 = 337, + DMAT3X3 = 338, + DMAT3X4 = 339, + DMAT4X2 = 340, + DMAT4X3 = 341, + DMAT4X4 = 342, + ATOMIC_UINT = 343, + SAMPLER1D = 344, + SAMPLER2D = 345, + SAMPLER3D = 346, + SAMPLERCUBE = 347, + SAMPLER1DSHADOW = 348, + SAMPLER2DSHADOW = 349, + SAMPLERCUBESHADOW = 350, + SAMPLER1DARRAY = 351, + SAMPLER2DARRAY = 352, + SAMPLER1DARRAYSHADOW = 353, + SAMPLER2DARRAYSHADOW = 354, + ISAMPLER1D = 355, + ISAMPLER2D = 356, + ISAMPLER3D = 357, + ISAMPLERCUBE = 358, + ISAMPLER1DARRAY = 359, + ISAMPLER2DARRAY = 360, + USAMPLER1D = 361, + USAMPLER2D = 362, + USAMPLER3D = 363, + USAMPLERCUBE = 364, + USAMPLER1DARRAY = 365, + USAMPLER2DARRAY = 366, + SAMPLER2DRECT = 367, + SAMPLER2DRECTSHADOW = 368, + ISAMPLER2DRECT = 369, + USAMPLER2DRECT = 370, + SAMPLERBUFFER = 371, + ISAMPLERBUFFER = 372, + USAMPLERBUFFER = 373, + SAMPLERCUBEARRAY = 374, + SAMPLERCUBEARRAYSHADOW = 375, + ISAMPLERCUBEARRAY = 376, + USAMPLERCUBEARRAY = 377, + SAMPLER2DMS = 378, + ISAMPLER2DMS = 379, + USAMPLER2DMS = 380, + SAMPLER2DMSARRAY = 381, + ISAMPLER2DMSARRAY = 382, + USAMPLER2DMSARRAY = 383, + SAMPLEREXTERNALOES = 384, + SAMPLER = 385, + SAMPLERSHADOW = 386, + TEXTURE1D = 387, + TEXTURE2D = 388, + TEXTURE3D = 389, + TEXTURECUBE = 390, + TEXTURE1DARRAY = 391, + TEXTURE2DARRAY = 392, + ITEXTURE1D = 393, + ITEXTURE2D = 394, + ITEXTURE3D = 395, + ITEXTURECUBE = 396, + ITEXTURE1DARRAY = 397, + ITEXTURE2DARRAY = 398, + UTEXTURE1D = 399, + UTEXTURE2D = 400, + UTEXTURE3D = 401, + UTEXTURECUBE = 402, + UTEXTURE1DARRAY = 403, + UTEXTURE2DARRAY = 404, + TEXTURE2DRECT = 405, + ITEXTURE2DRECT = 406, + UTEXTURE2DRECT = 407, + TEXTUREBUFFER = 408, + ITEXTUREBUFFER = 409, + UTEXTUREBUFFER = 410, + TEXTURECUBEARRAY = 411, + ITEXTURECUBEARRAY = 412, + UTEXTURECUBEARRAY = 413, + TEXTURE2DMS = 414, + ITEXTURE2DMS = 415, + UTEXTURE2DMS = 416, + TEXTURE2DMSARRAY = 417, + ITEXTURE2DMSARRAY = 418, + UTEXTURE2DMSARRAY = 419, + SUBPASSINPUT = 420, + SUBPASSINPUTMS = 421, + ISUBPASSINPUT = 422, + ISUBPASSINPUTMS = 423, + USUBPASSINPUT = 424, + USUBPASSINPUTMS = 425, + IMAGE1D = 426, + IIMAGE1D = 427, + UIMAGE1D = 428, + IMAGE2D = 429, + IIMAGE2D = 430, + UIMAGE2D = 431, + IMAGE3D = 432, + IIMAGE3D = 433, + UIMAGE3D = 434, + IMAGE2DRECT = 435, + IIMAGE2DRECT = 436, + UIMAGE2DRECT = 437, + IMAGECUBE = 438, + IIMAGECUBE = 439, + UIMAGECUBE = 440, + IMAGEBUFFER = 441, + IIMAGEBUFFER = 442, + UIMAGEBUFFER = 443, + IMAGE1DARRAY = 444, + IIMAGE1DARRAY = 445, + UIMAGE1DARRAY = 446, + IMAGE2DARRAY = 447, + IIMAGE2DARRAY = 448, + UIMAGE2DARRAY = 449, + IMAGECUBEARRAY = 450, + IIMAGECUBEARRAY = 451, + UIMAGECUBEARRAY = 452, + IMAGE2DMS = 453, + IIMAGE2DMS = 454, + UIMAGE2DMS = 455, + IMAGE2DMSARRAY = 456, + IIMAGE2DMSARRAY = 457, + UIMAGE2DMSARRAY = 458, + STRUCT = 459, + VOID = 460, + WHILE = 461, + IDENTIFIER = 462, + TYPE_NAME = 463, + FLOATCONSTANT = 464, + DOUBLECONSTANT = 465, + INTCONSTANT = 466, + UINTCONSTANT = 467, + INT64CONSTANT = 468, + UINT64CONSTANT = 469, + BOOLCONSTANT = 470, + LEFT_OP = 471, + RIGHT_OP = 472, + INC_OP = 473, + DEC_OP = 474, + LE_OP = 475, + GE_OP = 476, + EQ_OP = 477, + NE_OP = 478, + AND_OP = 479, + OR_OP = 480, + XOR_OP = 481, + MUL_ASSIGN = 482, + DIV_ASSIGN = 483, + ADD_ASSIGN = 484, + MOD_ASSIGN = 485, + LEFT_ASSIGN = 486, + RIGHT_ASSIGN = 487, + AND_ASSIGN = 488, + XOR_ASSIGN = 489, + OR_ASSIGN = 490, + SUB_ASSIGN = 491, + LEFT_PAREN = 492, + RIGHT_PAREN = 493, + LEFT_BRACKET = 494, + RIGHT_BRACKET = 495, + LEFT_BRACE = 496, + RIGHT_BRACE = 497, + DOT = 498, + COMMA = 499, + COLON = 500, + EQUAL = 501, + SEMICOLON = 502, + BANG = 503, + DASH = 504, + TILDE = 505, + PLUS = 506, + STAR = 507, + SLASH = 508, + PERCENT = 509, + LEFT_ANGLE = 510, + RIGHT_ANGLE = 511, + VERTICAL_BAR = 512, + CARET = 513, + AMPERSAND = 514, + QUESTION = 515, + INVARIANT = 516, + PRECISE = 517, + HIGH_PRECISION = 518, + MEDIUM_PRECISION = 519, + LOW_PRECISION = 520, + PRECISION = 521, + PACKED = 522, + RESOURCE = 523, + SUPERP = 524 }; #endif @@ -390,7 +400,7 @@ extern int yydebug; typedef union YYSTYPE { /* Line 387 of yacc.c */ -#line 66 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 66 "glslang.y" struct { glslang::TSourceLoc loc; @@ -398,6 +408,8 @@ typedef union YYSTYPE glslang::TString *string; int i; unsigned int u; + long long i64; + unsigned long long u64; bool b; double d; }; @@ -424,7 +436,7 @@ typedef union YYSTYPE /* Line 387 of yacc.c */ -#line 428 "C:/Projects/glslang/glslang/MachineIndependent/glslang_tab.cpp" +#line 440 "glslang_tab.cpp" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -446,11 +458,11 @@ int yyparse (); #endif #endif /* ! YYPARSE_PARAM */ -#endif /* !YY_YY_C_PROJECTS_GLSLANG_GLSLANG_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED */ +#endif /* !YY_YY_GLSLANG_TAB_CPP_H_INCLUDED */ /* Copy the second part of user declarations. */ /* Line 390 of yacc.c */ -#line 98 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 100 "glslang.y" /* windows only pragma */ @@ -467,7 +479,7 @@ extern int yylex(YYSTYPE*, TParseContext&); /* Line 390 of yacc.c */ -#line 471 "C:/Projects/glslang/glslang/MachineIndependent/glslang_tab.cpp" +#line 483 "glslang_tab.cpp" #ifdef short # undef short @@ -685,22 +697,22 @@ union yyalloc #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ -#define YYFINAL 240 +#define YYFINAL 248 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 5659 +#define YYLAST 5943 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 260 +#define YYNTOKENS 270 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 100 /* YYNRULES -- Number of rules. */ -#define YYNRULES 411 +#define YYNRULES 421 /* YYNRULES -- Number of states. */ -#define YYNSTATES 543 +#define YYNSTATES 553 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 514 +#define YYMAXUTOK 524 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -759,7 +771,8 @@ static const yytype_uint16 yytranslate[] = 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 + 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269 }; #if YYDEBUG @@ -768,23 +781,23 @@ static const yytype_uint16 yytranslate[] = static const yytype_uint16 yyprhs[] = { 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, - 21, 23, 28, 30, 34, 37, 40, 42, 44, 46, - 49, 52, 55, 57, 60, 64, 67, 69, 71, 73, - 76, 79, 82, 84, 86, 88, 90, 92, 96, 100, - 104, 106, 110, 114, 116, 120, 124, 126, 130, 134, - 138, 142, 144, 148, 152, 154, 158, 160, 164, 166, - 170, 172, 176, 178, 182, 184, 188, 190, 191, 198, - 200, 204, 206, 208, 210, 212, 214, 216, 218, 220, - 222, 224, 226, 228, 232, 234, 237, 240, 245, 248, - 252, 257, 260, 264, 269, 270, 277, 280, 284, 287, - 289, 291, 294, 298, 302, 305, 309, 312, 314, 317, - 319, 321, 323, 327, 332, 339, 345, 347, 350, 354, - 360, 365, 367, 370, 372, 374, 376, 378, 383, 385, - 389, 391, 395, 397, 399, 401, 404, 406, 408, 410, + 19, 21, 25, 27, 32, 34, 38, 41, 44, 46, + 48, 50, 53, 56, 59, 61, 64, 68, 71, 73, + 75, 77, 80, 83, 86, 88, 90, 92, 94, 96, + 100, 104, 108, 110, 114, 118, 120, 124, 128, 130, + 134, 138, 142, 146, 148, 152, 156, 158, 162, 164, + 168, 170, 174, 176, 180, 182, 186, 188, 192, 194, + 195, 202, 204, 208, 210, 212, 214, 216, 218, 220, + 222, 224, 226, 228, 230, 232, 236, 238, 241, 244, + 249, 252, 256, 261, 264, 268, 273, 274, 281, 284, + 288, 291, 293, 295, 298, 302, 306, 309, 313, 316, + 318, 321, 323, 325, 327, 331, 336, 343, 349, 351, + 354, 358, 364, 369, 371, 374, 376, 378, 380, 382, + 387, 389, 393, 395, 399, 401, 403, 405, 408, 410, 412, 414, 416, 418, 420, 422, 424, 426, 428, 430, 432, 434, 436, 438, 440, 442, 444, 446, 448, 450, - 452, 457, 459, 463, 465, 468, 471, 475, 479, 484, - 486, 488, 490, 492, 494, 496, 498, 500, 502, 504, + 452, 454, 456, 461, 463, 467, 469, 472, 475, 479, + 483, 488, 490, 492, 494, 496, 498, 500, 502, 504, 506, 508, 510, 512, 514, 516, 518, 520, 522, 524, 526, 528, 530, 532, 534, 536, 538, 540, 542, 544, 546, 548, 550, 552, 554, 556, 558, 560, 562, 564, @@ -800,172 +813,176 @@ static const yytype_uint16 yyprhs[] = 746, 748, 750, 752, 754, 756, 758, 760, 762, 764, 766, 768, 770, 772, 774, 776, 778, 780, 782, 784, 786, 788, 790, 792, 794, 796, 798, 800, 802, 804, - 806, 808, 810, 812, 814, 816, 817, 824, 825, 831, - 833, 836, 840, 845, 847, 851, 853, 856, 858, 862, - 867, 869, 873, 875, 877, 879, 881, 883, 885, 887, - 889, 891, 893, 896, 897, 898, 904, 906, 908, 909, - 912, 913, 916, 919, 923, 925, 928, 930, 933, 939, - 943, 945, 947, 952, 953, 962, 963, 965, 969, 972, - 973, 980, 981, 990, 991, 999, 1001, 1003, 1005, 1006, - 1009, 1013, 1016, 1019, 1022, 1026, 1029, 1031, 1034, 1036, - 1038, 1039 + 806, 808, 810, 812, 814, 816, 818, 820, 822, 824, + 826, 828, 830, 832, 834, 836, 837, 844, 845, 851, + 853, 856, 860, 865, 867, 871, 873, 876, 878, 882, + 887, 889, 893, 895, 897, 899, 901, 903, 905, 907, + 909, 911, 913, 916, 917, 918, 924, 926, 928, 929, + 932, 933, 936, 939, 943, 945, 948, 950, 953, 959, + 963, 965, 967, 972, 973, 982, 983, 985, 989, 992, + 993, 1000, 1001, 1010, 1011, 1019, 1021, 1023, 1025, 1026, + 1029, 1033, 1036, 1039, 1042, 1046, 1049, 1051, 1054, 1056, + 1058, 1059 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int16 yyrhs[] = { - 356, 0, -1, 199, -1, 261, -1, 203, -1, 204, - -1, 201, -1, 202, -1, 205, -1, 227, 289, 228, - -1, 262, -1, 263, 229, 264, 230, -1, 265, -1, - 263, 233, 199, -1, 263, 208, -1, 263, 209, -1, - 289, -1, 266, -1, 267, -1, 269, 228, -1, 268, - 228, -1, 270, 197, -1, 270, -1, 270, 287, -1, - 269, 234, 287, -1, 271, 227, -1, 315, -1, 263, - -1, 263, -1, 208, 272, -1, 209, 272, -1, 273, - 272, -1, 241, -1, 239, -1, 238, -1, 240, -1, - 272, -1, 274, 242, 272, -1, 274, 243, 272, -1, - 274, 244, 272, -1, 274, -1, 275, 241, 274, -1, - 275, 239, 274, -1, 275, -1, 276, 206, 275, -1, - 276, 207, 275, -1, 276, -1, 277, 245, 276, -1, - 277, 246, 276, -1, 277, 210, 276, -1, 277, 211, - 276, -1, 277, -1, 278, 212, 277, -1, 278, 213, - 277, -1, 278, -1, 279, 249, 278, -1, 279, -1, - 280, 248, 279, -1, 280, -1, 281, 247, 280, -1, - 281, -1, 282, 214, 281, -1, 282, -1, 283, 216, - 282, -1, 283, -1, 284, 215, 283, -1, 284, -1, - -1, 284, 250, 286, 289, 235, 287, -1, 285, -1, - 272, 288, 287, -1, 236, -1, 217, -1, 218, -1, - 220, -1, 219, -1, 226, -1, 221, -1, 222, -1, - 223, -1, 224, -1, 225, -1, 287, -1, 289, 234, - 287, -1, 285, -1, 295, 237, -1, 302, 237, -1, - 256, 318, 315, 237, -1, 292, 237, -1, 292, 199, - 237, -1, 292, 199, 316, 237, -1, 311, 237, -1, - 311, 199, 237, -1, 311, 199, 294, 237, -1, -1, - 311, 199, 231, 293, 322, 232, -1, 234, 199, -1, - 294, 234, 199, -1, 296, 228, -1, 298, -1, 297, - -1, 298, 300, -1, 297, 234, 300, -1, 304, 199, - 227, -1, 315, 199, -1, 315, 199, 316, -1, 311, - 299, -1, 299, -1, 311, 301, -1, 301, -1, 315, - -1, 303, -1, 302, 234, 199, -1, 302, 234, 199, - 316, -1, 302, 234, 199, 316, 236, 326, -1, 302, - 234, 199, 236, 326, -1, 304, -1, 304, 199, -1, - 304, 199, 316, -1, 304, 199, 316, 236, 326, -1, - 304, 199, 236, 326, -1, 315, -1, 311, 315, -1, - 251, -1, 60, -1, 59, -1, 58, -1, 61, 227, - 308, 228, -1, 309, -1, 308, 234, 309, -1, 199, - -1, 199, 236, 290, -1, 46, -1, 252, -1, 312, - -1, 311, 312, -1, 313, -1, 307, -1, 318, -1, - 306, -1, 305, -1, 310, -1, 5, -1, 3, -1, - 4, -1, 41, -1, 39, -1, 40, -1, 38, -1, - 43, -1, 44, -1, 42, -1, 45, -1, 46, -1, - 47, -1, 48, -1, 49, -1, 50, -1, 51, -1, - 22, -1, 22, 227, 314, 228, -1, 200, -1, 314, - 234, 200, -1, 317, -1, 317, 316, -1, 229, 230, - -1, 229, 285, 230, -1, 316, 229, 230, -1, 316, - 229, 285, 230, -1, 197, -1, 7, -1, 8, -1, - 9, -1, 10, -1, 6, -1, 32, -1, 33, -1, - 34, -1, 52, -1, 53, -1, 54, -1, 23, -1, - 24, -1, 25, -1, 26, -1, 27, -1, 28, -1, - 29, -1, 30, -1, 31, -1, 35, -1, 36, -1, - 37, -1, 62, -1, 63, -1, 64, -1, 65, -1, - 66, -1, 67, -1, 68, -1, 69, -1, 70, -1, - 55, -1, 56, -1, 57, -1, 71, -1, 72, -1, - 73, -1, 74, -1, 75, -1, 76, -1, 77, -1, - 78, -1, 79, -1, 80, -1, 81, -1, 82, -1, - 83, -1, 84, -1, 85, -1, 86, -1, 87, -1, - 88, -1, 89, -1, 90, -1, 91, -1, 111, -1, - 112, -1, 92, -1, 93, -1, 94, -1, 95, -1, - 96, -1, 97, -1, 113, -1, 98, -1, 99, -1, - 100, -1, 101, -1, 102, -1, 103, -1, 114, -1, - 104, -1, 105, -1, 106, -1, 107, -1, 108, -1, - 109, -1, 110, -1, 115, -1, 116, -1, 117, -1, - 118, -1, 119, -1, 120, -1, 122, -1, 123, -1, - 124, -1, 125, -1, 126, -1, 127, -1, 128, -1, - 129, -1, 148, -1, 130, -1, 131, -1, 132, -1, - 133, -1, 134, -1, 135, -1, 149, -1, 136, -1, - 137, -1, 138, -1, 139, -1, 140, -1, 141, -1, - 150, -1, 142, -1, 143, -1, 144, -1, 145, -1, - 146, -1, 147, -1, 151, -1, 152, -1, 153, -1, - 154, -1, 155, -1, 156, -1, 163, -1, 164, -1, - 165, -1, 166, -1, 167, -1, 168, -1, 169, -1, - 170, -1, 171, -1, 172, -1, 173, -1, 174, -1, - 175, -1, 176, -1, 177, -1, 178, -1, 179, -1, - 180, -1, 181, -1, 182, -1, 183, -1, 184, -1, - 185, -1, 186, -1, 187, -1, 188, -1, 189, -1, - 190, -1, 191, -1, 192, -1, 193, -1, 194, -1, - 195, -1, 121, -1, 157, -1, 158, -1, 159, -1, - 160, -1, 161, -1, 162, -1, 319, -1, 200, -1, - 253, -1, 254, -1, 255, -1, -1, 196, 199, 231, - 320, 322, 232, -1, -1, 196, 231, 321, 322, 232, - -1, 323, -1, 322, 323, -1, 315, 324, 237, -1, - 311, 315, 324, 237, -1, 325, -1, 324, 234, 325, - -1, 199, -1, 199, 316, -1, 287, -1, 231, 327, - 232, -1, 231, 327, 234, 232, -1, 326, -1, 327, - 234, 326, -1, 291, -1, 331, -1, 330, -1, 328, - -1, 340, -1, 341, -1, 344, -1, 347, -1, 348, - -1, 355, -1, 231, 232, -1, -1, -1, 231, 332, - 339, 333, 232, -1, 338, -1, 330, -1, -1, 336, - 331, -1, -1, 337, 330, -1, 231, 232, -1, 231, - 339, 232, -1, 329, -1, 339, 329, -1, 237, -1, - 289, 237, -1, 16, 227, 289, 228, 342, -1, 335, - 14, 335, -1, 335, -1, 289, -1, 304, 199, 236, - 326, -1, -1, 19, 227, 289, 228, 345, 231, 346, - 232, -1, -1, 339, -1, 20, 289, 235, -1, 21, - 235, -1, -1, 198, 227, 349, 343, 228, 334, -1, - -1, 13, 350, 329, 198, 227, 289, 228, 237, -1, - -1, 15, 227, 351, 352, 354, 228, 334, -1, 340, - -1, 328, -1, 343, -1, -1, 353, 237, -1, 353, - 237, 289, -1, 12, 237, -1, 11, 237, -1, 18, - 237, -1, 18, 289, 237, -1, 17, 237, -1, 357, - -1, 356, 357, -1, 358, -1, 291, -1, -1, 295, - 359, 338, -1 + 366, 0, -1, 207, -1, 271, -1, 211, -1, 212, + -1, 213, -1, 214, -1, 209, -1, 210, -1, 215, + -1, 237, 299, 238, -1, 272, -1, 273, 239, 274, + 240, -1, 275, -1, 273, 243, 207, -1, 273, 218, + -1, 273, 219, -1, 299, -1, 276, -1, 277, -1, + 279, 238, -1, 278, 238, -1, 280, 205, -1, 280, + -1, 280, 297, -1, 279, 244, 297, -1, 281, 237, + -1, 325, -1, 273, -1, 273, -1, 218, 282, -1, + 219, 282, -1, 283, 282, -1, 251, -1, 249, -1, + 248, -1, 250, -1, 282, -1, 284, 252, 282, -1, + 284, 253, 282, -1, 284, 254, 282, -1, 284, -1, + 285, 251, 284, -1, 285, 249, 284, -1, 285, -1, + 286, 216, 285, -1, 286, 217, 285, -1, 286, -1, + 287, 255, 286, -1, 287, 256, 286, -1, 287, 220, + 286, -1, 287, 221, 286, -1, 287, -1, 288, 222, + 287, -1, 288, 223, 287, -1, 288, -1, 289, 259, + 288, -1, 289, -1, 290, 258, 289, -1, 290, -1, + 291, 257, 290, -1, 291, -1, 292, 224, 291, -1, + 292, -1, 293, 226, 292, -1, 293, -1, 294, 225, + 293, -1, 294, -1, -1, 294, 260, 296, 299, 245, + 297, -1, 295, -1, 282, 298, 297, -1, 246, -1, + 227, -1, 228, -1, 230, -1, 229, -1, 236, -1, + 231, -1, 232, -1, 233, -1, 234, -1, 235, -1, + 297, -1, 299, 244, 297, -1, 295, -1, 305, 247, + -1, 312, 247, -1, 266, 328, 325, 247, -1, 302, + 247, -1, 302, 207, 247, -1, 302, 207, 326, 247, + -1, 321, 247, -1, 321, 207, 247, -1, 321, 207, + 304, 247, -1, -1, 321, 207, 241, 303, 332, 242, + -1, 244, 207, -1, 304, 244, 207, -1, 306, 238, + -1, 308, -1, 307, -1, 308, 310, -1, 307, 244, + 310, -1, 314, 207, 237, -1, 325, 207, -1, 325, + 207, 326, -1, 321, 309, -1, 309, -1, 321, 311, + -1, 311, -1, 325, -1, 313, -1, 312, 244, 207, + -1, 312, 244, 207, 326, -1, 312, 244, 207, 326, + 246, 336, -1, 312, 244, 207, 246, 336, -1, 314, + -1, 314, 207, -1, 314, 207, 326, -1, 314, 207, + 326, 246, 336, -1, 314, 207, 246, 336, -1, 325, + -1, 321, 325, -1, 261, -1, 68, -1, 67, -1, + 66, -1, 69, 237, 318, 238, -1, 319, -1, 318, + 244, 319, -1, 207, -1, 207, 246, 300, -1, 54, + -1, 262, -1, 322, -1, 321, 322, -1, 323, -1, + 317, -1, 328, -1, 316, -1, 315, -1, 320, -1, + 5, -1, 3, -1, 4, -1, 49, -1, 47, -1, + 48, -1, 46, -1, 51, -1, 52, -1, 50, -1, + 53, -1, 54, -1, 55, -1, 56, -1, 57, -1, + 58, -1, 59, -1, 24, -1, 24, 237, 324, 238, + -1, 208, -1, 324, 244, 208, -1, 327, -1, 327, + 326, -1, 239, 240, -1, 239, 295, 240, -1, 326, + 239, 240, -1, 326, 239, 295, 240, -1, 205, -1, + 7, -1, 8, -1, 9, -1, 10, -1, 11, -1, + 12, -1, 6, -1, 40, -1, 41, -1, 42, -1, + 60, -1, 61, -1, 62, -1, 25, -1, 26, -1, + 27, -1, 28, -1, 29, -1, 30, -1, 31, -1, + 32, -1, 33, -1, 34, -1, 35, -1, 36, -1, + 37, -1, 38, -1, 39, -1, 43, -1, 44, -1, + 45, -1, 70, -1, 71, -1, 72, -1, 73, -1, + 74, -1, 75, -1, 76, -1, 77, -1, 78, -1, + 63, -1, 64, -1, 65, -1, 79, -1, 80, -1, + 81, -1, 82, -1, 83, -1, 84, -1, 85, -1, + 86, -1, 87, -1, 88, -1, 89, -1, 90, -1, + 91, -1, 92, -1, 93, -1, 94, -1, 95, -1, + 96, -1, 97, -1, 98, -1, 99, -1, 119, -1, + 120, -1, 100, -1, 101, -1, 102, -1, 103, -1, + 104, -1, 105, -1, 121, -1, 106, -1, 107, -1, + 108, -1, 109, -1, 110, -1, 111, -1, 122, -1, + 112, -1, 113, -1, 114, -1, 115, -1, 116, -1, + 117, -1, 118, -1, 123, -1, 124, -1, 125, -1, + 126, -1, 127, -1, 128, -1, 130, -1, 131, -1, + 132, -1, 133, -1, 134, -1, 135, -1, 136, -1, + 137, -1, 156, -1, 138, -1, 139, -1, 140, -1, + 141, -1, 142, -1, 143, -1, 157, -1, 144, -1, + 145, -1, 146, -1, 147, -1, 148, -1, 149, -1, + 158, -1, 150, -1, 151, -1, 152, -1, 153, -1, + 154, -1, 155, -1, 159, -1, 160, -1, 161, -1, + 162, -1, 163, -1, 164, -1, 171, -1, 172, -1, + 173, -1, 174, -1, 175, -1, 176, -1, 177, -1, + 178, -1, 179, -1, 180, -1, 181, -1, 182, -1, + 183, -1, 184, -1, 185, -1, 186, -1, 187, -1, + 188, -1, 189, -1, 190, -1, 191, -1, 192, -1, + 193, -1, 194, -1, 195, -1, 196, -1, 197, -1, + 198, -1, 199, -1, 200, -1, 201, -1, 202, -1, + 203, -1, 129, -1, 165, -1, 166, -1, 167, -1, + 168, -1, 169, -1, 170, -1, 329, -1, 208, -1, + 263, -1, 264, -1, 265, -1, -1, 204, 207, 241, + 330, 332, 242, -1, -1, 204, 241, 331, 332, 242, + -1, 333, -1, 332, 333, -1, 325, 334, 247, -1, + 321, 325, 334, 247, -1, 335, -1, 334, 244, 335, + -1, 207, -1, 207, 326, -1, 297, -1, 241, 337, + 242, -1, 241, 337, 244, 242, -1, 336, -1, 337, + 244, 336, -1, 301, -1, 341, -1, 340, -1, 338, + -1, 350, -1, 351, -1, 354, -1, 357, -1, 358, + -1, 365, -1, 241, 242, -1, -1, -1, 241, 342, + 349, 343, 242, -1, 348, -1, 340, -1, -1, 346, + 341, -1, -1, 347, 340, -1, 241, 242, -1, 241, + 349, 242, -1, 339, -1, 349, 339, -1, 247, -1, + 299, 247, -1, 18, 237, 299, 238, 352, -1, 345, + 16, 345, -1, 345, -1, 299, -1, 314, 207, 246, + 336, -1, -1, 21, 237, 299, 238, 355, 241, 356, + 242, -1, -1, 349, -1, 22, 299, 245, -1, 23, + 245, -1, -1, 206, 237, 359, 353, 238, 344, -1, + -1, 15, 360, 339, 206, 237, 299, 238, 247, -1, + -1, 17, 237, 361, 362, 364, 238, 344, -1, 350, + -1, 338, -1, 353, -1, -1, 363, 247, -1, 363, + 247, 299, -1, 14, 247, -1, 13, 247, -1, 20, + 247, -1, 20, 299, 247, -1, 19, 247, -1, 367, + -1, 366, 367, -1, 368, -1, 301, -1, -1, 305, + 369, 348, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 244, 244, 250, 253, 256, 260, 263, 267, 270, - 278, 281, 284, 287, 290, 295, 303, 310, 317, 323, - 327, 334, 337, 343, 350, 360, 368, 373, 403, 409, - 413, 417, 437, 438, 439, 440, 446, 447, 452, 457, - 466, 467, 472, 480, 481, 487, 496, 497, 502, 507, - 512, 520, 521, 529, 540, 541, 550, 551, 560, 561, - 570, 571, 579, 580, 588, 589, 597, 598, 598, 616, - 617, 632, 636, 640, 644, 649, 653, 657, 661, 665, - 669, 673, 680, 683, 693, 700, 705, 710, 718, 722, - 726, 730, 735, 740, 749, 749, 760, 764, 771, 778, - 781, 788, 796, 816, 834, 849, 872, 883, 893, 903, - 913, 922, 925, 929, 933, 938, 946, 951, 956, 961, - 966, 975, 986, 1013, 1022, 1029, 1036, 1046, 1052, 1055, - 1062, 1066, 1070, 1078, 1084, 1087, 1098, 1101, 1104, 1107, - 1111, 1115, 1122, 1126, 1138, 1152, 1157, 1163, 1169, 1176, - 1182, 1187, 1192, 1197, 1204, 1208, 1212, 1216, 1220, 1224, - 1230, 1242, 1245, 1250, 1254, 1263, 1268, 1276, 1280, 1290, - 1294, 1298, 1303, 1307, 1312, 1316, 1321, 1326, 1331, 1337, - 1343, 1349, 1354, 1359, 1364, 1369, 1374, 1379, 1385, 1391, - 1397, 1402, 1407, 1412, 1417, 1422, 1427, 1432, 1437, 1442, - 1447, 1452, 1457, 1463, 1469, 1475, 1481, 1487, 1493, 1499, - 1505, 1511, 1517, 1523, 1529, 1534, 1539, 1544, 1549, 1554, - 1559, 1564, 1569, 1574, 1579, 1584, 1589, 1594, 1599, 1604, - 1609, 1614, 1619, 1624, 1629, 1634, 1639, 1644, 1649, 1654, - 1659, 1664, 1669, 1674, 1679, 1684, 1689, 1694, 1699, 1704, - 1709, 1714, 1719, 1724, 1729, 1734, 1739, 1744, 1749, 1754, - 1759, 1764, 1769, 1774, 1779, 1784, 1789, 1794, 1799, 1804, - 1809, 1814, 1819, 1824, 1829, 1834, 1839, 1844, 1849, 1854, - 1859, 1864, 1869, 1874, 1879, 1884, 1889, 1894, 1899, 1904, - 1909, 1914, 1919, 1924, 1929, 1934, 1939, 1944, 1949, 1954, - 1959, 1964, 1969, 1974, 1979, 1984, 1989, 1994, 1999, 2004, - 2009, 2014, 2019, 2024, 2029, 2034, 2039, 2044, 2049, 2054, - 2059, 2064, 2069, 2074, 2080, 2086, 2092, 2098, 2104, 2110, - 2116, 2121, 2137, 2143, 2149, 2158, 2158, 2169, 2169, 2179, - 2182, 2195, 2213, 2237, 2241, 2247, 2252, 2263, 2266, 2272, - 2281, 2284, 2290, 2294, 2295, 2301, 2302, 2303, 2304, 2305, - 2306, 2307, 2311, 2312, 2316, 2312, 2328, 2329, 2333, 2333, - 2340, 2340, 2354, 2357, 2365, 2373, 2384, 2385, 2389, 2396, - 2400, 2408, 2412, 2425, 2425, 2445, 2448, 2454, 2466, 2478, - 2478, 2493, 2493, 2509, 2509, 2530, 2533, 2539, 2542, 2548, - 2552, 2559, 2564, 2569, 2576, 2594, 2603, 2607, 2614, 2617, - 2623, 2623 + 0, 246, 246, 252, 255, 258, 262, 266, 270, 273, + 277, 280, 288, 291, 294, 297, 300, 305, 313, 320, + 327, 333, 337, 344, 347, 353, 360, 370, 378, 383, + 413, 419, 423, 427, 447, 448, 449, 450, 456, 457, + 462, 467, 476, 477, 482, 490, 491, 497, 506, 507, + 512, 517, 522, 530, 531, 539, 550, 551, 560, 561, + 570, 571, 580, 581, 589, 590, 598, 599, 607, 608, + 608, 626, 627, 642, 646, 650, 654, 659, 663, 667, + 671, 675, 679, 683, 690, 693, 703, 710, 715, 720, + 728, 732, 736, 740, 745, 750, 759, 759, 770, 774, + 781, 788, 791, 798, 806, 826, 844, 859, 882, 893, + 903, 913, 923, 932, 935, 939, 943, 948, 956, 961, + 966, 971, 976, 985, 996, 1023, 1032, 1039, 1046, 1056, + 1062, 1065, 1072, 1076, 1080, 1088, 1094, 1097, 1108, 1111, + 1114, 1117, 1121, 1125, 1132, 1136, 1148, 1162, 1167, 1173, + 1179, 1186, 1192, 1197, 1202, 1207, 1214, 1218, 1222, 1226, + 1230, 1234, 1240, 1252, 1255, 1260, 1264, 1273, 1278, 1286, + 1290, 1300, 1304, 1308, 1313, 1317, 1322, 1327, 1332, 1336, + 1341, 1346, 1351, 1357, 1363, 1369, 1374, 1379, 1384, 1389, + 1394, 1399, 1405, 1411, 1417, 1423, 1429, 1435, 1441, 1447, + 1453, 1458, 1463, 1468, 1473, 1478, 1483, 1488, 1493, 1498, + 1503, 1508, 1513, 1519, 1525, 1531, 1537, 1543, 1549, 1555, + 1561, 1567, 1573, 1579, 1585, 1590, 1595, 1600, 1605, 1610, + 1615, 1620, 1625, 1630, 1635, 1640, 1645, 1650, 1655, 1660, + 1665, 1670, 1675, 1680, 1685, 1690, 1695, 1700, 1705, 1710, + 1715, 1720, 1725, 1730, 1735, 1740, 1745, 1750, 1755, 1760, + 1765, 1770, 1775, 1780, 1785, 1790, 1795, 1800, 1805, 1810, + 1815, 1820, 1825, 1830, 1835, 1840, 1845, 1850, 1855, 1860, + 1865, 1870, 1875, 1880, 1885, 1890, 1895, 1900, 1905, 1910, + 1915, 1920, 1925, 1930, 1935, 1940, 1945, 1950, 1955, 1960, + 1965, 1970, 1975, 1980, 1985, 1990, 1995, 2000, 2005, 2010, + 2015, 2020, 2025, 2030, 2035, 2040, 2045, 2050, 2055, 2060, + 2065, 2070, 2075, 2080, 2085, 2090, 2095, 2100, 2105, 2110, + 2115, 2120, 2125, 2130, 2136, 2142, 2148, 2154, 2160, 2166, + 2172, 2177, 2193, 2199, 2205, 2214, 2214, 2225, 2225, 2235, + 2238, 2251, 2269, 2293, 2297, 2303, 2308, 2319, 2322, 2328, + 2337, 2340, 2346, 2350, 2351, 2357, 2358, 2359, 2360, 2361, + 2362, 2363, 2367, 2368, 2372, 2368, 2384, 2385, 2389, 2389, + 2396, 2396, 2410, 2413, 2421, 2429, 2440, 2441, 2445, 2452, + 2456, 2464, 2468, 2481, 2481, 2501, 2504, 2510, 2522, 2534, + 2534, 2549, 2549, 2565, 2565, 2586, 2589, 2595, 2598, 2604, + 2608, 2615, 2620, 2625, 2632, 2650, 2659, 2663, 2670, 2673, + 2679, 2679 }; #endif @@ -975,14 +992,15 @@ static const yytype_uint16 yyrline[] = static const char *const yytname[] = { "$end", "error", "$undefined", "ATTRIBUTE", "VARYING", "CONST", "BOOL", - "FLOAT", "DOUBLE", "INT", "UINT", "BREAK", "CONTINUE", "DO", "ELSE", - "FOR", "IF", "DISCARD", "RETURN", "SWITCH", "CASE", "DEFAULT", - "SUBROUTINE", "BVEC2", "BVEC3", "BVEC4", "IVEC2", "IVEC3", "IVEC4", - "UVEC2", "UVEC3", "UVEC4", "VEC2", "VEC3", "VEC4", "MAT2", "MAT3", - "MAT4", "CENTROID", "IN", "OUT", "INOUT", "UNIFORM", "PATCH", "SAMPLE", - "BUFFER", "SHARED", "COHERENT", "VOLATILE", "RESTRICT", "READONLY", - "WRITEONLY", "DVEC2", "DVEC3", "DVEC4", "DMAT2", "DMAT3", "DMAT4", - "NOPERSPECTIVE", "FLAT", "SMOOTH", "LAYOUT", "MAT2X2", "MAT2X3", + "FLOAT", "DOUBLE", "INT", "UINT", "INT64_T", "UINT64_T", "BREAK", + "CONTINUE", "DO", "ELSE", "FOR", "IF", "DISCARD", "RETURN", "SWITCH", + "CASE", "DEFAULT", "SUBROUTINE", "BVEC2", "BVEC3", "BVEC4", "IVEC2", + "IVEC3", "IVEC4", "I64VEC2", "I64VEC3", "I64VEC4", "UVEC2", "UVEC3", + "UVEC4", "U64VEC2", "U64VEC3", "U64VEC4", "VEC2", "VEC3", "VEC4", "MAT2", + "MAT3", "MAT4", "CENTROID", "IN", "OUT", "INOUT", "UNIFORM", "PATCH", + "SAMPLE", "BUFFER", "SHARED", "COHERENT", "VOLATILE", "RESTRICT", + "READONLY", "WRITEONLY", "DVEC2", "DVEC3", "DVEC4", "DMAT2", "DMAT3", + "DMAT4", "NOPERSPECTIVE", "FLAT", "SMOOTH", "LAYOUT", "MAT2X2", "MAT2X3", "MAT2X4", "MAT3X2", "MAT3X3", "MAT3X4", "MAT4X2", "MAT4X3", "MAT4X4", "DMAT2X2", "DMAT2X3", "DMAT2X4", "DMAT3X2", "DMAT3X3", "DMAT3X4", "DMAT4X2", "DMAT4X3", "DMAT4X4", "ATOMIC_UINT", "SAMPLER1D", "SAMPLER2D", @@ -1016,20 +1034,20 @@ static const char *const yytname[] = "UIMAGECUBEARRAY", "IMAGE2DMS", "IIMAGE2DMS", "UIMAGE2DMS", "IMAGE2DMSARRAY", "IIMAGE2DMSARRAY", "UIMAGE2DMSARRAY", "STRUCT", "VOID", "WHILE", "IDENTIFIER", "TYPE_NAME", "FLOATCONSTANT", "DOUBLECONSTANT", - "INTCONSTANT", "UINTCONSTANT", "BOOLCONSTANT", "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", + "INTCONSTANT", "UINTCONSTANT", "INT64CONSTANT", "UINT64CONSTANT", + "BOOLCONSTANT", "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", "function_call_header_with_parameters", "function_call_header", "function_identifier", "unary_expression", "unary_operator", "multiplicative_expression", "additive_expression", "shift_expression", @@ -1093,77 +1111,80 @@ static const yytype_uint16 yytoknum[] = 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, - 505, 506, 507, 508, 509, 510, 511, 512, 513, 514 + 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, + 515, 516, 517, 518, 519, 520, 521, 522, 523, 524 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint16 yyr1[] = { - 0, 260, 261, 262, 262, 262, 262, 262, 262, 262, - 263, 263, 263, 263, 263, 263, 264, 265, 266, 267, - 267, 268, 268, 269, 269, 270, 271, 271, 272, 272, - 272, 272, 273, 273, 273, 273, 274, 274, 274, 274, - 275, 275, 275, 276, 276, 276, 277, 277, 277, 277, - 277, 278, 278, 278, 279, 279, 280, 280, 281, 281, - 282, 282, 283, 283, 284, 284, 285, 286, 285, 287, - 287, 288, 288, 288, 288, 288, 288, 288, 288, 288, - 288, 288, 289, 289, 290, 291, 291, 291, 291, 291, - 291, 291, 291, 291, 293, 292, 294, 294, 295, 296, - 296, 297, 297, 298, 299, 299, 300, 300, 300, 300, - 301, 302, 302, 302, 302, 302, 303, 303, 303, 303, - 303, 304, 304, 305, 306, 306, 306, 307, 308, 308, - 309, 309, 309, 310, 311, 311, 312, 312, 312, 312, - 312, 312, 313, 313, 313, 313, 313, 313, 313, 313, - 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - 313, 314, 314, 315, 315, 316, 316, 316, 316, 317, - 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, - 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, - 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, - 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, - 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, - 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, - 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, - 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, - 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, - 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, - 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, - 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, - 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, - 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, - 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, - 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, - 317, 317, 318, 318, 318, 320, 319, 321, 319, 322, - 322, 323, 323, 324, 324, 325, 325, 326, 326, 326, - 327, 327, 328, 329, 329, 330, 330, 330, 330, 330, - 330, 330, 331, 332, 333, 331, 334, 334, 336, 335, - 337, 335, 338, 338, 339, 339, 340, 340, 341, 342, - 342, 343, 343, 345, 344, 346, 346, 347, 347, 349, - 348, 350, 348, 351, 348, 352, 352, 353, 353, 354, - 354, 355, 355, 355, 355, 355, 356, 356, 357, 357, - 359, 358 + 0, 270, 271, 272, 272, 272, 272, 272, 272, 272, + 272, 272, 273, 273, 273, 273, 273, 273, 274, 275, + 276, 277, 277, 278, 278, 279, 279, 280, 281, 281, + 282, 282, 282, 282, 283, 283, 283, 283, 284, 284, + 284, 284, 285, 285, 285, 286, 286, 286, 287, 287, + 287, 287, 287, 288, 288, 288, 289, 289, 290, 290, + 291, 291, 292, 292, 293, 293, 294, 294, 295, 296, + 295, 297, 297, 298, 298, 298, 298, 298, 298, 298, + 298, 298, 298, 298, 299, 299, 300, 301, 301, 301, + 301, 301, 301, 301, 301, 301, 303, 302, 304, 304, + 305, 306, 306, 307, 307, 308, 309, 309, 310, 310, + 310, 310, 311, 312, 312, 312, 312, 312, 313, 313, + 313, 313, 313, 314, 314, 315, 316, 316, 316, 317, + 318, 318, 319, 319, 319, 320, 321, 321, 322, 322, + 322, 322, 322, 322, 323, 323, 323, 323, 323, 323, + 323, 323, 323, 323, 323, 323, 323, 323, 323, 323, + 323, 323, 323, 324, 324, 325, 325, 326, 326, 326, + 326, 327, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 328, 328, 328, 330, 329, 331, 329, 332, + 332, 333, 333, 334, 334, 335, 335, 336, 336, 336, + 337, 337, 338, 339, 339, 340, 340, 340, 340, 340, + 340, 340, 341, 342, 343, 341, 344, 344, 346, 345, + 347, 345, 348, 348, 349, 349, 350, 350, 351, 352, + 352, 353, 353, 355, 354, 356, 356, 357, 357, 359, + 358, 360, 358, 361, 358, 362, 362, 363, 363, 364, + 364, 365, 365, 365, 365, 365, 366, 366, 367, 367, + 369, 368 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { - 0, 2, 1, 1, 1, 1, 1, 1, 1, 3, - 1, 4, 1, 3, 2, 2, 1, 1, 1, 2, - 2, 2, 1, 2, 3, 2, 1, 1, 1, 2, - 2, 2, 1, 1, 1, 1, 1, 3, 3, 3, - 1, 3, 3, 1, 3, 3, 1, 3, 3, 3, - 3, 1, 3, 3, 1, 3, 1, 3, 1, 3, - 1, 3, 1, 3, 1, 3, 1, 0, 6, 1, - 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 3, 1, 2, 2, 4, 2, 3, - 4, 2, 3, 4, 0, 6, 2, 3, 2, 1, - 1, 2, 3, 3, 2, 3, 2, 1, 2, 1, - 1, 1, 3, 4, 6, 5, 1, 2, 3, 5, - 4, 1, 2, 1, 1, 1, 1, 4, 1, 3, - 1, 3, 1, 1, 1, 2, 1, 1, 1, 1, + 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 3, 1, 4, 1, 3, 2, 2, 1, 1, + 1, 2, 2, 2, 1, 2, 3, 2, 1, 1, + 1, 2, 2, 2, 1, 1, 1, 1, 1, 3, + 3, 3, 1, 3, 3, 1, 3, 3, 1, 3, + 3, 3, 3, 1, 3, 3, 1, 3, 1, 3, + 1, 3, 1, 3, 1, 3, 1, 3, 1, 0, + 6, 1, 3, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 3, 1, 2, 2, 4, + 2, 3, 4, 2, 3, 4, 0, 6, 2, 3, + 2, 1, 1, 2, 3, 3, 2, 3, 2, 1, + 2, 1, 1, 1, 3, 4, 6, 5, 1, 2, + 3, 5, 4, 1, 2, 1, 1, 1, 1, 4, + 1, 3, 1, 3, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 4, 1, 3, 1, 2, 2, 3, 3, 4, 1, + 1, 1, 4, 1, 3, 1, 2, 2, 3, 3, + 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -1196,367 +1217,220 @@ static const yytype_uint8 yyr2[] = means the default is an error. */ static const yytype_uint16 yydefact[] = { - 0, 143, 144, 142, 174, 170, 171, 172, 173, 159, - 181, 182, 183, 184, 185, 186, 187, 188, 189, 175, - 176, 177, 190, 191, 192, 148, 146, 147, 145, 151, - 149, 150, 152, 153, 154, 155, 156, 157, 158, 178, - 179, 180, 202, 203, 204, 126, 125, 124, 0, 193, - 194, 195, 196, 197, 198, 199, 200, 201, 205, 206, - 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, - 217, 218, 219, 220, 221, 222, 223, 224, 225, 228, - 229, 230, 231, 232, 233, 235, 236, 237, 238, 239, - 240, 242, 243, 244, 245, 246, 247, 248, 226, 227, - 234, 241, 249, 250, 251, 252, 253, 254, 323, 255, - 256, 257, 258, 259, 260, 261, 262, 264, 265, 266, - 267, 268, 269, 271, 272, 273, 274, 275, 276, 278, - 279, 280, 281, 282, 283, 263, 270, 277, 284, 285, - 286, 287, 288, 289, 324, 325, 326, 327, 328, 329, - 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, 0, 169, 331, 123, 133, 332, 333, - 334, 0, 409, 0, 410, 0, 100, 99, 0, 111, - 116, 140, 139, 137, 141, 0, 134, 136, 121, 163, - 138, 330, 0, 406, 408, 0, 0, 0, 337, 0, - 0, 88, 85, 0, 98, 0, 107, 101, 109, 0, - 110, 0, 86, 117, 0, 91, 135, 122, 0, 164, - 1, 407, 161, 0, 132, 130, 0, 128, 335, 0, - 0, 89, 0, 0, 411, 102, 106, 108, 104, 112, - 103, 0, 118, 94, 0, 92, 0, 2, 6, 7, - 4, 5, 8, 0, 0, 0, 165, 34, 33, 35, - 32, 3, 10, 28, 12, 17, 18, 0, 0, 22, - 0, 36, 0, 40, 43, 46, 51, 54, 56, 58, - 60, 62, 64, 66, 0, 26, 0, 160, 0, 0, - 127, 0, 0, 0, 0, 0, 339, 87, 90, 0, - 0, 391, 0, 0, 0, 0, 0, 0, 0, 0, - 363, 372, 376, 36, 69, 82, 0, 352, 0, 121, - 355, 374, 354, 353, 0, 356, 357, 358, 359, 360, - 361, 105, 0, 113, 0, 347, 120, 0, 0, 96, - 0, 93, 29, 30, 0, 14, 15, 0, 0, 20, - 19, 0, 169, 23, 25, 31, 0, 0, 0, 0, + 0, 145, 146, 144, 178, 172, 173, 174, 175, 176, + 177, 161, 185, 186, 187, 188, 189, 190, 191, 192, + 193, 194, 195, 196, 197, 198, 199, 179, 180, 181, + 200, 201, 202, 150, 148, 149, 147, 153, 151, 152, + 154, 155, 156, 157, 158, 159, 160, 182, 183, 184, + 212, 213, 214, 128, 127, 126, 0, 203, 204, 205, + 206, 207, 208, 209, 210, 211, 215, 216, 217, 218, + 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, + 229, 230, 231, 232, 233, 234, 235, 238, 239, 240, + 241, 242, 243, 245, 246, 247, 248, 249, 250, 252, + 253, 254, 255, 256, 257, 258, 236, 237, 244, 251, + 259, 260, 261, 262, 263, 264, 333, 265, 266, 267, + 268, 269, 270, 271, 272, 274, 275, 276, 277, 278, + 279, 281, 282, 283, 284, 285, 286, 288, 289, 290, + 291, 292, 293, 273, 280, 287, 294, 295, 296, 297, + 298, 299, 334, 335, 336, 337, 338, 339, 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, 0, 171, 341, 125, 135, 342, 343, 344, 0, + 419, 0, 420, 0, 102, 101, 0, 113, 118, 142, + 141, 139, 143, 0, 136, 138, 123, 165, 140, 340, + 0, 416, 418, 0, 0, 0, 347, 0, 0, 90, + 87, 0, 100, 0, 109, 103, 111, 0, 112, 0, + 88, 119, 0, 93, 137, 124, 0, 166, 1, 417, + 163, 0, 134, 132, 0, 130, 345, 0, 0, 91, + 0, 0, 421, 104, 108, 110, 106, 114, 105, 0, + 120, 96, 0, 94, 0, 2, 8, 9, 4, 5, + 6, 7, 10, 0, 0, 0, 167, 36, 35, 37, + 34, 3, 12, 30, 14, 19, 20, 0, 0, 24, + 0, 38, 0, 42, 45, 48, 53, 56, 58, 60, + 62, 64, 66, 68, 0, 28, 0, 162, 0, 0, + 129, 0, 0, 0, 0, 0, 349, 89, 92, 0, + 0, 401, 0, 0, 0, 0, 0, 0, 0, 0, + 373, 382, 386, 38, 71, 84, 0, 362, 0, 123, + 365, 384, 364, 363, 0, 366, 367, 368, 369, 370, + 371, 107, 0, 115, 0, 357, 122, 0, 0, 98, + 0, 95, 31, 32, 0, 16, 17, 0, 0, 22, + 21, 0, 171, 25, 27, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 67, 166, 167, 0, 162, - 84, 131, 129, 0, 0, 345, 0, 343, 338, 340, - 402, 401, 0, 393, 0, 405, 403, 0, 0, 0, - 388, 389, 362, 0, 72, 73, 75, 74, 77, 78, - 79, 80, 81, 76, 71, 0, 0, 377, 373, 375, - 115, 0, 350, 0, 119, 0, 97, 9, 0, 16, - 13, 24, 37, 38, 39, 42, 41, 44, 45, 49, - 50, 47, 48, 52, 53, 55, 57, 59, 61, 63, - 65, 0, 168, 336, 0, 346, 0, 341, 0, 0, - 0, 404, 0, 387, 0, 364, 70, 83, 114, 348, - 0, 95, 11, 0, 342, 344, 0, 396, 395, 398, - 370, 383, 381, 0, 0, 0, 0, 349, 351, 0, - 0, 397, 0, 0, 380, 0, 0, 378, 0, 0, - 0, 365, 68, 0, 399, 0, 370, 369, 371, 385, - 0, 367, 390, 366, 0, 400, 394, 379, 386, 0, - 382, 392, 384 + 0, 0, 0, 0, 0, 69, 168, 169, 0, 164, + 86, 133, 131, 0, 0, 355, 0, 353, 348, 350, + 412, 411, 0, 403, 0, 415, 413, 0, 0, 0, + 398, 399, 372, 0, 74, 75, 77, 76, 79, 80, + 81, 82, 83, 78, 73, 0, 0, 387, 383, 385, + 117, 0, 360, 0, 121, 0, 99, 11, 0, 18, + 15, 26, 39, 40, 41, 44, 43, 46, 47, 51, + 52, 49, 50, 54, 55, 57, 59, 61, 63, 65, + 67, 0, 170, 346, 0, 356, 0, 351, 0, 0, + 0, 414, 0, 397, 0, 374, 72, 85, 116, 358, + 0, 97, 13, 0, 352, 354, 0, 406, 405, 408, + 380, 393, 391, 0, 0, 0, 0, 359, 361, 0, + 0, 407, 0, 0, 390, 0, 0, 388, 0, 0, + 0, 375, 70, 0, 409, 0, 380, 379, 381, 395, + 0, 377, 400, 376, 0, 410, 404, 389, 396, 0, + 392, 402, 394 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 281, 282, 283, 448, 284, 285, 286, 287, 288, - 289, 290, 333, 292, 293, 294, 295, 296, 297, 298, - 299, 300, 301, 302, 303, 334, 471, 335, 435, 336, - 401, 337, 193, 358, 266, 338, 195, 196, 197, 226, - 227, 228, 198, 199, 200, 201, 202, 203, 246, 247, - 204, 205, 206, 207, 243, 305, 239, 209, 210, 211, - 312, 249, 315, 316, 406, 407, 356, 443, 340, 341, - 342, 343, 423, 506, 532, 514, 515, 516, 533, 344, - 345, 346, 517, 505, 347, 518, 539, 348, 349, 484, - 412, 479, 499, 512, 513, 350, 212, 213, 214, 223 + -1, 291, 292, 293, 458, 294, 295, 296, 297, 298, + 299, 300, 343, 302, 303, 304, 305, 306, 307, 308, + 309, 310, 311, 312, 313, 344, 481, 345, 445, 346, + 411, 347, 201, 368, 274, 348, 203, 204, 205, 234, + 235, 236, 206, 207, 208, 209, 210, 211, 254, 255, + 212, 213, 214, 215, 251, 315, 247, 217, 218, 219, + 322, 257, 325, 326, 416, 417, 366, 453, 350, 351, + 352, 353, 433, 516, 542, 524, 525, 526, 543, 354, + 355, 356, 527, 515, 357, 528, 549, 358, 359, 494, + 422, 489, 509, 522, 523, 360, 220, 221, 222, 231 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -466 +#define YYPACT_NINF -496 static const yytype_int16 yypact[] = { - 2275, -466, -466, -466, -466, -466, -466, -466, -466, -205, - -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, - -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, - -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, - -466, -466, -466, -466, -466, -466, -466, -466, -192, -466, - -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, - -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, - -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, - -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, - -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, - -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, - -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, - -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, - -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, - -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, - -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, - -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, - -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, - -466, -466, -466, -179, -466, -466, -466, -466, -466, -466, - -466, -122, -466, -186, -198, -173, -175, 3686, -194, -466, - -121, -466, -466, -466, -466, 2749, -466, -466, -466, -141, - -466, -466, 527, -466, -466, -97, -37, -117, -466, 5459, - -200, -466, -466, -112, -466, 3686, -466, -466, -466, 3686, - -71, -44, -466, -191, -142, -466, -466, -466, 4117, -82, - -466, -466, -466, -202, -466, -76, -137, -466, -466, 3686, - -73, -466, -196, 781, -466, -466, -466, -466, -141, -155, - -466, 4342, -152, -466, -38, -466, -177, -466, -466, -466, - -466, -466, -466, 5015, 5015, 5015, -466, -466, -466, -466, - -466, -466, -466, -185, -466, -466, -466, -63, -128, 5237, - -61, -466, 5015, -106, -100, -157, -183, -78, -81, -79, - -80, -43, -46, -197, -58, -466, 4568, -466, -27, 5015, - -466, -37, 3686, 3686, -25, 2984, -466, -466, -466, -62, - -57, -466, -51, -48, -56, 4793, -45, 5015, -50, -40, - -41, -466, -466, -153, -466, -466, -147, -466, -198, -39, - -466, -466, -466, -466, 1035, -466, -466, -466, -466, -466, - -466, -82, 4342, -143, 4342, -466, -466, 4342, 3686, -466, - -15, -466, -466, -466, -126, -466, -466, 5015, -10, -466, - -466, 5015, -36, -466, -466, -466, 5015, 5015, 5015, 5015, - 5015, 5015, 5015, 5015, 5015, 5015, 5015, 5015, 5015, 5015, - 5015, 5015, 5015, 5015, 5015, -466, -466, -466, -35, -466, - -466, -466, -466, 3218, -25, -141, -127, -466, -466, -466, - -466, -466, 1289, -466, 5015, -466, -466, -108, 5015, -91, - -466, -466, -466, 1289, -466, -466, -466, -466, -466, -466, - -466, -466, -466, -466, -466, 5015, 5015, -466, -466, -466, - -466, 4342, -466, -92, -466, 3452, -466, -466, -34, -31, - -466, -466, -466, -466, -466, -106, -106, -100, -100, -157, - -157, -157, -157, -183, -183, -78, -81, -79, -80, -43, - -46, 5015, -466, -466, -107, -82, -25, -466, -4, 2036, - -123, -466, -116, -466, 2510, 1289, -466, -466, -466, -466, - 3890, -466, -466, -83, -466, -466, -29, -466, -466, 2510, - -32, -466, -31, 1, 3686, -24, -26, -466, -466, 5015, - 5015, -466, -30, -19, 196, -20, 1797, -466, -18, -22, - 1543, -466, -466, -113, 5015, 1543, -32, -466, -466, 1289, - 4342, -466, -466, -466, -17, -31, -466, -466, 1289, -14, - -466, -466, -466 + 2394, -496, -496, -496, -496, -496, -496, -496, -496, -496, + -496, -199, -496, -496, -496, -496, -496, -496, -496, -496, + -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, + -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, + -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, + -496, -496, -496, -496, -496, -496, -187, -496, -496, -496, + -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, + -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, + -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, + -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, + -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, + -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, + -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, + -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, + -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, + -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, + -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, + -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, + -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, + -496, -180, -496, -496, -496, -496, -496, -496, -496, -134, + -496, -191, -181, -155, -131, 3871, -133, -496, -69, -496, + -496, -496, -496, 2900, -496, -496, -496, -92, -496, -496, + 546, -496, -496, -68, -45, -91, -496, 5735, -200, -496, + -496, -85, -496, 3871, -496, -496, -496, 3871, -50, -49, + -496, -209, -193, -496, -496, -496, 4323, -80, -496, -496, + -496, -202, -496, -86, -171, -496, -496, 3871, -84, -496, + -198, 810, -496, -496, -496, -496, -92, -214, -496, 4558, + -176, -496, -46, -496, -127, -496, -496, -496, -496, -496, + -496, -496, -496, 5271, 5271, 5271, -496, -496, -496, -496, + -496, -496, -496, -175, -496, -496, -496, -73, -169, 5503, + -71, -496, 5271, -118, -170, -195, -197, -90, -89, -87, + -88, -57, -58, -208, -67, -496, 4804, -496, -36, 5271, + -496, -45, 3871, 3871, -33, 3145, -496, -496, -496, -72, + -70, -496, -61, -59, -66, 5039, -55, 5271, -62, -51, + -54, -496, -496, -141, -496, -496, -125, -496, -181, -48, + -496, -496, -496, -496, 1074, -496, -496, -496, -496, -496, + -496, -80, 4558, -174, 4558, -496, -496, 4558, 3871, -496, + -23, -496, -496, -496, -167, -496, -496, 5271, -20, -496, + -496, 5271, -43, -496, -496, -496, 5271, 5271, 5271, 5271, + 5271, 5271, 5271, 5271, 5271, 5271, 5271, 5271, 5271, 5271, + 5271, 5271, 5271, 5271, 5271, -496, -496, -496, -44, -496, + -496, -496, -496, 3387, -33, -92, -121, -496, -496, -496, + -496, -496, 1338, -496, 5271, -496, -496, -120, 5271, -102, + -496, -496, -496, 1338, -496, -496, -496, -496, -496, -496, + -496, -496, -496, -496, -496, 5271, 5271, -496, -496, -496, + -496, 4558, -496, -105, -496, 3629, -496, -496, -42, -52, + -496, -496, -496, -496, -496, -118, -118, -170, -170, -195, + -195, -195, -195, -197, -197, -90, -89, -87, -88, -57, + -58, 5271, -496, -496, -119, -80, -33, -496, -16, 2130, + -164, -496, -160, -496, 2637, 1338, -496, -496, -496, -496, + 4077, -496, -496, -99, -496, -496, -40, -496, -496, 2637, + -41, -496, -52, -8, 3871, -35, -38, -496, -496, 5271, + 5271, -496, -39, -32, 191, -31, 1866, -496, -30, -34, + 1602, -496, -496, -138, 5271, 1602, -41, -496, -496, 1338, + 4558, -496, -496, -496, -29, -52, -496, -496, 1338, -27, + -496, -496, -496 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, - -466, -466, -52, -466, -226, -225, -261, -229, -166, -164, - -167, -165, -162, -161, -466, -227, -466, -258, -466, -269, - -466, 4, -466, -466, -466, 5, -466, -466, -466, -1, - 9, 6, -466, -466, -465, -466, -466, -466, -466, -75, - -466, -195, -204, -466, -466, 0, -212, -466, 46, -466, - -466, -466, -297, -299, -160, -238, -340, -466, -240, -337, - -440, -273, -466, -466, -282, -281, -466, -466, 23, -413, - -232, -466, -466, -251, -466, -466, -466, -466, -466, -466, - -466, -466, -466, -466, -466, -466, -466, 40, -466, -466 + -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, + -496, -496, -53, -496, -237, -288, -286, -243, -183, -179, + -184, -177, -168, -185, -496, -234, -496, -266, -496, -280, + -496, 4, -496, -496, -496, 6, -496, -496, -496, -15, + -10, -9, -496, -496, -475, -496, -496, -496, -496, -83, + -496, -204, -211, -496, -496, 0, -221, -496, 33, -496, + -496, -496, -308, -314, -178, -247, -349, -496, -248, -346, + -495, -283, -496, -496, -292, -291, -496, -496, 13, -423, + -242, -496, -496, -263, -496, -496, -496, -496, -496, -496, + -496, -496, -496, -496, -496, -496, -496, 28, -496, -496 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -369 +#define YYTABLE_NINF -379 static const yytype_int16 yytable[] = { - 208, 236, 229, 355, 192, 194, 364, 439, 252, 244, - 485, 304, 440, 220, 442, 403, 409, 444, 394, 503, - 217, 262, 215, 365, 366, 236, 307, 383, 384, 238, - 229, 373, 308, 306, 503, 216, 260, 251, 238, 222, - 231, 318, -27, 232, 367, 261, 351, 353, 368, 381, - 382, 221, 218, 395, 313, 224, 417, 360, 419, 225, - 361, 445, 385, 386, 424, 425, 426, 427, 428, 429, - 430, 431, 432, 433, 238, 478, 528, 306, 233, 398, - 531, 352, 400, 434, 357, 531, 306, 436, 238, 263, - 437, 310, 264, 441, 355, 265, 355, 311, 449, 355, - 370, 488, 447, 242, 409, 500, 371, 476, 436, 236, - 477, 436, 501, 451, 248, 534, 538, 313, 436, 253, - 313, 436, 459, 460, 461, 462, 436, 476, 258, 481, - 494, 188, 189, 190, 387, 388, 376, 377, 378, 379, - 489, 380, 490, 436, 483, 480, 409, 306, 439, 482, - 508, 436, 509, 455, 456, 259, 457, 458, 463, 464, - 309, 359, 245, 313, 317, 369, 374, 391, 389, 390, - 393, 392, 396, 399, 405, 410, 413, 486, 487, 414, - 411, 415, 418, 355, 446, 420, 291, 421, -26, 450, - 540, 422, -21, 475, 496, 472, 492, 230, 510, -368, - 519, 439, 493, 436, 520, 237, 521, 524, 313, 525, - 526, 330, 208, 529, 530, 502, 192, 194, 542, 250, - 541, 362, 363, 465, 467, 230, 466, 468, 256, 230, - 502, 469, 355, 470, 255, 257, 402, 219, 495, 497, - 375, 523, 527, 536, 474, 537, 254, 498, 511, 314, - 313, 522, 241, 339, 291, 535, 0, 291, 0, 0, + 216, 237, 244, 365, 200, 374, 202, 260, 449, 252, + 495, 419, 314, 450, 413, 452, 228, 404, 454, 513, + 270, 391, 392, 393, 394, 246, 244, 225, 268, 237, + 246, 538, 362, 383, 513, 541, 317, 269, 223, 246, + 541, 316, 318, 375, 376, 361, 363, 259, 271, 328, + 224, 272, 405, 323, 273, 427, 229, 429, 395, 396, + 455, 226, -29, 316, 377, 316, 230, 320, 378, 380, + 367, 457, 451, 321, 510, 381, 488, 446, 511, 389, + 446, 390, 408, 232, 446, 410, 434, 435, 436, 437, + 438, 439, 440, 441, 442, 443, 365, 459, 365, 419, + 544, 365, 498, 467, 468, 444, 446, 469, 470, 471, + 472, 239, 244, 233, 240, 461, 548, 370, 323, 446, + 371, 323, 447, 486, 446, 486, 487, 491, 504, 196, + 197, 198, 397, 398, 386, 387, 388, 499, 241, 500, + 250, 419, 446, 493, 490, 446, 519, 246, 492, 449, + 256, 518, 465, 466, 473, 474, 261, 266, 267, 316, + 319, 369, 253, 327, 323, 379, 384, 402, 403, 401, + 399, 400, 409, 406, 415, 420, 423, 421, 424, 496, + 497, 425, 428, 430, 456, 365, 431, 460, 432, -28, + 506, 550, 446, 301, 485, -23, 482, 520, 502, 529, + -378, 503, 449, 530, 531, 238, 535, 536, 534, 323, + 340, 539, 540, 245, 512, 552, 475, 477, 551, 480, + 216, 476, 264, 263, 200, 478, 202, 258, 265, 512, + 372, 373, 227, 238, 365, 479, 484, 238, 412, 505, + 533, 507, 537, 546, 262, 547, 521, 508, 249, 385, + 0, 323, 0, 532, 545, 0, 0, 324, 0, 0, + 0, 349, 0, 301, 0, 0, 301, 0, 0, 0, + 0, 0, 0, 0, 365, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 355, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 504, + 514, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 244, 0, 514, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 236, 0, 0, 0, 504, 0, 0, 0, 0, 0, - 0, 0, 314, 404, 0, 314, 0, 0, 0, 0, - 0, 0, 0, 0, 452, 453, 454, 291, 291, 291, - 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, - 291, 291, 291, 0, 339, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 314, 0, + 0, 0, 324, 414, 0, 324, 0, 0, 0, 0, + 0, 0, 0, 462, 463, 464, 301, 301, 301, 301, + 301, 301, 301, 301, 301, 301, 301, 301, 301, 301, + 301, 301, 0, 0, 349, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 324, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 314, 0, 0, 0, 0, 0, 0, - 0, 0, 339, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 339, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 324, 0, 0, 0, 0, 0, 0, + 0, 0, 349, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 349, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 314, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 324, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 339, - 0, 0, 0, 0, 339, 339, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 339, - 0, 0, 0, 0, 237, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 339, 0, 0, 0, - 339, 0, 0, 0, 0, 339, 0, 240, 0, 339, - 1, 2, 3, 4, 5, 6, 7, 8, 339, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 185, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 349, + 0, 0, 0, 0, 349, 349, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 349, + 0, 0, 0, 0, 245, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 349, 0, 0, 0, + 349, 0, 0, 0, 0, 349, 0, 0, 0, 349, + 0, 0, 0, 0, 0, 0, 248, 0, 349, 1, + 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 186, 187, - 188, 189, 190, 191, 1, 2, 3, 4, 5, 6, - 7, 8, 319, 320, 321, 0, 322, 323, 324, 325, - 326, 327, 328, 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, 329, - 267, 185, 268, 269, 270, 271, 272, 0, 0, 273, - 274, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 275, 0, - 0, 0, 330, 331, 0, 0, 0, 0, 332, 277, - 278, 279, 280, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 186, 187, 188, 189, 190, 191, 1, 2, - 3, 4, 5, 6, 7, 8, 319, 320, 321, 0, - 322, 323, 324, 325, 326, 327, 328, 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, 329, 267, 185, 268, 269, 270, 271, - 272, 0, 0, 273, 274, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 275, 0, 0, 0, 330, 438, 0, 0, - 0, 0, 332, 277, 278, 279, 280, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 186, 187, 188, 189, - 190, 191, 1, 2, 3, 4, 5, 6, 7, 8, - 319, 320, 321, 0, 322, 323, 324, 325, 326, 327, - 328, 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, 329, 267, 185, - 268, 269, 270, 271, 272, 0, 0, 273, 274, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 275, 0, 0, 0, - 330, 0, 0, 0, 0, 0, 332, 277, 278, 279, - 280, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 186, 187, 188, 189, 190, 191, 1, 2, 3, 4, - 5, 6, 7, 8, 319, 320, 321, 0, 322, 323, - 324, 325, 326, 327, 328, 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, 329, 267, 185, 268, 269, 270, 271, 272, 0, - 0, 273, 274, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 275, 0, 0, 0, 253, 0, 0, 0, 0, 0, - 332, 277, 278, 279, 280, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 186, 187, 188, 189, 190, 191, - 1, 2, 3, 4, 5, 6, 7, 8, 319, 320, - 321, 0, 322, 323, 324, 325, 326, 327, 328, 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, 329, 267, 185, 268, 269, - 270, 271, 272, 0, 0, 273, 274, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 275, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 332, 277, 278, 279, 280, 1, - 2, 3, 4, 5, 6, 7, 8, 0, 186, 187, - 188, 189, 190, 191, 0, 0, 0, 0, 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, @@ -1574,37 +1448,16 @@ static const yytype_int16 yytable[] = 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, 0, 267, 185, 268, 269, 270, - 271, 272, 0, 0, 273, 274, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 275, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 332, 277, 278, 279, 280, 1, 2, - 3, 4, 5, 6, 7, 8, 0, 186, 187, 188, - 189, 190, 191, 0, 0, 0, 0, 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, 0, 0, 185, 0, 0, 0, 0, + 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, + 191, 192, 0, 0, 193, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, - 8, 0, 0, 0, 0, 0, 186, 187, 188, 189, - 190, 191, 9, 10, 11, 12, 13, 14, 15, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 194, 195, 196, + 197, 198, 199, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 329, 330, 331, 0, 332, 333, 334, + 335, 336, 337, 338, 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, @@ -1621,37 +1474,16 @@ static const yytype_int16 yytable[] = 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, 0, 267, - 185, 268, 269, 270, 271, 272, 0, 0, 273, 274, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 339, 275, 193, 276, + 277, 278, 279, 280, 281, 282, 0, 0, 283, 284, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 275, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 277, 278, - 279, 280, 1, 2, 3, 4, 5, 6, 7, 8, - 0, 186, 187, 188, 189, 190, 0, 0, 0, 0, - 0, 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, 0, 234, 185, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 235, 1, 2, 3, - 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, - 186, 187, 188, 189, 190, 0, 9, 10, 11, 12, + 0, 0, 0, 0, 0, 0, 0, 285, 0, 0, + 0, 340, 341, 0, 0, 0, 0, 342, 287, 288, + 289, 290, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 194, 195, 196, 197, 198, 199, 1, 2, 3, + 4, 5, 6, 7, 8, 9, 10, 329, 330, 331, + 0, 332, 333, 334, 335, 336, 337, 338, 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, @@ -1669,344 +1501,16 @@ static const yytype_int16 yytable[] = 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, 0, 0, 185, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 408, 0, 0, 0, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, - 0, 0, 0, 0, 0, 186, 187, 188, 189, 190, - 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, 0, 0, 185, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 473, 0, 0, 0, 0, 1, 2, 3, 4, 5, - 6, 7, 8, 0, 0, 0, 0, 0, 0, 186, - 187, 188, 189, 190, 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, - 0, 0, 185, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 491, 0, 0, 0, 0, 1, - 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, - 0, 0, 0, 186, 187, 188, 189, 190, 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, 0, 0, 185, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 4, 5, 6, 7, - 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 186, 187, 188, - 189, 190, 39, 40, 41, 42, 43, 44, 0, 0, - 0, 0, 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, 0, 267, - 185, 268, 269, 270, 271, 272, 0, 0, 273, 274, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 275, 0, 0, - 0, 354, 507, 4, 5, 6, 7, 8, 277, 278, - 279, 280, 0, 0, 0, 0, 0, 0, 0, 0, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 39, - 40, 41, 42, 43, 44, 0, 0, 0, 0, 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, 0, 267, 185, 268, 269, - 270, 271, 272, 0, 0, 273, 274, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 275, 0, 0, 276, 4, 5, - 6, 7, 8, 0, 0, 277, 278, 279, 280, 0, - 0, 0, 0, 0, 0, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 39, 40, 41, 42, 43, 44, - 0, 0, 0, 0, 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, - 0, 267, 185, 268, 269, 270, 271, 272, 0, 0, - 273, 274, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 275, - 0, 0, 0, 354, 4, 5, 6, 7, 8, 0, - 277, 278, 279, 280, 0, 0, 0, 0, 0, 0, - 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 39, 40, 41, 42, 43, 44, 0, 0, 0, 0, - 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, 0, 267, 185, 268, - 269, 270, 271, 272, 0, 0, 273, 274, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 275, 0, 0, 397, 4, - 5, 6, 7, 8, 0, 0, 277, 278, 279, 280, - 0, 0, 0, 0, 0, 0, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 39, 40, 41, 42, 43, - 44, 0, 0, 0, 0, 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, 0, 267, 185, 268, 269, 270, 271, 272, 0, - 0, 273, 274, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 275, 4, 5, 6, 7, 8, 0, 0, 0, 0, - 416, 277, 278, 279, 280, 0, 0, 0, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 39, 40, 41, - 42, 43, 44, 0, 0, 0, 0, 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, 0, 267, 185, 268, 269, 270, 271, - 272, 0, 0, 273, 274, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 275, 4, 5, 6, 7, 8, 0, 0, - 0, 0, 0, 277, 278, 279, 280, 0, 0, 0, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 39, - 40, 41, 42, 43, 44, 0, 0, 0, 0, 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, 372, 0, 267, 185, 268, 269, - 270, 271, 272, 0, 0, 273, 274, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 275, 4, 5, 6, 7, 8, - 0, 0, 0, 0, 0, 277, 278, 279, 280, 0, - 0, 0, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 39, 40, 41, 42, 43, 44, 0, 0, 0, - 0, 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, 0, 0, 185 -}; - -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-466))) - -#define yytable_value_is_error(Yytable_value) \ - YYID (0) - -static const yytype_int16 yycheck[] = -{ - 0, 205, 197, 261, 0, 0, 275, 344, 220, 46, - 423, 238, 352, 199, 354, 312, 315, 357, 215, 484, - 199, 233, 227, 208, 209, 229, 228, 210, 211, 229, - 225, 289, 234, 229, 499, 227, 227, 237, 229, 237, - 234, 237, 227, 237, 229, 236, 258, 259, 233, 206, - 207, 237, 231, 250, 249, 228, 325, 234, 327, 234, - 237, 358, 245, 246, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 229, 412, 516, 229, 199, 306, - 520, 236, 309, 236, 236, 525, 229, 234, 229, 231, - 237, 228, 234, 236, 352, 237, 354, 234, 367, 357, - 228, 441, 228, 200, 403, 228, 234, 234, 234, 313, - 237, 234, 228, 371, 231, 228, 529, 312, 234, 231, - 315, 234, 383, 384, 385, 386, 234, 234, 199, 237, - 237, 253, 254, 255, 212, 213, 242, 243, 244, 239, - 232, 241, 234, 234, 235, 414, 445, 229, 485, 418, - 490, 234, 235, 379, 380, 199, 381, 382, 387, 388, - 236, 199, 199, 358, 237, 228, 227, 247, 249, 248, - 216, 214, 230, 200, 199, 237, 227, 435, 436, 227, - 237, 237, 227, 441, 199, 235, 238, 227, 227, 199, - 530, 232, 228, 405, 198, 230, 230, 197, 227, 231, - 199, 538, 471, 234, 228, 205, 232, 237, 403, 228, - 14, 231, 212, 231, 236, 484, 212, 212, 232, 219, - 237, 273, 274, 389, 391, 225, 390, 392, 229, 229, - 499, 393, 490, 394, 225, 229, 311, 191, 476, 479, - 292, 510, 515, 525, 404, 526, 223, 479, 499, 249, - 445, 509, 212, 253, 306, 524, -1, 309, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 530, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 484, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 504, -1, -1, -1, 499, -1, -1, -1, -1, -1, - -1, -1, 312, 313, -1, 315, -1, -1, -1, -1, - -1, -1, -1, -1, 376, 377, 378, 379, 380, 381, - 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, - 392, 393, 394, -1, 344, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 358, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 403, -1, -1, -1, -1, -1, -1, - -1, -1, 412, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 423, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 445, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 479, - -1, -1, -1, -1, 484, 485, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 499, - -1, -1, -1, -1, 504, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 516, -1, -1, -1, - 520, -1, -1, -1, -1, 525, -1, 0, -1, 529, - 3, 4, 5, 6, 7, 8, 9, 10, 538, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 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, -1, -1, 200, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 251, 252, - 253, 254, 255, 256, 3, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, -1, 15, 16, 17, 18, + 339, 275, 193, 276, 277, 278, 279, 280, 281, 282, + 0, 0, 283, 284, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 285, 0, 0, 0, 340, 448, 0, 0, 0, + 0, 342, 287, 288, 289, 290, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 194, 195, 196, 197, 198, + 199, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 329, 330, 331, 0, 332, 333, 334, 335, 336, + 337, 338, 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, @@ -2024,14 +1528,15 @@ static const yytype_int16 yycheck[] = 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, -1, -1, 208, - 209, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 227, -1, - -1, -1, 231, 232, -1, -1, -1, -1, 237, 238, - 239, 240, 241, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 251, 252, 253, 254, 255, 256, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, -1, + 189, 190, 191, 192, 339, 275, 193, 276, 277, 278, + 279, 280, 281, 282, 0, 0, 283, 284, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 285, 0, 0, 0, 340, + 0, 0, 0, 0, 0, 342, 287, 288, 289, 290, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 194, + 195, 196, 197, 198, 199, 1, 2, 3, 4, 5, + 6, 7, 8, 9, 10, 329, 330, 331, 0, 332, + 333, 334, 335, 336, 337, 338, 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, @@ -2049,67 +1554,773 @@ static const yytype_int16 yycheck[] = 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, 339, 275, + 193, 276, 277, 278, 279, 280, 281, 282, 0, 0, + 283, 284, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 285, + 0, 0, 0, 261, 0, 0, 0, 0, 0, 342, + 287, 288, 289, 290, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 194, 195, 196, 197, 198, 199, 1, + 2, 3, 4, 5, 6, 7, 8, 9, 10, 329, + 330, 331, 0, 332, 333, 334, 335, 336, 337, 338, + 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, 339, 275, 193, 276, 277, 278, 279, 280, + 281, 282, 0, 0, 283, 284, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 285, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 342, 287, 288, 289, 290, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 194, 195, 196, + 197, 198, 199, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 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, 0, 275, 193, 276, + 277, 278, 279, 280, 281, 282, 0, 0, 283, 284, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 285, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 342, 287, 288, + 289, 290, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 194, 195, 196, 197, 198, 199, 1, 2, 3, + 4, 5, 6, 7, 8, 9, 10, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 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, + 0, 0, 193, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 0, 0, 0, 0, 0, 194, 195, 196, 197, 198, + 199, 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, 0, 275, 193, 276, 277, 278, 279, + 280, 281, 282, 0, 0, 283, 284, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 285, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 287, 288, 289, 290, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 194, 195, + 196, 197, 198, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 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, 0, 242, 193, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 243, 1, 2, + 3, 4, 5, 6, 7, 8, 9, 10, 0, 0, + 0, 194, 195, 196, 197, 198, 0, 0, 0, 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, 0, 0, 193, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 418, 0, 0, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 0, 0, 0, 0, 0, 0, 194, 195, 196, 197, + 198, 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, 0, 0, 193, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 483, + 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, + 9, 10, 0, 0, 0, 0, 0, 0, 194, 195, + 196, 197, 198, 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, 0, 0, 193, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 501, 0, 0, 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 0, 0, 0, 0, 0, 0, + 194, 195, 196, 197, 198, 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, 0, 0, 193, + 0, 0, 0, 4, 5, 6, 7, 8, 9, 10, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 194, 195, 196, 197, 198, 47, 48, 49, + 50, 51, 52, 0, 0, 0, 0, 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, 0, 275, 193, 276, 277, 278, 279, + 280, 281, 282, 0, 0, 283, 284, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 285, 0, 0, 0, 364, 517, + 0, 0, 0, 0, 0, 287, 288, 289, 290, 4, + 5, 6, 7, 8, 9, 10, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 47, 48, 49, 50, 51, 52, 0, + 0, 0, 0, 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, 0, + 275, 193, 276, 277, 278, 279, 280, 281, 282, 0, + 0, 283, 284, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 285, 0, 0, 286, 4, 5, 6, 7, 8, 9, + 10, 287, 288, 289, 290, 0, 0, 0, 0, 0, + 0, 0, 0, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 47, 48, + 49, 50, 51, 52, 0, 0, 0, 0, 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, 0, 275, 193, 276, 277, 278, + 279, 280, 281, 282, 0, 0, 283, 284, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 285, 0, 0, 0, 364, + 0, 0, 0, 0, 0, 0, 287, 288, 289, 290, + 4, 5, 6, 7, 8, 9, 10, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 47, 48, 49, 50, 51, 52, + 0, 0, 0, 0, 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, + 0, 275, 193, 276, 277, 278, 279, 280, 281, 282, + 0, 0, 283, 284, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 285, 0, 0, 407, 4, 5, 6, 7, 8, + 9, 10, 287, 288, 289, 290, 0, 0, 0, 0, + 0, 0, 0, 0, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, + 48, 49, 50, 51, 52, 0, 0, 0, 0, 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, 0, 275, 193, 276, 277, + 278, 279, 280, 281, 282, 0, 0, 283, 284, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 285, 4, 5, 6, + 7, 8, 9, 10, 0, 0, 426, 287, 288, 289, + 290, 0, 0, 0, 0, 0, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 47, 48, 49, 50, 51, 52, 0, 0, 0, + 0, 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, 0, 275, 193, + 276, 277, 278, 279, 280, 281, 282, 0, 0, 283, + 284, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 285, 4, + 5, 6, 7, 8, 9, 10, 0, 0, 0, 287, + 288, 289, 290, 0, 0, 0, 0, 0, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 47, 48, 49, 50, 51, 52, 0, + 0, 0, 0, 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, 382, 0, + 275, 193, 276, 277, 278, 279, 280, 281, 282, 0, + 0, 283, 284, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 285, 4, 5, 6, 7, 8, 9, 10, 0, 0, + 0, 287, 288, 289, 290, 0, 0, 0, 0, 0, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 47, 48, 49, 50, 51, + 52, 0, 0, 0, 0, 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, 0, 0, 193 +}; + +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-496))) + +#define yytable_value_is_error(Yytable_value) \ + YYID (0) + +static const yytype_int16 yycheck[] = +{ + 0, 205, 213, 269, 0, 285, 0, 228, 354, 54, + 433, 325, 246, 362, 322, 364, 207, 225, 367, 494, + 241, 216, 217, 220, 221, 239, 237, 207, 237, 233, + 239, 526, 246, 299, 509, 530, 238, 246, 237, 239, + 535, 239, 244, 218, 219, 266, 267, 247, 241, 247, + 237, 244, 260, 257, 247, 335, 247, 337, 255, 256, + 368, 241, 237, 239, 239, 239, 247, 238, 243, 238, + 246, 238, 246, 244, 238, 244, 422, 244, 238, 249, + 244, 251, 316, 238, 244, 319, 227, 228, 229, 230, + 231, 232, 233, 234, 235, 236, 362, 377, 364, 413, + 238, 367, 451, 391, 392, 246, 244, 393, 394, 395, + 396, 244, 323, 244, 247, 381, 539, 244, 322, 244, + 247, 325, 247, 244, 244, 244, 247, 247, 247, 263, + 264, 265, 222, 223, 252, 253, 254, 242, 207, 244, + 208, 455, 244, 245, 424, 244, 245, 239, 428, 495, + 241, 500, 389, 390, 397, 398, 241, 207, 207, 239, + 246, 207, 207, 247, 368, 238, 237, 224, 226, 257, + 259, 258, 208, 240, 207, 247, 237, 247, 237, 445, + 446, 247, 237, 245, 207, 451, 237, 207, 242, 237, + 206, 540, 244, 246, 415, 238, 240, 237, 240, 207, + 241, 481, 548, 238, 242, 205, 238, 16, 247, 413, + 241, 241, 246, 213, 494, 242, 399, 401, 247, 404, + 220, 400, 237, 233, 220, 402, 220, 227, 237, 509, + 283, 284, 199, 233, 500, 403, 414, 237, 321, 486, + 520, 489, 525, 535, 231, 536, 509, 489, 220, 302, + -1, 455, -1, 519, 534, -1, -1, 257, -1, -1, + -1, 261, -1, 316, -1, -1, 319, -1, -1, -1, + -1, -1, -1, -1, 540, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 494, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 514, -1, 509, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 322, 323, -1, 325, -1, -1, -1, -1, + -1, -1, -1, 386, 387, 388, 389, 390, 391, 392, + 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, + 403, 404, -1, -1, 354, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 368, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 413, -1, -1, -1, -1, -1, -1, + -1, -1, 422, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 433, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 455, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 489, + -1, -1, -1, -1, 494, 495, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 509, + -1, -1, -1, -1, 514, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 526, -1, -1, -1, + 530, -1, -1, -1, -1, 535, -1, -1, -1, 539, + -1, -1, -1, -1, -1, -1, 0, -1, 548, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 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, -1, -1, 208, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 261, 262, 263, + 264, 265, 266, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, -1, 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, -1, -1, 218, 219, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 237, -1, -1, + -1, 241, 242, -1, -1, -1, -1, 247, 248, 249, + 250, 251, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 261, 262, 263, 264, 265, 266, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + -1, 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, + -1, -1, 218, 219, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 237, -1, -1, -1, 241, 242, -1, -1, -1, + -1, 247, 248, 249, 250, 251, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 261, 262, 263, 264, 265, + 266, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, -1, 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, -1, -1, 218, 219, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 237, -1, -1, -1, 241, + -1, -1, -1, -1, -1, 247, 248, 249, 250, 251, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 261, + 262, 263, 264, 265, 266, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, -1, 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, -1, -1, + 218, 219, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 237, + -1, -1, -1, 241, -1, -1, -1, -1, -1, 247, + 248, 249, 250, 251, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 261, 262, 263, 264, 265, 266, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, -1, 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, -1, -1, 218, 219, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 237, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 247, 248, 249, 250, 251, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 261, 262, 263, + 264, 265, 266, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 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, -1, 207, 208, 209, + 210, 211, 212, 213, 214, 215, -1, -1, 218, 219, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 237, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 247, 248, 249, + 250, 251, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 261, 262, 263, 264, 265, 266, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 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, + -1, -1, 208, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + -1, -1, -1, -1, -1, 261, 262, 263, 264, 265, + 266, 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, -1, 207, 208, 209, 210, 211, 212, + 213, 214, 215, -1, -1, 218, 219, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 237, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 248, 249, 250, 251, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 261, 262, + 263, 264, 265, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 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, -1, 207, 208, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 247, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, -1, -1, + -1, 261, 262, 263, 264, 265, -1, -1, -1, 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, -1, -1, 208, 209, -1, -1, -1, -1, -1, + 205, -1, -1, 208, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 227, -1, -1, -1, 231, 232, -1, -1, - -1, -1, 237, 238, 239, 240, 241, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 251, 252, 253, 254, - 255, 256, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, -1, 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, -1, -1, 208, 209, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 227, -1, -1, -1, - 231, -1, -1, -1, -1, -1, 237, 238, 239, 240, - 241, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 251, 252, 253, 254, 255, 256, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, -1, 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, -1, - -1, 208, 209, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 227, -1, -1, -1, 231, -1, -1, -1, -1, -1, - 237, 238, 239, 240, 241, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 251, 252, 253, 254, 255, 256, + -1, -1, -1, -1, -1, -1, -1, 242, -1, -1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, -1, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + -1, -1, -1, -1, -1, -1, 261, 262, 263, 264, + 265, 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, @@ -2127,84 +2338,13 @@ static const yytype_int16 yycheck[] = 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, -1, -1, 208, 209, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 227, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 237, 238, 239, 240, 241, 3, - 4, 5, 6, 7, 8, 9, 10, -1, 251, 252, - 253, 254, 255, 256, -1, -1, -1, -1, 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, -1, 199, 200, 201, 202, 203, - 204, 205, -1, -1, 208, 209, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 227, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 237, 238, 239, 240, 241, 3, 4, - 5, 6, 7, 8, 9, 10, -1, 251, 252, 253, - 254, 255, 256, -1, -1, -1, -1, 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, -1, -1, 200, -1, -1, -1, -1, + 203, 204, 205, -1, -1, 208, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 3, 4, 5, 6, 7, 8, 9, - 10, -1, -1, -1, -1, -1, 251, 252, 253, 254, - 255, 256, 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, -1, 199, - 200, 201, 202, 203, 204, 205, -1, -1, 208, 209, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 227, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 238, 239, - 240, 241, 3, 4, 5, 6, 7, 8, 9, 10, - -1, 251, 252, 253, 254, 255, -1, -1, -1, -1, - -1, 22, 23, 24, 25, 26, 27, 28, 29, 30, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 242, + -1, -1, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, -1, -1, -1, -1, -1, -1, 261, 262, + 263, 264, 265, 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, @@ -2221,131 +2361,39 @@ static const yytype_int16 yycheck[] = 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, -1, 199, 200, + 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, + 201, 202, 203, 204, 205, -1, -1, 208, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 237, 3, 4, 5, - 6, 7, 8, 9, 10, -1, -1, -1, -1, -1, - 251, 252, 253, 254, 255, -1, 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, -1, -1, 200, -1, -1, -1, -1, -1, + -1, 242, -1, -1, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, -1, -1, -1, -1, -1, -1, + 261, 262, 263, 264, 265, 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, -1, -1, 208, + -1, -1, -1, 6, 7, 8, 9, 10, 11, 12, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 232, -1, -1, -1, - -1, 3, 4, 5, 6, 7, 8, 9, 10, -1, - -1, -1, -1, -1, -1, 251, 252, 253, 254, 255, - 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, -1, -1, 200, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 232, -1, -1, -1, -1, 3, 4, 5, 6, 7, - 8, 9, 10, -1, -1, -1, -1, -1, -1, 251, - 252, 253, 254, 255, 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, - -1, -1, 200, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 232, -1, -1, -1, -1, 3, - 4, 5, 6, 7, 8, 9, 10, -1, -1, -1, - -1, -1, -1, 251, 252, 253, 254, 255, 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, -1, -1, 200, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 6, 7, 8, 9, - 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 251, 252, 253, - 254, 255, 52, 53, 54, 55, 56, 57, -1, -1, - -1, -1, 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, -1, 199, - 200, 201, 202, 203, 204, 205, -1, -1, 208, 209, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 227, -1, -1, - -1, 231, 232, 6, 7, 8, 9, 10, 238, 239, - 240, 241, -1, -1, -1, -1, -1, -1, -1, -1, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 52, - 53, 54, 55, 56, 57, -1, -1, -1, -1, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + -1, -1, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, + 43, 44, 45, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 261, 262, 263, 264, 265, 60, 61, 62, + 63, 64, 65, -1, -1, -1, -1, 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, @@ -2358,62 +2406,19 @@ static const yytype_int16 yycheck[] = 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, -1, 199, 200, 201, 202, - 203, 204, 205, -1, -1, 208, 209, -1, -1, -1, + 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, + 203, 204, 205, -1, 207, 208, 209, 210, 211, 212, + 213, 214, 215, -1, -1, 218, 219, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 227, -1, -1, 230, 6, 7, - 8, 9, 10, -1, -1, 238, 239, 240, 241, -1, - -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 52, 53, 54, 55, 56, 57, - -1, -1, -1, -1, 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, - -1, 199, 200, 201, 202, 203, 204, 205, -1, -1, - 208, 209, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 227, - -1, -1, -1, 231, 6, 7, 8, 9, 10, -1, - 238, 239, 240, 241, -1, -1, -1, -1, -1, -1, - -1, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 52, 53, 54, 55, 56, 57, -1, -1, -1, -1, - 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, -1, 199, 200, 201, - 202, 203, 204, 205, -1, -1, 208, 209, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 227, -1, -1, 230, 6, - 7, 8, 9, 10, -1, -1, 238, 239, 240, 241, - -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, + -1, -1, -1, -1, 237, -1, -1, -1, 241, 242, + -1, -1, -1, -1, -1, 248, 249, 250, 251, 6, + 7, 8, 9, 10, 11, 12, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 52, 53, 54, 55, 56, - 57, -1, -1, -1, -1, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 37, 38, 39, 40, 41, 42, 43, 44, 45, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 60, 61, 62, 63, 64, 65, -1, + -1, -1, -1, 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, @@ -2426,60 +2431,65 @@ static const yytype_int16 yycheck[] = 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, -1, 199, 200, 201, 202, 203, 204, 205, -1, - -1, 208, 209, -1, -1, -1, -1, -1, -1, -1, + 197, 198, 199, 200, 201, 202, 203, 204, 205, -1, + 207, 208, 209, 210, 211, 212, 213, 214, 215, -1, + -1, 218, 219, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 227, 6, 7, 8, 9, 10, -1, -1, -1, -1, - 237, 238, 239, 240, 241, -1, -1, -1, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 52, 53, 54, - 55, 56, 57, -1, -1, -1, -1, 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, -1, 199, 200, 201, 202, 203, 204, - 205, -1, -1, 208, 209, -1, -1, -1, -1, -1, + 237, -1, -1, 240, 6, 7, 8, 9, 10, 11, + 12, 248, 249, 250, 251, -1, -1, -1, -1, -1, + -1, -1, -1, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 60, 61, + 62, 63, 64, 65, -1, -1, -1, -1, 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, -1, 207, 208, 209, 210, 211, + 212, 213, 214, 215, -1, -1, 218, 219, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 227, 6, 7, 8, 9, 10, -1, -1, - -1, -1, -1, 238, 239, 240, 241, -1, -1, -1, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 52, - 53, 54, 55, 56, 57, -1, -1, -1, -1, 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, -1, 199, 200, 201, 202, - 203, 204, 205, -1, -1, 208, 209, -1, -1, -1, + -1, -1, -1, -1, -1, 237, -1, -1, -1, 241, + -1, -1, -1, -1, -1, -1, 248, 249, 250, 251, + 6, 7, 8, 9, 10, 11, 12, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 227, 6, 7, 8, 9, 10, - -1, -1, -1, -1, -1, 238, 239, 240, 241, -1, - -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 36, 37, -1, -1, -1, + -1, -1, -1, -1, 60, 61, 62, 63, 64, 65, + -1, -1, -1, -1, 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, + -1, 207, 208, 209, 210, 211, 212, 213, 214, 215, + -1, -1, 218, 219, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 52, 53, 54, 55, 56, 57, -1, -1, -1, - -1, 62, 63, 64, 65, 66, 67, 68, 69, 70, + -1, 237, -1, -1, 240, 6, 7, 8, 9, 10, + 11, 12, 248, 249, 250, 251, -1, -1, -1, -1, + -1, -1, -1, -1, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 60, + 61, 62, 63, 64, 65, -1, -1, -1, -1, 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, @@ -2492,15 +2502,86 @@ static const yytype_int16 yycheck[] = 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, -1, -1, 200 + 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, + 201, 202, 203, 204, 205, -1, 207, 208, 209, 210, + 211, 212, 213, 214, 215, -1, -1, 218, 219, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 237, 6, 7, 8, + 9, 10, 11, 12, -1, -1, 247, 248, 249, 250, + 251, -1, -1, -1, -1, -1, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 60, 61, 62, 63, 64, 65, -1, -1, -1, + -1, 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, -1, 207, 208, + 209, 210, 211, 212, 213, 214, 215, -1, -1, 218, + 219, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 237, 6, + 7, 8, 9, 10, 11, 12, -1, -1, -1, 248, + 249, 250, 251, -1, -1, -1, -1, -1, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 60, 61, 62, 63, 64, 65, -1, + -1, -1, -1, 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, -1, + 207, 208, 209, 210, 211, 212, 213, 214, 215, -1, + -1, 218, 219, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 237, 6, 7, 8, 9, 10, 11, 12, -1, -1, + -1, 248, 249, 250, 251, -1, -1, -1, -1, -1, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 60, 61, 62, 63, 64, + 65, -1, -1, -1, -1, 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, -1, -1, 208 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint16 yystos[] = { - 0, 3, 4, 5, 6, 7, 8, 9, 10, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 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, @@ -2517,43 +2598,44 @@ static const yytype_uint16 yystos[] = 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, 200, 251, 252, 253, 254, - 255, 256, 291, 292, 295, 296, 297, 298, 302, 303, - 304, 305, 306, 307, 310, 311, 312, 313, 315, 317, - 318, 319, 356, 357, 358, 227, 227, 199, 231, 318, - 199, 237, 237, 359, 228, 234, 299, 300, 301, 311, - 315, 234, 237, 199, 199, 237, 312, 315, 229, 316, - 0, 357, 200, 314, 46, 199, 308, 309, 231, 321, - 315, 237, 316, 231, 338, 300, 299, 301, 199, 199, - 227, 236, 316, 231, 234, 237, 294, 199, 201, 202, - 203, 204, 205, 208, 209, 227, 230, 238, 239, 240, - 241, 261, 262, 263, 265, 266, 267, 268, 269, 270, - 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, - 281, 282, 283, 284, 285, 315, 229, 228, 234, 236, - 228, 234, 320, 311, 315, 322, 323, 237, 237, 11, - 12, 13, 15, 16, 17, 18, 19, 20, 21, 198, - 231, 232, 237, 272, 285, 287, 289, 291, 295, 315, - 328, 329, 330, 331, 339, 340, 341, 344, 347, 348, - 355, 316, 236, 316, 231, 287, 326, 236, 293, 199, - 234, 237, 272, 272, 289, 208, 209, 229, 233, 228, - 228, 234, 197, 287, 227, 272, 242, 243, 244, 239, - 241, 206, 207, 210, 211, 245, 246, 212, 213, 249, - 248, 247, 214, 216, 215, 250, 230, 230, 285, 200, - 285, 290, 309, 322, 315, 199, 324, 325, 232, 323, - 237, 237, 350, 227, 227, 237, 237, 289, 227, 289, - 235, 227, 232, 332, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 236, 288, 234, 237, 232, 329, - 326, 236, 326, 327, 326, 322, 199, 228, 264, 289, - 199, 287, 272, 272, 272, 274, 274, 275, 275, 276, - 276, 276, 276, 277, 277, 278, 279, 280, 281, 282, - 283, 286, 230, 232, 324, 316, 234, 237, 329, 351, - 289, 237, 289, 235, 349, 339, 287, 287, 326, 232, - 234, 232, 230, 289, 237, 325, 198, 328, 340, 352, - 228, 228, 289, 304, 311, 343, 333, 232, 326, 235, - 227, 343, 353, 354, 335, 336, 337, 342, 345, 199, - 228, 232, 287, 289, 237, 228, 14, 331, 330, 231, - 236, 330, 334, 338, 228, 289, 334, 335, 339, 346, - 326, 237, 232 + 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, + 203, 204, 205, 208, 261, 262, 263, 264, 265, 266, + 301, 302, 305, 306, 307, 308, 312, 313, 314, 315, + 316, 317, 320, 321, 322, 323, 325, 327, 328, 329, + 366, 367, 368, 237, 237, 207, 241, 328, 207, 247, + 247, 369, 238, 244, 309, 310, 311, 321, 325, 244, + 247, 207, 207, 247, 322, 325, 239, 326, 0, 367, + 208, 324, 54, 207, 318, 319, 241, 331, 325, 247, + 326, 241, 348, 310, 309, 311, 207, 207, 237, 246, + 326, 241, 244, 247, 304, 207, 209, 210, 211, 212, + 213, 214, 215, 218, 219, 237, 240, 248, 249, 250, + 251, 271, 272, 273, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, + 291, 292, 293, 294, 295, 325, 239, 238, 244, 246, + 238, 244, 330, 321, 325, 332, 333, 247, 247, 13, + 14, 15, 17, 18, 19, 20, 21, 22, 23, 206, + 241, 242, 247, 282, 295, 297, 299, 301, 305, 325, + 338, 339, 340, 341, 349, 350, 351, 354, 357, 358, + 365, 326, 246, 326, 241, 297, 336, 246, 303, 207, + 244, 247, 282, 282, 299, 218, 219, 239, 243, 238, + 238, 244, 205, 297, 237, 282, 252, 253, 254, 249, + 251, 216, 217, 220, 221, 255, 256, 222, 223, 259, + 258, 257, 224, 226, 225, 260, 240, 240, 295, 208, + 295, 300, 319, 332, 325, 207, 334, 335, 242, 333, + 247, 247, 360, 237, 237, 247, 247, 299, 237, 299, + 245, 237, 242, 342, 227, 228, 229, 230, 231, 232, + 233, 234, 235, 236, 246, 298, 244, 247, 242, 339, + 336, 246, 336, 337, 336, 332, 207, 238, 274, 299, + 207, 297, 282, 282, 282, 284, 284, 285, 285, 286, + 286, 286, 286, 287, 287, 288, 289, 290, 291, 292, + 293, 296, 240, 242, 334, 326, 244, 247, 339, 361, + 299, 247, 299, 245, 359, 349, 297, 297, 336, 242, + 244, 242, 240, 299, 247, 335, 206, 338, 350, 362, + 238, 238, 299, 314, 321, 353, 343, 242, 336, 245, + 237, 353, 363, 364, 345, 346, 347, 352, 355, 207, + 238, 242, 297, 299, 247, 238, 16, 341, 340, 241, + 246, 340, 344, 348, 238, 299, 344, 345, 349, 356, + 336, 247, 242 }; #define yyerrok (yyerrstatus = 0) @@ -3374,7 +3456,7 @@ yyreduce: { case 2: /* Line 1792 of yacc.c */ -#line 244 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 246 "glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleVariable((yyvsp[(1) - (1)].lex).loc, (yyvsp[(1) - (1)].lex).symbol, (yyvsp[(1) - (1)].lex).string); } @@ -3382,7 +3464,7 @@ yyreduce: case 3: /* Line 1792 of yacc.c */ -#line 250 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 252 "glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } @@ -3390,7 +3472,7 @@ yyreduce: case 4: /* Line 1792 of yacc.c */ -#line 253 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 255 "glslang.y" { (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[(1) - (1)].lex).i, (yyvsp[(1) - (1)].lex).loc, true); } @@ -3398,7 +3480,7 @@ yyreduce: case 5: /* Line 1792 of yacc.c */ -#line 256 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 258 "glslang.y" { parseContext.fullIntegerCheck((yyvsp[(1) - (1)].lex).loc, "unsigned literal"); (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[(1) - (1)].lex).u, (yyvsp[(1) - (1)].lex).loc, true); @@ -3407,32 +3489,50 @@ yyreduce: case 6: /* Line 1792 of yacc.c */ -#line 260 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 262 "glslang.y" { - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[(1) - (1)].lex).d, EbtFloat, (yyvsp[(1) - (1)].lex).loc, true); + parseContext.int64Check((yyvsp[(1) - (1)].lex).loc, "64-bit integer literal"); + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[(1) - (1)].lex).i64, (yyvsp[(1) - (1)].lex).loc, true); } break; case 7: /* Line 1792 of yacc.c */ -#line 263 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 266 "glslang.y" + { + parseContext.int64Check((yyvsp[(1) - (1)].lex).loc, "64-bit unsigned integer literal"); + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[(1) - (1)].lex).u64, (yyvsp[(1) - (1)].lex).loc, true); + } + break; + + case 8: +/* Line 1792 of yacc.c */ +#line 270 "glslang.y" + { + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[(1) - (1)].lex).d, EbtFloat, (yyvsp[(1) - (1)].lex).loc, true); + } + break; + + case 9: +/* Line 1792 of yacc.c */ +#line 273 "glslang.y" { parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double literal"); (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[(1) - (1)].lex).d, EbtDouble, (yyvsp[(1) - (1)].lex).loc, true); } break; - case 8: + case 10: /* Line 1792 of yacc.c */ -#line 267 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 277 "glslang.y" { (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[(1) - (1)].lex).b, (yyvsp[(1) - (1)].lex).loc, true); } break; - case 9: + case 11: /* Line 1792 of yacc.c */ -#line 270 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 280 "glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[(2) - (3)].interm.intermTypedNode); if ((yyval.interm.intermTypedNode)->getAsConstantUnion()) @@ -3440,25 +3540,9 @@ yyreduce: } break; - case 10: -/* Line 1792 of yacc.c */ -#line 278 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { - (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); - } - break; - - case 11: -/* Line 1792 of yacc.c */ -#line 281 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { - (yyval.interm.intermTypedNode) = parseContext.handleBracketDereference((yyvsp[(2) - (4)].lex).loc, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode)); - } - break; - case 12: /* Line 1792 of yacc.c */ -#line 284 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 288 "glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } @@ -3466,15 +3550,31 @@ yyreduce: case 13: /* Line 1792 of yacc.c */ -#line 287 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 291 "glslang.y" { - (yyval.interm.intermTypedNode) = parseContext.handleDotDereference((yyvsp[(3) - (3)].lex).loc, (yyvsp[(1) - (3)].interm.intermTypedNode), *(yyvsp[(3) - (3)].lex).string); + (yyval.interm.intermTypedNode) = parseContext.handleBracketDereference((yyvsp[(2) - (4)].lex).loc, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode)); } break; case 14: /* Line 1792 of yacc.c */ -#line 290 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 294 "glslang.y" + { + (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); + } + break; + + case 15: +/* Line 1792 of yacc.c */ +#line 297 "glslang.y" + { + (yyval.interm.intermTypedNode) = parseContext.handleDotDereference((yyvsp[(3) - (3)].lex).loc, (yyvsp[(1) - (3)].interm.intermTypedNode), *(yyvsp[(3) - (3)].lex).string); + } + break; + + case 16: +/* Line 1792 of yacc.c */ +#line 300 "glslang.y" { parseContext.variableCheck((yyvsp[(1) - (2)].interm.intermTypedNode)); parseContext.lValueErrorCheck((yyvsp[(2) - (2)].lex).loc, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)); @@ -3482,9 +3582,9 @@ yyreduce: } break; - case 15: + case 17: /* Line 1792 of yacc.c */ -#line 295 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 305 "glslang.y" { parseContext.variableCheck((yyvsp[(1) - (2)].interm.intermTypedNode)); parseContext.lValueErrorCheck((yyvsp[(2) - (2)].lex).loc, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)); @@ -3492,69 +3592,69 @@ yyreduce: } break; - case 16: + case 18: /* Line 1792 of yacc.c */ -#line 303 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 313 "glslang.y" { parseContext.integerCheck((yyvsp[(1) - (1)].interm.intermTypedNode), "[]"); (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } break; - case 17: + case 19: /* Line 1792 of yacc.c */ -#line 310 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 320 "glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleFunctionCall((yyvsp[(1) - (1)].interm).loc, (yyvsp[(1) - (1)].interm).function, (yyvsp[(1) - (1)].interm).intermNode); delete (yyvsp[(1) - (1)].interm).function; } break; - case 18: -/* Line 1792 of yacc.c */ -#line 317 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { - (yyval.interm) = (yyvsp[(1) - (1)].interm); - } - break; - - case 19: -/* Line 1792 of yacc.c */ -#line 323 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { - (yyval.interm) = (yyvsp[(1) - (2)].interm); - (yyval.interm).loc = (yyvsp[(2) - (2)].lex).loc; - } - break; - case 20: /* Line 1792 of yacc.c */ -#line 327 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 327 "glslang.y" { - (yyval.interm) = (yyvsp[(1) - (2)].interm); - (yyval.interm).loc = (yyvsp[(2) - (2)].lex).loc; + (yyval.interm) = (yyvsp[(1) - (1)].interm); } break; case 21: /* Line 1792 of yacc.c */ -#line 334 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 333 "glslang.y" { (yyval.interm) = (yyvsp[(1) - (2)].interm); + (yyval.interm).loc = (yyvsp[(2) - (2)].lex).loc; } break; case 22: /* Line 1792 of yacc.c */ -#line 337 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 337 "glslang.y" { - (yyval.interm) = (yyvsp[(1) - (1)].interm); + (yyval.interm) = (yyvsp[(1) - (2)].interm); + (yyval.interm).loc = (yyvsp[(2) - (2)].lex).loc; } break; case 23: /* Line 1792 of yacc.c */ -#line 343 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 344 "glslang.y" + { + (yyval.interm) = (yyvsp[(1) - (2)].interm); + } + break; + + case 24: +/* Line 1792 of yacc.c */ +#line 347 "glslang.y" + { + (yyval.interm) = (yyvsp[(1) - (1)].interm); + } + break; + + case 25: +/* Line 1792 of yacc.c */ +#line 353 "glslang.y" { TParameter param = { 0, new TType }; param.type->shallowCopy((yyvsp[(2) - (2)].interm.intermTypedNode)->getType()); @@ -3564,9 +3664,9 @@ yyreduce: } break; - case 24: + case 26: /* Line 1792 of yacc.c */ -#line 350 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 360 "glslang.y" { TParameter param = { 0, new TType }; param.type->shallowCopy((yyvsp[(3) - (3)].interm.intermTypedNode)->getType()); @@ -3576,17 +3676,17 @@ yyreduce: } break; - case 25: + case 27: /* Line 1792 of yacc.c */ -#line 360 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 370 "glslang.y" { (yyval.interm) = (yyvsp[(1) - (2)].interm); } break; - case 26: + case 28: /* Line 1792 of yacc.c */ -#line 368 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 378 "glslang.y" { // Constructor (yyval.interm).intermNode = 0; @@ -3594,9 +3694,9 @@ yyreduce: } break; - case 27: + case 29: /* Line 1792 of yacc.c */ -#line 373 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 383 "glslang.y" { // // Should be a method or subroutine call, but we haven't recognized the arguments yet. @@ -3626,9 +3726,9 @@ yyreduce: } break; - case 28: + case 30: /* Line 1792 of yacc.c */ -#line 403 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 413 "glslang.y" { parseContext.variableCheck((yyvsp[(1) - (1)].interm.intermTypedNode)); (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); @@ -3637,27 +3737,27 @@ yyreduce: } break; - case 29: + case 31: /* Line 1792 of yacc.c */ -#line 409 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 419 "glslang.y" { parseContext.lValueErrorCheck((yyvsp[(1) - (2)].lex).loc, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)); (yyval.interm.intermTypedNode) = parseContext.handleUnaryMath((yyvsp[(1) - (2)].lex).loc, "++", EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode)); } break; - case 30: + case 32: /* Line 1792 of yacc.c */ -#line 413 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 423 "glslang.y" { parseContext.lValueErrorCheck((yyvsp[(1) - (2)].lex).loc, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)); (yyval.interm.intermTypedNode) = parseContext.handleUnaryMath((yyvsp[(1) - (2)].lex).loc, "--", EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode)); } break; - case 31: + case 33: /* Line 1792 of yacc.c */ -#line 417 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 427 "glslang.y" { if ((yyvsp[(1) - (2)].interm).op != EOpNull) { char errorOp[2] = {0, 0}; @@ -3676,40 +3776,40 @@ yyreduce: } break; - case 32: -/* Line 1792 of yacc.c */ -#line 437 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { (yyval.interm).loc = (yyvsp[(1) - (1)].lex).loc; (yyval.interm).op = EOpNull; } - break; - - case 33: -/* Line 1792 of yacc.c */ -#line 438 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { (yyval.interm).loc = (yyvsp[(1) - (1)].lex).loc; (yyval.interm).op = EOpNegative; } - break; - case 34: /* Line 1792 of yacc.c */ -#line 439 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { (yyval.interm).loc = (yyvsp[(1) - (1)].lex).loc; (yyval.interm).op = EOpLogicalNot; } +#line 447 "glslang.y" + { (yyval.interm).loc = (yyvsp[(1) - (1)].lex).loc; (yyval.interm).op = EOpNull; } break; case 35: /* Line 1792 of yacc.c */ -#line 440 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { (yyval.interm).loc = (yyvsp[(1) - (1)].lex).loc; (yyval.interm).op = EOpBitwiseNot; - parseContext.fullIntegerCheck((yyvsp[(1) - (1)].lex).loc, "bitwise not"); } +#line 448 "glslang.y" + { (yyval.interm).loc = (yyvsp[(1) - (1)].lex).loc; (yyval.interm).op = EOpNegative; } break; case 36: /* Line 1792 of yacc.c */ -#line 446 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } +#line 449 "glslang.y" + { (yyval.interm).loc = (yyvsp[(1) - (1)].lex).loc; (yyval.interm).op = EOpLogicalNot; } break; case 37: /* Line 1792 of yacc.c */ -#line 447 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 450 "glslang.y" + { (yyval.interm).loc = (yyvsp[(1) - (1)].lex).loc; (yyval.interm).op = EOpBitwiseNot; + parseContext.fullIntegerCheck((yyvsp[(1) - (1)].lex).loc, "bitwise not"); } + break; + + case 38: +/* Line 1792 of yacc.c */ +#line 456 "glslang.y" + { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } + break; + + case 39: +/* Line 1792 of yacc.c */ +#line 457 "glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, "*", EOpMul, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) @@ -3717,9 +3817,9 @@ yyreduce: } break; - case 38: + case 40: /* Line 1792 of yacc.c */ -#line 452 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 462 "glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, "/", EOpDiv, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) @@ -3727,9 +3827,9 @@ yyreduce: } break; - case 39: + case 41: /* Line 1792 of yacc.c */ -#line 457 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 467 "glslang.y" { parseContext.fullIntegerCheck((yyvsp[(2) - (3)].lex).loc, "%"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, "%", EOpMod, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); @@ -3738,15 +3838,15 @@ yyreduce: } break; - case 40: + case 42: /* Line 1792 of yacc.c */ -#line 466 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 476 "glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } break; - case 41: + case 43: /* Line 1792 of yacc.c */ -#line 467 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 477 "glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, "+", EOpAdd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) @@ -3754,9 +3854,9 @@ yyreduce: } break; - case 42: + case 44: /* Line 1792 of yacc.c */ -#line 472 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 482 "glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, "-", EOpSub, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) @@ -3764,15 +3864,15 @@ yyreduce: } break; - case 43: + case 45: /* Line 1792 of yacc.c */ -#line 480 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 490 "glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } break; - case 44: + case 46: /* Line 1792 of yacc.c */ -#line 481 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 491 "glslang.y" { parseContext.fullIntegerCheck((yyvsp[(2) - (3)].lex).loc, "bit shift left"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, "<<", EOpLeftShift, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); @@ -3781,9 +3881,9 @@ yyreduce: } break; - case 45: + case 47: /* Line 1792 of yacc.c */ -#line 487 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 497 "glslang.y" { parseContext.fullIntegerCheck((yyvsp[(2) - (3)].lex).loc, "bit shift right"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, ">>", EOpRightShift, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); @@ -3792,15 +3892,15 @@ yyreduce: } break; - case 46: + case 48: /* Line 1792 of yacc.c */ -#line 496 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 506 "glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } break; - case 47: + case 49: /* Line 1792 of yacc.c */ -#line 497 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 507 "glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, "<", EOpLessThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) @@ -3808,9 +3908,9 @@ yyreduce: } break; - case 48: + case 50: /* Line 1792 of yacc.c */ -#line 502 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 512 "glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, ">", EOpGreaterThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) @@ -3818,9 +3918,9 @@ yyreduce: } break; - case 49: + case 51: /* Line 1792 of yacc.c */ -#line 507 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 517 "glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, "<=", EOpLessThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) @@ -3828,9 +3928,9 @@ yyreduce: } break; - case 50: + case 52: /* Line 1792 of yacc.c */ -#line 512 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 522 "glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, ">=", EOpGreaterThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) @@ -3838,15 +3938,15 @@ yyreduce: } break; - case 51: + case 53: /* Line 1792 of yacc.c */ -#line 520 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 530 "glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } break; - case 52: + case 54: /* Line 1792 of yacc.c */ -#line 521 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 531 "glslang.y" { parseContext.arrayObjectCheck((yyvsp[(2) - (3)].lex).loc, (yyvsp[(1) - (3)].interm.intermTypedNode)->getType(), "array comparison"); parseContext.opaqueCheck((yyvsp[(2) - (3)].lex).loc, (yyvsp[(1) - (3)].interm.intermTypedNode)->getType(), "=="); @@ -3857,9 +3957,9 @@ yyreduce: } break; - case 53: + case 55: /* Line 1792 of yacc.c */ -#line 529 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 539 "glslang.y" { parseContext.arrayObjectCheck((yyvsp[(2) - (3)].lex).loc, (yyvsp[(1) - (3)].interm.intermTypedNode)->getType(), "array comparison"); parseContext.opaqueCheck((yyvsp[(2) - (3)].lex).loc, (yyvsp[(1) - (3)].interm.intermTypedNode)->getType(), "!="); @@ -3870,15 +3970,15 @@ yyreduce: } break; - case 54: + case 56: /* Line 1792 of yacc.c */ -#line 540 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 550 "glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } break; - case 55: + case 57: /* Line 1792 of yacc.c */ -#line 541 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 551 "glslang.y" { parseContext.fullIntegerCheck((yyvsp[(2) - (3)].lex).loc, "bitwise and"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, "&", EOpAnd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); @@ -3887,15 +3987,15 @@ yyreduce: } break; - case 56: + case 58: /* Line 1792 of yacc.c */ -#line 550 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 560 "glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } break; - case 57: + case 59: /* Line 1792 of yacc.c */ -#line 551 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 561 "glslang.y" { parseContext.fullIntegerCheck((yyvsp[(2) - (3)].lex).loc, "bitwise exclusive or"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, "^", EOpExclusiveOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); @@ -3904,15 +4004,15 @@ yyreduce: } break; - case 58: + case 60: /* Line 1792 of yacc.c */ -#line 560 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 570 "glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } break; - case 59: + case 61: /* Line 1792 of yacc.c */ -#line 561 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 571 "glslang.y" { parseContext.fullIntegerCheck((yyvsp[(2) - (3)].lex).loc, "bitwise inclusive or"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, "|", EOpInclusiveOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); @@ -3921,15 +4021,15 @@ yyreduce: } break; - case 60: + case 62: /* Line 1792 of yacc.c */ -#line 570 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 580 "glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } break; - case 61: + case 63: /* Line 1792 of yacc.c */ -#line 571 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 581 "glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, "&&", EOpLogicalAnd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) @@ -3937,15 +4037,15 @@ yyreduce: } break; - case 62: + case 64: /* Line 1792 of yacc.c */ -#line 579 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 589 "glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } break; - case 63: + case 65: /* Line 1792 of yacc.c */ -#line 580 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 590 "glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, "^^", EOpLogicalXor, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) @@ -3953,15 +4053,15 @@ yyreduce: } break; - case 64: + case 66: /* Line 1792 of yacc.c */ -#line 588 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 598 "glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } break; - case 65: + case 67: /* Line 1792 of yacc.c */ -#line 589 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 599 "glslang.y" { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, "||", EOpLogicalOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) @@ -3969,23 +4069,23 @@ yyreduce: } break; - case 66: + case 68: /* Line 1792 of yacc.c */ -#line 597 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 607 "glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } break; - case 67: + case 69: /* Line 1792 of yacc.c */ -#line 598 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 608 "glslang.y" { ++parseContext.controlFlowNestingLevel; } break; - case 68: + case 70: /* Line 1792 of yacc.c */ -#line 601 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 611 "glslang.y" { --parseContext.controlFlowNestingLevel; parseContext.boolCheck((yyvsp[(2) - (6)].lex).loc, (yyvsp[(1) - (6)].interm.intermTypedNode)); @@ -4000,15 +4100,15 @@ yyreduce: } break; - case 69: + case 71: /* Line 1792 of yacc.c */ -#line 616 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 626 "glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } break; - case 70: + case 72: /* Line 1792 of yacc.c */ -#line 617 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 627 "glslang.y" { parseContext.arrayObjectCheck((yyvsp[(2) - (3)].interm).loc, (yyvsp[(1) - (3)].interm.intermTypedNode)->getType(), "array assignment"); parseContext.opaqueCheck((yyvsp[(2) - (3)].interm).loc, (yyvsp[(1) - (3)].interm.intermTypedNode)->getType(), "="); @@ -4023,36 +4123,36 @@ yyreduce: } break; - case 71: + case 73: /* Line 1792 of yacc.c */ -#line 632 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 642 "glslang.y" { (yyval.interm).loc = (yyvsp[(1) - (1)].lex).loc; (yyval.interm).op = EOpAssign; } break; - case 72: + case 74: /* Line 1792 of yacc.c */ -#line 636 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 646 "glslang.y" { (yyval.interm).loc = (yyvsp[(1) - (1)].lex).loc; (yyval.interm).op = EOpMulAssign; } break; - case 73: + case 75: /* Line 1792 of yacc.c */ -#line 640 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 650 "glslang.y" { (yyval.interm).loc = (yyvsp[(1) - (1)].lex).loc; (yyval.interm).op = EOpDivAssign; } break; - case 74: + case 76: /* Line 1792 of yacc.c */ -#line 644 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 654 "glslang.y" { parseContext.fullIntegerCheck((yyvsp[(1) - (1)].lex).loc, "%="); (yyval.interm).loc = (yyvsp[(1) - (1)].lex).loc; @@ -4060,80 +4160,80 @@ yyreduce: } break; - case 75: + case 77: /* Line 1792 of yacc.c */ -#line 649 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 659 "glslang.y" { (yyval.interm).loc = (yyvsp[(1) - (1)].lex).loc; (yyval.interm).op = EOpAddAssign; } break; - case 76: + case 78: /* Line 1792 of yacc.c */ -#line 653 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 663 "glslang.y" { (yyval.interm).loc = (yyvsp[(1) - (1)].lex).loc; (yyval.interm).op = EOpSubAssign; } break; - case 77: + case 79: /* Line 1792 of yacc.c */ -#line 657 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 667 "glslang.y" { parseContext.fullIntegerCheck((yyvsp[(1) - (1)].lex).loc, "bit-shift left assign"); (yyval.interm).loc = (yyvsp[(1) - (1)].lex).loc; (yyval.interm).op = EOpLeftShiftAssign; } break; - case 78: + case 80: /* Line 1792 of yacc.c */ -#line 661 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 671 "glslang.y" { parseContext.fullIntegerCheck((yyvsp[(1) - (1)].lex).loc, "bit-shift right assign"); (yyval.interm).loc = (yyvsp[(1) - (1)].lex).loc; (yyval.interm).op = EOpRightShiftAssign; } break; - case 79: + case 81: /* Line 1792 of yacc.c */ -#line 665 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 675 "glslang.y" { parseContext.fullIntegerCheck((yyvsp[(1) - (1)].lex).loc, "bitwise-and assign"); (yyval.interm).loc = (yyvsp[(1) - (1)].lex).loc; (yyval.interm).op = EOpAndAssign; } break; - case 80: + case 82: /* Line 1792 of yacc.c */ -#line 669 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 679 "glslang.y" { parseContext.fullIntegerCheck((yyvsp[(1) - (1)].lex).loc, "bitwise-xor assign"); (yyval.interm).loc = (yyvsp[(1) - (1)].lex).loc; (yyval.interm).op = EOpExclusiveOrAssign; } break; - case 81: + case 83: /* Line 1792 of yacc.c */ -#line 673 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 683 "glslang.y" { parseContext.fullIntegerCheck((yyvsp[(1) - (1)].lex).loc, "bitwise-or assign"); (yyval.interm).loc = (yyvsp[(1) - (1)].lex).loc; (yyval.interm).op = EOpInclusiveOrAssign; } break; - case 82: + case 84: /* Line 1792 of yacc.c */ -#line 680 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 690 "glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } break; - case 83: + case 85: /* Line 1792 of yacc.c */ -#line 683 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 693 "glslang.y" { (yyval.interm.intermTypedNode) = parseContext.intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).loc); if ((yyval.interm.intermTypedNode) == 0) { @@ -4143,18 +4243,18 @@ yyreduce: } break; - case 84: + case 86: /* Line 1792 of yacc.c */ -#line 693 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 703 "glslang.y" { parseContext.constantValueCheck((yyvsp[(1) - (1)].interm.intermTypedNode), ""); (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } break; - case 85: + case 87: /* Line 1792 of yacc.c */ -#line 700 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 710 "glslang.y" { parseContext.handleFunctionDeclarator((yyvsp[(1) - (2)].interm).loc, *(yyvsp[(1) - (2)].interm).function, true /* prototype */); (yyval.interm.intermNode) = 0; @@ -4162,9 +4262,9 @@ yyreduce: } break; - case 86: + case 88: /* Line 1792 of yacc.c */ -#line 705 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 715 "glslang.y" { if ((yyvsp[(1) - (2)].interm).intermNode && (yyvsp[(1) - (2)].interm).intermNode->getAsAggregate()) (yyvsp[(1) - (2)].interm).intermNode->getAsAggregate()->setOperator(EOpSequence); @@ -4172,9 +4272,9 @@ yyreduce: } break; - case 87: + case 89: /* Line 1792 of yacc.c */ -#line 710 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 720 "glslang.y" { parseContext.profileRequires((yyvsp[(1) - (4)].lex).loc, ENoProfile, 130, 0, "precision statement"); @@ -4185,36 +4285,36 @@ yyreduce: } break; - case 88: + case 90: /* Line 1792 of yacc.c */ -#line 718 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 728 "glslang.y" { parseContext.declareBlock((yyvsp[(1) - (2)].interm).loc, *(yyvsp[(1) - (2)].interm).typeList); (yyval.interm.intermNode) = 0; } break; - case 89: + case 91: /* Line 1792 of yacc.c */ -#line 722 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 732 "glslang.y" { parseContext.declareBlock((yyvsp[(1) - (3)].interm).loc, *(yyvsp[(1) - (3)].interm).typeList, (yyvsp[(2) - (3)].lex).string); (yyval.interm.intermNode) = 0; } break; - case 90: + case 92: /* Line 1792 of yacc.c */ -#line 726 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 736 "glslang.y" { parseContext.declareBlock((yyvsp[(1) - (4)].interm).loc, *(yyvsp[(1) - (4)].interm).typeList, (yyvsp[(2) - (4)].lex).string, (yyvsp[(3) - (4)].interm).arraySizes); (yyval.interm.intermNode) = 0; } break; - case 91: + case 93: /* Line 1792 of yacc.c */ -#line 730 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 740 "glslang.y" { parseContext.globalQualifierFixCheck((yyvsp[(1) - (2)].interm.type).loc, (yyvsp[(1) - (2)].interm.type).qualifier); parseContext.updateStandaloneQualifierDefaults((yyvsp[(1) - (2)].interm.type).loc, (yyvsp[(1) - (2)].interm.type)); @@ -4222,9 +4322,9 @@ yyreduce: } break; - case 92: + case 94: /* Line 1792 of yacc.c */ -#line 735 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 745 "glslang.y" { parseContext.checkNoShaderLayouts((yyvsp[(1) - (3)].interm.type).loc, (yyvsp[(1) - (3)].interm.type).shaderQualifiers); parseContext.addQualifierToExisting((yyvsp[(1) - (3)].interm.type).loc, (yyvsp[(1) - (3)].interm.type).qualifier, *(yyvsp[(2) - (3)].lex).string); @@ -4232,9 +4332,9 @@ yyreduce: } break; - case 93: + case 95: /* Line 1792 of yacc.c */ -#line 740 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 750 "glslang.y" { parseContext.checkNoShaderLayouts((yyvsp[(1) - (4)].interm.type).loc, (yyvsp[(1) - (4)].interm.type).shaderQualifiers); (yyvsp[(3) - (4)].interm.identifierList)->push_back((yyvsp[(2) - (4)].lex).string); @@ -4243,15 +4343,15 @@ yyreduce: } break; - case 94: + case 96: /* Line 1792 of yacc.c */ -#line 749 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 759 "glslang.y" { parseContext.nestedBlockCheck((yyvsp[(1) - (3)].interm.type).loc); } break; - case 95: + case 97: /* Line 1792 of yacc.c */ -#line 749 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 759 "glslang.y" { --parseContext.structNestingLevel; parseContext.blockName = (yyvsp[(2) - (6)].lex).string; @@ -4263,52 +4363,52 @@ yyreduce: } break; - case 96: + case 98: /* Line 1792 of yacc.c */ -#line 760 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 770 "glslang.y" { (yyval.interm.identifierList) = new TIdentifierList; (yyval.interm.identifierList)->push_back((yyvsp[(2) - (2)].lex).string); } break; - case 97: + case 99: /* Line 1792 of yacc.c */ -#line 764 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 774 "glslang.y" { (yyval.interm.identifierList) = (yyvsp[(1) - (3)].interm.identifierList); (yyval.interm.identifierList)->push_back((yyvsp[(3) - (3)].lex).string); } break; - case 98: + case 100: /* Line 1792 of yacc.c */ -#line 771 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 781 "glslang.y" { (yyval.interm).function = (yyvsp[(1) - (2)].interm.function); (yyval.interm).loc = (yyvsp[(2) - (2)].lex).loc; } break; - case 99: -/* Line 1792 of yacc.c */ -#line 778 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { - (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function); - } - break; - - case 100: -/* Line 1792 of yacc.c */ -#line 781 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { - (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function); - } - break; - case 101: /* Line 1792 of yacc.c */ -#line 788 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 788 "glslang.y" + { + (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function); + } + break; + + case 102: +/* Line 1792 of yacc.c */ +#line 791 "glslang.y" + { + (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function); + } + break; + + case 103: +/* Line 1792 of yacc.c */ +#line 798 "glslang.y" { // Add the parameter (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function); @@ -4319,9 +4419,9 @@ yyreduce: } break; - case 102: + case 104: /* Line 1792 of yacc.c */ -#line 796 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 806 "glslang.y" { // // Only first parameter of one-parameter functions can be void @@ -4341,9 +4441,9 @@ yyreduce: } break; - case 103: + case 105: /* Line 1792 of yacc.c */ -#line 816 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 826 "glslang.y" { if ((yyvsp[(1) - (3)].interm.type).qualifier.storage != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier.storage != EvqTemporary) { parseContext.error((yyvsp[(2) - (3)].lex).loc, "no qualifiers allowed for function return", @@ -4360,9 +4460,9 @@ yyreduce: } break; - case 104: + case 106: /* Line 1792 of yacc.c */ -#line 834 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 844 "glslang.y" { if ((yyvsp[(1) - (2)].interm.type).arraySizes) { parseContext.profileRequires((yyvsp[(1) - (2)].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); @@ -4380,9 +4480,9 @@ yyreduce: } break; - case 105: + case 107: /* Line 1792 of yacc.c */ -#line 849 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 859 "glslang.y" { if ((yyvsp[(1) - (3)].interm.type).arraySizes) { parseContext.profileRequires((yyvsp[(1) - (3)].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); @@ -4402,9 +4502,9 @@ yyreduce: } break; - case 106: + case 108: /* Line 1792 of yacc.c */ -#line 872 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 882 "glslang.y" { (yyval.interm) = (yyvsp[(2) - (2)].interm); if ((yyvsp[(1) - (2)].interm.type).qualifier.precision != EpqNone) @@ -4418,9 +4518,9 @@ yyreduce: } break; - case 107: + case 109: /* Line 1792 of yacc.c */ -#line 883 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 893 "glslang.y" { (yyval.interm) = (yyvsp[(1) - (1)].interm); @@ -4430,9 +4530,9 @@ yyreduce: } break; - case 108: + case 110: /* Line 1792 of yacc.c */ -#line 893 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 903 "glslang.y" { (yyval.interm) = (yyvsp[(2) - (2)].interm); if ((yyvsp[(1) - (2)].interm.type).qualifier.precision != EpqNone) @@ -4445,9 +4545,9 @@ yyreduce: } break; - case 109: + case 111: /* Line 1792 of yacc.c */ -#line 903 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 913 "glslang.y" { (yyval.interm) = (yyvsp[(1) - (1)].interm); @@ -4457,9 +4557,9 @@ yyreduce: } break; - case 110: + case 112: /* Line 1792 of yacc.c */ -#line 913 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 923 "glslang.y" { TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) }; (yyval.interm).param = param; @@ -4468,35 +4568,35 @@ yyreduce: } break; - case 111: + case 113: /* Line 1792 of yacc.c */ -#line 922 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 932 "glslang.y" { (yyval.interm) = (yyvsp[(1) - (1)].interm); } break; - case 112: + case 114: /* Line 1792 of yacc.c */ -#line 925 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 935 "glslang.y" { (yyval.interm) = (yyvsp[(1) - (3)].interm); parseContext.declareVariable((yyvsp[(3) - (3)].lex).loc, *(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm).type); } break; - case 113: + case 115: /* Line 1792 of yacc.c */ -#line 929 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 939 "glslang.y" { (yyval.interm) = (yyvsp[(1) - (4)].interm); parseContext.declareVariable((yyvsp[(3) - (4)].lex).loc, *(yyvsp[(3) - (4)].lex).string, (yyvsp[(1) - (4)].interm).type, (yyvsp[(4) - (4)].interm).arraySizes); } break; - case 114: + case 116: /* Line 1792 of yacc.c */ -#line 933 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 943 "glslang.y" { (yyval.interm).type = (yyvsp[(1) - (6)].interm).type; TIntermNode* initNode = parseContext.declareVariable((yyvsp[(3) - (6)].lex).loc, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, (yyvsp[(4) - (6)].interm).arraySizes, (yyvsp[(6) - (6)].interm.intermTypedNode)); @@ -4504,9 +4604,9 @@ yyreduce: } break; - case 115: + case 117: /* Line 1792 of yacc.c */ -#line 938 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 948 "glslang.y" { (yyval.interm).type = (yyvsp[(1) - (5)].interm).type; TIntermNode* initNode = parseContext.declareVariable((yyvsp[(3) - (5)].lex).loc, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, 0, (yyvsp[(5) - (5)].interm.intermTypedNode)); @@ -4514,9 +4614,9 @@ yyreduce: } break; - case 116: + case 118: /* Line 1792 of yacc.c */ -#line 946 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 956 "glslang.y" { (yyval.interm).type = (yyvsp[(1) - (1)].interm.type); (yyval.interm).intermNode = 0; @@ -4524,9 +4624,9 @@ yyreduce: } break; - case 117: + case 119: /* Line 1792 of yacc.c */ -#line 951 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 961 "glslang.y" { (yyval.interm).type = (yyvsp[(1) - (2)].interm.type); (yyval.interm).intermNode = 0; @@ -4534,9 +4634,9 @@ yyreduce: } break; - case 118: + case 120: /* Line 1792 of yacc.c */ -#line 956 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 966 "glslang.y" { (yyval.interm).type = (yyvsp[(1) - (3)].interm.type); (yyval.interm).intermNode = 0; @@ -4544,9 +4644,9 @@ yyreduce: } break; - case 119: + case 121: /* Line 1792 of yacc.c */ -#line 961 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 971 "glslang.y" { (yyval.interm).type = (yyvsp[(1) - (5)].interm.type); TIntermNode* initNode = parseContext.declareVariable((yyvsp[(2) - (5)].lex).loc, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), (yyvsp[(3) - (5)].interm).arraySizes, (yyvsp[(5) - (5)].interm.intermTypedNode)); @@ -4554,9 +4654,9 @@ yyreduce: } break; - case 120: + case 122: /* Line 1792 of yacc.c */ -#line 966 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 976 "glslang.y" { (yyval.interm).type = (yyvsp[(1) - (4)].interm.type); TIntermNode* initNode = parseContext.declareVariable((yyvsp[(2) - (4)].lex).loc, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), 0, (yyvsp[(4) - (4)].interm.intermTypedNode)); @@ -4564,9 +4664,9 @@ yyreduce: } break; - case 121: + case 123: /* Line 1792 of yacc.c */ -#line 975 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 985 "glslang.y" { (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); @@ -4580,9 +4680,9 @@ yyreduce: } break; - case 122: + case 124: /* Line 1792 of yacc.c */ -#line 986 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 996 "glslang.y" { parseContext.globalQualifierFixCheck((yyvsp[(1) - (2)].interm.type).loc, (yyvsp[(1) - (2)].interm.type).qualifier); parseContext.globalQualifierTypeCheck((yyvsp[(1) - (2)].interm.type).loc, (yyvsp[(1) - (2)].interm.type).qualifier, (yyvsp[(2) - (2)].interm.type)); @@ -4609,9 +4709,9 @@ yyreduce: } break; - case 123: + case 125: /* Line 1792 of yacc.c */ -#line 1013 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1023 "glslang.y" { parseContext.globalCheck((yyvsp[(1) - (1)].lex).loc, "invariant"); parseContext.profileRequires((yyval.interm.type).loc, ENoProfile, 120, 0, "invariant"); @@ -4620,9 +4720,9 @@ yyreduce: } break; - case 124: + case 126: /* Line 1792 of yacc.c */ -#line 1022 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1032 "glslang.y" { parseContext.globalCheck((yyvsp[(1) - (1)].lex).loc, "smooth"); parseContext.profileRequires((yyvsp[(1) - (1)].lex).loc, ENoProfile, 130, 0, "smooth"); @@ -4632,9 +4732,9 @@ yyreduce: } break; - case 125: + case 127: /* Line 1792 of yacc.c */ -#line 1029 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1039 "glslang.y" { parseContext.globalCheck((yyvsp[(1) - (1)].lex).loc, "flat"); parseContext.profileRequires((yyvsp[(1) - (1)].lex).loc, ENoProfile, 130, 0, "flat"); @@ -4644,9 +4744,9 @@ yyreduce: } break; - case 126: + case 128: /* Line 1792 of yacc.c */ -#line 1036 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1046 "glslang.y" { parseContext.globalCheck((yyvsp[(1) - (1)].lex).loc, "noperspective"); parseContext.requireProfile((yyvsp[(1) - (1)].lex).loc, ~EEsProfile, "noperspective"); @@ -4656,25 +4756,25 @@ yyreduce: } break; - case 127: + case 129: /* Line 1792 of yacc.c */ -#line 1046 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1056 "glslang.y" { (yyval.interm.type) = (yyvsp[(3) - (4)].interm.type); } break; - case 128: + case 130: /* Line 1792 of yacc.c */ -#line 1052 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1062 "glslang.y" { (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); } break; - case 129: + case 131: /* Line 1792 of yacc.c */ -#line 1055 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1065 "glslang.y" { (yyval.interm.type) = (yyvsp[(1) - (3)].interm.type); (yyval.interm.type).shaderQualifiers.merge((yyvsp[(3) - (3)].interm.type).shaderQualifiers); @@ -4682,27 +4782,27 @@ yyreduce: } break; - case 130: + case 132: /* Line 1792 of yacc.c */ -#line 1062 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1072 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); parseContext.setLayoutQualifier((yyvsp[(1) - (1)].lex).loc, (yyval.interm.type), *(yyvsp[(1) - (1)].lex).string); } break; - case 131: + case 133: /* Line 1792 of yacc.c */ -#line 1066 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1076 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (3)].lex).loc); parseContext.setLayoutQualifier((yyvsp[(1) - (3)].lex).loc, (yyval.interm.type), *(yyvsp[(1) - (3)].lex).string, (yyvsp[(3) - (3)].interm.intermTypedNode)); } break; - case 132: + case 134: /* Line 1792 of yacc.c */ -#line 1070 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1080 "glslang.y" { // because "shared" is both an identifier and a keyword (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); TString strShared("shared"); @@ -4710,25 +4810,25 @@ yyreduce: } break; - case 133: + case 135: /* Line 1792 of yacc.c */ -#line 1078 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1088 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); } break; - case 134: + case 136: /* Line 1792 of yacc.c */ -#line 1084 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1094 "glslang.y" { (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); } break; - case 135: + case 137: /* Line 1792 of yacc.c */ -#line 1087 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1097 "glslang.y" { (yyval.interm.type) = (yyvsp[(1) - (2)].interm.type); if ((yyval.interm.type).basicType == EbtVoid) @@ -4739,25 +4839,9 @@ yyreduce: } break; - case 136: -/* Line 1792 of yacc.c */ -#line 1098 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { - (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); - } - break; - - case 137: -/* Line 1792 of yacc.c */ -#line 1101 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { - (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); - } - break; - case 138: /* Line 1792 of yacc.c */ -#line 1104 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1108 "glslang.y" { (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); } @@ -4765,25 +4849,23 @@ yyreduce: case 139: /* Line 1792 of yacc.c */ -#line 1107 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1111 "glslang.y" { - // allow inheritance of storage qualifier from block declaration (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); } break; case 140: /* Line 1792 of yacc.c */ -#line 1111 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1114 "glslang.y" { - // allow inheritance of storage qualifier from block declaration (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); } break; case 141: /* Line 1792 of yacc.c */ -#line 1115 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1117 "glslang.y" { // allow inheritance of storage qualifier from block declaration (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); @@ -4792,16 +4874,34 @@ yyreduce: case 142: /* Line 1792 of yacc.c */ -#line 1122 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1121 "glslang.y" + { + // allow inheritance of storage qualifier from block declaration + (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); + } + break; + + case 143: +/* Line 1792 of yacc.c */ +#line 1125 "glslang.y" + { + // allow inheritance of storage qualifier from block declaration + (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); + } + break; + + case 144: +/* Line 1792 of yacc.c */ +#line 1132 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); (yyval.interm.type).qualifier.storage = EvqConst; // will later turn into EvqConstReadOnly, if the initializer is not constant } break; - case 143: + case 145: /* Line 1792 of yacc.c */ -#line 1126 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1136 "glslang.y" { parseContext.requireStage((yyvsp[(1) - (1)].lex).loc, EShLangVertex, "attribute"); parseContext.checkDeprecated((yyvsp[(1) - (1)].lex).loc, ECoreProfile, 130, "attribute"); @@ -4816,9 +4916,9 @@ yyreduce: } break; - case 144: + case 146: /* Line 1792 of yacc.c */ -#line 1138 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1148 "glslang.y" { parseContext.checkDeprecated((yyvsp[(1) - (1)].lex).loc, ENoProfile, 130, "varying"); parseContext.checkDeprecated((yyvsp[(1) - (1)].lex).loc, ECoreProfile, 130, "varying"); @@ -4835,9 +4935,9 @@ yyreduce: } break; - case 145: + case 147: /* Line 1792 of yacc.c */ -#line 1152 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1162 "glslang.y" { parseContext.globalCheck((yyvsp[(1) - (1)].lex).loc, "inout"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); @@ -4845,9 +4945,9 @@ yyreduce: } break; - case 146: + case 148: /* Line 1792 of yacc.c */ -#line 1157 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1167 "glslang.y" { parseContext.globalCheck((yyvsp[(1) - (1)].lex).loc, "in"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); @@ -4856,9 +4956,9 @@ yyreduce: } break; - case 147: + case 149: /* Line 1792 of yacc.c */ -#line 1163 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1173 "glslang.y" { parseContext.globalCheck((yyvsp[(1) - (1)].lex).loc, "out"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); @@ -4867,9 +4967,9 @@ yyreduce: } break; - case 148: + case 150: /* Line 1792 of yacc.c */ -#line 1169 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1179 "glslang.y" { parseContext.profileRequires((yyvsp[(1) - (1)].lex).loc, ENoProfile, 120, 0, "centroid"); parseContext.profileRequires((yyvsp[(1) - (1)].lex).loc, EEsProfile, 300, 0, "centroid"); @@ -4879,9 +4979,9 @@ yyreduce: } break; - case 149: + case 151: /* Line 1792 of yacc.c */ -#line 1176 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1186 "glslang.y" { parseContext.globalCheck((yyvsp[(1) - (1)].lex).loc, "patch"); parseContext.requireStage((yyvsp[(1) - (1)].lex).loc, (EShLanguageMask)(EShLangTessControlMask | EShLangTessEvaluationMask), "patch"); @@ -4890,9 +4990,9 @@ yyreduce: } break; - case 150: + case 152: /* Line 1792 of yacc.c */ -#line 1182 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1192 "glslang.y" { parseContext.globalCheck((yyvsp[(1) - (1)].lex).loc, "sample"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); @@ -4900,9 +5000,9 @@ yyreduce: } break; - case 151: + case 153: /* Line 1792 of yacc.c */ -#line 1187 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1197 "glslang.y" { parseContext.globalCheck((yyvsp[(1) - (1)].lex).loc, "uniform"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); @@ -4910,9 +5010,9 @@ yyreduce: } break; - case 152: + case 154: /* Line 1792 of yacc.c */ -#line 1192 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1202 "glslang.y" { parseContext.globalCheck((yyvsp[(1) - (1)].lex).loc, "buffer"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); @@ -4920,9 +5020,9 @@ yyreduce: } break; - case 153: + case 155: /* Line 1792 of yacc.c */ -#line 1197 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1207 "glslang.y" { parseContext.profileRequires((yyvsp[(1) - (1)].lex).loc, ECoreProfile | ECompatibilityProfile, 430, 0, "shared"); parseContext.profileRequires((yyvsp[(1) - (1)].lex).loc, EEsProfile, 310, 0, "shared"); @@ -4932,54 +5032,54 @@ yyreduce: } break; - case 154: + case 156: /* Line 1792 of yacc.c */ -#line 1204 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1214 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); (yyval.interm.type).qualifier.coherent = true; } break; - case 155: + case 157: /* Line 1792 of yacc.c */ -#line 1208 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1218 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); (yyval.interm.type).qualifier.volatil = true; } break; - case 156: + case 158: /* Line 1792 of yacc.c */ -#line 1212 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1222 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); (yyval.interm.type).qualifier.restrict = true; } break; - case 157: + case 159: /* Line 1792 of yacc.c */ -#line 1216 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1226 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); (yyval.interm.type).qualifier.readonly = true; } break; - case 158: + case 160: /* Line 1792 of yacc.c */ -#line 1220 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1230 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); (yyval.interm.type).qualifier.writeonly = true; } break; - case 159: + case 161: /* Line 1792 of yacc.c */ -#line 1224 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1234 "glslang.y" { parseContext.spvRemoved((yyvsp[(1) - (1)].lex).loc, "subroutine"); parseContext.globalCheck((yyvsp[(1) - (1)].lex).loc, "subroutine"); @@ -4988,9 +5088,9 @@ yyreduce: } break; - case 160: + case 162: /* Line 1792 of yacc.c */ -#line 1230 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1240 "glslang.y" { parseContext.spvRemoved((yyvsp[(1) - (4)].lex).loc, "subroutine"); parseContext.globalCheck((yyvsp[(1) - (4)].lex).loc, "subroutine"); @@ -5002,33 +5102,33 @@ yyreduce: } break; - case 161: + case 163: /* Line 1792 of yacc.c */ -#line 1242 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1252 "glslang.y" { // TODO: 4.0 functionality: subroutine type to list } break; - case 162: + case 164: /* Line 1792 of yacc.c */ -#line 1245 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1255 "glslang.y" { } break; - case 163: + case 165: /* Line 1792 of yacc.c */ -#line 1250 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1260 "glslang.y" { (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); (yyval.interm.type).qualifier.precision = parseContext.getDefaultPrecision((yyval.interm.type)); } break; - case 164: + case 166: /* Line 1792 of yacc.c */ -#line 1254 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1264 "glslang.y" { parseContext.arrayDimCheck((yyvsp[(2) - (2)].interm).loc, (yyvsp[(2) - (2)].interm).arraySizes, 0); (yyval.interm.type) = (yyvsp[(1) - (2)].interm.type); @@ -5037,9 +5137,9 @@ yyreduce: } break; - case 165: + case 167: /* Line 1792 of yacc.c */ -#line 1263 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1273 "glslang.y" { (yyval.interm).loc = (yyvsp[(1) - (2)].lex).loc; (yyval.interm).arraySizes = new TArraySizes; @@ -5047,9 +5147,9 @@ yyreduce: } break; - case 166: + case 168: /* Line 1792 of yacc.c */ -#line 1268 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1278 "glslang.y" { (yyval.interm).loc = (yyvsp[(1) - (3)].lex).loc; (yyval.interm).arraySizes = new TArraySizes; @@ -5060,18 +5160,18 @@ yyreduce: } break; - case 167: + case 169: /* Line 1792 of yacc.c */ -#line 1276 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1286 "glslang.y" { (yyval.interm) = (yyvsp[(1) - (3)].interm); (yyval.interm).arraySizes->addInnerSize(); } break; - case 168: + case 170: /* Line 1792 of yacc.c */ -#line 1280 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1290 "glslang.y" { (yyval.interm) = (yyvsp[(1) - (4)].interm); @@ -5081,27 +5181,27 @@ yyreduce: } break; - case 169: + case 171: /* Line 1792 of yacc.c */ -#line 1290 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1300 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtVoid; } break; - case 170: + case 172: /* Line 1792 of yacc.c */ -#line 1294 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1304 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; } break; - case 171: + case 173: /* Line 1792 of yacc.c */ -#line 1298 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1308 "glslang.y" { parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); @@ -5109,18 +5209,18 @@ yyreduce: } break; - case 172: + case 174: /* Line 1792 of yacc.c */ -#line 1303 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1313 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt; } break; - case 173: + case 175: /* Line 1792 of yacc.c */ -#line 1307 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1317 "glslang.y" { parseContext.fullIntegerCheck((yyvsp[(1) - (1)].lex).loc, "unsigned integer"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); @@ -5128,70 +5228,90 @@ yyreduce: } break; - case 174: -/* Line 1792 of yacc.c */ -#line 1312 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtBool; - } - break; - - case 175: -/* Line 1792 of yacc.c */ -#line 1316 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setVector(2); - } - break; - case 176: /* Line 1792 of yacc.c */ -#line 1321 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1322 "glslang.y" { + parseContext.int64Check((yyvsp[(1) - (1)].lex).loc, "64-bit integer", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setVector(3); + (yyval.interm.type).basicType = EbtInt64; } break; case 177: /* Line 1792 of yacc.c */ -#line 1326 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1327 "glslang.y" { + parseContext.int64Check((yyvsp[(1) - (1)].lex).loc, "64-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setVector(4); + (yyval.interm.type).basicType = EbtUint64; } break; case 178: /* Line 1792 of yacc.c */ -#line 1331 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1332 "glslang.y" { - parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double vector"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtDouble; - (yyval.interm.type).setVector(2); + (yyval.interm.type).basicType = EbtBool; } break; case 179: /* Line 1792 of yacc.c */ -#line 1337 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1336 "glslang.y" { - parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double vector"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtDouble; - (yyval.interm.type).setVector(3); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setVector(2); } break; case 180: /* Line 1792 of yacc.c */ -#line 1343 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1341 "glslang.y" + { + (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setVector(3); + } + break; + + case 181: +/* Line 1792 of yacc.c */ +#line 1346 "glslang.y" + { + (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setVector(4); + } + break; + + case 182: +/* Line 1792 of yacc.c */ +#line 1351 "glslang.y" + { + parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double vector"); + (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtDouble; + (yyval.interm.type).setVector(2); + } + break; + + case 183: +/* Line 1792 of yacc.c */ +#line 1357 "glslang.y" + { + parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double vector"); + (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtDouble; + (yyval.interm.type).setVector(3); + } + break; + + case 184: +/* Line 1792 of yacc.c */ +#line 1363 "glslang.y" { parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double vector"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); @@ -5200,59 +5320,59 @@ yyreduce: } break; - case 181: -/* Line 1792 of yacc.c */ -#line 1349 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtBool; - (yyval.interm.type).setVector(2); - } - break; - - case 182: -/* Line 1792 of yacc.c */ -#line 1354 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtBool; - (yyval.interm.type).setVector(3); - } - break; - - case 183: -/* Line 1792 of yacc.c */ -#line 1359 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtBool; - (yyval.interm.type).setVector(4); - } - break; - - case 184: -/* Line 1792 of yacc.c */ -#line 1364 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt; - (yyval.interm.type).setVector(2); - } - break; - case 185: /* Line 1792 of yacc.c */ -#line 1369 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1369 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt; - (yyval.interm.type).setVector(3); + (yyval.interm.type).basicType = EbtBool; + (yyval.interm.type).setVector(2); } break; case 186: /* Line 1792 of yacc.c */ -#line 1374 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1374 "glslang.y" + { + (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtBool; + (yyval.interm.type).setVector(3); + } + break; + + case 187: +/* Line 1792 of yacc.c */ +#line 1379 "glslang.y" + { + (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtBool; + (yyval.interm.type).setVector(4); + } + break; + + case 188: +/* Line 1792 of yacc.c */ +#line 1384 "glslang.y" + { + (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtInt; + (yyval.interm.type).setVector(2); + } + break; + + case 189: +/* Line 1792 of yacc.c */ +#line 1389 "glslang.y" + { + (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtInt; + (yyval.interm.type).setVector(3); + } + break; + + case 190: +/* Line 1792 of yacc.c */ +#line 1394 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt; @@ -5260,9 +5380,42 @@ yyreduce: } break; - case 187: + case 191: /* Line 1792 of yacc.c */ -#line 1379 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1399 "glslang.y" + { + parseContext.int64Check((yyvsp[(1) - (1)].lex).loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtInt64; + (yyval.interm.type).setVector(2); + } + break; + + case 192: +/* Line 1792 of yacc.c */ +#line 1405 "glslang.y" + { + parseContext.int64Check((yyvsp[(1) - (1)].lex).loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtInt64; + (yyval.interm.type).setVector(3); + } + break; + + case 193: +/* Line 1792 of yacc.c */ +#line 1411 "glslang.y" + { + parseContext.int64Check((yyvsp[(1) - (1)].lex).loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtInt64; + (yyval.interm.type).setVector(4); + } + break; + + case 194: +/* Line 1792 of yacc.c */ +#line 1417 "glslang.y" { parseContext.fullIntegerCheck((yyvsp[(1) - (1)].lex).loc, "unsigned integer vector"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); @@ -5271,9 +5424,9 @@ yyreduce: } break; - case 188: + case 195: /* Line 1792 of yacc.c */ -#line 1385 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1423 "glslang.y" { parseContext.fullIntegerCheck((yyvsp[(1) - (1)].lex).loc, "unsigned integer vector"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); @@ -5282,9 +5435,9 @@ yyreduce: } break; - case 189: + case 196: /* Line 1792 of yacc.c */ -#line 1391 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1429 "glslang.y" { parseContext.fullIntegerCheck((yyvsp[(1) - (1)].lex).loc, "unsigned integer vector"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); @@ -5293,119 +5446,62 @@ yyreduce: } break; - case 190: -/* Line 1792 of yacc.c */ -#line 1397 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setMatrix(2, 2); - } - break; - - case 191: -/* Line 1792 of yacc.c */ -#line 1402 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setMatrix(3, 3); - } - break; - - case 192: -/* Line 1792 of yacc.c */ -#line 1407 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setMatrix(4, 4); - } - break; - - case 193: -/* Line 1792 of yacc.c */ -#line 1412 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setMatrix(2, 2); - } - break; - - case 194: -/* Line 1792 of yacc.c */ -#line 1417 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setMatrix(2, 3); - } - break; - - case 195: -/* Line 1792 of yacc.c */ -#line 1422 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setMatrix(2, 4); - } - break; - - case 196: -/* Line 1792 of yacc.c */ -#line 1427 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setMatrix(3, 2); - } - break; - case 197: /* Line 1792 of yacc.c */ -#line 1432 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1435 "glslang.y" { + parseContext.int64Check((yyvsp[(1) - (1)].lex).loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setMatrix(3, 3); + (yyval.interm.type).basicType = EbtUint64; + (yyval.interm.type).setVector(2); } break; case 198: /* Line 1792 of yacc.c */ -#line 1437 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1441 "glslang.y" { + parseContext.int64Check((yyvsp[(1) - (1)].lex).loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setMatrix(3, 4); + (yyval.interm.type).basicType = EbtUint64; + (yyval.interm.type).setVector(3); } break; case 199: /* Line 1792 of yacc.c */ -#line 1442 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1447 "glslang.y" { + parseContext.int64Check((yyvsp[(1) - (1)].lex).loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[(1) - (1)].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(4); } break; case 200: /* Line 1792 of yacc.c */ -#line 1447 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1453 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setMatrix(4, 3); + (yyval.interm.type).setMatrix(2, 2); } break; case 201: /* Line 1792 of yacc.c */ -#line 1452 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1458 "glslang.y" + { + (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setMatrix(3, 3); + } + break; + + case 202: +/* Line 1792 of yacc.c */ +#line 1463 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; @@ -5413,9 +5509,99 @@ yyreduce: } break; - case 202: + case 203: /* Line 1792 of yacc.c */ -#line 1457 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1468 "glslang.y" + { + (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setMatrix(2, 2); + } + break; + + case 204: +/* Line 1792 of yacc.c */ +#line 1473 "glslang.y" + { + (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setMatrix(2, 3); + } + break; + + case 205: +/* Line 1792 of yacc.c */ +#line 1478 "glslang.y" + { + (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setMatrix(2, 4); + } + break; + + case 206: +/* Line 1792 of yacc.c */ +#line 1483 "glslang.y" + { + (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setMatrix(3, 2); + } + break; + + case 207: +/* Line 1792 of yacc.c */ +#line 1488 "glslang.y" + { + (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setMatrix(3, 3); + } + break; + + case 208: +/* Line 1792 of yacc.c */ +#line 1493 "glslang.y" + { + (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setMatrix(3, 4); + } + break; + + case 209: +/* Line 1792 of yacc.c */ +#line 1498 "glslang.y" + { + (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setMatrix(4, 2); + } + break; + + case 210: +/* Line 1792 of yacc.c */ +#line 1503 "glslang.y" + { + (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setMatrix(4, 3); + } + break; + + case 211: +/* Line 1792 of yacc.c */ +#line 1508 "glslang.y" + { + (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setMatrix(4, 4); + } + break; + + case 212: +/* Line 1792 of yacc.c */ +#line 1513 "glslang.y" { parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); @@ -5424,9 +5610,9 @@ yyreduce: } break; - case 203: + case 213: /* Line 1792 of yacc.c */ -#line 1463 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1519 "glslang.y" { parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); @@ -5435,9 +5621,9 @@ yyreduce: } break; - case 204: + case 214: /* Line 1792 of yacc.c */ -#line 1469 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1525 "glslang.y" { parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); @@ -5446,9 +5632,9 @@ yyreduce: } break; - case 205: + case 215: /* Line 1792 of yacc.c */ -#line 1475 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1531 "glslang.y" { parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); @@ -5457,9 +5643,9 @@ yyreduce: } break; - case 206: + case 216: /* Line 1792 of yacc.c */ -#line 1481 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1537 "glslang.y" { parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); @@ -5468,9 +5654,9 @@ yyreduce: } break; - case 207: + case 217: /* Line 1792 of yacc.c */ -#line 1487 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1543 "glslang.y" { parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); @@ -5479,9 +5665,9 @@ yyreduce: } break; - case 208: + case 218: /* Line 1792 of yacc.c */ -#line 1493 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1549 "glslang.y" { parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); @@ -5490,9 +5676,9 @@ yyreduce: } break; - case 209: + case 219: /* Line 1792 of yacc.c */ -#line 1499 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1555 "glslang.y" { parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); @@ -5501,9 +5687,9 @@ yyreduce: } break; - case 210: + case 220: /* Line 1792 of yacc.c */ -#line 1505 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1561 "glslang.y" { parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); @@ -5512,9 +5698,9 @@ yyreduce: } break; - case 211: + case 221: /* Line 1792 of yacc.c */ -#line 1511 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1567 "glslang.y" { parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); @@ -5523,9 +5709,9 @@ yyreduce: } break; - case 212: + case 222: /* Line 1792 of yacc.c */ -#line 1517 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1573 "glslang.y" { parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); @@ -5534,9 +5720,9 @@ yyreduce: } break; - case 213: + case 223: /* Line 1792 of yacc.c */ -#line 1523 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1579 "glslang.y" { parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); @@ -5545,9 +5731,9 @@ yyreduce: } break; - case 214: + case 224: /* Line 1792 of yacc.c */ -#line 1529 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1585 "glslang.y" { parseContext.vulkanRemoved((yyvsp[(1) - (1)].lex).loc, "atomic counter types"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); @@ -5555,9 +5741,9 @@ yyreduce: } break; - case 215: + case 225: /* Line 1792 of yacc.c */ -#line 1534 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1590 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5565,9 +5751,9 @@ yyreduce: } break; - case 216: + case 226: /* Line 1792 of yacc.c */ -#line 1539 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1595 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5575,9 +5761,9 @@ yyreduce: } break; - case 217: + case 227: /* Line 1792 of yacc.c */ -#line 1544 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1600 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5585,9 +5771,9 @@ yyreduce: } break; - case 218: + case 228: /* Line 1792 of yacc.c */ -#line 1549 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1605 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5595,9 +5781,9 @@ yyreduce: } break; - case 219: + case 229: /* Line 1792 of yacc.c */ -#line 1554 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1610 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5605,9 +5791,9 @@ yyreduce: } break; - case 220: + case 230: /* Line 1792 of yacc.c */ -#line 1559 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1615 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5615,9 +5801,9 @@ yyreduce: } break; - case 221: + case 231: /* Line 1792 of yacc.c */ -#line 1564 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1620 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5625,9 +5811,9 @@ yyreduce: } break; - case 222: + case 232: /* Line 1792 of yacc.c */ -#line 1569 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1625 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5635,9 +5821,9 @@ yyreduce: } break; - case 223: + case 233: /* Line 1792 of yacc.c */ -#line 1574 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1630 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5645,9 +5831,9 @@ yyreduce: } break; - case 224: + case 234: /* Line 1792 of yacc.c */ -#line 1579 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1635 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5655,9 +5841,9 @@ yyreduce: } break; - case 225: + case 235: /* Line 1792 of yacc.c */ -#line 1584 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1640 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5665,9 +5851,9 @@ yyreduce: } break; - case 226: + case 236: /* Line 1792 of yacc.c */ -#line 1589 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1645 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5675,9 +5861,9 @@ yyreduce: } break; - case 227: + case 237: /* Line 1792 of yacc.c */ -#line 1594 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1650 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5685,9 +5871,9 @@ yyreduce: } break; - case 228: + case 238: /* Line 1792 of yacc.c */ -#line 1599 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1655 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5695,9 +5881,9 @@ yyreduce: } break; - case 229: + case 239: /* Line 1792 of yacc.c */ -#line 1604 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1660 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5705,9 +5891,9 @@ yyreduce: } break; - case 230: + case 240: /* Line 1792 of yacc.c */ -#line 1609 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1665 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5715,9 +5901,9 @@ yyreduce: } break; - case 231: + case 241: /* Line 1792 of yacc.c */ -#line 1614 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1670 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5725,9 +5911,9 @@ yyreduce: } break; - case 232: + case 242: /* Line 1792 of yacc.c */ -#line 1619 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1675 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5735,9 +5921,9 @@ yyreduce: } break; - case 233: + case 243: /* Line 1792 of yacc.c */ -#line 1624 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1680 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5745,9 +5931,9 @@ yyreduce: } break; - case 234: + case 244: /* Line 1792 of yacc.c */ -#line 1629 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1685 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5755,9 +5941,9 @@ yyreduce: } break; - case 235: + case 245: /* Line 1792 of yacc.c */ -#line 1634 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1690 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5765,9 +5951,9 @@ yyreduce: } break; - case 236: + case 246: /* Line 1792 of yacc.c */ -#line 1639 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1695 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5775,9 +5961,9 @@ yyreduce: } break; - case 237: + case 247: /* Line 1792 of yacc.c */ -#line 1644 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1700 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5785,9 +5971,9 @@ yyreduce: } break; - case 238: + case 248: /* Line 1792 of yacc.c */ -#line 1649 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1705 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5795,9 +5981,9 @@ yyreduce: } break; - case 239: + case 249: /* Line 1792 of yacc.c */ -#line 1654 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1710 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5805,9 +5991,9 @@ yyreduce: } break; - case 240: + case 250: /* Line 1792 of yacc.c */ -#line 1659 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1715 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5815,9 +6001,9 @@ yyreduce: } break; - case 241: + case 251: /* Line 1792 of yacc.c */ -#line 1664 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1720 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5825,9 +6011,9 @@ yyreduce: } break; - case 242: + case 252: /* Line 1792 of yacc.c */ -#line 1669 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1725 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5835,9 +6021,9 @@ yyreduce: } break; - case 243: + case 253: /* Line 1792 of yacc.c */ -#line 1674 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1730 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5845,9 +6031,9 @@ yyreduce: } break; - case 244: + case 254: /* Line 1792 of yacc.c */ -#line 1679 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1735 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5855,9 +6041,9 @@ yyreduce: } break; - case 245: + case 255: /* Line 1792 of yacc.c */ -#line 1684 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1740 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5865,9 +6051,9 @@ yyreduce: } break; - case 246: + case 256: /* Line 1792 of yacc.c */ -#line 1689 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1745 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5875,9 +6061,9 @@ yyreduce: } break; - case 247: + case 257: /* Line 1792 of yacc.c */ -#line 1694 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1750 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5885,9 +6071,9 @@ yyreduce: } break; - case 248: + case 258: /* Line 1792 of yacc.c */ -#line 1699 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1755 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5895,9 +6081,9 @@ yyreduce: } break; - case 249: + case 259: /* Line 1792 of yacc.c */ -#line 1704 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1760 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5905,9 +6091,9 @@ yyreduce: } break; - case 250: + case 260: /* Line 1792 of yacc.c */ -#line 1709 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1765 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5915,9 +6101,9 @@ yyreduce: } break; - case 251: + case 261: /* Line 1792 of yacc.c */ -#line 1714 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1770 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5925,9 +6111,9 @@ yyreduce: } break; - case 252: + case 262: /* Line 1792 of yacc.c */ -#line 1719 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1775 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5935,9 +6121,9 @@ yyreduce: } break; - case 253: + case 263: /* Line 1792 of yacc.c */ -#line 1724 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1780 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5945,9 +6131,9 @@ yyreduce: } break; - case 254: + case 264: /* Line 1792 of yacc.c */ -#line 1729 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1785 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5955,9 +6141,9 @@ yyreduce: } break; - case 255: + case 265: /* Line 1792 of yacc.c */ -#line 1734 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1790 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5965,9 +6151,9 @@ yyreduce: } break; - case 256: + case 266: /* Line 1792 of yacc.c */ -#line 1739 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1795 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5975,9 +6161,9 @@ yyreduce: } break; - case 257: + case 267: /* Line 1792 of yacc.c */ -#line 1744 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1800 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5985,9 +6171,9 @@ yyreduce: } break; - case 258: + case 268: /* Line 1792 of yacc.c */ -#line 1749 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1805 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -5995,9 +6181,9 @@ yyreduce: } break; - case 259: + case 269: /* Line 1792 of yacc.c */ -#line 1754 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1810 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6005,9 +6191,9 @@ yyreduce: } break; - case 260: + case 270: /* Line 1792 of yacc.c */ -#line 1759 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1815 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6015,9 +6201,9 @@ yyreduce: } break; - case 261: + case 271: /* Line 1792 of yacc.c */ -#line 1764 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1820 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6025,9 +6211,9 @@ yyreduce: } break; - case 262: + case 272: /* Line 1792 of yacc.c */ -#line 1769 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1825 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6035,9 +6221,9 @@ yyreduce: } break; - case 263: + case 273: /* Line 1792 of yacc.c */ -#line 1774 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1830 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6045,9 +6231,9 @@ yyreduce: } break; - case 264: + case 274: /* Line 1792 of yacc.c */ -#line 1779 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1835 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6055,9 +6241,9 @@ yyreduce: } break; - case 265: + case 275: /* Line 1792 of yacc.c */ -#line 1784 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1840 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6065,9 +6251,9 @@ yyreduce: } break; - case 266: + case 276: /* Line 1792 of yacc.c */ -#line 1789 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1845 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6075,9 +6261,9 @@ yyreduce: } break; - case 267: + case 277: /* Line 1792 of yacc.c */ -#line 1794 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1850 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6085,9 +6271,9 @@ yyreduce: } break; - case 268: + case 278: /* Line 1792 of yacc.c */ -#line 1799 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1855 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6095,9 +6281,9 @@ yyreduce: } break; - case 269: + case 279: /* Line 1792 of yacc.c */ -#line 1804 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1860 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6105,9 +6291,9 @@ yyreduce: } break; - case 270: + case 280: /* Line 1792 of yacc.c */ -#line 1809 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1865 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6115,9 +6301,9 @@ yyreduce: } break; - case 271: + case 281: /* Line 1792 of yacc.c */ -#line 1814 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1870 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6125,9 +6311,9 @@ yyreduce: } break; - case 272: + case 282: /* Line 1792 of yacc.c */ -#line 1819 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1875 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6135,9 +6321,9 @@ yyreduce: } break; - case 273: + case 283: /* Line 1792 of yacc.c */ -#line 1824 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1880 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6145,9 +6331,9 @@ yyreduce: } break; - case 274: + case 284: /* Line 1792 of yacc.c */ -#line 1829 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1885 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6155,9 +6341,9 @@ yyreduce: } break; - case 275: + case 285: /* Line 1792 of yacc.c */ -#line 1834 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1890 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6165,9 +6351,9 @@ yyreduce: } break; - case 276: + case 286: /* Line 1792 of yacc.c */ -#line 1839 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1895 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6175,9 +6361,9 @@ yyreduce: } break; - case 277: + case 287: /* Line 1792 of yacc.c */ -#line 1844 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1900 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6185,9 +6371,9 @@ yyreduce: } break; - case 278: + case 288: /* Line 1792 of yacc.c */ -#line 1849 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1905 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6195,9 +6381,9 @@ yyreduce: } break; - case 279: + case 289: /* Line 1792 of yacc.c */ -#line 1854 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1910 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6205,9 +6391,9 @@ yyreduce: } break; - case 280: + case 290: /* Line 1792 of yacc.c */ -#line 1859 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1915 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6215,9 +6401,9 @@ yyreduce: } break; - case 281: + case 291: /* Line 1792 of yacc.c */ -#line 1864 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1920 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6225,9 +6411,9 @@ yyreduce: } break; - case 282: + case 292: /* Line 1792 of yacc.c */ -#line 1869 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1925 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6235,9 +6421,9 @@ yyreduce: } break; - case 283: + case 293: /* Line 1792 of yacc.c */ -#line 1874 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1930 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6245,9 +6431,9 @@ yyreduce: } break; - case 284: + case 294: /* Line 1792 of yacc.c */ -#line 1879 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1935 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6255,9 +6441,9 @@ yyreduce: } break; - case 285: + case 295: /* Line 1792 of yacc.c */ -#line 1884 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1940 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6265,9 +6451,9 @@ yyreduce: } break; - case 286: + case 296: /* Line 1792 of yacc.c */ -#line 1889 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1945 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6275,9 +6461,9 @@ yyreduce: } break; - case 287: + case 297: /* Line 1792 of yacc.c */ -#line 1894 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1950 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6285,9 +6471,9 @@ yyreduce: } break; - case 288: + case 298: /* Line 1792 of yacc.c */ -#line 1899 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1955 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6295,9 +6481,9 @@ yyreduce: } break; - case 289: + case 299: /* Line 1792 of yacc.c */ -#line 1904 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1960 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6305,9 +6491,9 @@ yyreduce: } break; - case 290: + case 300: /* Line 1792 of yacc.c */ -#line 1909 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1965 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6315,9 +6501,9 @@ yyreduce: } break; - case 291: + case 301: /* Line 1792 of yacc.c */ -#line 1914 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1970 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6325,9 +6511,9 @@ yyreduce: } break; - case 292: + case 302: /* Line 1792 of yacc.c */ -#line 1919 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1975 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6335,9 +6521,9 @@ yyreduce: } break; - case 293: + case 303: /* Line 1792 of yacc.c */ -#line 1924 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1980 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6345,9 +6531,9 @@ yyreduce: } break; - case 294: + case 304: /* Line 1792 of yacc.c */ -#line 1929 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1985 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6355,9 +6541,9 @@ yyreduce: } break; - case 295: + case 305: /* Line 1792 of yacc.c */ -#line 1934 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1990 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6365,9 +6551,9 @@ yyreduce: } break; - case 296: + case 306: /* Line 1792 of yacc.c */ -#line 1939 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 1995 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6375,9 +6561,9 @@ yyreduce: } break; - case 297: + case 307: /* Line 1792 of yacc.c */ -#line 1944 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2000 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6385,9 +6571,9 @@ yyreduce: } break; - case 298: + case 308: /* Line 1792 of yacc.c */ -#line 1949 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2005 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6395,9 +6581,9 @@ yyreduce: } break; - case 299: + case 309: /* Line 1792 of yacc.c */ -#line 1954 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2010 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6405,9 +6591,9 @@ yyreduce: } break; - case 300: + case 310: /* Line 1792 of yacc.c */ -#line 1959 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2015 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6415,9 +6601,9 @@ yyreduce: } break; - case 301: + case 311: /* Line 1792 of yacc.c */ -#line 1964 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2020 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6425,9 +6611,9 @@ yyreduce: } break; - case 302: + case 312: /* Line 1792 of yacc.c */ -#line 1969 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2025 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6435,9 +6621,9 @@ yyreduce: } break; - case 303: + case 313: /* Line 1792 of yacc.c */ -#line 1974 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2030 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6445,9 +6631,9 @@ yyreduce: } break; - case 304: + case 314: /* Line 1792 of yacc.c */ -#line 1979 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2035 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6455,9 +6641,9 @@ yyreduce: } break; - case 305: + case 315: /* Line 1792 of yacc.c */ -#line 1984 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2040 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6465,9 +6651,9 @@ yyreduce: } break; - case 306: + case 316: /* Line 1792 of yacc.c */ -#line 1989 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2045 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6475,9 +6661,9 @@ yyreduce: } break; - case 307: + case 317: /* Line 1792 of yacc.c */ -#line 1994 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2050 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6485,9 +6671,9 @@ yyreduce: } break; - case 308: + case 318: /* Line 1792 of yacc.c */ -#line 1999 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2055 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6495,9 +6681,9 @@ yyreduce: } break; - case 309: + case 319: /* Line 1792 of yacc.c */ -#line 2004 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2060 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6505,9 +6691,9 @@ yyreduce: } break; - case 310: + case 320: /* Line 1792 of yacc.c */ -#line 2009 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2065 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6515,9 +6701,9 @@ yyreduce: } break; - case 311: + case 321: /* Line 1792 of yacc.c */ -#line 2014 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2070 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6525,9 +6711,9 @@ yyreduce: } break; - case 312: + case 322: /* Line 1792 of yacc.c */ -#line 2019 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2075 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6535,9 +6721,9 @@ yyreduce: } break; - case 313: + case 323: /* Line 1792 of yacc.c */ -#line 2024 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2080 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6545,9 +6731,9 @@ yyreduce: } break; - case 314: + case 324: /* Line 1792 of yacc.c */ -#line 2029 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2085 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6555,9 +6741,9 @@ yyreduce: } break; - case 315: + case 325: /* Line 1792 of yacc.c */ -#line 2034 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2090 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6565,9 +6751,9 @@ yyreduce: } break; - case 316: + case 326: /* Line 1792 of yacc.c */ -#line 2039 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2095 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6575,9 +6761,9 @@ yyreduce: } break; - case 317: + case 327: /* Line 1792 of yacc.c */ -#line 2044 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2100 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6585,9 +6771,9 @@ yyreduce: } break; - case 318: + case 328: /* Line 1792 of yacc.c */ -#line 2049 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2105 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6595,9 +6781,9 @@ yyreduce: } break; - case 319: + case 329: /* Line 1792 of yacc.c */ -#line 2054 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2110 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6605,9 +6791,9 @@ yyreduce: } break; - case 320: + case 330: /* Line 1792 of yacc.c */ -#line 2059 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2115 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6615,9 +6801,9 @@ yyreduce: } break; - case 321: + case 331: /* Line 1792 of yacc.c */ -#line 2064 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2120 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6625,9 +6811,9 @@ yyreduce: } break; - case 322: + case 332: /* Line 1792 of yacc.c */ -#line 2069 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2125 "glslang.y" { (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6635,9 +6821,9 @@ yyreduce: } break; - case 323: + case 333: /* Line 1792 of yacc.c */ -#line 2074 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2130 "glslang.y" { // GL_OES_EGL_image_external (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; @@ -6646,9 +6832,9 @@ yyreduce: } break; - case 324: + case 334: /* Line 1792 of yacc.c */ -#line 2080 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2136 "glslang.y" { parseContext.requireStage((yyvsp[(1) - (1)].lex).loc, EShLangFragment, "subpass input"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); @@ -6657,9 +6843,9 @@ yyreduce: } break; - case 325: + case 335: /* Line 1792 of yacc.c */ -#line 2086 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2142 "glslang.y" { parseContext.requireStage((yyvsp[(1) - (1)].lex).loc, EShLangFragment, "subpass input"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); @@ -6668,9 +6854,9 @@ yyreduce: } break; - case 326: + case 336: /* Line 1792 of yacc.c */ -#line 2092 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2148 "glslang.y" { parseContext.requireStage((yyvsp[(1) - (1)].lex).loc, EShLangFragment, "subpass input"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); @@ -6679,9 +6865,9 @@ yyreduce: } break; - case 327: + case 337: /* Line 1792 of yacc.c */ -#line 2098 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2154 "glslang.y" { parseContext.requireStage((yyvsp[(1) - (1)].lex).loc, EShLangFragment, "subpass input"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); @@ -6690,9 +6876,9 @@ yyreduce: } break; - case 328: + case 338: /* Line 1792 of yacc.c */ -#line 2104 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2160 "glslang.y" { parseContext.requireStage((yyvsp[(1) - (1)].lex).loc, EShLangFragment, "subpass input"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); @@ -6701,9 +6887,9 @@ yyreduce: } break; - case 329: + case 339: /* Line 1792 of yacc.c */ -#line 2110 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2166 "glslang.y" { parseContext.requireStage((yyvsp[(1) - (1)].lex).loc, EShLangFragment, "subpass input"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); @@ -6712,9 +6898,9 @@ yyreduce: } break; - case 330: + case 340: /* Line 1792 of yacc.c */ -#line 2116 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2172 "glslang.y" { (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); (yyval.interm.type).qualifier.storage = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; @@ -6722,9 +6908,9 @@ yyreduce: } break; - case 331: + case 341: /* Line 1792 of yacc.c */ -#line 2121 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2177 "glslang.y" { // // This is for user defined type names. The lexical phase looked up the @@ -6740,9 +6926,9 @@ yyreduce: } break; - case 332: + case 342: /* Line 1792 of yacc.c */ -#line 2137 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2193 "glslang.y" { parseContext.profileRequires((yyvsp[(1) - (1)].lex).loc, ENoProfile, 130, 0, "highp precision qualifier"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); @@ -6751,9 +6937,9 @@ yyreduce: } break; - case 333: + case 343: /* Line 1792 of yacc.c */ -#line 2143 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2199 "glslang.y" { parseContext.profileRequires((yyvsp[(1) - (1)].lex).loc, ENoProfile, 130, 0, "mediump precision qualifier"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); @@ -6762,9 +6948,9 @@ yyreduce: } break; - case 334: + case 344: /* Line 1792 of yacc.c */ -#line 2149 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2205 "glslang.y" { parseContext.profileRequires((yyvsp[(1) - (1)].lex).loc, ENoProfile, 130, 0, "lowp precision qualifier"); (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); @@ -6773,15 +6959,15 @@ yyreduce: } break; - case 335: + case 345: /* Line 1792 of yacc.c */ -#line 2158 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2214 "glslang.y" { parseContext.nestedStructCheck((yyvsp[(1) - (3)].lex).loc); } break; - case 336: + case 346: /* Line 1792 of yacc.c */ -#line 2158 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2214 "glslang.y" { TType* structure = new TType((yyvsp[(5) - (6)].interm.typeList), *(yyvsp[(2) - (6)].lex).string); parseContext.structArrayCheck((yyvsp[(2) - (6)].lex).loc, *structure); @@ -6795,15 +6981,15 @@ yyreduce: } break; - case 337: + case 347: /* Line 1792 of yacc.c */ -#line 2169 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2225 "glslang.y" { parseContext.nestedStructCheck((yyvsp[(1) - (2)].lex).loc); } break; - case 338: + case 348: /* Line 1792 of yacc.c */ -#line 2169 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2225 "glslang.y" { TType* structure = new TType((yyvsp[(4) - (5)].interm.typeList), TString("")); (yyval.interm.type).init((yyvsp[(1) - (5)].lex).loc); @@ -6813,17 +6999,17 @@ yyreduce: } break; - case 339: + case 349: /* Line 1792 of yacc.c */ -#line 2179 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2235 "glslang.y" { (yyval.interm.typeList) = (yyvsp[(1) - (1)].interm.typeList); } break; - case 340: + case 350: /* Line 1792 of yacc.c */ -#line 2182 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2238 "glslang.y" { (yyval.interm.typeList) = (yyvsp[(1) - (2)].interm.typeList); for (unsigned int i = 0; i < (yyvsp[(2) - (2)].interm.typeList)->size(); ++i) { @@ -6836,9 +7022,9 @@ yyreduce: } break; - case 341: + case 351: /* Line 1792 of yacc.c */ -#line 2195 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2251 "glslang.y" { if ((yyvsp[(1) - (3)].interm.type).arraySizes) { parseContext.profileRequires((yyvsp[(1) - (3)].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); @@ -6859,9 +7045,9 @@ yyreduce: } break; - case 342: + case 352: /* Line 1792 of yacc.c */ -#line 2213 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2269 "glslang.y" { parseContext.globalQualifierFixCheck((yyvsp[(1) - (4)].interm.type).loc, (yyvsp[(1) - (4)].interm.type).qualifier); if ((yyvsp[(2) - (4)].interm.type).arraySizes) { @@ -6885,26 +7071,26 @@ yyreduce: } break; - case 343: + case 353: /* Line 1792 of yacc.c */ -#line 2237 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2293 "glslang.y" { (yyval.interm.typeList) = new TTypeList; (yyval.interm.typeList)->push_back((yyvsp[(1) - (1)].interm.typeLine)); } break; - case 344: + case 354: /* Line 1792 of yacc.c */ -#line 2241 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2297 "glslang.y" { (yyval.interm.typeList)->push_back((yyvsp[(3) - (3)].interm.typeLine)); } break; - case 345: + case 355: /* Line 1792 of yacc.c */ -#line 2247 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2303 "glslang.y" { (yyval.interm.typeLine).type = new TType(EbtVoid); (yyval.interm.typeLine).loc = (yyvsp[(1) - (1)].lex).loc; @@ -6912,9 +7098,9 @@ yyreduce: } break; - case 346: + case 356: /* Line 1792 of yacc.c */ -#line 2252 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2308 "glslang.y" { parseContext.arrayDimCheck((yyvsp[(1) - (2)].lex).loc, (yyvsp[(2) - (2)].interm).arraySizes, 0); @@ -6925,17 +7111,17 @@ yyreduce: } break; - case 347: + case 357: /* Line 1792 of yacc.c */ -#line 2263 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2319 "glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } break; - case 348: + case 358: /* Line 1792 of yacc.c */ -#line 2266 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2322 "glslang.y" { const char* initFeature = "{ } style initializers"; parseContext.requireProfile((yyvsp[(1) - (3)].lex).loc, ~EEsProfile, initFeature); @@ -6944,9 +7130,9 @@ yyreduce: } break; - case 349: + case 359: /* Line 1792 of yacc.c */ -#line 2272 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2328 "glslang.y" { const char* initFeature = "{ } style initializers"; parseContext.requireProfile((yyvsp[(1) - (4)].lex).loc, ~EEsProfile, initFeature); @@ -6955,109 +7141,109 @@ yyreduce: } break; - case 350: + case 360: /* Line 1792 of yacc.c */ -#line 2281 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2337 "glslang.y" { (yyval.interm.intermTypedNode) = parseContext.intermediate.growAggregate(0, (yyvsp[(1) - (1)].interm.intermTypedNode), (yyvsp[(1) - (1)].interm.intermTypedNode)->getLoc()); } break; - case 351: + case 361: /* Line 1792 of yacc.c */ -#line 2284 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2340 "glslang.y" { (yyval.interm.intermTypedNode) = parseContext.intermediate.growAggregate((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); } break; - case 352: -/* Line 1792 of yacc.c */ -#line 2290 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } - break; - - case 353: -/* Line 1792 of yacc.c */ -#line 2294 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } - break; - - case 354: -/* Line 1792 of yacc.c */ -#line 2295 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } - break; - - case 355: -/* Line 1792 of yacc.c */ -#line 2301 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } - break; - - case 356: -/* Line 1792 of yacc.c */ -#line 2302 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } - break; - - case 357: -/* Line 1792 of yacc.c */ -#line 2303 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } - break; - - case 358: -/* Line 1792 of yacc.c */ -#line 2304 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } - break; - - case 359: -/* Line 1792 of yacc.c */ -#line 2305 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } - break; - - case 360: -/* Line 1792 of yacc.c */ -#line 2306 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } - break; - - case 361: -/* Line 1792 of yacc.c */ -#line 2307 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } - break; - case 362: /* Line 1792 of yacc.c */ -#line 2311 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" - { (yyval.interm.intermNode) = 0; } +#line 2346 "glslang.y" + { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } break; case 363: /* Line 1792 of yacc.c */ -#line 2312 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2350 "glslang.y" + { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } + break; + + case 364: +/* Line 1792 of yacc.c */ +#line 2351 "glslang.y" + { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } + break; + + case 365: +/* Line 1792 of yacc.c */ +#line 2357 "glslang.y" + { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } + break; + + case 366: +/* Line 1792 of yacc.c */ +#line 2358 "glslang.y" + { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } + break; + + case 367: +/* Line 1792 of yacc.c */ +#line 2359 "glslang.y" + { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } + break; + + case 368: +/* Line 1792 of yacc.c */ +#line 2360 "glslang.y" + { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } + break; + + case 369: +/* Line 1792 of yacc.c */ +#line 2361 "glslang.y" + { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } + break; + + case 370: +/* Line 1792 of yacc.c */ +#line 2362 "glslang.y" + { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } + break; + + case 371: +/* Line 1792 of yacc.c */ +#line 2363 "glslang.y" + { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } + break; + + case 372: +/* Line 1792 of yacc.c */ +#line 2367 "glslang.y" + { (yyval.interm.intermNode) = 0; } + break; + + case 373: +/* Line 1792 of yacc.c */ +#line 2368 "glslang.y" { parseContext.symbolTable.push(); ++parseContext.statementNestingLevel; } break; - case 364: + case 374: /* Line 1792 of yacc.c */ -#line 2316 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2372 "glslang.y" { parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); --parseContext.statementNestingLevel; } break; - case 365: + case 375: /* Line 1792 of yacc.c */ -#line 2320 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2376 "glslang.y" { if ((yyvsp[(3) - (5)].interm.intermNode) && (yyvsp[(3) - (5)].interm.intermNode)->getAsAggregate()) (yyvsp[(3) - (5)].interm.intermNode)->getAsAggregate()->setOperator(EOpSequence); @@ -7065,38 +7251,38 @@ yyreduce: } break; - case 366: + case 376: /* Line 1792 of yacc.c */ -#line 2328 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2384 "glslang.y" { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } break; - case 367: + case 377: /* Line 1792 of yacc.c */ -#line 2329 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2385 "glslang.y" { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } break; - case 368: + case 378: /* Line 1792 of yacc.c */ -#line 2333 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2389 "glslang.y" { ++parseContext.controlFlowNestingLevel; } break; - case 369: + case 379: /* Line 1792 of yacc.c */ -#line 2336 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2392 "glslang.y" { --parseContext.controlFlowNestingLevel; (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); } break; - case 370: + case 380: /* Line 1792 of yacc.c */ -#line 2340 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2396 "glslang.y" { parseContext.symbolTable.push(); ++parseContext.statementNestingLevel; @@ -7104,9 +7290,9 @@ yyreduce: } break; - case 371: + case 381: /* Line 1792 of yacc.c */ -#line 2345 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2401 "glslang.y" { parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); --parseContext.statementNestingLevel; @@ -7115,17 +7301,17 @@ yyreduce: } break; - case 372: + case 382: /* Line 1792 of yacc.c */ -#line 2354 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2410 "glslang.y" { (yyval.interm.intermNode) = 0; } break; - case 373: + case 383: /* Line 1792 of yacc.c */ -#line 2357 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2413 "glslang.y" { if ((yyvsp[(2) - (3)].interm.intermNode) && (yyvsp[(2) - (3)].interm.intermNode)->getAsAggregate()) (yyvsp[(2) - (3)].interm.intermNode)->getAsAggregate()->setOperator(EOpSequence); @@ -7133,9 +7319,9 @@ yyreduce: } break; - case 374: + case 384: /* Line 1792 of yacc.c */ -#line 2365 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2421 "glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode)); if ((yyvsp[(1) - (1)].interm.intermNode) && (yyvsp[(1) - (1)].interm.intermNode)->getAsBranchNode() && ((yyvsp[(1) - (1)].interm.intermNode)->getAsBranchNode()->getFlowOp() == EOpCase || @@ -7146,9 +7332,9 @@ yyreduce: } break; - case 375: + case 385: /* Line 1792 of yacc.c */ -#line 2373 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2429 "glslang.y" { if ((yyvsp[(2) - (2)].interm.intermNode) && (yyvsp[(2) - (2)].interm.intermNode)->getAsBranchNode() && ((yyvsp[(2) - (2)].interm.intermNode)->getAsBranchNode()->getFlowOp() == EOpCase || (yyvsp[(2) - (2)].interm.intermNode)->getAsBranchNode()->getFlowOp() == EOpDefault)) { @@ -7159,57 +7345,57 @@ yyreduce: } break; - case 376: + case 386: /* Line 1792 of yacc.c */ -#line 2384 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2440 "glslang.y" { (yyval.interm.intermNode) = 0; } break; - case 377: + case 387: /* Line 1792 of yacc.c */ -#line 2385 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2441 "glslang.y" { (yyval.interm.intermNode) = static_cast((yyvsp[(1) - (2)].interm.intermTypedNode)); } break; - case 378: + case 388: /* Line 1792 of yacc.c */ -#line 2389 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2445 "glslang.y" { parseContext.boolCheck((yyvsp[(1) - (5)].lex).loc, (yyvsp[(3) - (5)].interm.intermTypedNode)); (yyval.interm.intermNode) = parseContext.intermediate.addSelection((yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.nodePair), (yyvsp[(1) - (5)].lex).loc); } break; - case 379: + case 389: /* Line 1792 of yacc.c */ -#line 2396 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2452 "glslang.y" { (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode); (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermNode); } break; - case 380: + case 390: /* Line 1792 of yacc.c */ -#line 2400 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2456 "glslang.y" { (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode); (yyval.interm.nodePair).node2 = 0; } break; - case 381: + case 391: /* Line 1792 of yacc.c */ -#line 2408 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2464 "glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); parseContext.boolCheck((yyvsp[(1) - (1)].interm.intermTypedNode)->getLoc(), (yyvsp[(1) - (1)].interm.intermTypedNode)); } break; - case 382: + case 392: /* Line 1792 of yacc.c */ -#line 2412 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2468 "glslang.y" { parseContext.boolCheck((yyvsp[(2) - (4)].lex).loc, (yyvsp[(1) - (4)].interm.type)); @@ -7222,9 +7408,9 @@ yyreduce: } break; - case 383: + case 393: /* Line 1792 of yacc.c */ -#line 2425 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2481 "glslang.y" { // start new switch sequence on the switch stack ++parseContext.controlFlowNestingLevel; @@ -7235,9 +7421,9 @@ yyreduce: } break; - case 384: + case 394: /* Line 1792 of yacc.c */ -#line 2433 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2489 "glslang.y" { (yyval.interm.intermNode) = parseContext.addSwitch((yyvsp[(1) - (8)].lex).loc, (yyvsp[(3) - (8)].interm.intermTypedNode), (yyvsp[(7) - (8)].interm.intermNode) ? (yyvsp[(7) - (8)].interm.intermNode)->getAsAggregate() : 0); delete parseContext.switchSequenceStack.back(); @@ -7249,25 +7435,25 @@ yyreduce: } break; - case 385: + case 395: /* Line 1792 of yacc.c */ -#line 2445 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2501 "glslang.y" { (yyval.interm.intermNode) = 0; } break; - case 386: + case 396: /* Line 1792 of yacc.c */ -#line 2448 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2504 "glslang.y" { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } break; - case 387: + case 397: /* Line 1792 of yacc.c */ -#line 2454 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2510 "glslang.y" { (yyval.interm.intermNode) = 0; if (parseContext.switchLevel.size() == 0) @@ -7282,9 +7468,9 @@ yyreduce: } break; - case 388: + case 398: /* Line 1792 of yacc.c */ -#line 2466 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2522 "glslang.y" { (yyval.interm.intermNode) = 0; if (parseContext.switchLevel.size() == 0) @@ -7296,9 +7482,9 @@ yyreduce: } break; - case 389: + case 399: /* Line 1792 of yacc.c */ -#line 2478 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2534 "glslang.y" { if (! parseContext.limits.whileLoops) parseContext.error((yyvsp[(1) - (2)].lex).loc, "while loops not available", "limitation", ""); @@ -7309,9 +7495,9 @@ yyreduce: } break; - case 390: + case 400: /* Line 1792 of yacc.c */ -#line 2486 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2542 "glslang.y" { parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); (yyval.interm.intermNode) = parseContext.intermediate.addLoop((yyvsp[(6) - (6)].interm.intermNode), (yyvsp[(4) - (6)].interm.intermTypedNode), 0, true, (yyvsp[(1) - (6)].lex).loc); @@ -7321,9 +7507,9 @@ yyreduce: } break; - case 391: + case 401: /* Line 1792 of yacc.c */ -#line 2493 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2549 "glslang.y" { ++parseContext.loopNestingLevel; ++parseContext.statementNestingLevel; @@ -7331,9 +7517,9 @@ yyreduce: } break; - case 392: + case 402: /* Line 1792 of yacc.c */ -#line 2498 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2554 "glslang.y" { if (! parseContext.limits.whileLoops) parseContext.error((yyvsp[(1) - (8)].lex).loc, "do-while loops not available", "limitation", ""); @@ -7347,9 +7533,9 @@ yyreduce: } break; - case 393: + case 403: /* Line 1792 of yacc.c */ -#line 2509 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2565 "glslang.y" { parseContext.symbolTable.push(); ++parseContext.loopNestingLevel; @@ -7358,9 +7544,9 @@ yyreduce: } break; - case 394: + case 404: /* Line 1792 of yacc.c */ -#line 2515 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2571 "glslang.y" { parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); (yyval.interm.intermNode) = parseContext.intermediate.makeAggregate((yyvsp[(4) - (7)].interm.intermNode), (yyvsp[(2) - (7)].lex).loc); @@ -7375,59 +7561,59 @@ yyreduce: } break; - case 395: + case 405: /* Line 1792 of yacc.c */ -#line 2530 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2586 "glslang.y" { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } break; - case 396: + case 406: /* Line 1792 of yacc.c */ -#line 2533 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2589 "glslang.y" { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } break; - case 397: + case 407: /* Line 1792 of yacc.c */ -#line 2539 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2595 "glslang.y" { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } break; - case 398: + case 408: /* Line 1792 of yacc.c */ -#line 2542 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2598 "glslang.y" { (yyval.interm.intermTypedNode) = 0; } break; - case 399: + case 409: /* Line 1792 of yacc.c */ -#line 2548 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2604 "glslang.y" { (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode); (yyval.interm.nodePair).node2 = 0; } break; - case 400: + case 410: /* Line 1792 of yacc.c */ -#line 2552 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2608 "glslang.y" { (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode); (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermTypedNode); } break; - case 401: + case 411: /* Line 1792 of yacc.c */ -#line 2559 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2615 "glslang.y" { if (parseContext.loopNestingLevel <= 0) parseContext.error((yyvsp[(1) - (2)].lex).loc, "continue statement only allowed in loops", "", ""); @@ -7435,9 +7621,9 @@ yyreduce: } break; - case 402: + case 412: /* Line 1792 of yacc.c */ -#line 2564 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2620 "glslang.y" { if (parseContext.loopNestingLevel + parseContext.switchSequenceStack.size() <= 0) parseContext.error((yyvsp[(1) - (2)].lex).loc, "break statement only allowed in switch and loops", "", ""); @@ -7445,9 +7631,9 @@ yyreduce: } break; - case 403: + case 413: /* Line 1792 of yacc.c */ -#line 2569 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2625 "glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpReturn, (yyvsp[(1) - (2)].lex).loc); if (parseContext.currentFunctionType->getBasicType() != EbtVoid) @@ -7457,9 +7643,9 @@ yyreduce: } break; - case 404: + case 414: /* Line 1792 of yacc.c */ -#line 2576 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2632 "glslang.y" { parseContext.functionReturnsValue = true; if (parseContext.currentFunctionType->getBasicType() == EbtVoid) { @@ -7480,61 +7666,61 @@ yyreduce: } break; - case 405: + case 415: /* Line 1792 of yacc.c */ -#line 2594 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2650 "glslang.y" { parseContext.requireStage((yyvsp[(1) - (2)].lex).loc, EShLangFragment, "discard"); (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpKill, (yyvsp[(1) - (2)].lex).loc); } break; - case 406: + case 416: /* Line 1792 of yacc.c */ -#line 2603 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2659 "glslang.y" { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); parseContext.intermediate.setTreeRoot((yyval.interm.intermNode)); } break; - case 407: + case 417: /* Line 1792 of yacc.c */ -#line 2607 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2663 "glslang.y" { (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode)); parseContext.intermediate.setTreeRoot((yyval.interm.intermNode)); } break; - case 408: + case 418: /* Line 1792 of yacc.c */ -#line 2614 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2670 "glslang.y" { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } break; - case 409: + case 419: /* Line 1792 of yacc.c */ -#line 2617 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2673 "glslang.y" { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } break; - case 410: + case 420: /* Line 1792 of yacc.c */ -#line 2623 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2679 "glslang.y" { (yyvsp[(1) - (1)].interm).function = parseContext.handleFunctionDeclarator((yyvsp[(1) - (1)].interm).loc, *(yyvsp[(1) - (1)].interm).function, false /* not prototype */); (yyvsp[(1) - (1)].interm).intermNode = parseContext.handleFunctionDefinition((yyvsp[(1) - (1)].interm).loc, *(yyvsp[(1) - (1)].interm).function); } break; - case 411: + case 421: /* Line 1792 of yacc.c */ -#line 2627 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2683 "glslang.y" { // May be best done as post process phase on intermediate code if (parseContext.currentFunctionType->getBasicType() != EbtVoid && ! parseContext.functionReturnsValue) @@ -7554,7 +7740,7 @@ yyreduce: /* Line 1792 of yacc.c */ -#line 7558 "C:/Projects/glslang/glslang/MachineIndependent/glslang_tab.cpp" +#line 7744 "glslang_tab.cpp" default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -7786,5 +7972,5 @@ yyreturn: /* Line 2055 of yacc.c */ -#line 2644 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 2700 "glslang.y" diff --git a/glslang/MachineIndependent/glslang_tab.cpp.h b/glslang/MachineIndependent/glslang_tab.cpp.h index 0c6ab3bc..03f5706b 100644 --- a/glslang/MachineIndependent/glslang_tab.cpp.h +++ b/glslang/MachineIndependent/glslang_tab.cpp.h @@ -30,8 +30,8 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ -#ifndef YY_YY_C_PROJECTS_GLSLANG_GLSLANG_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED -# define YY_YY_C_PROJECTS_GLSLANG_GLSLANG_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED +#ifndef YY_YY_GLSLANG_TAB_CPP_H_INCLUDED +# define YY_YY_GLSLANG_TAB_CPP_H_INCLUDED /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 1 @@ -54,255 +54,265 @@ extern int yydebug; DOUBLE = 263, INT = 264, UINT = 265, - BREAK = 266, - CONTINUE = 267, - DO = 268, - ELSE = 269, - FOR = 270, - IF = 271, - DISCARD = 272, - RETURN = 273, - SWITCH = 274, - CASE = 275, - DEFAULT = 276, - SUBROUTINE = 277, - BVEC2 = 278, - BVEC3 = 279, - BVEC4 = 280, - IVEC2 = 281, - IVEC3 = 282, - IVEC4 = 283, - UVEC2 = 284, - UVEC3 = 285, - UVEC4 = 286, - VEC2 = 287, - VEC3 = 288, - VEC4 = 289, - MAT2 = 290, - MAT3 = 291, - MAT4 = 292, - CENTROID = 293, - IN = 294, - OUT = 295, - INOUT = 296, - UNIFORM = 297, - PATCH = 298, - SAMPLE = 299, - BUFFER = 300, - SHARED = 301, - COHERENT = 302, - VOLATILE = 303, - RESTRICT = 304, - READONLY = 305, - WRITEONLY = 306, - DVEC2 = 307, - DVEC3 = 308, - DVEC4 = 309, - DMAT2 = 310, - DMAT3 = 311, - DMAT4 = 312, - NOPERSPECTIVE = 313, - FLAT = 314, - SMOOTH = 315, - LAYOUT = 316, - MAT2X2 = 317, - MAT2X3 = 318, - MAT2X4 = 319, - MAT3X2 = 320, - MAT3X3 = 321, - MAT3X4 = 322, - MAT4X2 = 323, - MAT4X3 = 324, - MAT4X4 = 325, - DMAT2X2 = 326, - DMAT2X3 = 327, - DMAT2X4 = 328, - DMAT3X2 = 329, - DMAT3X3 = 330, - DMAT3X4 = 331, - DMAT4X2 = 332, - DMAT4X3 = 333, - DMAT4X4 = 334, - ATOMIC_UINT = 335, - SAMPLER1D = 336, - SAMPLER2D = 337, - SAMPLER3D = 338, - SAMPLERCUBE = 339, - SAMPLER1DSHADOW = 340, - SAMPLER2DSHADOW = 341, - SAMPLERCUBESHADOW = 342, - SAMPLER1DARRAY = 343, - SAMPLER2DARRAY = 344, - SAMPLER1DARRAYSHADOW = 345, - SAMPLER2DARRAYSHADOW = 346, - ISAMPLER1D = 347, - ISAMPLER2D = 348, - ISAMPLER3D = 349, - ISAMPLERCUBE = 350, - ISAMPLER1DARRAY = 351, - ISAMPLER2DARRAY = 352, - USAMPLER1D = 353, - USAMPLER2D = 354, - USAMPLER3D = 355, - USAMPLERCUBE = 356, - USAMPLER1DARRAY = 357, - USAMPLER2DARRAY = 358, - SAMPLER2DRECT = 359, - SAMPLER2DRECTSHADOW = 360, - ISAMPLER2DRECT = 361, - USAMPLER2DRECT = 362, - SAMPLERBUFFER = 363, - ISAMPLERBUFFER = 364, - USAMPLERBUFFER = 365, - SAMPLERCUBEARRAY = 366, - SAMPLERCUBEARRAYSHADOW = 367, - ISAMPLERCUBEARRAY = 368, - USAMPLERCUBEARRAY = 369, - SAMPLER2DMS = 370, - ISAMPLER2DMS = 371, - USAMPLER2DMS = 372, - SAMPLER2DMSARRAY = 373, - ISAMPLER2DMSARRAY = 374, - USAMPLER2DMSARRAY = 375, - SAMPLEREXTERNALOES = 376, - SAMPLER = 377, - SAMPLERSHADOW = 378, - TEXTURE1D = 379, - TEXTURE2D = 380, - TEXTURE3D = 381, - TEXTURECUBE = 382, - TEXTURE1DARRAY = 383, - TEXTURE2DARRAY = 384, - ITEXTURE1D = 385, - ITEXTURE2D = 386, - ITEXTURE3D = 387, - ITEXTURECUBE = 388, - ITEXTURE1DARRAY = 389, - ITEXTURE2DARRAY = 390, - UTEXTURE1D = 391, - UTEXTURE2D = 392, - UTEXTURE3D = 393, - UTEXTURECUBE = 394, - UTEXTURE1DARRAY = 395, - UTEXTURE2DARRAY = 396, - TEXTURE2DRECT = 397, - ITEXTURE2DRECT = 398, - UTEXTURE2DRECT = 399, - TEXTUREBUFFER = 400, - ITEXTUREBUFFER = 401, - UTEXTUREBUFFER = 402, - TEXTURECUBEARRAY = 403, - ITEXTURECUBEARRAY = 404, - UTEXTURECUBEARRAY = 405, - TEXTURE2DMS = 406, - ITEXTURE2DMS = 407, - UTEXTURE2DMS = 408, - TEXTURE2DMSARRAY = 409, - ITEXTURE2DMSARRAY = 410, - UTEXTURE2DMSARRAY = 411, - SUBPASSINPUT = 412, - SUBPASSINPUTMS = 413, - ISUBPASSINPUT = 414, - ISUBPASSINPUTMS = 415, - USUBPASSINPUT = 416, - USUBPASSINPUTMS = 417, - IMAGE1D = 418, - IIMAGE1D = 419, - UIMAGE1D = 420, - IMAGE2D = 421, - IIMAGE2D = 422, - UIMAGE2D = 423, - IMAGE3D = 424, - IIMAGE3D = 425, - UIMAGE3D = 426, - IMAGE2DRECT = 427, - IIMAGE2DRECT = 428, - UIMAGE2DRECT = 429, - IMAGECUBE = 430, - IIMAGECUBE = 431, - UIMAGECUBE = 432, - IMAGEBUFFER = 433, - IIMAGEBUFFER = 434, - UIMAGEBUFFER = 435, - IMAGE1DARRAY = 436, - IIMAGE1DARRAY = 437, - UIMAGE1DARRAY = 438, - IMAGE2DARRAY = 439, - IIMAGE2DARRAY = 440, - UIMAGE2DARRAY = 441, - IMAGECUBEARRAY = 442, - IIMAGECUBEARRAY = 443, - UIMAGECUBEARRAY = 444, - IMAGE2DMS = 445, - IIMAGE2DMS = 446, - UIMAGE2DMS = 447, - IMAGE2DMSARRAY = 448, - IIMAGE2DMSARRAY = 449, - UIMAGE2DMSARRAY = 450, - STRUCT = 451, - VOID = 452, - WHILE = 453, - IDENTIFIER = 454, - TYPE_NAME = 455, - FLOATCONSTANT = 456, - DOUBLECONSTANT = 457, - INTCONSTANT = 458, - UINTCONSTANT = 459, - BOOLCONSTANT = 460, - LEFT_OP = 461, - RIGHT_OP = 462, - INC_OP = 463, - DEC_OP = 464, - LE_OP = 465, - GE_OP = 466, - EQ_OP = 467, - NE_OP = 468, - AND_OP = 469, - OR_OP = 470, - XOR_OP = 471, - MUL_ASSIGN = 472, - DIV_ASSIGN = 473, - ADD_ASSIGN = 474, - MOD_ASSIGN = 475, - LEFT_ASSIGN = 476, - RIGHT_ASSIGN = 477, - AND_ASSIGN = 478, - XOR_ASSIGN = 479, - OR_ASSIGN = 480, - SUB_ASSIGN = 481, - LEFT_PAREN = 482, - RIGHT_PAREN = 483, - LEFT_BRACKET = 484, - RIGHT_BRACKET = 485, - LEFT_BRACE = 486, - RIGHT_BRACE = 487, - DOT = 488, - COMMA = 489, - COLON = 490, - EQUAL = 491, - SEMICOLON = 492, - BANG = 493, - DASH = 494, - TILDE = 495, - PLUS = 496, - STAR = 497, - SLASH = 498, - PERCENT = 499, - LEFT_ANGLE = 500, - RIGHT_ANGLE = 501, - VERTICAL_BAR = 502, - CARET = 503, - AMPERSAND = 504, - QUESTION = 505, - INVARIANT = 506, - PRECISE = 507, - HIGH_PRECISION = 508, - MEDIUM_PRECISION = 509, - LOW_PRECISION = 510, - PRECISION = 511, - PACKED = 512, - RESOURCE = 513, - SUPERP = 514 + INT64_T = 266, + UINT64_T = 267, + BREAK = 268, + CONTINUE = 269, + DO = 270, + ELSE = 271, + FOR = 272, + IF = 273, + DISCARD = 274, + RETURN = 275, + SWITCH = 276, + CASE = 277, + DEFAULT = 278, + SUBROUTINE = 279, + BVEC2 = 280, + BVEC3 = 281, + BVEC4 = 282, + IVEC2 = 283, + IVEC3 = 284, + IVEC4 = 285, + I64VEC2 = 286, + I64VEC3 = 287, + I64VEC4 = 288, + UVEC2 = 289, + UVEC3 = 290, + UVEC4 = 291, + U64VEC2 = 292, + U64VEC3 = 293, + U64VEC4 = 294, + VEC2 = 295, + VEC3 = 296, + VEC4 = 297, + MAT2 = 298, + MAT3 = 299, + MAT4 = 300, + CENTROID = 301, + IN = 302, + OUT = 303, + INOUT = 304, + UNIFORM = 305, + PATCH = 306, + SAMPLE = 307, + BUFFER = 308, + SHARED = 309, + COHERENT = 310, + VOLATILE = 311, + RESTRICT = 312, + READONLY = 313, + WRITEONLY = 314, + DVEC2 = 315, + DVEC3 = 316, + DVEC4 = 317, + DMAT2 = 318, + DMAT3 = 319, + DMAT4 = 320, + NOPERSPECTIVE = 321, + FLAT = 322, + SMOOTH = 323, + LAYOUT = 324, + MAT2X2 = 325, + MAT2X3 = 326, + MAT2X4 = 327, + MAT3X2 = 328, + MAT3X3 = 329, + MAT3X4 = 330, + MAT4X2 = 331, + MAT4X3 = 332, + MAT4X4 = 333, + DMAT2X2 = 334, + DMAT2X3 = 335, + DMAT2X4 = 336, + DMAT3X2 = 337, + DMAT3X3 = 338, + DMAT3X4 = 339, + DMAT4X2 = 340, + DMAT4X3 = 341, + DMAT4X4 = 342, + ATOMIC_UINT = 343, + SAMPLER1D = 344, + SAMPLER2D = 345, + SAMPLER3D = 346, + SAMPLERCUBE = 347, + SAMPLER1DSHADOW = 348, + SAMPLER2DSHADOW = 349, + SAMPLERCUBESHADOW = 350, + SAMPLER1DARRAY = 351, + SAMPLER2DARRAY = 352, + SAMPLER1DARRAYSHADOW = 353, + SAMPLER2DARRAYSHADOW = 354, + ISAMPLER1D = 355, + ISAMPLER2D = 356, + ISAMPLER3D = 357, + ISAMPLERCUBE = 358, + ISAMPLER1DARRAY = 359, + ISAMPLER2DARRAY = 360, + USAMPLER1D = 361, + USAMPLER2D = 362, + USAMPLER3D = 363, + USAMPLERCUBE = 364, + USAMPLER1DARRAY = 365, + USAMPLER2DARRAY = 366, + SAMPLER2DRECT = 367, + SAMPLER2DRECTSHADOW = 368, + ISAMPLER2DRECT = 369, + USAMPLER2DRECT = 370, + SAMPLERBUFFER = 371, + ISAMPLERBUFFER = 372, + USAMPLERBUFFER = 373, + SAMPLERCUBEARRAY = 374, + SAMPLERCUBEARRAYSHADOW = 375, + ISAMPLERCUBEARRAY = 376, + USAMPLERCUBEARRAY = 377, + SAMPLER2DMS = 378, + ISAMPLER2DMS = 379, + USAMPLER2DMS = 380, + SAMPLER2DMSARRAY = 381, + ISAMPLER2DMSARRAY = 382, + USAMPLER2DMSARRAY = 383, + SAMPLEREXTERNALOES = 384, + SAMPLER = 385, + SAMPLERSHADOW = 386, + TEXTURE1D = 387, + TEXTURE2D = 388, + TEXTURE3D = 389, + TEXTURECUBE = 390, + TEXTURE1DARRAY = 391, + TEXTURE2DARRAY = 392, + ITEXTURE1D = 393, + ITEXTURE2D = 394, + ITEXTURE3D = 395, + ITEXTURECUBE = 396, + ITEXTURE1DARRAY = 397, + ITEXTURE2DARRAY = 398, + UTEXTURE1D = 399, + UTEXTURE2D = 400, + UTEXTURE3D = 401, + UTEXTURECUBE = 402, + UTEXTURE1DARRAY = 403, + UTEXTURE2DARRAY = 404, + TEXTURE2DRECT = 405, + ITEXTURE2DRECT = 406, + UTEXTURE2DRECT = 407, + TEXTUREBUFFER = 408, + ITEXTUREBUFFER = 409, + UTEXTUREBUFFER = 410, + TEXTURECUBEARRAY = 411, + ITEXTURECUBEARRAY = 412, + UTEXTURECUBEARRAY = 413, + TEXTURE2DMS = 414, + ITEXTURE2DMS = 415, + UTEXTURE2DMS = 416, + TEXTURE2DMSARRAY = 417, + ITEXTURE2DMSARRAY = 418, + UTEXTURE2DMSARRAY = 419, + SUBPASSINPUT = 420, + SUBPASSINPUTMS = 421, + ISUBPASSINPUT = 422, + ISUBPASSINPUTMS = 423, + USUBPASSINPUT = 424, + USUBPASSINPUTMS = 425, + IMAGE1D = 426, + IIMAGE1D = 427, + UIMAGE1D = 428, + IMAGE2D = 429, + IIMAGE2D = 430, + UIMAGE2D = 431, + IMAGE3D = 432, + IIMAGE3D = 433, + UIMAGE3D = 434, + IMAGE2DRECT = 435, + IIMAGE2DRECT = 436, + UIMAGE2DRECT = 437, + IMAGECUBE = 438, + IIMAGECUBE = 439, + UIMAGECUBE = 440, + IMAGEBUFFER = 441, + IIMAGEBUFFER = 442, + UIMAGEBUFFER = 443, + IMAGE1DARRAY = 444, + IIMAGE1DARRAY = 445, + UIMAGE1DARRAY = 446, + IMAGE2DARRAY = 447, + IIMAGE2DARRAY = 448, + UIMAGE2DARRAY = 449, + IMAGECUBEARRAY = 450, + IIMAGECUBEARRAY = 451, + UIMAGECUBEARRAY = 452, + IMAGE2DMS = 453, + IIMAGE2DMS = 454, + UIMAGE2DMS = 455, + IMAGE2DMSARRAY = 456, + IIMAGE2DMSARRAY = 457, + UIMAGE2DMSARRAY = 458, + STRUCT = 459, + VOID = 460, + WHILE = 461, + IDENTIFIER = 462, + TYPE_NAME = 463, + FLOATCONSTANT = 464, + DOUBLECONSTANT = 465, + INTCONSTANT = 466, + UINTCONSTANT = 467, + INT64CONSTANT = 468, + UINT64CONSTANT = 469, + BOOLCONSTANT = 470, + LEFT_OP = 471, + RIGHT_OP = 472, + INC_OP = 473, + DEC_OP = 474, + LE_OP = 475, + GE_OP = 476, + EQ_OP = 477, + NE_OP = 478, + AND_OP = 479, + OR_OP = 480, + XOR_OP = 481, + MUL_ASSIGN = 482, + DIV_ASSIGN = 483, + ADD_ASSIGN = 484, + MOD_ASSIGN = 485, + LEFT_ASSIGN = 486, + RIGHT_ASSIGN = 487, + AND_ASSIGN = 488, + XOR_ASSIGN = 489, + OR_ASSIGN = 490, + SUB_ASSIGN = 491, + LEFT_PAREN = 492, + RIGHT_PAREN = 493, + LEFT_BRACKET = 494, + RIGHT_BRACKET = 495, + LEFT_BRACE = 496, + RIGHT_BRACE = 497, + DOT = 498, + COMMA = 499, + COLON = 500, + EQUAL = 501, + SEMICOLON = 502, + BANG = 503, + DASH = 504, + TILDE = 505, + PLUS = 506, + STAR = 507, + SLASH = 508, + PERCENT = 509, + LEFT_ANGLE = 510, + RIGHT_ANGLE = 511, + VERTICAL_BAR = 512, + CARET = 513, + AMPERSAND = 514, + QUESTION = 515, + INVARIANT = 516, + PRECISE = 517, + HIGH_PRECISION = 518, + MEDIUM_PRECISION = 519, + LOW_PRECISION = 520, + PRECISION = 521, + PACKED = 522, + RESOURCE = 523, + SUPERP = 524 }; #endif @@ -311,7 +321,7 @@ extern int yydebug; typedef union YYSTYPE { /* Line 2058 of yacc.c */ -#line 66 "C:/Projects/glslang/glslang/MachineIndependent/glslang.y" +#line 66 "glslang.y" struct { glslang::TSourceLoc loc; @@ -319,6 +329,8 @@ typedef union YYSTYPE glslang::TString *string; int i; unsigned int u; + long long i64; + unsigned long long u64; bool b; double d; }; @@ -345,7 +357,7 @@ typedef union YYSTYPE /* Line 2058 of yacc.c */ -#line 349 "C:/Projects/glslang/glslang/MachineIndependent/glslang_tab.cpp.h" +#line 361 "glslang_tab.cpp.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -367,4 +379,4 @@ int yyparse (); #endif #endif /* ! YYPARSE_PARAM */ -#endif /* !YY_YY_C_PROJECTS_GLSLANG_GLSLANG_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED */ +#endif /* !YY_YY_GLSLANG_TAB_CPP_H_INCLUDED */ diff --git a/glslang/MachineIndependent/intermOut.cpp b/glslang/MachineIndependent/intermOut.cpp index eb6c30cd..82e71600 100644 --- a/glslang/MachineIndependent/intermOut.cpp +++ b/glslang/MachineIndependent/intermOut.cpp @@ -206,22 +206,44 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node) case EOpConvUintToBool: out.debug << "Convert uint to bool"; break; case EOpConvFloatToBool: out.debug << "Convert float to bool"; break; case EOpConvDoubleToBool: out.debug << "Convert double to bool"; break; + case EOpConvInt64ToBool: out.debug << "Convert int64 to bool"; break; + case EOpConvUint64ToBool: out.debug << "Convert uint64 to bool"; break; case EOpConvIntToFloat: out.debug << "Convert int to float"; break; case EOpConvUintToFloat: out.debug << "Convert uint to float"; break; case EOpConvDoubleToFloat: out.debug << "Convert double to float"; break; + case EOpConvInt64ToFloat: out.debug << "Convert int64 to float"; break; + case EOpConvUint64ToFloat: out.debug << "Convert uint64 to float"; break; case EOpConvBoolToFloat: out.debug << "Convert bool to float"; break; case EOpConvUintToInt: out.debug << "Convert uint to int"; break; case EOpConvFloatToInt: out.debug << "Convert float to int"; break; case EOpConvDoubleToInt: out.debug << "Convert double to int"; break; case EOpConvBoolToInt: out.debug << "Convert bool to int"; break; + case EOpConvInt64ToInt: out.debug << "Convert int64 to int"; break; + case EOpConvUint64ToInt: out.debug << "Convert uint64 to int"; break; case EOpConvIntToUint: out.debug << "Convert int to uint"; break; case EOpConvFloatToUint: out.debug << "Convert float to uint"; break; case EOpConvDoubleToUint: out.debug << "Convert double to uint"; break; case EOpConvBoolToUint: out.debug << "Convert bool to uint"; break; + case EOpConvInt64ToUint: out.debug << "Convert int64 to uint"; break; + case EOpConvUint64ToUint: out.debug << "Convert uint64 to uint"; break; case EOpConvIntToDouble: out.debug << "Convert int to double"; break; case EOpConvUintToDouble: out.debug << "Convert uint to double"; break; case EOpConvFloatToDouble: out.debug << "Convert float to double"; break; case EOpConvBoolToDouble: out.debug << "Convert bool to double"; break; + case EOpConvInt64ToDouble: out.debug << "Convert int64 to double"; break; + case EOpConvUint64ToDouble: out.debug << "Convert uint64 to double"; break; + case EOpConvBoolToInt64: out.debug << "Convert bool to int64"; break; + case EOpConvIntToInt64: out.debug << "Convert int to int64"; break; + case EOpConvUintToInt64: out.debug << "Convert uint to int64"; break; + case EOpConvFloatToInt64: out.debug << "Convert float to int64"; break; + case EOpConvDoubleToInt64: out.debug << "Convert double to int64"; break; + case EOpConvUint64ToInt64: out.debug << "Convert uint64 to int64"; break; + case EOpConvBoolToUint64: out.debug << "Convert bool to uint64"; break; + case EOpConvIntToUint64: out.debug << "Convert int to uint64"; break; + case EOpConvUintToUint64: out.debug << "Convert uint to uint64"; break; + case EOpConvFloatToUint64: out.debug << "Convert float to uint64"; break; + case EOpConvDoubleToUint64: out.debug << "Convert double to uint64"; break; + case EOpConvInt64ToUint64: out.debug << "Convert uint64 to uint64"; break; case EOpRadians: out.debug << "radians"; break; case EOpDegrees: out.debug << "degrees"; break; @@ -261,6 +283,10 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node) case EOpFloatBitsToUint:out.debug << "floatBitsToUint"; break; case EOpIntBitsToFloat: out.debug << "intBitsToFloat"; break; case EOpUintBitsToFloat:out.debug << "uintBitsToFloat"; break; + case EOpDoubleBitsToInt64: out.debug << "doubleBitsToInt64"; break; + case EOpDoubleBitsToUint64: out.debug << "doubleBitsToUint64"; break; + case EOpInt64BitsToDouble: out.debug << "int64BitsToDouble"; break; + case EOpUint64BitsToDouble: out.debug << "uint64BitsToDouble"; break; case EOpPackSnorm2x16: out.debug << "packSnorm2x16"; break; case EOpUnpackSnorm2x16:out.debug << "unpackSnorm2x16"; break; case EOpPackUnorm2x16: out.debug << "packUnorm2x16"; break; @@ -275,6 +301,11 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node) case EOpPackDouble2x32: out.debug << "PackDouble2x32"; break; case EOpUnpackDouble2x32: out.debug << "UnpackDouble2x32"; break; + case EOpPackInt2x32: out.debug << "packInt2x32"; break; + case EOpUnpackInt2x32: out.debug << "unpackInt2x32"; break; + case EOpPackUint2x32: out.debug << "packUint2x32"; break; + case EOpUnpackUint2x32: out.debug << "unpackUint2x32"; break; + case EOpLength: out.debug << "length"; break; case EOpNormalize: out.debug << "normalize"; break; case EOpDPdx: out.debug << "dPdx"; break; @@ -366,6 +397,14 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node case EOpConstructUVec2: out.debug << "Construct uvec2"; break; case EOpConstructUVec3: out.debug << "Construct uvec3"; break; case EOpConstructUVec4: out.debug << "Construct uvec4"; break; + case EOpConstructInt64: out.debug << "Construct int64_t"; break; + case EOpConstructI64Vec2: out.debug << "Construct i64vec2"; break; + case EOpConstructI64Vec3: out.debug << "Construct i64vec3"; break; + case EOpConstructI64Vec4: out.debug << "Construct i64vec4"; break; + case EOpConstructUint64: out.debug << "Construct uint64_t"; break; + case EOpConstructU64Vec2: out.debug << "Construct u64vec2"; break; + case EOpConstructU64Vec3: out.debug << "Construct u64vec3"; break; + case EOpConstructU64Vec4: out.debug << "Construct u64vec4"; break; case EOpConstructMat2x2: out.debug << "Construct mat2"; break; case EOpConstructMat2x3: out.debug << "Construct mat2x3"; break; case EOpConstructMat2x4: out.debug << "Construct mat2x4"; break; @@ -582,6 +621,24 @@ static void OutputConstantUnion(TInfoSink& out, const TIntermTyped* node, const out.debug << buf << "\n"; } break; + case EbtInt64: + { + const int maxSize = 300; + char buf[maxSize]; + snprintf(buf, maxSize, "%lld (%s)", constUnion[i].getI64Const(), "const int64_t"); + + out.debug << buf << "\n"; + } + break; + case EbtUint64: + { + const int maxSize = 300; + char buf[maxSize]; + snprintf(buf, maxSize, "%llu (%s)", constUnion[i].getU64Const(), "const uint64_t"); + + out.debug << buf << "\n"; + } + break; default: out.info.message(EPrefixInternalError, "Unknown constant", node->getLoc()); break; diff --git a/glslang/MachineIndependent/linkValidate.cpp b/glslang/MachineIndependent/linkValidate.cpp index ef9daa87..f82ca21b 100644 --- a/glslang/MachineIndependent/linkValidate.cpp +++ b/glslang/MachineIndependent/linkValidate.cpp @@ -880,6 +880,8 @@ const int baseAlignmentVec4Std140 = 16; int TIntermediate::getBaseAlignmentScalar(const TType& type, int& size) { switch (type.getBasicType()) { + case EbtInt64: + case EbtUint64: case EbtDouble: size = 8; return 8; default: size = 4; return 4; } diff --git a/glslang/MachineIndependent/localintermediate.h b/glslang/MachineIndependent/localintermediate.h index c2d0c74a..17b7d21c 100644 --- a/glslang/MachineIndependent/localintermediate.h +++ b/glslang/MachineIndependent/localintermediate.h @@ -191,6 +191,8 @@ public: TIntermConstantUnion* addConstantUnion(const TConstUnionArray&, const TType&, const TSourceLoc&, bool literal = false) const; TIntermConstantUnion* addConstantUnion(int, const TSourceLoc&, bool literal = false) const; TIntermConstantUnion* addConstantUnion(unsigned int, const TSourceLoc&, bool literal = false) const; + TIntermConstantUnion* addConstantUnion(long long, const TSourceLoc&, bool literal = false) const; + TIntermConstantUnion* addConstantUnion(unsigned long long, const TSourceLoc&, bool literal = false) const; TIntermConstantUnion* addConstantUnion(bool, const TSourceLoc&, bool literal = false) const; TIntermConstantUnion* addConstantUnion(double, TBasicType, const TSourceLoc&, bool literal = false) const; TIntermTyped* promoteConstantUnion(TBasicType, TIntermConstantUnion*) const; diff --git a/glslang/MachineIndependent/parseVersions.h b/glslang/MachineIndependent/parseVersions.h index c9dfdc91..13d76805 100755 --- a/glslang/MachineIndependent/parseVersions.h +++ b/glslang/MachineIndependent/parseVersions.h @@ -76,6 +76,7 @@ public: virtual void updateExtensionBehavior(int line, const char* const extension, const char* behavior); virtual void fullIntegerCheck(const TSourceLoc&, const char* op); virtual void doubleCheck(const TSourceLoc&, const char* op); + virtual void int64Check(const TSourceLoc&, const char* op, bool builtIn = false); virtual void spvRemoved(const TSourceLoc&, const char* op); virtual void vulkanRemoved(const TSourceLoc&, const char* op); virtual void requireVulkan(const TSourceLoc&, const char* op); diff --git a/glslang/MachineIndependent/preprocessor/Pp.cpp b/glslang/MachineIndependent/preprocessor/Pp.cpp index b9d00c8e..35097588 100644 --- a/glslang/MachineIndependent/preprocessor/Pp.cpp +++ b/glslang/MachineIndependent/preprocessor/Pp.cpp @@ -705,7 +705,8 @@ int TPpContext::CPPerror(TPpToken* ppToken) TSourceLoc loc = ppToken->loc; while (token != '\n' && token != EndOfInput) { - if (token == PpAtomConstInt || token == PpAtomConstUint || + if (token == PpAtomConstInt || token == PpAtomConstUint || + token == PpAtomConstInt64 || token == PpAtomConstUint64 || token == PpAtomConstFloat || token == PpAtomConstDouble) { message.append(ppToken->name); } else if (token == PpAtomIdentifier || token == PpAtomConstString) { @@ -736,6 +737,8 @@ int TPpContext::CPPpragma(TPpToken* ppToken) case PpAtomIdentifier: case PpAtomConstInt: case PpAtomConstUint: + case PpAtomConstInt64: + case PpAtomConstUint64: case PpAtomConstFloat: case PpAtomConstDouble: tokens.push_back(ppToken->name); diff --git a/glslang/MachineIndependent/preprocessor/PpContext.h b/glslang/MachineIndependent/preprocessor/PpContext.h index f65eb603..4e47fa05 100644 --- a/glslang/MachineIndependent/preprocessor/PpContext.h +++ b/glslang/MachineIndependent/preprocessor/PpContext.h @@ -111,6 +111,7 @@ public: bool space; // true if a space (for white space or a removed comment) should also be recognized, in front of the token returned int ival; double dval; + long long i64val; int atom; char name[MaxTokenLength + 1]; }; diff --git a/glslang/MachineIndependent/preprocessor/PpScanner.cpp b/glslang/MachineIndependent/preprocessor/PpScanner.cpp index 719365d4..b3d1af6d 100644 --- a/glslang/MachineIndependent/preprocessor/PpScanner.cpp +++ b/glslang/MachineIndependent/preprocessor/PpScanner.cpp @@ -238,9 +238,11 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) int len = 0; int ch = 0; int ii = 0; - unsigned ival = 0; + unsigned long long ival = 0; + bool enableInt64 = pp->parseContext.version >= 450 && pp->parseContext.extensionTurnedOn(E_GL_ARB_gpu_shader_int64); ppToken->ival = 0; + ppToken->i64val = 0; ppToken->space = false; ch = getch(); for (;;) { @@ -299,6 +301,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) // must be hexidecimal bool isUnsigned = false; + bool isInt64 = false; ppToken->name[len++] = (char)ch; ch = getch(); if ((ch >= '0' && ch <= '9') || @@ -307,7 +310,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) ival = 0; do { - if (ival <= 0x0fffffff) { + if (ival <= 0x0fffffff || (enableInt64 && ival <= 0x0fffffffffffffffull)) { ppToken->name[len++] = (char)ch; if (ch >= '0' && ch <= '9') { ii = ch - '0'; @@ -323,7 +326,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) pp->parseContext.ppError(ppToken->loc, "hexidecimal literal too big", "", ""); AlreadyComplained = 1; } - ival = 0xffffffff; + ival = 0xffffffffffffffffull; } ch = getch(); } while ((ch >= '0' && ch <= '9') || @@ -336,19 +339,37 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) if (len < MaxTokenLength) ppToken->name[len++] = (char)ch; isUnsigned = true; + + if (enableInt64) { + int nextCh = getch(); + if ((ch == 'u' && nextCh == 'l') || (ch == 'U' && nextCh == 'L')) { + if (len < MaxTokenLength) + ppToken->name[len++] = (char)nextCh; + isInt64 = true; + } else + ungetch(); + } + } + else if (enableInt64 && (ch == 'l' || ch == 'L')) { + if (len < MaxTokenLength) + ppToken->name[len++] = (char)ch; + isInt64 = true; } else ungetch(); ppToken->name[len] = '\0'; - ppToken->ival = (int)ival; - if (isUnsigned) - return PpAtomConstUint; - else - return PpAtomConstInt; + if (isInt64) { + ppToken->i64val = ival; + return isUnsigned ? PpAtomConstUint64 : PpAtomConstInt64; + } else { + ppToken->ival = (int)ival; + return isUnsigned ? PpAtomConstUint : PpAtomConstInt; + } } else { // could be octal integer or floating point, speculative pursue octal until it must be floating point bool isUnsigned = false; + bool isInt64 = false; bool octalOverflow = false; bool nonOctal = false; ival = 0; @@ -361,7 +382,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) pp->parseContext.ppError(ppToken->loc, "numeric literal too long", "", ""); AlreadyComplained = 1; } - if (ival <= 0x1fffffff) { + if (ival <= 0x1fffffff || (enableInt64 && ival <= 0x1fffffffffffffffull)) { ii = ch - '0'; ival = (ival << 3) | ii; } else @@ -382,7 +403,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) ch = getch(); } while (ch >= '0' && ch <= '9'); } - if (ch == '.' || ch == 'e' || ch == 'f' || ch == 'E' || ch == 'F' || ch == 'l' || ch == 'L') + if (ch == '.' || ch == 'e' || ch == 'f' || ch == 'E' || ch == 'F') return pp->lFloatConst(len, ch, ppToken); // wasn't a float, so must be octal... @@ -393,6 +414,21 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) if (len < MaxTokenLength) ppToken->name[len++] = (char)ch; isUnsigned = true; + + if (enableInt64) { + int nextCh = getch(); + if ((ch == 'u' && nextCh == 'l') || (ch == 'U' && nextCh == 'L')) { + if (len < MaxTokenLength) + ppToken->name[len++] = (char)nextCh; + isInt64 = true; + } else + ungetch(); + } + } + else if (enableInt64 && (ch == 'l' || ch == 'L')) { + if (len < MaxTokenLength) + ppToken->name[len++] = (char)ch; + isInt64 = true; } else ungetch(); ppToken->name[len] = '\0'; @@ -400,12 +436,13 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) if (octalOverflow) pp->parseContext.ppError(ppToken->loc, "octal literal too big", "", ""); - ppToken->ival = (int)ival; - - if (isUnsigned) - return PpAtomConstUint; - else - return PpAtomConstInt; + if (isInt64) { + ppToken->i64val = ival; + return isUnsigned ? PpAtomConstUint64 : PpAtomConstInt64; + } else { + ppToken->ival = (int)ival; + return isUnsigned ? PpAtomConstUint : PpAtomConstInt; + } } break; case '1': case '2': case '3': case '4': @@ -421,16 +458,31 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) } ch = getch(); } while (ch >= '0' && ch <= '9'); - if (ch == '.' || ch == 'e' || ch == 'f' || ch == 'E' || ch == 'F' || ch == 'l' || ch == 'L') { + if (ch == '.' || ch == 'e' || ch == 'f' || ch == 'E' || ch == 'F') { return pp->lFloatConst(len, ch, ppToken); } else { // Finish handling signed and unsigned integers int numericLen = len; - bool uint = false; + bool isUnsigned = false; + bool isInt64 = false; if (ch == 'u' || ch == 'U') { if (len < MaxTokenLength) ppToken->name[len++] = (char)ch; - uint = true; + isUnsigned = true; + + if (enableInt64) { + int nextCh = getch(); + if ((ch == 'u' && nextCh == 'l') || (ch == 'U' && nextCh == 'L')) { + if (len < MaxTokenLength) + ppToken->name[len++] = (char)nextCh; + isInt64 = true; + } else + ungetch(); + } + } else if (enableInt64 && (ch == 'l' || ch == 'L')) { + if (len < MaxTokenLength) + ppToken->name[len++] = (char)ch; + isInt64 = true; } else ungetch(); @@ -438,21 +490,26 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) ival = 0; const unsigned oneTenthMaxInt = 0xFFFFFFFFu / 10; const unsigned remainderMaxInt = 0xFFFFFFFFu - 10 * oneTenthMaxInt; + const unsigned long long oneTenthMaxInt64 = 0xFFFFFFFFFFFFFFFFull / 10; + const unsigned long long remainderMaxInt64 = 0xFFFFFFFFFFFFFFFFull - 10 * oneTenthMaxInt64; for (int i = 0; i < numericLen; i++) { ch = ppToken->name[i] - '0'; - if ((ival > oneTenthMaxInt) || (ival == oneTenthMaxInt && (unsigned)ch > remainderMaxInt)) { + if ((enableInt64 == false && ((ival > oneTenthMaxInt) || (ival == oneTenthMaxInt && (unsigned)ch > remainderMaxInt))) || + (enableInt64 && ((ival > oneTenthMaxInt64) || (ival == oneTenthMaxInt64 && (unsigned long long)ch > remainderMaxInt64)))) { pp->parseContext.ppError(ppToken->loc, "numeric literal too big", "", ""); - ival = 0xFFFFFFFFu; + ival = 0xFFFFFFFFFFFFFFFFull; break; } else ival = ival * 10 + ch; } - ppToken->ival = (int)ival; - if (uint) - return PpAtomConstUint; - else - return PpAtomConstInt; + if (isInt64) { + ppToken->i64val = ival; + return isUnsigned ? PpAtomConstUint64 : PpAtomConstInt64; + } else { + ppToken->ival = (int)ival; + return isUnsigned ? PpAtomConstUint : PpAtomConstInt; + } } break; case '-': @@ -686,6 +743,8 @@ const char* TPpContext::tokenize(TPpToken* ppToken) case PpAtomConstInt: case PpAtomConstUint: case PpAtomConstFloat: + case PpAtomConstInt64: + case PpAtomConstUint64: case PpAtomConstDouble: tokenString = ppToken->name; break; diff --git a/glslang/MachineIndependent/preprocessor/PpTokens.cpp b/glslang/MachineIndependent/preprocessor/PpTokens.cpp index 52343b7c..95da3dbd 100644 --- a/glslang/MachineIndependent/preprocessor/PpTokens.cpp +++ b/glslang/MachineIndependent/preprocessor/PpTokens.cpp @@ -141,6 +141,8 @@ void TPpContext::RecordToken(TokenStream *pTok, int token, TPpToken* ppToken) break; case PpAtomConstInt: case PpAtomConstUint: + case PpAtomConstInt64: + case PpAtomConstUint64: case PpAtomConstFloat: case PpAtomConstDouble: str = ppToken->name; @@ -193,6 +195,8 @@ int TPpContext::ReadToken(TokenStream *pTok, TPpToken *ppToken) case PpAtomConstDouble: case PpAtomConstInt: case PpAtomConstUint: + case PpAtomConstInt64: + case PpAtomConstUint64: len = 0; ch = lReadByte(pTok); while (ch != 0 && ch != EndOfInput) { @@ -227,6 +231,16 @@ int TPpContext::ReadToken(TokenStream *pTok, TPpToken *ppToken) } else ppToken->ival = atoi(ppToken->name); break; + case PpAtomConstInt64: + case PpAtomConstUint64: + if (len > 0 && tokenText[0] == '0') { + if (len > 1 && (tokenText[1] == 'x' || tokenText[1] == 'X')) + ppToken->i64val = std::stoll(ppToken->name, 0, 16); + else + ppToken->i64val = std::stoll(ppToken->name, 0, 8); + } else + ppToken->i64val = std::stoll(ppToken->name); + break; } } diff --git a/glslang/MachineIndependent/preprocessor/PpTokens.h b/glslang/MachineIndependent/preprocessor/PpTokens.h index 391b04ad..87f0eb1a 100644 --- a/glslang/MachineIndependent/preprocessor/PpTokens.h +++ b/glslang/MachineIndependent/preprocessor/PpTokens.h @@ -119,6 +119,8 @@ enum EFixedAtoms { PpAtomConstInt, PpAtomConstUint, + PpAtomConstInt64, + PpAtomConstUint64, PpAtomConstFloat, PpAtomConstDouble, PpAtomConstString, diff --git a/glslang/MachineIndependent/reflection.cpp b/glslang/MachineIndependent/reflection.cpp index 9ef6d02f..19e08e16 100644 --- a/glslang/MachineIndependent/reflection.cpp +++ b/glslang/MachineIndependent/reflection.cpp @@ -540,6 +540,8 @@ public: case EbtDouble: return GL_DOUBLE_VEC2 + offset; case EbtInt: return GL_INT_VEC2 + offset; case EbtUint: return GL_UNSIGNED_INT_VEC2 + offset; + case EbtInt64: return GL_INT64_ARB + offset; + case EbtUint64: return GL_UNSIGNED_INT64_ARB + offset; case EbtBool: return GL_BOOL_VEC2 + offset; case EbtAtomicUint: return GL_UNSIGNED_INT_ATOMIC_COUNTER + offset; default: return 0; @@ -605,6 +607,8 @@ public: case EbtDouble: return GL_DOUBLE; case EbtInt: return GL_INT; case EbtUint: return GL_UNSIGNED_INT; + case EbtInt64: return GL_INT64_ARB; + case EbtUint64: return GL_UNSIGNED_INT64_ARB; case EbtBool: return GL_BOOL; case EbtAtomicUint: return GL_UNSIGNED_INT_ATOMIC_COUNTER; default: return 0; diff --git a/gtests/Spv.FromFile.cpp b/gtests/Spv.FromFile.cpp index 9cd0787a..e5040b22 100644 --- a/gtests/Spv.FromFile.cpp +++ b/gtests/Spv.FromFile.cpp @@ -119,6 +119,7 @@ INSTANTIATE_TEST_CASE_P( "spv.functionCall.frag", "spv.functionSemantics.frag", "spv.interpOps.frag", + "spv.int64.frag", "spv.layoutNested.vert", "spv.length.frag", "spv.localAggregates.frag", From f67f91254bc22931b5c75d043de323c73b01cb68 Mon Sep 17 00:00:00 2001 From: David Yen Date: Mon, 2 May 2016 13:03:31 -0700 Subject: [PATCH 041/140] Removed unused files SetupLinux.sh, index.php. --- SetupLinux.sh | 47 -------------------- index.php | 119 -------------------------------------------------- 2 files changed, 166 deletions(-) delete mode 100755 SetupLinux.sh delete mode 100644 index.php diff --git a/SetupLinux.sh b/SetupLinux.sh deleted file mode 100755 index b0c39793..00000000 --- a/SetupLinux.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash -# Copyright (C) 2014-2015 LunarG, 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. - -# -# Author: John Kessenich, LunarG -# - -rm -rf build -mkdir build -pushd build -cmake .. -cmake .. -make -j 2 -make install -install/bin/glslangValidator -i ../Test/sample.vert ../Test/sample.frag -popd diff --git a/index.php b/index.php deleted file mode 100644 index df13df3e..00000000 --- a/index.php +++ /dev/null @@ -1,119 +0,0 @@ - - - - - GLSL Reference Parser - - - - -

- [About] - - - -

-

About GLSL Reference Parser

-

- The GLSL Reference Parser provides a front end for parsing and - operating on OpenGL Shading Language code. It was originally - developed by 3Dlabs and is being maintained and updated by LunarG. The README has some additional information. -

- -

- You can download the source from the - Khronos public-access Subversion server . For example, using the Subversion - command-line client: -

- -

- svn checkout --username anonymous --password anonymous - https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang/ glslang -

- -
- -

Requirements

-

TBD. Builds on Windows and Linux.

- - -
- - -
-

- Get BuGLe at SourceForge.net. Fast, secure and Free Open Source software downloads - - - From af459216a18a08c2e3eec880329c3a7a1244ddeb Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Tue, 3 May 2016 19:34:00 -0600 Subject: [PATCH 042/140] Correct precision qualification on built-in functions. This is a replacement commit for pull request #238. This is a design change, followed by implementation change that A) fixes the changes caused by the design change, and B) fixes some cases that were originally incorrect. The design change is to not give built-in functions default precision qualification. This is to allow the rule that the precision of some built-in functions adopt their precision qualification from the calling arguments. This is A above. A consequence of this design change is that all built-ins that are supposed to have an explicit precision qualifier must now be declared that way. So, a lot more built-in declarations now have precision qualifiers, just to keep things the same. This is B above. --- Test/baseResults/100scope.vert.out | 4 +- Test/baseResults/300.frag.out | 28 +-- Test/baseResults/300.vert.out | 12 +- Test/baseResults/300block.frag.out | 20 +- Test/baseResults/300scope.vert.out | 4 +- Test/baseResults/310.frag.out | 216 ++++++++++----------- Test/baseResults/310.vert.out | 8 +- Test/baseResults/precision.vert.out | 8 +- Test/baseResults/spv.intOps.vert.out | 2 + Test/baseResults/uint.frag.out | 12 +- glslang/MachineIndependent/Initialize.cpp | 68 +++---- glslang/MachineIndependent/ParseHelper.cpp | 28 +-- glslang/MachineIndependent/ParseHelper.h | 2 +- 13 files changed, 213 insertions(+), 199 deletions(-) diff --git a/Test/baseResults/100scope.vert.out b/Test/baseResults/100scope.vert.out index a3a67970..2b542b0c 100644 --- a/Test/baseResults/100scope.vert.out +++ b/Test/baseResults/100scope.vert.out @@ -4,14 +4,16 @@ ERROR: 0:17: 'b' : function name is redeclaration of existing name ERROR: 0:20: 'c' : redefinition ERROR: 0:22: 'f' : redefinition ERROR: 0:24: 'redefinition of built-in function' : not supported with this profile: es +ERROR: 0:24: 'highp' : overloaded functions must have the same parameter precision qualifiers for argument 1 ERROR: 0:25: 'redefinition of built-in function' : not supported with this profile: es +ERROR: 0:25: 'highp' : overloaded functions must have the same parameter precision qualifiers for argument 1 ERROR: 0:38: 'local function declaration' : not supported with this profile: es ERROR: 0:43: 'sin' : can't use function syntax on variable ERROR: 0:57: 'z' : undeclared identifier ERROR: 0:57: 'z' : redefinition ERROR: 0:73: 'degrees' : can't use function syntax on variable ERROR: 0:76: 'vertex-shader struct output' : not supported for this version or the enabled extensions -ERROR: 12 compilation errors. No code generated. +ERROR: 14 compilation errors. No code generated. Shader version: 100 diff --git a/Test/baseResults/300.frag.out b/Test/baseResults/300.frag.out index eb752b4d..a0c2615d 100644 --- a/Test/baseResults/300.frag.out +++ b/Test/baseResults/300.frag.out @@ -147,44 +147,44 @@ ERROR: node is still EOpNull! 0:69 'c2D' (smooth in lowp 2-component vector of float) 0:72 move second child to first child (temp mediump 4-component vector of int) 0:72 'iv' (temp mediump 4-component vector of int) -0:72 texture (global mediump 4-component vector of int) +0:72 texture (global lowp 4-component vector of int) 0:72 'is2D' (uniform lowp isampler2D) 0:72 'c2D' (smooth in lowp 2-component vector of float) 0:73 move second child to first child (temp mediump 4-component vector of int) 0:73 'iv' (temp mediump 4-component vector of int) -0:73 textureProjOffset (global mediump 4-component vector of int) +0:73 textureProjOffset (global lowp 4-component vector of int) 0:73 'is2D' (uniform lowp isampler2D) 0:73 'c4D' (smooth temp lowp 4-component vector of float) 0:73 'ic2D' (flat in mediump 2-component vector of int) 0:74 move second child to first child (temp mediump 4-component vector of int) 0:74 'iv' (temp mediump 4-component vector of int) -0:74 textureProjLod (global mediump 4-component vector of int) +0:74 textureProjLod (global lowp 4-component vector of int) 0:74 'is2D' (uniform lowp isampler2D) 0:74 'c3D' (smooth in lowp 3-component vector of float) 0:74 'c1D' (smooth in lowp float) 0:75 move second child to first child (temp mediump 4-component vector of int) 0:75 'iv' (temp mediump 4-component vector of int) -0:75 textureProjGrad (global mediump 4-component vector of int) +0:75 textureProjGrad (global lowp 4-component vector of int) 0:75 'is2D' (uniform lowp isampler2D) 0:75 'c3D' (smooth in lowp 3-component vector of float) 0:75 'c2D' (smooth in lowp 2-component vector of float) 0:75 'c2D' (smooth in lowp 2-component vector of float) 0:76 move second child to first child (temp mediump 4-component vector of int) 0:76 'iv' (temp mediump 4-component vector of int) -0:76 texture (global mediump 4-component vector of int) +0:76 texture (global lowp 4-component vector of int) 0:76 'is3D' (uniform lowp isampler3D) 0:76 'c3D' (smooth in lowp 3-component vector of float) 0:76 Constant: 0:76 4.200000 0:77 move second child to first child (temp mediump 4-component vector of int) 0:77 'iv' (temp mediump 4-component vector of int) -0:77 textureLod (global mediump 4-component vector of int) +0:77 textureLod (global lowp 4-component vector of int) 0:77 'isCube' (uniform lowp isamplerCube) 0:77 'c3D' (smooth in lowp 3-component vector of float) 0:77 'c1D' (smooth in lowp float) 0:78 move second child to first child (temp mediump 4-component vector of int) 0:78 'iv' (temp mediump 4-component vector of int) -0:78 textureFetch (global mediump 4-component vector of int) +0:78 textureFetch (global lowp 4-component vector of int) 0:78 'is2DArray' (uniform lowp isampler2DArray) 0:78 'ic3D' (flat in mediump 3-component vector of int) 0:78 'ic1D' (flat in mediump int) @@ -503,44 +503,44 @@ ERROR: node is still EOpNull! 0:69 'c2D' (smooth in lowp 2-component vector of float) 0:72 move second child to first child (temp mediump 4-component vector of int) 0:72 'iv' (temp mediump 4-component vector of int) -0:72 texture (global mediump 4-component vector of int) +0:72 texture (global lowp 4-component vector of int) 0:72 'is2D' (uniform lowp isampler2D) 0:72 'c2D' (smooth in lowp 2-component vector of float) 0:73 move second child to first child (temp mediump 4-component vector of int) 0:73 'iv' (temp mediump 4-component vector of int) -0:73 textureProjOffset (global mediump 4-component vector of int) +0:73 textureProjOffset (global lowp 4-component vector of int) 0:73 'is2D' (uniform lowp isampler2D) 0:73 'c4D' (smooth temp lowp 4-component vector of float) 0:73 'ic2D' (flat in mediump 2-component vector of int) 0:74 move second child to first child (temp mediump 4-component vector of int) 0:74 'iv' (temp mediump 4-component vector of int) -0:74 textureProjLod (global mediump 4-component vector of int) +0:74 textureProjLod (global lowp 4-component vector of int) 0:74 'is2D' (uniform lowp isampler2D) 0:74 'c3D' (smooth in lowp 3-component vector of float) 0:74 'c1D' (smooth in lowp float) 0:75 move second child to first child (temp mediump 4-component vector of int) 0:75 'iv' (temp mediump 4-component vector of int) -0:75 textureProjGrad (global mediump 4-component vector of int) +0:75 textureProjGrad (global lowp 4-component vector of int) 0:75 'is2D' (uniform lowp isampler2D) 0:75 'c3D' (smooth in lowp 3-component vector of float) 0:75 'c2D' (smooth in lowp 2-component vector of float) 0:75 'c2D' (smooth in lowp 2-component vector of float) 0:76 move second child to first child (temp mediump 4-component vector of int) 0:76 'iv' (temp mediump 4-component vector of int) -0:76 texture (global mediump 4-component vector of int) +0:76 texture (global lowp 4-component vector of int) 0:76 'is3D' (uniform lowp isampler3D) 0:76 'c3D' (smooth in lowp 3-component vector of float) 0:76 Constant: 0:76 4.200000 0:77 move second child to first child (temp mediump 4-component vector of int) 0:77 'iv' (temp mediump 4-component vector of int) -0:77 textureLod (global mediump 4-component vector of int) +0:77 textureLod (global lowp 4-component vector of int) 0:77 'isCube' (uniform lowp isamplerCube) 0:77 'c3D' (smooth in lowp 3-component vector of float) 0:77 'c1D' (smooth in lowp float) 0:78 move second child to first child (temp mediump 4-component vector of int) 0:78 'iv' (temp mediump 4-component vector of int) -0:78 textureFetch (global mediump 4-component vector of int) +0:78 textureFetch (global lowp 4-component vector of int) 0:78 'is2DArray' (uniform lowp isampler2DArray) 0:78 'ic3D' (flat in mediump 3-component vector of int) 0:78 'ic1D' (flat in mediump int) diff --git a/Test/baseResults/300.vert.out b/Test/baseResults/300.vert.out index 122b2569..8694a746 100644 --- a/Test/baseResults/300.vert.out +++ b/Test/baseResults/300.vert.out @@ -193,7 +193,7 @@ ERROR: node is still EOpNull! 0:124 Sequence 0:124 move second child to first child (temp highp 4-component vector of float) 0:124 'x4' (temp highp 4-component vector of float) -0:124 texture (global highp 4-component vector of float) +0:124 texture (global lowp 4-component vector of float) 0:124 's2D' (uniform lowp sampler2D) 0:124 'c2D' (in highp 2-component vector of float) 0:125 Constant: @@ -201,7 +201,7 @@ ERROR: node is still EOpNull! 0:126 Sequence 0:126 move second child to first child (temp highp 4-component vector of float) 0:126 'x5' (temp highp 4-component vector of float) -0:126 textureProjOffset (global highp 4-component vector of float) +0:126 textureProjOffset (global lowp 4-component vector of float) 0:126 's3D' (uniform lowp sampler3D) 0:126 Constant: 0:126 0.200000 @@ -217,7 +217,7 @@ ERROR: node is still EOpNull! 0:128 Sequence 0:128 move second child to first child (temp highp float) 0:128 'x6' (temp highp float) -0:128 textureProjGradOffset (global highp float) +0:128 textureProjGradOffset (global lowp float) 0:128 's2DS' (uniform lowp sampler2DShadow) 0:128 'invIn' (invariant in highp 4-component vector of float) 0:128 Constant: @@ -477,7 +477,7 @@ ERROR: node is still EOpNull! 0:124 Sequence 0:124 move second child to first child (temp highp 4-component vector of float) 0:124 'x4' (temp highp 4-component vector of float) -0:124 texture (global highp 4-component vector of float) +0:124 texture (global lowp 4-component vector of float) 0:124 's2D' (uniform lowp sampler2D) 0:124 'c2D' (in highp 2-component vector of float) 0:125 Constant: @@ -485,7 +485,7 @@ ERROR: node is still EOpNull! 0:126 Sequence 0:126 move second child to first child (temp highp 4-component vector of float) 0:126 'x5' (temp highp 4-component vector of float) -0:126 textureProjOffset (global highp 4-component vector of float) +0:126 textureProjOffset (global lowp 4-component vector of float) 0:126 's3D' (uniform lowp sampler3D) 0:126 Constant: 0:126 0.200000 @@ -501,7 +501,7 @@ ERROR: node is still EOpNull! 0:128 Sequence 0:128 move second child to first child (temp highp float) 0:128 'x6' (temp highp float) -0:128 textureProjGradOffset (global highp float) +0:128 textureProjGradOffset (global lowp float) 0:128 's2DS' (uniform lowp sampler2DShadow) 0:128 'invIn' (invariant in highp 4-component vector of float) 0:128 Constant: diff --git a/Test/baseResults/300block.frag.out b/Test/baseResults/300block.frag.out index ede34c31..224bd111 100644 --- a/Test/baseResults/300block.frag.out +++ b/Test/baseResults/300block.frag.out @@ -24,18 +24,18 @@ ERROR: node is still EOpNull! 0:42 Function Definition: main( (global void) 0:42 Function Parameters: 0:44 Sequence -0:44 texture (global mediump 4-component vector of int) +0:44 texture (global lowp 4-component vector of int) 0:44 sampler: direct index for structure (global lowp isampler3D) 0:44 's' (uniform structure{global mediump 4-component vector of float u, global mediump 4-component vector of uint v, global lowp isampler3D sampler, global mediump 3-component vector of float w, global structure{global mediump int a} t}) 0:44 Constant: 0:44 2 (const int) -0:44 Construct vec3 (temp mediump 3-component vector of float) -0:44 Convert int to float (temp mediump float) +0:44 Construct vec3 (temp lowp 3-component vector of float) +0:44 Convert int to float (temp lowp float) 0:44 ni: direct index for structure (layout(column_major shared ) uniform mediump int) 0:44 'inst' (layout(column_major shared ) uniform block{layout(column_major shared ) uniform mediump 4-component vector of uint nbv, layout(column_major shared ) uniform mediump int ni}) 0:44 Constant: 0:44 1 (const int) -0:44 Convert uint to float (temp mediump float) +0:44 Convert uint to float (temp lowp float) 0:44 direct index (temp mediump uint) 0:44 bv: direct index for structure (layout(column_major shared ) uniform mediump 4-component vector of uint) 0:44 'anon@0' (layout(column_major shared ) uniform block{layout(column_major shared ) uniform mediump 4-component vector of uint bv, layout(column_major shared ) uniform mediump 2X2 matrix of float bm2, layout(column_major shared ) uniform lowp isampler2D sampler, layout(column_major shared ) uniform structure{global mediump int a} t, layout(column_major shared ) uniform structure{global mediump 4-component vector of float u, global mediump 4-component vector of uint v, global lowp isampler3D sampler, global mediump 3-component vector of float w, global structure{global mediump int a} t} fbs}) @@ -43,7 +43,7 @@ ERROR: node is still EOpNull! 0:44 0 (const uint) 0:44 Constant: 0:44 1 (const int) -0:44 Convert uint to float (temp mediump float) +0:44 Convert uint to float (temp lowp float) 0:44 direct index (temp mediump uint) 0:44 nbv: direct index for structure (layout(column_major shared ) uniform mediump 4-component vector of uint) 0:44 direct index (layout(column_major shared ) temp block{layout(column_major shared ) uniform mediump 4-component vector of uint nbv, layout(column_major shared ) uniform mediump int ni}) @@ -92,18 +92,18 @@ ERROR: node is still EOpNull! 0:42 Function Definition: main( (global void) 0:42 Function Parameters: 0:44 Sequence -0:44 texture (global mediump 4-component vector of int) +0:44 texture (global lowp 4-component vector of int) 0:44 sampler: direct index for structure (global lowp isampler3D) 0:44 's' (uniform structure{global mediump 4-component vector of float u, global mediump 4-component vector of uint v, global lowp isampler3D sampler, global mediump 3-component vector of float w, global structure{global mediump int a} t}) 0:44 Constant: 0:44 2 (const int) -0:44 Construct vec3 (temp mediump 3-component vector of float) -0:44 Convert int to float (temp mediump float) +0:44 Construct vec3 (temp lowp 3-component vector of float) +0:44 Convert int to float (temp lowp float) 0:44 ni: direct index for structure (layout(column_major shared ) uniform mediump int) 0:44 'inst' (layout(column_major shared ) uniform block{layout(column_major shared ) uniform mediump 4-component vector of uint nbv, layout(column_major shared ) uniform mediump int ni}) 0:44 Constant: 0:44 1 (const int) -0:44 Convert uint to float (temp mediump float) +0:44 Convert uint to float (temp lowp float) 0:44 direct index (temp mediump uint) 0:44 bv: direct index for structure (layout(column_major shared ) uniform mediump 4-component vector of uint) 0:44 'anon@0' (layout(column_major shared ) uniform block{layout(column_major shared ) uniform mediump 4-component vector of uint bv, layout(column_major shared ) uniform mediump 2X2 matrix of float bm2, layout(column_major shared ) uniform lowp isampler2D sampler, layout(column_major shared ) uniform structure{global mediump int a} t, layout(column_major shared ) uniform structure{global mediump 4-component vector of float u, global mediump 4-component vector of uint v, global lowp isampler3D sampler, global mediump 3-component vector of float w, global structure{global mediump int a} t} fbs}) @@ -111,7 +111,7 @@ ERROR: node is still EOpNull! 0:44 0 (const uint) 0:44 Constant: 0:44 1 (const int) -0:44 Convert uint to float (temp mediump float) +0:44 Convert uint to float (temp lowp float) 0:44 direct index (temp mediump uint) 0:44 nbv: direct index for structure (layout(column_major shared ) uniform mediump 4-component vector of uint) 0:44 direct index (layout(column_major shared ) temp block{layout(column_major shared ) uniform mediump 4-component vector of uint nbv, layout(column_major shared ) uniform mediump int ni}) diff --git a/Test/baseResults/300scope.vert.out b/Test/baseResults/300scope.vert.out index acc93f5a..2a9a945d 100644 --- a/Test/baseResults/300scope.vert.out +++ b/Test/baseResults/300scope.vert.out @@ -5,8 +5,10 @@ ERROR: 0:20: 'c' : redefinition ERROR: 0:22: 'f' : redefinition ERROR: 0:23: 'tan' : redefinition ERROR: 0:24: 'redefinition of built-in function' : not supported with this profile: es +ERROR: 0:24: 'highp' : overloaded functions must have the same parameter precision qualifiers for argument 1 ERROR: 0:24: 'sin' : function name is redeclaration of existing name ERROR: 0:25: 'redefinition of built-in function' : not supported with this profile: es +ERROR: 0:25: 'highp' : overloaded functions must have the same parameter precision qualifiers for argument 1 ERROR: 0:25: 'cos' : function name is redeclaration of existing name ERROR: 0:25: 'cos' : function already has a body ERROR: 0:27: 'return' : void function cannot return a value @@ -18,7 +20,7 @@ ERROR: 0:43: 'sin' : can't use function syntax on variable ERROR: 0:57: 'z' : undeclared identifier ERROR: 0:57: 'z' : redefinition ERROR: 0:73: 'degrees' : can't use function syntax on variable -ERROR: 19 compilation errors. No code generated. +ERROR: 21 compilation errors. No code generated. Shader version: 300 diff --git a/Test/baseResults/310.frag.out b/Test/baseResults/310.frag.out index f1dc4d04..7f3f5089 100644 --- a/Test/baseResults/310.frag.out +++ b/Test/baseResults/310.frag.out @@ -169,9 +169,9 @@ ERROR: node is still EOpNull! 0:28 0 (const int) 0:28 'c2D' (smooth in mediump 2-component vector of float) 0:29 Sequence -0:29 move second child to first child (temp mediump 4-component vector of int) +0:29 move second child to first child (temp highp 4-component vector of int) 0:29 'iv4' (temp mediump 4-component vector of int) -0:29 textureGatherOffset (global mediump 4-component vector of int) +0:29 textureGatherOffset (global highp 4-component vector of int) 0:29 'isamp2DA' (uniform highp isampler2DArray) 0:29 Constant: 0:29 0.100000 @@ -182,9 +182,9 @@ ERROR: node is still EOpNull! 0:29 1 (const int) 0:29 Constant: 0:29 3 (const int) -0:30 move second child to first child (temp mediump 4-component vector of int) +0:30 move second child to first child (temp highp 4-component vector of int) 0:30 'iv4' (temp mediump 4-component vector of int) -0:30 textureGatherOffset (global mediump 4-component vector of int) +0:30 textureGatherOffset (global highp 4-component vector of int) 0:30 'isamp2DA' (uniform highp isampler2DArray) 0:30 Constant: 0:30 0.100000 @@ -194,9 +194,9 @@ ERROR: node is still EOpNull! 0:30 1 (const int) 0:30 1 (const int) 0:30 'i' (uniform mediump int) -0:31 move second child to first child (temp mediump 4-component vector of int) +0:31 move second child to first child (temp highp 4-component vector of int) 0:31 'iv4' (temp mediump 4-component vector of int) -0:31 textureGatherOffset (global mediump 4-component vector of int) +0:31 textureGatherOffset (global highp 4-component vector of int) 0:31 'isamp2DA' (uniform highp isampler2DArray) 0:31 Constant: 0:31 0.100000 @@ -207,9 +207,9 @@ ERROR: node is still EOpNull! 0:31 1 (const int) 0:31 Constant: 0:31 4 (const int) -0:32 move second child to first child (temp mediump 4-component vector of int) +0:32 move second child to first child (temp highp 4-component vector of int) 0:32 'iv4' (temp mediump 4-component vector of int) -0:32 textureGatherOffset (global mediump 4-component vector of int) +0:32 textureGatherOffset (global highp 4-component vector of int) 0:32 'isamp2DA' (uniform highp isampler2DArray) 0:32 Constant: 0:32 0.100000 @@ -220,9 +220,9 @@ ERROR: node is still EOpNull! 0:32 1 (const int) 0:32 Constant: 0:32 3 (const int) -0:33 move second child to first child (temp mediump 4-component vector of int) +0:33 move second child to first child (temp highp 4-component vector of int) 0:33 'iv4' (temp mediump 4-component vector of int) -0:33 textureGatherOffset (global mediump 4-component vector of int) +0:33 textureGatherOffset (global highp 4-component vector of int) 0:33 'isamp2DA' (uniform highp isampler2DArray) 0:33 Constant: 0:33 0.100000 @@ -231,20 +231,20 @@ ERROR: node is still EOpNull! 0:33 Constant: 0:33 0 (const int) 0:33 0 (const int) -0:34 move second child to first child (temp mediump 4-component vector of int) +0:34 move second child to first child (temp highp 4-component vector of int) 0:34 'iv4' (temp mediump 4-component vector of int) -0:34 textureGatherOffset (global mediump 4-component vector of int) +0:34 textureGatherOffset (global highp 4-component vector of int) 0:34 'isamp2DA' (uniform highp isampler2DArray) 0:34 Constant: 0:34 0.100000 0:34 0.100000 0:34 0.100000 -0:34 Construct ivec2 (temp mediump 2-component vector of int) +0:34 Construct ivec2 (temp highp 2-component vector of int) 0:34 'i' (uniform mediump int) 0:38 Function Definition: foo23( (global void) 0:38 Function Parameters: 0:? Sequence -0:42 textureProjGradOffset (global mediump 4-component vector of uint) +0:42 textureProjGradOffset (global highp 4-component vector of uint) 0:42 'usamp2d' (uniform highp usampler2D) 0:42 'outp' (out mediump 4-component vector of float) 0:42 Constant: @@ -253,9 +253,9 @@ ERROR: node is still EOpNull! 0:42 Constant: 0:42 0.000000 0:42 0.000000 -0:42 Convert float to int (temp mediump 2-component vector of int) +0:42 Convert float to int (temp highp 2-component vector of int) 0:42 'c2D' (smooth in mediump 2-component vector of float) -0:43 textureProjGradOffset (global mediump 4-component vector of uint) +0:43 textureProjGradOffset (global highp 4-component vector of uint) 0:43 'usamp2d' (uniform highp usampler2D) 0:43 'outp' (out mediump 4-component vector of float) 0:43 Constant: @@ -267,7 +267,7 @@ ERROR: node is still EOpNull! 0:43 Constant: 0:43 3 (const int) 0:43 4 (const int) -0:44 textureProjGradOffset (global mediump 4-component vector of uint) +0:44 textureProjGradOffset (global highp 4-component vector of uint) 0:44 'usamp2d' (uniform highp usampler2D) 0:44 'outp' (out mediump 4-component vector of float) 0:44 Constant: @@ -279,7 +279,7 @@ ERROR: node is still EOpNull! 0:44 Constant: 0:44 15 (const int) 0:44 16 (const int) -0:45 textureProjGradOffset (global mediump 4-component vector of uint) +0:45 textureProjGradOffset (global highp 4-component vector of uint) 0:45 'usamp2d' (uniform highp usampler2D) 0:45 'outp' (out mediump 4-component vector of float) 0:45 Constant: @@ -526,7 +526,7 @@ ERROR: node is still EOpNull! 0:251 Sequence 0:251 move second child to first child (temp highp 4-component vector of int) 0:251 'b6' (temp highp 4-component vector of int) -0:251 texture (global mediump 4-component vector of int) +0:251 texture (global highp 4-component vector of int) 0:251 'CA6' (uniform highp isamplerCubeArray) 0:251 Constant: 0:251 0.500000 @@ -538,7 +538,7 @@ ERROR: node is still EOpNull! 0:252 Sequence 0:252 move second child to first child (temp highp 4-component vector of uint) 0:252 'b7' (temp highp 4-component vector of uint) -0:252 texture (global mediump 4-component vector of uint) +0:252 texture (global highp 4-component vector of uint) 0:252 'CA7' (uniform highp usamplerCubeArray) 0:252 Constant: 0:252 0.500000 @@ -611,59 +611,59 @@ ERROR: node is still EOpNull! 0:283 Function Definition: badImageAtom( (global void) 0:283 Function Parameters: 0:? Sequence -0:289 imageAtomicAdd (global mediump int) +0:289 imageAtomicAdd (global highp int) 0:289 'im2Di' (layout(r32i ) uniform highp iimage2D) 0:289 'P' (uniform mediump 2-component vector of int) 0:289 'dati' (temp mediump int) -0:290 imageAtomicAdd (global mediump uint) +0:290 imageAtomicAdd (global highp uint) 0:290 'im2Du' (layout(r32ui ) uniform highp uimage2D) 0:290 'P' (uniform mediump 2-component vector of int) 0:290 'datu' (temp mediump uint) -0:291 imageAtomicMin (global mediump int) +0:291 imageAtomicMin (global highp int) 0:291 'im2Di' (layout(r32i ) uniform highp iimage2D) 0:291 'P' (uniform mediump 2-component vector of int) 0:291 'dati' (temp mediump int) -0:292 imageAtomicMin (global mediump uint) +0:292 imageAtomicMin (global highp uint) 0:292 'im2Du' (layout(r32ui ) uniform highp uimage2D) 0:292 'P' (uniform mediump 2-component vector of int) 0:292 'datu' (temp mediump uint) -0:293 imageAtomicMax (global mediump int) +0:293 imageAtomicMax (global highp int) 0:293 'im2Di' (layout(r32i ) uniform highp iimage2D) 0:293 'P' (uniform mediump 2-component vector of int) 0:293 'dati' (temp mediump int) -0:294 imageAtomicMax (global mediump uint) +0:294 imageAtomicMax (global highp uint) 0:294 'im2Du' (layout(r32ui ) uniform highp uimage2D) 0:294 'P' (uniform mediump 2-component vector of int) 0:294 'datu' (temp mediump uint) -0:295 imageAtomicAnd (global mediump int) +0:295 imageAtomicAnd (global highp int) 0:295 'im2Di' (layout(r32i ) uniform highp iimage2D) 0:295 'P' (uniform mediump 2-component vector of int) 0:295 'dati' (temp mediump int) -0:296 imageAtomicAnd (global mediump uint) +0:296 imageAtomicAnd (global highp uint) 0:296 'im2Du' (layout(r32ui ) uniform highp uimage2D) 0:296 'P' (uniform mediump 2-component vector of int) 0:296 'datu' (temp mediump uint) -0:297 imageAtomicOr (global mediump int) +0:297 imageAtomicOr (global highp int) 0:297 'im2Di' (layout(r32i ) uniform highp iimage2D) 0:297 'P' (uniform mediump 2-component vector of int) 0:297 'dati' (temp mediump int) -0:298 imageAtomicOr (global mediump uint) +0:298 imageAtomicOr (global highp uint) 0:298 'im2Du' (layout(r32ui ) uniform highp uimage2D) 0:298 'P' (uniform mediump 2-component vector of int) 0:298 'datu' (temp mediump uint) -0:299 imageAtomicXor (global mediump int) +0:299 imageAtomicXor (global highp int) 0:299 'im2Di' (layout(r32i ) uniform highp iimage2D) 0:299 'P' (uniform mediump 2-component vector of int) 0:299 'dati' (temp mediump int) -0:300 imageAtomicXor (global mediump uint) +0:300 imageAtomicXor (global highp uint) 0:300 'im2Du' (layout(r32ui ) uniform highp uimage2D) 0:300 'P' (uniform mediump 2-component vector of int) 0:300 'datu' (temp mediump uint) -0:301 imageAtomicExchange (global mediump int) +0:301 imageAtomicExchange (global highp int) 0:301 'im2Di' (layout(r32i ) uniform highp iimage2D) 0:301 'P' (uniform mediump 2-component vector of int) 0:301 'dati' (temp mediump int) -0:302 imageAtomicExchange (global mediump uint) +0:302 imageAtomicExchange (global highp uint) 0:302 'im2Du' (layout(r32ui ) uniform highp uimage2D) 0:302 'P' (uniform mediump 2-component vector of int) 0:302 'datu' (temp mediump uint) @@ -671,13 +671,13 @@ ERROR: node is still EOpNull! 0:303 'im2Df' (layout(r32f ) uniform highp image2D) 0:303 'P' (uniform mediump 2-component vector of int) 0:303 'datf' (temp mediump float) -0:304 imageAtomicCompSwap (global mediump int) +0:304 imageAtomicCompSwap (global highp int) 0:304 'im2Di' (layout(r32i ) uniform highp iimage2D) 0:304 'P' (uniform mediump 2-component vector of int) 0:304 Constant: 0:304 3 (const int) 0:304 'dati' (temp mediump int) -0:305 imageAtomicCompSwap (global mediump uint) +0:305 imageAtomicCompSwap (global highp uint) 0:305 'im2Du' (layout(r32ui ) uniform highp uimage2D) 0:305 'P' (uniform mediump 2-component vector of int) 0:305 Constant: @@ -686,59 +686,59 @@ ERROR: node is still EOpNull! 0:316 Function Definition: goodImageAtom( (global void) 0:316 Function Parameters: 0:? Sequence -0:322 imageAtomicAdd (global mediump int) +0:322 imageAtomicAdd (global highp int) 0:322 'im2Di' (layout(r32i ) uniform highp iimage2D) 0:322 'P' (uniform mediump 2-component vector of int) 0:322 'dati' (temp mediump int) -0:323 imageAtomicAdd (global mediump uint) +0:323 imageAtomicAdd (global highp uint) 0:323 'im2Du' (layout(r32ui ) uniform highp uimage2D) 0:323 'P' (uniform mediump 2-component vector of int) 0:323 'datu' (temp mediump uint) -0:324 imageAtomicMin (global mediump int) +0:324 imageAtomicMin (global highp int) 0:324 'im2Di' (layout(r32i ) uniform highp iimage2D) 0:324 'P' (uniform mediump 2-component vector of int) 0:324 'dati' (temp mediump int) -0:325 imageAtomicMin (global mediump uint) +0:325 imageAtomicMin (global highp uint) 0:325 'im2Du' (layout(r32ui ) uniform highp uimage2D) 0:325 'P' (uniform mediump 2-component vector of int) 0:325 'datu' (temp mediump uint) -0:326 imageAtomicMax (global mediump int) +0:326 imageAtomicMax (global highp int) 0:326 'im2Di' (layout(r32i ) uniform highp iimage2D) 0:326 'P' (uniform mediump 2-component vector of int) 0:326 'dati' (temp mediump int) -0:327 imageAtomicMax (global mediump uint) +0:327 imageAtomicMax (global highp uint) 0:327 'im2Du' (layout(r32ui ) uniform highp uimage2D) 0:327 'P' (uniform mediump 2-component vector of int) 0:327 'datu' (temp mediump uint) -0:328 imageAtomicAnd (global mediump int) +0:328 imageAtomicAnd (global highp int) 0:328 'im2Di' (layout(r32i ) uniform highp iimage2D) 0:328 'P' (uniform mediump 2-component vector of int) 0:328 'dati' (temp mediump int) -0:329 imageAtomicAnd (global mediump uint) +0:329 imageAtomicAnd (global highp uint) 0:329 'im2Du' (layout(r32ui ) uniform highp uimage2D) 0:329 'P' (uniform mediump 2-component vector of int) 0:329 'datu' (temp mediump uint) -0:330 imageAtomicOr (global mediump int) +0:330 imageAtomicOr (global highp int) 0:330 'im2Di' (layout(r32i ) uniform highp iimage2D) 0:330 'P' (uniform mediump 2-component vector of int) 0:330 'dati' (temp mediump int) -0:331 imageAtomicOr (global mediump uint) +0:331 imageAtomicOr (global highp uint) 0:331 'im2Du' (layout(r32ui ) uniform highp uimage2D) 0:331 'P' (uniform mediump 2-component vector of int) 0:331 'datu' (temp mediump uint) -0:332 imageAtomicXor (global mediump int) +0:332 imageAtomicXor (global highp int) 0:332 'im2Di' (layout(r32i ) uniform highp iimage2D) 0:332 'P' (uniform mediump 2-component vector of int) 0:332 'dati' (temp mediump int) -0:333 imageAtomicXor (global mediump uint) +0:333 imageAtomicXor (global highp uint) 0:333 'im2Du' (layout(r32ui ) uniform highp uimage2D) 0:333 'P' (uniform mediump 2-component vector of int) 0:333 'datu' (temp mediump uint) -0:334 imageAtomicExchange (global mediump int) +0:334 imageAtomicExchange (global highp int) 0:334 'im2Di' (layout(r32i ) uniform highp iimage2D) 0:334 'P' (uniform mediump 2-component vector of int) 0:334 'dati' (temp mediump int) -0:335 imageAtomicExchange (global mediump uint) +0:335 imageAtomicExchange (global highp uint) 0:335 'im2Du' (layout(r32ui ) uniform highp uimage2D) 0:335 'P' (uniform mediump 2-component vector of int) 0:335 'datu' (temp mediump uint) @@ -746,23 +746,23 @@ ERROR: node is still EOpNull! 0:336 'im2Df' (layout(r32f ) uniform highp image2D) 0:336 'P' (uniform mediump 2-component vector of int) 0:336 'datf' (temp mediump float) -0:337 imageAtomicCompSwap (global mediump int) +0:337 imageAtomicCompSwap (global highp int) 0:337 'im2Di' (layout(r32i ) uniform highp iimage2D) 0:337 'P' (uniform mediump 2-component vector of int) 0:337 Constant: 0:337 3 (const int) 0:337 'dati' (temp mediump int) -0:338 imageAtomicCompSwap (global mediump uint) +0:338 imageAtomicCompSwap (global highp uint) 0:338 'im2Du' (layout(r32ui ) uniform highp uimage2D) 0:338 'P' (uniform mediump 2-component vector of int) 0:338 Constant: 0:338 5 (const uint) 0:338 'datu' (temp mediump uint) -0:340 imageAtomicMax (global mediump int) +0:340 imageAtomicMax (global highp int) 0:340 'badIm2Di' (layout(rgba16i ) uniform highp iimage2D) 0:340 'P' (uniform mediump 2-component vector of int) 0:340 'dati' (temp mediump int) -0:341 imageAtomicMax (global mediump uint) +0:341 imageAtomicMax (global highp uint) 0:341 'badIm2Du' (layout(rgba8ui ) uniform highp uimage2D) 0:341 'P' (uniform mediump 2-component vector of int) 0:341 'datu' (temp mediump uint) @@ -1050,9 +1050,9 @@ ERROR: node is still EOpNull! 0:28 0 (const int) 0:28 'c2D' (smooth in mediump 2-component vector of float) 0:29 Sequence -0:29 move second child to first child (temp mediump 4-component vector of int) +0:29 move second child to first child (temp highp 4-component vector of int) 0:29 'iv4' (temp mediump 4-component vector of int) -0:29 textureGatherOffset (global mediump 4-component vector of int) +0:29 textureGatherOffset (global highp 4-component vector of int) 0:29 'isamp2DA' (uniform highp isampler2DArray) 0:29 Constant: 0:29 0.100000 @@ -1063,9 +1063,9 @@ ERROR: node is still EOpNull! 0:29 1 (const int) 0:29 Constant: 0:29 3 (const int) -0:30 move second child to first child (temp mediump 4-component vector of int) +0:30 move second child to first child (temp highp 4-component vector of int) 0:30 'iv4' (temp mediump 4-component vector of int) -0:30 textureGatherOffset (global mediump 4-component vector of int) +0:30 textureGatherOffset (global highp 4-component vector of int) 0:30 'isamp2DA' (uniform highp isampler2DArray) 0:30 Constant: 0:30 0.100000 @@ -1075,9 +1075,9 @@ ERROR: node is still EOpNull! 0:30 1 (const int) 0:30 1 (const int) 0:30 'i' (uniform mediump int) -0:31 move second child to first child (temp mediump 4-component vector of int) +0:31 move second child to first child (temp highp 4-component vector of int) 0:31 'iv4' (temp mediump 4-component vector of int) -0:31 textureGatherOffset (global mediump 4-component vector of int) +0:31 textureGatherOffset (global highp 4-component vector of int) 0:31 'isamp2DA' (uniform highp isampler2DArray) 0:31 Constant: 0:31 0.100000 @@ -1088,9 +1088,9 @@ ERROR: node is still EOpNull! 0:31 1 (const int) 0:31 Constant: 0:31 4 (const int) -0:32 move second child to first child (temp mediump 4-component vector of int) +0:32 move second child to first child (temp highp 4-component vector of int) 0:32 'iv4' (temp mediump 4-component vector of int) -0:32 textureGatherOffset (global mediump 4-component vector of int) +0:32 textureGatherOffset (global highp 4-component vector of int) 0:32 'isamp2DA' (uniform highp isampler2DArray) 0:32 Constant: 0:32 0.100000 @@ -1101,9 +1101,9 @@ ERROR: node is still EOpNull! 0:32 1 (const int) 0:32 Constant: 0:32 3 (const int) -0:33 move second child to first child (temp mediump 4-component vector of int) +0:33 move second child to first child (temp highp 4-component vector of int) 0:33 'iv4' (temp mediump 4-component vector of int) -0:33 textureGatherOffset (global mediump 4-component vector of int) +0:33 textureGatherOffset (global highp 4-component vector of int) 0:33 'isamp2DA' (uniform highp isampler2DArray) 0:33 Constant: 0:33 0.100000 @@ -1112,20 +1112,20 @@ ERROR: node is still EOpNull! 0:33 Constant: 0:33 0 (const int) 0:33 0 (const int) -0:34 move second child to first child (temp mediump 4-component vector of int) +0:34 move second child to first child (temp highp 4-component vector of int) 0:34 'iv4' (temp mediump 4-component vector of int) -0:34 textureGatherOffset (global mediump 4-component vector of int) +0:34 textureGatherOffset (global highp 4-component vector of int) 0:34 'isamp2DA' (uniform highp isampler2DArray) 0:34 Constant: 0:34 0.100000 0:34 0.100000 0:34 0.100000 -0:34 Construct ivec2 (temp mediump 2-component vector of int) +0:34 Construct ivec2 (temp highp 2-component vector of int) 0:34 'i' (uniform mediump int) 0:38 Function Definition: foo23( (global void) 0:38 Function Parameters: 0:? Sequence -0:42 textureProjGradOffset (global mediump 4-component vector of uint) +0:42 textureProjGradOffset (global highp 4-component vector of uint) 0:42 'usamp2d' (uniform highp usampler2D) 0:42 'outp' (out mediump 4-component vector of float) 0:42 Constant: @@ -1134,9 +1134,9 @@ ERROR: node is still EOpNull! 0:42 Constant: 0:42 0.000000 0:42 0.000000 -0:42 Convert float to int (temp mediump 2-component vector of int) +0:42 Convert float to int (temp highp 2-component vector of int) 0:42 'c2D' (smooth in mediump 2-component vector of float) -0:43 textureProjGradOffset (global mediump 4-component vector of uint) +0:43 textureProjGradOffset (global highp 4-component vector of uint) 0:43 'usamp2d' (uniform highp usampler2D) 0:43 'outp' (out mediump 4-component vector of float) 0:43 Constant: @@ -1148,7 +1148,7 @@ ERROR: node is still EOpNull! 0:43 Constant: 0:43 3 (const int) 0:43 4 (const int) -0:44 textureProjGradOffset (global mediump 4-component vector of uint) +0:44 textureProjGradOffset (global highp 4-component vector of uint) 0:44 'usamp2d' (uniform highp usampler2D) 0:44 'outp' (out mediump 4-component vector of float) 0:44 Constant: @@ -1160,7 +1160,7 @@ ERROR: node is still EOpNull! 0:44 Constant: 0:44 15 (const int) 0:44 16 (const int) -0:45 textureProjGradOffset (global mediump 4-component vector of uint) +0:45 textureProjGradOffset (global highp 4-component vector of uint) 0:45 'usamp2d' (uniform highp usampler2D) 0:45 'outp' (out mediump 4-component vector of float) 0:45 Constant: @@ -1407,7 +1407,7 @@ ERROR: node is still EOpNull! 0:251 Sequence 0:251 move second child to first child (temp highp 4-component vector of int) 0:251 'b6' (temp highp 4-component vector of int) -0:251 texture (global mediump 4-component vector of int) +0:251 texture (global highp 4-component vector of int) 0:251 'CA6' (uniform highp isamplerCubeArray) 0:251 Constant: 0:251 0.500000 @@ -1419,7 +1419,7 @@ ERROR: node is still EOpNull! 0:252 Sequence 0:252 move second child to first child (temp highp 4-component vector of uint) 0:252 'b7' (temp highp 4-component vector of uint) -0:252 texture (global mediump 4-component vector of uint) +0:252 texture (global highp 4-component vector of uint) 0:252 'CA7' (uniform highp usamplerCubeArray) 0:252 Constant: 0:252 0.500000 @@ -1492,59 +1492,59 @@ ERROR: node is still EOpNull! 0:283 Function Definition: badImageAtom( (global void) 0:283 Function Parameters: 0:? Sequence -0:289 imageAtomicAdd (global mediump int) +0:289 imageAtomicAdd (global highp int) 0:289 'im2Di' (layout(r32i ) uniform highp iimage2D) 0:289 'P' (uniform mediump 2-component vector of int) 0:289 'dati' (temp mediump int) -0:290 imageAtomicAdd (global mediump uint) +0:290 imageAtomicAdd (global highp uint) 0:290 'im2Du' (layout(r32ui ) uniform highp uimage2D) 0:290 'P' (uniform mediump 2-component vector of int) 0:290 'datu' (temp mediump uint) -0:291 imageAtomicMin (global mediump int) +0:291 imageAtomicMin (global highp int) 0:291 'im2Di' (layout(r32i ) uniform highp iimage2D) 0:291 'P' (uniform mediump 2-component vector of int) 0:291 'dati' (temp mediump int) -0:292 imageAtomicMin (global mediump uint) +0:292 imageAtomicMin (global highp uint) 0:292 'im2Du' (layout(r32ui ) uniform highp uimage2D) 0:292 'P' (uniform mediump 2-component vector of int) 0:292 'datu' (temp mediump uint) -0:293 imageAtomicMax (global mediump int) +0:293 imageAtomicMax (global highp int) 0:293 'im2Di' (layout(r32i ) uniform highp iimage2D) 0:293 'P' (uniform mediump 2-component vector of int) 0:293 'dati' (temp mediump int) -0:294 imageAtomicMax (global mediump uint) +0:294 imageAtomicMax (global highp uint) 0:294 'im2Du' (layout(r32ui ) uniform highp uimage2D) 0:294 'P' (uniform mediump 2-component vector of int) 0:294 'datu' (temp mediump uint) -0:295 imageAtomicAnd (global mediump int) +0:295 imageAtomicAnd (global highp int) 0:295 'im2Di' (layout(r32i ) uniform highp iimage2D) 0:295 'P' (uniform mediump 2-component vector of int) 0:295 'dati' (temp mediump int) -0:296 imageAtomicAnd (global mediump uint) +0:296 imageAtomicAnd (global highp uint) 0:296 'im2Du' (layout(r32ui ) uniform highp uimage2D) 0:296 'P' (uniform mediump 2-component vector of int) 0:296 'datu' (temp mediump uint) -0:297 imageAtomicOr (global mediump int) +0:297 imageAtomicOr (global highp int) 0:297 'im2Di' (layout(r32i ) uniform highp iimage2D) 0:297 'P' (uniform mediump 2-component vector of int) 0:297 'dati' (temp mediump int) -0:298 imageAtomicOr (global mediump uint) +0:298 imageAtomicOr (global highp uint) 0:298 'im2Du' (layout(r32ui ) uniform highp uimage2D) 0:298 'P' (uniform mediump 2-component vector of int) 0:298 'datu' (temp mediump uint) -0:299 imageAtomicXor (global mediump int) +0:299 imageAtomicXor (global highp int) 0:299 'im2Di' (layout(r32i ) uniform highp iimage2D) 0:299 'P' (uniform mediump 2-component vector of int) 0:299 'dati' (temp mediump int) -0:300 imageAtomicXor (global mediump uint) +0:300 imageAtomicXor (global highp uint) 0:300 'im2Du' (layout(r32ui ) uniform highp uimage2D) 0:300 'P' (uniform mediump 2-component vector of int) 0:300 'datu' (temp mediump uint) -0:301 imageAtomicExchange (global mediump int) +0:301 imageAtomicExchange (global highp int) 0:301 'im2Di' (layout(r32i ) uniform highp iimage2D) 0:301 'P' (uniform mediump 2-component vector of int) 0:301 'dati' (temp mediump int) -0:302 imageAtomicExchange (global mediump uint) +0:302 imageAtomicExchange (global highp uint) 0:302 'im2Du' (layout(r32ui ) uniform highp uimage2D) 0:302 'P' (uniform mediump 2-component vector of int) 0:302 'datu' (temp mediump uint) @@ -1552,13 +1552,13 @@ ERROR: node is still EOpNull! 0:303 'im2Df' (layout(r32f ) uniform highp image2D) 0:303 'P' (uniform mediump 2-component vector of int) 0:303 'datf' (temp mediump float) -0:304 imageAtomicCompSwap (global mediump int) +0:304 imageAtomicCompSwap (global highp int) 0:304 'im2Di' (layout(r32i ) uniform highp iimage2D) 0:304 'P' (uniform mediump 2-component vector of int) 0:304 Constant: 0:304 3 (const int) 0:304 'dati' (temp mediump int) -0:305 imageAtomicCompSwap (global mediump uint) +0:305 imageAtomicCompSwap (global highp uint) 0:305 'im2Du' (layout(r32ui ) uniform highp uimage2D) 0:305 'P' (uniform mediump 2-component vector of int) 0:305 Constant: @@ -1567,59 +1567,59 @@ ERROR: node is still EOpNull! 0:316 Function Definition: goodImageAtom( (global void) 0:316 Function Parameters: 0:? Sequence -0:322 imageAtomicAdd (global mediump int) +0:322 imageAtomicAdd (global highp int) 0:322 'im2Di' (layout(r32i ) uniform highp iimage2D) 0:322 'P' (uniform mediump 2-component vector of int) 0:322 'dati' (temp mediump int) -0:323 imageAtomicAdd (global mediump uint) +0:323 imageAtomicAdd (global highp uint) 0:323 'im2Du' (layout(r32ui ) uniform highp uimage2D) 0:323 'P' (uniform mediump 2-component vector of int) 0:323 'datu' (temp mediump uint) -0:324 imageAtomicMin (global mediump int) +0:324 imageAtomicMin (global highp int) 0:324 'im2Di' (layout(r32i ) uniform highp iimage2D) 0:324 'P' (uniform mediump 2-component vector of int) 0:324 'dati' (temp mediump int) -0:325 imageAtomicMin (global mediump uint) +0:325 imageAtomicMin (global highp uint) 0:325 'im2Du' (layout(r32ui ) uniform highp uimage2D) 0:325 'P' (uniform mediump 2-component vector of int) 0:325 'datu' (temp mediump uint) -0:326 imageAtomicMax (global mediump int) +0:326 imageAtomicMax (global highp int) 0:326 'im2Di' (layout(r32i ) uniform highp iimage2D) 0:326 'P' (uniform mediump 2-component vector of int) 0:326 'dati' (temp mediump int) -0:327 imageAtomicMax (global mediump uint) +0:327 imageAtomicMax (global highp uint) 0:327 'im2Du' (layout(r32ui ) uniform highp uimage2D) 0:327 'P' (uniform mediump 2-component vector of int) 0:327 'datu' (temp mediump uint) -0:328 imageAtomicAnd (global mediump int) +0:328 imageAtomicAnd (global highp int) 0:328 'im2Di' (layout(r32i ) uniform highp iimage2D) 0:328 'P' (uniform mediump 2-component vector of int) 0:328 'dati' (temp mediump int) -0:329 imageAtomicAnd (global mediump uint) +0:329 imageAtomicAnd (global highp uint) 0:329 'im2Du' (layout(r32ui ) uniform highp uimage2D) 0:329 'P' (uniform mediump 2-component vector of int) 0:329 'datu' (temp mediump uint) -0:330 imageAtomicOr (global mediump int) +0:330 imageAtomicOr (global highp int) 0:330 'im2Di' (layout(r32i ) uniform highp iimage2D) 0:330 'P' (uniform mediump 2-component vector of int) 0:330 'dati' (temp mediump int) -0:331 imageAtomicOr (global mediump uint) +0:331 imageAtomicOr (global highp uint) 0:331 'im2Du' (layout(r32ui ) uniform highp uimage2D) 0:331 'P' (uniform mediump 2-component vector of int) 0:331 'datu' (temp mediump uint) -0:332 imageAtomicXor (global mediump int) +0:332 imageAtomicXor (global highp int) 0:332 'im2Di' (layout(r32i ) uniform highp iimage2D) 0:332 'P' (uniform mediump 2-component vector of int) 0:332 'dati' (temp mediump int) -0:333 imageAtomicXor (global mediump uint) +0:333 imageAtomicXor (global highp uint) 0:333 'im2Du' (layout(r32ui ) uniform highp uimage2D) 0:333 'P' (uniform mediump 2-component vector of int) 0:333 'datu' (temp mediump uint) -0:334 imageAtomicExchange (global mediump int) +0:334 imageAtomicExchange (global highp int) 0:334 'im2Di' (layout(r32i ) uniform highp iimage2D) 0:334 'P' (uniform mediump 2-component vector of int) 0:334 'dati' (temp mediump int) -0:335 imageAtomicExchange (global mediump uint) +0:335 imageAtomicExchange (global highp uint) 0:335 'im2Du' (layout(r32ui ) uniform highp uimage2D) 0:335 'P' (uniform mediump 2-component vector of int) 0:335 'datu' (temp mediump uint) @@ -1627,23 +1627,23 @@ ERROR: node is still EOpNull! 0:336 'im2Df' (layout(r32f ) uniform highp image2D) 0:336 'P' (uniform mediump 2-component vector of int) 0:336 'datf' (temp mediump float) -0:337 imageAtomicCompSwap (global mediump int) +0:337 imageAtomicCompSwap (global highp int) 0:337 'im2Di' (layout(r32i ) uniform highp iimage2D) 0:337 'P' (uniform mediump 2-component vector of int) 0:337 Constant: 0:337 3 (const int) 0:337 'dati' (temp mediump int) -0:338 imageAtomicCompSwap (global mediump uint) +0:338 imageAtomicCompSwap (global highp uint) 0:338 'im2Du' (layout(r32ui ) uniform highp uimage2D) 0:338 'P' (uniform mediump 2-component vector of int) 0:338 Constant: 0:338 5 (const uint) 0:338 'datu' (temp mediump uint) -0:340 imageAtomicMax (global mediump int) +0:340 imageAtomicMax (global highp int) 0:340 'badIm2Di' (layout(rgba16i ) uniform highp iimage2D) 0:340 'P' (uniform mediump 2-component vector of int) 0:340 'dati' (temp mediump int) -0:341 imageAtomicMax (global mediump uint) +0:341 imageAtomicMax (global highp uint) 0:341 'badIm2Du' (layout(rgba8ui ) uniform highp uimage2D) 0:341 'P' (uniform mediump 2-component vector of int) 0:341 'datu' (temp mediump uint) diff --git a/Test/baseResults/310.vert.out b/Test/baseResults/310.vert.out index 73a33c4b..f42b44c1 100644 --- a/Test/baseResults/310.vert.out +++ b/Test/baseResults/310.vert.out @@ -186,11 +186,11 @@ ERROR: node is still EOpNull! 0:33 'u3' (temp highp 3-component vector of uint) 0:34 move second child to first child (temp highp 2-component vector of int) 0:34 'i2' (temp highp 2-component vector of int) -0:34 findLSB (global highp 2-component vector of int) +0:34 findLSB (global lowp 2-component vector of int) 0:34 'i2' (temp highp 2-component vector of int) 0:35 move second child to first child (temp highp 4-component vector of int) 0:35 'i4' (temp highp 4-component vector of int) -0:35 findLSB (global highp 4-component vector of int) +0:35 findLSB (global lowp 4-component vector of int) 0:35 'u4' (temp highp 4-component vector of uint) 0:36 move second child to first child (temp highp int) 0:36 'i1' (temp highp int) @@ -1117,11 +1117,11 @@ ERROR: node is still EOpNull! 0:33 'u3' (temp highp 3-component vector of uint) 0:34 move second child to first child (temp highp 2-component vector of int) 0:34 'i2' (temp highp 2-component vector of int) -0:34 findLSB (global highp 2-component vector of int) +0:34 findLSB (global lowp 2-component vector of int) 0:34 'i2' (temp highp 2-component vector of int) 0:35 move second child to first child (temp highp 4-component vector of int) 0:35 'i4' (temp highp 4-component vector of int) -0:35 findLSB (global highp 4-component vector of int) +0:35 findLSB (global lowp 4-component vector of int) 0:35 'u4' (temp highp 4-component vector of uint) 0:36 move second child to first child (temp highp int) 0:36 'i1' (temp highp int) diff --git a/Test/baseResults/precision.vert.out b/Test/baseResults/precision.vert.out index 69b0e962..f433ba52 100644 --- a/Test/baseResults/precision.vert.out +++ b/Test/baseResults/precision.vert.out @@ -13,7 +13,7 @@ ERROR: node is still EOpNull! 0:20 Sequence 0:20 move second child to first child (temp highp 4-component vector of float) 0:20 't' (temp highp 4-component vector of float) -0:20 texture (global highp 4-component vector of float) +0:20 texture (global lowp 4-component vector of float) 0:20 's2D' (uniform lowp sampler2D) 0:20 Constant: 0:20 0.100000 @@ -27,7 +27,7 @@ ERROR: node is still EOpNull! 0:21 0.200000 0:22 add second child into first child (temp highp 4-component vector of float) 0:22 't' (temp highp 4-component vector of float) -0:22 texture (global highp float) +0:22 texture (global mediump float) 0:22 's2dAS' (uniform mediump sampler2DArrayShadow) 0:22 Constant: 0:22 0.500000 @@ -61,7 +61,7 @@ ERROR: node is still EOpNull! 0:20 Sequence 0:20 move second child to first child (temp highp 4-component vector of float) 0:20 't' (temp highp 4-component vector of float) -0:20 texture (global highp 4-component vector of float) +0:20 texture (global lowp 4-component vector of float) 0:20 's2D' (uniform lowp sampler2D) 0:20 Constant: 0:20 0.100000 @@ -75,7 +75,7 @@ ERROR: node is still EOpNull! 0:21 0.200000 0:22 add second child into first child (temp highp 4-component vector of float) 0:22 't' (temp highp 4-component vector of float) -0:22 texture (global highp float) +0:22 texture (global mediump float) 0:22 's2dAS' (uniform mediump sampler2DArrayShadow) 0:22 Constant: 0:22 0.500000 diff --git a/Test/baseResults/spv.intOps.vert.out b/Test/baseResults/spv.intOps.vert.out index bbab470f..a279c188 100644 --- a/Test/baseResults/spv.intOps.vert.out +++ b/Test/baseResults/spv.intOps.vert.out @@ -44,6 +44,8 @@ Linked vertex stage: Name 173 "u3" Name 182 "i3" Name 247 "v4" + Decorate 223 RelaxedPrecision + Decorate 230 RelaxedPrecision Decorate 261 RelaxedPrecision Decorate 265 RelaxedPrecision 2: TypeVoid diff --git a/Test/baseResults/uint.frag.out b/Test/baseResults/uint.frag.out index c06ad846..dbe9578d 100644 --- a/Test/baseResults/uint.frag.out +++ b/Test/baseResults/uint.frag.out @@ -113,7 +113,7 @@ ERROR: node is still EOpNull! 0:55 true case 0:56 move second child to first child (temp mediump 4-component vector of uint) 0:56 'c' (out mediump 4-component vector of uint) -0:56 texture (global mediump 4-component vector of uint) +0:56 texture (global lowp 4-component vector of uint) 0:56 'usampler' (uniform lowp usampler2D) 0:56 'tc' (smooth in highp 2-component vector of float) 0:57 Test condition and select (temp void) @@ -124,7 +124,7 @@ ERROR: node is still EOpNull! 0:57 true case 0:58 move second child to first child (temp mediump 4-component vector of uint) 0:58 'c' (out mediump 4-component vector of uint) -0:58 texture (global mediump 4-component vector of uint) +0:58 texture (global lowp 4-component vector of uint) 0:58 'usampler' (uniform lowp usampler2D) 0:58 add (temp highp 2-component vector of float) 0:58 'tc' (smooth in highp 2-component vector of float) @@ -139,7 +139,7 @@ ERROR: node is still EOpNull! 0:59 true case 0:60 move second child to first child (temp mediump 4-component vector of uint) 0:60 'c' (out mediump 4-component vector of uint) -0:60 texture (global mediump 4-component vector of uint) +0:60 texture (global lowp 4-component vector of uint) 0:60 'usampler' (uniform lowp usampler2D) 0:60 subtract (temp highp 2-component vector of float) 0:60 'tc' (smooth in highp 2-component vector of float) @@ -412,7 +412,7 @@ ERROR: node is still EOpNull! 0:55 true case 0:56 move second child to first child (temp mediump 4-component vector of uint) 0:56 'c' (out mediump 4-component vector of uint) -0:56 texture (global mediump 4-component vector of uint) +0:56 texture (global lowp 4-component vector of uint) 0:56 'usampler' (uniform lowp usampler2D) 0:56 'tc' (smooth in highp 2-component vector of float) 0:57 Test condition and select (temp void) @@ -423,7 +423,7 @@ ERROR: node is still EOpNull! 0:57 true case 0:58 move second child to first child (temp mediump 4-component vector of uint) 0:58 'c' (out mediump 4-component vector of uint) -0:58 texture (global mediump 4-component vector of uint) +0:58 texture (global lowp 4-component vector of uint) 0:58 'usampler' (uniform lowp usampler2D) 0:58 add (temp highp 2-component vector of float) 0:58 'tc' (smooth in highp 2-component vector of float) @@ -438,7 +438,7 @@ ERROR: node is still EOpNull! 0:59 true case 0:60 move second child to first child (temp mediump 4-component vector of uint) 0:60 'c' (out mediump 4-component vector of uint) -0:60 texture (global mediump 4-component vector of uint) +0:60 texture (global lowp 4-component vector of uint) 0:60 'usampler' (uniform lowp usampler2D) 0:60 subtract (temp highp 2-component vector of float) 0:60 'tc' (smooth in highp 2-component vector of float) diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp index e2bd4531..0b27ddd9 100644 --- a/glslang/MachineIndependent/Initialize.cpp +++ b/glslang/MachineIndependent/Initialize.cpp @@ -778,16 +778,16 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan) "uint atomicMin(coherent volatile inout uint, uint);" " int atomicMin(coherent volatile inout int, int);" - + "uint atomicMax(coherent volatile inout uint, uint);" " int atomicMax(coherent volatile inout int, int);" - + "uint atomicAnd(coherent volatile inout uint, uint);" " int atomicAnd(coherent volatile inout int, int);" - + "uint atomicOr (coherent volatile inout uint, uint);" " int atomicOr (coherent volatile inout int, int);" - + "uint atomicXor(coherent volatile inout uint, uint);" " int atomicXor(coherent volatile inout int, int);" @@ -1242,15 +1242,15 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan) if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 400)) { commonBuiltins.append( - " uint uaddCarry( uint, uint, out uint carry);" - "uvec2 uaddCarry(uvec2, uvec2, out uvec2 carry);" - "uvec3 uaddCarry(uvec3, uvec3, out uvec3 carry);" - "uvec4 uaddCarry(uvec4, uvec4, out uvec4 carry);" + "highp uint uaddCarry( uint, uint, out uint carry);" + "highp uvec2 uaddCarry(uvec2, uvec2, out uvec2 carry);" + "highp uvec3 uaddCarry(uvec3, uvec3, out uvec3 carry);" + "highp uvec4 uaddCarry(uvec4, uvec4, out uvec4 carry);" - " uint usubBorrow( uint, uint, out uint borrow);" - "uvec2 usubBorrow(uvec2, uvec2, out uvec2 borrow);" - "uvec3 usubBorrow(uvec3, uvec3, out uvec3 borrow);" - "uvec4 usubBorrow(uvec4, uvec4, out uvec4 borrow);" + "highp uint usubBorrow( uint, uint, out uint borrow);" + "highp uvec2 usubBorrow(uvec2, uvec2, out uvec2 borrow);" + "highp uvec3 usubBorrow(uvec3, uvec3, out uvec3 borrow);" + "highp uvec4 usubBorrow(uvec4, uvec4, out uvec4 borrow);" "void umulExtended( uint, uint, out uint, out uint lsb);" "void umulExtended(uvec2, uvec2, out uvec2, out uvec2 lsb);" @@ -1302,15 +1302,15 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan) "ivec3 bitCount(uvec3);" "ivec4 bitCount(uvec4);" - " int findLSB( int);" - "ivec2 findLSB(ivec2);" - "ivec3 findLSB(ivec3);" - "ivec4 findLSB(ivec4);" + "lowp int findLSB( int);" + "lowp ivec2 findLSB(ivec2);" + "lowp ivec3 findLSB(ivec3);" + "lowp ivec4 findLSB(ivec4);" - " int findLSB( uint);" - "ivec2 findLSB(uvec2);" - "ivec3 findLSB(uvec3);" - "ivec4 findLSB(uvec4);" + "lowp int findLSB( uint);" + "lowp ivec2 findLSB(uvec2);" + "lowp ivec3 findLSB(uvec3);" + "lowp ivec4 findLSB(uvec4);" " int findMSB( int);" "ivec2 findMSB(ivec2);" @@ -1731,14 +1731,14 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan) if ((profile != EEsProfile && version >= 430) || (profile == EEsProfile && version >= 310)) { stageBuiltins[EShLangCompute].append( - "in uvec3 gl_NumWorkGroups;" - "const uvec3 gl_WorkGroupSize = uvec3(1,1,1);" + "in highp uvec3 gl_NumWorkGroups;" + "const highp uvec3 gl_WorkGroupSize = uvec3(1,1,1);" - "in uvec3 gl_WorkGroupID;" - "in uvec3 gl_LocalInvocationID;" + "in highp uvec3 gl_WorkGroupID;" + "in highp uvec3 gl_LocalInvocationID;" - "in uvec3 gl_GlobalInvocationID;" - "in uint gl_LocalInvocationIndex;" + "in highp uvec3 gl_GlobalInvocationID;" + "in highp uint gl_LocalInvocationIndex;" "\n"); } @@ -1976,12 +1976,12 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan) "in highp int gl_InvocationID;" "\n" "out gl_PerVertex {" - "vec4 gl_Position;" - "float gl_PointSize;" + "highp vec4 gl_Position;" + "highp float gl_PointSize;" "};" "\n" - "out int gl_PrimitiveID;" - "out int gl_Layer;" + "out highp int gl_PrimitiveID;" + "out highp int gl_Layer;" "\n" ); } @@ -2102,8 +2102,8 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan) "patch in highp float gl_TessLevelInner[2];" "out gl_PerVertex {" - "vec4 gl_Position;" - "float gl_PointSize;" + "highp vec4 gl_Position;" + "highp float gl_PointSize;" ); stageBuiltins[EShLangTessEvaluation].append( "};" @@ -2444,6 +2444,8 @@ void TBuiltIns::addImageFunctions(TSampler sampler, TString& typeName, int versi if (sampler.ms) imageParams.append(", int"); + if (profile == EEsProfile) + commonBuiltins.append("highp "); commonBuiltins.append(prefixes[sampler.type]); commonBuiltins.append("vec4 imageLoad(readonly volatile coherent "); commonBuiltins.append(imageParams); @@ -2467,7 +2469,7 @@ void TBuiltIns::addImageFunctions(TSampler sampler, TString& typeName, int versi if ( profile != EEsProfile || (profile == EEsProfile && version >= 310)) { if (sampler.type == EbtInt || sampler.type == EbtUint) { - const char* dataType = sampler.type == EbtInt ? "int" : "uint"; + const char* dataType = sampler.type == EbtInt ? "highp int" : "highp uint"; const int numBuiltins = 7; diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index c9ca5d30..aa9ea574 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -69,7 +69,7 @@ TParseContext::TParseContext(TSymbolTable& symbolTable, TIntermediate& interm, b for (int type = 0; type < maxSamplerIndex; ++type) defaultSamplerPrecision[type] = EpqNone; - // replace with real defaults for those that have them + // replace with real precision defaults for those that have them if (profile == EEsProfile) { TSampler sampler; sampler.set(EbtFloat, Esd2D); @@ -80,16 +80,22 @@ TParseContext::TParseContext(TSymbolTable& symbolTable, TIntermediate& interm, b sampler.external = true; defaultSamplerPrecision[computeSamplerTypeIndex(sampler)] = EpqLow; - switch (language) { - case EShLangFragment: - defaultPrecision[EbtInt] = EpqMedium; - defaultPrecision[EbtUint] = EpqMedium; - break; - default: - defaultPrecision[EbtInt] = EpqHigh; - defaultPrecision[EbtUint] = EpqHigh; - defaultPrecision[EbtFloat] = EpqHigh; - break; + // If we are parsing built-in computational variables/functions, it is meaningful to record + // whether the built-in has no precision qualifier, as that ambiguity + // 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) { + switch (language) { + case EShLangFragment: + defaultPrecision[EbtInt] = EpqMedium; + defaultPrecision[EbtUint] = EpqMedium; + break; + default: + defaultPrecision[EbtInt] = EpqHigh; + defaultPrecision[EbtUint] = EpqHigh; + defaultPrecision[EbtFloat] = EpqHigh; + break; + } } defaultPrecision[EbtSampler] = EpqLow; diff --git a/glslang/MachineIndependent/ParseHelper.h b/glslang/MachineIndependent/ParseHelper.h index ea5d0baf..a4775e71 100644 --- a/glslang/MachineIndependent/ParseHelper.h +++ b/glslang/MachineIndependent/ParseHelper.h @@ -334,7 +334,7 @@ protected: TParseContext(TParseContext&); TParseContext& operator=(TParseContext&); - bool parsingBuiltins; // true if parsing built-in symbols/functions + const bool parsingBuiltins; // true if parsing built-in symbols/functions static const int maxSamplerIndex = EsdNumDims * (EbtNumTypes * (2 * 2 * 2)); // see computeSamplerTypeIndex() TPrecisionQualifier defaultSamplerPrecision[maxSamplerIndex]; bool afterEOF; From e512cd943ed25174273f7520bd32346f4659597b Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Tue, 3 May 2016 21:17:55 -0600 Subject: [PATCH 043/140] Vulkan: Add the #define VULKAN 100 when compiled for Vulkan. Note this requires test-based piecing together of the preamble string, so it changed to being a std::string to make it easier to do. This closes issue #254. --- Test/nonVulkan.frag | 6 +++++- Test/vulkan.vert | 8 ++++++++ glslang/MachineIndependent/ShaderLang.cpp | 4 +++- glslang/MachineIndependent/Versions.cpp | 22 ++++++++++++---------- glslang/MachineIndependent/parseVersions.h | 2 +- hlsl/hlslParseHelper.h | 2 +- 6 files changed, 30 insertions(+), 14 deletions(-) diff --git a/Test/nonVulkan.frag b/Test/nonVulkan.frag index c8cf4674..425e8402 100644 --- a/Test/nonVulkan.frag +++ b/Test/nonVulkan.frag @@ -2,4 +2,8 @@ layout(constant_id = 17) const int arraySize = 12; // ERROR layout(input_attachment_index = 1) int foo; // ERROR -layout(push_constant) uniform ubn { int a; } ubi; // ERROR \ No newline at end of file +layout(push_constant) uniform ubn { int a; } ubi; // ERROR + +#ifdef VULKAN +#error VULKAN should not be defined +#endif diff --git a/Test/vulkan.vert b/Test/vulkan.vert index ad33a53b..b234c75b 100644 --- a/Test/vulkan.vert +++ b/Test/vulkan.vert @@ -37,3 +37,11 @@ void foo() } layout(set = 1, push_constant) uniform badpc { int a; } badpcI; // ERROR, no descriptor set with push_constant + +#ifndef VULKAN +#error VULKAN should be defined +#endif + +#if VULKAN != 100 +#error VULKAN should be 100 +#endif diff --git a/glslang/MachineIndependent/ShaderLang.cpp b/glslang/MachineIndependent/ShaderLang.cpp index 6034f1ab..5fd6f421 100644 --- a/glslang/MachineIndependent/ShaderLang.cpp +++ b/glslang/MachineIndependent/ShaderLang.cpp @@ -629,7 +629,9 @@ bool ProcessDeferred( parseContext->initializeExtensionBehavior(); // Fill in the strings as outlined above. - strings[0] = parseContext->getPreamble(); + std::string preamble; + parseContext->getPreamble(preamble); + strings[0] = preamble.c_str(); lengths[0] = strlen(strings[0]); names[0] = nullptr; strings[1] = customPreamble; diff --git a/glslang/MachineIndependent/Versions.cpp b/glslang/MachineIndependent/Versions.cpp index 019caf9b..911535af 100644 --- a/glslang/MachineIndependent/Versions.cpp +++ b/glslang/MachineIndependent/Versions.cpp @@ -215,10 +215,10 @@ void TParseVersions::initializeExtensionBehavior() // 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). -const char* TParseVersions::getPreamble() +void TParseVersions::getPreamble(std::string& preamble) { if (profile == EEsProfile) { - return + preamble = "#define GL_ES 1\n" "#define GL_FRAGMENT_PRECISION_HIGH 1\n" "#define GL_OES_texture_3D 1\n" @@ -227,10 +227,6 @@ const char* TParseVersions::getPreamble() "#define GL_OES_EGL_image_external 1\n" "#define GL_EXT_shader_texture_lod 1\n" - // #line and #include - "#define GL_GOOGLE_cpp_style_line_directive 1\n" - "#define GL_GOOGLE_include_directive 1\n" - // AEP "#define GL_ANDROID_extension_pack_es31a 1\n" "#define GL_KHR_blend_equation_advanced 1\n" @@ -260,7 +256,7 @@ const char* TParseVersions::getPreamble() "#define GL_OES_texture_cube_map_array 1\n" ; } else { - return + preamble = "#define GL_FRAGMENT_PRECISION_HIGH 1\n" "#define GL_ARB_texture_rectangle 1\n" "#define GL_ARB_shading_language_420pack 1\n" @@ -283,12 +279,18 @@ const char* TParseVersions::getPreamble() "#define GL_ARB_gl_spirv 1\n" "#define GL_ARB_sparse_texture2 1\n" "#define GL_ARB_sparse_texture_clamp 1\n" - - "#define GL_GOOGLE_cpp_style_line_directive 1\n" - "#define GL_GOOGLE_include_directive 1\n" // "#define GL_ARB_cull_distance 1\n" // present for 4.5, but need extension control over block members ; } + + // #line and #include + preamble += + "#define GL_GOOGLE_cpp_style_line_directive 1\n" + "#define GL_GOOGLE_include_directive 1\n" + ; + + if (vulkan > 0) + preamble += "#define VULKAN 100\n"; } // diff --git a/glslang/MachineIndependent/parseVersions.h b/glslang/MachineIndependent/parseVersions.h index 13d76805..0eebb10a 100755 --- a/glslang/MachineIndependent/parseVersions.h +++ b/glslang/MachineIndependent/parseVersions.h @@ -104,7 +104,7 @@ public: void setCurrentSourceName(const char* name) { currentScanner->setFile(name); } void setCurrentString(int string) { currentScanner->setString(string); } - const char* getPreamble(); + void getPreamble(std::string&); bool relaxedErrors() const { return (messages & EShMsgRelaxedErrors) != 0; } bool suppressWarnings() const { return (messages & EShMsgSuppressWarnings) != 0; } diff --git a/hlsl/hlslParseHelper.h b/hlsl/hlslParseHelper.h index 88a3fe2f..661fd97b 100755 --- a/hlsl/hlslParseHelper.h +++ b/hlsl/hlslParseHelper.h @@ -48,7 +48,7 @@ public: virtual ~HlslParseContext(); void setLimits(const TBuiltInResource&); bool parseShaderStrings(TPpContext&, TInputScanner& input, bool versionWillBeError = false); - const char* getPreamble(); + void getPreamble(std::string&); void C_DECL error(const TSourceLoc&, const char* szReason, const char* szToken, const char* szExtraInfoFormat, ...); From 9c86c6ab5bc1b119e3f25a9066d2c8825498f97c Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Tue, 3 May 2016 22:49:24 -0600 Subject: [PATCH 044/140] HLSL: Separate out token stream handling from grammar recognition. --- hlsl/CMakeLists.txt | 2 ++ hlsl/hlslGrammar.cpp | 31 ++---------------- hlsl/hlslGrammar.h | 13 ++------ hlsl/hlslTokenStream.cpp | 71 ++++++++++++++++++++++++++++++++++++++++ hlsl/hlslTokenStream.h | 64 ++++++++++++++++++++++++++++++++++++ 5 files changed, 143 insertions(+), 38 deletions(-) create mode 100755 hlsl/hlslTokenStream.cpp create mode 100755 hlsl/hlslTokenStream.h diff --git a/hlsl/CMakeLists.txt b/hlsl/CMakeLists.txt index acc69f08..96028f6f 100755 --- a/hlsl/CMakeLists.txt +++ b/hlsl/CMakeLists.txt @@ -3,12 +3,14 @@ cmake_minimum_required(VERSION 2.8) set(SOURCES hlslParseHelper.cpp hlslScanContext.cpp + hlslTokenStream.cpp hlslGrammar.cpp) set(HEADERS hlslParseHelper.h hlslTokens.h hlslScanContext.h + hlslTokenStream.h hlslGrammar.h) add_library(HLSL STATIC ${SOURCES} ${HEADERS}) diff --git a/hlsl/hlslGrammar.cpp b/hlsl/hlslGrammar.cpp index 4528a191..40c35cae 100755 --- a/hlsl/hlslGrammar.cpp +++ b/hlsl/hlslGrammar.cpp @@ -68,31 +68,6 @@ void HlslGrammar::expected(const char* syntax) parseContext.error(token.loc, "Expected", syntax, ""); } -// Load 'token' with the next token in the stream of tokens. -void HlslGrammar::advanceToken() -{ - scanner.tokenize(token); -} - -// Return true and advance to the next token if the current token is the -// expected (passed in) token class. -bool HlslGrammar::acceptTokenClass(EHlslTokenClass tokenClass) -{ - if (token.tokenClass == tokenClass) { - advanceToken(); - return true; - } - - return false; -} - -// Return true, without advancing to the next token, if the current token is -// the expected (passed in) token class. -bool HlslGrammar::peekTokenClass(EHlslTokenClass tokenClass) -{ - return token.tokenClass == tokenClass; -} - // Only process the next token if it is an identifier. // Return true if it was an identifier. bool HlslGrammar::acceptIdentifier(HlslToken& idToken) @@ -113,7 +88,7 @@ bool HlslGrammar::acceptCompilationUnit() { TIntermNode* unitNode = nullptr; - while (token.tokenClass != EHTokNone) { + while (! peekTokenClass(EHTokNone)) { // externalDeclaration TIntermNode* declarationNode; if (! acceptDeclaration(declarationNode)) @@ -215,7 +190,7 @@ bool HlslGrammar::acceptFullySpecifiedType(TType& type) // qualifier. Otherwise, return false, and don't advance. void HlslGrammar::acceptQualifier(TQualifier& qualifier) { - switch (token.tokenClass) { + switch (peek()) { case EHTokUniform: qualifier.storage = EvqUniform; break; @@ -237,7 +212,7 @@ bool HlslGrammar::acceptType(TType& type) if (! token.isType) return false; - switch (token.tokenClass) { + switch (peek()) { case EHTokInt: case EHTokInt1: case EHTokDword: diff --git a/hlsl/hlslGrammar.h b/hlsl/hlslGrammar.h index 902ba228..8b9b2897 100755 --- a/hlsl/hlslGrammar.h +++ b/hlsl/hlslGrammar.h @@ -36,29 +36,25 @@ #ifndef HLSLGRAMMAR_H_ #define HLSLGRAMMAR_H_ -#include "hlslScanContext.h" #include "hlslParseHelper.h" +#include "hlslTokenStream.h" namespace glslang { // Should just be the grammar aspect of HLSL. // Described in more detail in hlslGrammar.cpp. - class HlslGrammar { + class HlslGrammar : public HlslTokenStream { public: HlslGrammar(HlslScanContext& scanner, HlslParseContext& parseContext) - : scanner(scanner), parseContext(parseContext), intermediate(parseContext.intermediate) { } + : HlslTokenStream(scanner), parseContext(parseContext), intermediate(parseContext.intermediate) { } virtual ~HlslGrammar() { } bool parse(); protected: void expected(const char*); - void advanceToken(); - bool acceptTokenClass(EHlslTokenClass); - bool peekTokenClass(EHlslTokenClass); bool acceptIdentifier(HlslToken&); - bool acceptCompilationUnit(); bool acceptDeclaration(TIntermNode*& node); bool acceptFullySpecifiedType(TType&); @@ -76,11 +72,8 @@ namespace glslang { bool acceptStatement(TIntermNode*&); bool acceptSemantic(); - HlslScanContext& scanner; // lexical scanner, to get next token HlslParseContext& parseContext; // state of parsing and helper functions for building the intermediate TIntermediate& intermediate; // the final product, the intermediate representation, includes the AST - - HlslToken token; // the current token we are processing }; } // end namespace glslang diff --git a/hlsl/hlslTokenStream.cpp b/hlsl/hlslTokenStream.cpp new file mode 100755 index 00000000..cfc1101b --- /dev/null +++ b/hlsl/hlslTokenStream.cpp @@ -0,0 +1,71 @@ +// +//Copyright (C) 2016 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 Google, Inc., 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 "hlslTokenStream.h" + +namespace glslang { + +// Load 'token' with the next token in the stream of tokens. +void HlslTokenStream::advanceToken() +{ + scanner.tokenize(token); +} + +// Return the current token class. +EHlslTokenClass HlslTokenStream::peek() const +{ + return token.tokenClass; +} + +// Return true, without advancing to the next token, if the current token is +// the expected (passed in) token class. +bool HlslTokenStream::peekTokenClass(EHlslTokenClass tokenClass) const +{ + return peek() == tokenClass; +} + +// Return true and advance to the next token if the current token is the +// expected (passed in) token class. +bool HlslTokenStream::acceptTokenClass(EHlslTokenClass tokenClass) +{ + if (peekTokenClass(tokenClass)) { + advanceToken(); + return true; + } + + return false; +} + +} // end namespace glslang diff --git a/hlsl/hlslTokenStream.h b/hlsl/hlslTokenStream.h new file mode 100755 index 00000000..4fad8148 --- /dev/null +++ b/hlsl/hlslTokenStream.h @@ -0,0 +1,64 @@ +// +//Copyright (C) 2016 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 Google, Inc., 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. +// + +#ifndef HLSLTOKENSTREAM_H_ +#define HLSLTOKENSTREAM_H_ + +#include "hlslScanContext.h" + +namespace glslang { + + class HlslTokenStream { + public: + HlslTokenStream(HlslScanContext& scanner) + : scanner(scanner) { } + virtual ~HlslTokenStream() { } + + public: + void advanceToken(); + bool acceptTokenClass(EHlslTokenClass); + EHlslTokenClass peek() const; + bool peekTokenClass(EHlslTokenClass) const; + + protected: + HlslToken token; // the current token we are processing + + private: + HlslScanContext& scanner; // lexical scanner, to get next token + }; + +} // end namespace glslang + +#endif // HLSLTOKENSTREAM_H_ From 34fb036a9c52fc4bfec6d841dbb15e46f51043d5 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Tue, 3 May 2016 23:17:20 -0600 Subject: [PATCH 045/140] HLSL: Add (almost) full expression grammar: Binary, unary (pre/post-fix), assign, ... --- Test/baseResults/hlsl.frag.out | 103 ++++++++---- Test/hlsl.frag | 8 +- hlsl/CMakeLists.txt | 2 + hlsl/hlslGrammar.cpp | 283 ++++++++++++++++++++++++++------- hlsl/hlslGrammar.h | 7 +- hlsl/hlslOpMap.cpp | 171 ++++++++++++++++++++ hlsl/hlslOpMap.h | 69 ++++++++ hlsl/hlslScanContext.cpp | 2 +- hlsl/hlslTokenStream.h | 2 +- hlsl/hlslTokens.h | 2 +- 10 files changed, 550 insertions(+), 99 deletions(-) create mode 100755 hlsl/hlslOpMap.cpp create mode 100755 hlsl/hlslOpMap.h diff --git a/Test/baseResults/hlsl.frag.out b/Test/baseResults/hlsl.frag.out index 0fae4aea..9afecf12 100644 --- a/Test/baseResults/hlsl.frag.out +++ b/Test/baseResults/hlsl.frag.out @@ -2,23 +2,41 @@ hlsl.frag Shader version: 100 gl_FragCoord origin is upper left 0:? Sequence -0:1 move second child to first child (temp 4-component vector of float) -0:1 'AmbientColor' (temp 4-component vector of float) -0:? Constant: -0:? 1.000000 -0:? 0.500000 -0:? 0.000000 -0:? 1.000000 -0:8 Function Definition: PixelShaderFunction(vf4; (temp 4-component vector of float) +0:12 Function Definition: PixelShaderFunction(vf4; (temp 4-component vector of float) 0:5 Function Parameters: 0:5 'input' (temp 4-component vector of float) 0:? Sequence -0:6 Branch: Return with expression -0:6 add (temp 4-component vector of float) -0:6 'input' (temp 4-component vector of float) -0:6 'AmbientColor' (temp 4-component vector of float) +0:7 Branch: Return with expression +0:7 add (temp 4-component vector of float) +0:7 component-wise multiply (temp 4-component vector of float) +0:7 'input' (temp 4-component vector of float) +0:7 'input' (temp 4-component vector of float) +0:7 component-wise multiply (temp 4-component vector of float) +0:7 'input' (temp 4-component vector of float) +0:7 'input' (temp 4-component vector of float) +0:8 Branch: Return with expression +0:8 add (temp 4-component vector of float) +0:8 add (temp 4-component vector of float) +0:8 'input' (temp 4-component vector of float) +0:8 component-wise multiply (temp 4-component vector of float) +0:8 'input' (temp 4-component vector of float) +0:8 'input' (temp 4-component vector of float) +0:8 'input' (temp 4-component vector of float) +0:9 Branch: Return with expression +0:9 component-wise multiply (temp 4-component vector of float) +0:9 Pre-Increment (temp 4-component vector of float) +0:9 'input' (temp 4-component vector of float) +0:9 Negate value (temp 4-component vector of float) +0:9 Negate value (temp 4-component vector of float) +0:9 Pre-Decrement (temp 4-component vector of float) +0:9 'input' (temp 4-component vector of float) +0:10 Branch: Return with expression +0:10 add (temp 4-component vector of float) +0:10 Post-Increment (temp 4-component vector of float) +0:10 'input' (temp 4-component vector of float) +0:10 Pre-Increment (temp 4-component vector of float) +0:10 'input' (temp 4-component vector of float) 0:? Linker Objects -0:? 'AmbientColor' (temp 4-component vector of float) Linked fragment stage: @@ -27,27 +45,45 @@ Linked fragment stage: Shader version: 100 gl_FragCoord origin is upper left 0:? Sequence -0:1 move second child to first child (temp 4-component vector of float) -0:1 'AmbientColor' (temp 4-component vector of float) -0:? Constant: -0:? 1.000000 -0:? 0.500000 -0:? 0.000000 -0:? 1.000000 -0:8 Function Definition: PixelShaderFunction(vf4; (temp 4-component vector of float) +0:12 Function Definition: PixelShaderFunction(vf4; (temp 4-component vector of float) 0:5 Function Parameters: 0:5 'input' (temp 4-component vector of float) 0:? Sequence -0:6 Branch: Return with expression -0:6 add (temp 4-component vector of float) -0:6 'input' (temp 4-component vector of float) -0:6 'AmbientColor' (temp 4-component vector of float) +0:7 Branch: Return with expression +0:7 add (temp 4-component vector of float) +0:7 component-wise multiply (temp 4-component vector of float) +0:7 'input' (temp 4-component vector of float) +0:7 'input' (temp 4-component vector of float) +0:7 component-wise multiply (temp 4-component vector of float) +0:7 'input' (temp 4-component vector of float) +0:7 'input' (temp 4-component vector of float) +0:8 Branch: Return with expression +0:8 add (temp 4-component vector of float) +0:8 add (temp 4-component vector of float) +0:8 'input' (temp 4-component vector of float) +0:8 component-wise multiply (temp 4-component vector of float) +0:8 'input' (temp 4-component vector of float) +0:8 'input' (temp 4-component vector of float) +0:8 'input' (temp 4-component vector of float) +0:9 Branch: Return with expression +0:9 component-wise multiply (temp 4-component vector of float) +0:9 Pre-Increment (temp 4-component vector of float) +0:9 'input' (temp 4-component vector of float) +0:9 Negate value (temp 4-component vector of float) +0:9 Negate value (temp 4-component vector of float) +0:9 Pre-Decrement (temp 4-component vector of float) +0:9 'input' (temp 4-component vector of float) +0:10 Branch: Return with expression +0:10 add (temp 4-component vector of float) +0:10 Post-Increment (temp 4-component vector of float) +0:10 'input' (temp 4-component vector of float) +0:10 Pre-Increment (temp 4-component vector of float) +0:10 'input' (temp 4-component vector of float) 0:? Linker Objects -0:? 'AmbientColor' (temp 4-component vector of float) // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 15 +// Id's are bound by 45 Capability Shader 1: ExtInstImport "GLSL.std.450" @@ -57,18 +93,21 @@ gl_FragCoord origin is upper left Source HLSL 100 Name 4 "PixelShaderFunction" Name 9 "input" - Name 11 "AmbientColor" 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 7: TypeVector 6(float) 4 8: TypePointer Function 7(fvec4) + 27: 6(float) Constant 1065353216 4(PixelShaderFunction): 2 Function None 3 5: Label 9(input): 8(ptr) Variable Function -11(AmbientColor): 8(ptr) Variable Function 10: 7(fvec4) Load 9(input) - 12: 7(fvec4) Load 11(AmbientColor) - 13: 7(fvec4) FAdd 10 12 - ReturnValue 13 + 11: 7(fvec4) Load 9(input) + 12: 7(fvec4) FMul 10 11 + 13: 7(fvec4) Load 9(input) + 14: 7(fvec4) Load 9(input) + 15: 7(fvec4) FMul 13 14 + 16: 7(fvec4) FAdd 12 15 + ReturnValue 16 FunctionEnd diff --git a/Test/hlsl.frag b/Test/hlsl.frag index 7ee58499..ac6aa230 100644 --- a/Test/hlsl.frag +++ b/Test/hlsl.frag @@ -1,7 +1,11 @@ -float4 AmbientColor = float4(1, 0.5, 0, 1); +//float4 AmbientColor = float4(1, 0.5, 0, 1); //float AmbientIntensity = 0.1; float4 PixelShaderFunction(float4 input) : COLOR0 { - return input /* * AmbientIntensity */ + AmbientColor; +// return input * AmbientIntensity + AmbientColor; + return input * input + input * input; + return input + input * input + input; + return ++input * -+-+--input; + return input++ + ++input; } diff --git a/hlsl/CMakeLists.txt b/hlsl/CMakeLists.txt index 96028f6f..6dd84fa3 100755 --- a/hlsl/CMakeLists.txt +++ b/hlsl/CMakeLists.txt @@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 2.8) set(SOURCES hlslParseHelper.cpp hlslScanContext.cpp + hlslOpMap.cpp hlslTokenStream.cpp hlslGrammar.cpp) @@ -10,6 +11,7 @@ set(HEADERS hlslParseHelper.h hlslTokens.h hlslScanContext.h + hlslOpMap.h hlslTokenStream.h hlslGrammar.h) diff --git a/hlsl/hlslGrammar.cpp b/hlsl/hlslGrammar.cpp index 40c35cae..2339c2d4 100755 --- a/hlsl/hlslGrammar.cpp +++ b/hlsl/hlslGrammar.cpp @@ -129,7 +129,7 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& node) if (acceptIdentifier(idToken)) { // = expression TIntermTyped* expressionNode = nullptr; - if (acceptTokenClass(EHTokEqual)) { + if (acceptTokenClass(EHTokAssign)) { if (! acceptExpression(expressionNode)) { expected("initializer"); return false; @@ -362,36 +362,171 @@ bool HlslGrammar::acceptFunctionDefinition(TFunction& function, TIntermNode*& no return false; } +// The top-level full expression recognizer. +// // expression -// : identifier -// | identifier operator identifier // todo: generalize to all expressions -// | LEFT_PAREN expression RIGHT_PAREN -// | constructor -// | literal +// : assignment_expression COMMA assignment_expression COMMA assignment_expression ... // bool HlslGrammar::acceptExpression(TIntermTyped*& node) { - // identifier - HlslToken idToken; - if (acceptIdentifier(idToken)) { - TIntermTyped* left = parseContext.handleVariable(idToken.loc, idToken.symbol, token.string); + // assignment_expression + if (! acceptAssignmentExpression(node)) + return false; - // operator? - TOperator op; - if (! acceptOperator(op)) - return true; + if (! peekTokenClass(EHTokComma)) + return true; + + do { + // ... COMMA TSourceLoc loc = token.loc; + advanceToken(); - // identifier - if (acceptIdentifier(idToken)) { - TIntermTyped* right = parseContext.handleVariable(idToken.loc, idToken.symbol, token.string); - node = intermediate.addBinaryMath(op, left, right, loc); - return true; + // ... assignment_expression + TIntermTyped* rightNode = nullptr; + if (! acceptAssignmentExpression(rightNode)) { + expected("assignment expression"); + return false; } + node = intermediate.addComma(node, rightNode, loc); + + if (! peekTokenClass(EHTokComma)) + return true; + } while (true); +} + +// Accept an assignment expression, where assignment operations +// associate right-to-left. This is, it is implicit, for example +// +// a op (b op (c op d)) +// +// assigment_expression +// : binary_expression op binary_expression op binary_expression ... +// +bool HlslGrammar::acceptAssignmentExpression(TIntermTyped*& node) +{ + if (! acceptBinaryExpression(node, PlLogicalOr)) + return false; + + TOperator assignOp = HlslOpMap::assignment(peek()); + if (assignOp == EOpNull) + return true; + + // ... op + TSourceLoc loc = token.loc; + advanceToken(); + + // ... binary_expression + // But, done by recursing this function, which automatically + // gets the right-to-left associativity. + TIntermTyped* rightNode = nullptr; + if (! acceptAssignmentExpression(rightNode)) { + expected("assignment expression"); return false; } + node = intermediate.addAssign(assignOp, node, rightNode, loc); + + if (! peekTokenClass(EHTokComma)) + return true; + + return true; +} + +// Accept a binary expression, for binary operations that +// associate left-to-right. This is, it is implicit, for example +// +// ((a op b) op c) op d +// +// binary_expression +// : expression op expression op expression ... +// +// where 'expression' is the next higher level in precedence. +// +bool HlslGrammar::acceptBinaryExpression(TIntermTyped*& node, PrecedenceLevel precedenceLevel) +{ + if (precedenceLevel > PlMul) + return acceptUnaryExpression(node); + + // assignment_expression + if (! acceptBinaryExpression(node, (PrecedenceLevel)(precedenceLevel + 1))) + return false; + + TOperator op = HlslOpMap::binary(peek()); + PrecedenceLevel tokenLevel = HlslOpMap::precedenceLevel(op); + if (tokenLevel < precedenceLevel) + return true; + + do { + // ... op + TSourceLoc loc = token.loc; + advanceToken(); + + // ... expression + TIntermTyped* rightNode = nullptr; + if (! acceptBinaryExpression(rightNode, (PrecedenceLevel)(precedenceLevel + 1))) { + expected("expression"); + return false; + } + + node = intermediate.addBinaryMath(op, node, rightNode, loc); + + if (! peekTokenClass(EHTokComma)) + return true; + } while (true); +} + +// unary_expression +// : + unary_expression +// | - unary_expression +// | ! unary_expression +// | ~ unary_expression +// | ++ unary_expression +// | -- unary_expression +// | postfix_expression +// +bool HlslGrammar::acceptUnaryExpression(TIntermTyped*& node) +{ + TOperator unaryOp = HlslOpMap::preUnary(peek()); + + // postfix_expression + if (unaryOp == EOpNull) + return acceptPostfixExpression(node); + + // op unary_expression + TSourceLoc loc = token.loc; + advanceToken(); + if (! acceptUnaryExpression(node)) + return false; + + // + is a no-op + if (unaryOp == EOpAdd) + return true; + + node = intermediate.addUnaryMath(unaryOp, node, loc); + + return node != nullptr; +} + +// postfix_expression +// : LEFT_PAREN expression RIGHT_PAREN +// | literal +// | constructor +// | identifier +// | function_call +// | postfix_expression LEFT_BRACKET integer_expression RIGHT_BRACKET +// | postfix_expression DOT IDENTIFIER +// | postfix_expression INC_OP +// | postfix_expression DEC_OP +// +bool HlslGrammar::acceptPostfixExpression(TIntermTyped*& node) +{ + // Not implemented as self-recursive: + // The logical "right recursion" is done with an loop at the end + + // idToken will pick up either a variable or a function name in a function call + HlslToken idToken; + // LEFT_PAREN expression RIGHT_PAREN if (acceptTokenClass(EHTokLeftParen)) { if (! acceptExpression(node)) { @@ -402,19 +537,62 @@ bool HlslGrammar::acceptExpression(TIntermTyped*& node) expected("right parenthesis"); return false; } - - return true; + } else if (acceptLiteral(node)) { + // literal (nothing else to do yet), go on to the + } else if (acceptConstructor(node)) { + // constructor (nothing else to do yet) + } else if (acceptIdentifier(idToken)) { + // identifier or function_call name + if (! peekTokenClass(EHTokLeftParen)) { + node = parseContext.handleVariable(idToken.loc, idToken.symbol, token.string); + } else if (acceptFunctionCall(idToken, node)) { + // function_call (nothing else to do yet) + } else { + expected("function call arguments"); + return false; + } } - // literal - if (acceptLiteral(node)) - return true; + do { + TSourceLoc loc = token.loc; + TOperator postOp = HlslOpMap::postUnary(peek()); - // constructor - if (acceptConstructor(node)) - return true; + // Consume only a valid post-unary operator, otherwise we are done. + switch (postOp) { + case EOpIndexDirectStruct: + case EOpIndexIndirect: + case EOpPostIncrement: + case EOpPostDecrement: + advanceToken(); + break; + default: + return true; + } - return false; + // We have a valid post-unary operator, process it. + switch (postOp) { + case EOpIndexDirectStruct: + // todo + break; + case EOpIndexIndirect: + { + TIntermTyped* indexNode = nullptr; + if (! acceptExpression(indexNode) || + ! peekTokenClass(EHTokRightBracket)) { + expected("expression followed by ']'"); + return false; + } + // todo: node = intermediate.addBinaryMath( + } + case EOpPostIncrement: + case EOpPostDecrement: + node = intermediate.addUnaryMath(postOp, node, loc); + break; + default: + assert(0); + break; + } + } while (true); } // constructor @@ -445,6 +623,17 @@ bool HlslGrammar::acceptConstructor(TIntermTyped*& node) return false; } +// The function_call identifier was already recognized, and passed in as idToken. +// +// function_call +// : [idToken] arguments +// +bool HlslGrammar::acceptFunctionCall(HlslToken idToken, TIntermTyped*&) +{ + // todo + return false; +} + // arguments // : LEFT_PAREN expression COMMA expression COMMA ... RIGHT_PAREN // @@ -505,41 +694,12 @@ bool HlslGrammar::acceptLiteral(TIntermTyped*& node) return true; } -// operator -// : PLUS | DASH | STAR | SLASH | ... -bool HlslGrammar::acceptOperator(TOperator& op) -{ - switch (token.tokenClass) { - case EHTokEqual: - op = EOpAssign; - break; - case EHTokPlus: - op = EOpAdd; - break; - case EHTokDash: - op = EOpSub; - break; - case EHTokStar: - op = EOpMul; - break; - case EHTokSlash: - op = EOpDiv; - break; - default: - return false; - } - - advanceToken(); - - return true; -} - // compound_statement -// : { statement statement ... } +// : LEFT_CURLY statement statement ... RIGHT_CURLY // bool HlslGrammar::acceptCompoundStatement(TIntermAggregate*& compoundStatement) { - // { + // LEFT_CURLY if (! acceptTokenClass(EHTokLeftBrace)) return false; @@ -549,9 +709,10 @@ bool HlslGrammar::acceptCompoundStatement(TIntermAggregate*& compoundStatement) // hook it up compoundStatement = intermediate.growAggregate(compoundStatement, statement); } - compoundStatement->setOperator(EOpSequence); + if (compoundStatement) + compoundStatement->setOperator(EOpSequence); - // } + // RIGHT_CURLY return acceptTokenClass(EHTokRightBrace); } diff --git a/hlsl/hlslGrammar.h b/hlsl/hlslGrammar.h index 8b9b2897..61d30aff 100755 --- a/hlsl/hlslGrammar.h +++ b/hlsl/hlslGrammar.h @@ -37,6 +37,7 @@ #define HLSLGRAMMAR_H_ #include "hlslParseHelper.h" +#include "hlslOpMap.h" #include "hlslTokenStream.h" namespace glslang { @@ -64,10 +65,14 @@ namespace glslang { bool acceptParameterDeclaration(TFunction&); bool acceptFunctionDefinition(TFunction&, TIntermNode*&); bool acceptExpression(TIntermTyped*&); + bool acceptAssignmentExpression(TIntermTyped*&); + bool acceptBinaryExpression(TIntermTyped*&, PrecedenceLevel); + bool acceptUnaryExpression(TIntermTyped*&); + bool acceptPostfixExpression(TIntermTyped*&); bool acceptConstructor(TIntermTyped*&); + bool acceptFunctionCall(HlslToken, TIntermTyped*&); bool acceptArguments(TFunction*, TIntermAggregate*&); bool acceptLiteral(TIntermTyped*&); - bool acceptOperator(TOperator& op); bool acceptCompoundStatement(TIntermAggregate*&); bool acceptStatement(TIntermNode*&); bool acceptSemantic(); diff --git a/hlsl/hlslOpMap.cpp b/hlsl/hlslOpMap.cpp new file mode 100755 index 00000000..c31dd7cf --- /dev/null +++ b/hlsl/hlslOpMap.cpp @@ -0,0 +1,171 @@ +// +//Copyright (C) 2016 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 Google, Inc., 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. +// + +// Map from physical token form (e.g. '-') to logical operator +// form (e.g., binary subtract or unary negate). + +#include "hlslOpMap.h" + +namespace glslang { + +// Map parsing tokens that could be assignments into assignment operators. +TOperator HlslOpMap::assignment(EHlslTokenClass op) +{ + switch (op) { + case EHTokAssign: return EOpAssign; + case EHTokMulAssign: return EOpMulAssign; + case EHTokDivAssign: return EOpDivAssign; + case EHTokAddAssign: return EOpAddAssign; + case EHTokModAssign: return EOpModAssign; + case EHTokLeftAssign: return EOpLeftShiftAssign; + case EHTokRightAssign: return EOpRightShiftAssign; + case EHTokAndAssign: return EOpAndAssign; + case EHTokXorAssign: return EOpExclusiveOrAssign; + case EHTokOrAssign: return EOpInclusiveOrAssign; + case EHTokSubAssign: return EOpSubAssign; + + default: + return EOpNull; + } +} + +// Map parsing tokens that could be binary operations into binary operators. +TOperator HlslOpMap::binary(EHlslTokenClass op) +{ + switch (op) { + case EHTokPlus: return EOpAdd; + case EHTokDash: return EOpSub; + case EHTokStar: return EOpMul; + case EHTokSlash: return EOpDiv; + case EHTokPercent: return EOpMod; + case EHTokRightOp: return EOpRightShift; + case EHTokLeftOp: return EOpLeftShift; + case EHTokAmpersand: return EOpAnd; + case EHTokVerticalBar: return EOpInclusiveOr; + case EHTokCaret: return EOpExclusiveOr; + case EHTokEqOp: return EOpEqual; + case EHTokNeOp: return EOpNotEqual; + case EHTokLeftAngle: return EOpLessThan; + case EHTokRightAngle: return EOpGreaterThan; + case EHTokLeOp: return EOpLessThanEqual; + case EHTokGeOp: return EOpGreaterThanEqual; + case EHTokOrOp: return EOpLogicalOr; + case EHTokXorOp: return EOpLogicalXor; + case EHTokAndOp: return EOpLogicalAnd; + + default: + return EOpNull; + } +} + +// Map parsing tokens that could be unary operations into unary operators. +// These are just the ones that can appear in front of its operand. +TOperator HlslOpMap::preUnary(EHlslTokenClass op) +{ + switch (op) { + case EHTokPlus: return EOpAdd; // means no-op, but still a unary op was present + case EHTokDash: return EOpNegative; + case EHTokBang: return EOpLogicalNot; + case EHTokTilde: return EOpBitwiseNot; + + case EHTokIncOp: return EOpPreIncrement; + case EHTokDecOp: return EOpPreDecrement; + + default: return EOpNull; // means not a pre-unary op + } +} + +// Map parsing tokens that could be unary operations into unary operators. +// These are just the ones that can appear behind its operand. +TOperator HlslOpMap::postUnary(EHlslTokenClass op) +{ + switch (op) { + case EHTokDot: return EOpIndexDirectStruct; + case EHTokLeftBracket: return EOpIndexIndirect; // may need to change later to EOpIndexDirect + + case EHTokIncOp: return EOpPostIncrement; + case EHTokDecOp: return EOpPostDecrement; + + default: return EOpNull; // means not a post-unary op + } +} + +// Map operators into their level of precedence. +PrecedenceLevel HlslOpMap::precedenceLevel(TOperator op) +{ + switch (op) { + case EOpLogicalOr: + return PlLogicalOr; + case EOpLogicalXor: + return PlLogicalXor; + case EOpLogicalAnd: + return PlLogicalAnd; + + case EOpInclusiveOr: + return PlBitwiseOr; + case EOpExclusiveOr: + return PlBitwiseXor; + case EOpAnd: + return PlBitwiseAnd; + + case EOpEqual: + case EOpNotEqual: + return PlEquality; + + case EOpLessThan: + case EOpGreaterThan: + case EOpLessThanEqual: + case EOpGreaterThanEqual: + return PlRelational; + + case EOpRightShift: + case EOpLeftShift: + return PlShift; + + case EOpAdd: + case EOpSub: + return PlAdd; + + case EOpMul: + case EOpDiv: + case EOpMod: + return PlMul; + + default: + return PlBad; + } +} + +} // end namespace glslang diff --git a/hlsl/hlslOpMap.h b/hlsl/hlslOpMap.h new file mode 100755 index 00000000..92463787 --- /dev/null +++ b/hlsl/hlslOpMap.h @@ -0,0 +1,69 @@ +// +//Copyright (C) 2016 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 Google, Inc., 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. +// + +#ifndef HLSLOPMAP_H_ +#define HLSLOPMAP_H_ + +#include "hlslScanContext.h" + +namespace glslang { + + enum PrecedenceLevel { + PlBad, + PlLogicalOr, + PlLogicalXor, + PlLogicalAnd, + PlBitwiseOr, + PlBitwiseXor, + PlBitwiseAnd, + PlEquality, + PlRelational, + PlShift, + PlAdd, + PlMul + }; + + class HlslOpMap { + public: + static TOperator assignment(EHlslTokenClass op); + static TOperator binary(EHlslTokenClass op); + static TOperator preUnary(EHlslTokenClass op); + static TOperator postUnary(EHlslTokenClass op); + static PrecedenceLevel precedenceLevel(TOperator); + }; + +} // end namespace glslang + +#endif // HLSLOPMAP_H_ diff --git a/hlsl/hlslScanContext.cpp b/hlsl/hlslScanContext.cpp index 50277cfd..ab96bad6 100755 --- a/hlsl/hlslScanContext.cpp +++ b/hlsl/hlslScanContext.cpp @@ -309,7 +309,7 @@ EHlslTokenClass HlslScanContext::tokenizeClass(HlslToken& token) case ';': afterType = false; return EHTokSemicolon; case ',': afterType = false; return EHTokComma; case ':': return EHTokColon; - case '=': afterType = false; return EHTokEqual; + case '=': afterType = false; return EHTokAssign; case '(': afterType = false; return EHTokLeftParen; case ')': afterType = false; return EHTokRightParen; case '.': field = true; return EHTokDot; diff --git a/hlsl/hlslTokenStream.h b/hlsl/hlslTokenStream.h index 4fad8148..9139df07 100755 --- a/hlsl/hlslTokenStream.h +++ b/hlsl/hlslTokenStream.h @@ -42,7 +42,7 @@ namespace glslang { class HlslTokenStream { public: - HlslTokenStream(HlslScanContext& scanner) + explicit HlslTokenStream(HlslScanContext& scanner) : scanner(scanner) { } virtual ~HlslTokenStream() { } diff --git a/hlsl/hlslTokens.h b/hlsl/hlslTokens.h index b118f2e0..bc472fec 100755 --- a/hlsl/hlslTokens.h +++ b/hlsl/hlslTokens.h @@ -207,6 +207,7 @@ enum EHlslTokenClass { EHTokAndOp, EHTokOrOp, EHTokXorOp, + EHTokAssign, EHTokMulAssign, EHTokDivAssign, EHTokAddAssign, @@ -226,7 +227,6 @@ enum EHlslTokenClass { EHTokDot, EHTokComma, EHTokColon, - EHTokEqual, EHTokSemicolon, EHTokBang, EHTokDash, From c4ebb55347b69a6170a14c949c4bee4fbdaba4a3 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 4 May 2016 11:29:21 -0400 Subject: [PATCH 046/140] Add configuration for Travis to test on Linux and Mac OS X. --- .travis.yml | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 2 ++ 2 files changed, 62 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..4a88dce5 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,60 @@ +# Linux and Mac Build Configuration for Travis + +language: cpp + +os: + - linux + - osx + +# Use Ubuntu 14.04 LTS (Trusty) as the Linux testing environment. +sudo: required +dist: trusty + +env: + - GLSLANG_BUILD_TYPE=Release + - GLSLANG_BUILD_TYPE=Debug + +compiler: + - clang + - gcc + +matrix: + fast_finish: true # Show final status immediately if a test fails. + exclude: + # Skip GCC builds on Mac OS X. + - os: osx + compiler: gcc + +cache: + apt: true + +branches: + only: + - master + +addons: + apt: + packages: + - clang-3.6 + - ninja-build + +install: + # Install ninja on Mac OS X. + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update && brew install ninja; fi + # Make sure that clang-3.6 is selected. + - if [[ "$TRAVIS_OS_NAME" == "linux" && "$CC" == "clang" ]]; then + export CC=clang-3.6 CXX=clang++-3.6; + fi + +before_script: + - git clone https://github.com/google/googletest.git External/googletest + +script: + - mkdir build && cd build + # We need to install the compiled binaries so the paths in the runtests script can resolve correctly. + - cmake -GNinja -DCMAKE_BUILD_TYPE=${GLSLANG_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=`pwd`/install .. + - ninja install + # Run Google-Test-based tests. + - ctest --output-on-failure + # Run runtests-based tests. + - cd ../Test && ./runtests diff --git a/README.md b/README.md index d669e50d..02ba02a9 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ regarding the feature level of glslang. glslang ======= +[![Build Status](https://travis-ci.org/KhronosGroup/glslang.svg?branch=master)](https://travis-ci.org/KhronosGroup/glslang) + An OpenGL and OpenGL ES shader front end and validator. There are two components: From 045e02af756826ab9672f9de721399bdcc75aead Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 4 May 2016 13:06:15 -0400 Subject: [PATCH 047/140] Bump minimum required CMake version to 2.8.12. CMake 2.8.12 added support for target_include_directories(), among other features, and we would like to use it. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1027e7e5..a5220aa3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.8.12) enable_testing() From d145f855cf27e0ac08440b66bc1d6aad4e7606da Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 4 May 2016 14:53:34 -0400 Subject: [PATCH 048/140] Remove the obselete and incorrect LinusDoAll.bash. --- LinuxDoAll.bash | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100755 LinuxDoAll.bash diff --git a/LinuxDoAll.bash b/LinuxDoAll.bash deleted file mode 100755 index 4bd39a33..00000000 --- a/LinuxDoAll.bash +++ /dev/null @@ -1,34 +0,0 @@ -#! /bin/bash - -svn update - -rm -f StandAlone/glslangValidator -rm -f Test/glslangValidator -rm -f glslang/MachineIndependent/lib/libglslang.so -rm -f Install/Linux/libglslang.so -rm -f Install/Linux/glslangValidator - -cd StandAlone -make clean -cd ../glslang/MachineIndependent -make clean -cd ../.. - -# build the StandAlone app and all it's dependencies -make -C StandAlone - -# so we can find the shared library -#LD_LIBRARY_PATH=`pwd`/glslang/MachineIndependent/lib -#export LD_LIBRARY_PATH - -# install -cd Install/Linux -./install -cp glslangValidator ../../Test -LD_LIBRARY_PATH=/usr/local/lib -export LD_LIBRARY_PATH - -# run using test data -cd ../../Test -chmod +x runtests -./runtests From 758bb5520d2a1d0c4e6e242aefa43a2330a2be18 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Wed, 4 May 2016 00:12:10 -0600 Subject: [PATCH 049/140] Bison: Non-functional: Move to revision 3.0.4. This hopefully prevents obsucuring actual changes in a future commit. Also, adds a script to update the grammar. --- README.md | 6 + glslang/MachineIndependent/glslang_tab.cpp | 4890 ++++++++---------- glslang/MachineIndependent/glslang_tab.cpp.h | 595 ++- glslang/updateGrammar | 3 + 4 files changed, 2598 insertions(+), 2896 deletions(-) create mode 100755 glslang/updateGrammar diff --git a/README.md b/README.md index 02ba02a9..55129575 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,12 @@ bison --defines=MachineIndependent/glslang_tab.cpp.h -o MachineIndependent/glslang_tab.cpp ``` +The above command is also available in the bash script at: + +``` +glslang/updateGrammar +``` + Glslang is adding the ability to test with [Google Test](https://github.com/google/googletest) framework. If you want to build and run those tests, please make sure you have a copy of Google Tests diff --git a/glslang/MachineIndependent/glslang_tab.cpp b/glslang/MachineIndependent/glslang_tab.cpp index 18c1a2fa..c97c8e4d 100644 --- a/glslang/MachineIndependent/glslang_tab.cpp +++ b/glslang/MachineIndependent/glslang_tab.cpp @@ -1,19 +1,19 @@ -/* A Bison parser, made by GNU Bison 2.7. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison implementation for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc. - + + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -26,7 +26,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -44,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.7" +#define YYBISON_VERSION "3.0.4" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -62,8 +62,7 @@ /* Copy the first part of user declarations. */ -/* Line 371 of yacc.c */ -#line 41 "glslang.y" +#line 41 "MachineIndependent/glslang.y" /* yacc.c:339 */ /* Based on: @@ -88,14 +87,13 @@ Jutta Degener, 1995 using namespace glslang; -/* Line 371 of yacc.c */ -#line 93 "glslang_tab.cpp" +#line 91 "MachineIndependent/glslang_tab.cpp" /* yacc.c:339 */ -# ifndef YY_NULL +# ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULL nullptr +# define YY_NULLPTR nullptr # else -# define YY_NULL 0 +# define YY_NULLPTR 0 # endif # endif @@ -109,9 +107,9 @@ using namespace glslang; /* In a future release of Bison, this section will be replaced by #include "glslang_tab.cpp.h". */ -#ifndef YY_YY_GLSLANG_TAB_CPP_H_INCLUDED -# define YY_YY_GLSLANG_TAB_CPP_H_INCLUDED -/* Enabling traces. */ +#ifndef YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED +# define YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED +/* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 1 #endif @@ -119,288 +117,287 @@ using namespace glslang; extern int yydebug; #endif -/* Tokens. */ +/* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - ATTRIBUTE = 258, - VARYING = 259, - CONST = 260, - BOOL = 261, - FLOAT = 262, - DOUBLE = 263, - INT = 264, - UINT = 265, - INT64_T = 266, - UINT64_T = 267, - BREAK = 268, - CONTINUE = 269, - DO = 270, - ELSE = 271, - FOR = 272, - IF = 273, - DISCARD = 274, - RETURN = 275, - SWITCH = 276, - CASE = 277, - DEFAULT = 278, - SUBROUTINE = 279, - BVEC2 = 280, - BVEC3 = 281, - BVEC4 = 282, - IVEC2 = 283, - IVEC3 = 284, - IVEC4 = 285, - I64VEC2 = 286, - I64VEC3 = 287, - I64VEC4 = 288, - UVEC2 = 289, - UVEC3 = 290, - UVEC4 = 291, - U64VEC2 = 292, - U64VEC3 = 293, - U64VEC4 = 294, - VEC2 = 295, - VEC3 = 296, - VEC4 = 297, - MAT2 = 298, - MAT3 = 299, - MAT4 = 300, - CENTROID = 301, - IN = 302, - OUT = 303, - INOUT = 304, - UNIFORM = 305, - PATCH = 306, - SAMPLE = 307, - BUFFER = 308, - SHARED = 309, - COHERENT = 310, - VOLATILE = 311, - RESTRICT = 312, - READONLY = 313, - WRITEONLY = 314, - DVEC2 = 315, - DVEC3 = 316, - DVEC4 = 317, - DMAT2 = 318, - DMAT3 = 319, - DMAT4 = 320, - NOPERSPECTIVE = 321, - FLAT = 322, - SMOOTH = 323, - LAYOUT = 324, - MAT2X2 = 325, - MAT2X3 = 326, - MAT2X4 = 327, - MAT3X2 = 328, - MAT3X3 = 329, - MAT3X4 = 330, - MAT4X2 = 331, - MAT4X3 = 332, - MAT4X4 = 333, - DMAT2X2 = 334, - DMAT2X3 = 335, - DMAT2X4 = 336, - DMAT3X2 = 337, - DMAT3X3 = 338, - DMAT3X4 = 339, - DMAT4X2 = 340, - DMAT4X3 = 341, - DMAT4X4 = 342, - ATOMIC_UINT = 343, - SAMPLER1D = 344, - SAMPLER2D = 345, - SAMPLER3D = 346, - SAMPLERCUBE = 347, - SAMPLER1DSHADOW = 348, - SAMPLER2DSHADOW = 349, - SAMPLERCUBESHADOW = 350, - SAMPLER1DARRAY = 351, - SAMPLER2DARRAY = 352, - SAMPLER1DARRAYSHADOW = 353, - SAMPLER2DARRAYSHADOW = 354, - ISAMPLER1D = 355, - ISAMPLER2D = 356, - ISAMPLER3D = 357, - ISAMPLERCUBE = 358, - ISAMPLER1DARRAY = 359, - ISAMPLER2DARRAY = 360, - USAMPLER1D = 361, - USAMPLER2D = 362, - USAMPLER3D = 363, - USAMPLERCUBE = 364, - USAMPLER1DARRAY = 365, - USAMPLER2DARRAY = 366, - SAMPLER2DRECT = 367, - SAMPLER2DRECTSHADOW = 368, - ISAMPLER2DRECT = 369, - USAMPLER2DRECT = 370, - SAMPLERBUFFER = 371, - ISAMPLERBUFFER = 372, - USAMPLERBUFFER = 373, - SAMPLERCUBEARRAY = 374, - SAMPLERCUBEARRAYSHADOW = 375, - ISAMPLERCUBEARRAY = 376, - USAMPLERCUBEARRAY = 377, - SAMPLER2DMS = 378, - ISAMPLER2DMS = 379, - USAMPLER2DMS = 380, - SAMPLER2DMSARRAY = 381, - ISAMPLER2DMSARRAY = 382, - USAMPLER2DMSARRAY = 383, - SAMPLEREXTERNALOES = 384, - SAMPLER = 385, - SAMPLERSHADOW = 386, - TEXTURE1D = 387, - TEXTURE2D = 388, - TEXTURE3D = 389, - TEXTURECUBE = 390, - TEXTURE1DARRAY = 391, - TEXTURE2DARRAY = 392, - ITEXTURE1D = 393, - ITEXTURE2D = 394, - ITEXTURE3D = 395, - ITEXTURECUBE = 396, - ITEXTURE1DARRAY = 397, - ITEXTURE2DARRAY = 398, - UTEXTURE1D = 399, - UTEXTURE2D = 400, - UTEXTURE3D = 401, - UTEXTURECUBE = 402, - UTEXTURE1DARRAY = 403, - UTEXTURE2DARRAY = 404, - TEXTURE2DRECT = 405, - ITEXTURE2DRECT = 406, - UTEXTURE2DRECT = 407, - TEXTUREBUFFER = 408, - ITEXTUREBUFFER = 409, - UTEXTUREBUFFER = 410, - TEXTURECUBEARRAY = 411, - ITEXTURECUBEARRAY = 412, - UTEXTURECUBEARRAY = 413, - TEXTURE2DMS = 414, - ITEXTURE2DMS = 415, - UTEXTURE2DMS = 416, - TEXTURE2DMSARRAY = 417, - ITEXTURE2DMSARRAY = 418, - UTEXTURE2DMSARRAY = 419, - SUBPASSINPUT = 420, - SUBPASSINPUTMS = 421, - ISUBPASSINPUT = 422, - ISUBPASSINPUTMS = 423, - USUBPASSINPUT = 424, - USUBPASSINPUTMS = 425, - IMAGE1D = 426, - IIMAGE1D = 427, - UIMAGE1D = 428, - IMAGE2D = 429, - IIMAGE2D = 430, - UIMAGE2D = 431, - IMAGE3D = 432, - IIMAGE3D = 433, - UIMAGE3D = 434, - IMAGE2DRECT = 435, - IIMAGE2DRECT = 436, - UIMAGE2DRECT = 437, - IMAGECUBE = 438, - IIMAGECUBE = 439, - UIMAGECUBE = 440, - IMAGEBUFFER = 441, - IIMAGEBUFFER = 442, - UIMAGEBUFFER = 443, - IMAGE1DARRAY = 444, - IIMAGE1DARRAY = 445, - UIMAGE1DARRAY = 446, - IMAGE2DARRAY = 447, - IIMAGE2DARRAY = 448, - UIMAGE2DARRAY = 449, - IMAGECUBEARRAY = 450, - IIMAGECUBEARRAY = 451, - UIMAGECUBEARRAY = 452, - IMAGE2DMS = 453, - IIMAGE2DMS = 454, - UIMAGE2DMS = 455, - IMAGE2DMSARRAY = 456, - IIMAGE2DMSARRAY = 457, - UIMAGE2DMSARRAY = 458, - STRUCT = 459, - VOID = 460, - WHILE = 461, - IDENTIFIER = 462, - TYPE_NAME = 463, - FLOATCONSTANT = 464, - DOUBLECONSTANT = 465, - INTCONSTANT = 466, - UINTCONSTANT = 467, - INT64CONSTANT = 468, - UINT64CONSTANT = 469, - BOOLCONSTANT = 470, - LEFT_OP = 471, - RIGHT_OP = 472, - INC_OP = 473, - DEC_OP = 474, - LE_OP = 475, - GE_OP = 476, - EQ_OP = 477, - NE_OP = 478, - AND_OP = 479, - OR_OP = 480, - XOR_OP = 481, - MUL_ASSIGN = 482, - DIV_ASSIGN = 483, - ADD_ASSIGN = 484, - MOD_ASSIGN = 485, - LEFT_ASSIGN = 486, - RIGHT_ASSIGN = 487, - AND_ASSIGN = 488, - XOR_ASSIGN = 489, - OR_ASSIGN = 490, - SUB_ASSIGN = 491, - LEFT_PAREN = 492, - RIGHT_PAREN = 493, - LEFT_BRACKET = 494, - RIGHT_BRACKET = 495, - LEFT_BRACE = 496, - RIGHT_BRACE = 497, - DOT = 498, - COMMA = 499, - COLON = 500, - EQUAL = 501, - SEMICOLON = 502, - BANG = 503, - DASH = 504, - TILDE = 505, - PLUS = 506, - STAR = 507, - SLASH = 508, - PERCENT = 509, - LEFT_ANGLE = 510, - RIGHT_ANGLE = 511, - VERTICAL_BAR = 512, - CARET = 513, - AMPERSAND = 514, - QUESTION = 515, - INVARIANT = 516, - PRECISE = 517, - HIGH_PRECISION = 518, - MEDIUM_PRECISION = 519, - LOW_PRECISION = 520, - PRECISION = 521, - PACKED = 522, - RESOURCE = 523, - SUPERP = 524 - }; + enum yytokentype + { + ATTRIBUTE = 258, + VARYING = 259, + CONST = 260, + BOOL = 261, + FLOAT = 262, + DOUBLE = 263, + INT = 264, + UINT = 265, + INT64_T = 266, + UINT64_T = 267, + BREAK = 268, + CONTINUE = 269, + DO = 270, + ELSE = 271, + FOR = 272, + IF = 273, + DISCARD = 274, + RETURN = 275, + SWITCH = 276, + CASE = 277, + DEFAULT = 278, + SUBROUTINE = 279, + BVEC2 = 280, + BVEC3 = 281, + BVEC4 = 282, + IVEC2 = 283, + IVEC3 = 284, + IVEC4 = 285, + I64VEC2 = 286, + I64VEC3 = 287, + I64VEC4 = 288, + UVEC2 = 289, + UVEC3 = 290, + UVEC4 = 291, + U64VEC2 = 292, + U64VEC3 = 293, + U64VEC4 = 294, + VEC2 = 295, + VEC3 = 296, + VEC4 = 297, + MAT2 = 298, + MAT3 = 299, + MAT4 = 300, + CENTROID = 301, + IN = 302, + OUT = 303, + INOUT = 304, + UNIFORM = 305, + PATCH = 306, + SAMPLE = 307, + BUFFER = 308, + SHARED = 309, + COHERENT = 310, + VOLATILE = 311, + RESTRICT = 312, + READONLY = 313, + WRITEONLY = 314, + DVEC2 = 315, + DVEC3 = 316, + DVEC4 = 317, + DMAT2 = 318, + DMAT3 = 319, + DMAT4 = 320, + NOPERSPECTIVE = 321, + FLAT = 322, + SMOOTH = 323, + LAYOUT = 324, + MAT2X2 = 325, + MAT2X3 = 326, + MAT2X4 = 327, + MAT3X2 = 328, + MAT3X3 = 329, + MAT3X4 = 330, + MAT4X2 = 331, + MAT4X3 = 332, + MAT4X4 = 333, + DMAT2X2 = 334, + DMAT2X3 = 335, + DMAT2X4 = 336, + DMAT3X2 = 337, + DMAT3X3 = 338, + DMAT3X4 = 339, + DMAT4X2 = 340, + DMAT4X3 = 341, + DMAT4X4 = 342, + ATOMIC_UINT = 343, + SAMPLER1D = 344, + SAMPLER2D = 345, + SAMPLER3D = 346, + SAMPLERCUBE = 347, + SAMPLER1DSHADOW = 348, + SAMPLER2DSHADOW = 349, + SAMPLERCUBESHADOW = 350, + SAMPLER1DARRAY = 351, + SAMPLER2DARRAY = 352, + SAMPLER1DARRAYSHADOW = 353, + SAMPLER2DARRAYSHADOW = 354, + ISAMPLER1D = 355, + ISAMPLER2D = 356, + ISAMPLER3D = 357, + ISAMPLERCUBE = 358, + ISAMPLER1DARRAY = 359, + ISAMPLER2DARRAY = 360, + USAMPLER1D = 361, + USAMPLER2D = 362, + USAMPLER3D = 363, + USAMPLERCUBE = 364, + USAMPLER1DARRAY = 365, + USAMPLER2DARRAY = 366, + SAMPLER2DRECT = 367, + SAMPLER2DRECTSHADOW = 368, + ISAMPLER2DRECT = 369, + USAMPLER2DRECT = 370, + SAMPLERBUFFER = 371, + ISAMPLERBUFFER = 372, + USAMPLERBUFFER = 373, + SAMPLERCUBEARRAY = 374, + SAMPLERCUBEARRAYSHADOW = 375, + ISAMPLERCUBEARRAY = 376, + USAMPLERCUBEARRAY = 377, + SAMPLER2DMS = 378, + ISAMPLER2DMS = 379, + USAMPLER2DMS = 380, + SAMPLER2DMSARRAY = 381, + ISAMPLER2DMSARRAY = 382, + USAMPLER2DMSARRAY = 383, + SAMPLEREXTERNALOES = 384, + SAMPLER = 385, + SAMPLERSHADOW = 386, + TEXTURE1D = 387, + TEXTURE2D = 388, + TEXTURE3D = 389, + TEXTURECUBE = 390, + TEXTURE1DARRAY = 391, + TEXTURE2DARRAY = 392, + ITEXTURE1D = 393, + ITEXTURE2D = 394, + ITEXTURE3D = 395, + ITEXTURECUBE = 396, + ITEXTURE1DARRAY = 397, + ITEXTURE2DARRAY = 398, + UTEXTURE1D = 399, + UTEXTURE2D = 400, + UTEXTURE3D = 401, + UTEXTURECUBE = 402, + UTEXTURE1DARRAY = 403, + UTEXTURE2DARRAY = 404, + TEXTURE2DRECT = 405, + ITEXTURE2DRECT = 406, + UTEXTURE2DRECT = 407, + TEXTUREBUFFER = 408, + ITEXTUREBUFFER = 409, + UTEXTUREBUFFER = 410, + TEXTURECUBEARRAY = 411, + ITEXTURECUBEARRAY = 412, + UTEXTURECUBEARRAY = 413, + TEXTURE2DMS = 414, + ITEXTURE2DMS = 415, + UTEXTURE2DMS = 416, + TEXTURE2DMSARRAY = 417, + ITEXTURE2DMSARRAY = 418, + UTEXTURE2DMSARRAY = 419, + SUBPASSINPUT = 420, + SUBPASSINPUTMS = 421, + ISUBPASSINPUT = 422, + ISUBPASSINPUTMS = 423, + USUBPASSINPUT = 424, + USUBPASSINPUTMS = 425, + IMAGE1D = 426, + IIMAGE1D = 427, + UIMAGE1D = 428, + IMAGE2D = 429, + IIMAGE2D = 430, + UIMAGE2D = 431, + IMAGE3D = 432, + IIMAGE3D = 433, + UIMAGE3D = 434, + IMAGE2DRECT = 435, + IIMAGE2DRECT = 436, + UIMAGE2DRECT = 437, + IMAGECUBE = 438, + IIMAGECUBE = 439, + UIMAGECUBE = 440, + IMAGEBUFFER = 441, + IIMAGEBUFFER = 442, + UIMAGEBUFFER = 443, + IMAGE1DARRAY = 444, + IIMAGE1DARRAY = 445, + UIMAGE1DARRAY = 446, + IMAGE2DARRAY = 447, + IIMAGE2DARRAY = 448, + UIMAGE2DARRAY = 449, + IMAGECUBEARRAY = 450, + IIMAGECUBEARRAY = 451, + UIMAGECUBEARRAY = 452, + IMAGE2DMS = 453, + IIMAGE2DMS = 454, + UIMAGE2DMS = 455, + IMAGE2DMSARRAY = 456, + IIMAGE2DMSARRAY = 457, + UIMAGE2DMSARRAY = 458, + STRUCT = 459, + VOID = 460, + WHILE = 461, + IDENTIFIER = 462, + TYPE_NAME = 463, + FLOATCONSTANT = 464, + DOUBLECONSTANT = 465, + INTCONSTANT = 466, + UINTCONSTANT = 467, + INT64CONSTANT = 468, + UINT64CONSTANT = 469, + BOOLCONSTANT = 470, + LEFT_OP = 471, + RIGHT_OP = 472, + INC_OP = 473, + DEC_OP = 474, + LE_OP = 475, + GE_OP = 476, + EQ_OP = 477, + NE_OP = 478, + AND_OP = 479, + OR_OP = 480, + XOR_OP = 481, + MUL_ASSIGN = 482, + DIV_ASSIGN = 483, + ADD_ASSIGN = 484, + MOD_ASSIGN = 485, + LEFT_ASSIGN = 486, + RIGHT_ASSIGN = 487, + AND_ASSIGN = 488, + XOR_ASSIGN = 489, + OR_ASSIGN = 490, + SUB_ASSIGN = 491, + LEFT_PAREN = 492, + RIGHT_PAREN = 493, + LEFT_BRACKET = 494, + RIGHT_BRACKET = 495, + LEFT_BRACE = 496, + RIGHT_BRACE = 497, + DOT = 498, + COMMA = 499, + COLON = 500, + EQUAL = 501, + SEMICOLON = 502, + BANG = 503, + DASH = 504, + TILDE = 505, + PLUS = 506, + STAR = 507, + SLASH = 508, + PERCENT = 509, + LEFT_ANGLE = 510, + RIGHT_ANGLE = 511, + VERTICAL_BAR = 512, + CARET = 513, + AMPERSAND = 514, + QUESTION = 515, + INVARIANT = 516, + PRECISE = 517, + HIGH_PRECISION = 518, + MEDIUM_PRECISION = 519, + LOW_PRECISION = 520, + PRECISION = 521, + PACKED = 522, + RESOURCE = 523, + SUPERP = 524 + }; #endif - +/* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE + +union YYSTYPE { -/* Line 387 of yacc.c */ -#line 66 "glslang.y" +#line 66 "MachineIndependent/glslang.y" /* yacc.c:355 */ struct { glslang::TSourceLoc loc; @@ -434,35 +431,22 @@ typedef union YYSTYPE }; } interm; +#line 435 "MachineIndependent/glslang_tab.cpp" /* yacc.c:355 */ +}; -/* Line 387 of yacc.c */ -#line 440 "glslang_tab.cpp" -} YYSTYPE; +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); -#else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse (glslang::TParseContext* pParseContext); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ -#endif /* !YY_YY_GLSLANG_TAB_CPP_H_INCLUDED */ +int yyparse (glslang::TParseContext* pParseContext); + +#endif /* !YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED */ /* Copy the second part of user declarations. */ -/* Line 390 of yacc.c */ -#line 100 "glslang.y" +#line 100 "MachineIndependent/glslang.y" /* yacc.c:358 */ /* windows only pragma */ @@ -478,8 +462,7 @@ int yyparse (); extern int yylex(YYSTYPE*, TParseContext&); -/* Line 390 of yacc.c */ -#line 483 "glslang_tab.cpp" +#line 466 "MachineIndependent/glslang_tab.cpp" /* yacc.c:358 */ #ifdef short # undef short @@ -493,11 +476,8 @@ typedef unsigned char yytype_uint8; #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; #else -typedef short int yytype_int8; +typedef signed char yytype_int8; #endif #ifdef YYTYPE_UINT16 @@ -517,8 +497,7 @@ typedef short int yytype_int16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# elif ! defined YYSIZE_T # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else @@ -540,6 +519,33 @@ typedef short int yytype_int16; # endif #endif +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# endif +#endif + /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(E) ((void) (E)) @@ -547,23 +553,25 @@ typedef short int yytype_int16; # define YYUSE(E) /* empty */ #endif -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(N) (N) +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") #else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int yyi) -#else -static int -YYID (yyi) - int yyi; +# define YY_INITIAL_VALUE(Value) Value #endif -{ - return yyi; -} +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END #endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + #if ! defined yyoverflow || YYERROR_VERBOSE @@ -582,8 +590,7 @@ YYID (yyi) # define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS # include /* INFRINGES ON USER NAME SPACE */ /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS @@ -595,8 +602,8 @@ YYID (yyi) # endif # ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely @@ -612,7 +619,7 @@ YYID (yyi) # endif # if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) + && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 @@ -620,15 +627,13 @@ YYID (yyi) # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined malloc && ! defined EXIT_SUCCESS void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined free && ! defined EXIT_SUCCESS void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif @@ -638,7 +643,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc @@ -663,16 +668,16 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (YYID (0)) +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) #endif @@ -691,7 +696,7 @@ union yyalloc for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ - while (YYID (0)) + while (0) # endif # endif #endif /* !YYCOPY_NEEDED */ @@ -707,17 +712,19 @@ union yyalloc #define YYNNTS 100 /* YYNRULES -- Number of rules. */ #define YYNRULES 421 -/* YYNRULES -- Number of states. */ +/* YYNSTATES -- Number of states. */ #define YYNSTATES 553 -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 524 -#define YYTRANSLATE(YYX) \ +#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, without out-of-bounds checking. */ static const yytype_uint16 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -776,168 +783,7 @@ static const yytype_uint16 yytranslate[] = }; #if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const yytype_uint16 yyprhs[] = -{ - 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, - 19, 21, 25, 27, 32, 34, 38, 41, 44, 46, - 48, 50, 53, 56, 59, 61, 64, 68, 71, 73, - 75, 77, 80, 83, 86, 88, 90, 92, 94, 96, - 100, 104, 108, 110, 114, 118, 120, 124, 128, 130, - 134, 138, 142, 146, 148, 152, 156, 158, 162, 164, - 168, 170, 174, 176, 180, 182, 186, 188, 192, 194, - 195, 202, 204, 208, 210, 212, 214, 216, 218, 220, - 222, 224, 226, 228, 230, 232, 236, 238, 241, 244, - 249, 252, 256, 261, 264, 268, 273, 274, 281, 284, - 288, 291, 293, 295, 298, 302, 306, 309, 313, 316, - 318, 321, 323, 325, 327, 331, 336, 343, 349, 351, - 354, 358, 364, 369, 371, 374, 376, 378, 380, 382, - 387, 389, 393, 395, 399, 401, 403, 405, 408, 410, - 412, 414, 416, 418, 420, 422, 424, 426, 428, 430, - 432, 434, 436, 438, 440, 442, 444, 446, 448, 450, - 452, 454, 456, 461, 463, 467, 469, 472, 475, 479, - 483, 488, 490, 492, 494, 496, 498, 500, 502, 504, - 506, 508, 510, 512, 514, 516, 518, 520, 522, 524, - 526, 528, 530, 532, 534, 536, 538, 540, 542, 544, - 546, 548, 550, 552, 554, 556, 558, 560, 562, 564, - 566, 568, 570, 572, 574, 576, 578, 580, 582, 584, - 586, 588, 590, 592, 594, 596, 598, 600, 602, 604, - 606, 608, 610, 612, 614, 616, 618, 620, 622, 624, - 626, 628, 630, 632, 634, 636, 638, 640, 642, 644, - 646, 648, 650, 652, 654, 656, 658, 660, 662, 664, - 666, 668, 670, 672, 674, 676, 678, 680, 682, 684, - 686, 688, 690, 692, 694, 696, 698, 700, 702, 704, - 706, 708, 710, 712, 714, 716, 718, 720, 722, 724, - 726, 728, 730, 732, 734, 736, 738, 740, 742, 744, - 746, 748, 750, 752, 754, 756, 758, 760, 762, 764, - 766, 768, 770, 772, 774, 776, 778, 780, 782, 784, - 786, 788, 790, 792, 794, 796, 798, 800, 802, 804, - 806, 808, 810, 812, 814, 816, 818, 820, 822, 824, - 826, 828, 830, 832, 834, 836, 837, 844, 845, 851, - 853, 856, 860, 865, 867, 871, 873, 876, 878, 882, - 887, 889, 893, 895, 897, 899, 901, 903, 905, 907, - 909, 911, 913, 916, 917, 918, 924, 926, 928, 929, - 932, 933, 936, 939, 943, 945, 948, 950, 953, 959, - 963, 965, 967, 972, 973, 982, 983, 985, 989, 992, - 993, 1000, 1001, 1010, 1011, 1019, 1021, 1023, 1025, 1026, - 1029, 1033, 1036, 1039, 1042, 1046, 1049, 1051, 1054, 1056, - 1058, 1059 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int16 yyrhs[] = -{ - 366, 0, -1, 207, -1, 271, -1, 211, -1, 212, - -1, 213, -1, 214, -1, 209, -1, 210, -1, 215, - -1, 237, 299, 238, -1, 272, -1, 273, 239, 274, - 240, -1, 275, -1, 273, 243, 207, -1, 273, 218, - -1, 273, 219, -1, 299, -1, 276, -1, 277, -1, - 279, 238, -1, 278, 238, -1, 280, 205, -1, 280, - -1, 280, 297, -1, 279, 244, 297, -1, 281, 237, - -1, 325, -1, 273, -1, 273, -1, 218, 282, -1, - 219, 282, -1, 283, 282, -1, 251, -1, 249, -1, - 248, -1, 250, -1, 282, -1, 284, 252, 282, -1, - 284, 253, 282, -1, 284, 254, 282, -1, 284, -1, - 285, 251, 284, -1, 285, 249, 284, -1, 285, -1, - 286, 216, 285, -1, 286, 217, 285, -1, 286, -1, - 287, 255, 286, -1, 287, 256, 286, -1, 287, 220, - 286, -1, 287, 221, 286, -1, 287, -1, 288, 222, - 287, -1, 288, 223, 287, -1, 288, -1, 289, 259, - 288, -1, 289, -1, 290, 258, 289, -1, 290, -1, - 291, 257, 290, -1, 291, -1, 292, 224, 291, -1, - 292, -1, 293, 226, 292, -1, 293, -1, 294, 225, - 293, -1, 294, -1, -1, 294, 260, 296, 299, 245, - 297, -1, 295, -1, 282, 298, 297, -1, 246, -1, - 227, -1, 228, -1, 230, -1, 229, -1, 236, -1, - 231, -1, 232, -1, 233, -1, 234, -1, 235, -1, - 297, -1, 299, 244, 297, -1, 295, -1, 305, 247, - -1, 312, 247, -1, 266, 328, 325, 247, -1, 302, - 247, -1, 302, 207, 247, -1, 302, 207, 326, 247, - -1, 321, 247, -1, 321, 207, 247, -1, 321, 207, - 304, 247, -1, -1, 321, 207, 241, 303, 332, 242, - -1, 244, 207, -1, 304, 244, 207, -1, 306, 238, - -1, 308, -1, 307, -1, 308, 310, -1, 307, 244, - 310, -1, 314, 207, 237, -1, 325, 207, -1, 325, - 207, 326, -1, 321, 309, -1, 309, -1, 321, 311, - -1, 311, -1, 325, -1, 313, -1, 312, 244, 207, - -1, 312, 244, 207, 326, -1, 312, 244, 207, 326, - 246, 336, -1, 312, 244, 207, 246, 336, -1, 314, - -1, 314, 207, -1, 314, 207, 326, -1, 314, 207, - 326, 246, 336, -1, 314, 207, 246, 336, -1, 325, - -1, 321, 325, -1, 261, -1, 68, -1, 67, -1, - 66, -1, 69, 237, 318, 238, -1, 319, -1, 318, - 244, 319, -1, 207, -1, 207, 246, 300, -1, 54, - -1, 262, -1, 322, -1, 321, 322, -1, 323, -1, - 317, -1, 328, -1, 316, -1, 315, -1, 320, -1, - 5, -1, 3, -1, 4, -1, 49, -1, 47, -1, - 48, -1, 46, -1, 51, -1, 52, -1, 50, -1, - 53, -1, 54, -1, 55, -1, 56, -1, 57, -1, - 58, -1, 59, -1, 24, -1, 24, 237, 324, 238, - -1, 208, -1, 324, 244, 208, -1, 327, -1, 327, - 326, -1, 239, 240, -1, 239, 295, 240, -1, 326, - 239, 240, -1, 326, 239, 295, 240, -1, 205, -1, - 7, -1, 8, -1, 9, -1, 10, -1, 11, -1, - 12, -1, 6, -1, 40, -1, 41, -1, 42, -1, - 60, -1, 61, -1, 62, -1, 25, -1, 26, -1, - 27, -1, 28, -1, 29, -1, 30, -1, 31, -1, - 32, -1, 33, -1, 34, -1, 35, -1, 36, -1, - 37, -1, 38, -1, 39, -1, 43, -1, 44, -1, - 45, -1, 70, -1, 71, -1, 72, -1, 73, -1, - 74, -1, 75, -1, 76, -1, 77, -1, 78, -1, - 63, -1, 64, -1, 65, -1, 79, -1, 80, -1, - 81, -1, 82, -1, 83, -1, 84, -1, 85, -1, - 86, -1, 87, -1, 88, -1, 89, -1, 90, -1, - 91, -1, 92, -1, 93, -1, 94, -1, 95, -1, - 96, -1, 97, -1, 98, -1, 99, -1, 119, -1, - 120, -1, 100, -1, 101, -1, 102, -1, 103, -1, - 104, -1, 105, -1, 121, -1, 106, -1, 107, -1, - 108, -1, 109, -1, 110, -1, 111, -1, 122, -1, - 112, -1, 113, -1, 114, -1, 115, -1, 116, -1, - 117, -1, 118, -1, 123, -1, 124, -1, 125, -1, - 126, -1, 127, -1, 128, -1, 130, -1, 131, -1, - 132, -1, 133, -1, 134, -1, 135, -1, 136, -1, - 137, -1, 156, -1, 138, -1, 139, -1, 140, -1, - 141, -1, 142, -1, 143, -1, 157, -1, 144, -1, - 145, -1, 146, -1, 147, -1, 148, -1, 149, -1, - 158, -1, 150, -1, 151, -1, 152, -1, 153, -1, - 154, -1, 155, -1, 159, -1, 160, -1, 161, -1, - 162, -1, 163, -1, 164, -1, 171, -1, 172, -1, - 173, -1, 174, -1, 175, -1, 176, -1, 177, -1, - 178, -1, 179, -1, 180, -1, 181, -1, 182, -1, - 183, -1, 184, -1, 185, -1, 186, -1, 187, -1, - 188, -1, 189, -1, 190, -1, 191, -1, 192, -1, - 193, -1, 194, -1, 195, -1, 196, -1, 197, -1, - 198, -1, 199, -1, 200, -1, 201, -1, 202, -1, - 203, -1, 129, -1, 165, -1, 166, -1, 167, -1, - 168, -1, 169, -1, 170, -1, 329, -1, 208, -1, - 263, -1, 264, -1, 265, -1, -1, 204, 207, 241, - 330, 332, 242, -1, -1, 204, 241, 331, 332, 242, - -1, 333, -1, 332, 333, -1, 325, 334, 247, -1, - 321, 325, 334, 247, -1, 335, -1, 334, 244, 335, - -1, 207, -1, 207, 326, -1, 297, -1, 241, 337, - 242, -1, 241, 337, 244, 242, -1, 336, -1, 337, - 244, 336, -1, 301, -1, 341, -1, 340, -1, 338, - -1, 350, -1, 351, -1, 354, -1, 357, -1, 358, - -1, 365, -1, 241, 242, -1, -1, -1, 241, 342, - 349, 343, 242, -1, 348, -1, 340, -1, -1, 346, - 341, -1, -1, 347, 340, -1, 241, 242, -1, 241, - 349, 242, -1, 339, -1, 349, 339, -1, 247, -1, - 299, 247, -1, 18, 237, 299, 238, 352, -1, 345, - 16, 345, -1, 345, -1, 299, -1, 314, 207, 246, - 336, -1, -1, 21, 237, 299, 238, 355, 241, 356, - 242, -1, -1, 349, -1, 22, 299, 245, -1, 23, - 245, -1, -1, 206, 237, 359, 353, 238, 344, -1, - -1, 15, 360, 339, 206, 237, 299, 238, 247, -1, - -1, 17, 237, 361, 362, 364, 238, 344, -1, 350, - -1, 338, -1, 353, -1, -1, 363, 247, -1, 363, - 247, 299, -1, 14, 247, -1, 13, 247, -1, 20, - 247, -1, 20, 299, 247, -1, 19, 247, -1, 367, - -1, 366, 367, -1, 368, -1, 301, -1, -1, 305, - 369, 348, -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 246, 246, 252, 255, 258, 262, 266, 270, 273, @@ -1077,13 +923,13 @@ static const char *const yytname[] = "switch_statement_list", "case_label", "iteration_statement", "$@10", "$@11", "$@12", "for_init_statement", "conditionopt", "for_rest_statement", "jump_statement", "translation_unit", - "external_declaration", "function_definition", "$@13", YY_NULL + "external_declaration", "function_definition", "$@13", YY_NULLPTR }; #endif # ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, @@ -1116,183 +962,18 @@ static const yytype_uint16 yytoknum[] = }; # endif -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint16 yyr1[] = -{ - 0, 270, 271, 272, 272, 272, 272, 272, 272, 272, - 272, 272, 273, 273, 273, 273, 273, 273, 274, 275, - 276, 277, 277, 278, 278, 279, 279, 280, 281, 281, - 282, 282, 282, 282, 283, 283, 283, 283, 284, 284, - 284, 284, 285, 285, 285, 286, 286, 286, 287, 287, - 287, 287, 287, 288, 288, 288, 289, 289, 290, 290, - 291, 291, 292, 292, 293, 293, 294, 294, 295, 296, - 295, 297, 297, 298, 298, 298, 298, 298, 298, 298, - 298, 298, 298, 298, 299, 299, 300, 301, 301, 301, - 301, 301, 301, 301, 301, 301, 303, 302, 304, 304, - 305, 306, 306, 307, 307, 308, 309, 309, 310, 310, - 310, 310, 311, 312, 312, 312, 312, 312, 313, 313, - 313, 313, 313, 314, 314, 315, 316, 316, 316, 317, - 318, 318, 319, 319, 319, 320, 321, 321, 322, 322, - 322, 322, 322, 322, 323, 323, 323, 323, 323, 323, - 323, 323, 323, 323, 323, 323, 323, 323, 323, 323, - 323, 323, 323, 324, 324, 325, 325, 326, 326, 326, - 326, 327, 327, 327, 327, 327, 327, 327, 327, 327, - 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, - 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, - 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, - 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, - 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, - 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, - 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, - 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, - 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, - 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, - 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, - 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, - 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, - 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, - 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, - 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, - 327, 327, 328, 328, 328, 330, 329, 331, 329, 332, - 332, 333, 333, 334, 334, 335, 335, 336, 336, 336, - 337, 337, 338, 339, 339, 340, 340, 340, 340, 340, - 340, 340, 341, 342, 343, 341, 344, 344, 346, 345, - 347, 345, 348, 348, 349, 349, 350, 350, 351, 352, - 352, 353, 353, 355, 354, 356, 356, 357, 357, 359, - 358, 360, 358, 361, 358, 362, 362, 363, 363, 364, - 364, 365, 365, 365, 365, 365, 366, 366, 367, 367, - 369, 368 -}; - -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 3, 1, 4, 1, 3, 2, 2, 1, 1, - 1, 2, 2, 2, 1, 2, 3, 2, 1, 1, - 1, 2, 2, 2, 1, 1, 1, 1, 1, 3, - 3, 3, 1, 3, 3, 1, 3, 3, 1, 3, - 3, 3, 3, 1, 3, 3, 1, 3, 1, 3, - 1, 3, 1, 3, 1, 3, 1, 3, 1, 0, - 6, 1, 3, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 3, 1, 2, 2, 4, - 2, 3, 4, 2, 3, 4, 0, 6, 2, 3, - 2, 1, 1, 2, 3, 3, 2, 3, 2, 1, - 2, 1, 1, 1, 3, 4, 6, 5, 1, 2, - 3, 5, 4, 1, 2, 1, 1, 1, 1, 4, - 1, 3, 1, 3, 1, 1, 1, 2, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 4, 1, 3, 1, 2, 2, 3, 3, - 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 0, 6, 0, 5, 1, - 2, 3, 4, 1, 3, 1, 2, 1, 3, 4, - 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 2, 0, 0, 5, 1, 1, 0, 2, - 0, 2, 2, 3, 1, 2, 1, 2, 5, 3, - 1, 1, 4, 0, 8, 0, 1, 3, 2, 0, - 6, 0, 8, 0, 7, 1, 1, 1, 0, 2, - 3, 2, 2, 2, 3, 2, 1, 2, 1, 1, - 0, 3 -}; - -/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ -static const yytype_uint16 yydefact[] = -{ - 0, 145, 146, 144, 178, 172, 173, 174, 175, 176, - 177, 161, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 179, 180, 181, - 200, 201, 202, 150, 148, 149, 147, 153, 151, 152, - 154, 155, 156, 157, 158, 159, 160, 182, 183, 184, - 212, 213, 214, 128, 127, 126, 0, 203, 204, 205, - 206, 207, 208, 209, 210, 211, 215, 216, 217, 218, - 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, - 229, 230, 231, 232, 233, 234, 235, 238, 239, 240, - 241, 242, 243, 245, 246, 247, 248, 249, 250, 252, - 253, 254, 255, 256, 257, 258, 236, 237, 244, 251, - 259, 260, 261, 262, 263, 264, 333, 265, 266, 267, - 268, 269, 270, 271, 272, 274, 275, 276, 277, 278, - 279, 281, 282, 283, 284, 285, 286, 288, 289, 290, - 291, 292, 293, 273, 280, 287, 294, 295, 296, 297, - 298, 299, 334, 335, 336, 337, 338, 339, 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, 0, 171, 341, 125, 135, 342, 343, 344, 0, - 419, 0, 420, 0, 102, 101, 0, 113, 118, 142, - 141, 139, 143, 0, 136, 138, 123, 165, 140, 340, - 0, 416, 418, 0, 0, 0, 347, 0, 0, 90, - 87, 0, 100, 0, 109, 103, 111, 0, 112, 0, - 88, 119, 0, 93, 137, 124, 0, 166, 1, 417, - 163, 0, 134, 132, 0, 130, 345, 0, 0, 91, - 0, 0, 421, 104, 108, 110, 106, 114, 105, 0, - 120, 96, 0, 94, 0, 2, 8, 9, 4, 5, - 6, 7, 10, 0, 0, 0, 167, 36, 35, 37, - 34, 3, 12, 30, 14, 19, 20, 0, 0, 24, - 0, 38, 0, 42, 45, 48, 53, 56, 58, 60, - 62, 64, 66, 68, 0, 28, 0, 162, 0, 0, - 129, 0, 0, 0, 0, 0, 349, 89, 92, 0, - 0, 401, 0, 0, 0, 0, 0, 0, 0, 0, - 373, 382, 386, 38, 71, 84, 0, 362, 0, 123, - 365, 384, 364, 363, 0, 366, 367, 368, 369, 370, - 371, 107, 0, 115, 0, 357, 122, 0, 0, 98, - 0, 95, 31, 32, 0, 16, 17, 0, 0, 22, - 21, 0, 171, 25, 27, 33, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 69, 168, 169, 0, 164, - 86, 133, 131, 0, 0, 355, 0, 353, 348, 350, - 412, 411, 0, 403, 0, 415, 413, 0, 0, 0, - 398, 399, 372, 0, 74, 75, 77, 76, 79, 80, - 81, 82, 83, 78, 73, 0, 0, 387, 383, 385, - 117, 0, 360, 0, 121, 0, 99, 11, 0, 18, - 15, 26, 39, 40, 41, 44, 43, 46, 47, 51, - 52, 49, 50, 54, 55, 57, 59, 61, 63, 65, - 67, 0, 170, 346, 0, 356, 0, 351, 0, 0, - 0, 414, 0, 397, 0, 374, 72, 85, 116, 358, - 0, 97, 13, 0, 352, 354, 0, 406, 405, 408, - 380, 393, 391, 0, 0, 0, 0, 359, 361, 0, - 0, 407, 0, 0, 390, 0, 0, 388, 0, 0, - 0, 375, 70, 0, 409, 0, 380, 379, 381, 395, - 0, 377, 400, 376, 0, 410, 404, 389, 396, 0, - 392, 402, 394 -}; - -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int16 yydefgoto[] = -{ - -1, 291, 292, 293, 458, 294, 295, 296, 297, 298, - 299, 300, 343, 302, 303, 304, 305, 306, 307, 308, - 309, 310, 311, 312, 313, 344, 481, 345, 445, 346, - 411, 347, 201, 368, 274, 348, 203, 204, 205, 234, - 235, 236, 206, 207, 208, 209, 210, 211, 254, 255, - 212, 213, 214, 215, 251, 315, 247, 217, 218, 219, - 322, 257, 325, 326, 416, 417, 366, 453, 350, 351, - 352, 353, 433, 516, 542, 524, 525, 526, 543, 354, - 355, 356, 527, 515, 357, 528, 549, 358, 359, 494, - 422, 489, 509, 522, 523, 360, 220, 221, 222, 231 -}; - -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ #define YYPACT_NINF -496 + +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-496))) + +#define YYTABLE_NINF -379 + +#define yytable_value_is_error(Yytable_value) \ + 0 + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ static const yytype_int16 yypact[] = { 2394, -496, -496, -496, -496, -496, -496, -496, -496, -496, @@ -1353,7 +1034,70 @@ static const yytype_int16 yypact[] = -496, -496, -496 }; -/* YYPGOTO[NTERM-NUM]. */ + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_uint16 yydefact[] = +{ + 0, 145, 146, 144, 178, 172, 173, 174, 175, 176, + 177, 161, 185, 186, 187, 188, 189, 190, 191, 192, + 193, 194, 195, 196, 197, 198, 199, 179, 180, 181, + 200, 201, 202, 150, 148, 149, 147, 153, 151, 152, + 154, 155, 156, 157, 158, 159, 160, 182, 183, 184, + 212, 213, 214, 128, 127, 126, 0, 203, 204, 205, + 206, 207, 208, 209, 210, 211, 215, 216, 217, 218, + 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, + 229, 230, 231, 232, 233, 234, 235, 238, 239, 240, + 241, 242, 243, 245, 246, 247, 248, 249, 250, 252, + 253, 254, 255, 256, 257, 258, 236, 237, 244, 251, + 259, 260, 261, 262, 263, 264, 333, 265, 266, 267, + 268, 269, 270, 271, 272, 274, 275, 276, 277, 278, + 279, 281, 282, 283, 284, 285, 286, 288, 289, 290, + 291, 292, 293, 273, 280, 287, 294, 295, 296, 297, + 298, 299, 334, 335, 336, 337, 338, 339, 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, 0, 171, 341, 125, 135, 342, 343, 344, 0, + 419, 0, 420, 0, 102, 101, 0, 113, 118, 142, + 141, 139, 143, 0, 136, 138, 123, 165, 140, 340, + 0, 416, 418, 0, 0, 0, 347, 0, 0, 90, + 87, 0, 100, 0, 109, 103, 111, 0, 112, 0, + 88, 119, 0, 93, 137, 124, 0, 166, 1, 417, + 163, 0, 134, 132, 0, 130, 345, 0, 0, 91, + 0, 0, 421, 104, 108, 110, 106, 114, 105, 0, + 120, 96, 0, 94, 0, 2, 8, 9, 4, 5, + 6, 7, 10, 0, 0, 0, 167, 36, 35, 37, + 34, 3, 12, 30, 14, 19, 20, 0, 0, 24, + 0, 38, 0, 42, 45, 48, 53, 56, 58, 60, + 62, 64, 66, 68, 0, 28, 0, 162, 0, 0, + 129, 0, 0, 0, 0, 0, 349, 89, 92, 0, + 0, 401, 0, 0, 0, 0, 0, 0, 0, 0, + 373, 382, 386, 38, 71, 84, 0, 362, 0, 123, + 365, 384, 364, 363, 0, 366, 367, 368, 369, 370, + 371, 107, 0, 115, 0, 357, 122, 0, 0, 98, + 0, 95, 31, 32, 0, 16, 17, 0, 0, 22, + 21, 0, 171, 25, 27, 33, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 69, 168, 169, 0, 164, + 86, 133, 131, 0, 0, 355, 0, 353, 348, 350, + 412, 411, 0, 403, 0, 415, 413, 0, 0, 0, + 398, 399, 372, 0, 74, 75, 77, 76, 79, 80, + 81, 82, 83, 78, 73, 0, 0, 387, 383, 385, + 117, 0, 360, 0, 121, 0, 99, 11, 0, 18, + 15, 26, 39, 40, 41, 44, 43, 46, 47, 51, + 52, 49, 50, 54, 55, 57, 59, 61, 63, 65, + 67, 0, 170, 346, 0, 356, 0, 351, 0, 0, + 0, 414, 0, 397, 0, 374, 72, 85, 116, 358, + 0, 97, 13, 0, 352, 354, 0, 406, 405, 408, + 380, 393, 391, 0, 0, 0, 0, 359, 361, 0, + 0, 407, 0, 0, 390, 0, 0, 388, 0, 0, + 0, 375, 70, 0, 409, 0, 380, 379, 381, 395, + 0, 377, 400, 376, 0, 410, 404, 389, 396, 0, + 392, 402, 394 +}; + + /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, @@ -1368,10 +1112,24 @@ static const yytype_int16 yypgoto[] = -496, -496, -496, -496, -496, -496, -496, 28, -496, -496 }; -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -379 + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 291, 292, 293, 458, 294, 295, 296, 297, 298, + 299, 300, 343, 302, 303, 304, 305, 306, 307, 308, + 309, 310, 311, 312, 313, 344, 481, 345, 445, 346, + 411, 347, 201, 368, 274, 348, 203, 204, 205, 234, + 235, 236, 206, 207, 208, 209, 210, 211, 254, 255, + 212, 213, 214, 215, 251, 315, 247, 217, 218, 219, + 322, 257, 325, 326, 416, 417, 366, 453, 350, 351, + 352, 353, 433, 516, 542, 524, 525, 526, 543, 354, + 355, 356, 527, 515, 357, 528, 549, 358, 359, 494, + 422, 489, 509, 522, 523, 360, 220, 221, 222, 231 +}; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { 216, 237, 244, 365, 200, 374, 202, 260, 449, 252, @@ -1971,12 +1729,6 @@ static const yytype_int16 yytable[] = 192, 0, 0, 193 }; -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-496))) - -#define yytable_value_is_error(Yytable_value) \ - YYID (0) - static const yytype_int16 yycheck[] = { 0, 205, 213, 269, 0, 285, 0, 228, 354, 54, @@ -2576,8 +2328,8 @@ static const yytype_int16 yycheck[] = 205, -1, -1, 208 }; -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ static const yytype_uint16 yystos[] = { 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, @@ -2638,30 +2390,112 @@ static const yytype_uint16 yystos[] = 336, 247, 242 }; -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint16 yyr1[] = +{ + 0, 270, 271, 272, 272, 272, 272, 272, 272, 272, + 272, 272, 273, 273, 273, 273, 273, 273, 274, 275, + 276, 277, 277, 278, 278, 279, 279, 280, 281, 281, + 282, 282, 282, 282, 283, 283, 283, 283, 284, 284, + 284, 284, 285, 285, 285, 286, 286, 286, 287, 287, + 287, 287, 287, 288, 288, 288, 289, 289, 290, 290, + 291, 291, 292, 292, 293, 293, 294, 294, 295, 296, + 295, 297, 297, 298, 298, 298, 298, 298, 298, 298, + 298, 298, 298, 298, 299, 299, 300, 301, 301, 301, + 301, 301, 301, 301, 301, 301, 303, 302, 304, 304, + 305, 306, 306, 307, 307, 308, 309, 309, 310, 310, + 310, 310, 311, 312, 312, 312, 312, 312, 313, 313, + 313, 313, 313, 314, 314, 315, 316, 316, 316, 317, + 318, 318, 319, 319, 319, 320, 321, 321, 322, 322, + 322, 322, 322, 322, 323, 323, 323, 323, 323, 323, + 323, 323, 323, 323, 323, 323, 323, 323, 323, 323, + 323, 323, 323, 324, 324, 325, 325, 326, 326, 326, + 326, 327, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, + 327, 327, 328, 328, 328, 330, 329, 331, 329, 332, + 332, 333, 333, 334, 334, 335, 335, 336, 336, 336, + 337, 337, 338, 339, 339, 340, 340, 340, 340, 340, + 340, 340, 341, 342, 343, 341, 344, 344, 346, 345, + 347, 345, 348, 348, 349, 349, 350, 350, 351, 352, + 352, 353, 353, 355, 354, 356, 356, 357, 357, 359, + 358, 360, 358, 361, 358, 362, 362, 363, 363, 364, + 364, 365, 365, 365, 365, 365, 366, 366, 367, 367, + 369, 368 +}; -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab + /* 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, 3, 1, 4, 1, 3, 2, 2, 1, 1, + 1, 2, 2, 2, 1, 2, 3, 2, 1, 1, + 1, 2, 2, 2, 1, 1, 1, 1, 1, 3, + 3, 3, 1, 3, 3, 1, 3, 3, 1, 3, + 3, 3, 3, 1, 3, 3, 1, 3, 1, 3, + 1, 3, 1, 3, 1, 3, 1, 3, 1, 0, + 6, 1, 3, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 3, 1, 2, 2, 4, + 2, 3, 4, 2, 3, 4, 0, 6, 2, 3, + 2, 1, 1, 2, 3, 3, 2, 3, 2, 1, + 2, 1, 1, 1, 3, 4, 6, 5, 1, 2, + 3, 5, 4, 1, 2, 1, 1, 1, 1, 4, + 1, 3, 1, 3, 1, 1, 1, 2, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 4, 1, 3, 1, 2, 2, 3, 3, + 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 0, 6, 0, 5, 1, + 2, 3, 4, 1, 3, 1, 2, 1, 3, 4, + 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 2, 0, 0, 5, 1, 1, 0, 2, + 0, 2, 2, 3, 1, 2, 1, 2, 5, 3, + 1, 1, 4, 0, 8, 0, 1, 3, 2, 0, + 6, 0, 8, 0, 7, 1, 1, 1, 0, 2, + 3, 2, 2, 2, 3, 2, 1, 2, 1, 1, + 0, 3 +}; -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. However, - YYFAIL appears to be in use. Nevertheless, it is formally deprecated - in Bison 2.4.2's NEWS entry, where a plan to phase it out is - discussed. */ +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab -#define YYFAIL goto yyerrlab -#if defined YYFAIL - /* This is here to suppress warnings from the GCC cpp's - -Wunused-macros. Normally we don't worry about that warning, but - some users do, and we want to make it easy for users to remove - YYFAIL uses, which will produce warnings from Bison 2.5. */ -#endif #define YYRECOVERING() (!!yyerrstatus) @@ -2678,27 +2512,15 @@ do \ else \ { \ yyerror (pParseContext, YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (YYID (0)) + YYERROR; \ + } \ +while (0) /* Error token number */ -#define YYTERROR 1 -#define YYERRCODE 256 +#define YYTERROR 1 +#define YYERRCODE 256 -/* This macro is provided for backward compatibility. */ -#ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -#endif - - -/* YYLEX -- calling `yylex' with the right arguments. */ -#ifdef YYLEX_PARAM -# define YYLEX yylex (&yylval, YYLEX_PARAM) -#else -# define YYLEX yylex (&yylval, parseContext) -#endif /* Enable debugging if requested. */ #if YYDEBUG @@ -2708,58 +2530,47 @@ while (YYID (0)) # define YYFPRINTF fprintf # endif -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (YYID (0)) +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value, pParseContext); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (YYID (0)) +/* This macro is provided for backward compatibility. */ +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#endif -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value, pParseContext); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + + +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, glslang::TParseContext* pParseContext) -#else -static void -yy_symbol_value_print (yyoutput, yytype, yyvaluep, pParseContext) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; - glslang::TParseContext* pParseContext; -#endif { FILE *yyo = yyoutput; YYUSE (yyo); + YYUSE (pParseContext); if (!yyvaluep) return; - YYUSE (pParseContext); # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# else - YYUSE (yyoutput); # endif - switch (yytype) - { - default: - break; - } + YYUSE (yytype); } @@ -2767,23 +2578,11 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, pParseContext) | Print this symbol on YYOUTPUT. | `--------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, glslang::TParseContext* pParseContext) -#else -static void -yy_symbol_print (yyoutput, yytype, yyvaluep, pParseContext) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; - glslang::TParseContext* pParseContext; -#endif { - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep, pParseContext); YYFPRINTF (yyoutput, ")"); @@ -2794,16 +2593,8 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, pParseContext) | TOP (included). | `------------------------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) -#else -static void -yy_stack_print (yybottom, yytop) - yytype_int16 *yybottom; - yytype_int16 *yytop; -#endif { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) @@ -2814,50 +2605,42 @@ yy_stack_print (yybottom, yytop) YYFPRINTF (stderr, "\n"); } -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (YYID (0)) +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void -yy_reduce_print (YYSTYPE *yyvsp, int yyrule, glslang::TParseContext* pParseContext) -#else -static void -yy_reduce_print (yyvsp, yyrule, pParseContext) - YYSTYPE *yyvsp; - int yyrule; - glslang::TParseContext* pParseContext; -#endif +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, glslang::TParseContext* pParseContext) { + unsigned long int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; - unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); + yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)]) - , pParseContext); + yy_symbol_print (stderr, + yystos[yyssp[yyi + 1 - yynrhs]], + &(yyvsp[(yyi + 1) - (yynrhs)]) + , pParseContext); YYFPRINTF (stderr, "\n"); } } -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyvsp, Rule, pParseContext); \ -} while (YYID (0)) +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, Rule, pParseContext); \ +} while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ @@ -2871,7 +2654,7 @@ int yydebug; /* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH +#ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif @@ -2894,15 +2677,8 @@ int yydebug; # define yystrlen strlen # else /* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) -#else -static YYSIZE_T -yystrlen (yystr) - const char *yystr; -#endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) @@ -2918,16 +2694,8 @@ yystrlen (yystr) # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) -#else -static char * -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -#endif { char *yyd = yydest; const char *yys = yysrc; @@ -2957,27 +2725,27 @@ yytnamerr (char *yyres, const char *yystr) char const *yyp = yystr; for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } do_not_strip_quotes: ; } @@ -3000,11 +2768,11 @@ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { - YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); YYSIZE_T yysize = yysize0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ - const char *yyformat = YY_NULL; + const char *yyformat = YY_NULLPTR; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per @@ -3012,10 +2780,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, int yycount = 0; /* There are many possibilities here to consider: - - Assume YYFAIL is not used. It's too flawed to consider. See - - for details. YYERROR is fine as it does not invoke this - function. - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected @@ -3065,7 +2829,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, } yyarg[yycount++] = yytname[yyx]; { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; @@ -3132,33 +2896,18 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, | Release the memory associated to this symbol. | `-----------------------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, glslang::TParseContext* pParseContext) -#else -static void -yydestruct (yymsg, yytype, yyvaluep, pParseContext) - const char *yymsg; - int yytype; - YYSTYPE *yyvaluep; - glslang::TParseContext* pParseContext; -#endif { YYUSE (yyvaluep); YYUSE (pParseContext); - if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - switch (yytype) - { - - default: - break; - } + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END } @@ -3168,56 +2917,18 @@ yydestruct (yymsg, yytype, yyvaluep, pParseContext) | yyparse. | `----------*/ -#ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void *YYPARSE_PARAM) -#else -int -yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -#endif -#else /* ! YYPARSE_PARAM */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) int yyparse (glslang::TParseContext* pParseContext) -#else -int -yyparse (pParseContext) - glslang::TParseContext* pParseContext; -#endif -#endif { /* The lookahead symbol. */ int yychar; -#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ -/* Suppress an incorrect diagnostic about yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ - _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") -# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ - _Pragma ("GCC diagnostic pop") -#else +/* The semantic value of the lookahead symbol. */ /* Default value used for initialization, for pacifying older GCCs or non-GCC compilers. */ -static YYSTYPE yyval_default; -# define YY_INITIAL_VALUE(Value) = Value -#endif -#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_END -#endif -#ifndef YY_INITIAL_VALUE -# define YY_INITIAL_VALUE(Value) /* Nothing. */ -#endif - -/* The semantic value of the lookahead symbol. */ -YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); +YY_INITIAL_VALUE (static YYSTYPE yyval_default;) +YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); /* Number of syntax errors so far. */ int yynerrs; @@ -3227,8 +2938,8 @@ YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); int yyerrstatus; /* The stacks and their tools: - `yyss': related to states. - `yyvs': related to semantic values. + 'yyss': related to states. + 'yyvs': related to semantic values. Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ @@ -3296,23 +3007,23 @@ YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); #ifdef yyoverflow { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); - yyss = yyss1; - yyvs = yyvs1; + yyss = yyss1; + yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE @@ -3320,22 +3031,22 @@ YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; + goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; + yystacksize = YYMAXDEPTH; { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ @@ -3344,10 +3055,10 @@ YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) - YYABORT; + YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); @@ -3376,7 +3087,7 @@ yybackup: if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; + yychar = yylex (&yylval, parseContext); } if (yychar <= YYEOF) @@ -3441,7 +3152,7 @@ yyreduce: yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. + '$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison @@ -3455,248 +3166,247 @@ yyreduce: switch (yyn) { case 2: -/* Line 1792 of yacc.c */ -#line 246 "glslang.y" +#line 246 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = parseContext.handleVariable((yyvsp[(1) - (1)].lex).loc, (yyvsp[(1) - (1)].lex).symbol, (yyvsp[(1) - (1)].lex).string); + (yyval.interm.intermTypedNode) = parseContext.handleVariable((yyvsp[0].lex).loc, (yyvsp[0].lex).symbol, (yyvsp[0].lex).string); } +#line 3174 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 3: -/* Line 1792 of yacc.c */ -#line 252 "glslang.y" +#line 252 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); + (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } +#line 3182 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 4: -/* Line 1792 of yacc.c */ -#line 255 "glslang.y" +#line 255 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[(1) - (1)].lex).i, (yyvsp[(1) - (1)].lex).loc, true); + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).i, (yyvsp[0].lex).loc, true); } +#line 3190 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 5: -/* Line 1792 of yacc.c */ -#line 258 "glslang.y" +#line 258 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.fullIntegerCheck((yyvsp[(1) - (1)].lex).loc, "unsigned literal"); - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[(1) - (1)].lex).u, (yyvsp[(1) - (1)].lex).loc, true); + parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned literal"); + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).u, (yyvsp[0].lex).loc, true); } +#line 3199 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 6: -/* Line 1792 of yacc.c */ -#line 262 "glslang.y" +#line 262 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int64Check((yyvsp[(1) - (1)].lex).loc, "64-bit integer literal"); - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[(1) - (1)].lex).i64, (yyvsp[(1) - (1)].lex).loc, true); + parseContext.int64Check((yyvsp[0].lex).loc, "64-bit integer literal"); + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).i64, (yyvsp[0].lex).loc, true); } +#line 3208 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 7: -/* Line 1792 of yacc.c */ -#line 266 "glslang.y" +#line 266 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int64Check((yyvsp[(1) - (1)].lex).loc, "64-bit unsigned integer literal"); - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[(1) - (1)].lex).u64, (yyvsp[(1) - (1)].lex).loc, true); + parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer literal"); + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).u64, (yyvsp[0].lex).loc, true); } +#line 3217 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 8: -/* Line 1792 of yacc.c */ -#line 270 "glslang.y" +#line 270 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[(1) - (1)].lex).d, EbtFloat, (yyvsp[(1) - (1)].lex).loc, true); + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).d, EbtFloat, (yyvsp[0].lex).loc, true); } +#line 3225 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 9: -/* Line 1792 of yacc.c */ -#line 273 "glslang.y" +#line 273 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double literal"); - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[(1) - (1)].lex).d, EbtDouble, (yyvsp[(1) - (1)].lex).loc, true); + 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 3234 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 10: -/* Line 1792 of yacc.c */ -#line 277 "glslang.y" +#line 277 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[(1) - (1)].lex).b, (yyvsp[(1) - (1)].lex).loc, true); + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).b, (yyvsp[0].lex).loc, true); } +#line 3242 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 11: -/* Line 1792 of yacc.c */ -#line 280 "glslang.y" +#line 280 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = (yyvsp[(2) - (3)].interm.intermTypedNode); + (yyval.interm.intermTypedNode) = (yyvsp[-1].interm.intermTypedNode); if ((yyval.interm.intermTypedNode)->getAsConstantUnion()) (yyval.interm.intermTypedNode)->getAsConstantUnion()->setExpression(); } +#line 3252 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 12: -/* Line 1792 of yacc.c */ -#line 288 "glslang.y" +#line 288 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); + (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } +#line 3260 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 13: -/* Line 1792 of yacc.c */ -#line 291 "glslang.y" +#line 291 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = parseContext.handleBracketDereference((yyvsp[(2) - (4)].lex).loc, (yyvsp[(1) - (4)].interm.intermTypedNode), (yyvsp[(3) - (4)].interm.intermTypedNode)); + (yyval.interm.intermTypedNode) = parseContext.handleBracketDereference((yyvsp[-2].lex).loc, (yyvsp[-3].interm.intermTypedNode), (yyvsp[-1].interm.intermTypedNode)); } +#line 3268 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 14: -/* Line 1792 of yacc.c */ -#line 294 "glslang.y" +#line 294 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); + (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } +#line 3276 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 15: -/* Line 1792 of yacc.c */ -#line 297 "glslang.y" +#line 297 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = parseContext.handleDotDereference((yyvsp[(3) - (3)].lex).loc, (yyvsp[(1) - (3)].interm.intermTypedNode), *(yyvsp[(3) - (3)].lex).string); + (yyval.interm.intermTypedNode) = parseContext.handleDotDereference((yyvsp[0].lex).loc, (yyvsp[-2].interm.intermTypedNode), *(yyvsp[0].lex).string); } +#line 3284 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 16: -/* Line 1792 of yacc.c */ -#line 300 "glslang.y" +#line 300 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.variableCheck((yyvsp[(1) - (2)].interm.intermTypedNode)); - parseContext.lValueErrorCheck((yyvsp[(2) - (2)].lex).loc, "++", (yyvsp[(1) - (2)].interm.intermTypedNode)); - (yyval.interm.intermTypedNode) = parseContext.handleUnaryMath((yyvsp[(2) - (2)].lex).loc, "++", EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode)); + 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 3294 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 17: -/* Line 1792 of yacc.c */ -#line 305 "glslang.y" +#line 305 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.variableCheck((yyvsp[(1) - (2)].interm.intermTypedNode)); - parseContext.lValueErrorCheck((yyvsp[(2) - (2)].lex).loc, "--", (yyvsp[(1) - (2)].interm.intermTypedNode)); - (yyval.interm.intermTypedNode) = parseContext.handleUnaryMath((yyvsp[(2) - (2)].lex).loc, "--", EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode)); + 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 3304 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 18: -/* Line 1792 of yacc.c */ -#line 313 "glslang.y" +#line 313 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.integerCheck((yyvsp[(1) - (1)].interm.intermTypedNode), "[]"); - (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); + parseContext.integerCheck((yyvsp[0].interm.intermTypedNode), "[]"); + (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } +#line 3313 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 19: -/* Line 1792 of yacc.c */ -#line 320 "glslang.y" +#line 320 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = parseContext.handleFunctionCall((yyvsp[(1) - (1)].interm).loc, (yyvsp[(1) - (1)].interm).function, (yyvsp[(1) - (1)].interm).intermNode); - delete (yyvsp[(1) - (1)].interm).function; + (yyval.interm.intermTypedNode) = parseContext.handleFunctionCall((yyvsp[0].interm).loc, (yyvsp[0].interm).function, (yyvsp[0].interm).intermNode); + delete (yyvsp[0].interm).function; } +#line 3322 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 20: -/* Line 1792 of yacc.c */ -#line 327 "glslang.y" +#line 327 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm) = (yyvsp[(1) - (1)].interm); + (yyval.interm) = (yyvsp[0].interm); } +#line 3330 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 21: -/* Line 1792 of yacc.c */ -#line 333 "glslang.y" +#line 333 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm) = (yyvsp[(1) - (2)].interm); - (yyval.interm).loc = (yyvsp[(2) - (2)].lex).loc; + (yyval.interm) = (yyvsp[-1].interm); + (yyval.interm).loc = (yyvsp[0].lex).loc; } +#line 3339 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 22: -/* Line 1792 of yacc.c */ -#line 337 "glslang.y" +#line 337 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm) = (yyvsp[(1) - (2)].interm); - (yyval.interm).loc = (yyvsp[(2) - (2)].lex).loc; + (yyval.interm) = (yyvsp[-1].interm); + (yyval.interm).loc = (yyvsp[0].lex).loc; } +#line 3348 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 23: -/* Line 1792 of yacc.c */ -#line 344 "glslang.y" +#line 344 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm) = (yyvsp[(1) - (2)].interm); + (yyval.interm) = (yyvsp[-1].interm); } +#line 3356 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 24: -/* Line 1792 of yacc.c */ -#line 347 "glslang.y" +#line 347 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm) = (yyvsp[(1) - (1)].interm); + (yyval.interm) = (yyvsp[0].interm); } +#line 3364 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 25: -/* Line 1792 of yacc.c */ -#line 353 "glslang.y" +#line 353 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { TParameter param = { 0, new TType }; - param.type->shallowCopy((yyvsp[(2) - (2)].interm.intermTypedNode)->getType()); - (yyvsp[(1) - (2)].interm).function->addParameter(param); - (yyval.interm).function = (yyvsp[(1) - (2)].interm).function; - (yyval.interm).intermNode = (yyvsp[(2) - (2)].interm.intermTypedNode); + param.type->shallowCopy((yyvsp[0].interm.intermTypedNode)->getType()); + (yyvsp[-1].interm).function->addParameter(param); + (yyval.interm).function = (yyvsp[-1].interm).function; + (yyval.interm).intermNode = (yyvsp[0].interm.intermTypedNode); } +#line 3376 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 26: -/* Line 1792 of yacc.c */ -#line 360 "glslang.y" +#line 360 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { TParameter param = { 0, new TType }; - param.type->shallowCopy((yyvsp[(3) - (3)].interm.intermTypedNode)->getType()); - (yyvsp[(1) - (3)].interm).function->addParameter(param); - (yyval.interm).function = (yyvsp[(1) - (3)].interm).function; - (yyval.interm).intermNode = parseContext.intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).loc); + param.type->shallowCopy((yyvsp[0].interm.intermTypedNode)->getType()); + (yyvsp[-2].interm).function->addParameter(param); + (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 3388 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 27: -/* Line 1792 of yacc.c */ -#line 370 "glslang.y" +#line 370 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm) = (yyvsp[(1) - (2)].interm); + (yyval.interm) = (yyvsp[-1].interm); } +#line 3396 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 28: -/* Line 1792 of yacc.c */ -#line 378 "glslang.y" +#line 378 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // Constructor (yyval.interm).intermNode = 0; - (yyval.interm).function = parseContext.handleConstructorCall((yyvsp[(1) - (1)].interm.type).loc, (yyvsp[(1) - (1)].interm.type)); + (yyval.interm).function = parseContext.handleConstructorCall((yyvsp[0].interm.type).loc, (yyvsp[0].interm.type)); } +#line 3406 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 29: -/* Line 1792 of yacc.c */ -#line 383 "glslang.y" +#line 383 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // // Should be a method or subroutine call, but we haven't recognized the arguments yet. @@ -3704,18 +3414,18 @@ yyreduce: (yyval.interm).function = 0; (yyval.interm).intermNode = 0; - TIntermMethod* method = (yyvsp[(1) - (1)].interm.intermTypedNode)->getAsMethodNode(); + TIntermMethod* method = (yyvsp[0].interm.intermTypedNode)->getAsMethodNode(); if (method) { (yyval.interm).function = new TFunction(&method->getMethodName(), TType(EbtInt), EOpArrayLength); (yyval.interm).intermNode = method->getObject(); } else { - TIntermSymbol* symbol = (yyvsp[(1) - (1)].interm.intermTypedNode)->getAsSymbolNode(); + TIntermSymbol* symbol = (yyvsp[0].interm.intermTypedNode)->getAsSymbolNode(); if (symbol) { parseContext.reservedErrorCheck(symbol->getLoc(), symbol->getName()); TFunction *function = new TFunction(&symbol->getName(), TType(EbtVoid)); (yyval.interm).function = function; } else - parseContext.error((yyvsp[(1) - (1)].interm.intermTypedNode)->getLoc(), "function call, method, or subroutine call expected", "", ""); + parseContext.error((yyvsp[0].interm.intermTypedNode)->getLoc(), "function call, method, or subroutine call expected", "", ""); } if ((yyval.interm).function == 0) { @@ -3724,3693 +3434,3693 @@ yyreduce: (yyval.interm).function = new TFunction(&empty, TType(EbtVoid), EOpNull); } } +#line 3438 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 30: -/* Line 1792 of yacc.c */ -#line 413 "glslang.y" +#line 413 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.variableCheck((yyvsp[(1) - (1)].interm.intermTypedNode)); - (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); - if (TIntermMethod* method = (yyvsp[(1) - (1)].interm.intermTypedNode)->getAsMethodNode()) - parseContext.error((yyvsp[(1) - (1)].interm.intermTypedNode)->getLoc(), "incomplete method syntax", method->getMethodName().c_str(), ""); + 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 3449 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 31: -/* Line 1792 of yacc.c */ -#line 419 "glslang.y" +#line 419 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.lValueErrorCheck((yyvsp[(1) - (2)].lex).loc, "++", (yyvsp[(2) - (2)].interm.intermTypedNode)); - (yyval.interm.intermTypedNode) = parseContext.handleUnaryMath((yyvsp[(1) - (2)].lex).loc, "++", EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode)); + 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 3458 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 32: -/* Line 1792 of yacc.c */ -#line 423 "glslang.y" +#line 423 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.lValueErrorCheck((yyvsp[(1) - (2)].lex).loc, "--", (yyvsp[(2) - (2)].interm.intermTypedNode)); - (yyval.interm.intermTypedNode) = parseContext.handleUnaryMath((yyvsp[(1) - (2)].lex).loc, "--", EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode)); + 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 3467 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 33: -/* Line 1792 of yacc.c */ -#line 427 "glslang.y" +#line 427 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - if ((yyvsp[(1) - (2)].interm).op != EOpNull) { + if ((yyvsp[-1].interm).op != EOpNull) { char errorOp[2] = {0, 0}; - switch((yyvsp[(1) - (2)].interm).op) { + switch((yyvsp[-1].interm).op) { case EOpNegative: errorOp[0] = '-'; break; case EOpLogicalNot: errorOp[0] = '!'; break; case EOpBitwiseNot: errorOp[0] = '~'; break; default: break; // some compilers want this } - (yyval.interm.intermTypedNode) = parseContext.handleUnaryMath((yyvsp[(1) - (2)].interm).loc, errorOp, (yyvsp[(1) - (2)].interm).op, (yyvsp[(2) - (2)].interm.intermTypedNode)); + (yyval.interm.intermTypedNode) = parseContext.handleUnaryMath((yyvsp[-1].interm).loc, errorOp, (yyvsp[-1].interm).op, (yyvsp[0].interm.intermTypedNode)); } else { - (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode); + (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); if ((yyval.interm.intermTypedNode)->getAsConstantUnion()) (yyval.interm.intermTypedNode)->getAsConstantUnion()->setExpression(); } } +#line 3488 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 34: -/* Line 1792 of yacc.c */ -#line 447 "glslang.y" - { (yyval.interm).loc = (yyvsp[(1) - (1)].lex).loc; (yyval.interm).op = EOpNull; } +#line 447 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpNull; } +#line 3494 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 35: -/* Line 1792 of yacc.c */ -#line 448 "glslang.y" - { (yyval.interm).loc = (yyvsp[(1) - (1)].lex).loc; (yyval.interm).op = EOpNegative; } +#line 448 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpNegative; } +#line 3500 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 36: -/* Line 1792 of yacc.c */ -#line 449 "glslang.y" - { (yyval.interm).loc = (yyvsp[(1) - (1)].lex).loc; (yyval.interm).op = EOpLogicalNot; } +#line 449 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpLogicalNot; } +#line 3506 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 37: -/* Line 1792 of yacc.c */ -#line 450 "glslang.y" - { (yyval.interm).loc = (yyvsp[(1) - (1)].lex).loc; (yyval.interm).op = EOpBitwiseNot; - parseContext.fullIntegerCheck((yyvsp[(1) - (1)].lex).loc, "bitwise not"); } +#line 450 "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 3513 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 38: -/* Line 1792 of yacc.c */ -#line 456 "glslang.y" - { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } +#line 456 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } +#line 3519 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 39: -/* Line 1792 of yacc.c */ -#line 457 "glslang.y" +#line 457 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, "*", EOpMul, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); + (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[(1) - (3)].interm.intermTypedNode); + (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } +#line 3529 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 40: -/* Line 1792 of yacc.c */ -#line 462 "glslang.y" +#line 462 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, "/", EOpDiv, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); + (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[(1) - (3)].interm.intermTypedNode); + (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } +#line 3539 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 41: -/* Line 1792 of yacc.c */ -#line 467 "glslang.y" +#line 467 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.fullIntegerCheck((yyvsp[(2) - (3)].lex).loc, "%"); - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, "%", EOpMod, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); + 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[(1) - (3)].interm.intermTypedNode); + (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } +#line 3550 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 42: -/* Line 1792 of yacc.c */ -#line 476 "glslang.y" - { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } +#line 476 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } +#line 3556 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 43: -/* Line 1792 of yacc.c */ -#line 477 "glslang.y" +#line 477 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, "+", EOpAdd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); + (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[(1) - (3)].interm.intermTypedNode); + (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } +#line 3566 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 44: -/* Line 1792 of yacc.c */ -#line 482 "glslang.y" +#line 482 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, "-", EOpSub, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); + (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[(1) - (3)].interm.intermTypedNode); + (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } +#line 3576 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 45: -/* Line 1792 of yacc.c */ -#line 490 "glslang.y" - { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } +#line 490 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } +#line 3582 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 46: -/* Line 1792 of yacc.c */ -#line 491 "glslang.y" +#line 491 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.fullIntegerCheck((yyvsp[(2) - (3)].lex).loc, "bit shift left"); - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, "<<", EOpLeftShift, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); + 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[(1) - (3)].interm.intermTypedNode); + (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } +#line 3593 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 47: -/* Line 1792 of yacc.c */ -#line 497 "glslang.y" +#line 497 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.fullIntegerCheck((yyvsp[(2) - (3)].lex).loc, "bit shift right"); - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, ">>", EOpRightShift, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); + 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[(1) - (3)].interm.intermTypedNode); + (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } +#line 3604 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 48: -/* Line 1792 of yacc.c */ -#line 506 "glslang.y" - { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } +#line 506 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } +#line 3610 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 49: -/* Line 1792 of yacc.c */ -#line 507 "glslang.y" +#line 507 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, "<", EOpLessThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); + (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[(2) - (3)].lex).loc); + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } +#line 3620 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 50: -/* Line 1792 of yacc.c */ -#line 512 "glslang.y" +#line 512 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, ">", EOpGreaterThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); + (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[(2) - (3)].lex).loc); + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } +#line 3630 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 51: -/* Line 1792 of yacc.c */ -#line 517 "glslang.y" +#line 517 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, "<=", EOpLessThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); + (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[(2) - (3)].lex).loc); + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } +#line 3640 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 52: -/* Line 1792 of yacc.c */ -#line 522 "glslang.y" +#line 522 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, ">=", EOpGreaterThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); + (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[(2) - (3)].lex).loc); + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } +#line 3650 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 53: -/* Line 1792 of yacc.c */ -#line 530 "glslang.y" - { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } +#line 530 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } +#line 3656 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 54: -/* Line 1792 of yacc.c */ -#line 531 "glslang.y" +#line 531 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.arrayObjectCheck((yyvsp[(2) - (3)].lex).loc, (yyvsp[(1) - (3)].interm.intermTypedNode)->getType(), "array comparison"); - parseContext.opaqueCheck((yyvsp[(2) - (3)].lex).loc, (yyvsp[(1) - (3)].interm.intermTypedNode)->getType(), "=="); - parseContext.specializationCheck((yyvsp[(2) - (3)].lex).loc, (yyvsp[(1) - (3)].interm.intermTypedNode)->getType(), "=="); - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, "==", EOpEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); + parseContext.arrayObjectCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "array comparison"); + parseContext.opaqueCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "=="); + parseContext.specializationCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "=="); + (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "==", EOpEqual, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[(2) - (3)].lex).loc); + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } +#line 3669 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 55: -/* Line 1792 of yacc.c */ -#line 539 "glslang.y" +#line 539 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.arrayObjectCheck((yyvsp[(2) - (3)].lex).loc, (yyvsp[(1) - (3)].interm.intermTypedNode)->getType(), "array comparison"); - parseContext.opaqueCheck((yyvsp[(2) - (3)].lex).loc, (yyvsp[(1) - (3)].interm.intermTypedNode)->getType(), "!="); - parseContext.specializationCheck((yyvsp[(2) - (3)].lex).loc, (yyvsp[(1) - (3)].interm.intermTypedNode)->getType(), "!="); - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, "!=", EOpNotEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); + parseContext.arrayObjectCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "array comparison"); + parseContext.opaqueCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "!="); + parseContext.specializationCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "!="); + (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "!=", EOpNotEqual, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[(2) - (3)].lex).loc); + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } +#line 3682 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 56: -/* Line 1792 of yacc.c */ -#line 550 "glslang.y" - { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } +#line 550 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } +#line 3688 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 57: -/* Line 1792 of yacc.c */ -#line 551 "glslang.y" +#line 551 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.fullIntegerCheck((yyvsp[(2) - (3)].lex).loc, "bitwise and"); - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, "&", EOpAnd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); + 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[(1) - (3)].interm.intermTypedNode); + (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } +#line 3699 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 58: -/* Line 1792 of yacc.c */ -#line 560 "glslang.y" - { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } +#line 560 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } +#line 3705 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 59: -/* Line 1792 of yacc.c */ -#line 561 "glslang.y" +#line 561 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.fullIntegerCheck((yyvsp[(2) - (3)].lex).loc, "bitwise exclusive or"); - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, "^", EOpExclusiveOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); + 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[(1) - (3)].interm.intermTypedNode); + (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } +#line 3716 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 60: -/* Line 1792 of yacc.c */ -#line 570 "glslang.y" - { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } +#line 570 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } +#line 3722 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 61: -/* Line 1792 of yacc.c */ -#line 571 "glslang.y" +#line 571 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.fullIntegerCheck((yyvsp[(2) - (3)].lex).loc, "bitwise inclusive or"); - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, "|", EOpInclusiveOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); + 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[(1) - (3)].interm.intermTypedNode); + (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } +#line 3733 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 62: -/* Line 1792 of yacc.c */ -#line 580 "glslang.y" - { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } +#line 580 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } +#line 3739 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 63: -/* Line 1792 of yacc.c */ -#line 581 "glslang.y" +#line 581 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, "&&", EOpLogicalAnd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); + (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[(2) - (3)].lex).loc); + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } +#line 3749 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 64: -/* Line 1792 of yacc.c */ -#line 589 "glslang.y" - { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } +#line 589 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } +#line 3755 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 65: -/* Line 1792 of yacc.c */ -#line 590 "glslang.y" +#line 590 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, "^^", EOpLogicalXor, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); + (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[(2) - (3)].lex).loc); + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } +#line 3765 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 66: -/* Line 1792 of yacc.c */ -#line 598 "glslang.y" - { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } +#line 598 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } +#line 3771 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 67: -/* Line 1792 of yacc.c */ -#line 599 "glslang.y" +#line 599 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[(2) - (3)].lex).loc, "||", EOpLogicalOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); + (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[(2) - (3)].lex).loc); + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } +#line 3781 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 68: -/* Line 1792 of yacc.c */ -#line 607 "glslang.y" - { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } +#line 607 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } +#line 3787 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 69: -/* Line 1792 of yacc.c */ -#line 608 "glslang.y" +#line 608 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { ++parseContext.controlFlowNestingLevel; } +#line 3795 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 70: -/* Line 1792 of yacc.c */ -#line 611 "glslang.y" +#line 611 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { --parseContext.controlFlowNestingLevel; - parseContext.boolCheck((yyvsp[(2) - (6)].lex).loc, (yyvsp[(1) - (6)].interm.intermTypedNode)); - parseContext.rValueErrorCheck((yyvsp[(2) - (6)].lex).loc, "?", (yyvsp[(1) - (6)].interm.intermTypedNode)); - parseContext.rValueErrorCheck((yyvsp[(5) - (6)].lex).loc, ":", (yyvsp[(4) - (6)].interm.intermTypedNode)); - parseContext.rValueErrorCheck((yyvsp[(5) - (6)].lex).loc, ":", (yyvsp[(6) - (6)].interm.intermTypedNode)); - (yyval.interm.intermTypedNode) = parseContext.intermediate.addSelection((yyvsp[(1) - (6)].interm.intermTypedNode), (yyvsp[(4) - (6)].interm.intermTypedNode), (yyvsp[(6) - (6)].interm.intermTypedNode), (yyvsp[(2) - (6)].lex).loc); + parseContext.boolCheck((yyvsp[-4].lex).loc, (yyvsp[-5].interm.intermTypedNode)); + parseContext.rValueErrorCheck((yyvsp[-4].lex).loc, "?", (yyvsp[-5].interm.intermTypedNode)); + parseContext.rValueErrorCheck((yyvsp[-1].lex).loc, ":", (yyvsp[-2].interm.intermTypedNode)); + parseContext.rValueErrorCheck((yyvsp[-1].lex).loc, ":", (yyvsp[0].interm.intermTypedNode)); + (yyval.interm.intermTypedNode) = parseContext.intermediate.addSelection((yyvsp[-5].interm.intermTypedNode), (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yyvsp[-4].lex).loc); if ((yyval.interm.intermTypedNode) == 0) { - parseContext.binaryOpError((yyvsp[(2) - (6)].lex).loc, ":", (yyvsp[(4) - (6)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(6) - (6)].interm.intermTypedNode)->getCompleteString()); - (yyval.interm.intermTypedNode) = (yyvsp[(6) - (6)].interm.intermTypedNode); + parseContext.binaryOpError((yyvsp[-4].lex).loc, ":", (yyvsp[-2].interm.intermTypedNode)->getCompleteString(), (yyvsp[0].interm.intermTypedNode)->getCompleteString()); + (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } } +#line 3812 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 71: -/* Line 1792 of yacc.c */ -#line 626 "glslang.y" - { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); } +#line 626 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } +#line 3818 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 72: -/* Line 1792 of yacc.c */ -#line 627 "glslang.y" +#line 627 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.arrayObjectCheck((yyvsp[(2) - (3)].interm).loc, (yyvsp[(1) - (3)].interm.intermTypedNode)->getType(), "array assignment"); - parseContext.opaqueCheck((yyvsp[(2) - (3)].interm).loc, (yyvsp[(1) - (3)].interm.intermTypedNode)->getType(), "="); - parseContext.specializationCheck((yyvsp[(2) - (3)].interm).loc, (yyvsp[(1) - (3)].interm.intermTypedNode)->getType(), "="); - parseContext.lValueErrorCheck((yyvsp[(2) - (3)].interm).loc, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)); - parseContext.rValueErrorCheck((yyvsp[(2) - (3)].interm).loc, "assign", (yyvsp[(3) - (3)].interm.intermTypedNode)); - (yyval.interm.intermTypedNode) = parseContext.intermediate.addAssign((yyvsp[(2) - (3)].interm).op, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].interm).loc); + parseContext.arrayObjectCheck((yyvsp[-1].interm).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "array assignment"); + parseContext.opaqueCheck((yyvsp[-1].interm).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "="); + parseContext.specializationCheck((yyvsp[-1].interm).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "="); + parseContext.lValueErrorCheck((yyvsp[-1].interm).loc, "assign", (yyvsp[-2].interm.intermTypedNode)); + parseContext.rValueErrorCheck((yyvsp[-1].interm).loc, "assign", (yyvsp[0].interm.intermTypedNode)); + (yyval.interm.intermTypedNode) = parseContext.intermediate.addAssign((yyvsp[-1].interm).op, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yyvsp[-1].interm).loc); if ((yyval.interm.intermTypedNode) == 0) { - parseContext.assignError((yyvsp[(2) - (3)].interm).loc, "assign", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); - (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode); + parseContext.assignError((yyvsp[-1].interm).loc, "assign", (yyvsp[-2].interm.intermTypedNode)->getCompleteString(), (yyvsp[0].interm.intermTypedNode)->getCompleteString()); + (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } } +#line 3835 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 73: -/* Line 1792 of yacc.c */ -#line 642 "glslang.y" +#line 642 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm).loc = (yyvsp[(1) - (1)].lex).loc; + (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpAssign; } +#line 3844 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 74: -/* Line 1792 of yacc.c */ -#line 646 "glslang.y" +#line 646 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm).loc = (yyvsp[(1) - (1)].lex).loc; + (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpMulAssign; } +#line 3853 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 75: -/* Line 1792 of yacc.c */ -#line 650 "glslang.y" +#line 650 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm).loc = (yyvsp[(1) - (1)].lex).loc; + (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpDivAssign; } +#line 3862 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 76: -/* Line 1792 of yacc.c */ -#line 654 "glslang.y" +#line 654 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.fullIntegerCheck((yyvsp[(1) - (1)].lex).loc, "%="); - (yyval.interm).loc = (yyvsp[(1) - (1)].lex).loc; + parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "%="); + (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpModAssign; } +#line 3872 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 77: -/* Line 1792 of yacc.c */ -#line 659 "glslang.y" +#line 659 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm).loc = (yyvsp[(1) - (1)].lex).loc; + (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpAddAssign; } +#line 3881 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 78: -/* Line 1792 of yacc.c */ -#line 663 "glslang.y" +#line 663 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm).loc = (yyvsp[(1) - (1)].lex).loc; + (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpSubAssign; } +#line 3890 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 79: -/* Line 1792 of yacc.c */ -#line 667 "glslang.y" +#line 667 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.fullIntegerCheck((yyvsp[(1) - (1)].lex).loc, "bit-shift left assign"); - (yyval.interm).loc = (yyvsp[(1) - (1)].lex).loc; (yyval.interm).op = EOpLeftShiftAssign; + parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bit-shift left assign"); + (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpLeftShiftAssign; } +#line 3899 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 80: -/* Line 1792 of yacc.c */ -#line 671 "glslang.y" +#line 671 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.fullIntegerCheck((yyvsp[(1) - (1)].lex).loc, "bit-shift right assign"); - (yyval.interm).loc = (yyvsp[(1) - (1)].lex).loc; (yyval.interm).op = EOpRightShiftAssign; + parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bit-shift right assign"); + (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpRightShiftAssign; } +#line 3908 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 81: -/* Line 1792 of yacc.c */ -#line 675 "glslang.y" +#line 675 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.fullIntegerCheck((yyvsp[(1) - (1)].lex).loc, "bitwise-and assign"); - (yyval.interm).loc = (yyvsp[(1) - (1)].lex).loc; (yyval.interm).op = EOpAndAssign; + parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bitwise-and assign"); + (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpAndAssign; } +#line 3917 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 82: -/* Line 1792 of yacc.c */ -#line 679 "glslang.y" +#line 679 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.fullIntegerCheck((yyvsp[(1) - (1)].lex).loc, "bitwise-xor assign"); - (yyval.interm).loc = (yyvsp[(1) - (1)].lex).loc; (yyval.interm).op = EOpExclusiveOrAssign; + parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bitwise-xor assign"); + (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpExclusiveOrAssign; } +#line 3926 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 83: -/* Line 1792 of yacc.c */ -#line 683 "glslang.y" +#line 683 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.fullIntegerCheck((yyvsp[(1) - (1)].lex).loc, "bitwise-or assign"); - (yyval.interm).loc = (yyvsp[(1) - (1)].lex).loc; (yyval.interm).op = EOpInclusiveOrAssign; + parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bitwise-or assign"); + (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpInclusiveOrAssign; } +#line 3935 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 84: -/* Line 1792 of yacc.c */ -#line 690 "glslang.y" +#line 690 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); + (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } +#line 3943 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 85: -/* Line 1792 of yacc.c */ -#line 693 "glslang.y" +#line 693 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = parseContext.intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yyvsp[(2) - (3)].lex).loc); + (yyval.interm.intermTypedNode) = parseContext.intermediate.addComma((yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yyvsp[-1].lex).loc); if ((yyval.interm.intermTypedNode) == 0) { - parseContext.binaryOpError((yyvsp[(2) - (3)].lex).loc, ",", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString()); - (yyval.interm.intermTypedNode) = (yyvsp[(3) - (3)].interm.intermTypedNode); + parseContext.binaryOpError((yyvsp[-1].lex).loc, ",", (yyvsp[-2].interm.intermTypedNode)->getCompleteString(), (yyvsp[0].interm.intermTypedNode)->getCompleteString()); + (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } } +#line 3955 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 86: -/* Line 1792 of yacc.c */ -#line 703 "glslang.y" +#line 703 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.constantValueCheck((yyvsp[(1) - (1)].interm.intermTypedNode), ""); - (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); + parseContext.constantValueCheck((yyvsp[0].interm.intermTypedNode), ""); + (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } +#line 3964 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 87: -/* Line 1792 of yacc.c */ -#line 710 "glslang.y" +#line 710 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.handleFunctionDeclarator((yyvsp[(1) - (2)].interm).loc, *(yyvsp[(1) - (2)].interm).function, true /* prototype */); + 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 3974 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 88: -/* Line 1792 of yacc.c */ -#line 715 "glslang.y" +#line 715 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - if ((yyvsp[(1) - (2)].interm).intermNode && (yyvsp[(1) - (2)].interm).intermNode->getAsAggregate()) - (yyvsp[(1) - (2)].interm).intermNode->getAsAggregate()->setOperator(EOpSequence); - (yyval.interm.intermNode) = (yyvsp[(1) - (2)].interm).intermNode; + 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 3984 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 89: -/* Line 1792 of yacc.c */ -#line 720 "glslang.y" +#line 720 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.profileRequires((yyvsp[(1) - (4)].lex).loc, ENoProfile, 130, 0, "precision statement"); + 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[(1) - (4)].lex).loc, (yyvsp[(3) - (4)].interm.type), (yyvsp[(2) - (4)].interm.type).qualifier.precision); + parseContext.setDefaultPrecision((yyvsp[-3].lex).loc, (yyvsp[-1].interm.type), (yyvsp[-2].interm.type).qualifier.precision); (yyval.interm.intermNode) = 0; } +#line 3997 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 90: -/* Line 1792 of yacc.c */ -#line 728 "glslang.y" +#line 728 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.declareBlock((yyvsp[(1) - (2)].interm).loc, *(yyvsp[(1) - (2)].interm).typeList); + parseContext.declareBlock((yyvsp[-1].interm).loc, *(yyvsp[-1].interm).typeList); (yyval.interm.intermNode) = 0; } +#line 4006 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 91: -/* Line 1792 of yacc.c */ -#line 732 "glslang.y" +#line 732 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.declareBlock((yyvsp[(1) - (3)].interm).loc, *(yyvsp[(1) - (3)].interm).typeList, (yyvsp[(2) - (3)].lex).string); + parseContext.declareBlock((yyvsp[-2].interm).loc, *(yyvsp[-2].interm).typeList, (yyvsp[-1].lex).string); (yyval.interm.intermNode) = 0; } +#line 4015 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 92: -/* Line 1792 of yacc.c */ -#line 736 "glslang.y" +#line 736 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.declareBlock((yyvsp[(1) - (4)].interm).loc, *(yyvsp[(1) - (4)].interm).typeList, (yyvsp[(2) - (4)].lex).string, (yyvsp[(3) - (4)].interm).arraySizes); + parseContext.declareBlock((yyvsp[-3].interm).loc, *(yyvsp[-3].interm).typeList, (yyvsp[-2].lex).string, (yyvsp[-1].interm).arraySizes); (yyval.interm.intermNode) = 0; } +#line 4024 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 93: -/* Line 1792 of yacc.c */ -#line 740 "glslang.y" +#line 740 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.globalQualifierFixCheck((yyvsp[(1) - (2)].interm.type).loc, (yyvsp[(1) - (2)].interm.type).qualifier); - parseContext.updateStandaloneQualifierDefaults((yyvsp[(1) - (2)].interm.type).loc, (yyvsp[(1) - (2)].interm.type)); + parseContext.globalQualifierFixCheck((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).qualifier); + parseContext.updateStandaloneQualifierDefaults((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type)); (yyval.interm.intermNode) = 0; } +#line 4034 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 94: -/* Line 1792 of yacc.c */ -#line 745 "glslang.y" +#line 745 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.checkNoShaderLayouts((yyvsp[(1) - (3)].interm.type).loc, (yyvsp[(1) - (3)].interm.type).shaderQualifiers); - parseContext.addQualifierToExisting((yyvsp[(1) - (3)].interm.type).loc, (yyvsp[(1) - (3)].interm.type).qualifier, *(yyvsp[(2) - (3)].lex).string); + parseContext.checkNoShaderLayouts((yyvsp[-2].interm.type).loc, (yyvsp[-2].interm.type).shaderQualifiers); + parseContext.addQualifierToExisting((yyvsp[-2].interm.type).loc, (yyvsp[-2].interm.type).qualifier, *(yyvsp[-1].lex).string); (yyval.interm.intermNode) = 0; } +#line 4044 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 95: -/* Line 1792 of yacc.c */ -#line 750 "glslang.y" +#line 750 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.checkNoShaderLayouts((yyvsp[(1) - (4)].interm.type).loc, (yyvsp[(1) - (4)].interm.type).shaderQualifiers); - (yyvsp[(3) - (4)].interm.identifierList)->push_back((yyvsp[(2) - (4)].lex).string); - parseContext.addQualifierToExisting((yyvsp[(1) - (4)].interm.type).loc, (yyvsp[(1) - (4)].interm.type).qualifier, *(yyvsp[(3) - (4)].interm.identifierList)); + parseContext.checkNoShaderLayouts((yyvsp[-3].interm.type).loc, (yyvsp[-3].interm.type).shaderQualifiers); + (yyvsp[-1].interm.identifierList)->push_back((yyvsp[-2].lex).string); + parseContext.addQualifierToExisting((yyvsp[-3].interm.type).loc, (yyvsp[-3].interm.type).qualifier, *(yyvsp[-1].interm.identifierList)); (yyval.interm.intermNode) = 0; } +#line 4055 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 96: -/* Line 1792 of yacc.c */ -#line 759 "glslang.y" - { parseContext.nestedBlockCheck((yyvsp[(1) - (3)].interm.type).loc); } +#line 759 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { parseContext.nestedBlockCheck((yyvsp[-2].interm.type).loc); } +#line 4061 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 97: -/* Line 1792 of yacc.c */ -#line 759 "glslang.y" +#line 759 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { --parseContext.structNestingLevel; - parseContext.blockName = (yyvsp[(2) - (6)].lex).string; - parseContext.globalQualifierFixCheck((yyvsp[(1) - (6)].interm.type).loc, (yyvsp[(1) - (6)].interm.type).qualifier); - parseContext.checkNoShaderLayouts((yyvsp[(1) - (6)].interm.type).loc, (yyvsp[(1) - (6)].interm.type).shaderQualifiers); - parseContext.currentBlockQualifier = (yyvsp[(1) - (6)].interm.type).qualifier; - (yyval.interm).loc = (yyvsp[(1) - (6)].interm.type).loc; - (yyval.interm).typeList = (yyvsp[(5) - (6)].interm.typeList); + parseContext.blockName = (yyvsp[-4].lex).string; + parseContext.globalQualifierFixCheck((yyvsp[-5].interm.type).loc, (yyvsp[-5].interm.type).qualifier); + parseContext.checkNoShaderLayouts((yyvsp[-5].interm.type).loc, (yyvsp[-5].interm.type).shaderQualifiers); + parseContext.currentBlockQualifier = (yyvsp[-5].interm.type).qualifier; + (yyval.interm).loc = (yyvsp[-5].interm.type).loc; + (yyval.interm).typeList = (yyvsp[-1].interm.typeList); } +#line 4075 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 98: -/* Line 1792 of yacc.c */ -#line 770 "glslang.y" +#line 770 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.identifierList) = new TIdentifierList; - (yyval.interm.identifierList)->push_back((yyvsp[(2) - (2)].lex).string); + (yyval.interm.identifierList)->push_back((yyvsp[0].lex).string); } +#line 4084 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 99: -/* Line 1792 of yacc.c */ -#line 774 "glslang.y" +#line 774 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.identifierList) = (yyvsp[(1) - (3)].interm.identifierList); - (yyval.interm.identifierList)->push_back((yyvsp[(3) - (3)].lex).string); + (yyval.interm.identifierList) = (yyvsp[-2].interm.identifierList); + (yyval.interm.identifierList)->push_back((yyvsp[0].lex).string); } +#line 4093 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 100: -/* Line 1792 of yacc.c */ -#line 781 "glslang.y" +#line 781 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm).function = (yyvsp[(1) - (2)].interm.function); - (yyval.interm).loc = (yyvsp[(2) - (2)].lex).loc; + (yyval.interm).function = (yyvsp[-1].interm.function); + (yyval.interm).loc = (yyvsp[0].lex).loc; } +#line 4102 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 101: -/* Line 1792 of yacc.c */ -#line 788 "glslang.y" +#line 788 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function); + (yyval.interm.function) = (yyvsp[0].interm.function); } +#line 4110 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 102: -/* Line 1792 of yacc.c */ -#line 791 "glslang.y" +#line 791 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function); + (yyval.interm.function) = (yyvsp[0].interm.function); } +#line 4118 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 103: -/* Line 1792 of yacc.c */ -#line 798 "glslang.y" +#line 798 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // Add the parameter - (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function); - if ((yyvsp[(2) - (2)].interm).param.type->getBasicType() != EbtVoid) - (yyvsp[(1) - (2)].interm.function)->addParameter((yyvsp[(2) - (2)].interm).param); + (yyval.interm.function) = (yyvsp[-1].interm.function); + if ((yyvsp[0].interm).param.type->getBasicType() != EbtVoid) + (yyvsp[-1].interm.function)->addParameter((yyvsp[0].interm).param); else - delete (yyvsp[(2) - (2)].interm).param.type; + delete (yyvsp[0].interm).param.type; } +#line 4131 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 104: -/* Line 1792 of yacc.c */ -#line 806 "glslang.y" +#line 806 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // // Only first parameter of one-parameter functions can be void // The check for named parameters not being void is done in parameter_declarator // - if ((yyvsp[(3) - (3)].interm).param.type->getBasicType() == EbtVoid) { + if ((yyvsp[0].interm).param.type->getBasicType() == EbtVoid) { // // This parameter > first is void // - parseContext.error((yyvsp[(2) - (3)].lex).loc, "cannot be an argument type except for '(void)'", "void", ""); - delete (yyvsp[(3) - (3)].interm).param.type; + parseContext.error((yyvsp[-1].lex).loc, "cannot be an argument type except for '(void)'", "void", ""); + delete (yyvsp[0].interm).param.type; } else { // Add the parameter - (yyval.interm.function) = (yyvsp[(1) - (3)].interm.function); - (yyvsp[(1) - (3)].interm.function)->addParameter((yyvsp[(3) - (3)].interm).param); + (yyval.interm.function) = (yyvsp[-2].interm.function); + (yyvsp[-2].interm.function)->addParameter((yyvsp[0].interm).param); } } +#line 4153 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 105: -/* Line 1792 of yacc.c */ -#line 826 "glslang.y" +#line 826 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - if ((yyvsp[(1) - (3)].interm.type).qualifier.storage != EvqGlobal && (yyvsp[(1) - (3)].interm.type).qualifier.storage != EvqTemporary) { - parseContext.error((yyvsp[(2) - (3)].lex).loc, "no qualifiers allowed for function return", - GetStorageQualifierString((yyvsp[(1) - (3)].interm.type).qualifier.storage), ""); + 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", + GetStorageQualifierString((yyvsp[-2].interm.type).qualifier.storage), ""); } - if ((yyvsp[(1) - (3)].interm.type).arraySizes) - parseContext.arraySizeRequiredCheck((yyvsp[(1) - (3)].interm.type).loc, *(yyvsp[(1) - (3)].interm.type).arraySizes); + if ((yyvsp[-2].interm.type).arraySizes) + parseContext.arraySizeRequiredCheck((yyvsp[-2].interm.type).loc, *(yyvsp[-2].interm.type).arraySizes); // Add the function as a prototype after parsing it (we do not support recursion) TFunction *function; - TType type((yyvsp[(1) - (3)].interm.type)); - function = new TFunction((yyvsp[(2) - (3)].lex).string, type); + TType type((yyvsp[-2].interm.type)); + function = new TFunction((yyvsp[-1].lex).string, type); (yyval.interm.function) = function; } +#line 4172 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 106: -/* Line 1792 of yacc.c */ -#line 844 "glslang.y" +#line 844 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - if ((yyvsp[(1) - (2)].interm.type).arraySizes) { - parseContext.profileRequires((yyvsp[(1) - (2)].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); - parseContext.profileRequires((yyvsp[(1) - (2)].interm.type).loc, EEsProfile, 300, 0, "arrayed type"); - parseContext.arraySizeRequiredCheck((yyvsp[(1) - (2)].interm.type).loc, *(yyvsp[(1) - (2)].interm.type).arraySizes); + if ((yyvsp[-1].interm.type).arraySizes) { + parseContext.profileRequires((yyvsp[-1].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); + parseContext.profileRequires((yyvsp[-1].interm.type).loc, EEsProfile, 300, 0, "arrayed type"); + parseContext.arraySizeRequiredCheck((yyvsp[-1].interm.type).loc, *(yyvsp[-1].interm.type).arraySizes); } - if ((yyvsp[(1) - (2)].interm.type).basicType == EbtVoid) { - parseContext.error((yyvsp[(2) - (2)].lex).loc, "illegal use of type 'void'", (yyvsp[(2) - (2)].lex).string->c_str(), ""); + if ((yyvsp[-1].interm.type).basicType == EbtVoid) { + parseContext.error((yyvsp[0].lex).loc, "illegal use of type 'void'", (yyvsp[0].lex).string->c_str(), ""); } - parseContext.reservedErrorCheck((yyvsp[(2) - (2)].lex).loc, *(yyvsp[(2) - (2)].lex).string); + parseContext.reservedErrorCheck((yyvsp[0].lex).loc, *(yyvsp[0].lex).string); - TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))}; - (yyval.interm).loc = (yyvsp[(2) - (2)].lex).loc; + TParameter param = {(yyvsp[0].lex).string, new TType((yyvsp[-1].interm.type))}; + (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).param = param; } +#line 4192 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 107: -/* Line 1792 of yacc.c */ -#line 859 "glslang.y" +#line 859 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - if ((yyvsp[(1) - (3)].interm.type).arraySizes) { - parseContext.profileRequires((yyvsp[(1) - (3)].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); - parseContext.profileRequires((yyvsp[(1) - (3)].interm.type).loc, EEsProfile, 300, 0, "arrayed type"); - parseContext.arraySizeRequiredCheck((yyvsp[(1) - (3)].interm.type).loc, *(yyvsp[(1) - (3)].interm.type).arraySizes); + 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"); + parseContext.arraySizeRequiredCheck((yyvsp[-2].interm.type).loc, *(yyvsp[-2].interm.type).arraySizes); } - parseContext.arrayDimCheck((yyvsp[(2) - (3)].lex).loc, (yyvsp[(1) - (3)].interm.type).arraySizes, (yyvsp[(3) - (3)].interm).arraySizes); + parseContext.arrayDimCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.type).arraySizes, (yyvsp[0].interm).arraySizes); - parseContext.arraySizeRequiredCheck((yyvsp[(3) - (3)].interm).loc, *(yyvsp[(3) - (3)].interm).arraySizes); - parseContext.reservedErrorCheck((yyvsp[(2) - (3)].lex).loc, *(yyvsp[(2) - (3)].lex).string); + parseContext.arraySizeRequiredCheck((yyvsp[0].interm).loc, *(yyvsp[0].interm).arraySizes); + parseContext.reservedErrorCheck((yyvsp[-1].lex).loc, *(yyvsp[-1].lex).string); - (yyvsp[(1) - (3)].interm.type).arraySizes = (yyvsp[(3) - (3)].interm).arraySizes; + (yyvsp[-2].interm.type).arraySizes = (yyvsp[0].interm).arraySizes; - TParameter param = { (yyvsp[(2) - (3)].lex).string, new TType((yyvsp[(1) - (3)].interm.type))}; - (yyval.interm).loc = (yyvsp[(2) - (3)].lex).loc; + TParameter param = { (yyvsp[-1].lex).string, new TType((yyvsp[-2].interm.type))}; + (yyval.interm).loc = (yyvsp[-1].lex).loc; (yyval.interm).param = param; } +#line 4214 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 108: -/* Line 1792 of yacc.c */ -#line 882 "glslang.y" +#line 882 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm) = (yyvsp[(2) - (2)].interm); - if ((yyvsp[(1) - (2)].interm.type).qualifier.precision != EpqNone) - (yyval.interm).param.type->getQualifier().precision = (yyvsp[(1) - (2)].interm.type).qualifier.precision; + (yyval.interm) = (yyvsp[0].interm); + if ((yyvsp[-1].interm.type).qualifier.precision != EpqNone) + (yyval.interm).param.type->getQualifier().precision = (yyvsp[-1].interm.type).qualifier.precision; parseContext.precisionQualifierCheck((yyval.interm).loc, (yyval.interm).param.type->getBasicType(), (yyval.interm).param.type->getQualifier()); - parseContext.checkNoShaderLayouts((yyvsp[(1) - (2)].interm.type).loc, (yyvsp[(1) - (2)].interm.type).shaderQualifiers); - parseContext.parameterTypeCheck((yyvsp[(2) - (2)].interm).loc, (yyvsp[(1) - (2)].interm.type).qualifier.storage, *(yyval.interm).param.type); - parseContext.paramCheckFix((yyvsp[(1) - (2)].interm.type).loc, (yyvsp[(1) - (2)].interm.type).qualifier, *(yyval.interm).param.type); + parseContext.checkNoShaderLayouts((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).shaderQualifiers); + parseContext.parameterTypeCheck((yyvsp[0].interm).loc, (yyvsp[-1].interm.type).qualifier.storage, *(yyval.interm).param.type); + parseContext.paramCheckFix((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).qualifier, *(yyval.interm).param.type); } +#line 4230 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 109: -/* Line 1792 of yacc.c */ -#line 893 "glslang.y" +#line 893 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm) = (yyvsp[(1) - (1)].interm); + (yyval.interm) = (yyvsp[0].interm); - parseContext.parameterTypeCheck((yyvsp[(1) - (1)].interm).loc, EvqIn, *(yyvsp[(1) - (1)].interm).param.type); - parseContext.paramCheckFix((yyvsp[(1) - (1)].interm).loc, EvqTemporary, *(yyval.interm).param.type); + parseContext.parameterTypeCheck((yyvsp[0].interm).loc, EvqIn, *(yyvsp[0].interm).param.type); + parseContext.paramCheckFix((yyvsp[0].interm).loc, EvqTemporary, *(yyval.interm).param.type); parseContext.precisionQualifierCheck((yyval.interm).loc, (yyval.interm).param.type->getBasicType(), (yyval.interm).param.type->getQualifier()); } +#line 4242 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 110: -/* Line 1792 of yacc.c */ -#line 903 "glslang.y" +#line 903 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm) = (yyvsp[(2) - (2)].interm); - if ((yyvsp[(1) - (2)].interm.type).qualifier.precision != EpqNone) - (yyval.interm).param.type->getQualifier().precision = (yyvsp[(1) - (2)].interm.type).qualifier.precision; - parseContext.precisionQualifierCheck((yyvsp[(1) - (2)].interm.type).loc, (yyval.interm).param.type->getBasicType(), (yyval.interm).param.type->getQualifier()); + (yyval.interm) = (yyvsp[0].interm); + if ((yyvsp[-1].interm.type).qualifier.precision != EpqNone) + (yyval.interm).param.type->getQualifier().precision = (yyvsp[-1].interm.type).qualifier.precision; + parseContext.precisionQualifierCheck((yyvsp[-1].interm.type).loc, (yyval.interm).param.type->getBasicType(), (yyval.interm).param.type->getQualifier()); - parseContext.checkNoShaderLayouts((yyvsp[(1) - (2)].interm.type).loc, (yyvsp[(1) - (2)].interm.type).shaderQualifiers); - parseContext.parameterTypeCheck((yyvsp[(2) - (2)].interm).loc, (yyvsp[(1) - (2)].interm.type).qualifier.storage, *(yyval.interm).param.type); - parseContext.paramCheckFix((yyvsp[(1) - (2)].interm.type).loc, (yyvsp[(1) - (2)].interm.type).qualifier, *(yyval.interm).param.type); + parseContext.checkNoShaderLayouts((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).shaderQualifiers); + parseContext.parameterTypeCheck((yyvsp[0].interm).loc, (yyvsp[-1].interm.type).qualifier.storage, *(yyval.interm).param.type); + parseContext.paramCheckFix((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).qualifier, *(yyval.interm).param.type); } +#line 4257 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 111: -/* Line 1792 of yacc.c */ -#line 913 "glslang.y" +#line 913 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm) = (yyvsp[(1) - (1)].interm); + (yyval.interm) = (yyvsp[0].interm); - parseContext.parameterTypeCheck((yyvsp[(1) - (1)].interm).loc, EvqIn, *(yyvsp[(1) - (1)].interm).param.type); - parseContext.paramCheckFix((yyvsp[(1) - (1)].interm).loc, EvqTemporary, *(yyval.interm).param.type); + parseContext.parameterTypeCheck((yyvsp[0].interm).loc, EvqIn, *(yyvsp[0].interm).param.type); + parseContext.paramCheckFix((yyvsp[0].interm).loc, EvqTemporary, *(yyval.interm).param.type); parseContext.precisionQualifierCheck((yyval.interm).loc, (yyval.interm).param.type->getBasicType(), (yyval.interm).param.type->getQualifier()); } +#line 4269 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 112: -/* Line 1792 of yacc.c */ -#line 923 "glslang.y" +#line 923 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) }; + TParameter param = { 0, new TType((yyvsp[0].interm.type)) }; (yyval.interm).param = param; - if ((yyvsp[(1) - (1)].interm.type).arraySizes) - parseContext.arraySizeRequiredCheck((yyvsp[(1) - (1)].interm.type).loc, *(yyvsp[(1) - (1)].interm.type).arraySizes); + if ((yyvsp[0].interm.type).arraySizes) + parseContext.arraySizeRequiredCheck((yyvsp[0].interm.type).loc, *(yyvsp[0].interm.type).arraySizes); } +#line 4280 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 113: -/* Line 1792 of yacc.c */ -#line 932 "glslang.y" +#line 932 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm) = (yyvsp[(1) - (1)].interm); + (yyval.interm) = (yyvsp[0].interm); } +#line 4288 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 114: -/* Line 1792 of yacc.c */ -#line 935 "glslang.y" +#line 935 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm) = (yyvsp[(1) - (3)].interm); - parseContext.declareVariable((yyvsp[(3) - (3)].lex).loc, *(yyvsp[(3) - (3)].lex).string, (yyvsp[(1) - (3)].interm).type); + (yyval.interm) = (yyvsp[-2].interm); + parseContext.declareVariable((yyvsp[0].lex).loc, *(yyvsp[0].lex).string, (yyvsp[-2].interm).type); } +#line 4297 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 115: -/* Line 1792 of yacc.c */ -#line 939 "glslang.y" +#line 939 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm) = (yyvsp[(1) - (4)].interm); - parseContext.declareVariable((yyvsp[(3) - (4)].lex).loc, *(yyvsp[(3) - (4)].lex).string, (yyvsp[(1) - (4)].interm).type, (yyvsp[(4) - (4)].interm).arraySizes); + (yyval.interm) = (yyvsp[-3].interm); + parseContext.declareVariable((yyvsp[-1].lex).loc, *(yyvsp[-1].lex).string, (yyvsp[-3].interm).type, (yyvsp[0].interm).arraySizes); } +#line 4306 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 116: -/* Line 1792 of yacc.c */ -#line 943 "glslang.y" +#line 943 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm).type = (yyvsp[(1) - (6)].interm).type; - TIntermNode* initNode = parseContext.declareVariable((yyvsp[(3) - (6)].lex).loc, *(yyvsp[(3) - (6)].lex).string, (yyvsp[(1) - (6)].interm).type, (yyvsp[(4) - (6)].interm).arraySizes, (yyvsp[(6) - (6)].interm.intermTypedNode)); - (yyval.interm).intermNode = parseContext.intermediate.growAggregate((yyvsp[(1) - (6)].interm).intermNode, initNode, (yyvsp[(5) - (6)].lex).loc); + (yyval.interm).type = (yyvsp[-5].interm).type; + TIntermNode* initNode = parseContext.declareVariable((yyvsp[-3].lex).loc, *(yyvsp[-3].lex).string, (yyvsp[-5].interm).type, (yyvsp[-2].interm).arraySizes, (yyvsp[0].interm.intermTypedNode)); + (yyval.interm).intermNode = parseContext.intermediate.growAggregate((yyvsp[-5].interm).intermNode, initNode, (yyvsp[-1].lex).loc); } +#line 4316 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 117: -/* Line 1792 of yacc.c */ -#line 948 "glslang.y" +#line 948 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm).type = (yyvsp[(1) - (5)].interm).type; - TIntermNode* initNode = parseContext.declareVariable((yyvsp[(3) - (5)].lex).loc, *(yyvsp[(3) - (5)].lex).string, (yyvsp[(1) - (5)].interm).type, 0, (yyvsp[(5) - (5)].interm.intermTypedNode)); - (yyval.interm).intermNode = parseContext.intermediate.growAggregate((yyvsp[(1) - (5)].interm).intermNode, initNode, (yyvsp[(4) - (5)].lex).loc); + (yyval.interm).type = (yyvsp[-4].interm).type; + TIntermNode* initNode = parseContext.declareVariable((yyvsp[-2].lex).loc, *(yyvsp[-2].lex).string, (yyvsp[-4].interm).type, 0, (yyvsp[0].interm.intermTypedNode)); + (yyval.interm).intermNode = parseContext.intermediate.growAggregate((yyvsp[-4].interm).intermNode, initNode, (yyvsp[-1].lex).loc); } +#line 4326 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 118: -/* Line 1792 of yacc.c */ -#line 956 "glslang.y" +#line 956 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm).type = (yyvsp[(1) - (1)].interm.type); + (yyval.interm).type = (yyvsp[0].interm.type); (yyval.interm).intermNode = 0; parseContext.declareTypeDefaults((yyval.interm).loc, (yyval.interm).type); } +#line 4336 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 119: -/* Line 1792 of yacc.c */ -#line 961 "glslang.y" +#line 961 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm).type = (yyvsp[(1) - (2)].interm.type); + (yyval.interm).type = (yyvsp[-1].interm.type); (yyval.interm).intermNode = 0; - parseContext.declareVariable((yyvsp[(2) - (2)].lex).loc, *(yyvsp[(2) - (2)].lex).string, (yyvsp[(1) - (2)].interm.type)); + parseContext.declareVariable((yyvsp[0].lex).loc, *(yyvsp[0].lex).string, (yyvsp[-1].interm.type)); } +#line 4346 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 120: -/* Line 1792 of yacc.c */ -#line 966 "glslang.y" +#line 966 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm).type = (yyvsp[(1) - (3)].interm.type); + (yyval.interm).type = (yyvsp[-2].interm.type); (yyval.interm).intermNode = 0; - parseContext.declareVariable((yyvsp[(2) - (3)].lex).loc, *(yyvsp[(2) - (3)].lex).string, (yyvsp[(1) - (3)].interm.type), (yyvsp[(3) - (3)].interm).arraySizes); + parseContext.declareVariable((yyvsp[-1].lex).loc, *(yyvsp[-1].lex).string, (yyvsp[-2].interm.type), (yyvsp[0].interm).arraySizes); } +#line 4356 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 121: -/* Line 1792 of yacc.c */ -#line 971 "glslang.y" +#line 971 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm).type = (yyvsp[(1) - (5)].interm.type); - TIntermNode* initNode = parseContext.declareVariable((yyvsp[(2) - (5)].lex).loc, *(yyvsp[(2) - (5)].lex).string, (yyvsp[(1) - (5)].interm.type), (yyvsp[(3) - (5)].interm).arraySizes, (yyvsp[(5) - (5)].interm.intermTypedNode)); - (yyval.interm).intermNode = parseContext.intermediate.growAggregate(0, initNode, (yyvsp[(4) - (5)].lex).loc); + (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 4366 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 122: -/* Line 1792 of yacc.c */ -#line 976 "glslang.y" +#line 976 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm).type = (yyvsp[(1) - (4)].interm.type); - TIntermNode* initNode = parseContext.declareVariable((yyvsp[(2) - (4)].lex).loc, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), 0, (yyvsp[(4) - (4)].interm.intermTypedNode)); - (yyval.interm).intermNode = parseContext.intermediate.growAggregate(0, initNode, (yyvsp[(3) - (4)].lex).loc); + (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 4376 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 123: -/* Line 1792 of yacc.c */ -#line 985 "glslang.y" +#line 985 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); + (yyval.interm.type) = (yyvsp[0].interm.type); - parseContext.globalQualifierTypeCheck((yyvsp[(1) - (1)].interm.type).loc, (yyvsp[(1) - (1)].interm.type).qualifier, (yyval.interm.type)); - if ((yyvsp[(1) - (1)].interm.type).arraySizes) { - parseContext.profileRequires((yyvsp[(1) - (1)].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); - parseContext.profileRequires((yyvsp[(1) - (1)].interm.type).loc, EEsProfile, 300, 0, "arrayed type"); + parseContext.globalQualifierTypeCheck((yyvsp[0].interm.type).loc, (yyvsp[0].interm.type).qualifier, (yyval.interm.type)); + if ((yyvsp[0].interm.type).arraySizes) { + 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 4392 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 124: -/* Line 1792 of yacc.c */ -#line 996 "glslang.y" +#line 996 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.globalQualifierFixCheck((yyvsp[(1) - (2)].interm.type).loc, (yyvsp[(1) - (2)].interm.type).qualifier); - parseContext.globalQualifierTypeCheck((yyvsp[(1) - (2)].interm.type).loc, (yyvsp[(1) - (2)].interm.type).qualifier, (yyvsp[(2) - (2)].interm.type)); + 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)); - if ((yyvsp[(2) - (2)].interm.type).arraySizes) { - parseContext.profileRequires((yyvsp[(2) - (2)].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); - parseContext.profileRequires((yyvsp[(2) - (2)].interm.type).loc, EEsProfile, 300, 0, "arrayed type"); + if ((yyvsp[0].interm.type).arraySizes) { + 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"); } - if ((yyvsp[(2) - (2)].interm.type).arraySizes && parseContext.arrayQualifierError((yyvsp[(2) - (2)].interm.type).loc, (yyvsp[(1) - (2)].interm.type).qualifier)) - (yyvsp[(2) - (2)].interm.type).arraySizes = 0; + if ((yyvsp[0].interm.type).arraySizes && parseContext.arrayQualifierError((yyvsp[0].interm.type).loc, (yyvsp[-1].interm.type).qualifier)) + (yyvsp[0].interm.type).arraySizes = 0; - parseContext.checkNoShaderLayouts((yyvsp[(2) - (2)].interm.type).loc, (yyvsp[(1) - (2)].interm.type).shaderQualifiers); - (yyvsp[(2) - (2)].interm.type).shaderQualifiers.merge((yyvsp[(1) - (2)].interm.type).shaderQualifiers); - parseContext.mergeQualifiers((yyvsp[(2) - (2)].interm.type).loc, (yyvsp[(2) - (2)].interm.type).qualifier, (yyvsp[(1) - (2)].interm.type).qualifier, true); - parseContext.precisionQualifierCheck((yyvsp[(2) - (2)].interm.type).loc, (yyvsp[(2) - (2)].interm.type).basicType, (yyvsp[(2) - (2)].interm.type).qualifier); + parseContext.checkNoShaderLayouts((yyvsp[0].interm.type).loc, (yyvsp[-1].interm.type).shaderQualifiers); + (yyvsp[0].interm.type).shaderQualifiers.merge((yyvsp[-1].interm.type).shaderQualifiers); + parseContext.mergeQualifiers((yyvsp[0].interm.type).loc, (yyvsp[0].interm.type).qualifier, (yyvsp[-1].interm.type).qualifier, true); + parseContext.precisionQualifierCheck((yyvsp[0].interm.type).loc, (yyvsp[0].interm.type).basicType, (yyvsp[0].interm.type).qualifier); - (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type); + (yyval.interm.type) = (yyvsp[0].interm.type); if (! (yyval.interm.type).qualifier.isInterpolation() && ((parseContext.language == EShLangVertex && (yyval.interm.type).qualifier.storage == EvqVaryingOut) || (parseContext.language == EShLangFragment && (yyval.interm.type).qualifier.storage == EvqVaryingIn))) (yyval.interm.type).qualifier.smooth = true; } +#line 4421 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 125: -/* Line 1792 of yacc.c */ -#line 1023 "glslang.y" +#line 1023 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.globalCheck((yyvsp[(1) - (1)].lex).loc, "invariant"); + parseContext.globalCheck((yyvsp[0].lex).loc, "invariant"); parseContext.profileRequires((yyval.interm.type).loc, ENoProfile, 120, 0, "invariant"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); + (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.invariant = true; } +#line 4432 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 126: -/* Line 1792 of yacc.c */ -#line 1032 "glslang.y" +#line 1032 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.globalCheck((yyvsp[(1) - (1)].lex).loc, "smooth"); - parseContext.profileRequires((yyvsp[(1) - (1)].lex).loc, ENoProfile, 130, 0, "smooth"); - parseContext.profileRequires((yyvsp[(1) - (1)].lex).loc, EEsProfile, 300, 0, "smooth"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); + parseContext.globalCheck((yyvsp[0].lex).loc, "smooth"); + parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "smooth"); + parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 300, 0, "smooth"); + (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.smooth = true; } +#line 4444 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 127: -/* Line 1792 of yacc.c */ -#line 1039 "glslang.y" +#line 1039 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.globalCheck((yyvsp[(1) - (1)].lex).loc, "flat"); - parseContext.profileRequires((yyvsp[(1) - (1)].lex).loc, ENoProfile, 130, 0, "flat"); - parseContext.profileRequires((yyvsp[(1) - (1)].lex).loc, EEsProfile, 300, 0, "flat"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); + parseContext.globalCheck((yyvsp[0].lex).loc, "flat"); + parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "flat"); + parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 300, 0, "flat"); + (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.flat = true; } +#line 4456 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 128: -/* Line 1792 of yacc.c */ -#line 1046 "glslang.y" +#line 1046 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.globalCheck((yyvsp[(1) - (1)].lex).loc, "noperspective"); - parseContext.requireProfile((yyvsp[(1) - (1)].lex).loc, ~EEsProfile, "noperspective"); - parseContext.profileRequires((yyvsp[(1) - (1)].lex).loc, ENoProfile, 130, 0, "noperspective"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); + parseContext.globalCheck((yyvsp[0].lex).loc, "noperspective"); + parseContext.requireProfile((yyvsp[0].lex).loc, ~EEsProfile, "noperspective"); + 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 4468 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 129: -/* Line 1792 of yacc.c */ -#line 1056 "glslang.y" +#line 1056 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type) = (yyvsp[(3) - (4)].interm.type); + (yyval.interm.type) = (yyvsp[-1].interm.type); } +#line 4476 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 130: -/* Line 1792 of yacc.c */ -#line 1062 "glslang.y" +#line 1062 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); + (yyval.interm.type) = (yyvsp[0].interm.type); } +#line 4484 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 131: -/* Line 1792 of yacc.c */ -#line 1065 "glslang.y" +#line 1065 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type) = (yyvsp[(1) - (3)].interm.type); - (yyval.interm.type).shaderQualifiers.merge((yyvsp[(3) - (3)].interm.type).shaderQualifiers); - parseContext.mergeObjectLayoutQualifiers((yyval.interm.type).qualifier, (yyvsp[(3) - (3)].interm.type).qualifier, false); + (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 4494 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 132: -/* Line 1792 of yacc.c */ -#line 1072 "glslang.y" +#line 1072 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); - parseContext.setLayoutQualifier((yyvsp[(1) - (1)].lex).loc, (yyval.interm.type), *(yyvsp[(1) - (1)].lex).string); + (yyval.interm.type).init((yyvsp[0].lex).loc); + parseContext.setLayoutQualifier((yyvsp[0].lex).loc, (yyval.interm.type), *(yyvsp[0].lex).string); } +#line 4503 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 133: -/* Line 1792 of yacc.c */ -#line 1076 "glslang.y" +#line 1076 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (3)].lex).loc); - parseContext.setLayoutQualifier((yyvsp[(1) - (3)].lex).loc, (yyval.interm.type), *(yyvsp[(1) - (3)].lex).string, (yyvsp[(3) - (3)].interm.intermTypedNode)); + (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 4512 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 134: -/* Line 1792 of yacc.c */ -#line 1080 "glslang.y" +#line 1080 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // because "shared" is both an identifier and a keyword - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); + (yyval.interm.type).init((yyvsp[0].lex).loc); TString strShared("shared"); - parseContext.setLayoutQualifier((yyvsp[(1) - (1)].lex).loc, (yyval.interm.type), strShared); + parseContext.setLayoutQualifier((yyvsp[0].lex).loc, (yyval.interm.type), strShared); } +#line 4522 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 135: -/* Line 1792 of yacc.c */ -#line 1088 "glslang.y" +#line 1088 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); + (yyval.interm.type).init((yyvsp[0].lex).loc); } +#line 4530 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 136: -/* Line 1792 of yacc.c */ -#line 1094 "glslang.y" +#line 1094 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); + (yyval.interm.type) = (yyvsp[0].interm.type); } +#line 4538 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 137: -/* Line 1792 of yacc.c */ -#line 1097 "glslang.y" +#line 1097 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type) = (yyvsp[(1) - (2)].interm.type); + (yyval.interm.type) = (yyvsp[-1].interm.type); if ((yyval.interm.type).basicType == EbtVoid) - (yyval.interm.type).basicType = (yyvsp[(2) - (2)].interm.type).basicType; + (yyval.interm.type).basicType = (yyvsp[0].interm.type).basicType; - (yyval.interm.type).shaderQualifiers.merge((yyvsp[(2) - (2)].interm.type).shaderQualifiers); - parseContext.mergeQualifiers((yyval.interm.type).loc, (yyval.interm.type).qualifier, (yyvsp[(2) - (2)].interm.type).qualifier, false); + (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 4551 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 138: -/* Line 1792 of yacc.c */ -#line 1108 "glslang.y" +#line 1108 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); + (yyval.interm.type) = (yyvsp[0].interm.type); } +#line 4559 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 139: -/* Line 1792 of yacc.c */ -#line 1111 "glslang.y" +#line 1111 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); + (yyval.interm.type) = (yyvsp[0].interm.type); } +#line 4567 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 140: -/* Line 1792 of yacc.c */ -#line 1114 "glslang.y" +#line 1114 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); + (yyval.interm.type) = (yyvsp[0].interm.type); } +#line 4575 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 141: -/* Line 1792 of yacc.c */ -#line 1117 "glslang.y" +#line 1117 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // allow inheritance of storage qualifier from block declaration - (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); + (yyval.interm.type) = (yyvsp[0].interm.type); } +#line 4584 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 142: -/* Line 1792 of yacc.c */ -#line 1121 "glslang.y" +#line 1121 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // allow inheritance of storage qualifier from block declaration - (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); + (yyval.interm.type) = (yyvsp[0].interm.type); } +#line 4593 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 143: -/* Line 1792 of yacc.c */ -#line 1125 "glslang.y" +#line 1125 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // allow inheritance of storage qualifier from block declaration - (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); + (yyval.interm.type) = (yyvsp[0].interm.type); } +#line 4602 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 144: -/* Line 1792 of yacc.c */ -#line 1132 "glslang.y" +#line 1132 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); + (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 4611 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 145: -/* Line 1792 of yacc.c */ -#line 1136 "glslang.y" +#line 1136 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.requireStage((yyvsp[(1) - (1)].lex).loc, EShLangVertex, "attribute"); - parseContext.checkDeprecated((yyvsp[(1) - (1)].lex).loc, ECoreProfile, 130, "attribute"); - parseContext.checkDeprecated((yyvsp[(1) - (1)].lex).loc, ENoProfile, 130, "attribute"); - parseContext.requireNotRemoved((yyvsp[(1) - (1)].lex).loc, ECoreProfile, 420, "attribute"); - parseContext.requireNotRemoved((yyvsp[(1) - (1)].lex).loc, EEsProfile, 300, "attribute"); + parseContext.requireStage((yyvsp[0].lex).loc, EShLangVertex, "attribute"); + parseContext.checkDeprecated((yyvsp[0].lex).loc, ECoreProfile, 130, "attribute"); + parseContext.checkDeprecated((yyvsp[0].lex).loc, ENoProfile, 130, "attribute"); + parseContext.requireNotRemoved((yyvsp[0].lex).loc, ECoreProfile, 420, "attribute"); + parseContext.requireNotRemoved((yyvsp[0].lex).loc, EEsProfile, 300, "attribute"); - parseContext.globalCheck((yyvsp[(1) - (1)].lex).loc, "attribute"); + parseContext.globalCheck((yyvsp[0].lex).loc, "attribute"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); + (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqVaryingIn; } +#line 4628 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 146: -/* Line 1792 of yacc.c */ -#line 1148 "glslang.y" +#line 1148 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.checkDeprecated((yyvsp[(1) - (1)].lex).loc, ENoProfile, 130, "varying"); - parseContext.checkDeprecated((yyvsp[(1) - (1)].lex).loc, ECoreProfile, 130, "varying"); - parseContext.requireNotRemoved((yyvsp[(1) - (1)].lex).loc, ECoreProfile, 420, "varying"); - parseContext.requireNotRemoved((yyvsp[(1) - (1)].lex).loc, EEsProfile, 300, "varying"); + parseContext.checkDeprecated((yyvsp[0].lex).loc, ENoProfile, 130, "varying"); + parseContext.checkDeprecated((yyvsp[0].lex).loc, ECoreProfile, 130, "varying"); + parseContext.requireNotRemoved((yyvsp[0].lex).loc, ECoreProfile, 420, "varying"); + parseContext.requireNotRemoved((yyvsp[0].lex).loc, EEsProfile, 300, "varying"); - parseContext.globalCheck((yyvsp[(1) - (1)].lex).loc, "varying"); + parseContext.globalCheck((yyvsp[0].lex).loc, "varying"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); + (yyval.interm.type).init((yyvsp[0].lex).loc); if (parseContext.language == EShLangVertex) (yyval.interm.type).qualifier.storage = EvqVaryingOut; else (yyval.interm.type).qualifier.storage = EvqVaryingIn; } +#line 4647 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 147: -/* Line 1792 of yacc.c */ -#line 1162 "glslang.y" +#line 1162 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.globalCheck((yyvsp[(1) - (1)].lex).loc, "inout"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); + parseContext.globalCheck((yyvsp[0].lex).loc, "inout"); + (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqInOut; } +#line 4657 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 148: -/* Line 1792 of yacc.c */ -#line 1167 "glslang.y" +#line 1167 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.globalCheck((yyvsp[(1) - (1)].lex).loc, "in"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); + 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 4668 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 149: -/* Line 1792 of yacc.c */ -#line 1173 "glslang.y" +#line 1173 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.globalCheck((yyvsp[(1) - (1)].lex).loc, "out"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); + 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 4679 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 150: -/* Line 1792 of yacc.c */ -#line 1179 "glslang.y" +#line 1179 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.profileRequires((yyvsp[(1) - (1)].lex).loc, ENoProfile, 120, 0, "centroid"); - parseContext.profileRequires((yyvsp[(1) - (1)].lex).loc, EEsProfile, 300, 0, "centroid"); - parseContext.globalCheck((yyvsp[(1) - (1)].lex).loc, "centroid"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); + 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 4691 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 151: -/* Line 1792 of yacc.c */ -#line 1186 "glslang.y" +#line 1186 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.globalCheck((yyvsp[(1) - (1)].lex).loc, "patch"); - parseContext.requireStage((yyvsp[(1) - (1)].lex).loc, (EShLanguageMask)(EShLangTessControlMask | EShLangTessEvaluationMask), "patch"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); + 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 4702 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 152: -/* Line 1792 of yacc.c */ -#line 1192 "glslang.y" +#line 1192 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.globalCheck((yyvsp[(1) - (1)].lex).loc, "sample"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); + parseContext.globalCheck((yyvsp[0].lex).loc, "sample"); + (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.sample = true; } +#line 4712 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 153: -/* Line 1792 of yacc.c */ -#line 1197 "glslang.y" +#line 1197 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.globalCheck((yyvsp[(1) - (1)].lex).loc, "uniform"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); + parseContext.globalCheck((yyvsp[0].lex).loc, "uniform"); + (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqUniform; } +#line 4722 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 154: -/* Line 1792 of yacc.c */ -#line 1202 "glslang.y" +#line 1202 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.globalCheck((yyvsp[(1) - (1)].lex).loc, "buffer"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); + parseContext.globalCheck((yyvsp[0].lex).loc, "buffer"); + (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqBuffer; } +#line 4732 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 155: -/* Line 1792 of yacc.c */ -#line 1207 "glslang.y" +#line 1207 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.profileRequires((yyvsp[(1) - (1)].lex).loc, ECoreProfile | ECompatibilityProfile, 430, 0, "shared"); - parseContext.profileRequires((yyvsp[(1) - (1)].lex).loc, EEsProfile, 310, 0, "shared"); - parseContext.requireStage((yyvsp[(1) - (1)].lex).loc, EShLangCompute, "shared"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); + parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, 430, 0, "shared"); + parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 310, 0, "shared"); + parseContext.requireStage((yyvsp[0].lex).loc, EShLangCompute, "shared"); + (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqShared; } +#line 4744 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 156: -/* Line 1792 of yacc.c */ -#line 1214 "glslang.y" +#line 1214 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); + (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.coherent = true; } +#line 4753 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 157: -/* Line 1792 of yacc.c */ -#line 1218 "glslang.y" +#line 1218 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); + (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.volatil = true; } +#line 4762 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 158: -/* Line 1792 of yacc.c */ -#line 1222 "glslang.y" +#line 1222 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); + (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.restrict = true; } +#line 4771 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 159: -/* Line 1792 of yacc.c */ -#line 1226 "glslang.y" +#line 1226 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); + (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.readonly = true; } +#line 4780 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 160: -/* Line 1792 of yacc.c */ -#line 1230 "glslang.y" +#line 1230 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); + (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.writeonly = true; } +#line 4789 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 161: -/* Line 1792 of yacc.c */ -#line 1234 "glslang.y" +#line 1234 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.spvRemoved((yyvsp[(1) - (1)].lex).loc, "subroutine"); - parseContext.globalCheck((yyvsp[(1) - (1)].lex).loc, "subroutine"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc); + parseContext.spvRemoved((yyvsp[0].lex).loc, "subroutine"); + parseContext.globalCheck((yyvsp[0].lex).loc, "subroutine"); + (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqUniform; } +#line 4800 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 162: -/* Line 1792 of yacc.c */ -#line 1240 "glslang.y" +#line 1240 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.spvRemoved((yyvsp[(1) - (4)].lex).loc, "subroutine"); - parseContext.globalCheck((yyvsp[(1) - (4)].lex).loc, "subroutine"); - (yyval.interm.type).init((yyvsp[(1) - (4)].lex).loc); + parseContext.spvRemoved((yyvsp[-3].lex).loc, "subroutine"); + parseContext.globalCheck((yyvsp[-3].lex).loc, "subroutine"); + (yyval.interm.type).init((yyvsp[-3].lex).loc); (yyval.interm.type).qualifier.storage = EvqUniform; // 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 4814 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 163: -/* Line 1792 of yacc.c */ -#line 1252 "glslang.y" +#line 1252 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // TODO: 4.0 functionality: subroutine type to list } +#line 4822 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 164: -/* Line 1792 of yacc.c */ -#line 1255 "glslang.y" +#line 1255 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { } +#line 4829 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 165: -/* Line 1792 of yacc.c */ -#line 1260 "glslang.y" +#line 1260 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); + (yyval.interm.type) = (yyvsp[0].interm.type); (yyval.interm.type).qualifier.precision = parseContext.getDefaultPrecision((yyval.interm.type)); } +#line 4838 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 166: -/* Line 1792 of yacc.c */ -#line 1264 "glslang.y" +#line 1264 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.arrayDimCheck((yyvsp[(2) - (2)].interm).loc, (yyvsp[(2) - (2)].interm).arraySizes, 0); - (yyval.interm.type) = (yyvsp[(1) - (2)].interm.type); + parseContext.arrayDimCheck((yyvsp[0].interm).loc, (yyvsp[0].interm).arraySizes, 0); + (yyval.interm.type) = (yyvsp[-1].interm.type); (yyval.interm.type).qualifier.precision = parseContext.getDefaultPrecision((yyval.interm.type)); - (yyval.interm.type).arraySizes = (yyvsp[(2) - (2)].interm).arraySizes; + (yyval.interm.type).arraySizes = (yyvsp[0].interm).arraySizes; } +#line 4849 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 167: -/* Line 1792 of yacc.c */ -#line 1273 "glslang.y" +#line 1273 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm).loc = (yyvsp[(1) - (2)].lex).loc; + (yyval.interm).loc = (yyvsp[-1].lex).loc; (yyval.interm).arraySizes = new TArraySizes; (yyval.interm).arraySizes->addInnerSize(); } +#line 4859 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 168: -/* Line 1792 of yacc.c */ -#line 1278 "glslang.y" +#line 1278 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm).loc = (yyvsp[(1) - (3)].lex).loc; + (yyval.interm).loc = (yyvsp[-2].lex).loc; (yyval.interm).arraySizes = new TArraySizes; TArraySize size; - parseContext.arraySizeCheck((yyvsp[(2) - (3)].interm.intermTypedNode)->getLoc(), (yyvsp[(2) - (3)].interm.intermTypedNode), size); + parseContext.arraySizeCheck((yyvsp[-1].interm.intermTypedNode)->getLoc(), (yyvsp[-1].interm.intermTypedNode), size); (yyval.interm).arraySizes->addInnerSize(size); } +#line 4872 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 169: -/* Line 1792 of yacc.c */ -#line 1286 "glslang.y" +#line 1286 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm) = (yyvsp[(1) - (3)].interm); + (yyval.interm) = (yyvsp[-2].interm); (yyval.interm).arraySizes->addInnerSize(); } +#line 4881 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 170: -/* Line 1792 of yacc.c */ -#line 1290 "glslang.y" +#line 1290 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm) = (yyvsp[(1) - (4)].interm); + (yyval.interm) = (yyvsp[-3].interm); TArraySize size; - parseContext.arraySizeCheck((yyvsp[(3) - (4)].interm.intermTypedNode)->getLoc(), (yyvsp[(3) - (4)].interm.intermTypedNode), size); + parseContext.arraySizeCheck((yyvsp[-1].interm.intermTypedNode)->getLoc(), (yyvsp[-1].interm.intermTypedNode), size); (yyval.interm).arraySizes->addInnerSize(size); } +#line 4893 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 171: -/* Line 1792 of yacc.c */ -#line 1300 "glslang.y" +#line 1300 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtVoid; } +#line 4902 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 172: -/* Line 1792 of yacc.c */ -#line 1304 "glslang.y" +#line 1304 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; } +#line 4911 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 173: -/* Line 1792 of yacc.c */ -#line 1308 "glslang.y" +#line 1308 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + parseContext.doubleCheck((yyvsp[0].lex).loc, "double"); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; } +#line 4921 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 174: -/* Line 1792 of yacc.c */ -#line 1313 "glslang.y" +#line 1313 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt; } +#line 4930 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 175: -/* Line 1792 of yacc.c */ -#line 1317 "glslang.y" +#line 1317 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.fullIntegerCheck((yyvsp[(1) - (1)].lex).loc, "unsigned integer"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + 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 4940 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 176: -/* Line 1792 of yacc.c */ -#line 1322 "glslang.y" +#line 1322 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int64Check((yyvsp[(1) - (1)].lex).loc, "64-bit integer", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + 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 4950 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 177: -/* Line 1792 of yacc.c */ -#line 1327 "glslang.y" +#line 1327 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int64Check((yyvsp[(1) - (1)].lex).loc, "64-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + 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 4960 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 178: -/* Line 1792 of yacc.c */ -#line 1332 "glslang.y" +#line 1332 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtBool; } +#line 4969 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 179: -/* Line 1792 of yacc.c */ -#line 1336 "glslang.y" +#line 1336 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setVector(2); } +#line 4979 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 180: -/* Line 1792 of yacc.c */ -#line 1341 "glslang.y" +#line 1341 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setVector(3); } +#line 4989 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 181: -/* Line 1792 of yacc.c */ -#line 1346 "glslang.y" +#line 1346 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setVector(4); } +#line 4999 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 182: -/* Line 1792 of yacc.c */ -#line 1351 "glslang.y" +#line 1351 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double vector"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + 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 5010 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 183: -/* Line 1792 of yacc.c */ -#line 1357 "glslang.y" +#line 1357 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double vector"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + 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 5021 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 184: -/* Line 1792 of yacc.c */ -#line 1363 "glslang.y" +#line 1363 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double vector"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + 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 5032 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 185: -/* Line 1792 of yacc.c */ -#line 1369 "glslang.y" +#line 1369 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtBool; (yyval.interm.type).setVector(2); } +#line 5042 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 186: -/* Line 1792 of yacc.c */ -#line 1374 "glslang.y" +#line 1374 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtBool; (yyval.interm.type).setVector(3); } +#line 5052 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 187: -/* Line 1792 of yacc.c */ -#line 1379 "glslang.y" +#line 1379 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtBool; (yyval.interm.type).setVector(4); } +#line 5062 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 188: -/* Line 1792 of yacc.c */ -#line 1384 "glslang.y" +#line 1384 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt; (yyval.interm.type).setVector(2); } +#line 5072 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 189: -/* Line 1792 of yacc.c */ -#line 1389 "glslang.y" +#line 1389 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt; (yyval.interm.type).setVector(3); } +#line 5082 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 190: -/* Line 1792 of yacc.c */ -#line 1394 "glslang.y" +#line 1394 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt; (yyval.interm.type).setVector(4); } +#line 5092 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 191: -/* Line 1792 of yacc.c */ -#line 1399 "glslang.y" +#line 1399 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int64Check((yyvsp[(1) - (1)].lex).loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + 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 5103 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 192: -/* Line 1792 of yacc.c */ -#line 1405 "glslang.y" +#line 1405 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int64Check((yyvsp[(1) - (1)].lex).loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + 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 5114 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 193: -/* Line 1792 of yacc.c */ -#line 1411 "glslang.y" +#line 1411 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int64Check((yyvsp[(1) - (1)].lex).loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + 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 5125 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 194: -/* Line 1792 of yacc.c */ -#line 1417 "glslang.y" +#line 1417 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.fullIntegerCheck((yyvsp[(1) - (1)].lex).loc, "unsigned integer vector"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + 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 5136 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 195: -/* Line 1792 of yacc.c */ -#line 1423 "glslang.y" +#line 1423 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.fullIntegerCheck((yyvsp[(1) - (1)].lex).loc, "unsigned integer vector"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + 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 5147 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 196: -/* Line 1792 of yacc.c */ -#line 1429 "glslang.y" +#line 1429 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.fullIntegerCheck((yyvsp[(1) - (1)].lex).loc, "unsigned integer vector"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + 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 5158 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 197: -/* Line 1792 of yacc.c */ -#line 1435 "glslang.y" +#line 1435 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int64Check((yyvsp[(1) - (1)].lex).loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + 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 5169 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 198: -/* Line 1792 of yacc.c */ -#line 1441 "glslang.y" +#line 1441 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int64Check((yyvsp[(1) - (1)].lex).loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + 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 5180 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 199: -/* Line 1792 of yacc.c */ -#line 1447 "glslang.y" +#line 1447 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int64Check((yyvsp[(1) - (1)].lex).loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + 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 5191 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 200: -/* Line 1792 of yacc.c */ -#line 1453 "glslang.y" +#line 1453 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(2, 2); } +#line 5201 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 201: -/* Line 1792 of yacc.c */ -#line 1458 "glslang.y" +#line 1458 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(3, 3); } +#line 5211 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 202: -/* Line 1792 of yacc.c */ -#line 1463 "glslang.y" +#line 1463 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(4, 4); } +#line 5221 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 203: -/* Line 1792 of yacc.c */ -#line 1468 "glslang.y" +#line 1468 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(2, 2); } +#line 5231 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 204: -/* Line 1792 of yacc.c */ -#line 1473 "glslang.y" +#line 1473 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(2, 3); } +#line 5241 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 205: -/* Line 1792 of yacc.c */ -#line 1478 "glslang.y" +#line 1478 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(2, 4); } +#line 5251 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 206: -/* Line 1792 of yacc.c */ -#line 1483 "glslang.y" +#line 1483 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(3, 2); } +#line 5261 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 207: -/* Line 1792 of yacc.c */ -#line 1488 "glslang.y" +#line 1488 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(3, 3); } +#line 5271 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 208: -/* Line 1792 of yacc.c */ -#line 1493 "glslang.y" +#line 1493 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(3, 4); } +#line 5281 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 209: -/* Line 1792 of yacc.c */ -#line 1498 "glslang.y" +#line 1498 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(4, 2); } +#line 5291 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 210: -/* Line 1792 of yacc.c */ -#line 1503 "glslang.y" +#line 1503 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(4, 3); } +#line 5301 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 211: -/* Line 1792 of yacc.c */ -#line 1508 "glslang.y" +#line 1508 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(4, 4); } +#line 5311 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 212: -/* Line 1792 of yacc.c */ -#line 1513 "glslang.y" +#line 1513 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double matrix"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + 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 5322 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 213: -/* Line 1792 of yacc.c */ -#line 1519 "glslang.y" +#line 1519 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double matrix"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + 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 5333 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 214: -/* Line 1792 of yacc.c */ -#line 1525 "glslang.y" +#line 1525 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double matrix"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + 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 5344 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 215: -/* Line 1792 of yacc.c */ -#line 1531 "glslang.y" +#line 1531 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double matrix"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + 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 5355 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 216: -/* Line 1792 of yacc.c */ -#line 1537 "glslang.y" +#line 1537 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double matrix"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + 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 5366 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 217: -/* Line 1792 of yacc.c */ -#line 1543 "glslang.y" +#line 1543 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double matrix"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + 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 5377 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 218: -/* Line 1792 of yacc.c */ -#line 1549 "glslang.y" +#line 1549 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double matrix"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + 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 5388 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 219: -/* Line 1792 of yacc.c */ -#line 1555 "glslang.y" +#line 1555 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double matrix"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + 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 5399 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 220: -/* Line 1792 of yacc.c */ -#line 1561 "glslang.y" +#line 1561 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double matrix"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + 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 5410 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 221: -/* Line 1792 of yacc.c */ -#line 1567 "glslang.y" +#line 1567 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double matrix"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + 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 5421 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 222: -/* Line 1792 of yacc.c */ -#line 1573 "glslang.y" +#line 1573 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double matrix"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + 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 5432 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 223: -/* Line 1792 of yacc.c */ -#line 1579 "glslang.y" +#line 1579 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.doubleCheck((yyvsp[(1) - (1)].lex).loc, "double matrix"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + 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 5443 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 224: -/* Line 1792 of yacc.c */ -#line 1585 "glslang.y" +#line 1585 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.vulkanRemoved((yyvsp[(1) - (1)].lex).loc, "atomic counter types"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + 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 5453 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 225: -/* Line 1792 of yacc.c */ -#line 1590 "glslang.y" +#line 1590 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd1D); } +#line 5463 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 226: -/* Line 1792 of yacc.c */ -#line 1595 "glslang.y" +#line 1595 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd2D); } +#line 5473 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 227: -/* Line 1792 of yacc.c */ -#line 1600 "glslang.y" +#line 1600 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd3D); } +#line 5483 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 228: -/* Line 1792 of yacc.c */ -#line 1605 "glslang.y" +#line 1605 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, EsdCube); } +#line 5493 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 229: -/* Line 1792 of yacc.c */ -#line 1610 "glslang.y" +#line 1610 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 5503 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 230: -/* Line 1792 of yacc.c */ -#line 1615 "glslang.y" +#line 1615 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 5513 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 231: -/* Line 1792 of yacc.c */ -#line 1620 "glslang.y" +#line 1620 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 5523 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 232: -/* Line 1792 of yacc.c */ -#line 1625 "glslang.y" +#line 1625 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 5533 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 233: -/* Line 1792 of yacc.c */ -#line 1630 "glslang.y" +#line 1630 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 5543 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 234: -/* Line 1792 of yacc.c */ -#line 1635 "glslang.y" +#line 1635 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 5553 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 235: -/* Line 1792 of yacc.c */ -#line 1640 "glslang.y" +#line 1640 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 5563 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 236: -/* Line 1792 of yacc.c */ -#line 1645 "glslang.y" +#line 1645 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 5573 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 237: -/* Line 1792 of yacc.c */ -#line 1650 "glslang.y" +#line 1650 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 5583 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 238: -/* Line 1792 of yacc.c */ -#line 1655 "glslang.y" +#line 1655 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, Esd1D); } +#line 5593 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 239: -/* Line 1792 of yacc.c */ -#line 1660 "glslang.y" +#line 1660 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, Esd2D); } +#line 5603 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 240: -/* Line 1792 of yacc.c */ -#line 1665 "glslang.y" +#line 1665 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, Esd3D); } +#line 5613 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 241: -/* Line 1792 of yacc.c */ -#line 1670 "glslang.y" +#line 1670 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, EsdCube); } +#line 5623 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 242: -/* Line 1792 of yacc.c */ -#line 1675 "glslang.y" +#line 1675 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 5633 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 243: -/* Line 1792 of yacc.c */ -#line 1680 "glslang.y" +#line 1680 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 5643 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 244: -/* Line 1792 of yacc.c */ -#line 1685 "glslang.y" +#line 1685 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 5653 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 245: -/* Line 1792 of yacc.c */ -#line 1690 "glslang.y" +#line 1690 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, Esd1D); } +#line 5663 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 246: -/* Line 1792 of yacc.c */ -#line 1695 "glslang.y" +#line 1695 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, Esd2D); } +#line 5673 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 247: -/* Line 1792 of yacc.c */ -#line 1700 "glslang.y" +#line 1700 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, Esd3D); } +#line 5683 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 248: -/* Line 1792 of yacc.c */ -#line 1705 "glslang.y" +#line 1705 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, EsdCube); } +#line 5693 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 249: -/* Line 1792 of yacc.c */ -#line 1710 "glslang.y" +#line 1710 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 5703 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 250: -/* Line 1792 of yacc.c */ -#line 1715 "glslang.y" +#line 1715 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 5713 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 251: -/* Line 1792 of yacc.c */ -#line 1720 "glslang.y" +#line 1720 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 5723 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 252: -/* Line 1792 of yacc.c */ -#line 1725 "glslang.y" +#line 1725 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, EsdRect); } +#line 5733 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 253: -/* Line 1792 of yacc.c */ -#line 1730 "glslang.y" +#line 1730 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 5743 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 254: -/* Line 1792 of yacc.c */ -#line 1735 "glslang.y" +#line 1735 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, EsdRect); } +#line 5753 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 255: -/* Line 1792 of yacc.c */ -#line 1740 "glslang.y" +#line 1740 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, EsdRect); } +#line 5763 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 256: -/* Line 1792 of yacc.c */ -#line 1745 "glslang.y" +#line 1745 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, EsdBuffer); } +#line 5773 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 257: -/* Line 1792 of yacc.c */ -#line 1750 "glslang.y" +#line 1750 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, EsdBuffer); } +#line 5783 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 258: -/* Line 1792 of yacc.c */ -#line 1755 "glslang.y" +#line 1755 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, EsdBuffer); } +#line 5793 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 259: -/* Line 1792 of yacc.c */ -#line 1760 "glslang.y" +#line 1760 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 5803 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 260: -/* Line 1792 of yacc.c */ -#line 1765 "glslang.y" +#line 1765 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 5813 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 261: -/* Line 1792 of yacc.c */ -#line 1770 "glslang.y" +#line 1770 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 5823 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 262: -/* Line 1792 of yacc.c */ -#line 1775 "glslang.y" +#line 1775 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 5833 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 263: -/* Line 1792 of yacc.c */ -#line 1780 "glslang.y" +#line 1780 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 5843 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 264: -/* Line 1792 of yacc.c */ -#line 1785 "glslang.y" +#line 1785 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 5853 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 265: -/* Line 1792 of yacc.c */ -#line 1790 "glslang.y" +#line 1790 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setPureSampler(false); } +#line 5863 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 266: -/* Line 1792 of yacc.c */ -#line 1795 "glslang.y" +#line 1795 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setPureSampler(true); } +#line 5873 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 267: -/* Line 1792 of yacc.c */ -#line 1800 "glslang.y" +#line 1800 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, Esd1D); } +#line 5883 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 268: -/* Line 1792 of yacc.c */ -#line 1805 "glslang.y" +#line 1805 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, Esd2D); } +#line 5893 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 269: -/* Line 1792 of yacc.c */ -#line 1810 "glslang.y" +#line 1810 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, Esd3D); } +#line 5903 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 270: -/* Line 1792 of yacc.c */ -#line 1815 "glslang.y" +#line 1815 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, EsdCube); } +#line 5913 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 271: -/* Line 1792 of yacc.c */ -#line 1820 "glslang.y" +#line 1820 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 5923 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 272: -/* Line 1792 of yacc.c */ -#line 1825 "glslang.y" +#line 1825 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 5933 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 273: -/* Line 1792 of yacc.c */ -#line 1830 "glslang.y" +#line 1830 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 5943 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 274: -/* Line 1792 of yacc.c */ -#line 1835 "glslang.y" +#line 1835 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, Esd1D); } +#line 5953 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 275: -/* Line 1792 of yacc.c */ -#line 1840 "glslang.y" +#line 1840 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, Esd2D); } +#line 5963 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 276: -/* Line 1792 of yacc.c */ -#line 1845 "glslang.y" +#line 1845 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, Esd3D); } +#line 5973 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 277: -/* Line 1792 of yacc.c */ -#line 1850 "glslang.y" +#line 1850 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, EsdCube); } +#line 5983 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 278: -/* Line 1792 of yacc.c */ -#line 1855 "glslang.y" +#line 1855 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 5993 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 279: -/* Line 1792 of yacc.c */ -#line 1860 "glslang.y" +#line 1860 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 6003 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 280: -/* Line 1792 of yacc.c */ -#line 1865 "glslang.y" +#line 1865 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 6013 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 281: -/* Line 1792 of yacc.c */ -#line 1870 "glslang.y" +#line 1870 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, Esd1D); } +#line 6023 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 282: -/* Line 1792 of yacc.c */ -#line 1875 "glslang.y" +#line 1875 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, Esd2D); } +#line 6033 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 283: -/* Line 1792 of yacc.c */ -#line 1880 "glslang.y" +#line 1880 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, Esd3D); } +#line 6043 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 284: -/* Line 1792 of yacc.c */ -#line 1885 "glslang.y" +#line 1885 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, EsdCube); } +#line 6053 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 285: -/* Line 1792 of yacc.c */ -#line 1890 "glslang.y" +#line 1890 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 6063 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 286: -/* Line 1792 of yacc.c */ -#line 1895 "glslang.y" +#line 1895 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 6073 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 287: -/* Line 1792 of yacc.c */ -#line 1900 "glslang.y" +#line 1900 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 6083 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 288: -/* Line 1792 of yacc.c */ -#line 1905 "glslang.y" +#line 1905 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, EsdRect); } +#line 6093 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 289: -/* Line 1792 of yacc.c */ -#line 1910 "glslang.y" +#line 1910 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, EsdRect); } +#line 6103 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 290: -/* Line 1792 of yacc.c */ -#line 1915 "glslang.y" +#line 1915 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, EsdRect); } +#line 6113 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 291: -/* Line 1792 of yacc.c */ -#line 1920 "glslang.y" +#line 1920 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, EsdBuffer); } +#line 6123 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 292: -/* Line 1792 of yacc.c */ -#line 1925 "glslang.y" +#line 1925 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, EsdBuffer); } +#line 6133 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 293: -/* Line 1792 of yacc.c */ -#line 1930 "glslang.y" +#line 1930 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, EsdBuffer); } +#line 6143 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 294: -/* Line 1792 of yacc.c */ -#line 1935 "glslang.y" +#line 1935 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 6153 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 295: -/* Line 1792 of yacc.c */ -#line 1940 "glslang.y" +#line 1940 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 6163 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 296: -/* Line 1792 of yacc.c */ -#line 1945 "glslang.y" +#line 1945 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 6173 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 297: -/* Line 1792 of yacc.c */ -#line 1950 "glslang.y" +#line 1950 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 6183 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 298: -/* Line 1792 of yacc.c */ -#line 1955 "glslang.y" +#line 1955 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 6193 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 299: -/* Line 1792 of yacc.c */ -#line 1960 "glslang.y" +#line 1960 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 6203 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 300: -/* Line 1792 of yacc.c */ -#line 1965 "glslang.y" +#line 1965 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, Esd1D); } +#line 6213 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 301: -/* Line 1792 of yacc.c */ -#line 1970 "glslang.y" +#line 1970 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, Esd1D); } +#line 6223 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 302: -/* Line 1792 of yacc.c */ -#line 1975 "glslang.y" +#line 1975 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, Esd1D); } +#line 6233 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 303: -/* Line 1792 of yacc.c */ -#line 1980 "glslang.y" +#line 1980 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, Esd2D); } +#line 6243 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 304: -/* Line 1792 of yacc.c */ -#line 1985 "glslang.y" +#line 1985 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, Esd2D); } +#line 6253 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 305: -/* Line 1792 of yacc.c */ -#line 1990 "glslang.y" +#line 1990 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, Esd2D); } +#line 6263 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 306: -/* Line 1792 of yacc.c */ -#line 1995 "glslang.y" +#line 1995 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, Esd3D); } +#line 6273 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 307: -/* Line 1792 of yacc.c */ -#line 2000 "glslang.y" +#line 2000 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, Esd3D); } +#line 6283 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 308: -/* Line 1792 of yacc.c */ -#line 2005 "glslang.y" +#line 2005 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, Esd3D); } +#line 6293 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 309: -/* Line 1792 of yacc.c */ -#line 2010 "glslang.y" +#line 2010 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, EsdRect); } +#line 6303 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 310: -/* Line 1792 of yacc.c */ -#line 2015 "glslang.y" +#line 2015 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, EsdRect); } +#line 6313 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 311: -/* Line 1792 of yacc.c */ -#line 2020 "glslang.y" +#line 2020 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, EsdRect); } +#line 6323 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 312: -/* Line 1792 of yacc.c */ -#line 2025 "glslang.y" +#line 2025 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, EsdCube); } +#line 6333 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 313: -/* Line 1792 of yacc.c */ -#line 2030 "glslang.y" +#line 2030 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, EsdCube); } +#line 6343 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 314: -/* Line 1792 of yacc.c */ -#line 2035 "glslang.y" +#line 2035 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, EsdCube); } +#line 6353 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 315: -/* Line 1792 of yacc.c */ -#line 2040 "glslang.y" +#line 2040 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, EsdBuffer); } +#line 6363 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 316: -/* Line 1792 of yacc.c */ -#line 2045 "glslang.y" +#line 2045 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, EsdBuffer); } +#line 6373 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 317: -/* Line 1792 of yacc.c */ -#line 2050 "glslang.y" +#line 2050 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, EsdBuffer); } +#line 6383 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 318: -/* Line 1792 of yacc.c */ -#line 2055 "glslang.y" +#line 2055 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 6393 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 319: -/* Line 1792 of yacc.c */ -#line 2060 "glslang.y" +#line 2060 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 6403 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 320: -/* Line 1792 of yacc.c */ -#line 2065 "glslang.y" +#line 2065 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 6413 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 321: -/* Line 1792 of yacc.c */ -#line 2070 "glslang.y" +#line 2070 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 6423 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 322: -/* Line 1792 of yacc.c */ -#line 2075 "glslang.y" +#line 2075 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 6433 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 323: -/* Line 1792 of yacc.c */ -#line 2080 "glslang.y" +#line 2080 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 6443 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 324: -/* Line 1792 of yacc.c */ -#line 2085 "glslang.y" +#line 2085 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 6453 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 325: -/* Line 1792 of yacc.c */ -#line 2090 "glslang.y" +#line 2090 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 6463 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 326: -/* Line 1792 of yacc.c */ -#line 2095 "glslang.y" +#line 2095 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 6473 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 327: -/* Line 1792 of yacc.c */ -#line 2100 "glslang.y" +#line 2100 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 6483 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 328: -/* Line 1792 of yacc.c */ -#line 2105 "glslang.y" +#line 2105 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 6493 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 329: -/* Line 1792 of yacc.c */ -#line 2110 "glslang.y" +#line 2110 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 6503 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 330: -/* Line 1792 of yacc.c */ -#line 2115 "glslang.y" +#line 2115 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 6513 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 331: -/* Line 1792 of yacc.c */ -#line 2120 "glslang.y" +#line 2120 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 6523 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 332: -/* Line 1792 of yacc.c */ -#line 2125 "glslang.y" +#line 2125 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 6533 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 333: -/* Line 1792 of yacc.c */ -#line 2130 "glslang.y" +#line 2130 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // GL_OES_EGL_image_external - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (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 6544 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 334: -/* Line 1792 of yacc.c */ -#line 2136 "glslang.y" +#line 2136 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.requireStage((yyvsp[(1) - (1)].lex).loc, EShLangFragment, "subpass input"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + 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 6555 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 335: -/* Line 1792 of yacc.c */ -#line 2142 "glslang.y" +#line 2142 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.requireStage((yyvsp[(1) - (1)].lex).loc, EShLangFragment, "subpass input"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + 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 6566 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 336: -/* Line 1792 of yacc.c */ -#line 2148 "glslang.y" +#line 2148 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.requireStage((yyvsp[(1) - (1)].lex).loc, EShLangFragment, "subpass input"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + 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 6577 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 337: -/* Line 1792 of yacc.c */ -#line 2154 "glslang.y" +#line 2154 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.requireStage((yyvsp[(1) - (1)].lex).loc, EShLangFragment, "subpass input"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + 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 6588 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 338: -/* Line 1792 of yacc.c */ -#line 2160 "glslang.y" +#line 2160 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.requireStage((yyvsp[(1) - (1)].lex).loc, EShLangFragment, "subpass input"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + 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 6599 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 339: -/* Line 1792 of yacc.c */ -#line 2166 "glslang.y" +#line 2166 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.requireStage((yyvsp[(1) - (1)].lex).loc, EShLangFragment, "subpass input"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + 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 6610 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 340: -/* Line 1792 of yacc.c */ -#line 2172 "glslang.y" +#line 2172 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); + (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 6620 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 341: -/* Line 1792 of yacc.c */ -#line 2177 "glslang.y" +#line 2177 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // // This is for user defined type names. The lexical phase looked up the // type. // - if (const TVariable* variable = ((yyvsp[(1) - (1)].lex).symbol)->getAsVariable()) { + if (const TVariable* variable = ((yyvsp[0].lex).symbol)->getAsVariable()) { const TType& structure = variable->getType(); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtStruct; (yyval.interm.type).userDef = &structure; } else - parseContext.error((yyvsp[(1) - (1)].lex).loc, "expected type name", (yyvsp[(1) - (1)].lex).string->c_str(), ""); + parseContext.error((yyvsp[0].lex).loc, "expected type name", (yyvsp[0].lex).string->c_str(), ""); } +#line 6638 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 342: -/* Line 1792 of yacc.c */ -#line 2193 "glslang.y" +#line 2193 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.profileRequires((yyvsp[(1) - (1)].lex).loc, ENoProfile, 130, 0, "highp precision qualifier"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "highp precision qualifier"); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); if (parseContext.profile == EEsProfile) (yyval.interm.type).qualifier.precision = EpqHigh; } +#line 6649 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 343: -/* Line 1792 of yacc.c */ -#line 2199 "glslang.y" +#line 2199 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.profileRequires((yyvsp[(1) - (1)].lex).loc, ENoProfile, 130, 0, "mediump precision qualifier"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "mediump precision qualifier"); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); if (parseContext.profile == EEsProfile) (yyval.interm.type).qualifier.precision = EpqMedium; } +#line 6660 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 344: -/* Line 1792 of yacc.c */ -#line 2205 "glslang.y" +#line 2205 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.profileRequires((yyvsp[(1) - (1)].lex).loc, ENoProfile, 130, 0, "lowp precision qualifier"); - (yyval.interm.type).init((yyvsp[(1) - (1)].lex).loc, parseContext.symbolTable.atGlobalLevel()); + parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "lowp precision qualifier"); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); if (parseContext.profile == EEsProfile) (yyval.interm.type).qualifier.precision = EpqLow; } +#line 6671 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 345: -/* Line 1792 of yacc.c */ -#line 2214 "glslang.y" - { parseContext.nestedStructCheck((yyvsp[(1) - (3)].lex).loc); } +#line 2214 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { parseContext.nestedStructCheck((yyvsp[-2].lex).loc); } +#line 6677 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 346: -/* Line 1792 of yacc.c */ -#line 2214 "glslang.y" +#line 2214 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - TType* structure = new TType((yyvsp[(5) - (6)].interm.typeList), *(yyvsp[(2) - (6)].lex).string); - parseContext.structArrayCheck((yyvsp[(2) - (6)].lex).loc, *structure); - TVariable* userTypeDef = new TVariable((yyvsp[(2) - (6)].lex).string, *structure, true); + TType* structure = new TType((yyvsp[-1].interm.typeList), *(yyvsp[-4].lex).string); + parseContext.structArrayCheck((yyvsp[-4].lex).loc, *structure); + TVariable* userTypeDef = new TVariable((yyvsp[-4].lex).string, *structure, true); if (! parseContext.symbolTable.insert(*userTypeDef)) - parseContext.error((yyvsp[(2) - (6)].lex).loc, "redefinition", (yyvsp[(2) - (6)].lex).string->c_str(), "struct"); - (yyval.interm.type).init((yyvsp[(1) - (6)].lex).loc); + parseContext.error((yyvsp[-4].lex).loc, "redefinition", (yyvsp[-4].lex).string->c_str(), "struct"); + (yyval.interm.type).init((yyvsp[-5].lex).loc); (yyval.interm.type).basicType = EbtStruct; (yyval.interm.type).userDef = structure; --parseContext.structNestingLevel; } +#line 6693 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 347: -/* Line 1792 of yacc.c */ -#line 2225 "glslang.y" - { parseContext.nestedStructCheck((yyvsp[(1) - (2)].lex).loc); } +#line 2225 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { parseContext.nestedStructCheck((yyvsp[-1].lex).loc); } +#line 6699 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 348: -/* Line 1792 of yacc.c */ -#line 2225 "glslang.y" +#line 2225 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - TType* structure = new TType((yyvsp[(4) - (5)].interm.typeList), TString("")); - (yyval.interm.type).init((yyvsp[(1) - (5)].lex).loc); + TType* structure = new TType((yyvsp[-1].interm.typeList), TString("")); + (yyval.interm.type).init((yyvsp[-4].lex).loc); (yyval.interm.type).basicType = EbtStruct; (yyval.interm.type).userDef = structure; --parseContext.structNestingLevel; } +#line 6711 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 349: -/* Line 1792 of yacc.c */ -#line 2235 "glslang.y" +#line 2235 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.typeList) = (yyvsp[(1) - (1)].interm.typeList); + (yyval.interm.typeList) = (yyvsp[0].interm.typeList); } +#line 6719 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 350: -/* Line 1792 of yacc.c */ -#line 2238 "glslang.y" +#line 2238 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.typeList) = (yyvsp[(1) - (2)].interm.typeList); - for (unsigned int i = 0; i < (yyvsp[(2) - (2)].interm.typeList)->size(); ++i) { + (yyval.interm.typeList) = (yyvsp[-1].interm.typeList); + for (unsigned int i = 0; i < (yyvsp[0].interm.typeList)->size(); ++i) { for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) { - if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName()) - parseContext.error((*(yyvsp[(2) - (2)].interm.typeList))[i].loc, "duplicate member name:", "", (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName().c_str()); + if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[0].interm.typeList))[i].type->getFieldName()) + parseContext.error((*(yyvsp[0].interm.typeList))[i].loc, "duplicate member name:", "", (*(yyvsp[0].interm.typeList))[i].type->getFieldName().c_str()); } - (yyval.interm.typeList)->push_back((*(yyvsp[(2) - (2)].interm.typeList))[i]); + (yyval.interm.typeList)->push_back((*(yyvsp[0].interm.typeList))[i]); } } +#line 6734 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 351: -/* Line 1792 of yacc.c */ -#line 2251 "glslang.y" +#line 2251 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - if ((yyvsp[(1) - (3)].interm.type).arraySizes) { - parseContext.profileRequires((yyvsp[(1) - (3)].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); - parseContext.profileRequires((yyvsp[(1) - (3)].interm.type).loc, EEsProfile, 300, 0, "arrayed type"); + 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) - parseContext.arraySizeRequiredCheck((yyvsp[(1) - (3)].interm.type).loc, *(yyvsp[(1) - (3)].interm.type).arraySizes); + parseContext.arraySizeRequiredCheck((yyvsp[-2].interm.type).loc, *(yyvsp[-2].interm.type).arraySizes); } - (yyval.interm.typeList) = (yyvsp[(2) - (3)].interm.typeList); + (yyval.interm.typeList) = (yyvsp[-1].interm.typeList); - parseContext.voidErrorCheck((yyvsp[(1) - (3)].interm.type).loc, (*(yyvsp[(2) - (3)].interm.typeList))[0].type->getFieldName(), (yyvsp[(1) - (3)].interm.type).basicType); - parseContext.precisionQualifierCheck((yyvsp[(1) - (3)].interm.type).loc, (yyvsp[(1) - (3)].interm.type).basicType, (yyvsp[(1) - (3)].interm.type).qualifier); + parseContext.voidErrorCheck((yyvsp[-2].interm.type).loc, (*(yyvsp[-1].interm.typeList))[0].type->getFieldName(), (yyvsp[-2].interm.type).basicType); + parseContext.precisionQualifierCheck((yyvsp[-2].interm.type).loc, (yyvsp[-2].interm.type).basicType, (yyvsp[-2].interm.type).qualifier); for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) { - parseContext.arrayDimCheck((yyvsp[(1) - (3)].interm.type).loc, (*(yyval.interm.typeList))[i].type, (yyvsp[(1) - (3)].interm.type).arraySizes); - (*(yyval.interm.typeList))[i].type->mergeType((yyvsp[(1) - (3)].interm.type)); + parseContext.arrayDimCheck((yyvsp[-2].interm.type).loc, (*(yyval.interm.typeList))[i].type, (yyvsp[-2].interm.type).arraySizes); + (*(yyval.interm.typeList))[i].type->mergeType((yyvsp[-2].interm.type)); } } +#line 6757 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 352: -/* Line 1792 of yacc.c */ -#line 2269 "glslang.y" +#line 2269 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.globalQualifierFixCheck((yyvsp[(1) - (4)].interm.type).loc, (yyvsp[(1) - (4)].interm.type).qualifier); - if ((yyvsp[(2) - (4)].interm.type).arraySizes) { - parseContext.profileRequires((yyvsp[(2) - (4)].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); - parseContext.profileRequires((yyvsp[(2) - (4)].interm.type).loc, EEsProfile, 300, 0, "arrayed type"); + parseContext.globalQualifierFixCheck((yyvsp[-3].interm.type).loc, (yyvsp[-3].interm.type).qualifier); + 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) - parseContext.arraySizeRequiredCheck((yyvsp[(2) - (4)].interm.type).loc, *(yyvsp[(2) - (4)].interm.type).arraySizes); + parseContext.arraySizeRequiredCheck((yyvsp[-2].interm.type).loc, *(yyvsp[-2].interm.type).arraySizes); } - (yyval.interm.typeList) = (yyvsp[(3) - (4)].interm.typeList); + (yyval.interm.typeList) = (yyvsp[-1].interm.typeList); - parseContext.checkNoShaderLayouts((yyvsp[(1) - (4)].interm.type).loc, (yyvsp[(1) - (4)].interm.type).shaderQualifiers); - parseContext.voidErrorCheck((yyvsp[(2) - (4)].interm.type).loc, (*(yyvsp[(3) - (4)].interm.typeList))[0].type->getFieldName(), (yyvsp[(2) - (4)].interm.type).basicType); - parseContext.mergeQualifiers((yyvsp[(2) - (4)].interm.type).loc, (yyvsp[(2) - (4)].interm.type).qualifier, (yyvsp[(1) - (4)].interm.type).qualifier, true); - parseContext.precisionQualifierCheck((yyvsp[(2) - (4)].interm.type).loc, (yyvsp[(2) - (4)].interm.type).basicType, (yyvsp[(2) - (4)].interm.type).qualifier); + parseContext.checkNoShaderLayouts((yyvsp[-3].interm.type).loc, (yyvsp[-3].interm.type).shaderQualifiers); + parseContext.voidErrorCheck((yyvsp[-2].interm.type).loc, (*(yyvsp[-1].interm.typeList))[0].type->getFieldName(), (yyvsp[-2].interm.type).basicType); + parseContext.mergeQualifiers((yyvsp[-2].interm.type).loc, (yyvsp[-2].interm.type).qualifier, (yyvsp[-3].interm.type).qualifier, true); + parseContext.precisionQualifierCheck((yyvsp[-2].interm.type).loc, (yyvsp[-2].interm.type).basicType, (yyvsp[-2].interm.type).qualifier); for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) { - parseContext.arrayDimCheck((yyvsp[(1) - (4)].interm.type).loc, (*(yyval.interm.typeList))[i].type, (yyvsp[(2) - (4)].interm.type).arraySizes); - (*(yyval.interm.typeList))[i].type->mergeType((yyvsp[(2) - (4)].interm.type)); + parseContext.arrayDimCheck((yyvsp[-3].interm.type).loc, (*(yyval.interm.typeList))[i].type, (yyvsp[-2].interm.type).arraySizes); + (*(yyval.interm.typeList))[i].type->mergeType((yyvsp[-2].interm.type)); } } +#line 6783 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 353: -/* Line 1792 of yacc.c */ -#line 2293 "glslang.y" +#line 2293 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.typeList) = new TTypeList; - (yyval.interm.typeList)->push_back((yyvsp[(1) - (1)].interm.typeLine)); + (yyval.interm.typeList)->push_back((yyvsp[0].interm.typeLine)); } +#line 6792 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 354: -/* Line 1792 of yacc.c */ -#line 2297 "glslang.y" +#line 2297 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.typeList)->push_back((yyvsp[(3) - (3)].interm.typeLine)); + (yyval.interm.typeList)->push_back((yyvsp[0].interm.typeLine)); } +#line 6800 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 355: -/* Line 1792 of yacc.c */ -#line 2303 "glslang.y" +#line 2303 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.typeLine).type = new TType(EbtVoid); - (yyval.interm.typeLine).loc = (yyvsp[(1) - (1)].lex).loc; - (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (1)].lex).string); + (yyval.interm.typeLine).loc = (yyvsp[0].lex).loc; + (yyval.interm.typeLine).type->setFieldName(*(yyvsp[0].lex).string); } +#line 6810 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 356: -/* Line 1792 of yacc.c */ -#line 2308 "glslang.y" +#line 2308 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.arrayDimCheck((yyvsp[(1) - (2)].lex).loc, (yyvsp[(2) - (2)].interm).arraySizes, 0); + parseContext.arrayDimCheck((yyvsp[-1].lex).loc, (yyvsp[0].interm).arraySizes, 0); (yyval.interm.typeLine).type = new TType(EbtVoid); - (yyval.interm.typeLine).loc = (yyvsp[(1) - (2)].lex).loc; - (yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (2)].lex).string); - (yyval.interm.typeLine).type->newArraySizes(*(yyvsp[(2) - (2)].interm).arraySizes); + (yyval.interm.typeLine).loc = (yyvsp[-1].lex).loc; + (yyval.interm.typeLine).type->setFieldName(*(yyvsp[-1].lex).string); + (yyval.interm.typeLine).type->newArraySizes(*(yyvsp[0].interm).arraySizes); } +#line 6823 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 357: -/* Line 1792 of yacc.c */ -#line 2319 "glslang.y" +#line 2319 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); + (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } +#line 6831 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 358: -/* Line 1792 of yacc.c */ -#line 2322 "glslang.y" +#line 2322 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { const char* initFeature = "{ } style initializers"; - parseContext.requireProfile((yyvsp[(1) - (3)].lex).loc, ~EEsProfile, initFeature); - parseContext.profileRequires((yyvsp[(1) - (3)].lex).loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, initFeature); - (yyval.interm.intermTypedNode) = (yyvsp[(2) - (3)].interm.intermTypedNode); + 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 6842 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 359: -/* Line 1792 of yacc.c */ -#line 2328 "glslang.y" +#line 2328 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { const char* initFeature = "{ } style initializers"; - parseContext.requireProfile((yyvsp[(1) - (4)].lex).loc, ~EEsProfile, initFeature); - parseContext.profileRequires((yyvsp[(1) - (4)].lex).loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, initFeature); - (yyval.interm.intermTypedNode) = (yyvsp[(2) - (4)].interm.intermTypedNode); + 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 6853 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 360: -/* Line 1792 of yacc.c */ -#line 2337 "glslang.y" +#line 2337 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = parseContext.intermediate.growAggregate(0, (yyvsp[(1) - (1)].interm.intermTypedNode), (yyvsp[(1) - (1)].interm.intermTypedNode)->getLoc()); + (yyval.interm.intermTypedNode) = parseContext.intermediate.growAggregate(0, (yyvsp[0].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)->getLoc()); } +#line 6861 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 361: -/* Line 1792 of yacc.c */ -#line 2340 "glslang.y" +#line 2340 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = parseContext.intermediate.growAggregate((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode)); + (yyval.interm.intermTypedNode) = parseContext.intermediate.growAggregate((yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); } +#line 6869 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 362: -/* Line 1792 of yacc.c */ -#line 2346 "glslang.y" - { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } +#line 2346 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } +#line 6875 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 363: -/* Line 1792 of yacc.c */ -#line 2350 "glslang.y" - { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } +#line 2350 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } +#line 6881 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 364: -/* Line 1792 of yacc.c */ -#line 2351 "glslang.y" - { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } +#line 2351 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } +#line 6887 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 365: -/* Line 1792 of yacc.c */ -#line 2357 "glslang.y" - { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } +#line 2357 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } +#line 6893 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 366: -/* Line 1792 of yacc.c */ -#line 2358 "glslang.y" - { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } +#line 2358 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } +#line 6899 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 367: -/* Line 1792 of yacc.c */ -#line 2359 "glslang.y" - { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } +#line 2359 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } +#line 6905 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 368: -/* Line 1792 of yacc.c */ -#line 2360 "glslang.y" - { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } +#line 2360 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } +#line 6911 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 369: -/* Line 1792 of yacc.c */ -#line 2361 "glslang.y" - { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } +#line 2361 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } +#line 6917 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 370: -/* Line 1792 of yacc.c */ -#line 2362 "glslang.y" - { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } +#line 2362 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } +#line 6923 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 371: -/* Line 1792 of yacc.c */ -#line 2363 "glslang.y" - { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } +#line 2363 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } +#line 6929 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 372: -/* Line 1792 of yacc.c */ -#line 2367 "glslang.y" +#line 2367 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = 0; } +#line 6935 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 373: -/* Line 1792 of yacc.c */ -#line 2368 "glslang.y" +#line 2368 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.symbolTable.push(); ++parseContext.statementNestingLevel; } +#line 6944 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 374: -/* Line 1792 of yacc.c */ -#line 2372 "glslang.y" +#line 2372 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); --parseContext.statementNestingLevel; } +#line 6953 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 375: -/* Line 1792 of yacc.c */ -#line 2376 "glslang.y" +#line 2376 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - if ((yyvsp[(3) - (5)].interm.intermNode) && (yyvsp[(3) - (5)].interm.intermNode)->getAsAggregate()) - (yyvsp[(3) - (5)].interm.intermNode)->getAsAggregate()->setOperator(EOpSequence); - (yyval.interm.intermNode) = (yyvsp[(3) - (5)].interm.intermNode); + 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 6963 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 376: -/* Line 1792 of yacc.c */ -#line 2384 "glslang.y" - { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } +#line 2384 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } +#line 6969 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 377: -/* Line 1792 of yacc.c */ -#line 2385 "glslang.y" - { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); } +#line 2385 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } +#line 6975 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 378: -/* Line 1792 of yacc.c */ -#line 2389 "glslang.y" +#line 2389 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { ++parseContext.controlFlowNestingLevel; } +#line 6983 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 379: -/* Line 1792 of yacc.c */ -#line 2392 "glslang.y" +#line 2392 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { --parseContext.controlFlowNestingLevel; - (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); + (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } +#line 6992 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 380: -/* Line 1792 of yacc.c */ -#line 2396 "glslang.y" +#line 2396 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.symbolTable.push(); ++parseContext.statementNestingLevel; ++parseContext.controlFlowNestingLevel; } +#line 7002 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 381: -/* Line 1792 of yacc.c */ -#line 2401 "glslang.y" +#line 2401 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; - (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); + (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } +#line 7013 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 382: -/* Line 1792 of yacc.c */ -#line 2410 "glslang.y" +#line 2410 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = 0; } +#line 7021 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 383: -/* Line 1792 of yacc.c */ -#line 2413 "glslang.y" +#line 2413 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - if ((yyvsp[(2) - (3)].interm.intermNode) && (yyvsp[(2) - (3)].interm.intermNode)->getAsAggregate()) - (yyvsp[(2) - (3)].interm.intermNode)->getAsAggregate()->setOperator(EOpSequence); - (yyval.interm.intermNode) = (yyvsp[(2) - (3)].interm.intermNode); + 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 7031 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 384: -/* Line 1792 of yacc.c */ -#line 2421 "glslang.y" +#line 2421 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermNode) = parseContext.intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode)); - if ((yyvsp[(1) - (1)].interm.intermNode) && (yyvsp[(1) - (1)].interm.intermNode)->getAsBranchNode() && ((yyvsp[(1) - (1)].interm.intermNode)->getAsBranchNode()->getFlowOp() == EOpCase || - (yyvsp[(1) - (1)].interm.intermNode)->getAsBranchNode()->getFlowOp() == EOpDefault)) { - parseContext.wrapupSwitchSubsequence(0, (yyvsp[(1) - (1)].interm.intermNode)); + (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 || + (yyvsp[0].interm.intermNode)->getAsBranchNode()->getFlowOp() == EOpDefault)) { + parseContext.wrapupSwitchSubsequence(0, (yyvsp[0].interm.intermNode)); (yyval.interm.intermNode) = 0; // start a fresh subsequence for what's after this case } } +#line 7044 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 385: -/* Line 1792 of yacc.c */ -#line 2429 "glslang.y" +#line 2429 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - if ((yyvsp[(2) - (2)].interm.intermNode) && (yyvsp[(2) - (2)].interm.intermNode)->getAsBranchNode() && ((yyvsp[(2) - (2)].interm.intermNode)->getAsBranchNode()->getFlowOp() == EOpCase || - (yyvsp[(2) - (2)].interm.intermNode)->getAsBranchNode()->getFlowOp() == EOpDefault)) { - parseContext.wrapupSwitchSubsequence((yyvsp[(1) - (2)].interm.intermNode) ? (yyvsp[(1) - (2)].interm.intermNode)->getAsAggregate() : 0, (yyvsp[(2) - (2)].interm.intermNode)); + if ((yyvsp[0].interm.intermNode) && (yyvsp[0].interm.intermNode)->getAsBranchNode() && ((yyvsp[0].interm.intermNode)->getAsBranchNode()->getFlowOp() == EOpCase || + (yyvsp[0].interm.intermNode)->getAsBranchNode()->getFlowOp() == EOpDefault)) { + parseContext.wrapupSwitchSubsequence((yyvsp[-1].interm.intermNode) ? (yyvsp[-1].interm.intermNode)->getAsAggregate() : 0, (yyvsp[0].interm.intermNode)); (yyval.interm.intermNode) = 0; // start a fresh subsequence for what's after this case } else - (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode)); + (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[-1].interm.intermNode), (yyvsp[0].interm.intermNode)); } +#line 7057 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 386: -/* Line 1792 of yacc.c */ -#line 2440 "glslang.y" +#line 2440 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = 0; } +#line 7063 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 387: -/* Line 1792 of yacc.c */ -#line 2441 "glslang.y" - { (yyval.interm.intermNode) = static_cast((yyvsp[(1) - (2)].interm.intermTypedNode)); } +#line 2441 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermNode) = static_cast((yyvsp[-1].interm.intermTypedNode)); } +#line 7069 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 388: -/* Line 1792 of yacc.c */ -#line 2445 "glslang.y" +#line 2445 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.boolCheck((yyvsp[(1) - (5)].lex).loc, (yyvsp[(3) - (5)].interm.intermTypedNode)); - (yyval.interm.intermNode) = parseContext.intermediate.addSelection((yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.nodePair), (yyvsp[(1) - (5)].lex).loc); + 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 7078 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 389: -/* Line 1792 of yacc.c */ -#line 2452 "glslang.y" +#line 2452 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode); - (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermNode); + (yyval.interm.nodePair).node1 = (yyvsp[-2].interm.intermNode); + (yyval.interm.nodePair).node2 = (yyvsp[0].interm.intermNode); } +#line 7087 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 390: -/* Line 1792 of yacc.c */ -#line 2456 "glslang.y" +#line 2456 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode); + (yyval.interm.nodePair).node1 = (yyvsp[0].interm.intermNode); (yyval.interm.nodePair).node2 = 0; } +#line 7096 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 391: -/* Line 1792 of yacc.c */ -#line 2464 "glslang.y" +#line 2464 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); - parseContext.boolCheck((yyvsp[(1) - (1)].interm.intermTypedNode)->getLoc(), (yyvsp[(1) - (1)].interm.intermTypedNode)); + (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); + parseContext.boolCheck((yyvsp[0].interm.intermTypedNode)->getLoc(), (yyvsp[0].interm.intermTypedNode)); } +#line 7105 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 392: -/* Line 1792 of yacc.c */ -#line 2468 "glslang.y" +#line 2468 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.boolCheck((yyvsp[(2) - (4)].lex).loc, (yyvsp[(1) - (4)].interm.type)); + parseContext.boolCheck((yyvsp[-2].lex).loc, (yyvsp[-3].interm.type)); - TType type((yyvsp[(1) - (4)].interm.type)); - TIntermNode* initNode = parseContext.declareVariable((yyvsp[(2) - (4)].lex).loc, *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), 0, (yyvsp[(4) - (4)].interm.intermTypedNode)); + TType 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)); if (initNode) (yyval.interm.intermTypedNode) = initNode->getAsTyped(); else (yyval.interm.intermTypedNode) = 0; } +#line 7120 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 393: -/* Line 1792 of yacc.c */ -#line 2481 "glslang.y" +#line 2481 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // start new switch sequence on the switch stack ++parseContext.controlFlowNestingLevel; @@ -7419,13 +7129,13 @@ yyreduce: parseContext.switchLevel.push_back(parseContext.statementNestingLevel); parseContext.symbolTable.push(); } +#line 7133 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 394: -/* Line 1792 of yacc.c */ -#line 2489 "glslang.y" +#line 2489 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermNode) = parseContext.addSwitch((yyvsp[(1) - (8)].lex).loc, (yyvsp[(3) - (8)].interm.intermTypedNode), (yyvsp[(7) - (8)].interm.intermNode) ? (yyvsp[(7) - (8)].interm.intermNode)->getAsAggregate() : 0); + (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(); parseContext.switchSequenceStack.pop_back(); parseContext.switchLevel.pop_back(); @@ -7433,302 +7143,302 @@ yyreduce: --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; } +#line 7147 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 395: -/* Line 1792 of yacc.c */ -#line 2501 "glslang.y" +#line 2501 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = 0; } +#line 7155 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 396: -/* Line 1792 of yacc.c */ -#line 2504 "glslang.y" +#line 2504 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); + (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } +#line 7163 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 397: -/* Line 1792 of yacc.c */ -#line 2510 "glslang.y" +#line 2510 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = 0; if (parseContext.switchLevel.size() == 0) - parseContext.error((yyvsp[(1) - (3)].lex).loc, "cannot appear outside switch statement", "case", ""); + parseContext.error((yyvsp[-2].lex).loc, "cannot appear outside switch statement", "case", ""); else if (parseContext.switchLevel.back() != parseContext.statementNestingLevel) - parseContext.error((yyvsp[(1) - (3)].lex).loc, "cannot be nested inside control flow", "case", ""); + parseContext.error((yyvsp[-2].lex).loc, "cannot be nested inside control flow", "case", ""); else { - parseContext.constantValueCheck((yyvsp[(2) - (3)].interm.intermTypedNode), "case"); - parseContext.integerCheck((yyvsp[(2) - (3)].interm.intermTypedNode), "case"); - (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpCase, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).loc); + parseContext.constantValueCheck((yyvsp[-1].interm.intermTypedNode), "case"); + parseContext.integerCheck((yyvsp[-1].interm.intermTypedNode), "case"); + (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpCase, (yyvsp[-1].interm.intermTypedNode), (yyvsp[-2].lex).loc); } } +#line 7180 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 398: -/* Line 1792 of yacc.c */ -#line 2522 "glslang.y" +#line 2522 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = 0; if (parseContext.switchLevel.size() == 0) - parseContext.error((yyvsp[(1) - (2)].lex).loc, "cannot appear outside switch statement", "default", ""); + parseContext.error((yyvsp[-1].lex).loc, "cannot appear outside switch statement", "default", ""); else if (parseContext.switchLevel.back() != parseContext.statementNestingLevel) - parseContext.error((yyvsp[(1) - (2)].lex).loc, "cannot be nested inside control flow", "default", ""); + parseContext.error((yyvsp[-1].lex).loc, "cannot be nested inside control flow", "default", ""); else - (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpDefault, (yyvsp[(1) - (2)].lex).loc); + (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpDefault, (yyvsp[-1].lex).loc); } +#line 7194 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 399: -/* Line 1792 of yacc.c */ -#line 2534 "glslang.y" +#line 2534 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if (! parseContext.limits.whileLoops) - parseContext.error((yyvsp[(1) - (2)].lex).loc, "while loops not available", "limitation", ""); + parseContext.error((yyvsp[-1].lex).loc, "while loops not available", "limitation", ""); parseContext.symbolTable.push(); ++parseContext.loopNestingLevel; ++parseContext.statementNestingLevel; ++parseContext.controlFlowNestingLevel; } +#line 7207 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 400: -/* Line 1792 of yacc.c */ -#line 2542 "glslang.y" +#line 2542 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); - (yyval.interm.intermNode) = parseContext.intermediate.addLoop((yyvsp[(6) - (6)].interm.intermNode), (yyvsp[(4) - (6)].interm.intermTypedNode), 0, true, (yyvsp[(1) - (6)].lex).loc); + (yyval.interm.intermNode) = parseContext.intermediate.addLoop((yyvsp[0].interm.intermNode), (yyvsp[-2].interm.intermTypedNode), 0, true, (yyvsp[-5].lex).loc); --parseContext.loopNestingLevel; --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; } +#line 7219 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 401: -/* Line 1792 of yacc.c */ -#line 2549 "glslang.y" +#line 2549 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { ++parseContext.loopNestingLevel; ++parseContext.statementNestingLevel; ++parseContext.controlFlowNestingLevel; } +#line 7229 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 402: -/* Line 1792 of yacc.c */ -#line 2554 "glslang.y" +#line 2554 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if (! parseContext.limits.whileLoops) - parseContext.error((yyvsp[(1) - (8)].lex).loc, "do-while loops not available", "limitation", ""); + parseContext.error((yyvsp[-7].lex).loc, "do-while loops not available", "limitation", ""); - parseContext.boolCheck((yyvsp[(8) - (8)].lex).loc, (yyvsp[(6) - (8)].interm.intermTypedNode)); + parseContext.boolCheck((yyvsp[0].lex).loc, (yyvsp[-2].interm.intermTypedNode)); - (yyval.interm.intermNode) = parseContext.intermediate.addLoop((yyvsp[(3) - (8)].interm.intermNode), (yyvsp[(6) - (8)].interm.intermTypedNode), 0, false, (yyvsp[(4) - (8)].lex).loc); + (yyval.interm.intermNode) = parseContext.intermediate.addLoop((yyvsp[-5].interm.intermNode), (yyvsp[-2].interm.intermTypedNode), 0, false, (yyvsp[-4].lex).loc); --parseContext.loopNestingLevel; --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; } +#line 7245 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 403: -/* Line 1792 of yacc.c */ -#line 2565 "glslang.y" +#line 2565 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.symbolTable.push(); ++parseContext.loopNestingLevel; ++parseContext.statementNestingLevel; ++parseContext.controlFlowNestingLevel; } +#line 7256 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 404: -/* Line 1792 of yacc.c */ -#line 2571 "glslang.y" +#line 2571 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); - (yyval.interm.intermNode) = parseContext.intermediate.makeAggregate((yyvsp[(4) - (7)].interm.intermNode), (yyvsp[(2) - (7)].lex).loc); - TIntermLoop* forLoop = parseContext.intermediate.addLoop((yyvsp[(7) - (7)].interm.intermNode), reinterpret_cast((yyvsp[(5) - (7)].interm.nodePair).node1), reinterpret_cast((yyvsp[(5) - (7)].interm.nodePair).node2), true, (yyvsp[(1) - (7)].lex).loc); + (yyval.interm.intermNode) = parseContext.intermediate.makeAggregate((yyvsp[-3].interm.intermNode), (yyvsp[-5].lex).loc); + TIntermLoop* forLoop = parseContext.intermediate.addLoop((yyvsp[0].interm.intermNode), reinterpret_cast((yyvsp[-2].interm.nodePair).node1), reinterpret_cast((yyvsp[-2].interm.nodePair).node2), true, (yyvsp[-6].lex).loc); if (! parseContext.limits.nonInductiveForLoops) - parseContext.inductiveLoopCheck((yyvsp[(1) - (7)].lex).loc, (yyvsp[(4) - (7)].interm.intermNode), forLoop); - (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyval.interm.intermNode), forLoop, (yyvsp[(1) - (7)].lex).loc); + parseContext.inductiveLoopCheck((yyvsp[-6].lex).loc, (yyvsp[-3].interm.intermNode), forLoop); + (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyval.interm.intermNode), forLoop, (yyvsp[-6].lex).loc); (yyval.interm.intermNode)->getAsAggregate()->setOperator(EOpSequence); --parseContext.loopNestingLevel; --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; } +#line 7273 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 405: -/* Line 1792 of yacc.c */ -#line 2586 "glslang.y" +#line 2586 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); + (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } +#line 7281 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 406: -/* Line 1792 of yacc.c */ -#line 2589 "glslang.y" +#line 2589 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); + (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } +#line 7289 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 407: -/* Line 1792 of yacc.c */ -#line 2595 "glslang.y" +#line 2595 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); + (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } +#line 7297 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 408: -/* Line 1792 of yacc.c */ -#line 2598 "glslang.y" +#line 2598 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = 0; } +#line 7305 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 409: -/* Line 1792 of yacc.c */ -#line 2604 "glslang.y" +#line 2604 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode); + (yyval.interm.nodePair).node1 = (yyvsp[-1].interm.intermTypedNode); (yyval.interm.nodePair).node2 = 0; } +#line 7314 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 410: -/* Line 1792 of yacc.c */ -#line 2608 "glslang.y" +#line 2608 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode); - (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermTypedNode); + (yyval.interm.nodePair).node1 = (yyvsp[-2].interm.intermTypedNode); + (yyval.interm.nodePair).node2 = (yyvsp[0].interm.intermTypedNode); } +#line 7323 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 411: -/* Line 1792 of yacc.c */ -#line 2615 "glslang.y" +#line 2615 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if (parseContext.loopNestingLevel <= 0) - parseContext.error((yyvsp[(1) - (2)].lex).loc, "continue statement only allowed in loops", "", ""); - (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpContinue, (yyvsp[(1) - (2)].lex).loc); + parseContext.error((yyvsp[-1].lex).loc, "continue statement only allowed in loops", "", ""); + (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpContinue, (yyvsp[-1].lex).loc); } +#line 7333 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 412: -/* Line 1792 of yacc.c */ -#line 2620 "glslang.y" +#line 2620 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if (parseContext.loopNestingLevel + parseContext.switchSequenceStack.size() <= 0) - parseContext.error((yyvsp[(1) - (2)].lex).loc, "break statement only allowed in switch and loops", "", ""); - (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpBreak, (yyvsp[(1) - (2)].lex).loc); + 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 7343 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 413: -/* Line 1792 of yacc.c */ -#line 2625 "glslang.y" +#line 2625 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpReturn, (yyvsp[(1) - (2)].lex).loc); + (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpReturn, (yyvsp[-1].lex).loc); if (parseContext.currentFunctionType->getBasicType() != EbtVoid) - parseContext.error((yyvsp[(1) - (2)].lex).loc, "non-void function must return a value", "return", ""); + parseContext.error((yyvsp[-1].lex).loc, "non-void function must return a value", "return", ""); if (parseContext.inMain) parseContext.postMainReturn = true; } +#line 7355 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 414: -/* Line 1792 of yacc.c */ -#line 2632 "glslang.y" +#line 2632 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.functionReturnsValue = true; if (parseContext.currentFunctionType->getBasicType() == EbtVoid) { - parseContext.error((yyvsp[(1) - (3)].lex).loc, "void function cannot return a value", "return", ""); - (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpReturn, (yyvsp[(1) - (3)].lex).loc); - } else if (*(parseContext.currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)->getType()) { - TIntermTyped* converted = parseContext.intermediate.addConversion(EOpReturn, *parseContext.currentFunctionType, (yyvsp[(2) - (3)].interm.intermTypedNode)); + parseContext.error((yyvsp[-2].lex).loc, "void function cannot return a value", "return", ""); + (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpReturn, (yyvsp[-2].lex).loc); + } else if (*(parseContext.currentFunctionType) != (yyvsp[-1].interm.intermTypedNode)->getType()) { + TIntermTyped* converted = parseContext.intermediate.addConversion(EOpReturn, *parseContext.currentFunctionType, (yyvsp[-1].interm.intermTypedNode)); if (converted) { if (parseContext.version < 420) - parseContext.warn((yyvsp[(1) - (3)].lex).loc, "type conversion on return values was not explicitly allowed until version 420", "return", ""); - (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpReturn, converted, (yyvsp[(1) - (3)].lex).loc); + parseContext.warn((yyvsp[-2].lex).loc, "type conversion on return values was not explicitly allowed until version 420", "return", ""); + (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpReturn, converted, (yyvsp[-2].lex).loc); } else { - parseContext.error((yyvsp[(1) - (3)].lex).loc, "type does not match, or is not convertible to, the function's return type", "return", ""); - (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).loc); + parseContext.error((yyvsp[-2].lex).loc, "type does not match, or is not convertible to, the function's return type", "return", ""); + (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpReturn, (yyvsp[-1].interm.intermTypedNode), (yyvsp[-2].lex).loc); } } else - (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yyvsp[(1) - (3)].lex).loc); + (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpReturn, (yyvsp[-1].interm.intermTypedNode), (yyvsp[-2].lex).loc); } +#line 7378 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 415: -/* Line 1792 of yacc.c */ -#line 2650 "glslang.y" +#line 2650 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.requireStage((yyvsp[(1) - (2)].lex).loc, EShLangFragment, "discard"); - (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpKill, (yyvsp[(1) - (2)].lex).loc); + parseContext.requireStage((yyvsp[-1].lex).loc, EShLangFragment, "discard"); + (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpKill, (yyvsp[-1].lex).loc); } +#line 7387 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 416: -/* Line 1792 of yacc.c */ -#line 2659 "glslang.y" +#line 2659 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); + (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); parseContext.intermediate.setTreeRoot((yyval.interm.intermNode)); } +#line 7396 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 417: -/* Line 1792 of yacc.c */ -#line 2663 "glslang.y" +#line 2663 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode)); + (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[-1].interm.intermNode), (yyvsp[0].interm.intermNode)); parseContext.intermediate.setTreeRoot((yyval.interm.intermNode)); } +#line 7405 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 418: -/* Line 1792 of yacc.c */ -#line 2670 "glslang.y" +#line 2670 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); + (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } +#line 7413 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 419: -/* Line 1792 of yacc.c */ -#line 2673 "glslang.y" +#line 2673 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); + (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } +#line 7421 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 420: -/* Line 1792 of yacc.c */ -#line 2679 "glslang.y" +#line 2679 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyvsp[(1) - (1)].interm).function = parseContext.handleFunctionDeclarator((yyvsp[(1) - (1)].interm).loc, *(yyvsp[(1) - (1)].interm).function, false /* not prototype */); - (yyvsp[(1) - (1)].interm).intermNode = parseContext.handleFunctionDefinition((yyvsp[(1) - (1)].interm).loc, *(yyvsp[(1) - (1)].interm).function); + (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 7430 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 421: -/* Line 1792 of yacc.c */ -#line 2683 "glslang.y" +#line 2683 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // May be best done as post process phase on intermediate code if (parseContext.currentFunctionType->getBasicType() != EbtVoid && ! parseContext.functionReturnsValue) - parseContext.error((yyvsp[(1) - (3)].interm).loc, "function does not return a value:", "", (yyvsp[(1) - (3)].interm).function->getName().c_str()); + parseContext.error((yyvsp[-2].interm).loc, "function does not return a value:", "", (yyvsp[-2].interm).function->getName().c_str()); parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); - (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, (yyvsp[(3) - (3)].interm.intermNode)); - parseContext.intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yyvsp[(1) - (3)].interm).function->getType(), (yyvsp[(1) - (3)].interm).loc); - (yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[(1) - (3)].interm).function->getMangledName().c_str()); + (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[-2].interm).intermNode, (yyvsp[0].interm.intermNode)); + parseContext.intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yyvsp[-2].interm).function->getType(), (yyvsp[-2].interm).loc); + (yyval.interm.intermNode)->getAsAggregate()->setName((yyvsp[-2].interm).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 @@ -7736,11 +7446,11 @@ yyreduce: (yyval.interm.intermNode)->getAsAggregate()->setDebug(parseContext.contextPragma.debug); (yyval.interm.intermNode)->getAsAggregate()->addToPragmaTable(parseContext.contextPragma.pragmaTable); } +#line 7450 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; -/* Line 1792 of yacc.c */ -#line 7744 "glslang_tab.cpp" +#line 7454 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -7762,7 +7472,7 @@ yyreduce: *++yyvsp = yyval; - /* Now `shift' the result of the reduction. Determine what state + /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -7777,9 +7487,9 @@ yyreduce: goto yynewstate; -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ @@ -7830,20 +7540,20 @@ yyerrlab: if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an - error, discard it. */ + error, discard it. */ if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } else - { - yydestruct ("Error: discarding", - yytoken, &yylval, pParseContext); - yychar = YYEMPTY; - } + { + yydestruct ("Error: discarding", + yytoken, &yylval, pParseContext); + yychar = YYEMPTY; + } } /* Else will try to reuse lookahead token after shifting the error @@ -7862,7 +7572,7 @@ yyerrorlab: if (/*CONSTCOND*/ 0) goto yyerrorlab; - /* Do not reclaim the symbols of the rule which action triggered + /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; @@ -7875,29 +7585,29 @@ yyerrorlab: | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ + yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) - YYABORT; + YYABORT; yydestruct ("Error: popping", - yystos[yystate], yyvsp, pParseContext); + yystos[yystate], yyvsp, pParseContext); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); @@ -7948,14 +7658,14 @@ yyreturn: yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval, pParseContext); } - /* Do not reclaim the symbols of the rule which action triggered + /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp, pParseContext); + yystos[*yyssp], yyvsp, pParseContext); YYPOPSTACK (1); } #ifndef yyoverflow @@ -7966,11 +7676,7 @@ yyreturn: if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif - /* Make sure YYID is used. */ - return YYID (yyresult); + return yyresult; } - - -/* Line 2055 of yacc.c */ -#line 2700 "glslang.y" +#line 2700 "MachineIndependent/glslang.y" /* yacc.c:1906 */ diff --git a/glslang/MachineIndependent/glslang_tab.cpp.h b/glslang/MachineIndependent/glslang_tab.cpp.h index 03f5706b..e7d8fae8 100644 --- a/glslang/MachineIndependent/glslang_tab.cpp.h +++ b/glslang/MachineIndependent/glslang_tab.cpp.h @@ -1,19 +1,19 @@ -/* A Bison parser, made by GNU Bison 2.7. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison interface for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc. - + + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -26,13 +26,13 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ -#ifndef YY_YY_GLSLANG_TAB_CPP_H_INCLUDED -# define YY_YY_GLSLANG_TAB_CPP_H_INCLUDED -/* Enabling traces. */ +#ifndef YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED +# define YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED +/* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 1 #endif @@ -40,288 +40,287 @@ extern int yydebug; #endif -/* Tokens. */ +/* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - ATTRIBUTE = 258, - VARYING = 259, - CONST = 260, - BOOL = 261, - FLOAT = 262, - DOUBLE = 263, - INT = 264, - UINT = 265, - INT64_T = 266, - UINT64_T = 267, - BREAK = 268, - CONTINUE = 269, - DO = 270, - ELSE = 271, - FOR = 272, - IF = 273, - DISCARD = 274, - RETURN = 275, - SWITCH = 276, - CASE = 277, - DEFAULT = 278, - SUBROUTINE = 279, - BVEC2 = 280, - BVEC3 = 281, - BVEC4 = 282, - IVEC2 = 283, - IVEC3 = 284, - IVEC4 = 285, - I64VEC2 = 286, - I64VEC3 = 287, - I64VEC4 = 288, - UVEC2 = 289, - UVEC3 = 290, - UVEC4 = 291, - U64VEC2 = 292, - U64VEC3 = 293, - U64VEC4 = 294, - VEC2 = 295, - VEC3 = 296, - VEC4 = 297, - MAT2 = 298, - MAT3 = 299, - MAT4 = 300, - CENTROID = 301, - IN = 302, - OUT = 303, - INOUT = 304, - UNIFORM = 305, - PATCH = 306, - SAMPLE = 307, - BUFFER = 308, - SHARED = 309, - COHERENT = 310, - VOLATILE = 311, - RESTRICT = 312, - READONLY = 313, - WRITEONLY = 314, - DVEC2 = 315, - DVEC3 = 316, - DVEC4 = 317, - DMAT2 = 318, - DMAT3 = 319, - DMAT4 = 320, - NOPERSPECTIVE = 321, - FLAT = 322, - SMOOTH = 323, - LAYOUT = 324, - MAT2X2 = 325, - MAT2X3 = 326, - MAT2X4 = 327, - MAT3X2 = 328, - MAT3X3 = 329, - MAT3X4 = 330, - MAT4X2 = 331, - MAT4X3 = 332, - MAT4X4 = 333, - DMAT2X2 = 334, - DMAT2X3 = 335, - DMAT2X4 = 336, - DMAT3X2 = 337, - DMAT3X3 = 338, - DMAT3X4 = 339, - DMAT4X2 = 340, - DMAT4X3 = 341, - DMAT4X4 = 342, - ATOMIC_UINT = 343, - SAMPLER1D = 344, - SAMPLER2D = 345, - SAMPLER3D = 346, - SAMPLERCUBE = 347, - SAMPLER1DSHADOW = 348, - SAMPLER2DSHADOW = 349, - SAMPLERCUBESHADOW = 350, - SAMPLER1DARRAY = 351, - SAMPLER2DARRAY = 352, - SAMPLER1DARRAYSHADOW = 353, - SAMPLER2DARRAYSHADOW = 354, - ISAMPLER1D = 355, - ISAMPLER2D = 356, - ISAMPLER3D = 357, - ISAMPLERCUBE = 358, - ISAMPLER1DARRAY = 359, - ISAMPLER2DARRAY = 360, - USAMPLER1D = 361, - USAMPLER2D = 362, - USAMPLER3D = 363, - USAMPLERCUBE = 364, - USAMPLER1DARRAY = 365, - USAMPLER2DARRAY = 366, - SAMPLER2DRECT = 367, - SAMPLER2DRECTSHADOW = 368, - ISAMPLER2DRECT = 369, - USAMPLER2DRECT = 370, - SAMPLERBUFFER = 371, - ISAMPLERBUFFER = 372, - USAMPLERBUFFER = 373, - SAMPLERCUBEARRAY = 374, - SAMPLERCUBEARRAYSHADOW = 375, - ISAMPLERCUBEARRAY = 376, - USAMPLERCUBEARRAY = 377, - SAMPLER2DMS = 378, - ISAMPLER2DMS = 379, - USAMPLER2DMS = 380, - SAMPLER2DMSARRAY = 381, - ISAMPLER2DMSARRAY = 382, - USAMPLER2DMSARRAY = 383, - SAMPLEREXTERNALOES = 384, - SAMPLER = 385, - SAMPLERSHADOW = 386, - TEXTURE1D = 387, - TEXTURE2D = 388, - TEXTURE3D = 389, - TEXTURECUBE = 390, - TEXTURE1DARRAY = 391, - TEXTURE2DARRAY = 392, - ITEXTURE1D = 393, - ITEXTURE2D = 394, - ITEXTURE3D = 395, - ITEXTURECUBE = 396, - ITEXTURE1DARRAY = 397, - ITEXTURE2DARRAY = 398, - UTEXTURE1D = 399, - UTEXTURE2D = 400, - UTEXTURE3D = 401, - UTEXTURECUBE = 402, - UTEXTURE1DARRAY = 403, - UTEXTURE2DARRAY = 404, - TEXTURE2DRECT = 405, - ITEXTURE2DRECT = 406, - UTEXTURE2DRECT = 407, - TEXTUREBUFFER = 408, - ITEXTUREBUFFER = 409, - UTEXTUREBUFFER = 410, - TEXTURECUBEARRAY = 411, - ITEXTURECUBEARRAY = 412, - UTEXTURECUBEARRAY = 413, - TEXTURE2DMS = 414, - ITEXTURE2DMS = 415, - UTEXTURE2DMS = 416, - TEXTURE2DMSARRAY = 417, - ITEXTURE2DMSARRAY = 418, - UTEXTURE2DMSARRAY = 419, - SUBPASSINPUT = 420, - SUBPASSINPUTMS = 421, - ISUBPASSINPUT = 422, - ISUBPASSINPUTMS = 423, - USUBPASSINPUT = 424, - USUBPASSINPUTMS = 425, - IMAGE1D = 426, - IIMAGE1D = 427, - UIMAGE1D = 428, - IMAGE2D = 429, - IIMAGE2D = 430, - UIMAGE2D = 431, - IMAGE3D = 432, - IIMAGE3D = 433, - UIMAGE3D = 434, - IMAGE2DRECT = 435, - IIMAGE2DRECT = 436, - UIMAGE2DRECT = 437, - IMAGECUBE = 438, - IIMAGECUBE = 439, - UIMAGECUBE = 440, - IMAGEBUFFER = 441, - IIMAGEBUFFER = 442, - UIMAGEBUFFER = 443, - IMAGE1DARRAY = 444, - IIMAGE1DARRAY = 445, - UIMAGE1DARRAY = 446, - IMAGE2DARRAY = 447, - IIMAGE2DARRAY = 448, - UIMAGE2DARRAY = 449, - IMAGECUBEARRAY = 450, - IIMAGECUBEARRAY = 451, - UIMAGECUBEARRAY = 452, - IMAGE2DMS = 453, - IIMAGE2DMS = 454, - UIMAGE2DMS = 455, - IMAGE2DMSARRAY = 456, - IIMAGE2DMSARRAY = 457, - UIMAGE2DMSARRAY = 458, - STRUCT = 459, - VOID = 460, - WHILE = 461, - IDENTIFIER = 462, - TYPE_NAME = 463, - FLOATCONSTANT = 464, - DOUBLECONSTANT = 465, - INTCONSTANT = 466, - UINTCONSTANT = 467, - INT64CONSTANT = 468, - UINT64CONSTANT = 469, - BOOLCONSTANT = 470, - LEFT_OP = 471, - RIGHT_OP = 472, - INC_OP = 473, - DEC_OP = 474, - LE_OP = 475, - GE_OP = 476, - EQ_OP = 477, - NE_OP = 478, - AND_OP = 479, - OR_OP = 480, - XOR_OP = 481, - MUL_ASSIGN = 482, - DIV_ASSIGN = 483, - ADD_ASSIGN = 484, - MOD_ASSIGN = 485, - LEFT_ASSIGN = 486, - RIGHT_ASSIGN = 487, - AND_ASSIGN = 488, - XOR_ASSIGN = 489, - OR_ASSIGN = 490, - SUB_ASSIGN = 491, - LEFT_PAREN = 492, - RIGHT_PAREN = 493, - LEFT_BRACKET = 494, - RIGHT_BRACKET = 495, - LEFT_BRACE = 496, - RIGHT_BRACE = 497, - DOT = 498, - COMMA = 499, - COLON = 500, - EQUAL = 501, - SEMICOLON = 502, - BANG = 503, - DASH = 504, - TILDE = 505, - PLUS = 506, - STAR = 507, - SLASH = 508, - PERCENT = 509, - LEFT_ANGLE = 510, - RIGHT_ANGLE = 511, - VERTICAL_BAR = 512, - CARET = 513, - AMPERSAND = 514, - QUESTION = 515, - INVARIANT = 516, - PRECISE = 517, - HIGH_PRECISION = 518, - MEDIUM_PRECISION = 519, - LOW_PRECISION = 520, - PRECISION = 521, - PACKED = 522, - RESOURCE = 523, - SUPERP = 524 - }; + enum yytokentype + { + ATTRIBUTE = 258, + VARYING = 259, + CONST = 260, + BOOL = 261, + FLOAT = 262, + DOUBLE = 263, + INT = 264, + UINT = 265, + INT64_T = 266, + UINT64_T = 267, + BREAK = 268, + CONTINUE = 269, + DO = 270, + ELSE = 271, + FOR = 272, + IF = 273, + DISCARD = 274, + RETURN = 275, + SWITCH = 276, + CASE = 277, + DEFAULT = 278, + SUBROUTINE = 279, + BVEC2 = 280, + BVEC3 = 281, + BVEC4 = 282, + IVEC2 = 283, + IVEC3 = 284, + IVEC4 = 285, + I64VEC2 = 286, + I64VEC3 = 287, + I64VEC4 = 288, + UVEC2 = 289, + UVEC3 = 290, + UVEC4 = 291, + U64VEC2 = 292, + U64VEC3 = 293, + U64VEC4 = 294, + VEC2 = 295, + VEC3 = 296, + VEC4 = 297, + MAT2 = 298, + MAT3 = 299, + MAT4 = 300, + CENTROID = 301, + IN = 302, + OUT = 303, + INOUT = 304, + UNIFORM = 305, + PATCH = 306, + SAMPLE = 307, + BUFFER = 308, + SHARED = 309, + COHERENT = 310, + VOLATILE = 311, + RESTRICT = 312, + READONLY = 313, + WRITEONLY = 314, + DVEC2 = 315, + DVEC3 = 316, + DVEC4 = 317, + DMAT2 = 318, + DMAT3 = 319, + DMAT4 = 320, + NOPERSPECTIVE = 321, + FLAT = 322, + SMOOTH = 323, + LAYOUT = 324, + MAT2X2 = 325, + MAT2X3 = 326, + MAT2X4 = 327, + MAT3X2 = 328, + MAT3X3 = 329, + MAT3X4 = 330, + MAT4X2 = 331, + MAT4X3 = 332, + MAT4X4 = 333, + DMAT2X2 = 334, + DMAT2X3 = 335, + DMAT2X4 = 336, + DMAT3X2 = 337, + DMAT3X3 = 338, + DMAT3X4 = 339, + DMAT4X2 = 340, + DMAT4X3 = 341, + DMAT4X4 = 342, + ATOMIC_UINT = 343, + SAMPLER1D = 344, + SAMPLER2D = 345, + SAMPLER3D = 346, + SAMPLERCUBE = 347, + SAMPLER1DSHADOW = 348, + SAMPLER2DSHADOW = 349, + SAMPLERCUBESHADOW = 350, + SAMPLER1DARRAY = 351, + SAMPLER2DARRAY = 352, + SAMPLER1DARRAYSHADOW = 353, + SAMPLER2DARRAYSHADOW = 354, + ISAMPLER1D = 355, + ISAMPLER2D = 356, + ISAMPLER3D = 357, + ISAMPLERCUBE = 358, + ISAMPLER1DARRAY = 359, + ISAMPLER2DARRAY = 360, + USAMPLER1D = 361, + USAMPLER2D = 362, + USAMPLER3D = 363, + USAMPLERCUBE = 364, + USAMPLER1DARRAY = 365, + USAMPLER2DARRAY = 366, + SAMPLER2DRECT = 367, + SAMPLER2DRECTSHADOW = 368, + ISAMPLER2DRECT = 369, + USAMPLER2DRECT = 370, + SAMPLERBUFFER = 371, + ISAMPLERBUFFER = 372, + USAMPLERBUFFER = 373, + SAMPLERCUBEARRAY = 374, + SAMPLERCUBEARRAYSHADOW = 375, + ISAMPLERCUBEARRAY = 376, + USAMPLERCUBEARRAY = 377, + SAMPLER2DMS = 378, + ISAMPLER2DMS = 379, + USAMPLER2DMS = 380, + SAMPLER2DMSARRAY = 381, + ISAMPLER2DMSARRAY = 382, + USAMPLER2DMSARRAY = 383, + SAMPLEREXTERNALOES = 384, + SAMPLER = 385, + SAMPLERSHADOW = 386, + TEXTURE1D = 387, + TEXTURE2D = 388, + TEXTURE3D = 389, + TEXTURECUBE = 390, + TEXTURE1DARRAY = 391, + TEXTURE2DARRAY = 392, + ITEXTURE1D = 393, + ITEXTURE2D = 394, + ITEXTURE3D = 395, + ITEXTURECUBE = 396, + ITEXTURE1DARRAY = 397, + ITEXTURE2DARRAY = 398, + UTEXTURE1D = 399, + UTEXTURE2D = 400, + UTEXTURE3D = 401, + UTEXTURECUBE = 402, + UTEXTURE1DARRAY = 403, + UTEXTURE2DARRAY = 404, + TEXTURE2DRECT = 405, + ITEXTURE2DRECT = 406, + UTEXTURE2DRECT = 407, + TEXTUREBUFFER = 408, + ITEXTUREBUFFER = 409, + UTEXTUREBUFFER = 410, + TEXTURECUBEARRAY = 411, + ITEXTURECUBEARRAY = 412, + UTEXTURECUBEARRAY = 413, + TEXTURE2DMS = 414, + ITEXTURE2DMS = 415, + UTEXTURE2DMS = 416, + TEXTURE2DMSARRAY = 417, + ITEXTURE2DMSARRAY = 418, + UTEXTURE2DMSARRAY = 419, + SUBPASSINPUT = 420, + SUBPASSINPUTMS = 421, + ISUBPASSINPUT = 422, + ISUBPASSINPUTMS = 423, + USUBPASSINPUT = 424, + USUBPASSINPUTMS = 425, + IMAGE1D = 426, + IIMAGE1D = 427, + UIMAGE1D = 428, + IMAGE2D = 429, + IIMAGE2D = 430, + UIMAGE2D = 431, + IMAGE3D = 432, + IIMAGE3D = 433, + UIMAGE3D = 434, + IMAGE2DRECT = 435, + IIMAGE2DRECT = 436, + UIMAGE2DRECT = 437, + IMAGECUBE = 438, + IIMAGECUBE = 439, + UIMAGECUBE = 440, + IMAGEBUFFER = 441, + IIMAGEBUFFER = 442, + UIMAGEBUFFER = 443, + IMAGE1DARRAY = 444, + IIMAGE1DARRAY = 445, + UIMAGE1DARRAY = 446, + IMAGE2DARRAY = 447, + IIMAGE2DARRAY = 448, + UIMAGE2DARRAY = 449, + IMAGECUBEARRAY = 450, + IIMAGECUBEARRAY = 451, + UIMAGECUBEARRAY = 452, + IMAGE2DMS = 453, + IIMAGE2DMS = 454, + UIMAGE2DMS = 455, + IMAGE2DMSARRAY = 456, + IIMAGE2DMSARRAY = 457, + UIMAGE2DMSARRAY = 458, + STRUCT = 459, + VOID = 460, + WHILE = 461, + IDENTIFIER = 462, + TYPE_NAME = 463, + FLOATCONSTANT = 464, + DOUBLECONSTANT = 465, + INTCONSTANT = 466, + UINTCONSTANT = 467, + INT64CONSTANT = 468, + UINT64CONSTANT = 469, + BOOLCONSTANT = 470, + LEFT_OP = 471, + RIGHT_OP = 472, + INC_OP = 473, + DEC_OP = 474, + LE_OP = 475, + GE_OP = 476, + EQ_OP = 477, + NE_OP = 478, + AND_OP = 479, + OR_OP = 480, + XOR_OP = 481, + MUL_ASSIGN = 482, + DIV_ASSIGN = 483, + ADD_ASSIGN = 484, + MOD_ASSIGN = 485, + LEFT_ASSIGN = 486, + RIGHT_ASSIGN = 487, + AND_ASSIGN = 488, + XOR_ASSIGN = 489, + OR_ASSIGN = 490, + SUB_ASSIGN = 491, + LEFT_PAREN = 492, + RIGHT_PAREN = 493, + LEFT_BRACKET = 494, + RIGHT_BRACKET = 495, + LEFT_BRACE = 496, + RIGHT_BRACE = 497, + DOT = 498, + COMMA = 499, + COLON = 500, + EQUAL = 501, + SEMICOLON = 502, + BANG = 503, + DASH = 504, + TILDE = 505, + PLUS = 506, + STAR = 507, + SLASH = 508, + PERCENT = 509, + LEFT_ANGLE = 510, + RIGHT_ANGLE = 511, + VERTICAL_BAR = 512, + CARET = 513, + AMPERSAND = 514, + QUESTION = 515, + INVARIANT = 516, + PRECISE = 517, + HIGH_PRECISION = 518, + MEDIUM_PRECISION = 519, + LOW_PRECISION = 520, + PRECISION = 521, + PACKED = 522, + RESOURCE = 523, + SUPERP = 524 + }; #endif - +/* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE + +union YYSTYPE { -/* Line 2058 of yacc.c */ -#line 66 "glslang.y" +#line 66 "MachineIndependent/glslang.y" /* yacc.c:1909 */ struct { glslang::TSourceLoc loc; @@ -355,28 +354,16 @@ typedef union YYSTYPE }; } interm; +#line 358 "MachineIndependent/glslang_tab.cpp.h" /* yacc.c:1909 */ +}; -/* Line 2058 of yacc.c */ -#line 361 "glslang_tab.cpp.h" -} YYSTYPE; +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); -#else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse (glslang::TParseContext* pParseContext); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ -#endif /* !YY_YY_GLSLANG_TAB_CPP_H_INCLUDED */ +int yyparse (glslang::TParseContext* pParseContext); + +#endif /* !YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED */ diff --git a/glslang/updateGrammar b/glslang/updateGrammar new file mode 100755 index 00000000..f8fa81da --- /dev/null +++ b/glslang/updateGrammar @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +bison --defines=MachineIndependent/glslang_tab.cpp.h -t MachineIndependent/glslang.y -o MachineIndependent/glslang_tab.cpp From 17f07864189a2893911b6ae762594a59d5c6deca Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Wed, 4 May 2016 12:36:14 -0600 Subject: [PATCH 050/140] Parser: Precise: Recognize 'precise', tag types, and do related semantic checking. This partly overlaps pull request #222, we have divided the work on this one. --- Test/400.tesc | 3 + Test/baseResults/150.tesc.out | 51 +- Test/baseResults/300.vert.out | 2 +- Test/baseResults/310.comp.out | 7 +- Test/baseResults/310.frag.out | 19 +- Test/baseResults/310.tesc.out | 63 +- Test/baseResults/310.vert.out | 19 +- Test/baseResults/400.tesc.out | 51 +- Test/baseResults/specExamples.vert.out | 37 +- glslang/Include/Types.h | 6 +- glslang/MachineIndependent/ParseHelper.cpp | 19 +- glslang/MachineIndependent/glslang.y | 3 + glslang/MachineIndependent/glslang_tab.cpp | 1243 ++++++++++--------- glslang/MachineIndependent/linkValidate.cpp | 6 + hlsl/hlslParseHelper.cpp | 10 + 15 files changed, 797 insertions(+), 742 deletions(-) diff --git a/Test/400.tesc b/Test/400.tesc index 950f5de1..d01bd3ea 100644 --- a/Test/400.tesc +++ b/Test/400.tesc @@ -100,3 +100,6 @@ void foop() patch out pinbn { int a; } pinbi; + +invariant precise out vec4 badOrder[]; // ERROR, precise must appear first +void badp(out precise float f); // ERROR, precise must appear first diff --git a/Test/baseResults/150.tesc.out b/Test/baseResults/150.tesc.out index 8b7ab7dc..667fcfbf 100644 --- a/Test/baseResults/150.tesc.out +++ b/Test/baseResults/150.tesc.out @@ -229,7 +229,10 @@ ERROR: 0:74: 'in' : type must be an array: ina ERROR: 0:76: '[]' : tessellation input array size must be gl_MaxPatchVertices or implicitly sized ERROR: 0:83: 'location' : overlapping use of location 4 ERROR: 0:87: 'location' : overlapping use of location 4 -ERROR: 18 compilation errors. No code generated. +ERROR: 0:104: '' : precise qualifier must appear first +ERROR: 0:105: '' : precise qualifier must appear first +ERROR: 0:105: '' : precise qualifier must appear first +ERROR: 21 compilation errors. No code generated. Shader version: 400 @@ -391,20 +394,20 @@ ERROR: node is still EOpNull! 0:91 Function Parameters: 0:? Sequence 0:95 multiply second child into first child (temp 3-component vector of float) -0:95 'pv3' (temp 3-component vector of float) -0:95 'pv3' (temp 3-component vector of float) +0:95 'pv3' (noContraction temp 3-component vector of float) +0:95 'pv3' (noContraction temp 3-component vector of float) 0:96 move second child to first child (temp 3-component vector of float) -0:96 'pv3' (temp 3-component vector of float) +0:96 'pv3' (noContraction temp 3-component vector of float) 0:96 fma (global 3-component vector of float) -0:96 'pv3' (temp 3-component vector of float) -0:96 'pv3' (temp 3-component vector of float) -0:96 'pv3' (temp 3-component vector of float) +0:96 'pv3' (noContraction temp 3-component vector of float) +0:96 'pv3' (noContraction temp 3-component vector of float) +0:96 'pv3' (noContraction temp 3-component vector of float) 0:97 move second child to first child (temp double) -0:97 'd' (temp double) +0:97 'd' (noContraction temp double) 0:97 fma (global double) -0:97 'd' (temp double) -0:97 'd' (temp double) -0:97 'd' (temp double) +0:97 'd' (noContraction temp double) +0:97 'd' (noContraction temp double) +0:97 'd' (noContraction temp double) 0:? Linker Objects 0:? 'gl_out' (out 4-element array of block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) 0:? 'outa' (global 4-element array of int) @@ -420,8 +423,9 @@ ERROR: node is still EOpNull! 0:? 'ovla' (layout(location=3 ) out 4-element array of 4-component vector of float) 0:? 'ovlb' (layout(location=4 ) out 4-element array of 4-component vector of float) 0:? 'ovlc' (layout(location=4 ) out 4-element array of 4-component vector of float) -0:? 'pv3' (temp 3-component vector of float) +0:? 'pv3' (noContraction temp 3-component vector of float) 0:? 'pinbi' (patch out block{out int a}) +0:? 'badOrder' (invariant noContraction out 4-element array of 4-component vector of float) 400.tese Warning, version 400 is not yet complete; most version-specific features are present, but some are missing. @@ -1169,20 +1173,20 @@ vertices = 4 0:91 Function Parameters: 0:? Sequence 0:95 multiply second child into first child (temp 3-component vector of float) -0:95 'pv3' (temp 3-component vector of float) -0:95 'pv3' (temp 3-component vector of float) +0:95 'pv3' (noContraction temp 3-component vector of float) +0:95 'pv3' (noContraction temp 3-component vector of float) 0:96 move second child to first child (temp 3-component vector of float) -0:96 'pv3' (temp 3-component vector of float) +0:96 'pv3' (noContraction temp 3-component vector of float) 0:96 fma (global 3-component vector of float) -0:96 'pv3' (temp 3-component vector of float) -0:96 'pv3' (temp 3-component vector of float) -0:96 'pv3' (temp 3-component vector of float) +0:96 'pv3' (noContraction temp 3-component vector of float) +0:96 'pv3' (noContraction temp 3-component vector of float) +0:96 'pv3' (noContraction temp 3-component vector of float) 0:97 move second child to first child (temp double) -0:97 'd' (temp double) +0:97 'd' (noContraction temp double) 0:97 fma (global double) -0:97 'd' (temp double) -0:97 'd' (temp double) -0:97 'd' (temp double) +0:97 'd' (noContraction temp double) +0:97 'd' (noContraction temp double) +0:97 'd' (noContraction temp double) 0:8 Function Definition: main( (global void) 0:8 Function Parameters: 0:15 Function Definition: main( (global void) @@ -1294,8 +1298,9 @@ vertices = 4 0:? 'ovla' (layout(location=3 ) out 4-element array of 4-component vector of float) 0:? 'ovlb' (layout(location=4 ) out 4-element array of 4-component vector of float) 0:? 'ovlc' (layout(location=4 ) out 4-element array of 4-component vector of float) -0:? 'pv3' (temp 3-component vector of float) +0:? 'pv3' (noContraction temp 3-component vector of float) 0:? 'pinbi' (patch out block{out int a}) +0:? 'badOrder' (invariant noContraction out 4-element array of 4-component vector of float) 0:? 'a' (out 3-element array of int) 0:? 'outb' (out 5-element array of int) 0:? 'outc' (out 4-element array of int) diff --git a/Test/baseResults/300.vert.out b/Test/baseResults/300.vert.out index 8694a746..80745abe 100644 --- a/Test/baseResults/300.vert.out +++ b/Test/baseResults/300.vert.out @@ -3,7 +3,7 @@ ERROR: 0:8: 'varying' : Reserved word. ERROR: 0:8: 'varying' : no longer supported in es profile; removed in version 300 ERROR: 0:9: 'vertex input arrays' : not supported with this profile: es ERROR: 0:10: '' : precision qualifier must appear as last qualifier -ERROR: 0:11: '' : invariant qualifier must appear first +ERROR: 0:11: '' : invariant qualifier must appear before interpolation, storage, and precision qualifiers ERROR: 0:12: '' : Auxiliary qualifiers (centroid, patch, and sample) must appear before storage and precision qualifiers ERROR: 0:12: '' : vertex input cannot be further qualified ERROR: 0:13: '' : interpolation qualifiers must appear before storage and precision qualifiers diff --git a/Test/baseResults/310.comp.out b/Test/baseResults/310.comp.out index d6b03322..67129d1d 100644 --- a/Test/baseResults/310.comp.out +++ b/Test/baseResults/310.comp.out @@ -45,6 +45,7 @@ ERROR: 0:143: 'binding' : atomic_uint binding is too large; see gl_MaxAtomicCoun ERROR: 0:149: '[]' : scalar integer expression required ERROR: 0:166: 'precision' : can only apply highp to atomic_uint ERROR: 0:168: 'precise' : Reserved word. +ERROR: 0:168: 'precise' : not supported for this version or the enabled extensions ERROR: 0:170: 'dmat2x4' : Reserved word. ERROR: 0:170: 'double matrix' : not supported with this profile: es ERROR: 0:171: 'samplerCubeArray' : Reserved word. @@ -78,7 +79,7 @@ ERROR: 0:227: 'input block' : not supported in this stage: compute ERROR: 0:231: 'output block' : not supported in this stage: compute WARNING: 0:235: 't__' : identifiers containing consecutive underscores ("__") are reserved WARNING: 0:238: '#define' : names containing consecutive underscores are reserved: __D -ERROR: 76 compilation errors. No code generated. +ERROR: 77 compilation errors. No code generated. Shader version: 310 @@ -484,7 +485,7 @@ ERROR: node is still EOpNull! 0:? 'i' (uniform highp int) 0:? 'atomi' (shared highp int) 0:? 'atomu' (shared highp uint) -0:? 'pfoo' (temp highp int) +0:? 'pfoo' (noContraction temp highp int) 0:? 'dm' (global 2X4 matrix of double) 0:? 'sca' (uniform mediump samplerCubeArray) 0:? 'i2dr' (uniform mediump iimage2DRect) @@ -911,7 +912,7 @@ ERROR: node is still EOpNull! 0:? 'i' (uniform highp int) 0:? 'atomi' (shared highp int) 0:? 'atomu' (shared highp uint) -0:? 'pfoo' (temp highp int) +0:? 'pfoo' (noContraction temp highp int) 0:? 'dm' (global 2X4 matrix of double) 0:? 'sca' (uniform mediump samplerCubeArray) 0:? 'i2dr' (uniform mediump iimage2DRect) diff --git a/Test/baseResults/310.frag.out b/Test/baseResults/310.frag.out index 7f3f5089..0d2ad8d0 100644 --- a/Test/baseResults/310.frag.out +++ b/Test/baseResults/310.frag.out @@ -61,6 +61,7 @@ ERROR: 0:183: 'gl_PrimitiveID' : required extension not requested: Possible exte GL_EXT_geometry_shader GL_OES_geometry_shader ERROR: 0:209: 'precise' : Reserved word. +ERROR: 0:209: 'precise' : not supported for this version or the enabled extensions ERROR: 0:210: 'fma' : required extension not requested: Possible extensions include: GL_EXT_gpu_shader5 GL_OES_gpu_shader5 @@ -129,7 +130,7 @@ ERROR: 0:427: 'blend equation' : can only apply to a standalone qualifier ERROR: 0:428: 'blend equation' : can only apply to a standalone qualifier ERROR: 0:429: 'blend_support' : unknown blend equation ERROR: 0:431: 'fragment-shader array-of-array output' : not supported with this profile: es -ERROR: 121 compilation errors. No code generated. +ERROR: 122 compilation errors. No code generated. Shader version: 310 @@ -431,11 +432,11 @@ ERROR: node is still EOpNull! 0:207 Function Parameters: 0:? Sequence 0:210 move second child to first child (temp mediump 2-component vector of float) -0:210 'h' (temp mediump 2-component vector of float) +0:210 'h' (noContraction temp mediump 2-component vector of float) 0:210 fma (global mediump 2-component vector of float) 0:210 'inf' (smooth in mediump 2-component vector of float) 0:210 'ing' (smooth in mediump 2-component vector of float) -0:210 'h' (temp mediump 2-component vector of float) +0:210 'h' (noContraction temp mediump 2-component vector of float) 0:211 textureGatherOffset (global highp 4-component vector of float) 0:211 direct index (temp highp sampler2D) 0:211 'sArray' (uniform 4-element array of highp sampler2D) @@ -467,11 +468,11 @@ ERROR: node is still EOpNull! 0:217 Function Parameters: 0:? Sequence 0:220 move second child to first child (temp mediump 2-component vector of float) -0:220 'h' (temp mediump 2-component vector of float) +0:220 'h' (noContraction temp mediump 2-component vector of float) 0:220 fma (global mediump 2-component vector of float) 0:220 'inf' (smooth in mediump 2-component vector of float) 0:220 'ing' (smooth in mediump 2-component vector of float) -0:220 'h' (temp mediump 2-component vector of float) +0:220 'h' (noContraction temp mediump 2-component vector of float) 0:221 textureGatherOffset (global highp 4-component vector of float) 0:221 direct index (temp highp sampler2D) 0:221 'sArray' (uniform 4-element array of highp sampler2D) @@ -1312,11 +1313,11 @@ ERROR: node is still EOpNull! 0:207 Function Parameters: 0:? Sequence 0:210 move second child to first child (temp mediump 2-component vector of float) -0:210 'h' (temp mediump 2-component vector of float) +0:210 'h' (noContraction temp mediump 2-component vector of float) 0:210 fma (global mediump 2-component vector of float) 0:210 'inf' (smooth in mediump 2-component vector of float) 0:210 'ing' (smooth in mediump 2-component vector of float) -0:210 'h' (temp mediump 2-component vector of float) +0:210 'h' (noContraction temp mediump 2-component vector of float) 0:211 textureGatherOffset (global highp 4-component vector of float) 0:211 direct index (temp highp sampler2D) 0:211 'sArray' (uniform 4-element array of highp sampler2D) @@ -1348,11 +1349,11 @@ ERROR: node is still EOpNull! 0:217 Function Parameters: 0:? Sequence 0:220 move second child to first child (temp mediump 2-component vector of float) -0:220 'h' (temp mediump 2-component vector of float) +0:220 'h' (noContraction temp mediump 2-component vector of float) 0:220 fma (global mediump 2-component vector of float) 0:220 'inf' (smooth in mediump 2-component vector of float) 0:220 'ing' (smooth in mediump 2-component vector of float) -0:220 'h' (temp mediump 2-component vector of float) +0:220 'h' (noContraction temp mediump 2-component vector of float) 0:221 textureGatherOffset (global highp 4-component vector of float) 0:221 direct index (temp highp sampler2D) 0:221 'sArray' (uniform 4-element array of highp sampler2D) diff --git a/Test/baseResults/310.tesc.out b/Test/baseResults/310.tesc.out index c572c096..24e3d209 100644 --- a/Test/baseResults/310.tesc.out +++ b/Test/baseResults/310.tesc.out @@ -31,6 +31,7 @@ ERROR: 0:80: '' : array size required ERROR: 0:86: 'location' : overlapping use of location 4 ERROR: 0:90: 'location' : overlapping use of location 4 ERROR: 0:94: 'precise' : Reserved word. +ERROR: 0:94: 'precise' : not supported for this version or the enabled extensions ERROR: 0:95: 'fma' : required extension not requested: Possible extensions include: GL_EXT_gpu_shader5 GL_OES_gpu_shader5 @@ -45,7 +46,7 @@ ERROR: 0:145: '' : array size required ERROR: 0:161: '[]' : tessellation-control per-vertex output l-value must be indexed with gl_InvocationID ERROR: 0:162: '[]' : tessellation-control per-vertex output l-value must be indexed with gl_InvocationID ERROR: 0:165: '[]' : tessellation-control per-vertex output l-value must be indexed with gl_InvocationID -ERROR: 37 compilation errors. No code generated. +ERROR: 38 compilation errors. No code generated. Shader version: 310 @@ -197,11 +198,11 @@ ERROR: node is still EOpNull! 0:92 Function Parameters: 0:? Sequence 0:95 move second child to first child (temp highp float) -0:95 'd' (temp highp float) +0:95 'd' (noContraction temp highp float) 0:95 fma (global highp float) -0:95 'd' (temp highp float) -0:95 'd' (temp highp float) -0:95 'd' (temp highp float) +0:95 'd' (noContraction temp highp float) +0:95 'd' (noContraction temp highp float) +0:95 'd' (noContraction temp highp float) 0:112 Function Definition: pointSize2( (global void) 0:112 Function Parameters: 0:114 Sequence @@ -227,20 +228,20 @@ ERROR: node is still EOpNull! 0:122 Function Parameters: 0:? Sequence 0:126 multiply second child into first child (temp highp 3-component vector of float) -0:126 'pv3' (temp highp 3-component vector of float) -0:126 'pv3' (temp highp 3-component vector of float) +0:126 'pv3' (noContraction temp highp 3-component vector of float) +0:126 'pv3' (noContraction temp highp 3-component vector of float) 0:127 move second child to first child (temp highp 3-component vector of float) -0:127 'pv3' (temp highp 3-component vector of float) +0:127 'pv3' (noContraction temp highp 3-component vector of float) 0:127 fma (global highp 3-component vector of float) -0:127 'pv3' (temp highp 3-component vector of float) -0:127 'pv3' (temp highp 3-component vector of float) -0:127 'pv3' (temp highp 3-component vector of float) +0:127 'pv3' (noContraction temp highp 3-component vector of float) +0:127 'pv3' (noContraction temp highp 3-component vector of float) +0:127 'pv3' (noContraction temp highp 3-component vector of float) 0:128 move second child to first child (temp highp float) -0:128 'd' (temp highp float) +0:128 'd' (noContraction temp highp float) 0:128 fma (global highp float) -0:128 'd' (temp highp float) -0:128 'd' (temp highp float) -0:128 'd' (temp highp float) +0:128 'd' (noContraction temp highp float) +0:128 'd' (noContraction temp highp float) +0:128 'd' (noContraction temp highp float) 0:131 Function Definition: bbBad( (global void) 0:131 Function Parameters: 0:133 Sequence @@ -371,7 +372,7 @@ ERROR: node is still EOpNull! 0:? 'badlay' (out 4-element array of highp float) 0:? 'misSized' (out 5-element array of highp float) 0:? 'okaySize' (out 4-element array of highp float) -0:? 'pv3' (temp highp 3-component vector of float) +0:? 'pv3' (noContraction temp highp 3-component vector of float) 0:? 'badpatchIName' (patch out implicitly-sized array of block{out highp float f}) 0:? 'patchIName' (patch out 4-element array of block{out highp float f}) @@ -528,11 +529,11 @@ ERROR: node is still EOpNull! 0:92 Function Parameters: 0:? Sequence 0:95 move second child to first child (temp highp float) -0:95 'd' (temp highp float) +0:95 'd' (noContraction temp highp float) 0:95 fma (global highp float) -0:95 'd' (temp highp float) -0:95 'd' (temp highp float) -0:95 'd' (temp highp float) +0:95 'd' (noContraction temp highp float) +0:95 'd' (noContraction temp highp float) +0:95 'd' (noContraction temp highp float) 0:112 Function Definition: pointSize2( (global void) 0:112 Function Parameters: 0:114 Sequence @@ -558,20 +559,20 @@ ERROR: node is still EOpNull! 0:122 Function Parameters: 0:? Sequence 0:126 multiply second child into first child (temp highp 3-component vector of float) -0:126 'pv3' (temp highp 3-component vector of float) -0:126 'pv3' (temp highp 3-component vector of float) +0:126 'pv3' (noContraction temp highp 3-component vector of float) +0:126 'pv3' (noContraction temp highp 3-component vector of float) 0:127 move second child to first child (temp highp 3-component vector of float) -0:127 'pv3' (temp highp 3-component vector of float) +0:127 'pv3' (noContraction temp highp 3-component vector of float) 0:127 fma (global highp 3-component vector of float) -0:127 'pv3' (temp highp 3-component vector of float) -0:127 'pv3' (temp highp 3-component vector of float) -0:127 'pv3' (temp highp 3-component vector of float) +0:127 'pv3' (noContraction temp highp 3-component vector of float) +0:127 'pv3' (noContraction temp highp 3-component vector of float) +0:127 'pv3' (noContraction temp highp 3-component vector of float) 0:128 move second child to first child (temp highp float) -0:128 'd' (temp highp float) +0:128 'd' (noContraction temp highp float) 0:128 fma (global highp float) -0:128 'd' (temp highp float) -0:128 'd' (temp highp float) -0:128 'd' (temp highp float) +0:128 'd' (noContraction temp highp float) +0:128 'd' (noContraction temp highp float) +0:128 'd' (noContraction temp highp float) 0:131 Function Definition: bbBad( (global void) 0:131 Function Parameters: 0:133 Sequence @@ -702,7 +703,7 @@ ERROR: node is still EOpNull! 0:? 'badlay' (out 4-element array of highp float) 0:? 'misSized' (out 5-element array of highp float) 0:? 'okaySize' (out 4-element array of highp float) -0:? 'pv3' (temp highp 3-component vector of float) +0:? 'pv3' (noContraction temp highp 3-component vector of float) 0:? 'badpatchIName' (patch out 1-element array of block{out highp float f}) 0:? 'patchIName' (patch out 4-element array of block{out highp float f}) diff --git a/Test/baseResults/310.vert.out b/Test/baseResults/310.vert.out index f42b44c1..c32f5d8e 100644 --- a/Test/baseResults/310.vert.out +++ b/Test/baseResults/310.vert.out @@ -29,6 +29,7 @@ ERROR: 0:131: 'flat/smooth/noperspective' : cannot use interpolation qualifiers ERROR: 0:135: 'centroid' : cannot use centroid qualifier on an interface block ERROR: 0:139: 'invariant' : cannot use invariant qualifier on an interface block ERROR: 0:155: 'precise' : Reserved word. +ERROR: 0:155: 'precise' : not supported for this version or the enabled extensions ERROR: 0:156: 'fma' : required extension not requested: Possible extensions include: GL_EXT_gpu_shader5 GL_OES_gpu_shader5 @@ -96,7 +97,7 @@ ERROR: 0:389: 'sample' : Reserved word. ERROR: 0:400: 'interpolateAtCentroid' : no matching overloaded function found ERROR: 0:401: 'interpolateAtSample' : no matching overloaded function found ERROR: 0:402: 'interpolateAtOffset' : no matching overloaded function found -ERROR: 92 compilation errors. No code generated. +ERROR: 93 compilation errors. No code generated. Shader version: 310 @@ -285,11 +286,11 @@ ERROR: node is still EOpNull! 0:153 Function Parameters: 0:? Sequence 0:156 move second child to first child (temp highp 2-component vector of float) -0:156 'h' (temp highp 2-component vector of float) +0:156 'h' (noContraction temp highp 2-component vector of float) 0:156 fma (global highp 2-component vector of float) 0:156 'inf' (in highp 2-component vector of float) 0:156 'ing' (in highp 2-component vector of float) -0:156 'h' (temp highp 2-component vector of float) +0:156 'h' (noContraction temp highp 2-component vector of float) 0:157 indirect index (temp highp sampler2D) 0:157 'sArray' (uniform 4-element array of highp sampler2D) 0:157 add (temp highp int) @@ -360,11 +361,11 @@ ERROR: node is still EOpNull! 0:171 Function Parameters: 0:? Sequence 0:174 move second child to first child (temp highp 2-component vector of float) -0:174 'h' (temp highp 2-component vector of float) +0:174 'h' (noContraction temp highp 2-component vector of float) 0:174 fma (global highp 2-component vector of float) 0:174 'inf' (in highp 2-component vector of float) 0:174 'ing' (in highp 2-component vector of float) -0:174 'h' (temp highp 2-component vector of float) +0:174 'h' (noContraction temp highp 2-component vector of float) 0:175 indirect index (temp highp sampler2D) 0:175 'sArray' (uniform 4-element array of highp sampler2D) 0:175 add (temp highp int) @@ -1216,11 +1217,11 @@ ERROR: node is still EOpNull! 0:153 Function Parameters: 0:? Sequence 0:156 move second child to first child (temp highp 2-component vector of float) -0:156 'h' (temp highp 2-component vector of float) +0:156 'h' (noContraction temp highp 2-component vector of float) 0:156 fma (global highp 2-component vector of float) 0:156 'inf' (in highp 2-component vector of float) 0:156 'ing' (in highp 2-component vector of float) -0:156 'h' (temp highp 2-component vector of float) +0:156 'h' (noContraction temp highp 2-component vector of float) 0:157 indirect index (temp highp sampler2D) 0:157 'sArray' (uniform 4-element array of highp sampler2D) 0:157 add (temp highp int) @@ -1291,11 +1292,11 @@ ERROR: node is still EOpNull! 0:171 Function Parameters: 0:? Sequence 0:174 move second child to first child (temp highp 2-component vector of float) -0:174 'h' (temp highp 2-component vector of float) +0:174 'h' (noContraction temp highp 2-component vector of float) 0:174 fma (global highp 2-component vector of float) 0:174 'inf' (in highp 2-component vector of float) 0:174 'ing' (in highp 2-component vector of float) -0:174 'h' (temp highp 2-component vector of float) +0:174 'h' (noContraction temp highp 2-component vector of float) 0:175 indirect index (temp highp sampler2D) 0:175 'sArray' (uniform 4-element array of highp sampler2D) 0:175 add (temp highp int) diff --git a/Test/baseResults/400.tesc.out b/Test/baseResults/400.tesc.out index 99867ca5..58a8a327 100644 --- a/Test/baseResults/400.tesc.out +++ b/Test/baseResults/400.tesc.out @@ -18,7 +18,10 @@ ERROR: 0:74: 'in' : type must be an array: ina ERROR: 0:76: '[]' : tessellation input array size must be gl_MaxPatchVertices or implicitly sized ERROR: 0:83: 'location' : overlapping use of location 4 ERROR: 0:87: 'location' : overlapping use of location 4 -ERROR: 18 compilation errors. No code generated. +ERROR: 0:104: '' : precise qualifier must appear first +ERROR: 0:105: '' : precise qualifier must appear first +ERROR: 0:105: '' : precise qualifier must appear first +ERROR: 21 compilation errors. No code generated. Shader version: 400 @@ -180,20 +183,20 @@ ERROR: node is still EOpNull! 0:91 Function Parameters: 0:? Sequence 0:95 multiply second child into first child (temp 3-component vector of float) -0:95 'pv3' (temp 3-component vector of float) -0:95 'pv3' (temp 3-component vector of float) +0:95 'pv3' (noContraction temp 3-component vector of float) +0:95 'pv3' (noContraction temp 3-component vector of float) 0:96 move second child to first child (temp 3-component vector of float) -0:96 'pv3' (temp 3-component vector of float) +0:96 'pv3' (noContraction temp 3-component vector of float) 0:96 fma (global 3-component vector of float) -0:96 'pv3' (temp 3-component vector of float) -0:96 'pv3' (temp 3-component vector of float) -0:96 'pv3' (temp 3-component vector of float) +0:96 'pv3' (noContraction temp 3-component vector of float) +0:96 'pv3' (noContraction temp 3-component vector of float) +0:96 'pv3' (noContraction temp 3-component vector of float) 0:97 move second child to first child (temp double) -0:97 'd' (temp double) +0:97 'd' (noContraction temp double) 0:97 fma (global double) -0:97 'd' (temp double) -0:97 'd' (temp double) -0:97 'd' (temp double) +0:97 'd' (noContraction temp double) +0:97 'd' (noContraction temp double) +0:97 'd' (noContraction temp double) 0:? Linker Objects 0:? 'gl_out' (out 4-element array of block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) 0:? 'outa' (global 4-element array of int) @@ -209,8 +212,9 @@ ERROR: node is still EOpNull! 0:? 'ovla' (layout(location=3 ) out 4-element array of 4-component vector of float) 0:? 'ovlb' (layout(location=4 ) out 4-element array of 4-component vector of float) 0:? 'ovlc' (layout(location=4 ) out 4-element array of 4-component vector of float) -0:? 'pv3' (temp 3-component vector of float) +0:? 'pv3' (noContraction temp 3-component vector of float) 0:? 'pinbi' (patch out block{out int a}) +0:? 'badOrder' (invariant noContraction out 4-element array of 4-component vector of float) Linked tessellation control stage: @@ -375,20 +379,20 @@ ERROR: node is still EOpNull! 0:91 Function Parameters: 0:? Sequence 0:95 multiply second child into first child (temp 3-component vector of float) -0:95 'pv3' (temp 3-component vector of float) -0:95 'pv3' (temp 3-component vector of float) +0:95 'pv3' (noContraction temp 3-component vector of float) +0:95 'pv3' (noContraction temp 3-component vector of float) 0:96 move second child to first child (temp 3-component vector of float) -0:96 'pv3' (temp 3-component vector of float) +0:96 'pv3' (noContraction temp 3-component vector of float) 0:96 fma (global 3-component vector of float) -0:96 'pv3' (temp 3-component vector of float) -0:96 'pv3' (temp 3-component vector of float) -0:96 'pv3' (temp 3-component vector of float) +0:96 'pv3' (noContraction temp 3-component vector of float) +0:96 'pv3' (noContraction temp 3-component vector of float) +0:96 'pv3' (noContraction temp 3-component vector of float) 0:97 move second child to first child (temp double) -0:97 'd' (temp double) +0:97 'd' (noContraction temp double) 0:97 fma (global double) -0:97 'd' (temp double) -0:97 'd' (temp double) -0:97 'd' (temp double) +0:97 'd' (noContraction temp double) +0:97 'd' (noContraction temp double) +0:97 'd' (noContraction temp double) 0:? Linker Objects 0:? 'gl_out' (out 4-element array of block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out 2-element array of float ClipDistance gl_ClipDistance}) 0:? 'outa' (global 4-element array of int) @@ -404,6 +408,7 @@ ERROR: node is still EOpNull! 0:? 'ovla' (layout(location=3 ) out 4-element array of 4-component vector of float) 0:? 'ovlb' (layout(location=4 ) out 4-element array of 4-component vector of float) 0:? 'ovlc' (layout(location=4 ) out 4-element array of 4-component vector of float) -0:? 'pv3' (temp 3-component vector of float) +0:? 'pv3' (noContraction temp 3-component vector of float) 0:? 'pinbi' (patch out block{out int a}) +0:? 'badOrder' (invariant noContraction out 4-element array of 4-component vector of float) diff --git a/Test/baseResults/specExamples.vert.out b/Test/baseResults/specExamples.vert.out index eb399e1b..5f798a7e 100644 --- a/Test/baseResults/specExamples.vert.out +++ b/Test/baseResults/specExamples.vert.out @@ -28,7 +28,6 @@ ERROR: 0:97: 'binding' : atomic_uint binding is too large; see gl_MaxAtomicCount ERROR: 0:106: '' : vertex input cannot be further qualified ERROR: 0:106: 'redeclaration' : cannot change storage, memory, or auxiliary qualification of gl_FrontColor ERROR: 0:112: 'ColorIvn' : identifier not previously declared -WARNING: 0:118: '' : unknown requalification ERROR: 0:132: 'shared' : not supported in this stage: vertex ERROR: 0:134: '' : function does not return a value: funcA ERROR: 0:136: '' : function does not return a value: funcB @@ -70,7 +69,7 @@ ERROR: node is still EOpNull! 0:148 Sequence 0:148 Sequence 0:148 move second child to first child (temp float) -0:148 'result' (temp float) +0:148 'result' (noContraction temp float) 0:148 add (temp float) 0:148 component-wise multiply (temp float) 0:148 'e' (in float) @@ -79,7 +78,7 @@ ERROR: node is still EOpNull! 0:148 'g' (in float) 0:148 'h' (in float) 0:150 Branch: Return with expression -0:150 'result' (temp float) +0:150 'result' (noContraction temp float) 0:153 Function Definition: func3(f1;f1;f1; (global float) 0:153 Function Parameters: 0:153 'i' (in float) @@ -112,7 +111,7 @@ ERROR: node is still EOpNull! 0:161 'd' (in 4-component vector of float) 0:162 move second child to first child (temp 3-component vector of float) 0:162 vector swizzle (temp 3-component vector of float) -0:162 'v' (smooth out 4-component vector of float) +0:162 'v' (noContraction smooth out 4-component vector of float) 0:162 Sequence 0:162 Constant: 0:162 0 (const int) @@ -125,7 +124,7 @@ ERROR: node is still EOpNull! 0:162 's' (temp 3-component vector of float) 0:163 move second child to first child (temp float) 0:163 direct index (temp float) -0:163 'v' (smooth out 4-component vector of float) +0:163 'v' (noContraction smooth out 4-component vector of float) 0:163 Constant: 0:163 3 (const int) 0:163 add (temp float) @@ -149,7 +148,7 @@ ERROR: node is still EOpNull! 0:163 3 (const int) 0:164 move second child to first child (temp float) 0:164 direct index (temp float) -0:164 'v' (smooth out 4-component vector of float) +0:164 'v' (noContraction smooth out 4-component vector of float) 0:164 Constant: 0:164 0 (const int) 0:164 Function Call: func(f1;f1;f1;f1; (global float) @@ -171,7 +170,7 @@ ERROR: node is still EOpNull! 0:164 0 (const int) 0:166 move second child to first child (temp float) 0:166 direct index (temp float) -0:166 'v' (smooth out 4-component vector of float) +0:166 'v' (noContraction smooth out 4-component vector of float) 0:166 Constant: 0:166 0 (const int) 0:166 Function Call: func2(f1;f1;f1;f1; (global float) @@ -211,7 +210,7 @@ ERROR: node is still EOpNull! 0:167 Constant: 0:167 0 (const int) 0:167 direct index (temp float) -0:167 'v' (smooth out 4-component vector of float) +0:167 'v' (noContraction smooth out 4-component vector of float) 0:167 Constant: 0:167 0 (const int) 0:169 Function Call: funcA(I21; (global 4-component vector of float) @@ -302,13 +301,13 @@ ERROR: node is still EOpNull! 0:? 'anon@5' (out block{invariant gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance, gl_ClipVertex 4-component vector of float ClipVertex gl_ClipVertex, flat out 4-component vector of float FrontColor gl_FrontColor, out 4-component vector of float BackColor gl_BackColor, out 4-component vector of float FrontSecondaryColor gl_FrontSecondaryColor, out 4-component vector of float BackSecondaryColor gl_BackSecondaryColor, out implicitly-sized array of 4-component vector of float TexCoord gl_TexCoord, out float FogFragCoord gl_FogFragCoord}) 0:? 'ColorInv' (smooth out 3-component vector of float) 0:? 'Color4' (invariant centroid smooth out 3-component vector of float) -0:? 'position' (smooth out 4-component vector of float) +0:? 'position' (noContraction smooth out 4-component vector of float) 0:? 'Color5' (smooth out 3-component vector of float) 0:? 'a' (in 4-component vector of float) 0:? 'b' (in 4-component vector of float) 0:? 'c' (in 4-component vector of float) 0:? 'd' (in 4-component vector of float) -0:? 'v' (smooth out 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@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) @@ -354,7 +353,7 @@ ERROR: node is still EOpNull! 0:148 Sequence 0:148 Sequence 0:148 move second child to first child (temp float) -0:148 'result' (temp float) +0:148 'result' (noContraction temp float) 0:148 add (temp float) 0:148 component-wise multiply (temp float) 0:148 'e' (in float) @@ -363,7 +362,7 @@ ERROR: node is still EOpNull! 0:148 'g' (in float) 0:148 'h' (in float) 0:150 Branch: Return with expression -0:150 'result' (temp float) +0:150 'result' (noContraction temp float) 0:153 Function Definition: func3(f1;f1;f1; (global float) 0:153 Function Parameters: 0:153 'i' (in float) @@ -396,7 +395,7 @@ ERROR: node is still EOpNull! 0:161 'd' (in 4-component vector of float) 0:162 move second child to first child (temp 3-component vector of float) 0:162 vector swizzle (temp 3-component vector of float) -0:162 'v' (smooth out 4-component vector of float) +0:162 'v' (noContraction smooth out 4-component vector of float) 0:162 Sequence 0:162 Constant: 0:162 0 (const int) @@ -409,7 +408,7 @@ ERROR: node is still EOpNull! 0:162 's' (temp 3-component vector of float) 0:163 move second child to first child (temp float) 0:163 direct index (temp float) -0:163 'v' (smooth out 4-component vector of float) +0:163 'v' (noContraction smooth out 4-component vector of float) 0:163 Constant: 0:163 3 (const int) 0:163 add (temp float) @@ -433,7 +432,7 @@ ERROR: node is still EOpNull! 0:163 3 (const int) 0:164 move second child to first child (temp float) 0:164 direct index (temp float) -0:164 'v' (smooth out 4-component vector of float) +0:164 'v' (noContraction smooth out 4-component vector of float) 0:164 Constant: 0:164 0 (const int) 0:164 Function Call: func(f1;f1;f1;f1; (global float) @@ -455,7 +454,7 @@ ERROR: node is still EOpNull! 0:164 0 (const int) 0:166 move second child to first child (temp float) 0:166 direct index (temp float) -0:166 'v' (smooth out 4-component vector of float) +0:166 'v' (noContraction smooth out 4-component vector of float) 0:166 Constant: 0:166 0 (const int) 0:166 Function Call: func2(f1;f1;f1;f1; (global float) @@ -495,7 +494,7 @@ ERROR: node is still EOpNull! 0:167 Constant: 0:167 0 (const int) 0:167 direct index (temp float) -0:167 'v' (smooth out 4-component vector of float) +0:167 'v' (noContraction smooth out 4-component vector of float) 0:167 Constant: 0:167 0 (const int) 0:169 Function Call: funcA(I21; (global 4-component vector of float) @@ -586,13 +585,13 @@ ERROR: node is still EOpNull! 0:? 'anon@5' (out block{invariant gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance, gl_ClipVertex 4-component vector of float ClipVertex gl_ClipVertex, flat out 4-component vector of float FrontColor gl_FrontColor, out 4-component vector of float BackColor gl_BackColor, out 4-component vector of float FrontSecondaryColor gl_FrontSecondaryColor, out 4-component vector of float BackSecondaryColor gl_BackSecondaryColor, out 1-element array of 4-component vector of float TexCoord gl_TexCoord, out float FogFragCoord gl_FogFragCoord}) 0:? 'ColorInv' (smooth out 3-component vector of float) 0:? 'Color4' (invariant centroid smooth out 3-component vector of float) -0:? 'position' (smooth out 4-component vector of float) +0:? 'position' (noContraction smooth out 4-component vector of float) 0:? 'Color5' (smooth out 3-component vector of float) 0:? 'a' (in 4-component vector of float) 0:? 'b' (in 4-component vector of float) 0:? 'c' (in 4-component vector of float) 0:? 'd' (in 4-component vector of float) -0:? 'v' (smooth out 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@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) diff --git a/glslang/Include/Types.h b/glslang/Include/Types.h index 38a27d4e..d4a9d101 100644 --- a/glslang/Include/Types.h +++ b/glslang/Include/Types.h @@ -390,6 +390,7 @@ public: { precision = EpqNone; invariant = false; + noContraction = false; makeTemporary(); } @@ -429,7 +430,8 @@ public: TStorageQualifier storage : 6; TBuiltInVariable builtIn : 8; TPrecisionQualifier precision : 3; - bool invariant : 1; + bool invariant : 1; // require canonical treatment for cross-shader invariance + bool noContraction: 1; // prevent contraction and reassociation, e.g., for 'precise' keyword, and expressions it affects bool centroid : 1; bool smooth : 1; bool flat : 1; @@ -1479,6 +1481,8 @@ public: if (qualifier.invariant) p += snprintf(p, end - p, "invariant "); + if (qualifier.noContraction) + p += snprintf(p, end - p, "noContraction "); if (qualifier.centroid) p += snprintf(p, end - p, "centroid "); if (qualifier.smooth) diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index aa9ea574..12b7fab7 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -2703,8 +2703,10 @@ void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, cons (profile == EEsProfile && 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)) + 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 first", "", ""); + error(loc, "invariant qualifier must appear before interpolation, storage, and precision qualifiers ", "", ""); else if (src.isInterpolation() && (dst.isAuxiliary() || dst.storage != EvqTemporary || dst.precision != EpqNone)) error(loc, "interpolation qualifiers must appear before storage and precision qualifiers", "", ""); else if (src.isAuxiliary() && (dst.storage != EvqTemporary || dst.precision != EpqNone)) @@ -2713,6 +2715,8 @@ 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)) + 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", "", ""); } @@ -2743,6 +2747,7 @@ 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); @@ -3448,6 +3453,7 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT oldType.getQualifier().centroid = newType.getQualifier().centroid; oldType.getQualifier().sample = newType.getQualifier().sample; oldType.getQualifier().invariant = newType.getQualifier().invariant; + oldType.getQualifier().noContraction = newType.getQualifier().noContraction; oldType.getQualifier().smooth = newType.getQualifier().smooth; oldType.getQualifier().flat = newType.getQualifier().flat; oldType.getQualifier().nopersp = newType.getQualifier().nopersp; @@ -3534,7 +3540,9 @@ void TParseContext::paramCheckFix(const TSourceLoc& loc, const TQualifier& quali if (qualifier.hasLayout()) error(loc, "cannot use layout qualifiers on a function parameter", "", ""); if (qualifier.invariant) - error(loc, "cannot use invariant qualifier on a function parameter", "", ""); + error(loc, "cannot use invariant qualifier on a function parameter", "", ""); + if (qualifier.noContraction && qualifier.storage != EvqOut && qualifier.storage != EvqInOut) + warn(loc, "qualifier has no effect on non-output parameters", "precise", ""); paramCheckFix(loc, qualifier.storage, type); } @@ -5560,7 +5568,7 @@ void TParseContext::blockStageIoCheck(const TSourceLoc& loc, const TQualifier& q } } -// Do all block-declaration checking regarding its qualifers. +// Do all block-declaration checking regarding its qualifiers. void TParseContext::blockQualifierCheck(const TSourceLoc& loc, const TQualifier& qualifier, bool instanceName) { // The 4.5 specification says: @@ -5760,6 +5768,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) { + if (intermediate.inIoAccessed(identifier)) + error(loc, "cannot change qualification after use", "precise", ""); + symbol->getWritableType().getQualifier().noContraction = true; } else if (qualifier.specConstant) { symbol->getWritableType().getQualifier().makeSpecConstant(); if (qualifier.hasSpecConstantId()) @@ -5774,6 +5786,7 @@ void TParseContext::addQualifierToExisting(const TSourceLoc& loc, TQualifier qua addQualifierToExisting(loc, qualifier, *identifiers[i]); } +// Make sure 'invariant' isn't being applied to a non-allowed object. void TParseContext::invariantCheck(const TSourceLoc& loc, const TQualifier& qualifier) { if (! qualifier.invariant) diff --git a/glslang/MachineIndependent/glslang.y b/glslang/MachineIndependent/glslang.y index 976c9952..f4c7857c 100644 --- a/glslang/MachineIndependent/glslang.y +++ b/glslang/MachineIndependent/glslang.y @@ -1086,7 +1086,10 @@ layout_qualifier_id 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; } ; diff --git a/glslang/MachineIndependent/glslang_tab.cpp b/glslang/MachineIndependent/glslang_tab.cpp index c97c8e4d..9d632d8a 100644 --- a/glslang/MachineIndependent/glslang_tab.cpp +++ b/glslang/MachineIndependent/glslang_tab.cpp @@ -799,36 +799,36 @@ static const yytype_uint16 yyrline[] = 781, 788, 791, 798, 806, 826, 844, 859, 882, 893, 903, 913, 923, 932, 935, 939, 943, 948, 956, 961, 966, 971, 976, 985, 996, 1023, 1032, 1039, 1046, 1056, - 1062, 1065, 1072, 1076, 1080, 1088, 1094, 1097, 1108, 1111, - 1114, 1117, 1121, 1125, 1132, 1136, 1148, 1162, 1167, 1173, - 1179, 1186, 1192, 1197, 1202, 1207, 1214, 1218, 1222, 1226, - 1230, 1234, 1240, 1252, 1255, 1260, 1264, 1273, 1278, 1286, - 1290, 1300, 1304, 1308, 1313, 1317, 1322, 1327, 1332, 1336, - 1341, 1346, 1351, 1357, 1363, 1369, 1374, 1379, 1384, 1389, - 1394, 1399, 1405, 1411, 1417, 1423, 1429, 1435, 1441, 1447, - 1453, 1458, 1463, 1468, 1473, 1478, 1483, 1488, 1493, 1498, - 1503, 1508, 1513, 1519, 1525, 1531, 1537, 1543, 1549, 1555, - 1561, 1567, 1573, 1579, 1585, 1590, 1595, 1600, 1605, 1610, - 1615, 1620, 1625, 1630, 1635, 1640, 1645, 1650, 1655, 1660, - 1665, 1670, 1675, 1680, 1685, 1690, 1695, 1700, 1705, 1710, - 1715, 1720, 1725, 1730, 1735, 1740, 1745, 1750, 1755, 1760, - 1765, 1770, 1775, 1780, 1785, 1790, 1795, 1800, 1805, 1810, - 1815, 1820, 1825, 1830, 1835, 1840, 1845, 1850, 1855, 1860, - 1865, 1870, 1875, 1880, 1885, 1890, 1895, 1900, 1905, 1910, - 1915, 1920, 1925, 1930, 1935, 1940, 1945, 1950, 1955, 1960, - 1965, 1970, 1975, 1980, 1985, 1990, 1995, 2000, 2005, 2010, - 2015, 2020, 2025, 2030, 2035, 2040, 2045, 2050, 2055, 2060, - 2065, 2070, 2075, 2080, 2085, 2090, 2095, 2100, 2105, 2110, - 2115, 2120, 2125, 2130, 2136, 2142, 2148, 2154, 2160, 2166, - 2172, 2177, 2193, 2199, 2205, 2214, 2214, 2225, 2225, 2235, - 2238, 2251, 2269, 2293, 2297, 2303, 2308, 2319, 2322, 2328, - 2337, 2340, 2346, 2350, 2351, 2357, 2358, 2359, 2360, 2361, - 2362, 2363, 2367, 2368, 2372, 2368, 2384, 2385, 2389, 2389, - 2396, 2396, 2410, 2413, 2421, 2429, 2440, 2441, 2445, 2452, - 2456, 2464, 2468, 2481, 2481, 2501, 2504, 2510, 2522, 2534, - 2534, 2549, 2549, 2565, 2565, 2586, 2589, 2595, 2598, 2604, - 2608, 2615, 2620, 2625, 2632, 2650, 2659, 2663, 2670, 2673, - 2679, 2679 + 1062, 1065, 1072, 1076, 1080, 1088, 1097, 1100, 1111, 1114, + 1117, 1120, 1124, 1128, 1135, 1139, 1151, 1165, 1170, 1176, + 1182, 1189, 1195, 1200, 1205, 1210, 1217, 1221, 1225, 1229, + 1233, 1237, 1243, 1255, 1258, 1263, 1267, 1276, 1281, 1289, + 1293, 1303, 1307, 1311, 1316, 1320, 1325, 1330, 1335, 1339, + 1344, 1349, 1354, 1360, 1366, 1372, 1377, 1382, 1387, 1392, + 1397, 1402, 1408, 1414, 1420, 1426, 1432, 1438, 1444, 1450, + 1456, 1461, 1466, 1471, 1476, 1481, 1486, 1491, 1496, 1501, + 1506, 1511, 1516, 1522, 1528, 1534, 1540, 1546, 1552, 1558, + 1564, 1570, 1576, 1582, 1588, 1593, 1598, 1603, 1608, 1613, + 1618, 1623, 1628, 1633, 1638, 1643, 1648, 1653, 1658, 1663, + 1668, 1673, 1678, 1683, 1688, 1693, 1698, 1703, 1708, 1713, + 1718, 1723, 1728, 1733, 1738, 1743, 1748, 1753, 1758, 1763, + 1768, 1773, 1778, 1783, 1788, 1793, 1798, 1803, 1808, 1813, + 1818, 1823, 1828, 1833, 1838, 1843, 1848, 1853, 1858, 1863, + 1868, 1873, 1878, 1883, 1888, 1893, 1898, 1903, 1908, 1913, + 1918, 1923, 1928, 1933, 1938, 1943, 1948, 1953, 1958, 1963, + 1968, 1973, 1978, 1983, 1988, 1993, 1998, 2003, 2008, 2013, + 2018, 2023, 2028, 2033, 2038, 2043, 2048, 2053, 2058, 2063, + 2068, 2073, 2078, 2083, 2088, 2093, 2098, 2103, 2108, 2113, + 2118, 2123, 2128, 2133, 2139, 2145, 2151, 2157, 2163, 2169, + 2175, 2180, 2196, 2202, 2208, 2217, 2217, 2228, 2228, 2238, + 2241, 2254, 2272, 2296, 2300, 2306, 2311, 2322, 2325, 2331, + 2340, 2343, 2349, 2353, 2354, 2360, 2361, 2362, 2363, 2364, + 2365, 2366, 2370, 2371, 2375, 2371, 2387, 2388, 2392, 2392, + 2399, 2399, 2413, 2416, 2424, 2432, 2443, 2444, 2448, 2455, + 2459, 2467, 2471, 2484, 2484, 2504, 2507, 2513, 2525, 2537, + 2537, 2552, 2552, 2568, 2568, 2589, 2592, 2598, 2601, 2607, + 2611, 2618, 2623, 2628, 2635, 2653, 2662, 2666, 2673, 2676, + 2682, 2682 }; #endif @@ -4524,21 +4524,24 @@ yyreduce: case 135: #line 1088 "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 4530 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4533 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 136: -#line 1094 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1097 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 4538 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4541 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 137: -#line 1097 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1100 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type) = (yyvsp[-1].interm.type); if ((yyval.interm.type).basicType == EbtVoid) @@ -4547,71 +4550,71 @@ 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 4551 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4554 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 138: -#line 1108 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type) = (yyvsp[0].interm.type); - } -#line 4559 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 139: #line 1111 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 4567 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4562 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 140: + case 139: #line 1114 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 4575 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4570 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 140: +#line 1117 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.type) = (yyvsp[0].interm.type); + } +#line 4578 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 141: -#line 1117 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1120 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // allow inheritance of storage qualifier from block declaration (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 4584 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4587 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 142: -#line 1121 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1124 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // allow inheritance of storage qualifier from block declaration (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 4593 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4596 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 143: -#line 1125 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1128 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // allow inheritance of storage qualifier from block declaration (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 4602 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4605 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 144: -#line 1132 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1135 "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 4611 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4614 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 145: -#line 1136 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1139 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.requireStage((yyvsp[0].lex).loc, EShLangVertex, "attribute"); parseContext.checkDeprecated((yyvsp[0].lex).loc, ECoreProfile, 130, "attribute"); @@ -4624,11 +4627,11 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqVaryingIn; } -#line 4628 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4631 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 146: -#line 1148 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1151 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.checkDeprecated((yyvsp[0].lex).loc, ENoProfile, 130, "varying"); parseContext.checkDeprecated((yyvsp[0].lex).loc, ECoreProfile, 130, "varying"); @@ -4643,43 +4646,43 @@ yyreduce: else (yyval.interm.type).qualifier.storage = EvqVaryingIn; } -#line 4647 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4650 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 147: -#line 1162 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1165 "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 4657 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4660 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 148: -#line 1167 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1170 "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 4668 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4671 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 149: -#line 1173 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1176 "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 4679 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4682 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 150: -#line 1179 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1182 "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"); @@ -4687,52 +4690,52 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.centroid = true; } -#line 4691 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4694 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 151: -#line 1186 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1189 "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 4702 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4705 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 152: -#line 1192 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1195 "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 4712 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4715 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 153: -#line 1197 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1200 "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 4722 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4725 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 154: -#line 1202 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1205 "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 4732 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4735 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 155: -#line 1207 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1210 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, 430, 0, "shared"); parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 310, 0, "shared"); @@ -4740,67 +4743,67 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqShared; } -#line 4744 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4747 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 156: -#line 1214 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1217 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.coherent = true; } -#line 4753 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4756 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 157: -#line 1218 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1221 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.volatil = true; } -#line 4762 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4765 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 158: -#line 1222 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1225 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.restrict = true; } -#line 4771 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4774 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 159: -#line 1226 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1229 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.readonly = true; } -#line 4780 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4783 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 160: -#line 1230 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1233 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.writeonly = true; } -#line 4789 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4792 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 161: -#line 1234 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1237 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.spvRemoved((yyvsp[0].lex).loc, "subroutine"); parseContext.globalCheck((yyvsp[0].lex).loc, "subroutine"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqUniform; } -#line 4800 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4803 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 162: -#line 1240 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1243 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.spvRemoved((yyvsp[-3].lex).loc, "subroutine"); parseContext.globalCheck((yyvsp[-3].lex).loc, "subroutine"); @@ -4810,56 +4813,56 @@ yyreduce: // 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 4814 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4817 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 163: -#line 1252 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1255 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // TODO: 4.0 functionality: subroutine type to list } -#line 4822 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4825 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 164: -#line 1255 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1258 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { } -#line 4829 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4832 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 165: -#line 1260 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1263 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type) = (yyvsp[0].interm.type); (yyval.interm.type).qualifier.precision = parseContext.getDefaultPrecision((yyval.interm.type)); } -#line 4838 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4841 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 166: -#line 1264 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1267 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.arrayDimCheck((yyvsp[0].interm).loc, (yyvsp[0].interm).arraySizes, 0); (yyval.interm.type) = (yyvsp[-1].interm.type); (yyval.interm.type).qualifier.precision = parseContext.getDefaultPrecision((yyval.interm.type)); (yyval.interm.type).arraySizes = (yyvsp[0].interm).arraySizes; } -#line 4849 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4852 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 167: -#line 1273 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1276 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).loc = (yyvsp[-1].lex).loc; (yyval.interm).arraySizes = new TArraySizes; (yyval.interm).arraySizes->addInnerSize(); } -#line 4859 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4862 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 168: -#line 1278 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1281 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).loc = (yyvsp[-2].lex).loc; (yyval.interm).arraySizes = new TArraySizes; @@ -4868,20 +4871,20 @@ yyreduce: parseContext.arraySizeCheck((yyvsp[-1].interm.intermTypedNode)->getLoc(), (yyvsp[-1].interm.intermTypedNode), size); (yyval.interm).arraySizes->addInnerSize(size); } -#line 4872 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4875 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 169: -#line 1286 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1289 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm) = (yyvsp[-2].interm); (yyval.interm).arraySizes->addInnerSize(); } -#line 4881 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4884 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 170: -#line 1290 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1293 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm) = (yyvsp[-3].interm); @@ -4889,1738 +4892,1738 @@ yyreduce: parseContext.arraySizeCheck((yyvsp[-1].interm.intermTypedNode)->getLoc(), (yyvsp[-1].interm.intermTypedNode), size); (yyval.interm).arraySizes->addInnerSize(size); } -#line 4893 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4896 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 171: -#line 1300 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1303 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtVoid; } -#line 4902 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4905 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 172: -#line 1304 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1307 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; } -#line 4911 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4914 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 173: -#line 1308 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1311 "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 4921 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4924 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 174: -#line 1313 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1316 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt; } -#line 4930 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4933 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 175: -#line 1317 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1320 "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 4940 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4943 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 176: -#line 1322 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1325 "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 4950 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4953 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 177: -#line 1327 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1330 "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 4960 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4963 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 178: -#line 1332 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1335 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtBool; } -#line 4969 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4972 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 179: -#line 1336 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1339 "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 4979 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4982 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 180: -#line 1341 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1344 "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 4989 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4992 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 181: -#line 1346 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1349 "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 4999 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5002 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 182: -#line 1351 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1354 "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 5010 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5013 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 183: -#line 1357 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1360 "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 5021 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5024 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 184: -#line 1363 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1366 "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 5032 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5035 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 185: -#line 1369 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1372 "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 5042 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5045 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 186: -#line 1374 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1377 "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 5052 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5055 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 187: -#line 1379 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1382 "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 5062 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5065 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 188: -#line 1384 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1387 "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 5072 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5075 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 189: -#line 1389 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1392 "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 5082 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5085 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 190: -#line 1394 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1397 "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 5092 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5095 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 191: -#line 1399 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1402 "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 5103 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5106 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 192: -#line 1405 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1408 "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 5114 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5117 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 193: -#line 1411 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1414 "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 5125 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5128 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 194: -#line 1417 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1420 "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 5136 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5139 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 195: -#line 1423 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1426 "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 5147 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5150 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 196: -#line 1429 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1432 "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 5158 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5161 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 197: -#line 1435 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1438 "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 5169 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5172 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 198: -#line 1441 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1444 "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 5180 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5183 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 199: -#line 1447 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1450 "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 5191 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5194 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 200: -#line 1453 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1456 "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 5201 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5204 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 201: -#line 1458 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1461 "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 5211 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5214 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 202: -#line 1463 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1466 "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 5221 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5224 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 203: -#line 1468 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1471 "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 5231 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5234 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 204: -#line 1473 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1476 "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 5241 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5244 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 205: -#line 1478 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1481 "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 5251 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5254 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 206: -#line 1483 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1486 "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 5261 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5264 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 207: -#line 1488 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1491 "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 5271 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5274 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 208: -#line 1493 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1496 "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 5281 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5284 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 209: -#line 1498 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1501 "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 5291 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5294 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 210: -#line 1503 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1506 "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 5301 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5304 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 211: -#line 1508 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1511 "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 5311 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5314 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 212: -#line 1513 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1516 "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 5322 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5325 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 213: -#line 1519 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1522 "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 5333 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5336 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 214: -#line 1525 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1528 "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 5344 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5347 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 215: -#line 1531 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1534 "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 5355 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5358 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 216: -#line 1537 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1540 "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 5366 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5369 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 217: -#line 1543 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1546 "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 5377 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5380 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 218: -#line 1549 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1552 "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 5388 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5391 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 219: -#line 1555 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1558 "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 5399 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5402 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 220: -#line 1561 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1564 "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 5410 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5413 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 221: -#line 1567 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1570 "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 5421 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5424 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 222: -#line 1573 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1576 "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 5432 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5435 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 223: -#line 1579 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1582 "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 5443 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5446 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 224: -#line 1585 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1588 "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 5453 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5456 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 225: -#line 1590 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1593 "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 5463 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5466 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 226: -#line 1595 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1598 "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 5473 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5476 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 227: -#line 1600 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1603 "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 5483 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5486 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 228: -#line 1605 "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 = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, EsdCube); } -#line 5493 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5496 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 229: -#line 1610 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1613 "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 5503 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5506 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 230: -#line 1615 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1618 "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 5513 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5516 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 231: -#line 1620 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1623 "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 5523 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5526 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 232: -#line 1625 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1628 "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 5533 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5536 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 233: -#line 1630 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1633 "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 5543 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5546 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 234: -#line 1635 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1638 "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 5553 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5556 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 235: -#line 1640 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1643 "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 5563 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5566 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 236: -#line 1645 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1648 "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 5573 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5576 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 237: -#line 1650 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1653 "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 5583 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5586 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 238: -#line 1655 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1658 "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 5593 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5596 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 239: -#line 1660 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1663 "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 5603 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5606 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 240: -#line 1665 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1668 "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 5613 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5616 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 241: -#line 1670 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1673 "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 5623 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5626 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 242: -#line 1675 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1678 "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 5633 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5636 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 243: -#line 1680 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1683 "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 5643 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5646 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 244: -#line 1685 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1688 "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 5653 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5656 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 245: -#line 1690 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1693 "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 5663 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5666 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 246: -#line 1695 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1698 "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 5673 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5676 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 247: -#line 1700 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1703 "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 5683 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5686 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 248: -#line 1705 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1708 "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 5693 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5696 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 249: -#line 1710 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1713 "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 5703 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5706 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 250: -#line 1715 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1718 "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 5713 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5716 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 251: -#line 1720 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1723 "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 5723 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5726 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 252: -#line 1725 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1728 "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 5733 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5736 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 253: -#line 1730 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1733 "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 5743 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5746 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 254: -#line 1735 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1738 "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 5753 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5756 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 255: -#line 1740 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1743 "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 5763 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5766 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 256: -#line 1745 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1748 "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 5773 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5776 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 257: -#line 1750 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1753 "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 5783 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5786 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 258: -#line 1755 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1758 "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 5793 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5796 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 259: -#line 1760 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1763 "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 5803 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5806 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 260: -#line 1765 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1768 "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 5813 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5816 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 261: -#line 1770 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1773 "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 5823 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5826 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 262: -#line 1775 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1778 "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 5833 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5836 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 263: -#line 1780 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1783 "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 5843 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5846 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 264: -#line 1785 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1788 "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 5853 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5856 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 265: -#line 1790 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1793 "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 5863 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5866 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 266: -#line 1795 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1798 "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 5873 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5876 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 267: -#line 1800 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1803 "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 5883 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5886 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 268: -#line 1805 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1808 "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 5893 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5896 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 269: -#line 1810 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1813 "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 5903 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5906 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 270: -#line 1815 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1818 "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 5913 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5916 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 271: -#line 1820 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1823 "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 5923 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5926 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 272: -#line 1825 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1828 "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 5933 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5936 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 273: -#line 1830 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1833 "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 5943 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5946 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 274: -#line 1835 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1838 "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 5953 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5956 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 275: -#line 1840 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1843 "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 5963 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5966 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 276: -#line 1845 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1848 "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 5973 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5976 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 277: -#line 1850 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1853 "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 5983 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5986 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 278: -#line 1855 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1858 "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 5993 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5996 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 279: -#line 1860 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1863 "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 6003 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6006 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 280: -#line 1865 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1868 "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 6013 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6016 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 281: -#line 1870 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1873 "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 6023 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6026 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 282: -#line 1875 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1878 "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 6033 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6036 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 283: -#line 1880 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1883 "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 6043 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6046 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 284: -#line 1885 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1888 "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 6053 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6056 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 285: -#line 1890 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1893 "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 6063 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6066 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 286: -#line 1895 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1898 "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 6073 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6076 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 287: -#line 1900 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1903 "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 6083 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6086 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 288: -#line 1905 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1908 "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 6093 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6096 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 289: -#line 1910 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1913 "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 6103 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6106 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 290: -#line 1915 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1918 "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 6113 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6116 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 291: -#line 1920 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1923 "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 6123 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6126 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 292: -#line 1925 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1928 "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 6133 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6136 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 293: -#line 1930 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1933 "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 6143 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6146 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 294: -#line 1935 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1938 "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 6153 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6156 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 295: -#line 1940 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1943 "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 6163 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6166 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 296: -#line 1945 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1948 "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 6173 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6176 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 297: -#line 1950 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1953 "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 6183 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6186 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 298: -#line 1955 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1958 "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 6193 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6196 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 299: -#line 1960 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1963 "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 6203 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6206 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 300: -#line 1965 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1968 "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 6213 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6216 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 301: -#line 1970 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1973 "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 6223 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6226 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 302: -#line 1975 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1978 "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 6233 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6236 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 303: -#line 1980 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1983 "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 6243 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6246 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 304: -#line 1985 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1988 "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 6253 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6256 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 305: -#line 1990 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1993 "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 6263 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6266 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 306: -#line 1995 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1998 "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 6273 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6276 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 307: -#line 2000 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2003 "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 6283 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6286 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 308: -#line 2005 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2008 "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 6293 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6296 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 309: -#line 2010 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2013 "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 6303 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6306 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 310: -#line 2015 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2018 "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 6313 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6316 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 311: -#line 2020 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2023 "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 6323 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6326 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 312: -#line 2025 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2028 "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 6333 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6336 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 313: -#line 2030 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2033 "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 6343 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6346 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 314: -#line 2035 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2038 "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 6353 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6356 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 315: -#line 2040 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2043 "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 6363 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6366 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 316: -#line 2045 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2048 "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 6373 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6376 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 317: -#line 2050 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2053 "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 6383 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6386 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 318: -#line 2055 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2058 "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 6393 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6396 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 319: -#line 2060 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2063 "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 6403 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6406 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 320: -#line 2065 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2068 "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 6413 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6416 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 321: -#line 2070 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2073 "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 6423 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6426 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 322: -#line 2075 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2078 "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 6433 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6436 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 323: -#line 2080 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2083 "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 6443 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6446 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 324: -#line 2085 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2088 "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 6453 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6456 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 325: -#line 2090 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2093 "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 6463 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6466 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 326: -#line 2095 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2098 "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 6473 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6476 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 327: -#line 2100 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2103 "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 6483 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6486 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 328: -#line 2105 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2108 "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 6493 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6496 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 329: -#line 2110 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2113 "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 6503 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6506 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 330: -#line 2115 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2118 "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 6513 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6516 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 331: -#line 2120 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2123 "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 6523 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6526 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 332: -#line 2125 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2128 "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 6533 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6536 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 333: -#line 2130 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2133 "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 6544 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6547 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 334: -#line 2136 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2139 "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 6555 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6558 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 335: -#line 2142 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2145 "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 6566 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6569 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 336: -#line 2148 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2151 "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 6577 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6580 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 337: -#line 2154 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2157 "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 6588 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6591 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 338: -#line 2160 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2163 "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 6599 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6602 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 339: -#line 2166 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2169 "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 6610 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6613 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 340: -#line 2172 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2175 "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 6620 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6623 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 341: -#line 2177 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2180 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // // This is for user defined type names. The lexical phase looked up the @@ -6634,50 +6637,50 @@ yyreduce: } else parseContext.error((yyvsp[0].lex).loc, "expected type name", (yyvsp[0].lex).string->c_str(), ""); } -#line 6638 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6641 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 342: -#line 2193 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2196 "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()); if (parseContext.profile == EEsProfile) (yyval.interm.type).qualifier.precision = EpqHigh; } -#line 6649 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6652 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 343: -#line 2199 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2202 "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()); if (parseContext.profile == EEsProfile) (yyval.interm.type).qualifier.precision = EpqMedium; } -#line 6660 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6663 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 344: -#line 2205 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2208 "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()); if (parseContext.profile == EEsProfile) (yyval.interm.type).qualifier.precision = EpqLow; } -#line 6671 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6674 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 345: -#line 2214 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2217 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.nestedStructCheck((yyvsp[-2].lex).loc); } -#line 6677 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6680 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 346: -#line 2214 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2217 "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); @@ -6689,17 +6692,17 @@ yyreduce: (yyval.interm.type).userDef = structure; --parseContext.structNestingLevel; } -#line 6693 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6696 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 347: -#line 2225 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2228 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.nestedStructCheck((yyvsp[-1].lex).loc); } -#line 6699 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6702 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 348: -#line 2225 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2228 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { TType* structure = new TType((yyvsp[-1].interm.typeList), TString("")); (yyval.interm.type).init((yyvsp[-4].lex).loc); @@ -6707,19 +6710,19 @@ yyreduce: (yyval.interm.type).userDef = structure; --parseContext.structNestingLevel; } -#line 6711 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6714 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 349: -#line 2235 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2238 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.typeList) = (yyvsp[0].interm.typeList); } -#line 6719 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6722 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 350: -#line 2238 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2241 "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) { @@ -6730,11 +6733,11 @@ yyreduce: (yyval.interm.typeList)->push_back((*(yyvsp[0].interm.typeList))[i]); } } -#line 6734 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6737 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 351: -#line 2251 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2254 "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"); @@ -6753,11 +6756,11 @@ yyreduce: (*(yyval.interm.typeList))[i].type->mergeType((yyvsp[-2].interm.type)); } } -#line 6757 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6760 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 352: -#line 2269 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2272 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.globalQualifierFixCheck((yyvsp[-3].interm.type).loc, (yyvsp[-3].interm.type).qualifier); if ((yyvsp[-2].interm.type).arraySizes) { @@ -6779,38 +6782,38 @@ yyreduce: (*(yyval.interm.typeList))[i].type->mergeType((yyvsp[-2].interm.type)); } } -#line 6783 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6786 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 353: -#line 2293 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2296 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.typeList) = new TTypeList; (yyval.interm.typeList)->push_back((yyvsp[0].interm.typeLine)); } -#line 6792 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6795 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 354: -#line 2297 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2300 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.typeList)->push_back((yyvsp[0].interm.typeLine)); } -#line 6800 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6803 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 355: -#line 2303 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2306 "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 6810 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6813 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 356: -#line 2308 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2311 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.arrayDimCheck((yyvsp[-1].lex).loc, (yyvsp[0].interm).arraySizes, 0); @@ -6819,219 +6822,219 @@ yyreduce: (yyval.interm.typeLine).type->setFieldName(*(yyvsp[-1].lex).string); (yyval.interm.typeLine).type->newArraySizes(*(yyvsp[0].interm).arraySizes); } -#line 6823 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6826 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 357: -#line 2319 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2322 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 6831 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6834 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 358: -#line 2322 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2325 "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 6842 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6845 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 359: -#line 2328 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2331 "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 6853 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6856 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 360: -#line 2337 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2340 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.intermediate.growAggregate(0, (yyvsp[0].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)->getLoc()); } -#line 6861 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6864 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 361: -#line 2340 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2343 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.intermediate.growAggregate((yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); } -#line 6869 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6872 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 362: -#line 2346 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2349 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 6875 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6878 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 363: -#line 2350 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2353 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 6881 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6884 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 364: -#line 2351 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2354 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 6887 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6890 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 365: -#line 2357 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2360 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 6893 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6896 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 366: -#line 2358 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2361 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 6899 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6902 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 367: -#line 2359 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2362 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 6905 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6908 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 368: -#line 2360 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2363 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 6911 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6914 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 369: -#line 2361 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2364 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 6917 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6920 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 370: -#line 2362 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2365 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 6923 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6926 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 371: -#line 2363 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2366 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 6929 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6932 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 372: -#line 2367 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2370 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = 0; } -#line 6935 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6938 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 373: -#line 2368 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2371 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.symbolTable.push(); ++parseContext.statementNestingLevel; } -#line 6944 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6947 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 374: -#line 2372 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2375 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); --parseContext.statementNestingLevel; } -#line 6953 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6956 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 375: -#line 2376 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2379 "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 6963 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6966 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 376: -#line 2384 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2387 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 6969 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6972 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 377: -#line 2385 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2388 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 6975 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6978 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 378: -#line 2389 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2392 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { ++parseContext.controlFlowNestingLevel; } -#line 6983 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6986 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 379: -#line 2392 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2395 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { --parseContext.controlFlowNestingLevel; (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 6992 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6995 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 380: -#line 2396 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2399 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.symbolTable.push(); ++parseContext.statementNestingLevel; ++parseContext.controlFlowNestingLevel; } -#line 7002 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7005 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 381: -#line 2401 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2404 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7013 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7016 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 382: -#line 2410 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2413 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = 0; } -#line 7021 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7024 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 383: -#line 2413 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2416 "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 7031 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7034 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 384: -#line 2421 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2424 "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 || @@ -7040,11 +7043,11 @@ yyreduce: (yyval.interm.intermNode) = 0; // start a fresh subsequence for what's after this case } } -#line 7044 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7047 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 385: -#line 2429 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2432 "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)) { @@ -7053,59 +7056,59 @@ yyreduce: } else (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[-1].interm.intermNode), (yyvsp[0].interm.intermNode)); } -#line 7057 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7060 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 386: -#line 2440 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2443 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = 0; } -#line 7063 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7066 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 387: -#line 2441 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2444 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = static_cast((yyvsp[-1].interm.intermTypedNode)); } -#line 7069 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7072 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 388: -#line 2445 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2448 "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 7078 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7081 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 389: -#line 2452 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2455 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.nodePair).node1 = (yyvsp[-2].interm.intermNode); (yyval.interm.nodePair).node2 = (yyvsp[0].interm.intermNode); } -#line 7087 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7090 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 390: -#line 2456 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2459 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.nodePair).node1 = (yyvsp[0].interm.intermNode); (yyval.interm.nodePair).node2 = 0; } -#line 7096 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7099 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 391: -#line 2464 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2467 "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 7105 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7108 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 392: -#line 2468 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2471 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.boolCheck((yyvsp[-2].lex).loc, (yyvsp[-3].interm.type)); @@ -7116,11 +7119,11 @@ yyreduce: else (yyval.interm.intermTypedNode) = 0; } -#line 7120 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7123 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 393: -#line 2481 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2484 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // start new switch sequence on the switch stack ++parseContext.controlFlowNestingLevel; @@ -7129,11 +7132,11 @@ yyreduce: parseContext.switchLevel.push_back(parseContext.statementNestingLevel); parseContext.symbolTable.push(); } -#line 7133 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7136 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 394: -#line 2489 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2492 "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(); @@ -7143,27 +7146,27 @@ yyreduce: --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; } -#line 7147 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7150 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 395: -#line 2501 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2504 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = 0; } -#line 7155 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7158 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 396: -#line 2504 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2507 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7163 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7166 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 397: -#line 2510 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2513 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = 0; if (parseContext.switchLevel.size() == 0) @@ -7176,11 +7179,11 @@ yyreduce: (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpCase, (yyvsp[-1].interm.intermTypedNode), (yyvsp[-2].lex).loc); } } -#line 7180 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7183 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 398: -#line 2522 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2525 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = 0; if (parseContext.switchLevel.size() == 0) @@ -7190,11 +7193,11 @@ yyreduce: else (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpDefault, (yyvsp[-1].lex).loc); } -#line 7194 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7197 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 399: -#line 2534 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2537 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if (! parseContext.limits.whileLoops) parseContext.error((yyvsp[-1].lex).loc, "while loops not available", "limitation", ""); @@ -7203,11 +7206,11 @@ yyreduce: ++parseContext.statementNestingLevel; ++parseContext.controlFlowNestingLevel; } -#line 7207 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7210 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 400: -#line 2542 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2545 "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); @@ -7215,21 +7218,21 @@ yyreduce: --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; } -#line 7219 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7222 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 401: -#line 2549 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2552 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { ++parseContext.loopNestingLevel; ++parseContext.statementNestingLevel; ++parseContext.controlFlowNestingLevel; } -#line 7229 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7232 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 402: -#line 2554 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2557 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if (! parseContext.limits.whileLoops) parseContext.error((yyvsp[-7].lex).loc, "do-while loops not available", "limitation", ""); @@ -7241,22 +7244,22 @@ yyreduce: --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; } -#line 7245 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7248 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 403: -#line 2565 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2568 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.symbolTable.push(); ++parseContext.loopNestingLevel; ++parseContext.statementNestingLevel; ++parseContext.controlFlowNestingLevel; } -#line 7256 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7259 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 404: -#line 2571 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2574 "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); @@ -7269,81 +7272,81 @@ yyreduce: --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; } -#line 7273 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7276 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 405: -#line 2586 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); - } -#line 7281 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 406: #line 2589 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7289 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7284 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 406: +#line 2592 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); + } +#line 7292 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 407: -#line 2595 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2598 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 7297 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7300 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 408: -#line 2598 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2601 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = 0; } -#line 7305 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7308 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 409: -#line 2604 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2607 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.nodePair).node1 = (yyvsp[-1].interm.intermTypedNode); (yyval.interm.nodePair).node2 = 0; } -#line 7314 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7317 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 410: -#line 2608 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2611 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.nodePair).node1 = (yyvsp[-2].interm.intermTypedNode); (yyval.interm.nodePair).node2 = (yyvsp[0].interm.intermTypedNode); } -#line 7323 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7326 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 411: -#line 2615 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2618 "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 7333 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7336 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 412: -#line 2620 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2623 "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 7343 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7346 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 413: -#line 2625 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2628 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpReturn, (yyvsp[-1].lex).loc); if (parseContext.currentFunctionType->getBasicType() != EbtVoid) @@ -7351,11 +7354,11 @@ yyreduce: if (parseContext.inMain) parseContext.postMainReturn = true; } -#line 7355 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7358 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 414: -#line 2632 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2635 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.functionReturnsValue = true; if (parseContext.currentFunctionType->getBasicType() == EbtVoid) { @@ -7374,63 +7377,63 @@ yyreduce: } else (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpReturn, (yyvsp[-1].interm.intermTypedNode), (yyvsp[-2].lex).loc); } -#line 7378 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7381 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 415: -#line 2650 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2653 "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 7387 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7390 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 416: -#line 2659 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2662 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); parseContext.intermediate.setTreeRoot((yyval.interm.intermNode)); } -#line 7396 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7399 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 417: -#line 2663 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2666 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[-1].interm.intermNode), (yyvsp[0].interm.intermNode)); parseContext.intermediate.setTreeRoot((yyval.interm.intermNode)); } -#line 7405 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7408 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 418: -#line 2670 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); - } -#line 7413 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 419: #line 2673 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7421 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7416 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 419: +#line 2676 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); + } +#line 7424 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 420: -#line 2679 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2682 "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 7430 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7433 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 421: -#line 2683 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 2686 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // May be best done as post process phase on intermediate code if (parseContext.currentFunctionType->getBasicType() != EbtVoid && ! parseContext.functionReturnsValue) @@ -7446,11 +7449,11 @@ yyreduce: (yyval.interm.intermNode)->getAsAggregate()->setDebug(parseContext.contextPragma.debug); (yyval.interm.intermNode)->getAsAggregate()->addToPragmaTable(parseContext.contextPragma.pragmaTable); } -#line 7450 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7453 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; -#line 7454 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7457 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -7678,5 +7681,5 @@ yyreturn: #endif return yyresult; } -#line 2700 "MachineIndependent/glslang.y" /* yacc.c:1906 */ +#line 2703 "MachineIndependent/glslang.y" /* yacc.c:1906 */ diff --git a/glslang/MachineIndependent/linkValidate.cpp b/glslang/MachineIndependent/linkValidate.cpp index f82ca21b..4a6e7e5b 100644 --- a/glslang/MachineIndependent/linkValidate.cpp +++ b/glslang/MachineIndependent/linkValidate.cpp @@ -309,6 +309,12 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy writeTypeComparison = true; } + // Precise... + if (! crossStage && symbol.getQualifier().noContraction != unitSymbol.getQualifier().noContraction) { + error(infoSink, "Presence of precise qualifier must match:"); + writeTypeComparison = true; + } + // Auxiliary and interpolation... if (symbol.getQualifier().centroid != unitSymbol.getQualifier().centroid || symbol.getQualifier().smooth != unitSymbol.getQualifier().smooth || diff --git a/hlsl/hlslParseHelper.cpp b/hlsl/hlslParseHelper.cpp index e05f01f1..13887444 100755 --- a/hlsl/hlslParseHelper.cpp +++ b/hlsl/hlslParseHelper.cpp @@ -1711,6 +1711,7 @@ void HlslParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, c 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); @@ -2016,6 +2017,7 @@ void HlslParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& n oldType.getQualifier().centroid = newType.getQualifier().centroid; oldType.getQualifier().sample = newType.getQualifier().sample; oldType.getQualifier().invariant = newType.getQualifier().invariant; + oldType.getQualifier().noContraction = newType.getQualifier().noContraction; oldType.getQualifier().smooth = newType.getQualifier().smooth; oldType.getQualifier().flat = newType.getQualifier().flat; oldType.getQualifier().nopersp = newType.getQualifier().nopersp; @@ -3380,6 +3382,14 @@ void HlslParseContext::addQualifierToExisting(const TSourceLoc& loc, TQualifier if (intermediate.inIoAccessed(identifier)) error(loc, "cannot change qualification after use", "invariant", ""); symbol->getWritableType().getQualifier().invariant = true; + } else if (qualifier.noContraction) { + if (intermediate.inIoAccessed(identifier)) + error(loc, "cannot change qualification after use", "precise", ""); + symbol->getWritableType().getQualifier().noContraction = true; + } else if (qualifier.specConstant) { + symbol->getWritableType().getQualifier().makeSpecConstant(); + if (qualifier.hasSpecConstantId()) + symbol->getWritableType().getQualifier().layoutSpecConstantId = qualifier.layoutSpecConstantId; } else warn(loc, "unknown requalification", "", ""); } From 3c1e08057ee2384c266c8f09e18fc4fbc7de4ca6 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Wed, 4 May 2016 13:24:47 -0600 Subject: [PATCH 051/140] Front-end precise: Propagate noContraction up the AST when dereferencing structs. This should be the last commit in this sequence to form the base of the work in pull request #222. --- Test/baseResults/specExamples.vert.out | 20 ++++++++++---------- glslang/MachineIndependent/ParseHelper.cpp | 6 +++++- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Test/baseResults/specExamples.vert.out b/Test/baseResults/specExamples.vert.out index 5f798a7e..7de02d3d 100644 --- a/Test/baseResults/specExamples.vert.out +++ b/Test/baseResults/specExamples.vert.out @@ -110,7 +110,7 @@ ERROR: node is still EOpNull! 0:161 'c' (in 4-component vector of float) 0:161 'd' (in 4-component vector of float) 0:162 move second child to first child (temp 3-component vector of float) -0:162 vector swizzle (temp 3-component vector of float) +0:162 vector swizzle (noContraction temp 3-component vector of float) 0:162 'v' (noContraction smooth out 4-component vector of float) 0:162 Sequence 0:162 Constant: @@ -123,7 +123,7 @@ ERROR: node is still EOpNull! 0:162 'r' (temp 3-component vector of float) 0:162 's' (temp 3-component vector of float) 0:163 move second child to first child (temp float) -0:163 direct index (temp float) +0:163 direct index (noContraction temp float) 0:163 'v' (noContraction smooth out 4-component vector of float) 0:163 Constant: 0:163 3 (const int) @@ -147,7 +147,7 @@ ERROR: node is still EOpNull! 0:163 Constant: 0:163 3 (const int) 0:164 move second child to first child (temp float) -0:164 direct index (temp float) +0:164 direct index (noContraction temp float) 0:164 'v' (noContraction smooth out 4-component vector of float) 0:164 Constant: 0:164 0 (const int) @@ -169,7 +169,7 @@ ERROR: node is still EOpNull! 0:164 Constant: 0:164 0 (const int) 0:166 move second child to first child (temp float) -0:166 direct index (temp float) +0:166 direct index (noContraction temp float) 0:166 'v' (noContraction smooth out 4-component vector of float) 0:166 Constant: 0:166 0 (const int) @@ -209,7 +209,7 @@ ERROR: node is still EOpNull! 0:167 'd' (in 4-component vector of float) 0:167 Constant: 0:167 0 (const int) -0:167 direct index (temp float) +0:167 direct index (noContraction temp float) 0:167 'v' (noContraction smooth out 4-component vector of float) 0:167 Constant: 0:167 0 (const int) @@ -394,7 +394,7 @@ ERROR: node is still EOpNull! 0:161 'c' (in 4-component vector of float) 0:161 'd' (in 4-component vector of float) 0:162 move second child to first child (temp 3-component vector of float) -0:162 vector swizzle (temp 3-component vector of float) +0:162 vector swizzle (noContraction temp 3-component vector of float) 0:162 'v' (noContraction smooth out 4-component vector of float) 0:162 Sequence 0:162 Constant: @@ -407,7 +407,7 @@ ERROR: node is still EOpNull! 0:162 'r' (temp 3-component vector of float) 0:162 's' (temp 3-component vector of float) 0:163 move second child to first child (temp float) -0:163 direct index (temp float) +0:163 direct index (noContraction temp float) 0:163 'v' (noContraction smooth out 4-component vector of float) 0:163 Constant: 0:163 3 (const int) @@ -431,7 +431,7 @@ ERROR: node is still EOpNull! 0:163 Constant: 0:163 3 (const int) 0:164 move second child to first child (temp float) -0:164 direct index (temp float) +0:164 direct index (noContraction temp float) 0:164 'v' (noContraction smooth out 4-component vector of float) 0:164 Constant: 0:164 0 (const int) @@ -453,7 +453,7 @@ ERROR: node is still EOpNull! 0:164 Constant: 0:164 0 (const int) 0:166 move second child to first child (temp float) -0:166 direct index (temp float) +0:166 direct index (noContraction temp float) 0:166 'v' (noContraction smooth out 4-component vector of float) 0:166 Constant: 0:166 0 (const int) @@ -493,7 +493,7 @@ ERROR: node is still EOpNull! 0:167 'd' (in 4-component vector of float) 0:167 Constant: 0:167 0 (const int) -0:167 direct index (temp float) +0:167 direct index (noContraction temp float) 0:167 'v' (noContraction smooth out 4-component vector of float) 0:167 Constant: 0:167 0 (const int) diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 12b7fab7..3373d2f3 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -781,7 +781,7 @@ TIntermTyped* TParseContext::handleDotDereference(const TSourceLoc& loc, TInterm // // .length() can't be resolved until we later see the function-calling syntax. - // Save away the name in the AST for now. Processing is compeleted in + // Save away the name in the AST for now. Processing is completed in // handleLengthMethod(). // if (field == "length") { @@ -879,6 +879,10 @@ TIntermTyped* TParseContext::handleDotDereference(const TSourceLoc& loc, TInterm } 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; + return result; } From 3f460532cc4cc7410c2411f92fb216f074d1f379 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 4 May 2016 17:01:36 -0400 Subject: [PATCH 052/140] Remove duplicated cmake_minimum_required() calls. --- OGLCompilersDLL/CMakeLists.txt | 2 -- SPIRV/CMakeLists.txt | 2 -- StandAlone/CMakeLists.txt | 2 -- glslang/CMakeLists.txt | 2 -- glslang/OSDependent/Unix/CMakeLists.txt | 4 ---- glslang/OSDependent/Windows/CMakeLists.txt | 2 -- hlsl/CMakeLists.txt | 2 -- 7 files changed, 16 deletions(-) diff --git a/OGLCompilersDLL/CMakeLists.txt b/OGLCompilersDLL/CMakeLists.txt index 60fb93b6..14afbd90 100644 --- a/OGLCompilersDLL/CMakeLists.txt +++ b/OGLCompilersDLL/CMakeLists.txt @@ -1,5 +1,3 @@ -cmake_minimum_required(VERSION 2.8) - set(SOURCES InitializeDll.cpp InitializeDll.h) add_library(OGLCompiler STATIC ${SOURCES}) diff --git a/SPIRV/CMakeLists.txt b/SPIRV/CMakeLists.txt index 50cda686..88d89da0 100755 --- a/SPIRV/CMakeLists.txt +++ b/SPIRV/CMakeLists.txt @@ -1,5 +1,3 @@ -cmake_minimum_required(VERSION 2.8) - set(SOURCES GlslangToSpv.cpp InReadableOrder.cpp diff --git a/StandAlone/CMakeLists.txt b/StandAlone/CMakeLists.txt index e9d72110..e02a465f 100644 --- a/StandAlone/CMakeLists.txt +++ b/StandAlone/CMakeLists.txt @@ -1,5 +1,3 @@ -cmake_minimum_required(VERSION 2.8) - add_library(glslang-default-resource-limits ${CMAKE_CURRENT_SOURCE_DIR}/DefaultResourceLimits.cpp ) diff --git a/glslang/CMakeLists.txt b/glslang/CMakeLists.txt index b6c70c46..52c781a8 100644 --- a/glslang/CMakeLists.txt +++ b/glslang/CMakeLists.txt @@ -1,5 +1,3 @@ -cmake_minimum_required(VERSION 2.8) - if(WIN32) add_subdirectory(OSDependent/Windows) elseif(UNIX) diff --git a/glslang/OSDependent/Unix/CMakeLists.txt b/glslang/OSDependent/Unix/CMakeLists.txt index 319c70cc..f4d1b425 100644 --- a/glslang/OSDependent/Unix/CMakeLists.txt +++ b/glslang/OSDependent/Unix/CMakeLists.txt @@ -1,7 +1,3 @@ - - -cmake_minimum_required(VERSION 2.8) - add_library(OSDependent STATIC ossource.cpp ../osinclude.h) install(TARGETS OSDependent diff --git a/glslang/OSDependent/Windows/CMakeLists.txt b/glslang/OSDependent/Windows/CMakeLists.txt index 9bc73a37..2df014cc 100644 --- a/glslang/OSDependent/Windows/CMakeLists.txt +++ b/glslang/OSDependent/Windows/CMakeLists.txt @@ -1,5 +1,3 @@ -cmake_minimum_required(VERSION 2.8) - set(SOURCES ossource.cpp ../osinclude.h) add_library(OSDependent STATIC ${SOURCES}) diff --git a/hlsl/CMakeLists.txt b/hlsl/CMakeLists.txt index 6dd84fa3..e4a0bd32 100755 --- a/hlsl/CMakeLists.txt +++ b/hlsl/CMakeLists.txt @@ -1,5 +1,3 @@ -cmake_minimum_required(VERSION 2.8) - set(SOURCES hlslParseHelper.cpp hlslScanContext.cpp From 574ab04caa0d643cccdcb8f133579a308d17a62d Mon Sep 17 00:00:00 2001 From: Rex Xu Date: Thu, 14 Apr 2016 16:53:07 +0800 Subject: [PATCH 053/140] Implement the extension GL_ARB_shader_ballot Add new built-in variables and functions to the parser (SPIR-V tokens are missing). --- SPIRV/GlslangToSpv.cpp | 23 +- Test/baseResults/spv.shaderBallot.comp.out | 345 +++++++++++++++++++++ Test/spv.shaderBallot.comp | 59 ++++ Test/test-spirv-list | 1 + glslang/Include/BaseTypes.h | 14 + glslang/Include/intermediate.h | 4 + glslang/MachineIndependent/Initialize.cpp | 88 +++++- glslang/MachineIndependent/Versions.cpp | 2 + glslang/MachineIndependent/Versions.h | 1 + glslang/MachineIndependent/intermOut.cpp | 5 + gtests/Spv.FromFile.cpp | 1 + 11 files changed, 537 insertions(+), 6 deletions(-) create mode 100644 Test/baseResults/spv.shaderBallot.comp.out create mode 100644 Test/spv.shaderBallot.comp diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 0c62d52e..62383cc1 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -433,7 +433,7 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI case glslang::EbvBaseInstance: case glslang::EbvDrawId: // TODO: Add SPIR-V builtin ID. - spv::MissingFunctionality("Draw parameters"); + spv::MissingFunctionality("shader draw parameters"); return (spv::BuiltIn)spv::BadValue; case glslang::EbvPrimitiveId: return spv::BuiltInPrimitiveId; case glslang::EbvInvocationId: return spv::BuiltInInvocationId; @@ -453,6 +453,16 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI case glslang::EbvLocalInvocationId: return spv::BuiltInLocalInvocationId; case glslang::EbvLocalInvocationIndex: return spv::BuiltInLocalInvocationIndex; case glslang::EbvGlobalInvocationId: return spv::BuiltInGlobalInvocationId; + case glslang::EbvSubGroupSize: + case glslang::EbvSubGroupInvocation: + case glslang::EbvSubGroupEqMask: + case glslang::EbvSubGroupGeMask: + case glslang::EbvSubGroupGtMask: + case glslang::EbvSubGroupLeMask: + case glslang::EbvSubGroupLtMask: + // TODO: Add SPIR-V builtin ID. + spv::MissingFunctionality("shader ballot"); + return (spv::BuiltIn)spv::BadValue; default: return (spv::BuiltIn)spv::BadValue; } } @@ -3234,6 +3244,12 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv: libCall = spv::GLSLstd450FindSMsb; break; + case glslang::EOpBallot: + case glslang::EOpReadFirstInvocation: + spv::MissingFunctionality("shader ballot"); + libCall = spv::GLSLstd450Bad; + break; + default: return 0; } @@ -3687,6 +3703,11 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: libCall = spv::GLSLstd450Ldexp; break; + case glslang::EOpReadInvocation: + spv::MissingFunctionality("shader ballot"); + libCall = spv::GLSLstd450Bad; + break; + default: return 0; } diff --git a/Test/baseResults/spv.shaderBallot.comp.out b/Test/baseResults/spv.shaderBallot.comp.out new file mode 100644 index 00000000..51ddc63d --- /dev/null +++ b/Test/baseResults/spv.shaderBallot.comp.out @@ -0,0 +1,345 @@ +spv.shaderBallot.comp +Warning, version 450 is not yet complete; most version-specific features are present, but some are missing. + + +Linked compute stage: + + +Missing functionality: shader ballot +Missing functionality: shader ballot +Missing functionality: shader ballot +Missing functionality: shader ballot +Missing functionality: shader ballot +Missing functionality: shader ballot +Missing functionality: shader ballot +Missing functionality: shader ballot +Missing functionality: shader ballot +Missing functionality: shader ballot +Missing functionality: shader ballot +Missing functionality: shader ballot +Missing functionality: shader ballot +Missing functionality: shader ballot +Missing functionality: shader ballot +Missing functionality: shader ballot +Missing functionality: shader ballot +Missing functionality: shader ballot +Missing functionality: shader ballot +Missing functionality: shader ballot +Missing functionality: shader ballot +Missing functionality: shader ballot +Missing functionality: shader ballot +Missing functionality: shader ballot +Missing functionality: shader ballot +Missing functionality: shader ballot +Missing functionality: shader ballot +Missing functionality: shader ballot +Missing functionality: shader ballot +Missing functionality: shader ballot +Missing functionality: shader ballot +Missing functionality: shader ballot +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 241 + + Capability Shader + Capability Int64 + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" 10 22 24 27 30 33 + ExecutionMode 4 LocalSize 8 8 1 + Source GLSL 450 + SourceExtension "GL_ARB_gpu_shader_int64" + SourceExtension "GL_ARB_shader_ballot" + Name 4 "main" + Name 8 "invocation" + Name 10 "gl_SubGroupInvocationARB" + Name 13 "gl_SubGroupSizeARB" + Name 20 "relMask" + Name 22 "gl_SubGroupEqMaskARB" + Name 24 "gl_SubGroupGeMaskARB" + Name 27 "gl_SubGroupGtMaskARB" + Name 30 "gl_SubGroupLeMaskARB" + Name 33 "gl_SubGroupLtMaskARB" + Name 48 "Buffers" + MemberName 48(Buffers) 0 "f4" + MemberName 48(Buffers) 1 "i4" + MemberName 48(Buffers) 2 "u4" + Name 51 "data" + MemberDecorate 48(Buffers) 0 Offset 0 + MemberDecorate 48(Buffers) 1 Offset 16 + MemberDecorate 48(Buffers) 2 Offset 32 + Decorate 48(Buffers) BufferBlock + Decorate 51(data) DescriptorSet 0 + Decorate 51(data) Binding 0 + Decorate 240 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypePointer Function 6(int) + 9: TypePointer Input 6(int) +10(gl_SubGroupInvocationARB): 9(ptr) Variable Input + 12: TypePointer UniformConstant 6(int) +13(gl_SubGroupSizeARB): 12(ptr) Variable UniformConstant + 16: 6(int) Constant 4 + 18: TypeInt 64 0 + 19: TypePointer Function 18(int) + 21: TypePointer Input 18(int) +22(gl_SubGroupEqMaskARB): 21(ptr) Variable Input +24(gl_SubGroupGeMaskARB): 21(ptr) Variable Input +27(gl_SubGroupGtMaskARB): 21(ptr) Variable Input +30(gl_SubGroupLeMaskARB): 21(ptr) Variable Input +33(gl_SubGroupLtMaskARB): 21(ptr) Variable Input + 37: TypeBool + 38: 37(bool) ConstantTrue + 43: TypeFloat 32 + 44: TypeVector 43(float) 4 + 45: TypeInt 32 1 + 46: TypeVector 45(int) 4 + 47: TypeVector 6(int) 4 + 48(Buffers): TypeStruct 44(fvec4) 46(ivec4) 47(ivec4) + 49: TypeArray 48(Buffers) 16 + 50: TypePointer Uniform 49 + 51(data): 50(ptr) Variable Uniform + 53: 45(int) Constant 0 + 54: 6(int) Constant 0 + 55: TypePointer Uniform 43(float) + 62: 45(int) Constant 1 + 63: TypeVector 43(float) 2 + 64: TypePointer Uniform 44(fvec4) + 74: 45(int) Constant 2 + 75: TypeVector 43(float) 3 + 85: 45(int) Constant 3 + 92: TypePointer Uniform 45(int) + 99: TypeVector 45(int) 2 + 100: TypePointer Uniform 46(ivec4) + 110: TypeVector 45(int) 3 + 126: TypePointer Uniform 6(int) + 133: TypeVector 6(int) 2 + 134: TypePointer Uniform 47(ivec4) + 144: TypeVector 6(int) 3 + 238: 6(int) Constant 8 + 239: 6(int) Constant 1 + 240: 144(ivec3) ConstantComposite 238 238 239 + 4(main): 2 Function None 3 + 5: Label + 8(invocation): 7(ptr) Variable Function + 20(relMask): 19(ptr) Variable Function + 11: 6(int) Load 10(gl_SubGroupInvocationARB) + 14: 6(int) Load 13(gl_SubGroupSizeARB) + 15: 6(int) IAdd 11 14 + 17: 6(int) UMod 15 16 + Store 8(invocation) 17 + 23: 18(int) Load 22(gl_SubGroupEqMaskARB) + 25: 18(int) Load 24(gl_SubGroupGeMaskARB) + 26: 18(int) IAdd 23 25 + 28: 18(int) Load 27(gl_SubGroupGtMaskARB) + 29: 18(int) IAdd 26 28 + 31: 18(int) Load 30(gl_SubGroupLeMaskARB) + 32: 18(int) IAdd 29 31 + 34: 18(int) Load 33(gl_SubGroupLtMaskARB) + 35: 18(int) IAdd 32 34 + Store 20(relMask) 35 + 36: 18(int) Load 20(relMask) + 39: 18(int) ExtInst 1(GLSL.std.450) 0(Unknown) 38 + 40: 37(bool) IEqual 36 39 + SelectionMerge 42 None + BranchConditional 40 41 159 + 41: Label + 52: 6(int) Load 8(invocation) + 56: 55(ptr) AccessChain 51(data) 53 53 54 + 57: 43(float) Load 56 + 58: 6(int) Load 8(invocation) + 59: 43(float) ExtInst 1(GLSL.std.450) 0(Unknown) 57 58 + 60: 55(ptr) AccessChain 51(data) 52 53 54 + Store 60 59 + 61: 6(int) Load 8(invocation) + 65: 64(ptr) AccessChain 51(data) 62 53 + 66: 44(fvec4) Load 65 + 67: 63(fvec2) VectorShuffle 66 66 0 1 + 68: 6(int) Load 8(invocation) + 69: 63(fvec2) ExtInst 1(GLSL.std.450) 0(Unknown) 67 68 + 70: 64(ptr) AccessChain 51(data) 61 53 + 71: 44(fvec4) Load 70 + 72: 44(fvec4) VectorShuffle 71 69 4 5 2 3 + Store 70 72 + 73: 6(int) Load 8(invocation) + 76: 64(ptr) AccessChain 51(data) 74 53 + 77: 44(fvec4) Load 76 + 78: 75(fvec3) VectorShuffle 77 77 0 1 2 + 79: 6(int) Load 8(invocation) + 80: 75(fvec3) ExtInst 1(GLSL.std.450) 0(Unknown) 78 79 + 81: 64(ptr) AccessChain 51(data) 73 53 + 82: 44(fvec4) Load 81 + 83: 44(fvec4) VectorShuffle 82 80 4 5 6 3 + Store 81 83 + 84: 6(int) Load 8(invocation) + 86: 64(ptr) AccessChain 51(data) 85 53 + 87: 44(fvec4) Load 86 + 88: 6(int) Load 8(invocation) + 89: 44(fvec4) ExtInst 1(GLSL.std.450) 0(Unknown) 87 88 + 90: 64(ptr) AccessChain 51(data) 84 53 + Store 90 89 + 91: 6(int) Load 8(invocation) + 93: 92(ptr) AccessChain 51(data) 53 62 54 + 94: 45(int) Load 93 + 95: 6(int) Load 8(invocation) + 96: 45(int) ExtInst 1(GLSL.std.450) 0(Unknown) 94 95 + 97: 92(ptr) AccessChain 51(data) 91 62 54 + Store 97 96 + 98: 6(int) Load 8(invocation) + 101: 100(ptr) AccessChain 51(data) 62 62 + 102: 46(ivec4) Load 101 + 103: 99(ivec2) VectorShuffle 102 102 0 1 + 104: 6(int) Load 8(invocation) + 105: 99(ivec2) ExtInst 1(GLSL.std.450) 0(Unknown) 103 104 + 106: 100(ptr) AccessChain 51(data) 98 62 + 107: 46(ivec4) Load 106 + 108: 46(ivec4) VectorShuffle 107 105 4 5 2 3 + Store 106 108 + 109: 6(int) Load 8(invocation) + 111: 100(ptr) AccessChain 51(data) 74 62 + 112: 46(ivec4) Load 111 + 113: 110(ivec3) VectorShuffle 112 112 0 1 2 + 114: 6(int) Load 8(invocation) + 115: 110(ivec3) ExtInst 1(GLSL.std.450) 0(Unknown) 113 114 + 116: 100(ptr) AccessChain 51(data) 109 62 + 117: 46(ivec4) Load 116 + 118: 46(ivec4) VectorShuffle 117 115 4 5 6 3 + Store 116 118 + 119: 6(int) Load 8(invocation) + 120: 100(ptr) AccessChain 51(data) 85 62 + 121: 46(ivec4) Load 120 + 122: 6(int) Load 8(invocation) + 123: 46(ivec4) ExtInst 1(GLSL.std.450) 0(Unknown) 121 122 + 124: 100(ptr) AccessChain 51(data) 119 62 + Store 124 123 + 125: 6(int) Load 8(invocation) + 127: 126(ptr) AccessChain 51(data) 53 74 54 + 128: 6(int) Load 127 + 129: 6(int) Load 8(invocation) + 130: 6(int) ExtInst 1(GLSL.std.450) 0(Unknown) 128 129 + 131: 126(ptr) AccessChain 51(data) 125 74 54 + Store 131 130 + 132: 6(int) Load 8(invocation) + 135: 134(ptr) AccessChain 51(data) 62 74 + 136: 47(ivec4) Load 135 + 137: 133(ivec2) VectorShuffle 136 136 0 1 + 138: 6(int) Load 8(invocation) + 139: 133(ivec2) ExtInst 1(GLSL.std.450) 0(Unknown) 137 138 + 140: 134(ptr) AccessChain 51(data) 132 74 + 141: 47(ivec4) Load 140 + 142: 47(ivec4) VectorShuffle 141 139 4 5 2 3 + Store 140 142 + 143: 6(int) Load 8(invocation) + 145: 134(ptr) AccessChain 51(data) 74 74 + 146: 47(ivec4) Load 145 + 147: 144(ivec3) VectorShuffle 146 146 0 1 2 + 148: 6(int) Load 8(invocation) + 149: 144(ivec3) ExtInst 1(GLSL.std.450) 0(Unknown) 147 148 + 150: 134(ptr) AccessChain 51(data) 143 74 + 151: 47(ivec4) Load 150 + 152: 47(ivec4) VectorShuffle 151 149 4 5 6 3 + Store 150 152 + 153: 6(int) Load 8(invocation) + 154: 134(ptr) AccessChain 51(data) 85 74 + 155: 47(ivec4) Load 154 + 156: 6(int) Load 8(invocation) + 157: 47(ivec4) ExtInst 1(GLSL.std.450) 0(Unknown) 155 156 + 158: 134(ptr) AccessChain 51(data) 153 74 + Store 158 157 + Branch 42 + 159: Label + 160: 6(int) Load 8(invocation) + 161: 55(ptr) AccessChain 51(data) 53 53 54 + 162: 43(float) Load 161 + 163: 43(float) ExtInst 1(GLSL.std.450) 0(Unknown) 162 + 164: 55(ptr) AccessChain 51(data) 160 53 54 + Store 164 163 + 165: 6(int) Load 8(invocation) + 166: 64(ptr) AccessChain 51(data) 62 53 + 167: 44(fvec4) Load 166 + 168: 63(fvec2) VectorShuffle 167 167 0 1 + 169: 63(fvec2) ExtInst 1(GLSL.std.450) 0(Unknown) 168 + 170: 64(ptr) AccessChain 51(data) 165 53 + 171: 44(fvec4) Load 170 + 172: 44(fvec4) VectorShuffle 171 169 4 5 2 3 + Store 170 172 + 173: 6(int) Load 8(invocation) + 174: 64(ptr) AccessChain 51(data) 74 53 + 175: 44(fvec4) Load 174 + 176: 75(fvec3) VectorShuffle 175 175 0 1 2 + 177: 75(fvec3) ExtInst 1(GLSL.std.450) 0(Unknown) 176 + 178: 64(ptr) AccessChain 51(data) 173 53 + 179: 44(fvec4) Load 178 + 180: 44(fvec4) VectorShuffle 179 177 4 5 6 3 + Store 178 180 + 181: 6(int) Load 8(invocation) + 182: 64(ptr) AccessChain 51(data) 85 53 + 183: 44(fvec4) Load 182 + 184: 44(fvec4) ExtInst 1(GLSL.std.450) 0(Unknown) 183 + 185: 64(ptr) AccessChain 51(data) 181 53 + Store 185 184 + 186: 6(int) Load 8(invocation) + 187: 92(ptr) AccessChain 51(data) 53 62 54 + 188: 45(int) Load 187 + 189: 45(int) ExtInst 1(GLSL.std.450) 0(Unknown) 188 + 190: 92(ptr) AccessChain 51(data) 186 62 54 + Store 190 189 + 191: 6(int) Load 8(invocation) + 192: 100(ptr) AccessChain 51(data) 62 62 + 193: 46(ivec4) Load 192 + 194: 99(ivec2) VectorShuffle 193 193 0 1 + 195: 99(ivec2) ExtInst 1(GLSL.std.450) 0(Unknown) 194 + 196: 100(ptr) AccessChain 51(data) 191 62 + 197: 46(ivec4) Load 196 + 198: 46(ivec4) VectorShuffle 197 195 4 5 2 3 + Store 196 198 + 199: 6(int) Load 8(invocation) + 200: 100(ptr) AccessChain 51(data) 74 62 + 201: 46(ivec4) Load 200 + 202: 110(ivec3) VectorShuffle 201 201 0 1 2 + 203: 110(ivec3) ExtInst 1(GLSL.std.450) 0(Unknown) 202 + 204: 100(ptr) AccessChain 51(data) 199 62 + 205: 46(ivec4) Load 204 + 206: 46(ivec4) VectorShuffle 205 203 4 5 6 3 + Store 204 206 + 207: 6(int) Load 8(invocation) + 208: 100(ptr) AccessChain 51(data) 85 62 + 209: 46(ivec4) Load 208 + 210: 46(ivec4) ExtInst 1(GLSL.std.450) 0(Unknown) 209 + 211: 100(ptr) AccessChain 51(data) 207 62 + Store 211 210 + 212: 6(int) Load 8(invocation) + 213: 126(ptr) AccessChain 51(data) 53 74 54 + 214: 6(int) Load 213 + 215: 6(int) ExtInst 1(GLSL.std.450) 0(Unknown) 214 + 216: 126(ptr) AccessChain 51(data) 212 74 54 + Store 216 215 + 217: 6(int) Load 8(invocation) + 218: 134(ptr) AccessChain 51(data) 62 74 + 219: 47(ivec4) Load 218 + 220: 133(ivec2) VectorShuffle 219 219 0 1 + 221: 133(ivec2) ExtInst 1(GLSL.std.450) 0(Unknown) 220 + 222: 134(ptr) AccessChain 51(data) 217 74 + 223: 47(ivec4) Load 222 + 224: 47(ivec4) VectorShuffle 223 221 4 5 2 3 + Store 222 224 + 225: 6(int) Load 8(invocation) + 226: 134(ptr) AccessChain 51(data) 74 74 + 227: 47(ivec4) Load 226 + 228: 144(ivec3) VectorShuffle 227 227 0 1 2 + 229: 144(ivec3) ExtInst 1(GLSL.std.450) 0(Unknown) 228 + 230: 134(ptr) AccessChain 51(data) 225 74 + 231: 47(ivec4) Load 230 + 232: 47(ivec4) VectorShuffle 231 229 4 5 6 3 + Store 230 232 + 233: 6(int) Load 8(invocation) + 234: 134(ptr) AccessChain 51(data) 85 74 + 235: 47(ivec4) Load 234 + 236: 47(ivec4) ExtInst 1(GLSL.std.450) 0(Unknown) 235 + 237: 134(ptr) AccessChain 51(data) 233 74 + Store 237 236 + Branch 42 + 42: Label + Return + FunctionEnd diff --git a/Test/spv.shaderBallot.comp b/Test/spv.shaderBallot.comp new file mode 100644 index 00000000..20059b1c --- /dev/null +++ b/Test/spv.shaderBallot.comp @@ -0,0 +1,59 @@ +#version 450 + +#extension GL_ARB_gpu_shader_int64: enable +#extension GL_ARB_shader_ballot: enable + +layout (local_size_x = 8, local_size_y = 8, local_size_z = 1) in; + +layout(binding = 0) buffer Buffers +{ + vec4 f4; + ivec4 i4; + uvec4 u4; +} data[4]; + +void main() +{ + uint invocation = (gl_SubGroupInvocationARB + gl_SubGroupSizeARB) % 4; + + uint64_t relMask = gl_SubGroupEqMaskARB + + gl_SubGroupGeMaskARB + + gl_SubGroupGtMaskARB + + gl_SubGroupLeMaskARB + + gl_SubGroupLtMaskARB; + + if (relMask == ballotARB(true)) + { + data[invocation].f4.x = readInvocationARB(data[0].f4.x, invocation); + data[invocation].f4.xy = readInvocationARB(data[1].f4.xy, invocation); + data[invocation].f4.xyz = readInvocationARB(data[2].f4.xyz, invocation); + data[invocation].f4 = readInvocationARB(data[3].f4, invocation); + + data[invocation].i4.x = readInvocationARB(data[0].i4.x, invocation); + data[invocation].i4.xy = readInvocationARB(data[1].i4.xy, invocation); + data[invocation].i4.xyz = readInvocationARB(data[2].i4.xyz, invocation); + data[invocation].i4 = readInvocationARB(data[3].i4, invocation); + + data[invocation].u4.x = readInvocationARB(data[0].u4.x, invocation); + data[invocation].u4.xy = readInvocationARB(data[1].u4.xy, invocation); + data[invocation].u4.xyz = readInvocationARB(data[2].u4.xyz, invocation); + data[invocation].u4 = readInvocationARB(data[3].u4, invocation); + } + else + { + data[invocation].f4.x = readFirstInvocationARB(data[0].f4.x); + data[invocation].f4.xy = readFirstInvocationARB(data[1].f4.xy); + data[invocation].f4.xyz = readFirstInvocationARB(data[2].f4.xyz); + data[invocation].f4 = readFirstInvocationARB(data[3].f4); + + data[invocation].i4.x = readFirstInvocationARB(data[0].i4.x); + data[invocation].i4.xy = readFirstInvocationARB(data[1].i4.xy); + data[invocation].i4.xyz = readFirstInvocationARB(data[2].i4.xyz); + data[invocation].i4 = readFirstInvocationARB(data[3].i4); + + data[invocation].u4.x = readFirstInvocationARB(data[0].u4.x); + data[invocation].u4.xy = readFirstInvocationARB(data[1].u4.xy); + data[invocation].u4.xyz = readFirstInvocationARB(data[2].u4.xyz); + data[invocation].u4 = readFirstInvocationARB(data[3].u4); + } +} \ No newline at end of file diff --git a/Test/test-spirv-list b/Test/test-spirv-list index dfc6db7b..5167b13c 100644 --- a/Test/test-spirv-list +++ b/Test/test-spirv-list @@ -72,6 +72,7 @@ spv.intOps.vert spv.precision.frag spv.prepost.frag spv.qualifiers.vert +spv.shaderBallot.comp spv.shiftOps.frag spv.simpleFunctionCall.frag spv.simpleMat.vert diff --git a/glslang/Include/BaseTypes.h b/glslang/Include/BaseTypes.h index ff4b560c..2c275772 100644 --- a/glslang/Include/BaseTypes.h +++ b/glslang/Include/BaseTypes.h @@ -130,6 +130,13 @@ enum TBuiltInVariable { EbvLocalInvocationId, EbvGlobalInvocationId, EbvLocalInvocationIndex, + EbvSubGroupSize, + EbvSubGroupInvocation, + EbvSubGroupEqMask, + EbvSubGroupGeMask, + EbvSubGroupGtMask, + EbvSubGroupLeMask, + EbvSubGroupLtMask, EbvVertexId, EbvInstanceId, EbvVertexIndex, @@ -223,6 +230,13 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v) case EbvLocalInvocationId: return "LocalInvocationID"; case EbvGlobalInvocationId: return "GlobalInvocationID"; case EbvLocalInvocationIndex: return "LocalInvocationIndex"; + case EbvSubGroupSize: return "SubGroupSize"; + case EbvSubGroupInvocation: return "SubGroupInvocation"; + case EbvSubGroupEqMask: return "SubGroupEqMask"; + case EbvSubGroupGeMask: return "SubGroupGeMask"; + case EbvSubGroupGtMask: return "SubGroupGtMask"; + case EbvSubGroupLeMask: return "SubGroupLeMask"; + case EbvSubGroupLtMask: return "SubGroupLtMask"; case EbvVertexId: return "VertexId"; case EbvInstanceId: return "InstanceId"; case EbvVertexIndex: return "VertexIndex"; diff --git a/glslang/Include/intermediate.h b/glslang/Include/intermediate.h index 1dd55a7b..ef2547a7 100644 --- a/glslang/Include/intermediate.h +++ b/glslang/Include/intermediate.h @@ -283,6 +283,10 @@ enum TOperator { EOpMemoryBarrierShared, // compute only EOpGroupMemoryBarrier, // compute only + EOpBallot, + EOpReadInvocation, + EOpReadFirstInvocation, + EOpAtomicAdd, EOpAtomicMin, EOpAtomicMax, diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp index 0b27ddd9..ac9dfc79 100644 --- a/glslang/MachineIndependent/Initialize.cpp +++ b/glslang/MachineIndependent/Initialize.cpp @@ -1325,6 +1325,44 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan) "\n"); } + // GL_ARB_shader_ballot + if (profile != EEsProfile && version >= 450) { + commonBuiltins.append( + "uint64_t ballotARB(bool);" + + "float readInvocationARB(float, uint);" + "vec2 readInvocationARB(vec2, uint);" + "vec3 readInvocationARB(vec3, uint);" + "vec4 readInvocationARB(vec4, uint);" + + "int readInvocationARB(int, uint);" + "ivec2 readInvocationARB(ivec2, uint);" + "ivec3 readInvocationARB(ivec3, uint);" + "ivec4 readInvocationARB(ivec4, uint);" + + "uint readInvocationARB(uint, uint);" + "uvec2 readInvocationARB(uvec2, uint);" + "uvec3 readInvocationARB(uvec3, uint);" + "uvec4 readInvocationARB(uvec4, uint);" + + "float readFirstInvocationARB(float);" + "vec2 readFirstInvocationARB(vec2);" + "vec3 readFirstInvocationARB(vec3);" + "vec4 readFirstInvocationARB(vec4);" + + "int readFirstInvocationARB(int);" + "ivec2 readFirstInvocationARB(ivec2);" + "ivec3 readFirstInvocationARB(ivec3);" + "ivec4 readFirstInvocationARB(ivec4);" + + "uint readFirstInvocationARB(uint);" + "uvec2 readFirstInvocationARB(uvec2);" + "uvec3 readFirstInvocationARB(uvec3);" + "uvec4 readFirstInvocationARB(uvec4);" + + "\n"); + } + //============================================================================ // // Prototypes for built-in functions seen by vertex shaders only. @@ -2232,6 +2270,21 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan) if (version >= 130) add2ndGenerationSamplingImaging(version, profile, spv, vulkan); + // GL_ARB_shader_ballot + if (profile != EEsProfile && version >= 450) { + commonBuiltins.append( + "uniform uint gl_SubGroupSizeARB;" + + "in uint gl_SubGroupInvocationARB;" + "in uint64_t gl_SubGroupEqMaskARB;" + "in uint64_t gl_SubGroupGeMaskARB;" + "in uint64_t gl_SubGroupGtMaskARB;" + "in uint64_t gl_SubGroupLeMaskARB;" + "in uint64_t gl_SubGroupLtMaskARB;" + + "\n"); + } + //printf("%s\n", commonBuiltins.c_str()); //printf("%s\n", stageBuiltins[EShLangFragment].c_str()); } @@ -3394,7 +3447,7 @@ void IdentifyBuiltIns(int version, EProfile profile, int spv, int vulkan, EShLan switch(language) { case EShLangVertex: - if (profile != EEsProfile && version >= 440) { + if (profile != EEsProfile) { symbolTable.setVariableExtensions("gl_BaseVertexARB", 1, &E_GL_ARB_shader_draw_parameters); symbolTable.setVariableExtensions("gl_BaseInstanceARB", 1, &E_GL_ARB_shader_draw_parameters); symbolTable.setVariableExtensions("gl_DrawIDARB", 1, &E_GL_ARB_shader_draw_parameters); @@ -3404,6 +3457,28 @@ void IdentifyBuiltIns(int version, EProfile profile, int spv, int vulkan, EShLan BuiltInVariable("gl_DrawIDARB", EbvDrawId, symbolTable); } + if (profile != EEsProfile) { + symbolTable.setVariableExtensions("gl_SubGroupSizeARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupInvocationARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupEqMaskARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupGeMaskARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupGtMaskARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupLeMaskARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupLtMaskARB", 1, &E_GL_ARB_shader_ballot); + + symbolTable.setFunctionExtensions("ballotARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setFunctionExtensions("readInvocationARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setFunctionExtensions("readFirstInvocationARB", 1, &E_GL_ARB_shader_ballot); + + BuiltInVariable("gl_SubGroupSizeARB", EbvSubGroupSize, symbolTable); + BuiltInVariable("gl_SubGroupInvocationARB", EbvSubGroupInvocation, symbolTable); + BuiltInVariable("gl_SubGroupEqMaskARB", EbvSubGroupEqMask, symbolTable); + BuiltInVariable("gl_SubGroupGeMaskARB", EbvSubGroupGeMask, symbolTable); + BuiltInVariable("gl_SubGroupGtMaskARB", EbvSubGroupGtMask, symbolTable); + BuiltInVariable("gl_SubGroupLeMaskARB", EbvSubGroupLeMask, symbolTable); + BuiltInVariable("gl_SubGroupLtMaskARB", EbvSubGroupLtMask, symbolTable); + } + // Compatibility variables, vertex only if (spv == 0) { BuiltInVariable("gl_Color", EbvColor, symbolTable); @@ -3963,8 +4038,7 @@ void IdentifyBuiltIns(int version, EProfile profile, int spv, int vulkan, EShLan symbolTable.relateToOperator("shadow2DProjLod", EOpTextureProjLod); } - if (profile != EEsProfile) - { + if (profile != EEsProfile) { symbolTable.relateToOperator("sparseTextureARB", EOpSparseTexture); symbolTable.relateToOperator("sparseTextureLodARB", EOpSparseTextureLod); symbolTable.relateToOperator("sparseTextureOffsetARB", EOpSparseTextureOffset); @@ -3987,6 +4061,10 @@ void IdentifyBuiltIns(int version, EProfile profile, int spv, int vulkan, EShLan symbolTable.relateToOperator("textureOffsetClampARB", EOpTextureOffsetClamp); symbolTable.relateToOperator("textureGradClampARB", EOpTextureGradClamp); symbolTable.relateToOperator("textureGradOffsetClampARB", EOpTextureGradOffsetClamp); + + symbolTable.relateToOperator("ballotARB", EOpBallot); + symbolTable.relateToOperator("readInvocationARB", EOpReadInvocation); + symbolTable.relateToOperator("readFirstInvocationARB", EOpReadFirstInvocation); } } @@ -4023,8 +4101,8 @@ void IdentifyBuiltIns(int version, EProfile profile, int spv, int vulkan, EShLan break; case EShLangCompute: - symbolTable.relateToOperator("memoryBarrierShared", EOpMemoryBarrierShared); - symbolTable.relateToOperator("groupMemoryBarrier", EOpGroupMemoryBarrier); + symbolTable.relateToOperator("memoryBarrierShared", EOpMemoryBarrierShared); + symbolTable.relateToOperator("groupMemoryBarrier", EOpGroupMemoryBarrier); break; default: diff --git a/glslang/MachineIndependent/Versions.cpp b/glslang/MachineIndependent/Versions.cpp index 911535af..42eca96d 100644 --- a/glslang/MachineIndependent/Versions.cpp +++ b/glslang/MachineIndependent/Versions.cpp @@ -176,6 +176,7 @@ void TParseVersions::initializeExtensionBehavior() extensionBehavior[E_GL_ARB_viewport_array] = EBhDisable; extensionBehavior[E_GL_ARB_gpu_shader_int64] = EBhDisable; extensionBehavior[E_GL_ARB_gl_spirv] = EBhDisable; + extensionBehavior[E_GL_ARB_shader_ballot] = EBhDisable; extensionBehavior[E_GL_ARB_sparse_texture2] = EBhDisable; extensionBehavior[E_GL_ARB_sparse_texture_clamp] = EBhDisable; // extensionBehavior[E_GL_ARB_cull_distance] = EBhDisable; // present for 4.5, but need extension control over block members @@ -277,6 +278,7 @@ void TParseVersions::getPreamble(std::string& preamble) "#define GL_ARB_viewport_array 1\n" "#define GL_ARB_gpu_shader_int64 1\n" "#define GL_ARB_gl_spirv 1\n" + "#define GL_ARB_shader_ballot 1\n" "#define GL_ARB_sparse_texture2 1\n" "#define GL_ARB_sparse_texture_clamp 1\n" // "#define GL_ARB_cull_distance 1\n" // present for 4.5, but need extension control over block members diff --git a/glslang/MachineIndependent/Versions.h b/glslang/MachineIndependent/Versions.h index 779ba9f2..93db6c3e 100644 --- a/glslang/MachineIndependent/Versions.h +++ b/glslang/MachineIndependent/Versions.h @@ -113,6 +113,7 @@ const char* const E_GL_ARB_shader_texture_image_samples = "GL_ARB_shader_texture const char* const E_GL_ARB_viewport_array = "GL_ARB_viewport_array"; const char* const E_GL_ARB_gpu_shader_int64 = "GL_ARB_gpu_shader_int64"; const char* const E_GL_ARB_gl_spirv = "GL_ARB_gl_spirv"; +const char* const E_GL_ARB_shader_ballot = "GL_ARB_shader_ballot"; const char* const E_GL_ARB_sparse_texture2 = "GL_ARB_sparse_texture2"; const char* const E_GL_ARB_sparse_texture_clamp = "GL_ARB_sparse_texture_clamp"; //const char* const E_GL_ARB_cull_distance = "GL_ARB_cull_distance"; // present for 4.5, but need extension control over block members diff --git a/glslang/MachineIndependent/intermOut.cpp b/glslang/MachineIndependent/intermOut.cpp index 82e71600..4a7ee653 100644 --- a/glslang/MachineIndependent/intermOut.cpp +++ b/glslang/MachineIndependent/intermOut.cpp @@ -351,6 +351,9 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node) case EOpNoise: out.debug << "noise"; break; + case EOpBallot: out.debug << "ballot"; break; + case EOpReadFirstInvocation: out.debug << "readFirstInvocation"; break; + default: out.debug.message(EPrefixError, "Bad unary op"); } @@ -466,6 +469,8 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node case EOpMemoryBarrierShared: out.debug << "MemoryBarrierShared"; break; case EOpGroupMemoryBarrier: out.debug << "GroupMemoryBarrier"; break; + case EOpReadInvocation: out.debug << "readInvocation"; break; + case EOpAtomicAdd: out.debug << "AtomicAdd"; break; case EOpAtomicMin: out.debug << "AtomicMin"; break; case EOpAtomicMax: out.debug << "AtomicMax"; break; diff --git a/gtests/Spv.FromFile.cpp b/gtests/Spv.FromFile.cpp index e5040b22..e3595446 100644 --- a/gtests/Spv.FromFile.cpp +++ b/gtests/Spv.FromFile.cpp @@ -138,6 +138,7 @@ INSTANTIATE_TEST_CASE_P( "spv.precision.frag", "spv.prepost.frag", "spv.qualifiers.vert", + "spv.shaderBallot.comp", "spv.shiftOps.frag", "spv.simpleFunctionCall.frag", "spv.simpleMat.vert", From 338b185a2b2d2887ba8e8d7b742e714b366bc488 Mon Sep 17 00:00:00 2001 From: Rex Xu Date: Thu, 5 May 2016 20:38:33 +0800 Subject: [PATCH 054/140] Implement the extension GL_ARB_shader_group_vote. --- SPIRV/GlslangToSpv.cpp | 35 ++++++++- Test/baseResults/spv.shaderGroupVote.comp.out | 71 +++++++++++++++++++ Test/spv.shaderGroupVote.comp | 21 ++++++ Test/test-spirv-list | 1 + glslang/Include/intermediate.h | 4 ++ glslang/MachineIndependent/Initialize.cpp | 22 +++++- glslang/MachineIndependent/Versions.cpp | 2 + glslang/MachineIndependent/Versions.h | 1 + glslang/MachineIndependent/intermOut.cpp | 4 ++ gtests/Spv.FromFile.cpp | 1 + 10 files changed, 159 insertions(+), 3 deletions(-) create mode 100644 Test/baseResults/spv.shaderGroupVote.comp.out create mode 100644 Test/spv.shaderGroupVote.comp diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 0c62d52e..ea6b2b46 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -3234,6 +3234,18 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv: libCall = spv::GLSLstd450FindSMsb; break; + case glslang::EOpAnyInvocation: + builder.addCapability(spv::CapabilityGroups); + unaryOp = spv::OpGroupAny; + break; + case glslang::EOpAllInvocations: + builder.addCapability(spv::CapabilityGroups); + unaryOp = spv::OpGroupAll; + break; + case glslang::EOpAllInvocationsEqual: + builder.addCapability(spv::CapabilityGroups); + break; + default: return 0; } @@ -3243,8 +3255,27 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv: std::vector args; args.push_back(operand); id = builder.createBuiltinCall(typeId, stdBuiltins, libCall, args); - } else - id = builder.createUnaryOp(unaryOp, typeId, operand); + } else { + if (op == glslang::EOpAnyInvocation || op == glslang::EOpAllInvocations || op == glslang::EOpAllInvocationsEqual) { + std::vector operands; + operands.push_back(builder.makeUintConstant(spv::ScopeSubgroup)); + operands.push_back(operand); + + if (op == glslang::EOpAnyInvocation || op == glslang::EOpAllInvocations) + id = builder.createOp(unaryOp, typeId, operands); + else if (op == glslang::EOpAllInvocationsEqual) { + spv::Id groupAll = builder.createOp(spv::OpGroupAll, typeId, operands); + spv::Id groupAny = builder.createOp(spv::OpGroupAny, typeId, operands); + + id = builder.createBinOp(spv::OpLogicalOr, + typeId, + groupAll, + builder.createUnaryOp(spv::OpLogicalNot, typeId, groupAny)); + } + } + else + id = builder.createUnaryOp(unaryOp, typeId, operand); + } return builder.setPrecision(id, precision); } diff --git a/Test/baseResults/spv.shaderGroupVote.comp.out b/Test/baseResults/spv.shaderGroupVote.comp.out new file mode 100644 index 00000000..e63164d0 --- /dev/null +++ b/Test/baseResults/spv.shaderGroupVote.comp.out @@ -0,0 +1,71 @@ +spv.shaderGroupVote.comp +Warning, version 450 is not yet complete; most version-specific features are present, but some are missing. + + +Linked compute stage: + + +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 37 + + Capability Shader + Capability Groups + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" + ExecutionMode 4 LocalSize 4 4 1 + Source GLSL 450 + SourceExtension "GL_ARB_shader_group_vote" + Name 4 "main" + Name 8 "b1" + Name 10 "Buffers" + MemberName 10(Buffers) 0 "b" + Name 12 "" + MemberDecorate 10(Buffers) 0 Offset 0 + Decorate 10(Buffers) BufferBlock + Decorate 12 DescriptorSet 0 + Decorate 12 Binding 0 + Decorate 36 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeBool + 7: TypePointer Function 6(bool) + 9: TypeInt 32 0 + 10(Buffers): TypeStruct 9(int) + 11: TypePointer Uniform 10(Buffers) + 12: 11(ptr) Variable Uniform + 13: TypeInt 32 1 + 14: 13(int) Constant 0 + 15: TypePointer Uniform 9(int) + 18: 9(int) Constant 0 + 21: 9(int) Constant 3 + 31: 9(int) Constant 1 + 34: TypeVector 9(int) 3 + 35: 9(int) Constant 4 + 36: 34(ivec3) ConstantComposite 35 35 31 + 4(main): 2 Function None 3 + 5: Label + 8(b1): 7(ptr) Variable Function + 16: 15(ptr) AccessChain 12 14 + 17: 9(int) Load 16 + 19: 6(bool) INotEqual 17 18 + Store 8(b1) 19 + 20: 6(bool) Load 8(b1) + 22: 6(bool) GroupAny 21 20 + Store 8(b1) 22 + 23: 6(bool) Load 8(b1) + 24: 6(bool) GroupAll 21 23 + Store 8(b1) 24 + 25: 6(bool) Load 8(b1) + 26: 6(bool) GroupAll 21 25 + 27: 6(bool) GroupAny 21 25 + 28: 6(bool) LogicalNot 27 + 29: 6(bool) LogicalOr 26 28 + Store 8(b1) 29 + 30: 6(bool) Load 8(b1) + 32: 9(int) Select 30 31 18 + 33: 15(ptr) AccessChain 12 14 + Store 33 32 + Return + FunctionEnd diff --git a/Test/spv.shaderGroupVote.comp b/Test/spv.shaderGroupVote.comp new file mode 100644 index 00000000..c0b1fe72 --- /dev/null +++ b/Test/spv.shaderGroupVote.comp @@ -0,0 +1,21 @@ +#version 450 + +#extension GL_ARB_shader_group_vote : enable + +layout(local_size_x = 4, local_size_y = 4) in; + +layout(std430, binding = 0) buffer Buffers +{ + bool b; +}; + +void main() +{ + bool b1 = b; + + b1 = anyInvocationARB(b1); + b1 = allInvocationsARB(b1); + b1 = allInvocationsEqualARB(b1); + + b = b1; +} diff --git a/Test/test-spirv-list b/Test/test-spirv-list index dfc6db7b..b607d838 100644 --- a/Test/test-spirv-list +++ b/Test/test-spirv-list @@ -72,6 +72,7 @@ spv.intOps.vert spv.precision.frag spv.prepost.frag spv.qualifiers.vert +spv.shaderGroupVote.comp spv.shiftOps.frag spv.simpleFunctionCall.frag spv.simpleMat.vert diff --git a/glslang/Include/intermediate.h b/glslang/Include/intermediate.h index 1dd55a7b..c397557a 100644 --- a/glslang/Include/intermediate.h +++ b/glslang/Include/intermediate.h @@ -283,6 +283,10 @@ enum TOperator { EOpMemoryBarrierShared, // compute only EOpGroupMemoryBarrier, // compute only + EOpAnyInvocation, + EOpAllInvocations, + EOpAllInvocationsEqual, + EOpAtomicAdd, EOpAtomicMin, EOpAtomicMax, diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp index 0b27ddd9..86943a59 100644 --- a/glslang/MachineIndependent/Initialize.cpp +++ b/glslang/MachineIndependent/Initialize.cpp @@ -1325,6 +1325,16 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan) "\n"); } + // GL_ARB_shader_group_vote + if (profile != EEsProfile && version >= 430) { + commonBuiltins.append( + "bool anyInvocationARB(bool);" + "bool allInvocationsARB(bool);" + "bool allInvocationsEqualARB(bool);" + + "\n"); + } + //============================================================================ // // Prototypes for built-in functions seen by vertex shaders only. @@ -3394,7 +3404,7 @@ void IdentifyBuiltIns(int version, EProfile profile, int spv, int vulkan, EShLan switch(language) { case EShLangVertex: - if (profile != EEsProfile && version >= 440) { + if (profile != EEsProfile) { symbolTable.setVariableExtensions("gl_BaseVertexARB", 1, &E_GL_ARB_shader_draw_parameters); symbolTable.setVariableExtensions("gl_BaseInstanceARB", 1, &E_GL_ARB_shader_draw_parameters); symbolTable.setVariableExtensions("gl_DrawIDARB", 1, &E_GL_ARB_shader_draw_parameters); @@ -3404,6 +3414,12 @@ void IdentifyBuiltIns(int version, EProfile profile, int spv, int vulkan, EShLan BuiltInVariable("gl_DrawIDARB", EbvDrawId, symbolTable); } + if (profile != EEsProfile) { + symbolTable.setFunctionExtensions("anyInvocationARB", 1, &E_GL_ARB_shader_group_vote); + symbolTable.setFunctionExtensions("allInvocationsARB", 1, &E_GL_ARB_shader_group_vote); + symbolTable.setFunctionExtensions("allInvocationsEqualARB", 1, &E_GL_ARB_shader_group_vote); + } + // Compatibility variables, vertex only if (spv == 0) { BuiltInVariable("gl_Color", EbvColor, symbolTable); @@ -3987,6 +4003,10 @@ void IdentifyBuiltIns(int version, EProfile profile, int spv, int vulkan, EShLan symbolTable.relateToOperator("textureOffsetClampARB", EOpTextureOffsetClamp); symbolTable.relateToOperator("textureGradClampARB", EOpTextureGradClamp); symbolTable.relateToOperator("textureGradOffsetClampARB", EOpTextureGradOffsetClamp); + + symbolTable.relateToOperator("anyInvocationARB", EOpAnyInvocation); + symbolTable.relateToOperator("allInvocationsARB", EOpAllInvocations); + symbolTable.relateToOperator("allInvocationsEqualARB", EOpAllInvocationsEqual); } } diff --git a/glslang/MachineIndependent/Versions.cpp b/glslang/MachineIndependent/Versions.cpp index 911535af..12696a99 100644 --- a/glslang/MachineIndependent/Versions.cpp +++ b/glslang/MachineIndependent/Versions.cpp @@ -171,6 +171,7 @@ void TParseVersions::initializeExtensionBehavior() extensionBehavior[E_GL_ARB_shader_image_load_store] = EBhDisable; extensionBehavior[E_GL_ARB_shader_atomic_counters] = EBhDisable; extensionBehavior[E_GL_ARB_shader_draw_parameters] = EBhDisable; + extensionBehavior[E_GL_ARB_shader_group_vote] = EBhDisable; extensionBehavior[E_GL_ARB_derivative_control] = EBhDisable; extensionBehavior[E_GL_ARB_shader_texture_image_samples] = EBhDisable; extensionBehavior[E_GL_ARB_viewport_array] = EBhDisable; @@ -272,6 +273,7 @@ void TParseVersions::getPreamble(std::string& preamble) "#define GL_ARB_shader_image_load_store 1\n" "#define GL_ARB_shader_atomic_counters 1\n" "#define GL_ARB_shader_draw_parameters 1\n" + "#define GL_ARB_shader_group_vote 1\n" "#define GL_ARB_derivative_control 1\n" "#define GL_ARB_shader_texture_image_samples 1\n" "#define GL_ARB_viewport_array 1\n" diff --git a/glslang/MachineIndependent/Versions.h b/glslang/MachineIndependent/Versions.h index 779ba9f2..5a712867 100644 --- a/glslang/MachineIndependent/Versions.h +++ b/glslang/MachineIndependent/Versions.h @@ -108,6 +108,7 @@ const char* const E_GL_ARB_explicit_attrib_location = "GL_ARB_explicit_attri const char* const E_GL_ARB_shader_image_load_store = "GL_ARB_shader_image_load_store"; const char* const E_GL_ARB_shader_atomic_counters = "GL_ARB_shader_atomic_counters"; const char* const E_GL_ARB_shader_draw_parameters = "GL_ARB_shader_draw_parameters"; +const char* const E_GL_ARB_shader_group_vote = "GL_ARB_shader_group_vote"; const char* const E_GL_ARB_derivative_control = "GL_ARB_derivative_control"; const char* const E_GL_ARB_shader_texture_image_samples = "GL_ARB_shader_texture_image_samples"; const char* const E_GL_ARB_viewport_array = "GL_ARB_viewport_array"; diff --git a/glslang/MachineIndependent/intermOut.cpp b/glslang/MachineIndependent/intermOut.cpp index 82e71600..4efb4c9d 100644 --- a/glslang/MachineIndependent/intermOut.cpp +++ b/glslang/MachineIndependent/intermOut.cpp @@ -351,6 +351,10 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node) case EOpNoise: out.debug << "noise"; break; + case EOpAnyInvocation: out.debug << "anyInvocation"; break; + case EOpAllInvocations: out.debug << "allInvocations"; break; + case EOpAllInvocationsEqual: out.debug << "allInvocationsEqual"; break; + default: out.debug.message(EPrefixError, "Bad unary op"); } diff --git a/gtests/Spv.FromFile.cpp b/gtests/Spv.FromFile.cpp index e5040b22..dad17c8d 100644 --- a/gtests/Spv.FromFile.cpp +++ b/gtests/Spv.FromFile.cpp @@ -138,6 +138,7 @@ INSTANTIATE_TEST_CASE_P( "spv.precision.frag", "spv.prepost.frag", "spv.qualifiers.vert", + "spv.shaderGroupVote.comp", "spv.shiftOps.frag", "spv.simpleFunctionCall.frag", "spv.simpleMat.vert", From 09caf12beca6a9bfc11f2140c8fec62ed4c7e95b Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 2 May 2016 18:11:54 -0400 Subject: [PATCH 055/140] Avoid printing to stdout directly in library functions. Previously GlslangToSpv() reported missing/TBD functionalities by directly writing to stdout using printf. That could cause problems to callers of GlslangToSpv(). This patch cleans up the error reporting logic in GlslangToSpv(), TGlslangToSpvTraverser, and spv::Builder a little bit to use ostringstream. Also fixed the usage of GlslangToSpv() in GTest fixtures to capture warnings/errors reported when translating AST to SPIR-V. --- SPIRV/GlslangToSpv.cpp | 31 +++++++++++++++++++++---------- SPIRV/GlslangToSpv.h | 1 + SPIRV/SpvBuilder.cpp | 16 ++++++++-------- SPIRV/SpvBuilder.h | 14 +++++++++----- StandAlone/StandAlone.cpp | 4 +++- gtests/TestFixture.h | 11 ++++++++--- 6 files changed, 50 insertions(+), 27 deletions(-) diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 0c62d52e..b4d5fb11 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -109,6 +109,8 @@ public: void dumpSpv(std::vector& out); + std::string getWarningsAndErrors() const { return warningsErrors.str(); } + protected: spv::Decoration TranslateInterpolationDecoration(const glslang::TQualifier& qualifier); spv::BuiltIn TranslateBuiltInDecoration(glslang::TBuiltInVariable); @@ -159,6 +161,8 @@ protected: spv::Instruction* entryPoint; int sequenceDepth; + std::ostringstream warningsErrors; + // There is a 1:1 mapping between a spv builder and a module; this is thread safe spv::Builder builder; bool inMain; @@ -433,7 +437,7 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI case glslang::EbvBaseInstance: case glslang::EbvDrawId: // TODO: Add SPIR-V builtin ID. - spv::MissingFunctionality("Draw parameters"); + spv::MissingFunctionality(warningsErrors, "Draw parameters"); return (spv::BuiltIn)spv::BadValue; case glslang::EbvPrimitiveId: return spv::BuiltInPrimitiveId; case glslang::EbvInvocationId: return spv::BuiltInInvocationId; @@ -608,7 +612,7 @@ bool HasNonLayoutQualifiers(const glslang::TQualifier& qualifier) TGlslangToSpvTraverser::TGlslangToSpvTraverser(const glslang::TIntermediate* glslangIntermediate) : TIntermTraverser(true, false, true), shaderEntry(0), sequenceDepth(0), - builder((glslang::GetKhronosToolId() << 16) | GeneratorVersion), + builder((glslang::GetKhronosToolId() << 16) | GeneratorVersion, warningsErrors), inMain(false), mainTerminated(false), linkageOnly(false), glslangIntermediate(glslangIntermediate) { @@ -984,7 +988,7 @@ bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::T builder.clearAccessChain(); if (! result) { - spv::MissingFunctionality("unknown glslang binary operation"); + spv::MissingFunctionality(warningsErrors, "unknown glslang binary operation"); return true; // pick up a child as the place-holder result } else { builder.setAccessChainRValue(result); @@ -1109,7 +1113,7 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI return false; default: - spv::MissingFunctionality("unknown glslang unary"); + spv::MissingFunctionality(warningsErrors, "unknown glslang unary"); return true; // pick up operand as placeholder result } } @@ -1220,7 +1224,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt builder.clearAccessChain(); builder.setAccessChainRValue(result); } else - spv::MissingFunctionality("missing user function; linker needs to catch that"); + spv::MissingFunctionality(warningsErrors, "missing user function; linker needs to catch that"); return false; } @@ -1468,7 +1472,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt return false; if (! result) { - spv::MissingFunctionality("unknown glslang aggregate"); + spv::MissingFunctionality(warningsErrors, "unknown glslang aggregate"); return true; // pick up a child as a placeholder operand } else { builder.clearAccessChain(); @@ -1761,7 +1765,7 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty spvType = builder.makeUintType(64); break; case glslang::EbtAtomicUint: - spv::TbdFunctionality("Is atomic_uint an opaque handle in the uniform storage class, or an addresses in the atomic storage class?"); + spv::TbdFunctionality(warningsErrors, "Is atomic_uint an opaque handle in the uniform storage class, or an addresses in the atomic storage class?"); spvType = builder.makeUintType(32); break; case glslang::EbtSampler: @@ -3147,7 +3151,7 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv: case glslang::EOpUnpackInt2x32: case glslang::EOpPackUint2x32: case glslang::EOpUnpackUint2x32: - spv::MissingFunctionality("shader int64"); + spv::MissingFunctionality(warningsErrors, "shader int64"); libCall = spv::GLSLstd450Bad; // TODO: This is a placeholder. break; @@ -3778,7 +3782,7 @@ spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op) builder.createMemoryBarrier(spv::ScopeDevice, spv::MemorySemanticsCrossWorkgroupMemoryMask); return 0; default: - spv::MissingFunctionality("unknown operation with no arguments"); + spv::MissingFunctionality(warningsErrors, "unknown operation with no arguments"); return 0; } } @@ -3939,7 +3943,7 @@ spv::Id TGlslangToSpvTraverser::createSpvConstant(const glslang::TIntermTyped& n // Neither a front-end constant node, nor a specialization constant node with constant union array or // constant sub tree as initializer. - spv::MissingFunctionality("Neither a front-end constant nor a spec constant."); + spv::MissingFunctionality(warningsErrors, "Neither a front-end constant nor a spec constant."); exit(1); return spv::NoResult; } @@ -4193,6 +4197,11 @@ void OutputSpv(const std::vector& spirv, const char* baseName) // Set up the glslang traversal // void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector& spirv) +{ + GlslangToSpv(intermediate, spirv, nullptr); +} + +void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector& spirv, std::string* messages) { TIntermNode* root = intermediate.getTreeRoot(); @@ -4207,6 +4216,8 @@ void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector& spirv); +void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector& spirv, std::string* messages); void OutputSpv(const std::vector& spirv, const char* baseName); } diff --git a/SPIRV/SpvBuilder.cpp b/SPIRV/SpvBuilder.cpp index 0171b15e..8250dc77 100644 --- a/SPIRV/SpvBuilder.cpp +++ b/SPIRV/SpvBuilder.cpp @@ -43,7 +43,6 @@ // #include -#include #include #include @@ -57,7 +56,7 @@ namespace spv { -Builder::Builder(unsigned int magicNumber) : +Builder::Builder(unsigned int magicNumber, std::ostringstream& warnError) : source(SourceLanguageUnknown), sourceVersion(0), addressModel(AddressingModelLogical), @@ -66,7 +65,8 @@ Builder::Builder(unsigned int magicNumber) : buildPoint(0), uniqueId(0), mainFunction(0), - generatingOpCodeForSpecConst(false) + generatingOpCodeForSpecConst(false), + warningsErrors(warnError) { clearAccessChain(); } @@ -2111,7 +2111,7 @@ void Builder::accessChainStore(Id rvalue) Id base = collapseAccessChain(); if (accessChain.swizzle.size() && accessChain.component != NoResult) - MissingFunctionality("simultaneous l-value swizzle and dynamic component selection"); + MissingFunctionality(warningsErrors, "simultaneous l-value swizzle and dynamic component selection"); // If swizzle still exists, it is out-of-order or not full, we must load the target vector, // extract and insert elements to perform writeMask and/or swizzle. @@ -2487,19 +2487,19 @@ void Builder::dumpInstructions(std::vector& out, const std::vector } } -void TbdFunctionality(const char* tbd) +void TbdFunctionality(std::ostringstream& stream, const char* tbd) { static std::unordered_set issued; if (issued.find(tbd) == issued.end()) { - printf("TBD functionality: %s\n", tbd); + stream << "TBD functionality: " << tbd << "\n"; issued.insert(tbd); } } -void MissingFunctionality(const char* fun) +void MissingFunctionality(std::ostringstream& stream, const char* fun) { - printf("Missing functionality: %s\n", fun); + stream << "Missing functionality: " << fun << "\n"; } }; // end spv namespace diff --git a/SPIRV/SpvBuilder.h b/SPIRV/SpvBuilder.h index 8c05f4e5..93cdf2fa 100755 --- a/SPIRV/SpvBuilder.h +++ b/SPIRV/SpvBuilder.h @@ -53,16 +53,17 @@ #include "spvIR.h" #include -#include -#include #include +#include #include +#include +#include namespace spv { class Builder { public: - Builder(unsigned int userNumber); + Builder(unsigned int userNumber, std::ostringstream& warnError); virtual ~Builder(); static const int maxMatrixSize = 4; @@ -580,13 +581,16 @@ public: // Our loop stack. std::stack loops; + + // The stream for outputing warnings and errors. + std::ostringstream& warningsErrors; }; // end Builder class // Use for non-fatal notes about what's not complete -void TbdFunctionality(const char*); +void TbdFunctionality(std::ostringstream&, const char*); // Use for fatal missing functionality -void MissingFunctionality(const char*); +void MissingFunctionality(std::ostringstream&, const char*); }; // end spv namespace diff --git a/StandAlone/StandAlone.cpp b/StandAlone/StandAlone.cpp index 2f5a7180..b2bee852 100644 --- a/StandAlone/StandAlone.cpp +++ b/StandAlone/StandAlone.cpp @@ -671,11 +671,13 @@ void CompileAndLinkShaderUnits(std::vector compUnits) for (int stage = 0; stage < EShLangCount; ++stage) { if (program.getIntermediate((EShLanguage)stage)) { std::vector spirv; - glslang::GlslangToSpv(*program.getIntermediate((EShLanguage)stage), spirv); + std::string warningsErrors; + glslang::GlslangToSpv(*program.getIntermediate((EShLanguage)stage), spirv, &warningsErrors); // Dump the spv to a file or stdout, etc., but only if not doing // memory/perf testing, as it's not internal to programmatic use. if (! (Options & EOptionMemoryLeakMode)) { + printf("%s", warningsErrors.c_str()); glslang::OutputSpv(spirv, GetBinaryName((EShLanguage)stage)); if (Options & EOptionHumanReadableSpv) { spv::Disassemble(std::cout, spirv); diff --git a/gtests/TestFixture.h b/gtests/TestFixture.h index 87a365b5..a7702478 100644 --- a/gtests/TestFixture.h +++ b/gtests/TestFixture.h @@ -156,6 +156,7 @@ public: const std::string compilationError; const std::string linkingOutput; const std::string linkingError; + const std::string spirvWarningsErrors; const std::string spirv; // Optional SPIR-V disassembly text. }; @@ -187,20 +188,23 @@ public: program.addShader(&shader); success &= program.link(messages); + std::string spirvWarningsErrors; + if (success && target == Target::Spirv) { std::vector spirv_binary; glslang::GlslangToSpv(*program.getIntermediate(language), - spirv_binary); + spirv_binary, &spirvWarningsErrors); std::ostringstream disassembly_stream; spv::Parameterize(); spv::Disassemble(disassembly_stream, spirv_binary); return {shader.getInfoLog(), shader.getInfoDebugLog(), program.getInfoLog(), program.getInfoDebugLog(), - disassembly_stream.str()}; + spirvWarningsErrors, disassembly_stream.str()}; } else { return {shader.getInfoLog(), shader.getInfoDebugLog(), - program.getInfoLog(), program.getInfoDebugLog(), ""}; + program.getInfoLog(), program.getInfoDebugLog(), + "", ""}; } } @@ -231,6 +235,7 @@ public: outputIfNotEmpty(result.compilationError); outputIfNotEmpty(result.linkingOutput); outputIfNotEmpty(result.linkingError); + stream << result.spirvWarningsErrors; if (target == Target::Spirv) { stream << (result.spirv.empty() From 17535f7d5557dc56407b5ed96d013c66d5eee321 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 4 May 2016 15:55:59 -0400 Subject: [PATCH 056/140] Create a new logger class for all messages w.r.t. SPIR-V build. --- SPIRV/CMakeLists.txt | 2 + SPIRV/GlslangToSpv.cpp | 49 +++++++++---------- SPIRV/GlslangToSpv.h | 7 ++- SPIRV/Logger.cpp | 68 +++++++++++++++++++++++++++ SPIRV/Logger.h | 73 +++++++++++++++++++++++++++++ SPIRV/SpvBuilder.cpp | 21 ++------- SPIRV/SpvBuilder.h | 11 ++--- StandAlone/StandAlone.cpp | 5 +- Test/baseResults/spv.int64.frag.out | 3 -- gtests/TestFixture.h | 6 +-- 10 files changed, 184 insertions(+), 61 deletions(-) create mode 100644 SPIRV/Logger.cpp create mode 100644 SPIRV/Logger.h diff --git a/SPIRV/CMakeLists.txt b/SPIRV/CMakeLists.txt index 88d89da0..123ab3e3 100755 --- a/SPIRV/CMakeLists.txt +++ b/SPIRV/CMakeLists.txt @@ -1,6 +1,7 @@ set(SOURCES GlslangToSpv.cpp InReadableOrder.cpp + Logger.cpp SpvBuilder.cpp SPVRemapper.cpp doc.cpp @@ -10,6 +11,7 @@ set(HEADERS spirv.hpp GLSL.std.450.h GlslangToSpv.h + Logger.h SpvBuilder.h SPVRemapper.h spvIR.h diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index b4d5fb11..bf0b4302 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -52,12 +52,12 @@ namespace spv { #include "../glslang/MachineIndependent/SymbolTable.h" #include "../glslang/Include/Common.h" -#include -#include -#include -#include -#include #include +#include +#include +#include +#include +#include namespace { @@ -94,7 +94,7 @@ private: // class TGlslangToSpvTraverser : public glslang::TIntermTraverser { public: - TGlslangToSpvTraverser(const glslang::TIntermediate*); + TGlslangToSpvTraverser(const glslang::TIntermediate*, spv::SpvBuildLogger* logger); virtual ~TGlslangToSpvTraverser(); bool visitAggregate(glslang::TVisit, glslang::TIntermAggregate*); @@ -109,8 +109,6 @@ public: void dumpSpv(std::vector& out); - std::string getWarningsAndErrors() const { return warningsErrors.str(); } - protected: spv::Decoration TranslateInterpolationDecoration(const glslang::TQualifier& qualifier); spv::BuiltIn TranslateBuiltInDecoration(glslang::TBuiltInVariable); @@ -161,7 +159,7 @@ protected: spv::Instruction* entryPoint; int sequenceDepth; - std::ostringstream warningsErrors; + spv::SpvBuildLogger* logger; // There is a 1:1 mapping between a spv builder and a module; this is thread safe spv::Builder builder; @@ -437,7 +435,7 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI case glslang::EbvBaseInstance: case glslang::EbvDrawId: // TODO: Add SPIR-V builtin ID. - spv::MissingFunctionality(warningsErrors, "Draw parameters"); + logger->missingFunctionality("Draw parameters"); return (spv::BuiltIn)spv::BadValue; case glslang::EbvPrimitiveId: return spv::BuiltInPrimitiveId; case glslang::EbvInvocationId: return spv::BuiltInInvocationId; @@ -610,9 +608,9 @@ bool HasNonLayoutQualifiers(const glslang::TQualifier& qualifier) // Implement the TGlslangToSpvTraverser class. // -TGlslangToSpvTraverser::TGlslangToSpvTraverser(const glslang::TIntermediate* glslangIntermediate) - : TIntermTraverser(true, false, true), shaderEntry(0), sequenceDepth(0), - builder((glslang::GetKhronosToolId() << 16) | GeneratorVersion, warningsErrors), +TGlslangToSpvTraverser::TGlslangToSpvTraverser(const glslang::TIntermediate* glslangIntermediate, spv::SpvBuildLogger* buildLogger) + : TIntermTraverser(true, false, true), shaderEntry(0), sequenceDepth(0), logger(buildLogger), + builder((glslang::GetKhronosToolId() << 16) | GeneratorVersion, logger), inMain(false), mainTerminated(false), linkageOnly(false), glslangIntermediate(glslangIntermediate) { @@ -988,7 +986,7 @@ bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::T builder.clearAccessChain(); if (! result) { - spv::MissingFunctionality(warningsErrors, "unknown glslang binary operation"); + logger->missingFunctionality("unknown glslang binary operation"); return true; // pick up a child as the place-holder result } else { builder.setAccessChainRValue(result); @@ -1113,7 +1111,7 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI return false; default: - spv::MissingFunctionality(warningsErrors, "unknown glslang unary"); + logger->missingFunctionality("unknown glslang unary"); return true; // pick up operand as placeholder result } } @@ -1224,7 +1222,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt builder.clearAccessChain(); builder.setAccessChainRValue(result); } else - spv::MissingFunctionality(warningsErrors, "missing user function; linker needs to catch that"); + logger->missingFunctionality("missing user function; linker needs to catch that"); return false; } @@ -1472,7 +1470,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt return false; if (! result) { - spv::MissingFunctionality(warningsErrors, "unknown glslang aggregate"); + logger->missingFunctionality("unknown glslang aggregate"); return true; // pick up a child as a placeholder operand } else { builder.clearAccessChain(); @@ -1765,7 +1763,7 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty spvType = builder.makeUintType(64); break; case glslang::EbtAtomicUint: - spv::TbdFunctionality(warningsErrors, "Is atomic_uint an opaque handle in the uniform storage class, or an addresses in the atomic storage class?"); + logger->tbdFunctionality("Is atomic_uint an opaque handle in the uniform storage class, or an addresses in the atomic storage class?"); spvType = builder.makeUintType(32); break; case glslang::EbtSampler: @@ -3151,7 +3149,7 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv: case glslang::EOpUnpackInt2x32: case glslang::EOpPackUint2x32: case glslang::EOpUnpackUint2x32: - spv::MissingFunctionality(warningsErrors, "shader int64"); + logger->missingFunctionality("shader int64"); libCall = spv::GLSLstd450Bad; // TODO: This is a placeholder. break; @@ -3782,7 +3780,7 @@ spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op) builder.createMemoryBarrier(spv::ScopeDevice, spv::MemorySemanticsCrossWorkgroupMemoryMask); return 0; default: - spv::MissingFunctionality(warningsErrors, "unknown operation with no arguments"); + logger->missingFunctionality("unknown operation with no arguments"); return 0; } } @@ -3943,7 +3941,7 @@ spv::Id TGlslangToSpvTraverser::createSpvConstant(const glslang::TIntermTyped& n // Neither a front-end constant node, nor a specialization constant node with constant union array or // constant sub tree as initializer. - spv::MissingFunctionality(warningsErrors, "Neither a front-end constant nor a spec constant."); + logger->missingFunctionality("Neither a front-end constant nor a spec constant."); exit(1); return spv::NoResult; } @@ -4198,10 +4196,11 @@ void OutputSpv(const std::vector& spirv, const char* baseName) // void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector& spirv) { - GlslangToSpv(intermediate, spirv, nullptr); + spv::SpvBuildLogger logger; + GlslangToSpv(intermediate, spirv, &logger); } -void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector& spirv, std::string* messages) +void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector& spirv, spv::SpvBuildLogger* logger) { TIntermNode* root = intermediate.getTreeRoot(); @@ -4210,14 +4209,12 @@ void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vectortraverse(&it); it.dumpSpv(spirv); - if (messages != nullptr) *messages = it.getWarningsAndErrors(); - glslang::GetThreadPoolAllocator().pop(); } diff --git a/SPIRV/GlslangToSpv.h b/SPIRV/GlslangToSpv.h index 9b26864c..8d006f38 100644 --- a/SPIRV/GlslangToSpv.h +++ b/SPIRV/GlslangToSpv.h @@ -34,11 +34,16 @@ #include "../glslang/Include/intermediate.h" +#include +#include + +#include "Logger.h" + namespace glslang { void GetSpirvVersion(std::string&); void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector& spirv); -void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector& spirv, std::string* messages); +void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector& spirv, spv::SpvBuildLogger* logger); void OutputSpv(const std::vector& spirv, const char* baseName); } diff --git a/SPIRV/Logger.cpp b/SPIRV/Logger.cpp new file mode 100644 index 00000000..2977ea39 --- /dev/null +++ b/SPIRV/Logger.cpp @@ -0,0 +1,68 @@ +// +// Copyright (C) 2016 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 Google Inc. 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 "Logger.h" + +#include +#include +#include + +namespace spv { + +void SpvBuildLogger::tbdFunctionality(const char* f) +{ + if (std::find(std::begin(tbdFeatures), std::end(tbdFeatures), f) == std::end(tbdFeatures)) + tbdFeatures.push_back(f); +} + +void SpvBuildLogger::missingFunctionality(const char* f) +{ + if (std::find(std::begin(missingFeatures), std::end(missingFeatures), f) == std::end(missingFeatures)) + missingFeatures.push_back(f); +} + +std::string SpvBuildLogger::getAllMessages() const { + std::ostringstream messages; + for (const auto& f : tbdFeatures) + messages << "TBD functionality: " << f << "\n"; + for (const auto& f : missingFeatures) + messages << "Missing functionality: " << f << "\n"; + for (const auto& w : warnings) + messages << "warning: " << w << "\n"; + for (const auto& e : errors) + messages << "error: " << e << "\n"; + return messages.str(); +} + +} // end spv namespace diff --git a/SPIRV/Logger.h b/SPIRV/Logger.h new file mode 100644 index 00000000..2b9eb0d5 --- /dev/null +++ b/SPIRV/Logger.h @@ -0,0 +1,73 @@ +// +// Copyright (C) 2016 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 Google Inc. 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. + +#ifndef GLSLANG_SPIRV_LOGGER_H +#define GLSLANG_SPIRV_LOGGER_H + +#include +#include + +namespace spv { + +// A class for holding all SPIR-V build status messages, including +// missing/TBD functionalities, warnings, and errors. +class SpvBuildLogger { +public: + SpvBuildLogger() = default; + SpvBuildLogger(const SpvBuildLogger&) = delete; + + // Registers a TBD functionality. + void tbdFunctionality(const char* f); + // Registers a missing functionality. + void missingFunctionality(const char* f); + + // Logs a warning. + void warning(const std::string& w) { warnings.push_back(w); } + // Logs an error. + void error(const std::string& e) { errors.push_back(e); } + + // Returns all messages accumulated in the order of: + // TBD functionalities, missing functionalities, warnings, errors. + std::string getAllMessages() const; + +private: + std::vector tbdFeatures; + std::vector missingFeatures; + std::vector warnings; + std::vector errors; +}; + +} // end spv namespace + +#endif // GLSLANG_SPIRV_LOGGER_H diff --git a/SPIRV/SpvBuilder.cpp b/SPIRV/SpvBuilder.cpp index 8250dc77..d3f2ced2 100644 --- a/SPIRV/SpvBuilder.cpp +++ b/SPIRV/SpvBuilder.cpp @@ -56,7 +56,7 @@ namespace spv { -Builder::Builder(unsigned int magicNumber, std::ostringstream& warnError) : +Builder::Builder(unsigned int magicNumber, SpvBuildLogger* buildLogger) : source(SourceLanguageUnknown), sourceVersion(0), addressModel(AddressingModelLogical), @@ -66,7 +66,7 @@ Builder::Builder(unsigned int magicNumber, std::ostringstream& warnError) : uniqueId(0), mainFunction(0), generatingOpCodeForSpecConst(false), - warningsErrors(warnError) + logger(buildLogger) { clearAccessChain(); } @@ -2111,7 +2111,7 @@ void Builder::accessChainStore(Id rvalue) Id base = collapseAccessChain(); if (accessChain.swizzle.size() && accessChain.component != NoResult) - MissingFunctionality(warningsErrors, "simultaneous l-value swizzle and dynamic component selection"); + logger->missingFunctionality("simultaneous l-value swizzle and dynamic component selection"); // If swizzle still exists, it is out-of-order or not full, we must load the target vector, // extract and insert elements to perform writeMask and/or swizzle. @@ -2487,19 +2487,4 @@ void Builder::dumpInstructions(std::vector& out, const std::vector } } -void TbdFunctionality(std::ostringstream& stream, const char* tbd) -{ - static std::unordered_set issued; - - if (issued.find(tbd) == issued.end()) { - stream << "TBD functionality: " << tbd << "\n"; - issued.insert(tbd); - } -} - -void MissingFunctionality(std::ostringstream& stream, const char* fun) -{ - stream << "Missing functionality: " << fun << "\n"; -} - }; // end spv namespace diff --git a/SPIRV/SpvBuilder.h b/SPIRV/SpvBuilder.h index 93cdf2fa..35138b05 100755 --- a/SPIRV/SpvBuilder.h +++ b/SPIRV/SpvBuilder.h @@ -49,6 +49,7 @@ #ifndef SpvBuilder_H #define SpvBuilder_H +#include "Logger.h" #include "spirv.hpp" #include "spvIR.h" @@ -63,7 +64,7 @@ namespace spv { class Builder { public: - Builder(unsigned int userNumber, std::ostringstream& warnError); + Builder(unsigned int userNumber, SpvBuildLogger* logger); virtual ~Builder(); static const int maxMatrixSize = 4; @@ -583,15 +584,9 @@ public: std::stack loops; // The stream for outputing warnings and errors. - std::ostringstream& warningsErrors; + SpvBuildLogger* logger; }; // end Builder class -// Use for non-fatal notes about what's not complete -void TbdFunctionality(std::ostringstream&, const char*); - -// Use for fatal missing functionality -void MissingFunctionality(std::ostringstream&, const char*); - }; // end spv namespace #endif // SpvBuilder_H diff --git a/StandAlone/StandAlone.cpp b/StandAlone/StandAlone.cpp index b2bee852..5c4be73d 100644 --- a/StandAlone/StandAlone.cpp +++ b/StandAlone/StandAlone.cpp @@ -672,12 +672,13 @@ void CompileAndLinkShaderUnits(std::vector compUnits) if (program.getIntermediate((EShLanguage)stage)) { std::vector spirv; std::string warningsErrors; - glslang::GlslangToSpv(*program.getIntermediate((EShLanguage)stage), spirv, &warningsErrors); + spv::SpvBuildLogger logger; + glslang::GlslangToSpv(*program.getIntermediate((EShLanguage)stage), spirv, &logger); // Dump the spv to a file or stdout, etc., but only if not doing // memory/perf testing, as it's not internal to programmatic use. if (! (Options & EOptionMemoryLeakMode)) { - printf("%s", warningsErrors.c_str()); + printf("%s", logger.getAllMessages().c_str()); glslang::OutputSpv(spirv, GetBinaryName((EShLanguage)stage)); if (Options & EOptionHumanReadableSpv) { spv::Disassemble(std::cout, spirv); diff --git a/Test/baseResults/spv.int64.frag.out b/Test/baseResults/spv.int64.frag.out index 5088469e..fe450137 100644 --- a/Test/baseResults/spv.int64.frag.out +++ b/Test/baseResults/spv.int64.frag.out @@ -5,9 +5,6 @@ Warning, version 450 is not yet complete; most version-specific features are pre Linked fragment stage: -Missing functionality: shader int64 -Missing functionality: shader int64 -Missing functionality: shader int64 Missing functionality: shader int64 // Module Version 10000 // Generated by (magic number): 80001 diff --git a/gtests/TestFixture.h b/gtests/TestFixture.h index a7702478..8f744441 100644 --- a/gtests/TestFixture.h +++ b/gtests/TestFixture.h @@ -188,19 +188,19 @@ public: program.addShader(&shader); success &= program.link(messages); - std::string spirvWarningsErrors; + spv::SpvBuildLogger logger; if (success && target == Target::Spirv) { std::vector spirv_binary; glslang::GlslangToSpv(*program.getIntermediate(language), - spirv_binary, &spirvWarningsErrors); + spirv_binary, &logger); std::ostringstream disassembly_stream; spv::Parameterize(); spv::Disassemble(disassembly_stream, spirv_binary); return {shader.getInfoLog(), shader.getInfoDebugLog(), program.getInfoLog(), program.getInfoDebugLog(), - spirvWarningsErrors, disassembly_stream.str()}; + logger.getAllMessages(), disassembly_stream.str()}; } else { return {shader.getInfoLog(), shader.getInfoDebugLog(), program.getInfoLog(), program.getInfoDebugLog(), From f5e33b0bacb6d479dc9673d6ea66b4edb3c3d53c Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 4 May 2016 14:22:56 -0400 Subject: [PATCH 057/140] Explain organization and build steps for source code and tests. --- README.md | 146 ++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 108 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index 55129575..4858ad9b 100644 --- a/README.md +++ b/README.md @@ -45,35 +45,125 @@ There is also a non-shader extension Building -------- -CMake: The currently maintained and preferred way of building is through CMake. +### Dependencies + +* [CMake][cmake]: for generating compilation targets. +* [bison][bison]: _optional_, for regenerating grammar (if changes). + +### Build steps + +1) Check out external projects: + +```bash +git clone https://github.com/google/googletest.git External/googletest +``` + +2) Configure and build. Assume the source directory is `$SOURCE_DIR` and +the build directory is `$BUILD_DIR`: + +```bash +# for building on Linux (assuming using the Ninja generator): +cd $BUILD_DIR +cmake -GNinja -DCMAKE_BUILD_TYPE={Debug|Release|RelWithDebInfo} \ + -DCMAKE_INSTALL_PREFIX=`pwd`/install $SOURCE_DIR +ninja + +# for building on Windows: +cd $BUILD_DIR +cmake $SOURCE_DIR -DCMAKE_INSTALL_PREFIX=`pwd`/install +cmake --build . --config {Release|Debug|MinSizeRel|RelWithDebInfo} + +# The CMAKE_INSTALL_PREFIX part is for testing (explained latter). +``` + In MSVC, after running CMake, you may need to use the Configuration Manager to check the INSTALL project. -The grammar in glslang/MachineIndependent/glslang.y has to be recompiled with +### If you need to change the GLSL grammar + +The grammar in `glslang/MachineIndependent/glslang.y` has to be recompiled with bison if it changes, the output files are committed to the repo to avoid every developer needing to have bison configured to compile the project when grammar changes are quite infrequent. For windows you can get binaries from -[GnuWin32](http://gnuwin32.sourceforge.net/packages/bison.htm). +[GnuWin32][bison-gnu-win32]. The command to rebuild is: -``` +```bash 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: +The above command is also available in the bash script at +`glslang/updateGrammar`. -``` -glslang/updateGrammar +Testing +------- + +Right now, there are two test harnesses existing in glslang: one is [Google +Test](gtests/), one is the [`runtests` script](Test/runtests). The former +runs unit tests and single-shader single-threaded integration tests, while +the latter runs multiple-shader linking tests and multi-threaded tests. + +### Running tests + +The [`runtests` script](Test/runtests) requires compiled binaries to be +installed into `$BUILD_DIR/install`. Please make sure you have supplied the +correct configuration to CMake (using `-DCMAKE_INSTALL_PREFIX`) when building; +otherwise, you may want to modify the path in the `runtests` script. + +Running Google Test-backed tests: + +```bash +# assuming we are in the build directory: +ctest +# or, run the test binary directly +# (which gives more fine-grained control like filtering): +/glslangtests ``` -Glslang is adding the ability to test with -[Google Test](https://github.com/google/googletest) framework. If you want to -build and run those tests, please make sure you have a copy of Google Tests -checked out in the `External/` directory: -`git clone https://github.com/google/googletest.git`. +Running `runtests` script-backed tests: + +```bash +# assuming we are in the source directory: +cd Test && ./runtests +``` + +### Contributing tests + +Test results should always be included with a pull request that modifies +functionality. + +If you are writing unit tests, please use the Google Test framework and +place the tests under the `gtests/` directory. + +Integration tests are placed in the `Test/` directory. It contains test input +and a subdirectory `baseResults/` that contains the expected results of the +tests. Both the tests and `baseResults/` are under source-code control. + +Google Test runs those integration tests by reading the test input, compiling +them, and then compare against the expected results in `baseResults/`. The +integration tests to run via Google Test is registered in various +`gtests/*.FromFile.cpp` source files. `glslangtests` provides a command-line +option `--update-mode`, which, if supplied, will overwrite the golden files +under the `baseResults/` directory with real output from that invocation. +For more information, please check `gtests/` directory's +[README](gtests/README.md). + +For the `runtests` script, it will generate current results in the +`localResults/` directory and `diff` them against the `baseResults/`. +The integration tests to run via the `runtests` script is registered +via various `Test/test-*` text files and `Test/testlist`. +When you want to update the tracked test results, they need to be +copied from `localResults/` to `baseResults/`. This can be done by +the `bump` shell script. + +The list of files tested comes from `testlist`, and lists input shaders +in this directory, which must all be public for this to work. However, +you can add your own private list of tests, not tracked here, by using +`localtestlist` to list non-tracked tests. This is automatically read +by `runtests` and included in the `diff` and `bump` process. Programmatic Interfaces ----------------------- @@ -128,32 +218,6 @@ ShCompile(shader, compiler) -> compiler(AST) -> In practice, `ShCompile()` takes shader strings, default version, and warning/error and other options for controlling compilation. -Testing -------- - -Test results should always be included with a pull request that modifies -functionality. And since glslang added the ability to test with -[Google Test](https://github.com/google/googletest) framework, -please write your new tests using Google Test. - -The old (deprecated) testing process is: - -`Test` is an active test directory that contains test input and a -subdirectory `baseResults` that contains the expected results of the -tests. Both the tests and `baseResults` are under source-code control. -Executing the script `./runtests` will generate current results in -the `localResults` directory and `diff` them against the `baseResults`. - -When you want to update the tracked test results, they need to be -copied from `localResults` to `baseResults`. This can be done by -the `bump` shell script. - -The list of files tested comes from `testlist`, and lists input shaders -in this directory, which must all be public for this to work. However, -you can add your own private list of tests, not tracked here, by using -`localtestlist` to list non-tracked tests. This is automatically read -by `runtests` and included in the `diff` and `bump` process. - Basic Internal Operation ------------------------ @@ -201,3 +265,9 @@ Basic Internal Operation - the object does not come from the pool, and you have to do normal C++ memory management of what you `new` + + +[cmake]: https://cmake.org/ +[bison]: https://www.gnu.org/software/bison/ +[googletest]: https://github.com/google/googletest +[bison-gnu-win32]: http://gnuwin32.sourceforge.net/packages/bison.htm From d7b552a907dbfb70c6a1e901ea8e770566b317bf Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 5 May 2016 10:44:26 -0400 Subject: [PATCH 058/140] Improve README steps for building and testing glslang. --- README.md | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 4858ad9b..0059c2b8 100644 --- a/README.md +++ b/README.md @@ -58,26 +58,35 @@ Building git clone https://github.com/google/googletest.git External/googletest ``` -2) Configure and build. Assume the source directory is `$SOURCE_DIR` and +2) Configure. Assume the source directory is `$SOURCE_DIR` and the build directory is `$BUILD_DIR`: ```bash -# for building on Linux (assuming using the Ninja generator): cd $BUILD_DIR + +# for building on Linux (assuming using the Ninja generator): cmake -GNinja -DCMAKE_BUILD_TYPE={Debug|Release|RelWithDebInfo} \ -DCMAKE_INSTALL_PREFIX=`pwd`/install $SOURCE_DIR -ninja # for building on Windows: -cd $BUILD_DIR cmake $SOURCE_DIR -DCMAKE_INSTALL_PREFIX=`pwd`/install -cmake --build . --config {Release|Debug|MinSizeRel|RelWithDebInfo} -# The CMAKE_INSTALL_PREFIX part is for testing (explained latter). +# The CMAKE_INSTALL_PREFIX part is for testing (explained later). ``` -In MSVC, after running CMake, you may need to use the Configuration Manager to -check the INSTALL project. +3) Build and install. + +```bash +# for Linux: +ninja install + +# for Windows: +cmake --build . --config {Release|Debug|MinSizeRel|RelWithDebInfo} \ + --target install +``` + +If using MSVC, after running CMake to configure, you may need to use the +Configuration Manager to check the `INSTALL` project. ### If you need to change the GLSL grammar @@ -116,8 +125,14 @@ otherwise, you may want to modify the path in the `runtests` script. Running Google Test-backed tests: ```bash -# assuming we are in the build directory: +cd $BUILD_DIR + +# for Linux: ctest + +# for Windows: +ctest -C {Debug|Release|RelWithDebInfo|MinSizeRel} + # or, run the test binary directly # (which gives more fine-grained control like filtering): /glslangtests @@ -126,8 +141,7 @@ ctest Running `runtests` script-backed tests: ```bash -# assuming we are in the source directory: -cd Test && ./runtests +cd $SOURCE_DIR/Test && ./runtests ``` ### Contributing tests From a25352eb4fe752c74552f54a436e6f98928d297f Mon Sep 17 00:00:00 2001 From: Dejan Mircevski Date: Thu, 5 May 2016 11:51:27 -0400 Subject: [PATCH 059/140] Use strtoll, as stoll is unavailable on Android. --- glslang/MachineIndependent/preprocessor/PpTokens.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/glslang/MachineIndependent/preprocessor/PpTokens.cpp b/glslang/MachineIndependent/preprocessor/PpTokens.cpp index 95da3dbd..54d495e1 100644 --- a/glslang/MachineIndependent/preprocessor/PpTokens.cpp +++ b/glslang/MachineIndependent/preprocessor/PpTokens.cpp @@ -235,11 +235,11 @@ int TPpContext::ReadToken(TokenStream *pTok, TPpToken *ppToken) case PpAtomConstUint64: if (len > 0 && tokenText[0] == '0') { if (len > 1 && (tokenText[1] == 'x' || tokenText[1] == 'X')) - ppToken->i64val = std::stoll(ppToken->name, 0, 16); + ppToken->i64val = strtoll(ppToken->name, nullptr, 16); else - ppToken->i64val = std::stoll(ppToken->name, 0, 8); + ppToken->i64val = strtoll(ppToken->name, nullptr, 8); } else - ppToken->i64val = std::stoll(ppToken->name); + ppToken->i64val = atoll(ppToken->name); break; } } From db0eaf988799269250fd4a9faf8f46f59e05d8c4 Mon Sep 17 00:00:00 2001 From: Andrew Woloszyn Date: Thu, 5 May 2016 14:45:53 -0400 Subject: [PATCH 060/140] Updated cmake to better organize folders and options. This adds solution folders that properly group gtest/glslang/hlsl. This also marks gtest options as advanced so they don't show up in cmake-gui by default. --- CMakeLists.txt | 1 + External/CMakeLists.txt | 18 ++++++++++++++++++ OGLCompilersDLL/CMakeLists.txt | 1 + SPIRV/CMakeLists.txt | 1 + StandAlone/CMakeLists.txt | 4 ++++ glslang/CMakeLists.txt | 1 + glslang/OSDependent/Unix/CMakeLists.txt | 1 + glslang/OSDependent/Windows/CMakeLists.txt | 1 + gtests/CMakeLists.txt | 1 + hlsl/CMakeLists.txt | 1 + 10 files changed, 30 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a5220aa3..a3722bac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,5 @@ cmake_minimum_required(VERSION 2.8.12) +set_property(GLOBAL PROPERTY USE_FOLDERS ON) enable_testing() diff --git a/External/CMakeLists.txt b/External/CMakeLists.txt index d43cf9d0..5180ea56 100644 --- a/External/CMakeLists.txt +++ b/External/CMakeLists.txt @@ -10,6 +10,24 @@ elseif(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/googletest) set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) endif(WIN32) add_subdirectory(googletest) + set(GTEST_TARGETS + gtest + gtest_main + gmock + gmock_main + ) + foreach(target ${GTEST_TARGETS}) + set_property(TARGET ${target} PROPERTY FOLDER gtest) + endforeach() + mark_as_advanced(gmock_build_tests + BUILD_GMOCK + BUILD_GTEST + BUILD_SHARED_LIBS + gtest_build_samples + gtest_build_tests + gtest_disable_pthreads + gtest_force_shared_crt + gtest_hide_internal_symbols) else() message(STATUS "Google Mock was not found - tests based on that will not build") diff --git a/OGLCompilersDLL/CMakeLists.txt b/OGLCompilersDLL/CMakeLists.txt index 14afbd90..4954db94 100644 --- a/OGLCompilersDLL/CMakeLists.txt +++ b/OGLCompilersDLL/CMakeLists.txt @@ -1,6 +1,7 @@ set(SOURCES InitializeDll.cpp InitializeDll.h) add_library(OGLCompiler STATIC ${SOURCES}) +set_property(TARGET OGLCompiler PROPERTY FOLDER glslang) if(WIN32) source_group("Source" FILES ${SOURCES}) diff --git a/SPIRV/CMakeLists.txt b/SPIRV/CMakeLists.txt index 88d89da0..cdd92820 100755 --- a/SPIRV/CMakeLists.txt +++ b/SPIRV/CMakeLists.txt @@ -17,6 +17,7 @@ set(HEADERS disassemble.h) add_library(SPIRV STATIC ${SOURCES} ${HEADERS}) +set_property(TARGET SPIRV PROPERTY FOLDER glslang) if(WIN32) source_group("Source" FILES ${SOURCES} ${HEADERS}) diff --git a/StandAlone/CMakeLists.txt b/StandAlone/CMakeLists.txt index e02a465f..cd173c6c 100644 --- a/StandAlone/CMakeLists.txt +++ b/StandAlone/CMakeLists.txt @@ -1,6 +1,8 @@ add_library(glslang-default-resource-limits ${CMAKE_CURRENT_SOURCE_DIR}/DefaultResourceLimits.cpp ) +set_property(TARGET glslang-default-resource-limits PROPERTY FOLDER glslang) + target_include_directories(glslang-default-resource-limits PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} PUBLIC ${PROJECT_SOURCE_DIR} @@ -11,6 +13,8 @@ set(REMAPPER_SOURCES spirv-remap.cpp) add_executable(glslangValidator ${SOURCES}) add_executable(spirv-remap ${REMAPPER_SOURCES}) +set_property(TARGET glslangValidator PROPERTY FOLDER tools) +set_property(TARGET spirv-remap PROPERTY FOLDER tools) set(LIBRARIES glslang diff --git a/glslang/CMakeLists.txt b/glslang/CMakeLists.txt index 52c781a8..7015e304 100644 --- a/glslang/CMakeLists.txt +++ b/glslang/CMakeLists.txt @@ -75,6 +75,7 @@ set(HEADERS # set(BISON_GLSLParser_OUTPUT_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/MachineIndependent/glslang_tab.cpp) add_library(glslang STATIC ${BISON_GLSLParser_OUTPUT_SOURCE} ${SOURCES} ${HEADERS}) +set_property(TARGET glslang PROPERTY FOLDER glslang) if(WIN32) source_group("Public" REGULAR_EXPRESSION "Public/*") diff --git a/glslang/OSDependent/Unix/CMakeLists.txt b/glslang/OSDependent/Unix/CMakeLists.txt index f4d1b425..174cc916 100644 --- a/glslang/OSDependent/Unix/CMakeLists.txt +++ b/glslang/OSDependent/Unix/CMakeLists.txt @@ -1,4 +1,5 @@ add_library(OSDependent STATIC ossource.cpp ../osinclude.h) +set_property(TARGET OSDependent PROPERTY FOLDER glslang) install(TARGETS OSDependent ARCHIVE DESTINATION lib) diff --git a/glslang/OSDependent/Windows/CMakeLists.txt b/glslang/OSDependent/Windows/CMakeLists.txt index 2df014cc..399760c3 100644 --- a/glslang/OSDependent/Windows/CMakeLists.txt +++ b/glslang/OSDependent/Windows/CMakeLists.txt @@ -1,6 +1,7 @@ set(SOURCES ossource.cpp ../osinclude.h) add_library(OSDependent STATIC ${SOURCES}) +set_property(TARGET OSDependent PROPERTY FOLDER glslang) # MinGW GCC complains about function pointer casts to void*. # Turn that off with -fpermissive. diff --git a/gtests/CMakeLists.txt b/gtests/CMakeLists.txt index 7f477d61..75f0b4ea 100644 --- a/gtests/CMakeLists.txt +++ b/gtests/CMakeLists.txt @@ -18,6 +18,7 @@ if (TARGET gmock) ) add_executable(glslangtests ${TEST_SOURCES}) + set_property(TARGET glslangtests PROPERTY FOLDER tests) target_compile_definitions(glslangtests PRIVATE GLSLANG_TEST_DIRECTORY="${CMAKE_CURRENT_SOURCE_DIR}/../Test") target_include_directories(glslangtests PRIVATE diff --git a/hlsl/CMakeLists.txt b/hlsl/CMakeLists.txt index e4a0bd32..5e39b455 100755 --- a/hlsl/CMakeLists.txt +++ b/hlsl/CMakeLists.txt @@ -14,6 +14,7 @@ set(HEADERS hlslGrammar.h) add_library(HLSL STATIC ${SOURCES} ${HEADERS}) +set_property(TARGET HLSL PROPERTY FOLDER hlsl) if(WIN32) source_group("Source" FILES ${SOURCES} ${HEADERS}) From 0b887d00e03c1816eb5651ce2e241d9af8a2cbbd Mon Sep 17 00:00:00 2001 From: Andrew Woloszyn Date: Thu, 5 May 2016 14:58:26 -0400 Subject: [PATCH 061/140] Install the test executable alongside glslangValidator --- gtests/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gtests/CMakeLists.txt b/gtests/CMakeLists.txt index 75f0b4ea..de04ecee 100644 --- a/gtests/CMakeLists.txt +++ b/gtests/CMakeLists.txt @@ -19,6 +19,9 @@ if (TARGET gmock) add_executable(glslangtests ${TEST_SOURCES}) set_property(TARGET glslangtests PROPERTY FOLDER tests) + install(TARGETS glslangtests + RUNTIME DESTINATION bin) + target_compile_definitions(glslangtests PRIVATE GLSLANG_TEST_DIRECTORY="${CMAKE_CURRENT_SOURCE_DIR}/../Test") target_include_directories(glslangtests PRIVATE From 5cc344d8ce09a6d35ff88b9ea9f351062d779081 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Thu, 5 May 2016 13:36:55 -0600 Subject: [PATCH 062/140] Front-End: precise: capture noContraction on output parameter declarations. --- Test/baseResults/specExamples.vert.out | 8 ++++---- glslang/MachineIndependent/ParseHelper.cpp | 9 +++++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Test/baseResults/specExamples.vert.out b/Test/baseResults/specExamples.vert.out index 7de02d3d..7a880331 100644 --- a/Test/baseResults/specExamples.vert.out +++ b/Test/baseResults/specExamples.vert.out @@ -83,10 +83,10 @@ ERROR: node is still EOpNull! 0:153 Function Parameters: 0:153 'i' (in float) 0:153 'j' (in float) -0:153 'k' (out float) +0:153 'k' (noContraction out float) 0:155 Sequence 0:155 move second child to first child (temp float) -0:155 'k' (out float) +0:155 'k' (noContraction out float) 0:155 add (temp float) 0:155 component-wise multiply (temp float) 0:155 'i' (in float) @@ -367,10 +367,10 @@ ERROR: node is still EOpNull! 0:153 Function Parameters: 0:153 'i' (in float) 0:153 'j' (in float) -0:153 'k' (out float) +0:153 'k' (noContraction out float) 0:155 Sequence 0:155 move second child to first child (temp float) -0:155 'k' (out float) +0:155 'k' (noContraction out float) 0:155 add (temp float) 0:155 component-wise multiply (temp float) 0:155 'i' (in float) diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 3373d2f3..b9d77f2d 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -3538,6 +3538,7 @@ void TParseContext::paramCheckFix(const TSourceLoc& loc, const TQualifier& quali type.getQualifier().writeonly = qualifier.writeonly; type.getQualifier().restrict = qualifier.restrict; } + if (qualifier.isAuxiliary() || qualifier.isInterpolation()) error(loc, "cannot use auxiliary or interpolation qualifiers on a function parameter", "", ""); @@ -3545,8 +3546,12 @@ 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 && qualifier.storage != EvqOut && qualifier.storage != EvqInOut) - warn(loc, "qualifier has no effect on non-output parameters", "precise", ""); + if (qualifier.noContraction) { + if (qualifier.storage == EvqOut || qualifier.storage == EvqInOut) + type.getQualifier().noContraction = true; + else + warn(loc, "qualifier has no effect on non-output parameters", "precise", ""); + } paramCheckFix(loc, qualifier.storage, type); } From 91cef52f634e70afa4e769689c6e107261b42322 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Thu, 5 May 2016 16:45:40 -0600 Subject: [PATCH 063/140] SPV: Non-functional: modularize createInvocationsOperation() from the previous commit. --- SPIRV/GlslangToSpv.cpp | 58 ++++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 943743ad..7aa62fbd 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -142,6 +142,7 @@ protected: spv::Id createConversion(glslang::TOperator op, spv::Decoration precision, spv::Id destTypeId, spv::Id operand); spv::Id makeSmearedConstant(spv::Id constant, int vectorSize); spv::Id createAtomicOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, std::vector& operands, glslang::TBasicType typeProxy); + spv::Id createInvocationsOperation(glslang::TOperator, spv::Id typeId, spv::Id operand); 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::Id getSymbolId(const glslang::TIntermSymbol* node); @@ -3253,16 +3254,9 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv: break; case glslang::EOpAnyInvocation: - builder.addCapability(spv::CapabilityGroups); - unaryOp = spv::OpGroupAny; - break; case glslang::EOpAllInvocations: - builder.addCapability(spv::CapabilityGroups); - unaryOp = spv::OpGroupAll; - break; case glslang::EOpAllInvocationsEqual: - builder.addCapability(spv::CapabilityGroups); - break; + return createInvocationsOperation(op, typeId, operand); default: return 0; @@ -3274,25 +3268,7 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv: args.push_back(operand); id = builder.createBuiltinCall(typeId, stdBuiltins, libCall, args); } else { - if (op == glslang::EOpAnyInvocation || op == glslang::EOpAllInvocations || op == glslang::EOpAllInvocationsEqual) { - std::vector operands; - operands.push_back(builder.makeUintConstant(spv::ScopeSubgroup)); - operands.push_back(operand); - - if (op == glslang::EOpAnyInvocation || op == glslang::EOpAllInvocations) - id = builder.createOp(unaryOp, typeId, operands); - else if (op == glslang::EOpAllInvocationsEqual) { - spv::Id groupAll = builder.createOp(spv::OpGroupAll, typeId, operands); - spv::Id groupAny = builder.createOp(spv::OpGroupAny, typeId, operands); - - id = builder.createBinOp(spv::OpLogicalOr, - typeId, - groupAll, - builder.createUnaryOp(spv::OpLogicalNot, typeId, groupAny)); - } - } - else - id = builder.createUnaryOp(unaryOp, typeId, operand); + id = builder.createUnaryOp(unaryOp, typeId, operand); } return builder.setPrecision(id, precision); @@ -3592,6 +3568,34 @@ spv::Id TGlslangToSpvTraverser::createAtomicOperation(glslang::TOperator op, spv return builder.createOp(opCode, typeId, spvAtomicOperands); } +// Create group invocation operations. +spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op, spv::Id typeId, spv::Id operand) +{ + builder.addCapability(spv::CapabilityGroups); + + std::vector operands; + operands.push_back(builder.makeUintConstant(spv::ScopeSubgroup)); + operands.push_back(operand); + + switch (op) { + case glslang::EOpAnyInvocation: + case glslang::EOpAllInvocations: + return builder.createOp(op == glslang::EOpAnyInvocation ? spv::OpGroupAny : spv::OpGroupAll, typeId, operands); + + case glslang::EOpAllInvocationsEqual: + { + spv::Id groupAll = builder.createOp(spv::OpGroupAll, typeId, operands); + spv::Id groupAny = builder.createOp(spv::OpGroupAny, typeId, operands); + + return builder.createBinOp(spv::OpLogicalOr, typeId, groupAll, + builder.createUnaryOp(spv::OpLogicalNot, typeId, groupAny)); + } + default: + logger->missingFunctionality("invocation operation"); + return spv::NoResult; + } +} + spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, std::vector& operands, glslang::TBasicType typeProxy) { bool isUnsigned = typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64; From 3bdf24267c4ff580aeb488abdf0386aae6240161 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Fri, 6 May 2016 00:08:03 -0600 Subject: [PATCH 064/140] README: Editorial update. --- README.md | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 0059c2b8..70d5b9e5 100644 --- a/README.md +++ b/README.md @@ -48,33 +48,42 @@ Building ### Dependencies * [CMake][cmake]: for generating compilation targets. -* [bison][bison]: _optional_, for regenerating grammar (if changes). +* [bison][bison]: _optional_, but needed when changing the grammar (glslang.y). +* [googletest][googletest]: _optional_, but should use if making any changes to glslang. ### Build steps -1) Check out external projects: +#### 1) Check-Out External Projects ```bash +cd git clone https://github.com/google/googletest.git External/googletest ``` -2) Configure. Assume the source directory is `$SOURCE_DIR` and +#### 2) Configure + +Assume the source directory is `$SOURCE_DIR` and the build directory is `$BUILD_DIR`: +For building on Linux (assuming using the Ninja generator): + ```bash cd $BUILD_DIR -# for building on Linux (assuming using the Ninja generator): cmake -GNinja -DCMAKE_BUILD_TYPE={Debug|Release|RelWithDebInfo} \ -DCMAKE_INSTALL_PREFIX=`pwd`/install $SOURCE_DIR +``` -# for building on Windows: +For building on Windows: + +```bash cmake $SOURCE_DIR -DCMAKE_INSTALL_PREFIX=`pwd`/install - # The CMAKE_INSTALL_PREFIX part is for testing (explained later). ``` -3) Build and install. +The CMake GUI also works for Windows (version 3.4.1 tested). + +#### 3) Build and Install ```bash # for Linux: @@ -85,7 +94,7 @@ cmake --build . --config {Release|Debug|MinSizeRel|RelWithDebInfo} \ --target install ``` -If using MSVC, after running CMake to configure, you may need to use the +If using MSVC, after running CMake to configure, use the Configuration Manager to check the `INSTALL` project. ### If you need to change the GLSL grammar From 8add151c4bed52798e21ae6c675652a30f76235e Mon Sep 17 00:00:00 2001 From: scygan Date: Fri, 6 May 2016 16:54:54 +0200 Subject: [PATCH 065/140] SPIR-V do not decorate: members of plain structs with location; non-top level members with interp. This fixes some vulkanCTS tests that use struct arrays as a member of in/out interface blocks. From Vulkan spec: "If it is a not a Block, then the structure type must have a Location decoration. Its members are assigned consecutive locations in their declaration order, with the first member assigned to the location specified for the structure type. >>>>> The members, and their nested types, must not themselves have Location decorations <<<<" From SPIR-V spec: "When applied to structure-type members, the Decorations Noperspective, Flat, Patch, Centroid, and Sample can only be applied to the top-level members of the structure type. (Nested objects' types cannot be structures whose members are decorated with these decorations.)" --- SPIRV/GlslangToSpv.cpp | 15 ++++++++++++++- Test/baseResults/spv.430.vert.out | 9 --------- Test/baseResults/spv.localAggregates.frag.out | 10 ---------- Test/baseResults/spv.variableArrayIndex.frag.out | 9 --------- 4 files changed, 14 insertions(+), 29 deletions(-) diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 7aa62fbd..0b1a8497 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -1862,7 +1862,11 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty builder.addMemberName(spvType, member, glslangType.getFieldName().c_str()); addMemberDecoration(spvType, member, TranslateLayoutDecoration(glslangType, subQualifier.layoutMatrix)); addMemberDecoration(spvType, member, TranslatePrecisionDecoration(glslangType)); - addMemberDecoration(spvType, member, TranslateInterpolationDecoration(subQualifier)); + // Add interpolation decorations only to top-level members of Input and Output storage classes + if (type.getQualifier().storage == glslang::EvqVaryingIn || type.getQualifier().storage == glslang::EvqVaryingOut) + { + addMemberDecoration(spvType, member, TranslateInterpolationDecoration(subQualifier)); + } addMemberDecoration(spvType, member, TranslateInvariantDecoration(subQualifier)); if (qualifier.storage == glslang::EvqBuffer) { @@ -1878,7 +1882,16 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty // answer sitting already distributed throughout the individual member locations. int location = -1; // will only decorate if present or inherited if (subQualifier.hasLocation()) // no inheritance, or override of inheritance + { + // struct members should not have explicit locations + assert(type.getBasicType() != glslang::EbtStruct); location = subQualifier.layoutLocation; + } + else if (type.getBasicType() != glslang::EbtBlock) + { + // If it is a not a Block, (...) Its members are assigned consecutive locations (...) + // The members, and their nested types, must not themselves have Location decorations. + } else if (qualifier.hasLocation()) // inheritance location = qualifier.layoutLocation + locationOffset; if (qualifier.hasLocation()) // track for upcoming inheritance diff --git a/Test/baseResults/spv.430.vert.out b/Test/baseResults/spv.430.vert.out index a1487d53..19161692 100755 --- a/Test/baseResults/spv.430.vert.out +++ b/Test/baseResults/spv.430.vert.out @@ -63,18 +63,9 @@ Linked vertex stage: Decorate 55(sampb2) Binding 5 Decorate 56(sampb4) DescriptorSet 0 Decorate 56(sampb4) Binding 31 - MemberDecorate 59(S) 0 Flat - MemberDecorate 59(S) 0 Location 1 - MemberDecorate 59(S) 1 Flat - MemberDecorate 59(S) 1 Location 2 - MemberDecorate 59(S) 2 Flat - MemberDecorate 59(S) 2 Location 3 MemberDecorate 60(SS) 0 Flat - MemberDecorate 60(SS) 0 Location 0 MemberDecorate 60(SS) 1 Flat - MemberDecorate 60(SS) 1 Location 1 MemberDecorate 60(SS) 2 Flat - MemberDecorate 60(SS) 2 Location 4 MemberDecorate 63(MS) 0 Location 17 Decorate 63(MS) Block 2: TypeVoid diff --git a/Test/baseResults/spv.localAggregates.frag.out b/Test/baseResults/spv.localAggregates.frag.out index 14f56092..cd8afedc 100755 --- a/Test/baseResults/spv.localAggregates.frag.out +++ b/Test/baseResults/spv.localAggregates.frag.out @@ -66,14 +66,6 @@ Linked fragment stage: MemberName 140(s2) 2 "s1_1" MemberName 140(s2) 3 "bleh" Name 142 "foo2" - MemberDecorate 13(s1) 0 Flat - MemberDecorate 13(s1) 1 Flat - MemberDecorate 14(s2) 0 Flat - MemberDecorate 14(s2) 1 Flat - MemberDecorate 14(s2) 2 Flat - MemberDecorate 14(s2) 3 Flat - MemberDecorate 15(s1) 0 Flat - MemberDecorate 15(s1) 1 Flat MemberDecorate 16(s3) 0 Flat MemberDecorate 16(s3) 1 Flat MemberDecorate 16(s3) 2 Flat @@ -82,8 +74,6 @@ Linked fragment stage: Decorate 131(samp2D) DescriptorSet 0 MemberDecorate 136(s1) 0 Flat MemberDecorate 136(s1) 1 Flat - MemberDecorate 139(s1) 0 Flat - MemberDecorate 139(s1) 1 Flat MemberDecorate 140(s2) 0 Flat MemberDecorate 140(s2) 1 Flat MemberDecorate 140(s2) 2 Flat diff --git a/Test/baseResults/spv.variableArrayIndex.frag.out b/Test/baseResults/spv.variableArrayIndex.frag.out index 75ed07ee..43df45f5 100755 --- a/Test/baseResults/spv.variableArrayIndex.frag.out +++ b/Test/baseResults/spv.variableArrayIndex.frag.out @@ -52,19 +52,10 @@ Linked fragment stage: Name 67 "coord" Name 73 "constructed" Decorate 10(Count) Flat - MemberDecorate 13(lunarStruct1) 0 Flat - MemberDecorate 13(lunarStruct1) 1 Flat - MemberDecorate 14(lunarStruct2) 0 Flat - MemberDecorate 14(lunarStruct2) 1 Flat - MemberDecorate 14(lunarStruct2) 2 Flat - MemberDecorate 18(lunarStruct1) 0 Flat - MemberDecorate 18(lunarStruct1) 1 Flat MemberDecorate 19(lunarStruct3) 0 Flat MemberDecorate 19(lunarStruct3) 1 Flat MemberDecorate 19(lunarStruct3) 2 Flat MemberDecorate 19(lunarStruct3) 3 Flat - MemberDecorate 32(lunarStruct1) 0 Flat - MemberDecorate 32(lunarStruct1) 1 Flat MemberDecorate 33(lunarStruct2) 0 Flat MemberDecorate 33(lunarStruct2) 1 Flat MemberDecorate 33(lunarStruct2) 2 Flat From d3d3ce7160001846ede74978954e67f4f9fd84e4 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Fri, 6 May 2016 13:06:11 -0600 Subject: [PATCH 066/140] Comments only. --- SPIRV/InReadableOrder.cpp | 4 ---- SPIRV/SpvBuilder.cpp | 4 ---- SPIRV/SpvBuilder.h | 4 ---- SPIRV/disassemble.cpp | 4 ---- SPIRV/disassemble.h | 4 ---- SPIRV/doc.cpp | 4 ---- SPIRV/doc.h | 4 ---- SPIRV/spvIR.h | 4 ---- glslang/Include/intermediate.h | 5 +++++ glslang/MachineIndependent/IntermTraverse.cpp | 2 +- 10 files changed, 6 insertions(+), 33 deletions(-) diff --git a/SPIRV/InReadableOrder.cpp b/SPIRV/InReadableOrder.cpp index 142d716b..86aae6d0 100644 --- a/SPIRV/InReadableOrder.cpp +++ b/SPIRV/InReadableOrder.cpp @@ -32,10 +32,6 @@ //ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE //POSSIBILITY OF SUCH DAMAGE. -// -// Author: Dejan Mircevski, Google -// - // The SPIR-V spec requires code blocks to appear in an order satisfying the // dominator-tree direction (ie, dominator before the dominated). This is, // actually, easy to achieve: any pre-order CFG traversal algorithm will do it. diff --git a/SPIRV/SpvBuilder.cpp b/SPIRV/SpvBuilder.cpp index d3f2ced2..53410477 100644 --- a/SPIRV/SpvBuilder.cpp +++ b/SPIRV/SpvBuilder.cpp @@ -33,10 +33,6 @@ //ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE //POSSIBILITY OF SUCH DAMAGE. -// -// Author: John Kessenich, LunarG -// - // // Helper for making SPIR-V IR. Generally, this is documented in the header // SpvBuilder.h. diff --git a/SPIRV/SpvBuilder.h b/SPIRV/SpvBuilder.h index 35138b05..01cd6038 100755 --- a/SPIRV/SpvBuilder.h +++ b/SPIRV/SpvBuilder.h @@ -33,10 +33,6 @@ //ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE //POSSIBILITY OF SUCH DAMAGE. -// -// Author: John Kessenich, LunarG -// - // // "Builder" is an interface to fully build SPIR-V IR. Allocate one of // these to build (a thread safe) internal SPIR-V representation (IR), diff --git a/SPIRV/disassemble.cpp b/SPIRV/disassemble.cpp index e1edddec..75688cb9 100644 --- a/SPIRV/disassemble.cpp +++ b/SPIRV/disassemble.cpp @@ -32,10 +32,6 @@ //ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE //POSSIBILITY OF SUCH DAMAGE. -// -// Author: John Kessenich, LunarG -// - // // Disassembler for SPIR-V. // diff --git a/SPIRV/disassemble.h b/SPIRV/disassemble.h index be537a37..f5d0bc23 100755 --- a/SPIRV/disassemble.h +++ b/SPIRV/disassemble.h @@ -32,10 +32,6 @@ //ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE //POSSIBILITY OF SUCH DAMAGE. -// -// Author: John Kessenich, LunarG -// - // // Disassembler for SPIR-V. // diff --git a/SPIRV/doc.cpp b/SPIRV/doc.cpp index 7ee86b5b..fed3ec42 100755 --- a/SPIRV/doc.cpp +++ b/SPIRV/doc.cpp @@ -32,10 +32,6 @@ //ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE //POSSIBILITY OF SUCH DAMAGE. -// -// Author: John Kessenich, LunarG -// - // // 1) Programatically fill in instruction/operand information. // This can be used for disassembly, printing documentation, etc. diff --git a/SPIRV/doc.h b/SPIRV/doc.h index b7929793..cf9e059b 100644 --- a/SPIRV/doc.h +++ b/SPIRV/doc.h @@ -32,10 +32,6 @@ //ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE //POSSIBILITY OF SUCH DAMAGE. -// -// Author: John Kessenich, LunarG -// - // // Parameterize the SPIR-V enumerants. // diff --git a/SPIRV/spvIR.h b/SPIRV/spvIR.h index 3c483872..7c9fb987 100755 --- a/SPIRV/spvIR.h +++ b/SPIRV/spvIR.h @@ -32,10 +32,6 @@ //ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE //POSSIBILITY OF SUCH DAMAGE. -// -// Author: John Kessenich, LunarG -// - // SPIRV-IR // // Simple in-memory representation (IR) of SPIRV. Just for holding diff --git a/glslang/Include/intermediate.h b/glslang/Include/intermediate.h index 6353a0a0..3b819de0 100644 --- a/glslang/Include/intermediate.h +++ b/glslang/Include/intermediate.h @@ -1002,6 +1002,11 @@ enum TVisit // If you only want post-visits, explicitly turn off preVisit (and inVisit) // and turn on postVisit. // +// In general, for the visit*() methods, return true from interior nodes +// to have the traversal continue on to children. +// +// If you process children yourself, or don't want them processed, return false. +// class TIntermTraverser { public: POOL_ALLOCATOR_NEW_DELETE(glslang::GetThreadPoolAllocator()) diff --git a/glslang/MachineIndependent/IntermTraverse.cpp b/glslang/MachineIndependent/IntermTraverse.cpp index 44743eaf..b910f473 100644 --- a/glslang/MachineIndependent/IntermTraverse.cpp +++ b/glslang/MachineIndependent/IntermTraverse.cpp @@ -115,7 +115,7 @@ void TIntermBinary::traverse(TIntermTraverser *it) // // Visit the node after the children, if requested and the traversal - // hasn't been cancelled yet. + // hasn't been canceled yet. // if (visit && it->postVisit) it->visitBinary(EvPostVisit, this); From 9220dbb078c0652028186b3aa2d1238f4bb8dfa1 Mon Sep 17 00:00:00 2001 From: qining Date: Wed, 4 May 2016 17:34:38 -0400 Subject: [PATCH 067/140] Precise and noContraction propagation Reimplement the whole workflow to make that: precise'ness of struct members won't spread to other non-precise members of the same struct instance. Approach: 1. Build the map from symbols to their defining nodes. And for each object node (StructIndex, DirectIndex, Symbol nodes, etc), generates an accesschain path. Different AST nodes that indicating a same object should have the same accesschain path. 2. Along the building phase in step 1, collect the initial set of 'precise' (AST qualifier: 'noContraction') objects' accesschain paths. 3. Start with the initial set of 'precise' accesschain paths, use it as a worklist, do as the following steps until the worklist is empty: 1) Pop an accesschain path from worklist. 2) Get the symbol part from the accesschain path. 3) Find the defining nodes of that symbol. 4) For each defining node, check whether it is defining a 'precise' object, or its assignee has nested 'precise' object. Get the incremental path from assignee to its nested 'precise' object (if any). 5) Traverse the right side of the defining node, obtain the accesschain paths of the corresponding involved 'precise' objects. Update the worklist with those new objects' accesschain paths. Label involved operations with 'noContraction'. In each step, whenever we find the parent object of an nested object is 'precise' (has 'noContraction' qualifier), we let the nested object inherit the 'precise'ness from its parent object. --- SPIRV/GlslangToSpv.cpp | 21 +- Test/baseResults/precise.tesc.out | 728 ++++++++++++ .../baseResults/precise_struct_block.vert.out | 1045 +++++++++++++++++ Test/baseResults/spv.precise.tesc.out | 122 ++ Test/baseResults/spv.precise.tese.out | 192 +++ Test/precise.tesc | 102 ++ Test/precise_struct_block.vert | 89 ++ Test/spv.precise.tesc | 24 + Test/spv.precise.tese | 36 + Test/test-spirv-list | 2 + Test/testlist | 2 + glslang/CMakeLists.txt | 2 + glslang/MachineIndependent/Intermediate.cpp | 4 + .../propagateNoContraction.cpp | 886 ++++++++++++++ .../propagateNoContraction.h | 53 + 15 files changed, 3307 insertions(+), 1 deletion(-) create mode 100644 Test/baseResults/precise.tesc.out create mode 100644 Test/baseResults/precise_struct_block.vert.out create mode 100644 Test/baseResults/spv.precise.tesc.out create mode 100644 Test/baseResults/spv.precise.tese.out create mode 100644 Test/precise.tesc create mode 100644 Test/precise_struct_block.vert create mode 100644 Test/spv.precise.tesc create mode 100644 Test/spv.precise.tese create mode 100644 glslang/MachineIndependent/propagateNoContraction.cpp create mode 100644 glslang/MachineIndependent/propagateNoContraction.h diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 7aa62fbd..d160e36e 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -385,6 +385,15 @@ spv::Decoration TranslateInvariantDecoration(const glslang::TQualifier& qualifie return (spv::Decoration)spv::BadValue; } +// If glslang type is noContraction, return SPIR-V NoContraction decoration. +spv::Decoration TranslateNoContractionDecoration(const glslang::TQualifier& qualifier) +{ + if (qualifier.noContraction) + return spv::DecorationNoContraction; + else + return (spv::Decoration)spv::BadValue; +} + // Translate glslang built-in variable to SPIR-V built in decoration. spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltInVariable builtIn) { @@ -612,7 +621,8 @@ bool HasNonLayoutQualifiers(const glslang::TQualifier& qualifier) // - struct members can inherit from a struct declaration // - effect decorations on the struct members (note smooth does not, and expecting something like volatile to effect the whole object) // - are not part of the offset/st430/etc or row/column-major layout - return qualifier.invariant || qualifier.nopersp || qualifier.flat || qualifier.centroid || qualifier.patch || qualifier.sample || qualifier.hasLocation(); + return qualifier.invariant || qualifier.nopersp || qualifier.flat || qualifier.centroid || qualifier.patch || qualifier.sample || qualifier.hasLocation() || + qualifier.noContraction; } // @@ -877,6 +887,9 @@ bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::T convertGlslangToSpvType(node->getType()), leftRValue, rValue, node->getType().getBasicType()); + // Decorate this instruction, if this node has 'noContraction' qualifier. + addDecoration(rValue, TranslateNoContractionDecoration(node->getType().getQualifier())); + // these all need their counterparts in createBinaryOperation() assert(rValue != spv::NoResult); } @@ -1000,6 +1013,8 @@ bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::T logger->missingFunctionality("unknown glslang binary operation"); return true; // pick up a child as the place-holder result } else { + // Decorate this instruction, if this node has 'noContraction' qualifier. + addDecoration(result, TranslateNoContractionDecoration(node->getType().getQualifier())); builder.setAccessChainRValue(result); return false; } @@ -1068,6 +1083,8 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI result = createUnaryOperation(node->getOp(), precision, convertGlslangToSpvType(node->getType()), operand, node->getOperand()->getBasicType()); if (result) { + // Decorate this instruction, if this node has 'noContraction' qualifier. + addDecoration(result, TranslateNoContractionDecoration(node->getType().getQualifier())); builder.clearAccessChain(); builder.setAccessChainRValue(result); @@ -1100,6 +1117,8 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI convertGlslangToSpvType(node->getType()), operand, one, node->getType().getBasicType()); assert(result != spv::NoResult); + // Decorate this instruction, if this node has 'noContraction' qualifier. + addDecoration(result, TranslateNoContractionDecoration(node->getType().getQualifier())); // The result of operation is always stored, but conditionally the // consumed result. The consumed result is always an r-value. diff --git a/Test/baseResults/precise.tesc.out b/Test/baseResults/precise.tesc.out new file mode 100644 index 00000000..d14af90e --- /dev/null +++ b/Test/baseResults/precise.tesc.out @@ -0,0 +1,728 @@ +precise.tesc +Warning, version 450 is not yet complete; most version-specific features are present, but some are missing. + +Shader version: 450 +Requested GL_EXT_gpu_shader5 +Requested GL_EXT_shader_io_blocks +Requested GL_EXT_tessellation_shader +vertices = -1 +0:? Sequence +0:5 Function Definition: minimal( (global float) +0:5 Function Parameters: +0:6 Sequence +0:6 Sequence +0:6 move second child to first child (temp float) +0:6 'result' (noContraction temp float) +0:6 Constant: +0:6 5.000000 +0:7 Sequence +0:7 move second child to first child (temp float) +0:7 'a' (noContraction temp float) +0:7 Constant: +0:7 10.000000 +0:8 Sequence +0:8 move second child to first child (temp float) +0:8 'b' (noContraction temp float) +0:8 Constant: +0:8 20.000000 +0:9 Sequence +0:9 move second child to first child (temp float) +0:9 'c' (noContraction temp float) +0:9 Constant: +0:9 30.000000 +0:10 Sequence +0:10 move second child to first child (temp float) +0:10 'd' (noContraction temp float) +0:10 Constant: +0:10 40.000000 +0:11 move second child to first child (temp float) +0:11 'result' (noContraction temp float) +0:11 add (noContraction temp float) +0:11 component-wise multiply (noContraction temp float) +0:11 'a' (noContraction temp float) +0:11 'b' (noContraction temp float) +0:11 component-wise multiply (noContraction temp float) +0:11 'c' (noContraction temp float) +0:11 'd' (noContraction temp float) +0:12 Branch: Return with expression +0:12 'result' (noContraction temp float) +0:15 Function Definition: continuous_assignment( (global void) +0:15 Function Parameters: +0:16 Sequence +0:16 Sequence +0:16 move second child to first child (temp float) +0:16 'result' (noContraction temp float) +0:16 Constant: +0:16 5.000000 +0:17 Sequence +0:17 move second child to first child (temp int) +0:17 'a' (noContraction temp int) +0:17 Constant: +0:17 10 (const int) +0:18 Sequence +0:18 move second child to first child (temp int) +0:18 'b' (noContraction temp int) +0:18 Constant: +0:18 20 (const int) +0:19 move second child to first child (temp float) +0:19 'result' (noContraction temp float) +0:19 Convert int to float (temp float) +0:19 move second child to first child (temp int) +0:19 'a' (noContraction temp int) +0:19 add (noContraction temp int) +0:19 'b' (noContraction temp int) +0:19 Constant: +0:19 4 (const int) +0:22 Function Definition: convert( (global void) +0:22 Function Parameters: +0:? Sequence +0:24 Sequence +0:24 move second child to first child (temp int) +0:24 'a' (noContraction temp int) +0:24 Constant: +0:24 10 (const int) +0:25 Sequence +0:25 move second child to first child (temp int) +0:25 'b' (noContraction temp int) +0:25 Constant: +0:25 20 (const int) +0:26 move second child to first child (temp int) +0:26 'b' (noContraction temp int) +0:26 add (noContraction temp int) +0:26 'a' (noContraction temp int) +0:26 'b' (noContraction temp int) +0:27 move second child to first child (temp float) +0:27 'result' (noContraction temp float) +0:27 Convert int to float (temp float) +0:27 'b' (noContraction temp int) +0:30 Function Definition: loop_for( (global float) +0:30 Function Parameters: +0:31 Sequence +0:31 Sequence +0:31 move second child to first child (temp float) +0:31 'r1' (noContraction temp float) +0:31 Constant: +0:31 5.000000 +0:32 Sequence +0:32 move second child to first child (temp float) +0:32 'r2' (noContraction temp float) +0:32 Constant: +0:32 10.000000 +0:33 Sequence +0:33 move second child to first child (temp int) +0:33 'a' (temp int) +0:33 Constant: +0:33 10 (const int) +0:34 Sequence +0:34 move second child to first child (temp int) +0:34 'b' (noContraction temp int) +0:34 Constant: +0:34 20 (const int) +0:35 Sequence +0:35 move second child to first child (temp int) +0:35 'c' (noContraction temp int) +0:35 Constant: +0:35 30 (const int) +0:36 Sequence +0:36 Sequence +0:36 move second child to first child (temp int) +0:36 'i' (noContraction temp int) +0:36 Constant: +0:36 0 (const int) +0:36 Loop with condition tested first +0:36 Loop Condition +0:36 Compare Less Than (temp bool) +0:36 'i' (temp int) +0:36 'a' (temp int) +0:36 Loop Body +0:37 Sequence +0:37 add second child into first child (noContraction temp float) +0:37 'r1' (noContraction temp float) +0:37 add (noContraction temp float) +0:37 add (noContraction temp float) +0:37 Constant: +0:37 3.120000 +0:37 Convert int to float (temp float) +0:37 'b' (noContraction temp int) +0:37 Convert int to float (temp float) +0:37 'i' (noContraction temp int) +0:38 add second child into first child (noContraction temp int) +0:38 'c' (noContraction temp int) +0:38 Constant: +0:38 1 (const int) +0:36 Loop Terminal Expression +0:36 Post-Increment (noContraction temp int) +0:36 'i' (noContraction temp int) +0:40 add second child into first child (temp int) +0:40 'a' (temp int) +0:40 Constant: +0:40 1 (const int) +0:41 move second child to first child (temp float) +0:41 'r2' (noContraction temp float) +0:41 Convert int to float (temp float) +0:41 'c' (noContraction temp int) +0:42 Branch: Return with expression +0:42 Construct float (temp float) +0:42 add (temp float) +0:42 'r1' (noContraction temp float) +0:42 'r2' (noContraction temp float) +0:45 Function Definition: loop_array( (global void) +0:45 Function Parameters: +0:46 Sequence +0:46 Sequence +0:46 move second child to first child (temp int) +0:46 'result' (noContraction temp int) +0:46 Constant: +0:46 5 (const int) +0:48 Sequence +0:48 move second child to first child (temp int) +0:48 'x' (noContraction temp int) +0:48 Constant: +0:48 22 (const int) +0:49 Sequence +0:49 move second child to first child (temp int) +0:49 'y' (noContraction temp int) +0:49 Constant: +0:49 33 (const int) +0:52 add second child into first child (noContraction temp int) +0:52 'result' (noContraction temp int) +0:52 add (noContraction temp int) +0:52 'x' (noContraction temp int) +0:52 'y' (noContraction temp int) +0:54 Sequence +0:54 Sequence +0:54 move second child to first child (temp int) +0:54 'i' (temp int) +0:54 Constant: +0:54 0 (const int) +0:54 Loop with condition tested first +0:54 Loop Condition +0:54 Compare Less Than (temp bool) +0:54 'i' (temp int) +0:54 Constant: +0:54 3 (const int) +0:54 Loop Body +0:56 Sequence +0:56 add second child into first child (noContraction temp int) +0:56 'result' (noContraction temp int) +0:56 add (noContraction temp int) +0:56 indirect index (noContraction temp int) +0:56 'a0' (temp 3-element array of int) +0:56 'i' (temp int) +0:56 Constant: +0:56 2 (const int) +0:58 move second child to first child (temp int) +0:58 indirect index (noContraction temp int) +0:58 'a0' (noContraction temp 3-element array of int) +0:58 'i' (temp int) +0:58 subtract (noContraction temp int) +0:58 Constant: +0:58 3 (const int) +0:58 Post-Increment (noContraction temp int) +0:58 'result' (noContraction temp int) +0:54 Loop Terminal Expression +0:54 Pre-Increment (temp int) +0:54 'i' (temp int) +0:62 Function Definition: loop_while( (global void) +0:62 Function Parameters: +0:63 Sequence +0:63 Sequence +0:63 move second child to first child (temp float) +0:63 'result' (noContraction temp float) +0:63 Constant: +0:63 5.000000 +0:64 Sequence +0:64 move second child to first child (temp int) +0:64 'a' (noContraction temp int) +0:64 Constant: +0:64 10 (const int) +0:65 Sequence +0:65 move second child to first child (temp int) +0:65 'b' (noContraction temp int) +0:65 Constant: +0:65 20 (const int) +0:66 Loop with condition tested first +0:66 Loop Condition +0:66 Compare Less Than (temp bool) +0:66 'result' (noContraction temp float) +0:66 Constant: +0:66 10.000000 +0:66 Loop Body +0:67 Sequence +0:67 add second child into first child (noContraction temp float) +0:67 'result' (noContraction temp float) +0:67 add (noContraction temp float) +0:67 Constant: +0:67 3.120000 +0:67 Convert int to float (temp float) +0:67 'b' (noContraction temp int) +0:69 move second child to first child (temp float) +0:69 'result' (noContraction temp float) +0:69 Convert int to float (temp float) +0:69 add (noContraction temp int) +0:69 add (noContraction temp int) +0:69 'a' (noContraction temp int) +0:69 'b' (noContraction temp int) +0:69 Constant: +0:69 5 (const int) +0:70 move second child to first child (temp float) +0:70 'result' (noContraction temp float) +0:70 Constant: +0:70 11.100000 +0:73 Function Definition: fma_not_decorated( (global float) +0:73 Function Parameters: +0:? Sequence +0:75 Sequence +0:75 move second child to first child (temp float) +0:75 'a' (noContraction temp float) +0:75 Constant: +0:75 1.000000 +0:76 Sequence +0:76 move second child to first child (temp float) +0:76 'b' (noContraction temp float) +0:76 Constant: +0:76 2.000000 +0:77 Sequence +0:77 move second child to first child (temp float) +0:77 'c' (noContraction temp float) +0:77 Constant: +0:77 3.000000 +0:78 move second child to first child (temp float) +0:78 'b' (noContraction temp float) +0:78 add (noContraction temp float) +0:78 'b' (noContraction temp float) +0:78 'c' (noContraction temp float) +0:79 move second child to first child (temp float) +0:79 'result' (noContraction temp float) +0:79 fma (global float) +0:79 'a' (noContraction temp float) +0:79 'b' (noContraction temp float) +0:79 'c' (noContraction temp float) +0:80 Branch: Return with expression +0:80 'result' (noContraction temp float) +0:83 Function Definition: precise_return_exp_func( (noContraction temp float) +0:83 Function Parameters: +0:84 Sequence +0:84 Sequence +0:84 move second child to first child (temp float) +0:84 'a' (noContraction temp float) +0:84 Constant: +0:84 1.000000 +0:85 Sequence +0:85 move second child to first child (temp float) +0:85 'b' (noContraction temp float) +0:85 Constant: +0:85 2.000000 +0:86 Branch: Return with expression +0:86 add (noContraction temp float) +0:86 'a' (noContraction temp float) +0:86 'b' (noContraction temp float) +0:89 Function Definition: precise_return_val_func( (noContraction temp float) +0:89 Function Parameters: +0:90 Sequence +0:90 Sequence +0:90 move second child to first child (temp float) +0:90 'a' (noContraction temp float) +0:90 Constant: +0:90 1.000000 +0:91 Sequence +0:91 move second child to first child (temp float) +0:91 'b' (noContraction temp float) +0:91 Constant: +0:91 2.000000 +0:92 Sequence +0:92 move second child to first child (temp float) +0:92 'result' (noContraction temp float) +0:92 add (noContraction temp float) +0:92 'a' (noContraction temp float) +0:92 'b' (noContraction temp float) +0:93 Branch: Return with expression +0:93 'result' (noContraction temp float) +0:96 Function Definition: precise_func_parameter(f1;f1; (global float) +0:96 Function Parameters: +0:96 'b' (in float) +0:96 'c' (out float) +0:97 Sequence +0:97 Sequence +0:97 move second child to first child (temp float) +0:97 'a' (temp float) +0:97 Constant: +0:97 0.500000 +0:98 move second child to first child (temp float) +0:98 'c' (out float) +0:98 add (temp float) +0:98 'a' (temp float) +0:98 'b' (in float) +0:99 Branch: Return with expression +0:99 subtract (temp float) +0:99 'a' (temp float) +0:99 'b' (in float) +0:102 Function Definition: main( (global void) +0:102 Function Parameters: +0:? Linker Objects + + +Linked tessellation control stage: + +ERROR: Linking tessellation control stage: At least one shader must specify an output layout(vertices=...) + +Shader version: 450 +Requested GL_EXT_gpu_shader5 +Requested GL_EXT_shader_io_blocks +Requested GL_EXT_tessellation_shader +vertices = -1 +0:? Sequence +0:5 Function Definition: minimal( (global float) +0:5 Function Parameters: +0:6 Sequence +0:6 Sequence +0:6 move second child to first child (temp float) +0:6 'result' (noContraction temp float) +0:6 Constant: +0:6 5.000000 +0:7 Sequence +0:7 move second child to first child (temp float) +0:7 'a' (noContraction temp float) +0:7 Constant: +0:7 10.000000 +0:8 Sequence +0:8 move second child to first child (temp float) +0:8 'b' (noContraction temp float) +0:8 Constant: +0:8 20.000000 +0:9 Sequence +0:9 move second child to first child (temp float) +0:9 'c' (noContraction temp float) +0:9 Constant: +0:9 30.000000 +0:10 Sequence +0:10 move second child to first child (temp float) +0:10 'd' (noContraction temp float) +0:10 Constant: +0:10 40.000000 +0:11 move second child to first child (temp float) +0:11 'result' (noContraction temp float) +0:11 add (noContraction temp float) +0:11 component-wise multiply (noContraction temp float) +0:11 'a' (noContraction temp float) +0:11 'b' (noContraction temp float) +0:11 component-wise multiply (noContraction temp float) +0:11 'c' (noContraction temp float) +0:11 'd' (noContraction temp float) +0:12 Branch: Return with expression +0:12 'result' (noContraction temp float) +0:15 Function Definition: continuous_assignment( (global void) +0:15 Function Parameters: +0:16 Sequence +0:16 Sequence +0:16 move second child to first child (temp float) +0:16 'result' (noContraction temp float) +0:16 Constant: +0:16 5.000000 +0:17 Sequence +0:17 move second child to first child (temp int) +0:17 'a' (noContraction temp int) +0:17 Constant: +0:17 10 (const int) +0:18 Sequence +0:18 move second child to first child (temp int) +0:18 'b' (noContraction temp int) +0:18 Constant: +0:18 20 (const int) +0:19 move second child to first child (temp float) +0:19 'result' (noContraction temp float) +0:19 Convert int to float (temp float) +0:19 move second child to first child (temp int) +0:19 'a' (noContraction temp int) +0:19 add (noContraction temp int) +0:19 'b' (noContraction temp int) +0:19 Constant: +0:19 4 (const int) +0:22 Function Definition: convert( (global void) +0:22 Function Parameters: +0:? Sequence +0:24 Sequence +0:24 move second child to first child (temp int) +0:24 'a' (noContraction temp int) +0:24 Constant: +0:24 10 (const int) +0:25 Sequence +0:25 move second child to first child (temp int) +0:25 'b' (noContraction temp int) +0:25 Constant: +0:25 20 (const int) +0:26 move second child to first child (temp int) +0:26 'b' (noContraction temp int) +0:26 add (noContraction temp int) +0:26 'a' (noContraction temp int) +0:26 'b' (noContraction temp int) +0:27 move second child to first child (temp float) +0:27 'result' (noContraction temp float) +0:27 Convert int to float (temp float) +0:27 'b' (noContraction temp int) +0:30 Function Definition: loop_for( (global float) +0:30 Function Parameters: +0:31 Sequence +0:31 Sequence +0:31 move second child to first child (temp float) +0:31 'r1' (noContraction temp float) +0:31 Constant: +0:31 5.000000 +0:32 Sequence +0:32 move second child to first child (temp float) +0:32 'r2' (noContraction temp float) +0:32 Constant: +0:32 10.000000 +0:33 Sequence +0:33 move second child to first child (temp int) +0:33 'a' (temp int) +0:33 Constant: +0:33 10 (const int) +0:34 Sequence +0:34 move second child to first child (temp int) +0:34 'b' (noContraction temp int) +0:34 Constant: +0:34 20 (const int) +0:35 Sequence +0:35 move second child to first child (temp int) +0:35 'c' (noContraction temp int) +0:35 Constant: +0:35 30 (const int) +0:36 Sequence +0:36 Sequence +0:36 move second child to first child (temp int) +0:36 'i' (noContraction temp int) +0:36 Constant: +0:36 0 (const int) +0:36 Loop with condition tested first +0:36 Loop Condition +0:36 Compare Less Than (temp bool) +0:36 'i' (temp int) +0:36 'a' (temp int) +0:36 Loop Body +0:37 Sequence +0:37 add second child into first child (noContraction temp float) +0:37 'r1' (noContraction temp float) +0:37 add (noContraction temp float) +0:37 add (noContraction temp float) +0:37 Constant: +0:37 3.120000 +0:37 Convert int to float (temp float) +0:37 'b' (noContraction temp int) +0:37 Convert int to float (temp float) +0:37 'i' (noContraction temp int) +0:38 add second child into first child (noContraction temp int) +0:38 'c' (noContraction temp int) +0:38 Constant: +0:38 1 (const int) +0:36 Loop Terminal Expression +0:36 Post-Increment (noContraction temp int) +0:36 'i' (noContraction temp int) +0:40 add second child into first child (temp int) +0:40 'a' (temp int) +0:40 Constant: +0:40 1 (const int) +0:41 move second child to first child (temp float) +0:41 'r2' (noContraction temp float) +0:41 Convert int to float (temp float) +0:41 'c' (noContraction temp int) +0:42 Branch: Return with expression +0:42 Construct float (temp float) +0:42 add (temp float) +0:42 'r1' (noContraction temp float) +0:42 'r2' (noContraction temp float) +0:45 Function Definition: loop_array( (global void) +0:45 Function Parameters: +0:46 Sequence +0:46 Sequence +0:46 move second child to first child (temp int) +0:46 'result' (noContraction temp int) +0:46 Constant: +0:46 5 (const int) +0:48 Sequence +0:48 move second child to first child (temp int) +0:48 'x' (noContraction temp int) +0:48 Constant: +0:48 22 (const int) +0:49 Sequence +0:49 move second child to first child (temp int) +0:49 'y' (noContraction temp int) +0:49 Constant: +0:49 33 (const int) +0:52 add second child into first child (noContraction temp int) +0:52 'result' (noContraction temp int) +0:52 add (noContraction temp int) +0:52 'x' (noContraction temp int) +0:52 'y' (noContraction temp int) +0:54 Sequence +0:54 Sequence +0:54 move second child to first child (temp int) +0:54 'i' (temp int) +0:54 Constant: +0:54 0 (const int) +0:54 Loop with condition tested first +0:54 Loop Condition +0:54 Compare Less Than (temp bool) +0:54 'i' (temp int) +0:54 Constant: +0:54 3 (const int) +0:54 Loop Body +0:56 Sequence +0:56 add second child into first child (noContraction temp int) +0:56 'result' (noContraction temp int) +0:56 add (noContraction temp int) +0:56 indirect index (noContraction temp int) +0:56 'a0' (temp 3-element array of int) +0:56 'i' (temp int) +0:56 Constant: +0:56 2 (const int) +0:58 move second child to first child (temp int) +0:58 indirect index (noContraction temp int) +0:58 'a0' (noContraction temp 3-element array of int) +0:58 'i' (temp int) +0:58 subtract (noContraction temp int) +0:58 Constant: +0:58 3 (const int) +0:58 Post-Increment (noContraction temp int) +0:58 'result' (noContraction temp int) +0:54 Loop Terminal Expression +0:54 Pre-Increment (temp int) +0:54 'i' (temp int) +0:62 Function Definition: loop_while( (global void) +0:62 Function Parameters: +0:63 Sequence +0:63 Sequence +0:63 move second child to first child (temp float) +0:63 'result' (noContraction temp float) +0:63 Constant: +0:63 5.000000 +0:64 Sequence +0:64 move second child to first child (temp int) +0:64 'a' (noContraction temp int) +0:64 Constant: +0:64 10 (const int) +0:65 Sequence +0:65 move second child to first child (temp int) +0:65 'b' (noContraction temp int) +0:65 Constant: +0:65 20 (const int) +0:66 Loop with condition tested first +0:66 Loop Condition +0:66 Compare Less Than (temp bool) +0:66 'result' (noContraction temp float) +0:66 Constant: +0:66 10.000000 +0:66 Loop Body +0:67 Sequence +0:67 add second child into first child (noContraction temp float) +0:67 'result' (noContraction temp float) +0:67 add (noContraction temp float) +0:67 Constant: +0:67 3.120000 +0:67 Convert int to float (temp float) +0:67 'b' (noContraction temp int) +0:69 move second child to first child (temp float) +0:69 'result' (noContraction temp float) +0:69 Convert int to float (temp float) +0:69 add (noContraction temp int) +0:69 add (noContraction temp int) +0:69 'a' (noContraction temp int) +0:69 'b' (noContraction temp int) +0:69 Constant: +0:69 5 (const int) +0:70 move second child to first child (temp float) +0:70 'result' (noContraction temp float) +0:70 Constant: +0:70 11.100000 +0:73 Function Definition: fma_not_decorated( (global float) +0:73 Function Parameters: +0:? Sequence +0:75 Sequence +0:75 move second child to first child (temp float) +0:75 'a' (noContraction temp float) +0:75 Constant: +0:75 1.000000 +0:76 Sequence +0:76 move second child to first child (temp float) +0:76 'b' (noContraction temp float) +0:76 Constant: +0:76 2.000000 +0:77 Sequence +0:77 move second child to first child (temp float) +0:77 'c' (noContraction temp float) +0:77 Constant: +0:77 3.000000 +0:78 move second child to first child (temp float) +0:78 'b' (noContraction temp float) +0:78 add (noContraction temp float) +0:78 'b' (noContraction temp float) +0:78 'c' (noContraction temp float) +0:79 move second child to first child (temp float) +0:79 'result' (noContraction temp float) +0:79 fma (global float) +0:79 'a' (noContraction temp float) +0:79 'b' (noContraction temp float) +0:79 'c' (noContraction temp float) +0:80 Branch: Return with expression +0:80 'result' (noContraction temp float) +0:83 Function Definition: precise_return_exp_func( (noContraction temp float) +0:83 Function Parameters: +0:84 Sequence +0:84 Sequence +0:84 move second child to first child (temp float) +0:84 'a' (noContraction temp float) +0:84 Constant: +0:84 1.000000 +0:85 Sequence +0:85 move second child to first child (temp float) +0:85 'b' (noContraction temp float) +0:85 Constant: +0:85 2.000000 +0:86 Branch: Return with expression +0:86 add (noContraction temp float) +0:86 'a' (noContraction temp float) +0:86 'b' (noContraction temp float) +0:89 Function Definition: precise_return_val_func( (noContraction temp float) +0:89 Function Parameters: +0:90 Sequence +0:90 Sequence +0:90 move second child to first child (temp float) +0:90 'a' (noContraction temp float) +0:90 Constant: +0:90 1.000000 +0:91 Sequence +0:91 move second child to first child (temp float) +0:91 'b' (noContraction temp float) +0:91 Constant: +0:91 2.000000 +0:92 Sequence +0:92 move second child to first child (temp float) +0:92 'result' (noContraction temp float) +0:92 add (noContraction temp float) +0:92 'a' (noContraction temp float) +0:92 'b' (noContraction temp float) +0:93 Branch: Return with expression +0:93 'result' (noContraction temp float) +0:96 Function Definition: precise_func_parameter(f1;f1; (global float) +0:96 Function Parameters: +0:96 'b' (in float) +0:96 'c' (out float) +0:97 Sequence +0:97 Sequence +0:97 move second child to first child (temp float) +0:97 'a' (temp float) +0:97 Constant: +0:97 0.500000 +0:98 move second child to first child (temp float) +0:98 'c' (out float) +0:98 add (temp float) +0:98 'a' (temp float) +0:98 'b' (in float) +0:99 Branch: Return with expression +0:99 subtract (temp float) +0:99 'a' (temp float) +0:99 'b' (in float) +0:102 Function Definition: main( (global void) +0:102 Function Parameters: +0:? Linker Objects + diff --git a/Test/baseResults/precise_struct_block.vert.out b/Test/baseResults/precise_struct_block.vert.out new file mode 100644 index 00000000..7d783e55 --- /dev/null +++ b/Test/baseResults/precise_struct_block.vert.out @@ -0,0 +1,1045 @@ +precise_struct_block.vert +Warning, version 450 is not yet complete; most version-specific features are present, but some are missing. + +Shader version: 450 +0:? Sequence +0:11 Function Definition: struct_member( (global float) +0:11 Function Parameters: +0:12 Sequence +0:12 Sequence +0:12 move second child to first child (temp float) +0:12 'a' (noContraction temp float) +0:12 Constant: +0:12 1.000000 +0:13 Sequence +0:13 move second child to first child (temp float) +0:13 'b' (temp float) +0:13 Constant: +0:13 2.000000 +0:14 Sequence +0:14 move second child to first child (temp float) +0:14 'c' (temp float) +0:14 Constant: +0:14 3.000000 +0:15 Sequence +0:15 move second child to first child (temp float) +0:15 'd' (temp float) +0:15 Constant: +0:15 4.000000 +0:21 move second child to first child (temp float) +0:21 f1: direct index for structure (noContraction global float) +0:21 'S2' (temp structure{global float f1, global float f2}) +0:21 Constant: +0:21 0 (const int) +0:21 add (noContraction temp float) +0:21 'a' (noContraction temp float) +0:21 Constant: +0:21 0.200000 +0:22 move second child to first child (temp float) +0:22 f2: direct index for structure (global float) +0:22 'S2' (temp structure{global float f1, global float f2}) +0:22 Constant: +0:22 1 (const int) +0:22 add (temp float) +0:22 'b' (temp float) +0:22 Constant: +0:22 0.200000 +0:23 move second child to first child (temp float) +0:23 f1: direct index for structure (global float) +0:23 'S3' (temp structure{global float f1, global float f2}) +0:23 Constant: +0:23 0 (const int) +0:23 add (temp float) +0:23 'a' (temp float) +0:23 'b' (temp float) +0:24 move second child to first child (temp structure{global float f1, global float f2}) +0:24 'S' (temp structure{global float f1, global float f2}) +0:24 'S2' (temp structure{global float f1, global float f2}) +0:25 move second child to first child (temp float) +0:25 'result' (noContraction temp float) +0:25 add (noContraction temp float) +0:25 f1: direct index for structure (noContraction global float) +0:25 'S' (temp structure{global float f1, global float f2}) +0:25 Constant: +0:25 0 (const int) +0:25 Constant: +0:25 0.100000 +0:27 Branch: Return with expression +0:27 'result' (noContraction temp float) +0:30 Function Definition: complex_array_struct( (global float) +0:30 Function Parameters: +0:? Sequence +0:43 Sequence +0:43 Sequence +0:43 move second child to first child (temp int) +0:43 'i' (noContraction temp int) +0:43 Constant: +0:43 0 (const int) +0:43 Loop with condition tested first +0:43 Loop Condition +0:43 Compare Less Than (temp bool) +0:43 'i' (temp int) +0:43 Constant: +0:43 10 (const int) +0:43 Loop Body +0:44 Sequence +0:44 move second child to first child (temp float) +0:44 f: direct index for structure (temp float) +0:44 indirect index (temp structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:44 't3' (temp 10-element array of structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:44 'i' (temp int) +0:44 Constant: +0:44 0 (const int) +0:44 divide (temp float) +0:44 Convert int to float (temp float) +0:44 'i' (temp int) +0:44 Constant: +0:44 3.000000 +0:45 move second child to first child (temp 4-component vector of float) +0:45 v: direct index for structure (noContraction temp 4-component vector of float) +0:45 indirect index (temp structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:45 't3' (temp 10-element array of structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:45 'i' (temp int) +0:45 Constant: +0:45 2 (const int) +0:45 Construct vec4 (temp 4-component vector of float) +0:45 component-wise multiply (noContraction temp float) +0:45 Convert int to float (temp float) +0:45 'i' (noContraction temp int) +0:45 Constant: +0:45 1.500000 +0:46 move second child to first child (temp int) +0:46 p: direct index for structure (temp int) +0:46 indirect index (temp structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:46 't3' (temp 10-element array of structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:46 'i' (temp int) +0:46 Constant: +0:46 3 (const int) +0:46 add (temp int) +0:46 'i' (temp int) +0:46 Constant: +0:46 1 (const int) +0:47 Sequence +0:47 Sequence +0:47 move second child to first child (temp int) +0:47 'j' (temp int) +0:47 Constant: +0:47 0 (const int) +0:47 Loop with condition tested first +0:47 Loop Condition +0:47 Compare Less Than (temp bool) +0:47 'j' (temp int) +0:47 Constant: +0:47 5 (const int) +0:47 Loop Body +0:48 Sequence +0:48 Sequence +0:48 Sequence +0:48 move second child to first child (temp int) +0:48 'k' (temp int) +0:48 Constant: +0:48 0 (const int) +0:48 Loop with condition tested first +0:48 Loop Condition +0:48 Compare Less Than (temp bool) +0:48 'k' (temp int) +0:48 Constant: +0:48 3 (const int) +0:48 Loop Body +0:49 Sequence +0:49 move second child to first child (temp float) +0:49 indirect index (temp float) +0:49 t1_array: direct index for structure (temp 3-element array of float) +0:49 indirect index (temp structure{temp 3-element array of float t1_array, temp float t1_scalar}) +0:49 t1a: direct index for structure (temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar}) +0:49 t2: direct index for structure (temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c}) +0:49 indirect index (temp structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:49 't3' (temp 10-element array of structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:49 'i' (temp int) +0:49 Constant: +0:49 1 (const int) +0:49 Constant: +0:49 0 (const int) +0:49 'j' (temp int) +0:49 Constant: +0:49 0 (const int) +0:49 'k' (temp int) +0:49 Convert int to float (temp float) +0:49 add (temp int) +0:49 component-wise multiply (temp int) +0:49 'i' (temp int) +0:49 'j' (temp int) +0:49 'k' (temp int) +0:48 Loop Terminal Expression +0:48 Post-Increment (temp int) +0:48 'k' (temp int) +0:51 move second child to first child (temp float) +0:51 t1_scalar: direct index for structure (temp float) +0:51 indirect index (temp structure{temp 3-element array of float t1_array, temp float t1_scalar}) +0:51 t1a: direct index for structure (temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar}) +0:51 t2: direct index for structure (temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c}) +0:51 indirect index (temp structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:51 't3' (temp 10-element array of structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:51 'i' (temp int) +0:51 Constant: +0:51 1 (const int) +0:51 Constant: +0:51 0 (const int) +0:51 'j' (temp int) +0:51 Constant: +0:51 1 (const int) +0:51 divide (temp float) +0:51 component-wise multiply (temp float) +0:51 Convert int to float (temp float) +0:51 'j' (temp int) +0:51 Constant: +0:51 2.000000 +0:51 Convert int to float (temp float) +0:51 'i' (temp int) +0:47 Loop Terminal Expression +0:47 Post-Increment (temp int) +0:47 'j' (temp int) +0:54 Sequence +0:54 Sequence +0:54 move second child to first child (temp int) +0:54 'j' (noContraction temp int) +0:54 Constant: +0:54 0 (const int) +0:54 Loop with condition tested first +0:54 Loop Condition +0:54 Compare Less Than (temp bool) +0:54 'j' (temp int) +0:54 Constant: +0:54 6 (const int) +0:54 Loop Body +0:55 Sequence +0:55 Sequence +0:55 Sequence +0:55 move second child to first child (temp int) +0:55 'k' (temp int) +0:55 Constant: +0:55 0 (const int) +0:55 Loop with condition tested first +0:55 Loop Condition +0:55 Compare Less Than (temp bool) +0:55 'k' (temp int) +0:55 Constant: +0:55 3 (const int) +0:55 Loop Body +0:56 Sequence +0:56 move second child to first child (temp float) +0:56 indirect index (temp float) +0:56 t1_array: direct index for structure (temp 3-element array of float) +0:56 indirect index (temp structure{temp 3-element array of float t1_array, temp float t1_scalar}) +0:56 t1b: direct index for structure (temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar}) +0:56 t2: direct index for structure (temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c}) +0:56 indirect index (temp structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:56 't3' (temp 10-element array of structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:56 'i' (temp int) +0:56 Constant: +0:56 1 (const int) +0:56 Constant: +0:56 1 (const int) +0:56 'j' (temp int) +0:56 Constant: +0:56 0 (const int) +0:56 'k' (temp int) +0:56 Convert int to float (temp float) +0:56 add (temp int) +0:56 component-wise multiply (temp int) +0:56 'i' (temp int) +0:56 'j' (temp int) +0:56 'k' (temp int) +0:55 Loop Terminal Expression +0:55 Post-Increment (temp int) +0:55 'k' (temp int) +0:58 move second child to first child (temp float) +0:58 t1_scalar: direct index for structure (noContraction temp float) +0:58 indirect index (temp structure{temp 3-element array of float t1_array, temp float t1_scalar}) +0:58 t1b: direct index for structure (temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar}) +0:58 t2: direct index for structure (temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c}) +0:58 indirect index (temp structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:58 't3' (temp 10-element array of structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:58 'i' (temp int) +0:58 Constant: +0:58 1 (const int) +0:58 Constant: +0:58 1 (const int) +0:58 'j' (temp int) +0:58 Constant: +0:58 1 (const int) +0:58 divide (noContraction temp float) +0:58 component-wise multiply (noContraction temp float) +0:58 Convert int to float (temp float) +0:58 'j' (noContraction temp int) +0:58 Constant: +0:58 2.000000 +0:58 Convert int to float (temp float) +0:58 'i' (noContraction temp int) +0:54 Loop Terminal Expression +0:54 Post-Increment (noContraction temp int) +0:54 'j' (noContraction temp int) +0:61 Sequence +0:61 Sequence +0:61 move second child to first child (temp int) +0:61 'j' (noContraction temp int) +0:61 Constant: +0:61 0 (const int) +0:61 Loop with condition tested first +0:61 Loop Condition +0:61 Compare Less Than (temp bool) +0:61 'j' (temp int) +0:61 Constant: +0:61 6 (const int) +0:61 Loop Body +0:62 Sequence +0:62 Sequence +0:62 Sequence +0:62 move second child to first child (temp int) +0:62 'k' (noContraction temp int) +0:62 Constant: +0:62 0 (const int) +0:62 Loop with condition tested first +0:62 Loop Condition +0:62 Compare Less Than (temp bool) +0:62 'k' (temp int) +0:62 Constant: +0:62 3 (const int) +0:62 Loop Body +0:63 Sequence +0:63 move second child to first child (temp float) +0:63 indirect index (noContraction temp float) +0:63 t1_array: direct index for structure (noContraction temp 3-element array of float) +0:63 indirect index (temp structure{temp 3-element array of float t1_array, temp float t1_scalar}) +0:63 t1c: direct index for structure (temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar}) +0:63 t2: direct index for structure (temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c}) +0:63 indirect index (temp structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:63 't3' (temp 10-element array of structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:63 'i' (temp int) +0:63 Constant: +0:63 1 (const int) +0:63 Constant: +0:63 2 (const int) +0:63 'j' (temp int) +0:63 Constant: +0:63 0 (const int) +0:63 'k' (temp int) +0:63 Convert int to float (temp float) +0:63 add (noContraction temp int) +0:63 component-wise multiply (noContraction temp int) +0:63 'i' (noContraction temp int) +0:63 'j' (noContraction temp int) +0:63 'k' (noContraction temp int) +0:62 Loop Terminal Expression +0:62 Post-Increment (noContraction temp int) +0:62 'k' (noContraction temp int) +0:65 move second child to first child (temp float) +0:65 t1_scalar: direct index for structure (temp float) +0:65 indirect index (temp structure{temp 3-element array of float t1_array, temp float t1_scalar}) +0:65 t1c: direct index for structure (temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar}) +0:65 t2: direct index for structure (temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c}) +0:65 indirect index (temp structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:65 't3' (temp 10-element array of structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:65 'i' (temp int) +0:65 Constant: +0:65 1 (const int) +0:65 Constant: +0:65 2 (const int) +0:65 'j' (temp int) +0:65 Constant: +0:65 1 (const int) +0:65 divide (temp float) +0:65 component-wise multiply (temp float) +0:65 Convert int to float (temp float) +0:65 'j' (temp int) +0:65 Constant: +0:65 2.000000 +0:65 Convert int to float (temp float) +0:65 'i' (temp int) +0:61 Loop Terminal Expression +0:61 Post-Increment (noContraction temp int) +0:61 'j' (noContraction temp int) +0:43 Loop Terminal Expression +0:43 Post-Increment (noContraction temp int) +0:43 'i' (noContraction temp int) +0:68 Sequence +0:68 move second child to first child (temp int) +0:68 'i' (temp int) +0:68 Constant: +0:68 2 (const int) +0:69 move second child to first child (temp float) +0:69 'result' (noContraction temp float) +0:71 add (noContraction temp float) +0:70 add (noContraction temp float) +0:69 direct index (noContraction temp float) +0:69 t1_array: direct index for structure (temp 3-element array of float) +0:69 direct index (temp structure{temp 3-element array of float t1_array, temp float t1_scalar}) +0:69 t1c: direct index for structure (temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar}) +0:69 t2: direct index for structure (temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c}) +0:69 direct index (temp structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:69 't3' (temp 10-element array of structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:69 Constant: +0:69 5 (const int) +0:69 Constant: +0:69 1 (const int) +0:69 Constant: +0:69 2 (const int) +0:69 Constant: +0:69 6 (const int) +0:69 Constant: +0:69 0 (const int) +0:69 Constant: +0:69 1 (const int) +0:70 t1_scalar: direct index for structure (noContraction temp float) +0:70 direct index (temp structure{temp 3-element array of float t1_array, temp float t1_scalar}) +0:70 t1b: direct index for structure (temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar}) +0:70 t2: direct index for structure (temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c}) +0:70 direct index (temp structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:70 't3' (temp 10-element array of structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:70 Constant: +0:70 2 (const int) +0:70 Constant: +0:70 1 (const int) +0:70 Constant: +0:70 1 (const int) +0:70 Constant: +0:70 1 (const int) +0:70 Constant: +0:70 1 (const int) +0:71 direct index (noContraction temp float) +0:71 vector swizzle (temp 2-component vector of float) +0:71 v: direct index for structure (temp 4-component vector of float) +0:71 indirect index (temp structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:71 't3' (temp 10-element array of structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:71 subtract (temp int) +0:71 'i' (temp int) +0:71 Constant: +0:71 1 (const int) +0:71 Constant: +0:71 2 (const int) +0:71 Sequence +0:71 Constant: +0:71 0 (const int) +0:71 Constant: +0:71 1 (const int) +0:71 Constant: +0:71 0 (const int) +0:72 Branch: Return with expression +0:72 'result' (noContraction temp float) +0:75 Function Definition: out_block( (global float) +0:75 Function Parameters: +0:76 Sequence +0:76 Sequence +0:76 move second child to first child (temp float) +0:76 'a' (noContraction temp float) +0:76 Constant: +0:76 0.100000 +0:77 Sequence +0:77 move second child to first child (temp float) +0:77 'b' (noContraction temp float) +0:77 Constant: +0:77 0.200000 +0:78 move second child to first child (temp float) +0:78 f1: direct index for structure (noContraction global float) +0:78 s: direct index for structure (noContraction out structure{global float f1, global float f2}) +0:78 'partial_precise_block' (out block{noContraction out structure{global float f1, global float f2} s, out float x}) +0:78 Constant: +0:78 0 (const int) +0:78 Constant: +0:78 0 (const int) +0:78 add (noContraction temp float) +0:78 'a' (noContraction temp float) +0:78 'b' (noContraction temp float) +0:79 move second child to first child (temp float) +0:79 f2: direct index for structure (noContraction global float) +0:79 s: direct index for structure (noContraction out structure{global float f1, global float f2}) +0:79 'partial_precise_block' (out block{noContraction out structure{global float f1, global float f2} s, out float x}) +0:79 Constant: +0:79 0 (const int) +0:79 Constant: +0:79 1 (const int) +0:79 subtract (noContraction temp float) +0:79 'a' (noContraction temp float) +0:79 'b' (noContraction temp float) +0:80 move second child to first child (temp float) +0:80 x: direct index for structure (out float) +0:80 'partial_precise_block' (out block{noContraction out structure{global float f1, global float f2} s, out float x}) +0:80 Constant: +0:80 1 (const int) +0:80 component-wise multiply (temp float) +0:80 'a' (temp float) +0:80 'b' (temp float) +0:82 move second child to first child (temp float) +0:82 f1: direct index for structure (noContraction global float) +0:82 s: direct index for structure (noContraction out structure{global float f1, global float f2}) +0:82 'all_precise_block' (noContraction out block{out structure{global float f1, global float f2} s, out float x}) +0:82 Constant: +0:82 0 (const int) +0:82 Constant: +0:82 0 (const int) +0:82 add (noContraction temp float) +0:82 add (noContraction temp float) +0:82 'a' (noContraction temp float) +0:82 'b' (noContraction temp float) +0:82 Constant: +0:82 1.000000 +0:83 move second child to first child (temp float) +0:83 f2: direct index for structure (noContraction global float) +0:83 s: direct index for structure (noContraction out structure{global float f1, global float f2}) +0:83 'all_precise_block' (noContraction out block{out structure{global float f1, global float f2} s, out float x}) +0:83 Constant: +0:83 0 (const int) +0:83 Constant: +0:83 1 (const int) +0:83 subtract (noContraction temp float) +0:83 subtract (noContraction temp float) +0:83 'a' (noContraction temp float) +0:83 'b' (noContraction temp float) +0:83 Constant: +0:83 1.000000 +0:84 move second child to first child (temp float) +0:84 x: direct index for structure (noContraction out float) +0:84 'all_precise_block' (noContraction out block{out structure{global float f1, global float f2} s, out float x}) +0:84 Constant: +0:84 1 (const int) +0:84 component-wise multiply (noContraction temp float) +0:84 component-wise multiply (noContraction temp float) +0:84 'a' (noContraction temp float) +0:84 'b' (noContraction temp float) +0:84 Constant: +0:84 2.000000 +0:86 Branch: Return with expression +0:86 add (temp float) +0:86 'a' (temp float) +0:86 'b' (temp float) +0:89 Function Definition: main( (global void) +0:89 Function Parameters: +0:? Linker Objects +0:? 'partial_precise_block' (out block{noContraction out structure{global float f1, global float f2} s, out float x}) +0:? 'all_precise_block' (noContraction out block{out structure{global float f1, global float f2} s, out float x}) +0:? 'gl_VertexID' (gl_VertexId int VertexId) +0:? 'gl_InstanceID' (gl_InstanceId int InstanceId) + + +Linked vertex stage: + + +Shader version: 450 +0:? Sequence +0:11 Function Definition: struct_member( (global float) +0:11 Function Parameters: +0:12 Sequence +0:12 Sequence +0:12 move second child to first child (temp float) +0:12 'a' (noContraction temp float) +0:12 Constant: +0:12 1.000000 +0:13 Sequence +0:13 move second child to first child (temp float) +0:13 'b' (temp float) +0:13 Constant: +0:13 2.000000 +0:14 Sequence +0:14 move second child to first child (temp float) +0:14 'c' (temp float) +0:14 Constant: +0:14 3.000000 +0:15 Sequence +0:15 move second child to first child (temp float) +0:15 'd' (temp float) +0:15 Constant: +0:15 4.000000 +0:21 move second child to first child (temp float) +0:21 f1: direct index for structure (noContraction global float) +0:21 'S2' (temp structure{global float f1, global float f2}) +0:21 Constant: +0:21 0 (const int) +0:21 add (noContraction temp float) +0:21 'a' (noContraction temp float) +0:21 Constant: +0:21 0.200000 +0:22 move second child to first child (temp float) +0:22 f2: direct index for structure (global float) +0:22 'S2' (temp structure{global float f1, global float f2}) +0:22 Constant: +0:22 1 (const int) +0:22 add (temp float) +0:22 'b' (temp float) +0:22 Constant: +0:22 0.200000 +0:23 move second child to first child (temp float) +0:23 f1: direct index for structure (global float) +0:23 'S3' (temp structure{global float f1, global float f2}) +0:23 Constant: +0:23 0 (const int) +0:23 add (temp float) +0:23 'a' (temp float) +0:23 'b' (temp float) +0:24 move second child to first child (temp structure{global float f1, global float f2}) +0:24 'S' (temp structure{global float f1, global float f2}) +0:24 'S2' (temp structure{global float f1, global float f2}) +0:25 move second child to first child (temp float) +0:25 'result' (noContraction temp float) +0:25 add (noContraction temp float) +0:25 f1: direct index for structure (noContraction global float) +0:25 'S' (temp structure{global float f1, global float f2}) +0:25 Constant: +0:25 0 (const int) +0:25 Constant: +0:25 0.100000 +0:27 Branch: Return with expression +0:27 'result' (noContraction temp float) +0:30 Function Definition: complex_array_struct( (global float) +0:30 Function Parameters: +0:? Sequence +0:43 Sequence +0:43 Sequence +0:43 move second child to first child (temp int) +0:43 'i' (noContraction temp int) +0:43 Constant: +0:43 0 (const int) +0:43 Loop with condition tested first +0:43 Loop Condition +0:43 Compare Less Than (temp bool) +0:43 'i' (temp int) +0:43 Constant: +0:43 10 (const int) +0:43 Loop Body +0:44 Sequence +0:44 move second child to first child (temp float) +0:44 f: direct index for structure (temp float) +0:44 indirect index (temp structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:44 't3' (temp 10-element array of structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:44 'i' (temp int) +0:44 Constant: +0:44 0 (const int) +0:44 divide (temp float) +0:44 Convert int to float (temp float) +0:44 'i' (temp int) +0:44 Constant: +0:44 3.000000 +0:45 move second child to first child (temp 4-component vector of float) +0:45 v: direct index for structure (noContraction temp 4-component vector of float) +0:45 indirect index (temp structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:45 't3' (temp 10-element array of structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:45 'i' (temp int) +0:45 Constant: +0:45 2 (const int) +0:45 Construct vec4 (temp 4-component vector of float) +0:45 component-wise multiply (noContraction temp float) +0:45 Convert int to float (temp float) +0:45 'i' (noContraction temp int) +0:45 Constant: +0:45 1.500000 +0:46 move second child to first child (temp int) +0:46 p: direct index for structure (temp int) +0:46 indirect index (temp structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:46 't3' (temp 10-element array of structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:46 'i' (temp int) +0:46 Constant: +0:46 3 (const int) +0:46 add (temp int) +0:46 'i' (temp int) +0:46 Constant: +0:46 1 (const int) +0:47 Sequence +0:47 Sequence +0:47 move second child to first child (temp int) +0:47 'j' (temp int) +0:47 Constant: +0:47 0 (const int) +0:47 Loop with condition tested first +0:47 Loop Condition +0:47 Compare Less Than (temp bool) +0:47 'j' (temp int) +0:47 Constant: +0:47 5 (const int) +0:47 Loop Body +0:48 Sequence +0:48 Sequence +0:48 Sequence +0:48 move second child to first child (temp int) +0:48 'k' (temp int) +0:48 Constant: +0:48 0 (const int) +0:48 Loop with condition tested first +0:48 Loop Condition +0:48 Compare Less Than (temp bool) +0:48 'k' (temp int) +0:48 Constant: +0:48 3 (const int) +0:48 Loop Body +0:49 Sequence +0:49 move second child to first child (temp float) +0:49 indirect index (temp float) +0:49 t1_array: direct index for structure (temp 3-element array of float) +0:49 indirect index (temp structure{temp 3-element array of float t1_array, temp float t1_scalar}) +0:49 t1a: direct index for structure (temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar}) +0:49 t2: direct index for structure (temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c}) +0:49 indirect index (temp structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:49 't3' (temp 10-element array of structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:49 'i' (temp int) +0:49 Constant: +0:49 1 (const int) +0:49 Constant: +0:49 0 (const int) +0:49 'j' (temp int) +0:49 Constant: +0:49 0 (const int) +0:49 'k' (temp int) +0:49 Convert int to float (temp float) +0:49 add (temp int) +0:49 component-wise multiply (temp int) +0:49 'i' (temp int) +0:49 'j' (temp int) +0:49 'k' (temp int) +0:48 Loop Terminal Expression +0:48 Post-Increment (temp int) +0:48 'k' (temp int) +0:51 move second child to first child (temp float) +0:51 t1_scalar: direct index for structure (temp float) +0:51 indirect index (temp structure{temp 3-element array of float t1_array, temp float t1_scalar}) +0:51 t1a: direct index for structure (temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar}) +0:51 t2: direct index for structure (temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c}) +0:51 indirect index (temp structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:51 't3' (temp 10-element array of structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:51 'i' (temp int) +0:51 Constant: +0:51 1 (const int) +0:51 Constant: +0:51 0 (const int) +0:51 'j' (temp int) +0:51 Constant: +0:51 1 (const int) +0:51 divide (temp float) +0:51 component-wise multiply (temp float) +0:51 Convert int to float (temp float) +0:51 'j' (temp int) +0:51 Constant: +0:51 2.000000 +0:51 Convert int to float (temp float) +0:51 'i' (temp int) +0:47 Loop Terminal Expression +0:47 Post-Increment (temp int) +0:47 'j' (temp int) +0:54 Sequence +0:54 Sequence +0:54 move second child to first child (temp int) +0:54 'j' (noContraction temp int) +0:54 Constant: +0:54 0 (const int) +0:54 Loop with condition tested first +0:54 Loop Condition +0:54 Compare Less Than (temp bool) +0:54 'j' (temp int) +0:54 Constant: +0:54 6 (const int) +0:54 Loop Body +0:55 Sequence +0:55 Sequence +0:55 Sequence +0:55 move second child to first child (temp int) +0:55 'k' (temp int) +0:55 Constant: +0:55 0 (const int) +0:55 Loop with condition tested first +0:55 Loop Condition +0:55 Compare Less Than (temp bool) +0:55 'k' (temp int) +0:55 Constant: +0:55 3 (const int) +0:55 Loop Body +0:56 Sequence +0:56 move second child to first child (temp float) +0:56 indirect index (temp float) +0:56 t1_array: direct index for structure (temp 3-element array of float) +0:56 indirect index (temp structure{temp 3-element array of float t1_array, temp float t1_scalar}) +0:56 t1b: direct index for structure (temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar}) +0:56 t2: direct index for structure (temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c}) +0:56 indirect index (temp structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:56 't3' (temp 10-element array of structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:56 'i' (temp int) +0:56 Constant: +0:56 1 (const int) +0:56 Constant: +0:56 1 (const int) +0:56 'j' (temp int) +0:56 Constant: +0:56 0 (const int) +0:56 'k' (temp int) +0:56 Convert int to float (temp float) +0:56 add (temp int) +0:56 component-wise multiply (temp int) +0:56 'i' (temp int) +0:56 'j' (temp int) +0:56 'k' (temp int) +0:55 Loop Terminal Expression +0:55 Post-Increment (temp int) +0:55 'k' (temp int) +0:58 move second child to first child (temp float) +0:58 t1_scalar: direct index for structure (noContraction temp float) +0:58 indirect index (temp structure{temp 3-element array of float t1_array, temp float t1_scalar}) +0:58 t1b: direct index for structure (temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar}) +0:58 t2: direct index for structure (temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c}) +0:58 indirect index (temp structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:58 't3' (temp 10-element array of structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:58 'i' (temp int) +0:58 Constant: +0:58 1 (const int) +0:58 Constant: +0:58 1 (const int) +0:58 'j' (temp int) +0:58 Constant: +0:58 1 (const int) +0:58 divide (noContraction temp float) +0:58 component-wise multiply (noContraction temp float) +0:58 Convert int to float (temp float) +0:58 'j' (noContraction temp int) +0:58 Constant: +0:58 2.000000 +0:58 Convert int to float (temp float) +0:58 'i' (noContraction temp int) +0:54 Loop Terminal Expression +0:54 Post-Increment (noContraction temp int) +0:54 'j' (noContraction temp int) +0:61 Sequence +0:61 Sequence +0:61 move second child to first child (temp int) +0:61 'j' (noContraction temp int) +0:61 Constant: +0:61 0 (const int) +0:61 Loop with condition tested first +0:61 Loop Condition +0:61 Compare Less Than (temp bool) +0:61 'j' (temp int) +0:61 Constant: +0:61 6 (const int) +0:61 Loop Body +0:62 Sequence +0:62 Sequence +0:62 Sequence +0:62 move second child to first child (temp int) +0:62 'k' (noContraction temp int) +0:62 Constant: +0:62 0 (const int) +0:62 Loop with condition tested first +0:62 Loop Condition +0:62 Compare Less Than (temp bool) +0:62 'k' (temp int) +0:62 Constant: +0:62 3 (const int) +0:62 Loop Body +0:63 Sequence +0:63 move second child to first child (temp float) +0:63 indirect index (noContraction temp float) +0:63 t1_array: direct index for structure (noContraction temp 3-element array of float) +0:63 indirect index (temp structure{temp 3-element array of float t1_array, temp float t1_scalar}) +0:63 t1c: direct index for structure (temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar}) +0:63 t2: direct index for structure (temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c}) +0:63 indirect index (temp structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:63 't3' (temp 10-element array of structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:63 'i' (temp int) +0:63 Constant: +0:63 1 (const int) +0:63 Constant: +0:63 2 (const int) +0:63 'j' (temp int) +0:63 Constant: +0:63 0 (const int) +0:63 'k' (temp int) +0:63 Convert int to float (temp float) +0:63 add (noContraction temp int) +0:63 component-wise multiply (noContraction temp int) +0:63 'i' (noContraction temp int) +0:63 'j' (noContraction temp int) +0:63 'k' (noContraction temp int) +0:62 Loop Terminal Expression +0:62 Post-Increment (noContraction temp int) +0:62 'k' (noContraction temp int) +0:65 move second child to first child (temp float) +0:65 t1_scalar: direct index for structure (temp float) +0:65 indirect index (temp structure{temp 3-element array of float t1_array, temp float t1_scalar}) +0:65 t1c: direct index for structure (temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar}) +0:65 t2: direct index for structure (temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c}) +0:65 indirect index (temp structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:65 't3' (temp 10-element array of structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:65 'i' (temp int) +0:65 Constant: +0:65 1 (const int) +0:65 Constant: +0:65 2 (const int) +0:65 'j' (temp int) +0:65 Constant: +0:65 1 (const int) +0:65 divide (temp float) +0:65 component-wise multiply (temp float) +0:65 Convert int to float (temp float) +0:65 'j' (temp int) +0:65 Constant: +0:65 2.000000 +0:65 Convert int to float (temp float) +0:65 'i' (temp int) +0:61 Loop Terminal Expression +0:61 Post-Increment (noContraction temp int) +0:61 'j' (noContraction temp int) +0:43 Loop Terminal Expression +0:43 Post-Increment (noContraction temp int) +0:43 'i' (noContraction temp int) +0:68 Sequence +0:68 move second child to first child (temp int) +0:68 'i' (temp int) +0:68 Constant: +0:68 2 (const int) +0:69 move second child to first child (temp float) +0:69 'result' (noContraction temp float) +0:71 add (noContraction temp float) +0:70 add (noContraction temp float) +0:69 direct index (noContraction temp float) +0:69 t1_array: direct index for structure (temp 3-element array of float) +0:69 direct index (temp structure{temp 3-element array of float t1_array, temp float t1_scalar}) +0:69 t1c: direct index for structure (temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar}) +0:69 t2: direct index for structure (temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c}) +0:69 direct index (temp structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:69 't3' (temp 10-element array of structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:69 Constant: +0:69 5 (const int) +0:69 Constant: +0:69 1 (const int) +0:69 Constant: +0:69 2 (const int) +0:69 Constant: +0:69 6 (const int) +0:69 Constant: +0:69 0 (const int) +0:69 Constant: +0:69 1 (const int) +0:70 t1_scalar: direct index for structure (noContraction temp float) +0:70 direct index (temp structure{temp 3-element array of float t1_array, temp float t1_scalar}) +0:70 t1b: direct index for structure (temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar}) +0:70 t2: direct index for structure (temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c}) +0:70 direct index (temp structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:70 't3' (temp 10-element array of structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:70 Constant: +0:70 2 (const int) +0:70 Constant: +0:70 1 (const int) +0:70 Constant: +0:70 1 (const int) +0:70 Constant: +0:70 1 (const int) +0:70 Constant: +0:70 1 (const int) +0:71 direct index (noContraction temp float) +0:71 vector swizzle (temp 2-component vector of float) +0:71 v: direct index for structure (temp 4-component vector of float) +0:71 indirect index (temp structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:71 't3' (temp 10-element array of structure{temp float f, temp structure{temp 5-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1a, temp 6-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1b, temp 7-element array of structure{temp 3-element array of float t1_array, temp float t1_scalar} t1c} t2, temp 4-component vector of float v, temp int p}) +0:71 subtract (temp int) +0:71 'i' (temp int) +0:71 Constant: +0:71 1 (const int) +0:71 Constant: +0:71 2 (const int) +0:71 Sequence +0:71 Constant: +0:71 0 (const int) +0:71 Constant: +0:71 1 (const int) +0:71 Constant: +0:71 0 (const int) +0:72 Branch: Return with expression +0:72 'result' (noContraction temp float) +0:75 Function Definition: out_block( (global float) +0:75 Function Parameters: +0:76 Sequence +0:76 Sequence +0:76 move second child to first child (temp float) +0:76 'a' (noContraction temp float) +0:76 Constant: +0:76 0.100000 +0:77 Sequence +0:77 move second child to first child (temp float) +0:77 'b' (noContraction temp float) +0:77 Constant: +0:77 0.200000 +0:78 move second child to first child (temp float) +0:78 f1: direct index for structure (noContraction global float) +0:78 s: direct index for structure (noContraction out structure{global float f1, global float f2}) +0:78 'partial_precise_block' (out block{noContraction out structure{global float f1, global float f2} s, out float x}) +0:78 Constant: +0:78 0 (const int) +0:78 Constant: +0:78 0 (const int) +0:78 add (noContraction temp float) +0:78 'a' (noContraction temp float) +0:78 'b' (noContraction temp float) +0:79 move second child to first child (temp float) +0:79 f2: direct index for structure (noContraction global float) +0:79 s: direct index for structure (noContraction out structure{global float f1, global float f2}) +0:79 'partial_precise_block' (out block{noContraction out structure{global float f1, global float f2} s, out float x}) +0:79 Constant: +0:79 0 (const int) +0:79 Constant: +0:79 1 (const int) +0:79 subtract (noContraction temp float) +0:79 'a' (noContraction temp float) +0:79 'b' (noContraction temp float) +0:80 move second child to first child (temp float) +0:80 x: direct index for structure (out float) +0:80 'partial_precise_block' (out block{noContraction out structure{global float f1, global float f2} s, out float x}) +0:80 Constant: +0:80 1 (const int) +0:80 component-wise multiply (temp float) +0:80 'a' (temp float) +0:80 'b' (temp float) +0:82 move second child to first child (temp float) +0:82 f1: direct index for structure (noContraction global float) +0:82 s: direct index for structure (noContraction out structure{global float f1, global float f2}) +0:82 'all_precise_block' (noContraction out block{out structure{global float f1, global float f2} s, out float x}) +0:82 Constant: +0:82 0 (const int) +0:82 Constant: +0:82 0 (const int) +0:82 add (noContraction temp float) +0:82 add (noContraction temp float) +0:82 'a' (noContraction temp float) +0:82 'b' (noContraction temp float) +0:82 Constant: +0:82 1.000000 +0:83 move second child to first child (temp float) +0:83 f2: direct index for structure (noContraction global float) +0:83 s: direct index for structure (noContraction out structure{global float f1, global float f2}) +0:83 'all_precise_block' (noContraction out block{out structure{global float f1, global float f2} s, out float x}) +0:83 Constant: +0:83 0 (const int) +0:83 Constant: +0:83 1 (const int) +0:83 subtract (noContraction temp float) +0:83 subtract (noContraction temp float) +0:83 'a' (noContraction temp float) +0:83 'b' (noContraction temp float) +0:83 Constant: +0:83 1.000000 +0:84 move second child to first child (temp float) +0:84 x: direct index for structure (noContraction out float) +0:84 'all_precise_block' (noContraction out block{out structure{global float f1, global float f2} s, out float x}) +0:84 Constant: +0:84 1 (const int) +0:84 component-wise multiply (noContraction temp float) +0:84 component-wise multiply (noContraction temp float) +0:84 'a' (noContraction temp float) +0:84 'b' (noContraction temp float) +0:84 Constant: +0:84 2.000000 +0:86 Branch: Return with expression +0:86 add (temp float) +0:86 'a' (temp float) +0:86 'b' (temp float) +0:89 Function Definition: main( (global void) +0:89 Function Parameters: +0:? Linker Objects +0:? 'partial_precise_block' (out block{noContraction out structure{global float f1, global float f2} s, out float x}) +0:? 'all_precise_block' (noContraction out block{out structure{global float f1, global float f2} s, out float x}) +0:? 'gl_VertexID' (gl_VertexId int VertexId) +0:? 'gl_InstanceID' (gl_InstanceId int InstanceId) + diff --git a/Test/baseResults/spv.precise.tesc.out b/Test/baseResults/spv.precise.tesc.out new file mode 100644 index 00000000..0331a14a --- /dev/null +++ b/Test/baseResults/spv.precise.tesc.out @@ -0,0 +1,122 @@ +spv.precise.tesc +Warning, version 310 is not yet complete; most version-specific features are present, but some are missing. + + +Linked tessellation control stage: + + +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 72 + + Capability Tessellation + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint TessellationControl 4 "main" 12 15 20 30 40 45 + ExecutionMode 4 OutputVertices 3 + Source ESSL 310 + SourceExtension "GL_EXT_gpu_shader5" + SourceExtension "GL_EXT_shader_io_blocks" + SourceExtension "GL_EXT_tessellation_shader" + Name 4 "main" + Name 12 "in_te_position" + Name 15 "gl_InvocationID" + Name 20 "in_tc_position" + Name 30 "gl_TessLevelInner" + Name 40 "gl_TessLevelOuter" + Name 45 "in_tc_tessParam" + Decorate 12(in_te_position) Location 0 + Decorate 15(gl_InvocationID) BuiltIn InvocationId + Decorate 20(in_tc_position) Location 0 + Decorate 30(gl_TessLevelInner) Patch + Decorate 30(gl_TessLevelInner) BuiltIn TessLevelInner + Decorate 40(gl_TessLevelOuter) Patch + Decorate 40(gl_TessLevelOuter) BuiltIn TessLevelOuter + Decorate 45(in_tc_tessParam) Location 1 + Decorate 52 NoContraction + Decorate 53 NoContraction + Decorate 54 NoContraction + Decorate 60 NoContraction + Decorate 61 NoContraction + Decorate 62 NoContraction + Decorate 68 NoContraction + Decorate 69 NoContraction + Decorate 70 NoContraction + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 2 + 8: TypeInt 32 0 + 9: 8(int) Constant 3 + 10: TypeArray 7(fvec2) 9 + 11: TypePointer Output 10 +12(in_te_position): 11(ptr) Variable Output + 13: TypeInt 32 1 + 14: TypePointer Input 13(int) +15(gl_InvocationID): 14(ptr) Variable Input + 17: 8(int) Constant 32 + 18: TypeArray 7(fvec2) 17 + 19: TypePointer Input 18 +20(in_tc_position): 19(ptr) Variable Input + 22: TypePointer Input 7(fvec2) + 25: TypePointer Output 7(fvec2) + 27: 8(int) Constant 2 + 28: TypeArray 6(float) 27 + 29: TypePointer Output 28 +30(gl_TessLevelInner): 29(ptr) Variable Output + 31: 13(int) Constant 0 + 32: 6(float) Constant 1084227584 + 33: TypePointer Output 6(float) + 35: 13(int) Constant 1 + 37: 8(int) Constant 4 + 38: TypeArray 6(float) 37 + 39: TypePointer Output 38 +40(gl_TessLevelOuter): 39(ptr) Variable Output + 41: 6(float) Constant 1065353216 + 42: 6(float) Constant 1105985536 + 43: TypeArray 6(float) 17 + 44: TypePointer Input 43 +45(in_tc_tessParam): 44(ptr) Variable Input + 46: TypePointer Input 6(float) + 49: 13(int) Constant 2 + 4(main): 2 Function None 3 + 5: Label + 16: 13(int) Load 15(gl_InvocationID) + 21: 13(int) Load 15(gl_InvocationID) + 23: 22(ptr) AccessChain 20(in_tc_position) 21 + 24: 7(fvec2) Load 23 + 26: 25(ptr) AccessChain 12(in_te_position) 16 + Store 26 24 + 34: 33(ptr) AccessChain 30(gl_TessLevelInner) 31 + Store 34 32 + 36: 33(ptr) AccessChain 30(gl_TessLevelInner) 35 + Store 36 32 + 47: 46(ptr) AccessChain 45(in_tc_tessParam) 35 + 48: 6(float) Load 47 + 50: 46(ptr) AccessChain 45(in_tc_tessParam) 49 + 51: 6(float) Load 50 + 52: 6(float) FAdd 48 51 + 53: 6(float) FMul 42 52 + 54: 6(float) FAdd 41 53 + 55: 33(ptr) AccessChain 40(gl_TessLevelOuter) 31 + Store 55 54 + 56: 46(ptr) AccessChain 45(in_tc_tessParam) 49 + 57: 6(float) Load 56 + 58: 46(ptr) AccessChain 45(in_tc_tessParam) 31 + 59: 6(float) Load 58 + 60: 6(float) FAdd 57 59 + 61: 6(float) FMul 42 60 + 62: 6(float) FAdd 41 61 + 63: 33(ptr) AccessChain 40(gl_TessLevelOuter) 35 + Store 63 62 + 64: 46(ptr) AccessChain 45(in_tc_tessParam) 31 + 65: 6(float) Load 64 + 66: 46(ptr) AccessChain 45(in_tc_tessParam) 35 + 67: 6(float) Load 66 + 68: 6(float) FAdd 65 67 + 69: 6(float) FMul 42 68 + 70: 6(float) FAdd 41 69 + 71: 33(ptr) AccessChain 40(gl_TessLevelOuter) 49 + Store 71 70 + Return + FunctionEnd diff --git a/Test/baseResults/spv.precise.tese.out b/Test/baseResults/spv.precise.tese.out new file mode 100644 index 00000000..231ea333 --- /dev/null +++ b/Test/baseResults/spv.precise.tese.out @@ -0,0 +1,192 @@ +spv.precise.tese +Warning, version 310 is not yet complete; most version-specific features are present, but some are missing. + + +Linked tessellation evaluation stage: + + +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 119 + + Capability Tessellation + Capability TessellationPointSize + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint TessellationEvaluation 4 "main" 12 21 62 112 + ExecutionMode 4 Triangles + ExecutionMode 4 SpacingEqual + ExecutionMode 4 VertexOrderCcw + Source ESSL 310 + SourceExtension "GL_EXT_gpu_shader5" + SourceExtension "GL_EXT_shader_io_blocks" + SourceExtension "GL_EXT_tessellation_shader" + Name 4 "main" + Name 9 "pos" + Name 12 "gl_TessCoord" + Name 21 "in_te_position" + Name 45 "f" + Name 62 "in_f_color" + Name 73 "bits" + Name 77 "numBits" + Name 78 "i" + Name 110 "gl_PerVertex" + MemberName 110(gl_PerVertex) 0 "gl_Position" + MemberName 110(gl_PerVertex) 1 "gl_PointSize" + Name 112 "" + Decorate 12(gl_TessCoord) BuiltIn TessCoord + Decorate 21(in_te_position) Location 0 + Decorate 27 NoContraction + Decorate 34 NoContraction + Decorate 35 NoContraction + Decorate 42 NoContraction + Decorate 43 NoContraction + Decorate 62(in_f_color) RelaxedPrecision + Decorate 62(in_f_color) Location 0 + Decorate 67 RelaxedPrecision + Decorate 68 RelaxedPrecision + Decorate 69 RelaxedPrecision + Decorate 70 RelaxedPrecision + Decorate 97 NoContraction + Decorate 99 NoContraction + Decorate 101 NoContraction + Decorate 106 NoContraction + Decorate 109 NoContraction + MemberDecorate 110(gl_PerVertex) 0 BuiltIn Position + MemberDecorate 110(gl_PerVertex) 1 BuiltIn PointSize + Decorate 110(gl_PerVertex) Block + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 2 + 8: TypePointer Function 7(fvec2) + 10: TypeVector 6(float) 3 + 11: TypePointer Input 10(fvec3) +12(gl_TessCoord): 11(ptr) Variable Input + 13: TypeInt 32 0 + 14: 13(int) Constant 0 + 15: TypePointer Input 6(float) + 18: 13(int) Constant 32 + 19: TypeArray 7(fvec2) 18 + 20: TypePointer Input 19 +21(in_te_position): 20(ptr) Variable Input + 22: TypeInt 32 1 + 23: 22(int) Constant 0 + 24: TypePointer Input 7(fvec2) + 28: 13(int) Constant 1 + 31: 22(int) Constant 1 + 36: 13(int) Constant 2 + 39: 22(int) Constant 2 + 44: TypePointer Function 6(float) + 46: 6(float) Constant 1077936128 + 57: 6(float) Constant 1056964608 + 60: TypeVector 6(float) 4 + 61: TypePointer Output 60(fvec4) + 62(in_f_color): 61(ptr) Variable Output + 66: 6(float) Constant 1065353216 + 71: TypeVector 13(int) 2 + 72: TypePointer Function 71(ivec2) + 76: TypePointer Function 13(int) + 85: TypeBool + 105: 6(float) Constant 1025758986 +110(gl_PerVertex): TypeStruct 60(fvec4) 6(float) + 111: TypePointer Output 110(gl_PerVertex) + 112: 111(ptr) Variable Output + 114: 6(float) Constant 0 + 4(main): 2 Function None 3 + 5: Label + 9(pos): 8(ptr) Variable Function + 45(f): 44(ptr) Variable Function + 73(bits): 72(ptr) Variable Function + 77(numBits): 76(ptr) Variable Function + 78(i): 76(ptr) Variable Function + 16: 15(ptr) AccessChain 12(gl_TessCoord) 14 + 17: 6(float) Load 16 + 25: 24(ptr) AccessChain 21(in_te_position) 23 + 26: 7(fvec2) Load 25 + 27: 7(fvec2) VectorTimesScalar 26 17 + 29: 15(ptr) AccessChain 12(gl_TessCoord) 28 + 30: 6(float) Load 29 + 32: 24(ptr) AccessChain 21(in_te_position) 31 + 33: 7(fvec2) Load 32 + 34: 7(fvec2) VectorTimesScalar 33 30 + 35: 7(fvec2) FAdd 27 34 + 37: 15(ptr) AccessChain 12(gl_TessCoord) 36 + 38: 6(float) Load 37 + 40: 24(ptr) AccessChain 21(in_te_position) 39 + 41: 7(fvec2) Load 40 + 42: 7(fvec2) VectorTimesScalar 41 38 + 43: 7(fvec2) FAdd 35 42 + Store 9(pos) 43 + 47: 15(ptr) AccessChain 12(gl_TessCoord) 14 + 48: 6(float) Load 47 + 49: 15(ptr) AccessChain 12(gl_TessCoord) 28 + 50: 6(float) Load 49 + 51: 15(ptr) AccessChain 12(gl_TessCoord) 36 + 52: 6(float) Load 51 + 53: 6(float) ExtInst 1(GLSL.std.450) 37(FMin) 50 52 + 54: 6(float) ExtInst 1(GLSL.std.450) 37(FMin) 48 53 + 55: 6(float) FMul 46 54 + 56: 6(float) ExtInst 1(GLSL.std.450) 31(Sqrt) 55 + 58: 6(float) FMul 56 57 + 59: 6(float) FAdd 58 57 + Store 45(f) 59 + 63: 10(fvec3) Load 12(gl_TessCoord) + 64: 6(float) Load 45(f) + 65: 10(fvec3) VectorTimesScalar 63 64 + 67: 6(float) CompositeExtract 65 0 + 68: 6(float) CompositeExtract 65 1 + 69: 6(float) CompositeExtract 65 2 + 70: 60(fvec4) CompositeConstruct 67 68 69 66 + Store 62(in_f_color) 70 + 74: 7(fvec2) Load 9(pos) + 75: 71(ivec2) Bitcast 74 + Store 73(bits) 75 + Store 77(numBits) 14 + Store 78(i) 14 + Branch 79 + 79: Label + LoopMerge 81 82 None + Branch 83 + 83: Label + 84: 13(int) Load 78(i) + 86: 85(bool) ULessThan 84 18 + BranchConditional 86 80 81 + 80: Label + 87: 76(ptr) AccessChain 73(bits) 14 + 88: 13(int) Load 87 + 89: 13(int) Load 78(i) + 90: 13(int) ShiftLeftLogical 88 89 + 91: 13(int) BitwiseAnd 90 28 + 92: 76(ptr) AccessChain 73(bits) 28 + 93: 13(int) Load 92 + 94: 13(int) Load 78(i) + 95: 13(int) ShiftLeftLogical 93 94 + 96: 13(int) BitwiseAnd 95 28 + 97: 13(int) IAdd 91 96 + 98: 13(int) Load 77(numBits) + 99: 13(int) IAdd 98 97 + Store 77(numBits) 99 + Branch 82 + 82: Label + 100: 13(int) Load 78(i) + 101: 13(int) IAdd 100 31 + Store 78(i) 101 + Branch 79 + 81: Label + 102: 13(int) Load 77(numBits) + 103: 13(int) BitwiseAnd 102 28 + 104: 6(float) ConvertUToF 103 + 106: 6(float) FMul 104 105 + 107: 7(fvec2) Load 9(pos) + 108: 7(fvec2) CompositeConstruct 106 106 + 109: 7(fvec2) FAdd 107 108 + Store 9(pos) 109 + 113: 7(fvec2) Load 9(pos) + 115: 6(float) CompositeExtract 113 0 + 116: 6(float) CompositeExtract 113 1 + 117: 60(fvec4) CompositeConstruct 115 116 114 66 + 118: 61(ptr) AccessChain 112 23 + Store 118 117 + Return + FunctionEnd diff --git a/Test/precise.tesc b/Test/precise.tesc new file mode 100644 index 00000000..71a71e48 --- /dev/null +++ b/Test/precise.tesc @@ -0,0 +1,102 @@ +#version 450 +#extension GL_EXT_tessellation_shader : require +#extension GL_EXT_gpu_shader5 : require + +float minimal() { + precise float result = 5.0; + float a = 10.0; + float b = 20.0; + float c = 30.0; + float d = 40.0; + result = a * b + c * d; // c * d, a * b and rvalue1 + rvalue2 should be 'noContraction'. + return result; +} + +void continuous_assignment() { + precise float result = 5.0; + int a = 10; + int b = 20; + result = a = b + 4; // b + 4 should be 'noContraction'. +} + +void convert() { + precise float result; + int a = 10; + int b = 20; + b = a + b; // a + b should be 'noContraction'. + result = float(b); // convert operation should not be 'noContraction'. +} + +float loop_for() { + precise float r1 = 5.0; + precise float r2 = 10.0; + int a = 10; + int b = 20; + int c = 30; + for (int i = 0; i < a; i++) { + r1 += 3.12 + b + i; // 'noContration', this make i++ also 'noContraction' + c += 1; // 'noContration' + } + a += 1; // a + 1 should not be 'noContraction'. + r2 = c; // The calculation of c should be 'noContration'. + return float(r1 + r2); // conversion should not be 'noContration'. +} + +void loop_array(void) { + precise int result = 5; + + int x = 22; + int y = 33; + + int a0[3]; + result += x + y; // x + y should be 'noContraction' also result + rvalue. + + for (int i = 0; i < 3; ++i) { + // a's dereference + 2 should be 'noContraction'. + result += a0[i] + 2; + // result + 1 and 3 - rvalue should be 'noContraction'. + a0[i] = 3 - result++; + } +} + +void loop_while() { + precise float result = 5.0; + int a = 10; + int b = 20; + while (result < 10) { + result += 3.12 + b; // result + 3.12 should be 'noContraction'. + } + result = a + b + 5; // b + 5 should be 'noCtraction' and also a + rvalue. + result = 11.1; +} + +float fma_not_decorated() { + precise float result; + float a = 1.0; + float b = 2.0; + float c = 3.0; + b = b + c; // b + c should be decorated with 'noContraction' + result = fma(a, b, c); // fma() should not be decorated with 'noContradtion' + return result; +} + +precise float precise_return_exp_func() { + float a = 1.0; + float b = 2.0; + return a + b; // the ADD operation should be 'noContraction' +} + +precise float precise_return_val_func() { + float a = 1.0; + float b = 2.0; + float result = a + b; // the ADD operation should be 'noContraction' + return result; +} + +float precise_func_parameter(float b, precise out float c) { + float a = 0.5; + c = a + b; // noContration + return a - b; // Not noContraction +} + +void main(){} diff --git a/Test/precise_struct_block.vert b/Test/precise_struct_block.vert new file mode 100644 index 00000000..a050ccd0 --- /dev/null +++ b/Test/precise_struct_block.vert @@ -0,0 +1,89 @@ +#version 450 + +struct T { + float f1; + float f2; +}; + +out B1 {precise T s; float x;} partial_precise_block; +precise out B2 {T s; float x;} all_precise_block; + +float struct_member() { + float a = 1.0; + float b = 2.0; + float c = 3.0; + float d = 4.0; + + precise float result; + + T S, S2, S3; + + S2.f1 = a + 0.2; // NoContraction + S2.f2 = b + 0.2; // NOT NoContraction + S3.f1 = a + b; // NOT NoContraction + S = S2; // "precise" propagated through parent object nodes + result = S.f1 + 0.1; // the ADD operation should be NoContraction + + return result; +} + +float complex_array_struct() { + precise float result; + struct T1 { + float t1_array[3]; + float t1_scalar; + }; + struct T2 { + T1 t1a[5]; + T1 t1b[6]; + T1 t1c[7]; + }; + struct T3 {float f; T2 t2; vec4 v; int p;}; + T3 t3[10]; + for(int i=0; i<10; i++) { + t3[i].f = i / 3.0; // Not NoContraction + t3[i].v = vec4(i * 1.5); // NoContraction + t3[i].p = i + 1; + for(int j=0; j<5; j++) { + for(int k = 0; k<3; k++) { + t3[i].t2.t1a[j].t1_array[k] = i * j + k; // Not NoContraction + } + t3[i].t2.t1a[j].t1_scalar = j * 2.0 / i; // Not NoContration + } + + for(int j=0; j<6; j++) { + for(int k = 0; k<3; k++) { + t3[i].t2.t1b[j].t1_array[k] = i * j + k; // Not NoContraction + } + t3[i].t2.t1b[j].t1_scalar = j * 2.0 / i; // NoContraction + } + + for(int j=0; j<6; j++) { + for(int k = 0; k<3; k++) { + t3[i].t2.t1c[j].t1_array[k] = i * j + k; // NoContraction + } + t3[i].t2.t1c[j].t1_scalar = j * 2.0 / i; // Not NoContraction + } + } + int i = 2; + result = t3[5].t2.t1c[6].t1_array[1] + + t3[2].t2.t1b[1].t1_scalar + + t3[i - 1].v.xy.x; // NoContraction + return result; +} + +float out_block() { + float a = 0.1; + float b = 0.2; + partial_precise_block.s.f1 = a + b; // NoContraction + partial_precise_block.s.f2 = a - b; // NoContraction + partial_precise_block.x = a * b; // Not NoContraction + + all_precise_block.s.f1 = a + b + 1.0; // NoContraction + all_precise_block.s.f2 = a - b - 1.0; // NoContraction + all_precise_block.x = a * b * 2.0; // Also NoContraction + + return a + b; // Not NoContraction +} + +void main(){} diff --git a/Test/spv.precise.tesc b/Test/spv.precise.tesc new file mode 100644 index 00000000..35de26b8 --- /dev/null +++ b/Test/spv.precise.tesc @@ -0,0 +1,24 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require +#extension GL_EXT_gpu_shader5 : require + +layout(vertices = 3) out; + +layout(location = 0) in highp vec2 in_tc_position[]; +layout(location = 1) in highp float in_tc_tessParam[]; + +layout(location = 0) out highp vec2 in_te_position[]; + +precise gl_TessLevelOuter; + +void main (void) +{ + in_te_position[gl_InvocationID] = in_tc_position[gl_InvocationID]; + + gl_TessLevelInner[0] = 5.0; + gl_TessLevelInner[1] = 5.0; + + gl_TessLevelOuter[0] = 1.0 + 59.0 * 0.5 * (in_tc_tessParam[1] + in_tc_tessParam[2]); + gl_TessLevelOuter[1] = 1.0 + 59.0 * 0.5 * (in_tc_tessParam[2] + in_tc_tessParam[0]); + gl_TessLevelOuter[2] = 1.0 + 59.0 * 0.5 * (in_tc_tessParam[0] + in_tc_tessParam[1]); +} diff --git a/Test/spv.precise.tese b/Test/spv.precise.tese new file mode 100644 index 00000000..874ea840 --- /dev/null +++ b/Test/spv.precise.tese @@ -0,0 +1,36 @@ +#version 310 es +#extension GL_EXT_tessellation_shader : require +#extension GL_EXT_gpu_shader5 : require + +layout(triangles, equal_spacing) in; + +layout(location = 0) in highp vec2 in_te_position[]; + +layout(location = 0) out mediump vec4 in_f_color; + +precise gl_Position; + +void main(void) { + highp vec2 pos = gl_TessCoord.x * in_te_position[0] + + gl_TessCoord.y * in_te_position[1] + + gl_TessCoord.z * in_te_position[2]; + + highp float f = + sqrt(3.0 * min(gl_TessCoord.x, min(gl_TessCoord.y, gl_TessCoord.z))) * + 0.5 + + 0.5; + in_f_color = vec4(gl_TessCoord * f, 1.0); + + // Offset the position slightly, based on the parity of the bits in the float + // representation. + // This is done to detect possible small differences in edge vertex positions + // between patches. + uvec2 bits = floatBitsToUint(pos); + uint numBits = 0u; + for (uint i = 0u; i < 32u; i++) + numBits += + ((bits[0] << i) & 1u) + ((bits[1] << i) & 1u); + pos += float(numBits & 1u) * 0.04; + + gl_Position = vec4(pos, 0.0, 1.0); +} diff --git a/Test/test-spirv-list b/Test/test-spirv-list index 703607da..03f4432e 100644 --- a/Test/test-spirv-list +++ b/Test/test-spirv-list @@ -107,6 +107,8 @@ spv.specConstant.vert spv.specConstant.comp spv.specConstantComposite.vert spv.specConstantOperations.vert +spv.precise.tese +spv.precise.tesc # GLSL-level semantics vulkan.frag vulkan.vert diff --git a/Test/testlist b/Test/testlist index d60fbca4..ecb99d1a 100644 --- a/Test/testlist +++ b/Test/testlist @@ -129,3 +129,5 @@ voidFunction.frag whileLoop.frag nonVulkan.frag spv.atomic.comp +precise.tesc +precise_struct_block.vert diff --git a/glslang/CMakeLists.txt b/glslang/CMakeLists.txt index 7015e304..f431cc11 100644 --- a/glslang/CMakeLists.txt +++ b/glslang/CMakeLists.txt @@ -33,6 +33,7 @@ set(SOURCES MachineIndependent/preprocessor/PpScanner.cpp MachineIndependent/preprocessor/PpSymbols.cpp MachineIndependent/preprocessor/PpTokens.cpp + MachineIndependent/propagateNoContraction.cpp GenericCodeGen/CodeGen.cpp GenericCodeGen/Link.cpp) @@ -62,6 +63,7 @@ set(HEADERS MachineIndependent/SymbolTable.h MachineIndependent/Versions.h MachineIndependent/parseVersions.h + MachineIndependent/propagateNoContraction.h MachineIndependent/preprocessor/PpContext.h MachineIndependent/preprocessor/PpTokens.h) diff --git a/glslang/MachineIndependent/Intermediate.cpp b/glslang/MachineIndependent/Intermediate.cpp index 47a93670..d3aa5853 100644 --- a/glslang/MachineIndependent/Intermediate.cpp +++ b/glslang/MachineIndependent/Intermediate.cpp @@ -42,6 +42,7 @@ #include "localintermediate.h" #include "RemoveTree.h" #include "SymbolTable.h" +#include "propagateNoContraction.h" #include @@ -1066,6 +1067,9 @@ bool TIntermediate::postProcess(TIntermNode* root, EShLanguage /*language*/) if (aggRoot && aggRoot->getOp() == EOpNull) aggRoot->setOperator(EOpSequence); + // Propagate 'noContraction' label in backward from 'precise' variables. + glslang::PropagateNoContraction(*this); + return true; } diff --git a/glslang/MachineIndependent/propagateNoContraction.cpp b/glslang/MachineIndependent/propagateNoContraction.cpp new file mode 100644 index 00000000..044ecbf3 --- /dev/null +++ b/glslang/MachineIndependent/propagateNoContraction.cpp @@ -0,0 +1,886 @@ +// +// Copyright (C) 2015-2016 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 Google Inc. 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. + +// +// Visit the nodes in the glslang intermediate tree representation to +// propagate 'noContraction' qualifier. +// + +#include "propagateNoContraction.h" + +#include +#include +#include +#include + +#include "localintermediate.h" +namespace { + +// Use string to hold the accesschain information, as in most cases we the +// accesschain is short and may contain only one element, which is the symbol ID. +using ObjectAccessChain = std::string; +#ifndef StructAccessChainDelimiter +#define StructAccessChainDelimiter '/' +#endif + +// Mapping from Symbol IDs of symbol nodes, to their defining operation +// nodes. +using NodeMapping = std::unordered_multimap; +// Mapping from object nodes to their accesschain info string. +using AccessChainMapping = std::unordered_map; + +// Set of object IDs. +using ObjectAccesschainSet = std::unordered_set; +// Set of return branch nodes. +using ReturnBranchNodeSet = std::unordered_set; + +// A helper function to tell whether a node is 'noContraction'. Returns true if +// the node has 'noContraction' qualifier, otherwise false. +bool isPreciseObjectNode(glslang::TIntermTyped *node) +{ + return node->getType().getQualifier().noContraction; +} + +// Returns true if the opcode is a dereferencing one. +bool isDereferenceOperation(glslang::TOperator op) +{ + switch (op) { + case glslang::EOpIndexDirect: + case glslang::EOpIndexDirectStruct: + case glslang::EOpIndexIndirect: + case glslang::EOpVectorSwizzle: + return true; + default: + return false; + } +} + +// Returns true if the opcode leads to an assignment operation. +bool isAssignOperation(glslang::TOperator op) +{ + switch (op) { + case glslang::EOpAssign: + case glslang::EOpAddAssign: + case glslang::EOpSubAssign: + case glslang::EOpMulAssign: + case glslang::EOpVectorTimesMatrixAssign: + case glslang::EOpVectorTimesScalarAssign: + case glslang::EOpMatrixTimesScalarAssign: + case glslang::EOpMatrixTimesMatrixAssign: + case glslang::EOpDivAssign: + case glslang::EOpModAssign: + case glslang::EOpAndAssign: + case glslang::EOpLeftShiftAssign: + case glslang::EOpRightShiftAssign: + case glslang::EOpInclusiveOrAssign: + case glslang::EOpExclusiveOrAssign: + + case glslang::EOpPostIncrement: + case glslang::EOpPostDecrement: + case glslang::EOpPreIncrement: + case glslang::EOpPreDecrement: + return true; + default: + return false; + } +} + +// A helper function to get the unsigned int from a given constant union node. +// Note the node should only holds a uint scalar. +unsigned getStructIndexFromConstantUnion(glslang::TIntermTyped *node) +{ + assert(node->getAsConstantUnion() && node->getAsConstantUnion()->isScalar()); + unsigned struct_dereference_index = node->getAsConstantUnion()->getConstArray()[0].getUConst(); + return struct_dereference_index; +} + +// A helper function to generate symbol_label. +ObjectAccessChain generateSymbolLabel(glslang::TIntermSymbol *node) +{ + ObjectAccessChain symbol_id = std::to_string(node->getId()) + "(" + node->getName().c_str() + ")"; + return symbol_id; +} + +// Return true if the operation is an arithmetic operation and valid for +// 'NoContraction' decoration. +bool isArithmeticOperation(glslang::TOperator op) +{ + switch (op) { + case glslang::EOpAddAssign: + case glslang::EOpSubAssign: + case glslang::EOpMulAssign: + case glslang::EOpVectorTimesMatrixAssign: + case glslang::EOpVectorTimesScalarAssign: + case glslang::EOpMatrixTimesScalarAssign: + case glslang::EOpMatrixTimesMatrixAssign: + case glslang::EOpDivAssign: + case glslang::EOpModAssign: + + case glslang::EOpNegative: + + case glslang::EOpAdd: + case glslang::EOpSub: + case glslang::EOpMul: + case glslang::EOpDiv: + case glslang::EOpMod: + + case glslang::EOpVectorTimesScalar: + case glslang::EOpVectorTimesMatrix: + case glslang::EOpMatrixTimesVector: + case glslang::EOpMatrixTimesScalar: + + case glslang::EOpDot: + + case glslang::EOpAddCarry: + case glslang::EOpSubBorrow: + case glslang::EOpUMulExtended: + case glslang::EOpIMulExtended: + + case glslang::EOpPostIncrement: + case glslang::EOpPostDecrement: + case glslang::EOpPreIncrement: + case glslang::EOpPreDecrement: + return true; + default: + return false; + } +} + +// A helper class to help managing populating_initial_no_contraction_ flag. +template class StateSettingGuard { +public: + StateSettingGuard(T *state_ptr, T new_state_value) + : state_ptr_(state_ptr), previous_state_(*state_ptr) + { + *state_ptr = new_state_value; + } + StateSettingGuard(T *state_ptr) : state_ptr_(state_ptr), previous_state_(*state_ptr) {} + void setState(T new_state_value) + { + *state_ptr_ = new_state_value; + } + ~StateSettingGuard() { *state_ptr_ = previous_state_; } + +private: + T *state_ptr_; + T previous_state_; +}; + +// A helper function to get the front element from a given ObjectAccessChain +ObjectAccessChain getFrontElement(const ObjectAccessChain &chain) +{ + size_t pos_delimiter = chain.find(StructAccessChainDelimiter); + return pos_delimiter == std::string::npos ? chain : chain.substr(0, pos_delimiter); +} + +// A helper function to get the accesschain starting from the second element. +ObjectAccessChain subAccessChainFromSecondElement(const ObjectAccessChain& chain) +{ + size_t pos_delimiter = chain.find(StructAccessChainDelimiter); + return pos_delimiter == std::string::npos ? "" : chain.substr(pos_delimiter + 1); +} + +// +// A traverser which traverses the whole AST and populates: +// 1) A mapping from symbol nodes' IDs to their defining operation nodes. +// 2) A set of accesschains of the initial precise object nodes. +// +class TSymbolDefinitionCollectingTraverser : public glslang::TIntermTraverser { +public: + TSymbolDefinitionCollectingTraverser( + NodeMapping *symbol_definition_mapping, AccessChainMapping *accesschain_mapping, + ObjectAccesschainSet *precise_objects, + ReturnBranchNodeSet *precise_return_nodes); + + // bool visitAggregate(glslang::TVisit, glslang::TIntermAggregate *) override; + bool visitUnary(glslang::TVisit, glslang::TIntermUnary *) override; + bool visitBinary(glslang::TVisit, glslang::TIntermBinary *) override; + void visitSymbol(glslang::TIntermSymbol *) override; + bool visitAggregate(glslang::TVisit, glslang::TIntermAggregate *) override; + bool visitBranch(glslang::TVisit, glslang::TIntermBranch *) override; + +protected: + // The mapping from symbol node IDs to their defining nodes. This should be + // populated along traversing the AST. + NodeMapping &symbol_definition_mapping_; + // The set of symbol node IDs for precise symbol nodes, the ones marked as + // 'noContraction'. + ObjectAccesschainSet &precise_objects_; + // The set of precise return nodes. + ReturnBranchNodeSet &precise_return_nodes_; + // A temporary cache of the symbol node whose defining node is to be found + // currently along traversing the AST. + ObjectAccessChain object_to_be_defined_; + // A map from object node to its accesschain. This traverser stores + // the built accesschains into this map for each object node it has + // visited. + AccessChainMapping &accesschain_mapping_; + // The pointer to the Function Definition node, so we can get the + // precise'ness of the return expression from it when we traverse the + // return branch node. + glslang::TIntermAggregate* current_function_definition_node_; +}; + +TSymbolDefinitionCollectingTraverser::TSymbolDefinitionCollectingTraverser( + NodeMapping *symbol_definition_mapping, AccessChainMapping *accesschain_mapping, + ObjectAccesschainSet *precise_objects, + std::unordered_set *precise_return_nodes) + : TIntermTraverser(true, false, false), symbol_definition_mapping_(*symbol_definition_mapping), + precise_objects_(*precise_objects), object_to_be_defined_(), + accesschain_mapping_(*accesschain_mapping), current_function_definition_node_(nullptr), + precise_return_nodes_(*precise_return_nodes) {} + +// Visits a symbol node, set the object_to_be_defined_ to the +// current node symbol ID, and record a mapping from this node to the current +// object_to_be_defined_, which is the just obtained symbol +// ID. +void TSymbolDefinitionCollectingTraverser::visitSymbol(glslang::TIntermSymbol *node) +{ + object_to_be_defined_ = generateSymbolLabel(node); + accesschain_mapping_[node] = object_to_be_defined_; +} + +// Visits an aggregate node, traverses all of its children. +bool TSymbolDefinitionCollectingTraverser::visitAggregate(glslang::TVisit, + glslang::TIntermAggregate *node) +{ + // This aggreagate node might be a function definition node, in which case we need to + // cache this node, so we can get the precise'ness information of the return value + // of this function later. + StateSettingGuard current_function_definition_node_setting_guard( + ¤t_function_definition_node_); + if (node->getOp() == glslang::EOpFunction) { + // This is function definition node, we need to cache this node so that we can + // get the precise'ness of the return value later. + current_function_definition_node_setting_guard.setState(node); + } + // Traverse the items in the sequence. + glslang::TIntermSequence &seq = node->getSequence(); + for (int i = 0; i < (int)seq.size(); ++i) { + object_to_be_defined_.clear(); + seq[i]->traverse(this); + } + return false; +} + +bool TSymbolDefinitionCollectingTraverser::visitBranch(glslang::TVisit, + glslang::TIntermBranch *node) +{ + if (node->getFlowOp() == glslang::EOpReturn && node->getExpression() && + current_function_definition_node_ && + current_function_definition_node_->getType().getQualifier().noContraction) { + // This node is a return node with expression, and its function has + // precise return value. We need to find the involved objects in its + // expression and add them to the set of initial precise objects. + precise_return_nodes_.insert(node); + node->getExpression()->traverse(this); + } + return false; +} + +// Visits an unary node. This might be an implicit assignment like i++, i--. etc. +bool TSymbolDefinitionCollectingTraverser::visitUnary(glslang::TVisit /* visit */, + glslang::TIntermUnary *node) +{ + object_to_be_defined_.clear(); + node->getOperand()->traverse(this); + if (isAssignOperation(node->getOp())) { + // We should always be able to get an accesschain of the operand node. + // But we have some tests in which it is intented to have invalid operand + // nodes, so just return for now. + if (object_to_be_defined_.empty()) return false; + + // If the operand node object is 'precise', we collect its accesschain + // for the initial set of 'precise' objects. + if (isPreciseObjectNode(node->getOperand())) { + // The operand node is an 'precise' object node, add its + // accesschain to the set of 'precise' objects. This is to collect + // the initial set of 'precise' objects. + precise_objects_.insert(object_to_be_defined_); + } + // Gets the symbol ID from the object's accesschain. + ObjectAccessChain id_symbol = getFrontElement(object_to_be_defined_); + // Add a mapping from the symbol ID to this assignment operation node. + symbol_definition_mapping_.insert(std::make_pair(id_symbol, node)); + } + // Unary node is not a dereference node, so we clear the accesschain which + // is under construction. + object_to_be_defined_.clear(); + return false; +} + +// Visits a binary node and updates the mapping from symbol IDs to the definition +// nodes. Also collects the accesschains for the initial precise objects. +bool TSymbolDefinitionCollectingTraverser::visitBinary(glslang::TVisit /* visit */, + glslang::TIntermBinary *node) +{ + // Traverses the left node to build the accesschain info for the object. + object_to_be_defined_.clear(); + node->getLeft()->traverse(this); + + if (isAssignOperation(node->getOp())) { + // We should always be able to get an accesschain for the left node. + // But we have some tests in which it is intented to have invalid left + // nodes, so just return false in such cases for now. + if (object_to_be_defined_.empty()) return false; + + // If the left node object is 'precise', it is an initial precise object + // specified in the shader source. Adds it to the initial worklist to + // process later. + if (isPreciseObjectNode(node->getLeft())) { + // The left node is an 'precise' object node, add its accesschain to + // the set of 'precise' objects. This is to collect the initial set + // of 'precise' objects. + precise_objects_.insert(object_to_be_defined_); + } + // Gets the symbol ID from the object accesschain, which should be the + // first element recorded in the accesschain. + ObjectAccessChain id_symbol = getFrontElement(object_to_be_defined_); + // Adds a mapping from the symbol ID to this assignment operation node. + symbol_definition_mapping_.insert(std::make_pair(id_symbol, node)); + + // Traverses the right node, there may be other 'assignment' + // operatrions in the right. + object_to_be_defined_.clear(); + node->getRight()->traverse(this); + + return false; + } else if (isDereferenceOperation(node->getOp())) { + // If the left node is 'precise' object node, this node should also + // be 'precise' object node, and all the members of this node too. There + // is no need to append accesschain information into the object id. + if (isPreciseObjectNode(node->getLeft())) { + node->getWritableType().getQualifier().noContraction = true; + accesschain_mapping_[node] = object_to_be_defined_; + return false; + } + + // If the opcode is not EOpIndexDirectStruct, the left node is not be a + // struct type object, hence there is no need to append dereference + // indices. For other composite type objects, the precise'ness of + // members should always matches with the 'precise'ness of the + // composite type object. + if (node->getOp() != glslang::EOpIndexDirectStruct) { + accesschain_mapping_[node] = object_to_be_defined_; + return false; + } + + // The left node (parent node) is not 'precise' and it is a struct type + // object. We need to record the accesschain information of the current + // node into its object id. + unsigned struct_dereference_index = getStructIndexFromConstantUnion(node->getRight()); + object_to_be_defined_.push_back(StructAccessChainDelimiter); + object_to_be_defined_.append(std::to_string(struct_dereference_index)); + accesschain_mapping_[node] = object_to_be_defined_; + + // For dereference node, there is no need to traverse the right child + // node as the right node should always be an integer type object. + return false; + } else { + // For other binary nodes, still traverse the right node. + object_to_be_defined_.clear(); + node->getRight()->traverse(this); + return false; + } +} + +// Traverses the AST and returns a tuple of three members: +// 1) a mapping from symbol IDs to the definition nodes (aka. assignment nodes) of these symbols. +// 2) a mapping from object nodes in the AST to the accesschains of these objects. +// 3) a set of accesschains of precise objects. +std::tuple +getSymbolToDefinitionMappingAndPreciseSymbolIDs(const glslang::TIntermediate &intermediate) +{ + auto result_tuple = std::make_tuple(NodeMapping(), AccessChainMapping(), ObjectAccesschainSet(), ReturnBranchNodeSet()); + + TIntermNode *root = intermediate.getTreeRoot(); + if (root == 0) return result_tuple; + + NodeMapping &symbol_definition_mapping = std::get<0>(result_tuple); + AccessChainMapping &accesschain_mapping = std::get<1>(result_tuple); + ObjectAccesschainSet &precise_objects = std::get<2>(result_tuple); + ReturnBranchNodeSet &precise_return_nodes = std::get<3>(result_tuple); + + // Traverses the AST and populate the results. + TSymbolDefinitionCollectingTraverser collector(&symbol_definition_mapping, &accesschain_mapping, + &precise_objects, &precise_return_nodes); + root->traverse(&collector); + + return result_tuple; +} + +// +// A traverser that determine whether the left node (or operand node for unary +// node) of an assignment node is 'precise', containing 'precise' or not, +// according to the accesschain a given precise object which share the same +// symbol as the left node. +// +// Post-orderly traverses the left node subtree of an binary assignment node and: +// +// 1) Propagates the 'precise' from the left object nodes to this object node. +// +// 2) Builds object accesschain along the traversal, and also compares with +// the accesschain of the given 'precise' object along with the traversal to +// tell if the node to be defined is 'precise' or not. +// +class TNoContractionAssigneeCheckingTraverser : public glslang::TIntermTraverser { + + enum DecisionStatus { + // The object node to be assigned to may contain 'precise' objects and also not 'precise' objects. + Mixed = 0, + // The object node to be assigned to is either a 'precise' object or a struct objects whose members are all 'precise'. + Precise = 1, + // The object node to be assigned to is not a 'precise' object. + NotPreicse = 2, + }; + +public: + TNoContractionAssigneeCheckingTraverser() + : TIntermTraverser(true, false, false), accesschain_to_precise_object_(), decision_(Mixed) {} + + // Checks the precise'ness of a given assignment node with a precise object + // represented as accesschain. The precise object shares the same symbol + // with the assignee of the given assignment node. Return a tuple of two: + // + // 1) The precise'ness of the assignee node of this assignment node. True + // if the assignee contains 'precise' objects or is 'precise', false if + // the assignee is not 'precise' according to the accesschain of the given + // precise object. + // + // 2) The incremental accesschain from the assignee node to its nested + // 'precise' object, according to the accesschain of the given precise + // object. This incremental accesschain can be empty, which means the + // assignee is 'precise'. Otherwise it shows the path to the nested + // precise object. + std::tuple + getPrecisenessAndRemainedAccessChain(glslang::TIntermOperator* node, + const ObjectAccessChain &precise_object) + { + assert(isAssignOperation(node->getOp())); + accesschain_to_precise_object_ = precise_object; + decision_ = Mixed; + node->traverse(this); + return make_tuple(decision_ != NotPreicse, accesschain_to_precise_object_); + } + +protected: + bool visitBinary(glslang::TVisit, glslang::TIntermBinary *node) override; + bool visitUnary(glslang::TVisit, glslang::TIntermUnary *node) override; + void visitSymbol(glslang::TIntermSymbol *node) override; + + // The accesschain toward the given precise object. It will be iniailized + // with the accesschain of a given precise object, then trimmed along the + // traversal of the assignee subtree. The remained accesschain at the end + // of traversal shows the path from the assignee node to its nested + // 'precise' object. If the assignee node is 'precise' object object, this + // should be empty. + ObjectAccessChain accesschain_to_precise_object_; + // A state to tell the precise'ness of the assignee node according to the + // accesschain of the given precise object: + // + // 'Mixed': contains both 'precise' and 'non-precise' object + // (accesschain_to_precise_object_ is not empty), + // + // 'Precise': is precise object (accesschain_to_precise_object is empty), + // + // 'NotPrecise': is not precise object (mismatch in the struct dereference + // indices). + DecisionStatus decision_; +}; + +// Visit a binary node. As this traverser's job is to check the precise'ness of +// the assignee node in an assignment operation, it only needs to traverse the +// object nodes along the left branches. For struct type object nodes, it needs +// to obtain the struct dereference index from the right node to build the +// accesschain for this node. +bool TNoContractionAssigneeCheckingTraverser::visitBinary(glslang::TVisit, + glslang::TIntermBinary *node) +{ + node->getLeft()->traverse(this); + // For dereference operation nodes, we may need to check if the accesschain + // of the given precise object matches with the struct dereference indices + // of the assignee subtree. + if (isDereferenceOperation(node->getOp())) { + if (isPreciseObjectNode(node->getLeft())) { + // The left node is 'precise', which means the object node in the + // left contains the object represented in this node. If the left node + // is 'precise', this object node should also be 'precise' and no need + // to check the accesschain and struct deference indices anymore. + node->getWritableType().getQualifier().noContraction = true; + decision_ = Precise; + return false; + } + if (node->getOp() == glslang::EOpIndexDirectStruct && decision_ == Mixed) { + std::string struct_index = + std::to_string(getStructIndexFromConstantUnion(node->getRight())); + ObjectAccessChain precise_struct_index = getFrontElement(accesschain_to_precise_object_); + if (precise_struct_index == struct_index) { + // The struct dereference index matches with the record in the + // accesschain to the precise object. Pop the front access + // chain index from the precise object access chain. + accesschain_to_precise_object_ = + subAccessChainFromSecondElement(accesschain_to_precise_object_); + // If the given access chain to precise object is empty now, + // it means we've found the corresponding precise object in + // the assignee subtree. + if (accesschain_to_precise_object_.empty()) { + node->getWritableType().getQualifier().noContraction = true; + decision_ = Precise; + } + } else { + // The access chain index does not match with the record in the precise object id. + // This object should not be labelled as 'precise' here. + decision_ = NotPreicse; + } + } + } + return false; +} + +// Visits an unary node, traverses its operand. If the node is an assignment node, +// determines the precise'ness of the assignee directly based on the assignee node's +// precise'ness. +bool TNoContractionAssigneeCheckingTraverser::visitUnary(glslang::TVisit, + glslang::TIntermUnary *node) +{ + node->getOperand()->traverse(this); + if (isAssignOperation(node->getOp())) { + if (isPreciseObjectNode(node->getOperand())) { + decision_ = Precise; + // As the assignee node is 'precise', all (if any) the + // member objects the that node should also be 'precise'. This means + // we won't need to propagate extra access chain info. + accesschain_to_precise_object_.clear(); + } else { + decision_ = NotPreicse; + } + } + return false; +} + +// Visits a symbol node. The symbol ID of this node should match with the symbol ID, which is +// the front element, in the accesschain of the given 'precise' object. +void TNoContractionAssigneeCheckingTraverser::visitSymbol(glslang::TIntermSymbol *node) +{ + ObjectAccessChain symbol_id = generateSymbolLabel(node); + // The root symbol of the given access chain should be the same with the one represented by the symbol node here. + assert(symbol_id == getFrontElement(accesschain_to_precise_object_)); + // Pop the symbol node part from the front end of the accesschain string. + accesschain_to_precise_object_ = + subAccessChainFromSecondElement(accesschain_to_precise_object_); + if (accesschain_to_precise_object_.empty()) { + node->getWritableType().getQualifier().noContraction = true; + decision_ = Precise; + } + // If this symbol node is 'precise', all its members should be 'precise' so the assignee of the processing + // assignment operations is 'precise'. + if (isPreciseObjectNode(node)) { + decision_ = Precise; + } +} + +// +// A traverser that only traverses the right side of binary assignment nodes +// and the operand node of unary assignment nodes. +// +// 1) Marks arithmetic operations 'NoContraction'. +// +// 2) Find the object which should be marked as 'precise' in the right and +// update the 'precise' object worklist. +// +class TNoContractionPropagator : public glslang::TIntermTraverser { +public: + TNoContractionPropagator(ObjectAccesschainSet *precise_objects, + const AccessChainMapping &accesschain_mapping) + : TIntermTraverser(true, false, false), remained_accesschain_(), + precise_objects_(*precise_objects), + accesschain_mapping_(accesschain_mapping), added_precise_object_ids_() {} + + // Propagates 'precise' in the right nodes of a given assignment node with + // accesschain record from the assignee node to a 'precise' object it + // contains. + void + propagateNoContractionInOneExpression(glslang::TIntermTyped *defining_node, + const ObjectAccessChain &assignee_remained_accesschain) + { + remained_accesschain_ = assignee_remained_accesschain; + if (glslang::TIntermBinary *BN = defining_node->getAsBinaryNode()) { + assert(isAssignOperation(BN->getOp())); + BN->getRight()->traverse(this); + if (isArithmeticOperation(BN->getOp())) { + BN->getWritableType().getQualifier().noContraction = true; + } + } else if (glslang::TIntermUnary *UN = defining_node->getAsUnaryNode()) { + assert(isAssignOperation(UN->getOp())); + UN->getOperand()->traverse(this); + if (isArithmeticOperation(UN->getOp())) { + UN->getWritableType().getQualifier().noContraction = true; + } + } + } + + // Propagates 'precise' in a given precise return node. + void + propagateNoContractionInReturnNode(glslang::TIntermBranch *return_node) + { + remained_accesschain_ = ""; + assert(return_node->getFlowOp() == glslang::EOpReturn && return_node->getExpression()); + return_node->getExpression()->traverse(this); + } + +protected: + // Visit an aggregate node. The node can be a initializer list, in which + // case we need to find the 'precise' or 'precise' containing object node + // with the accesschain record. In other cases, just need to traverse all + // the children nodes. + bool visitAggregate(glslang::TVisit, glslang::TIntermAggregate *node) override + { + if (!remained_accesschain_.empty() && node->getOp() == glslang::EOpConstructStruct) { + // This is a struct initializer node, and the remained + // accesschain is not empty, we need to refer to the + // assignee_remained_access_chain_ to find the nested + // 'precise' object. And we don't need to visit other nodes in this + // aggreagate node. + + // Gets the struct dereference index that leads to 'precise' object. + ObjectAccessChain precise_accesschain_index_str = + getFrontElement(remained_accesschain_); + unsigned precise_accesschain_index = std::stoul(precise_accesschain_index_str); + // Gets the node pointed by the accesschain index extracted before. + glslang::TIntermTyped *potential_precise_node = + node->getSequence()[precise_accesschain_index]->getAsTyped(); + assert(potential_precise_node); + // Pop the front accesschain index from the path, and visit the nested node. + { + ObjectAccessChain next_level_accesschain = + subAccessChainFromSecondElement(remained_accesschain_); + StateSettingGuard setup_remained_accesschain_for_next_level( + &remained_accesschain_, next_level_accesschain); + potential_precise_node->traverse(this); + } + + } else { + // If this is not a struct constructor, just visit each nested node. + glslang::TIntermSequence &seq = node->getSequence(); + for (int i = 0; i < (int)seq.size(); ++i) { + seq[i]->traverse(this); + } + } + + return false; + } + + // Visit a binary node. A binary node can be an object node, e.g. a dereference node. + // As only the top object nodes in the right side of an assignment needs to be visited + // and added to 'precise' worklist, this traverser won't visit the children nodes of + // an object node. If the binary node does not represent an object node, it should + // go on to traverse its children nodes and if it is an arithmetic operation node, this + // operation should be marked as 'noContraction'. + bool visitBinary(glslang::TVisit, glslang::TIntermBinary *node) override + { + if (isDereferenceOperation(node->getOp())) { + // This binary node is an object node. Need to update the precise + // object set with the accesschain of this node + remained + // accesschain . + ObjectAccessChain new_precise_accesschain = accesschain_mapping_.at(node); + if (remained_accesschain_.empty()) { + node->getWritableType().getQualifier().noContraction = true; + } else { + new_precise_accesschain += + StructAccessChainDelimiter + remained_accesschain_; + } + // Cache the accesschain as added precise object, so we won't add the + // same object to the worklist again. + if (!added_precise_object_ids_.count(new_precise_accesschain)) { + precise_objects_.insert(new_precise_accesschain); + added_precise_object_ids_.insert(new_precise_accesschain); + } + // Only the upper-most object nodes should be visited, so do not + // visit children of this object node. + return false; + } + // If this is an arithmetic operation, marks this node as 'noContraction'. + if (isArithmeticOperation(node->getOp())) { + node->getWritableType().getQualifier().noContraction = true; + } + // As this node is not an object node, need to traverse the children nodes. + node->getLeft()->traverse(this); + node->getRight()->traverse(this); + return false; + } + + // Visits an unary node. An unary node can not be an object node. If the operation + // is an arithmetic operation, need to mark this node as 'noContraction'. + bool visitUnary(glslang::TVisit /* visit */, glslang::TIntermUnary *node) override + { + // If this is an arithmetic operation, marks this with 'noContraction' + if (isArithmeticOperation(node->getOp())) { + node->getWritableType().getQualifier().noContraction = true; + } + node->getOperand()->traverse(this); + return false; + } + + // Visits a symbol node. A symbol node is always an object node. So we + // should always be able to find its in our colected mapping from object + // nodes to accesschains. As an object node, a symbol node can be either + // 'precise' or containing 'precise' objects according to unused + // accesschain information we have when we visit this node. + void visitSymbol(glslang::TIntermSymbol *node) override + { + // Symbol nodes are object nodes and should always have an + // accesschain collected before matches with it. + assert(accesschain_mapping_.count(node)); + ObjectAccessChain new_precise_accesschain = accesschain_mapping_.at(node); + // If the unused accesschain is empty, this symbol node should be + // marked as 'precise'. Otherwise, the unused accesschain should be + // appended to the symbol ID to build a new accesschain which points to + // the nested 'precise' object in this symbol object. + if (remained_accesschain_.empty()) { + node->getWritableType().getQualifier().noContraction = true; + } else { + new_precise_accesschain += StructAccessChainDelimiter + remained_accesschain_; + } + // Add the new 'precise' accesschain to the worklist and make sure we + // don't visit it again. + if (!added_precise_object_ids_.count(new_precise_accesschain)) { + precise_objects_.insert(new_precise_accesschain); + added_precise_object_ids_.insert(new_precise_accesschain); + } + } + + // A set of precise objects, represented as accesschains. + ObjectAccesschainSet &precise_objects_; + // Visited symbol nodes, should not revisit these nodes. + ObjectAccesschainSet added_precise_object_ids_; + // The left node of an assignment operation might be an parent of 'precise' objects. + // This means the left node might not be an 'precise' object node, but it may contains + // 'precise' qualifier which should be propagated to the corresponding child node in + // the right. So we need the path from the left node to its nested 'precise' node to + // tell us how to find the corresponding 'precise' node in the right. + ObjectAccessChain remained_accesschain_; + // A map from node pointers to their accesschains. + const AccessChainMapping &accesschain_mapping_; +}; + +#undef StructAccessChainDelimiter +} + +namespace glslang { + +void PropagateNoContraction(const glslang::TIntermediate &intermediate) +{ + // First, traverses the AST, records symbols with their defining operations + // and collects the initial set of precise symbols (symbol nodes that marked + // as 'noContraction'). + auto mappings_and_precise_objects = + getSymbolToDefinitionMappingAndPreciseSymbolIDs(intermediate); + + // The mapping of symbol node IDs to their defining nodes. This enables us + // to get the defining node directly from a given symbol ID without + // traversing the tree again. + NodeMapping &symbol_definition_mapping = std::get<0>(mappings_and_precise_objects); + + // The mapping of object nodes to their accesschains recorded. + AccessChainMapping &accesschain_mapping = std::get<1>(mappings_and_precise_objects); + + // The initial set of 'precise' objects which are represented as the + // accesschain toward them. + ObjectAccesschainSet &precise_object_accesschains = + std::get<2>(mappings_and_precise_objects); + + // The set of 'precise' return nodes. + ReturnBranchNodeSet &precise_return_nodes = std::get<3>(mappings_and_precise_objects); + + // Second, uses the initial set of precise objects as a worklist, pops an + // accesschain, extract the symbol ID from it. Then: + // 1) Check the assignee object, see if it is 'precise' object node or + // contains 'precise' object. Obtain the incremental accesschain from the + // assignee node to its nested 'precise' node (if any). + // 2) If the assignee object node is 'precise' or it contains 'precise' + // objects, traverses the right side of the assignment operation + // expression to mark arithmetic operations as 'noContration' and update + // 'precise' accesschain worklist with new found object nodes. + // Repeat above steps until the worklist is empty. + TNoContractionAssigneeCheckingTraverser checker; + TNoContractionPropagator propagator(&precise_object_accesschains, + accesschain_mapping); + + // We have to initial precise worklist to handle: + // 1) precise return nodes + // 2) precise object accesschains + // We should process the precise return nodes first and the involved + // objects in the return expression should be added to the precise object + // accesschain set. + while (!precise_return_nodes.empty()) { + glslang::TIntermBranch* precise_return_node = *precise_return_nodes.begin(); + propagator.propagateNoContractionInReturnNode(precise_return_node); + precise_return_nodes.erase(precise_return_node); + } + + while (!precise_object_accesschains.empty()) { + // Get the accesschain of a precise object from the worklist. + ObjectAccessChain precise_object_accesschain = *precise_object_accesschains.begin(); + // Get the symbol id from the accesschain. + ObjectAccessChain symbol_id = getFrontElement(precise_object_accesschain); + // Get all the defining nodes of that symbol ID. + std::pair range = + symbol_definition_mapping.equal_range(symbol_id); + // Visit all the assignment nodes of that symbol ID and + // 1) Check if the assignee node is 'precise' or contains 'precise' + // objects. + // 2) Propagate the 'precise' to the top layer object ndoes + // in the right side of the assignment operation, update the 'precise' + // worklist with new accesschains representing the new 'precise' + // objects, and mark arithmetic operations as 'noContraction'. + for (NodeMapping::iterator defining_node_iter = range.first; + defining_node_iter != range.second; defining_node_iter++) { + TIntermOperator *defining_node = defining_node_iter->second; + // Check the assignee node. + auto checker_result = checker.getPrecisenessAndRemainedAccessChain( + defining_node, precise_object_accesschain); + bool &contain_precise = std::get<0>(checker_result); + ObjectAccessChain &remained_accesschain = std::get<1>(checker_result); + // If the assignee node is 'precise' or contains 'precise', propagate the + // 'precise' to the right. Otherwise just skip this assignment node. + if (contain_precise) { + propagator.propagateNoContractionInOneExpression(defining_node, + remained_accesschain); + } + } + // Remove the last processed 'precise' object from the worklist. + precise_object_accesschains.erase(precise_object_accesschain); + } +} +}; diff --git a/glslang/MachineIndependent/propagateNoContraction.h b/glslang/MachineIndependent/propagateNoContraction.h new file mode 100644 index 00000000..43c2116b --- /dev/null +++ b/glslang/MachineIndependent/propagateNoContraction.h @@ -0,0 +1,53 @@ +// +// Copyright (C) 2015-2016 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 Google Inc. 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. + +// +// Visit the nodes in the glslang intermediate tree representation to +// propagate 'noContraction' qualifier. +// + +#include "../Include/intermediate.h" + +namespace glslang { + +// Propagates the 'precise' qualifier for objects (objects marked with +// 'noContraction' qualifier) from the shader source specified 'precise' +// variables to all the involved objects, and add 'noContraction' qualifier for +// the involved arithmetic operations. +// Note that the same qualifier: 'noContraction' is used in both object nodes +// and arithmetic operation nodes, but has different meaning. For object nodes, +// 'noContraction' means the object is 'precise'; and for arithmetic operation +// nodes, it means the operation should not be contracted. +void PropagateNoContraction(const glslang::TIntermediate& intermediate); +}; From 1a0d93f416361d11bffd562d092cb2ba53cd8e9c Mon Sep 17 00:00:00 2001 From: qining Date: Thu, 5 May 2016 17:47:27 -0400 Subject: [PATCH 068/140] Fix the test of precise output function parameter Rebase to 5cc344d8ce09a6d35ff88b9ea9f351062d779081 and update the expected test result. --- Test/baseResults/precise.tesc.out | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Test/baseResults/precise.tesc.out b/Test/baseResults/precise.tesc.out index d14af90e..4976b9cb 100644 --- a/Test/baseResults/precise.tesc.out +++ b/Test/baseResults/precise.tesc.out @@ -341,18 +341,18 @@ vertices = -1 0:96 Function Definition: precise_func_parameter(f1;f1; (global float) 0:96 Function Parameters: 0:96 'b' (in float) -0:96 'c' (out float) +0:96 'c' (noContraction out float) 0:97 Sequence 0:97 Sequence 0:97 move second child to first child (temp float) -0:97 'a' (temp float) +0:97 'a' (noContraction temp float) 0:97 Constant: 0:97 0.500000 0:98 move second child to first child (temp float) -0:98 'c' (out float) -0:98 add (temp float) -0:98 'a' (temp float) -0:98 'b' (in float) +0:98 'c' (noContraction out float) +0:98 add (noContraction temp float) +0:98 'a' (noContraction temp float) +0:98 'b' (noContraction in float) 0:99 Branch: Return with expression 0:99 subtract (temp float) 0:99 'a' (temp float) @@ -706,18 +706,18 @@ vertices = -1 0:96 Function Definition: precise_func_parameter(f1;f1; (global float) 0:96 Function Parameters: 0:96 'b' (in float) -0:96 'c' (out float) +0:96 'c' (noContraction out float) 0:97 Sequence 0:97 Sequence 0:97 move second child to first child (temp float) -0:97 'a' (temp float) +0:97 'a' (noContraction temp float) 0:97 Constant: 0:97 0.500000 0:98 move second child to first child (temp float) -0:98 'c' (out float) -0:98 add (temp float) -0:98 'a' (temp float) -0:98 'b' (in float) +0:98 'c' (noContraction out float) +0:98 add (noContraction temp float) +0:98 'a' (noContraction temp float) +0:98 'b' (noContraction in float) 0:99 Branch: Return with expression 0:99 subtract (temp float) 0:99 'a' (temp float) From 015150e4b359ee7539ea5952fa86439c550602df Mon Sep 17 00:00:00 2001 From: qining Date: Thu, 5 May 2016 22:34:52 -0400 Subject: [PATCH 069/140] Removed the redundant functionalities in the assignee checking traverser --- .../propagateNoContraction.cpp | 211 +++++++++--------- 1 file changed, 111 insertions(+), 100 deletions(-) diff --git a/glslang/MachineIndependent/propagateNoContraction.cpp b/glslang/MachineIndependent/propagateNoContraction.cpp index 044ecbf3..fa2b62a9 100644 --- a/glslang/MachineIndependent/propagateNoContraction.cpp +++ b/glslang/MachineIndependent/propagateNoContraction.cpp @@ -211,6 +211,14 @@ ObjectAccessChain subAccessChainFromSecondElement(const ObjectAccessChain& chain return pos_delimiter == std::string::npos ? "" : chain.substr(pos_delimiter + 1); } +// A helper function to get the accesschain after removing a given prefix. +ObjectAccessChain getSubAccessChainAfterPrefix(const ObjectAccessChain &chain, const ObjectAccessChain &prefix) +{ + size_t pos = chain.find(prefix); + if (pos != 0) return chain; + return chain.substr(prefix.length() + sizeof(StructAccessChainDelimiter)); +} + // // A traverser which traverses the whole AST and populates: // 1) A mapping from symbol nodes' IDs to their defining operation nodes. @@ -466,8 +474,9 @@ class TNoContractionAssigneeCheckingTraverser : public glslang::TIntermTraverser }; public: - TNoContractionAssigneeCheckingTraverser() - : TIntermTraverser(true, false, false), accesschain_to_precise_object_(), decision_(Mixed) {} + TNoContractionAssigneeCheckingTraverser(const AccessChainMapping &accesschain_mapping) + : TIntermTraverser(true, false, false), accesschain_mapping_(accesschain_mapping), + precise_object_(nullptr) {} // Checks the precise'ness of a given assignment node with a precise object // represented as accesschain. The precise object shares the same symbol @@ -488,125 +497,127 @@ public: const ObjectAccessChain &precise_object) { assert(isAssignOperation(node->getOp())); - accesschain_to_precise_object_ = precise_object; - decision_ = Mixed; - node->traverse(this); - return make_tuple(decision_ != NotPreicse, accesschain_to_precise_object_); + precise_object_ = &precise_object; + ObjectAccessChain assignee_object; + if (glslang::TIntermBinary* BN = node->getAsBinaryNode()) { + // This is a binary assignment node, we need to check the + // precise'ness of the left node. + if (!accesschain_mapping_.count(BN->getLeft())) { + // If the left node is not an object node, it can not be + // 'precise'. + return make_tuple(false, ObjectAccessChain()); + } + // The left node (assignee node) is an object node, traverse the + // node to let the 'precise' of nesting objects being transfered to + // nested objects. + BN->getLeft()->traverse(this); + // After traversing the left node, if the left node is 'precise', + // we can conclude this assignment should propagate 'precise'. + if (isPreciseObjectNode(BN->getLeft())) { + return make_tuple(true, ObjectAccessChain()); + } + // If the precise'ness of the left node (assignee node) can not + // be determined by now, we need to compare the accesschain string + // of the assignee object with the given precise object. + assignee_object = accesschain_mapping_.at(BN->getLeft()); + + } else if (glslang::TIntermUnary* UN = node->getAsUnaryNode()) { + // This is a unary assignment node, we need to check the + // precise'ness of the operand node. For unary assignment node, the + // operand node should always be an object node. + if (!accesschain_mapping_.count(UN->getOperand())) { + // If the operand node is not an object node, it can not be + // 'precise'. + return make_tuple(false, ObjectAccessChain()); + } + // Traverse the operand node to let the 'precise' being propagated + // from lower nodes to upper nodes. + UN->getOperand()->traverse(this); + // After traversing the operand node, if the operand node is + // 'precise', this assignment should propagate 'precise'. + if (isPreciseObjectNode(UN->getOperand())) { + return make_tuple(true, ObjectAccessChain()); + } + // If the precise'ness of the operand node (assignee node) can not + // be determined by now, we need to compare the accesschain string + // of the assignee object with the given precise object. + assignee_object = accesschain_mapping_.at(UN->getOperand()); + } else { + // Not a binary or unary node, should not happen. + assert(false); + } + + // Compare the accesschain string of the assignee node with the given + // precise object to determine if this assignment should propagate + // 'precise'. + if (assignee_object.find(precise_object) == 0) { + // The accesschain string of the given precise object is a prefix + // of assignee's accesschain string. The assignee should be + // 'precise'. + return make_tuple(true, ObjectAccessChain()); + } else if (precise_object.find(assignee_object) == 0) { + // The assignee's accesschain string is a prefix of the given + // precise object, the assignee object contains 'precise' object, + // and we need to pass the remained accesschain to the object nodes + // in the right. + return make_tuple(true, getSubAccessChainAfterPrefix(precise_object, assignee_object)); + } else { + // The accesschain strings do not match, the assignee object can + // not be labelled as 'precise' according to the given precise + // object. + return make_tuple(false, ObjectAccessChain()); + } } protected: bool visitBinary(glslang::TVisit, glslang::TIntermBinary *node) override; - bool visitUnary(glslang::TVisit, glslang::TIntermUnary *node) override; void visitSymbol(glslang::TIntermSymbol *node) override; - // The accesschain toward the given precise object. It will be iniailized - // with the accesschain of a given precise object, then trimmed along the - // traversal of the assignee subtree. The remained accesschain at the end - // of traversal shows the path from the assignee node to its nested - // 'precise' object. If the assignee node is 'precise' object object, this - // should be empty. - ObjectAccessChain accesschain_to_precise_object_; - // A state to tell the precise'ness of the assignee node according to the - // accesschain of the given precise object: - // - // 'Mixed': contains both 'precise' and 'non-precise' object - // (accesschain_to_precise_object_ is not empty), - // - // 'Precise': is precise object (accesschain_to_precise_object is empty), - // - // 'NotPrecise': is not precise object (mismatch in the struct dereference - // indices). - DecisionStatus decision_; + // A map from object nodes to their accesschain string (used as object ID). + const AccessChainMapping &accesschain_mapping_; + // A given precise object, represented in it accesschain string. This + // precise object is used to be compared with the assignee node to tell if + // the assignee node is 'precise', contains 'precise' object or not + // 'precise'. + const ObjectAccessChain *precise_object_; }; -// Visit a binary node. As this traverser's job is to check the precise'ness of -// the assignee node in an assignment operation, it only needs to traverse the -// object nodes along the left branches. For struct type object nodes, it needs -// to obtain the struct dereference index from the right node to build the -// accesschain for this node. +// Visit a binary node. If the node is an object node, it must be a dereference +// node. In such cases, if the left node is 'precise', this node should also be +// 'precise'. bool TNoContractionAssigneeCheckingTraverser::visitBinary(glslang::TVisit, glslang::TIntermBinary *node) { + // Traverses the left so that we transfer the 'precise' from nesting object + // to its nested object. node->getLeft()->traverse(this); - // For dereference operation nodes, we may need to check if the accesschain - // of the given precise object matches with the struct dereference indices - // of the assignee subtree. - if (isDereferenceOperation(node->getOp())) { + // If this binary node is an object node, we should have it in the + // accesschain_mapping_. + if (accesschain_mapping_.count(node)) { + // A binary object node must be a dereference node. + assert(isDereferenceOperation(node->getOp())); + // If the left node is 'precise', this node should also be precise, + // otherwise, compare with the given precise_object_. If the + // accesschain of this node matches with the given precise_object_, + // this node should be marked as 'precise'. if (isPreciseObjectNode(node->getLeft())) { - // The left node is 'precise', which means the object node in the - // left contains the object represented in this node. If the left node - // is 'precise', this object node should also be 'precise' and no need - // to check the accesschain and struct deference indices anymore. node->getWritableType().getQualifier().noContraction = true; - decision_ = Precise; - return false; - } - if (node->getOp() == glslang::EOpIndexDirectStruct && decision_ == Mixed) { - std::string struct_index = - std::to_string(getStructIndexFromConstantUnion(node->getRight())); - ObjectAccessChain precise_struct_index = getFrontElement(accesschain_to_precise_object_); - if (precise_struct_index == struct_index) { - // The struct dereference index matches with the record in the - // accesschain to the precise object. Pop the front access - // chain index from the precise object access chain. - accesschain_to_precise_object_ = - subAccessChainFromSecondElement(accesschain_to_precise_object_); - // If the given access chain to precise object is empty now, - // it means we've found the corresponding precise object in - // the assignee subtree. - if (accesschain_to_precise_object_.empty()) { - node->getWritableType().getQualifier().noContraction = true; - decision_ = Precise; - } - } else { - // The access chain index does not match with the record in the precise object id. - // This object should not be labelled as 'precise' here. - decision_ = NotPreicse; - } + } else if (accesschain_mapping_.at(node) == *precise_object_){ + node->getWritableType().getQualifier().noContraction = true; } } return false; } -// Visits an unary node, traverses its operand. If the node is an assignment node, -// determines the precise'ness of the assignee directly based on the assignee node's -// precise'ness. -bool TNoContractionAssigneeCheckingTraverser::visitUnary(glslang::TVisit, - glslang::TIntermUnary *node) -{ - node->getOperand()->traverse(this); - if (isAssignOperation(node->getOp())) { - if (isPreciseObjectNode(node->getOperand())) { - decision_ = Precise; - // As the assignee node is 'precise', all (if any) the - // member objects the that node should also be 'precise'. This means - // we won't need to propagate extra access chain info. - accesschain_to_precise_object_.clear(); - } else { - decision_ = NotPreicse; - } - } - return false; -} - -// Visits a symbol node. The symbol ID of this node should match with the symbol ID, which is -// the front element, in the accesschain of the given 'precise' object. +// Visit a symbol node, if the symbol node ID (its accesschain string) matches +// with the given precise object, this node should be 'precise'. void TNoContractionAssigneeCheckingTraverser::visitSymbol(glslang::TIntermSymbol *node) { - ObjectAccessChain symbol_id = generateSymbolLabel(node); - // The root symbol of the given access chain should be the same with the one represented by the symbol node here. - assert(symbol_id == getFrontElement(accesschain_to_precise_object_)); - // Pop the symbol node part from the front end of the accesschain string. - accesschain_to_precise_object_ = - subAccessChainFromSecondElement(accesschain_to_precise_object_); - if (accesschain_to_precise_object_.empty()) { + // A symbol node should always be an object node, and should have been added + // to the map from object nodes to their accesschain strings. + assert(accesschain_mapping_.count(node)); + if (accesschain_mapping_.at(node) == *precise_object_) { node->getWritableType().getQualifier().noContraction = true; - decision_ = Precise; - } - // If this symbol node is 'precise', all its members should be 'precise' so the assignee of the processing - // assignment operations is 'precise'. - if (isPreciseObjectNode(node)) { - decision_ = Precise; } } @@ -833,7 +844,7 @@ void PropagateNoContraction(const glslang::TIntermediate &intermediate) // expression to mark arithmetic operations as 'noContration' and update // 'precise' accesschain worklist with new found object nodes. // Repeat above steps until the worklist is empty. - TNoContractionAssigneeCheckingTraverser checker; + TNoContractionAssigneeCheckingTraverser checker(accesschain_mapping); TNoContractionPropagator propagator(&precise_object_accesschains, accesschain_mapping); From 25262b3fd95da58de45197e9b06418bdcdeee57c Mon Sep 17 00:00:00 2001 From: qining Date: Fri, 6 May 2016 17:25:16 -0400 Subject: [PATCH 070/140] Resolve comments 1. Sink adding noContraction decoration to createBinaryOperation() and createUnaryOperation(). 2. Fix comments. 3. Remove the #define of my delimiter, use global constant char. --- SPIRV/GlslangToSpv.cpp | 108 +++++---- .../propagateNoContraction.cpp | 216 +++++++++--------- 2 files changed, 162 insertions(+), 162 deletions(-) diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index d160e36e..22575b5a 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -33,8 +33,6 @@ //ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE //POSSIBILITY OF SUCH DAMAGE. -// -// Author: John Kessenich, LunarG // // Visit the nodes in the glslang intermediate tree representation to // translate them to SPIR-V. @@ -135,10 +133,10 @@ protected: spv::Id createImageTextureFunctionCall(glslang::TIntermOperator* node); spv::Id handleUserFunctionCall(const glslang::TIntermAggregate*); - spv::Id createBinaryOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, spv::Id left, spv::Id right, glslang::TBasicType typeProxy, bool reduceComparison = true); - spv::Id createBinaryMatrixOperation(spv::Op, spv::Decoration precision, spv::Id typeId, spv::Id left, spv::Id right); - spv::Id createUnaryOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, spv::Id operand,glslang::TBasicType typeProxy); - spv::Id createUnaryMatrixOperation(spv::Op, spv::Decoration precision, spv::Id typeId, spv::Id operand,glslang::TBasicType typeProxy); + spv::Id createBinaryOperation(glslang::TOperator op, spv::Decoration precision, spv::Decoration noContraction, spv::Id typeId, spv::Id left, spv::Id right, glslang::TBasicType typeProxy, bool reduceComparison = true); + spv::Id createBinaryMatrixOperation(spv::Op, spv::Decoration precision, spv::Decoration noContraction, spv::Id typeId, spv::Id left, spv::Id right); + spv::Id createUnaryOperation(glslang::TOperator op, spv::Decoration precision, spv::Decoration noContraction, spv::Id typeId, spv::Id operand,glslang::TBasicType typeProxy); + spv::Id createUnaryMatrixOperation(spv::Op, spv::Decoration precision, spv::Decoration noContraction, spv::Id typeId, spv::Id operand,glslang::TBasicType typeProxy); spv::Id createConversion(glslang::TOperator op, spv::Decoration precision, spv::Id destTypeId, spv::Id operand); spv::Id makeSmearedConstant(spv::Id constant, int vectorSize); spv::Id createAtomicOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, std::vector& operands, glslang::TBasicType typeProxy); @@ -244,7 +242,7 @@ spv::StorageClass TranslateStorageClass(const glslang::TType& type) case glslang::EvqGlobal: return spv::StorageClassPrivate; case glslang::EvqConstReadOnly: return spv::StorageClassFunction; case glslang::EvqTemporary: return spv::StorageClassFunction; - default: + default: assert(0); return spv::StorageClassFunction; } @@ -567,7 +565,7 @@ spv::ImageFormat TGlslangToSpvTraverser::TranslateImageFormat(const glslang::TTy } } -// Return whether or not the given type is something that should be tied to a +// Return whether or not the given type is something that should be tied to a // descriptor set. bool IsDescriptorResource(const glslang::TType& type) { @@ -621,8 +619,7 @@ bool HasNonLayoutQualifiers(const glslang::TQualifier& qualifier) // - struct members can inherit from a struct declaration // - effect decorations on the struct members (note smooth does not, and expecting something like volatile to effect the whole object) // - are not part of the offset/st430/etc or row/column-major layout - return qualifier.invariant || qualifier.nopersp || qualifier.flat || qualifier.centroid || qualifier.patch || qualifier.sample || qualifier.hasLocation() || - qualifier.noContraction; + return qualifier.invariant || qualifier.nopersp || qualifier.flat || qualifier.centroid || qualifier.patch || qualifier.sample || qualifier.hasLocation(); } // @@ -792,7 +789,7 @@ TGlslangToSpvTraverser::~TGlslangToSpvTraverser() // // -// Symbols can turn into +// Symbols can turn into // - uniform/input reads // - output writes // - complex lvalue base setups: foo.bar[3].... , where we see foo and start up an access chain @@ -883,13 +880,11 @@ bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::T spv::Id leftRValue = accessChainLoad(node->getLeft()->getType()); // do the operation - rValue = createBinaryOperation(node->getOp(), TranslatePrecisionDecoration(node->getType()), + rValue = createBinaryOperation(node->getOp(), TranslatePrecisionDecoration(node->getType()), + TranslateNoContractionDecoration(node->getType().getQualifier()), convertGlslangToSpvType(node->getType()), leftRValue, rValue, node->getType().getBasicType()); - // Decorate this instruction, if this node has 'noContraction' qualifier. - addDecoration(rValue, TranslateNoContractionDecoration(node->getType().getQualifier())); - // these all need their counterparts in createBinaryOperation() assert(rValue != spv::NoResult); } @@ -1005,6 +1000,7 @@ bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::T // get result spv::Id result = createBinaryOperation(node->getOp(), TranslatePrecisionDecoration(node->getType()), + TranslateNoContractionDecoration(node->getType().getQualifier()), convertGlslangToSpvType(node->getType()), left, right, node->getLeft()->getType().getBasicType()); @@ -1013,8 +1009,6 @@ bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::T logger->missingFunctionality("unknown glslang binary operation"); return true; // pick up a child as the place-holder result } else { - // Decorate this instruction, if this node has 'noContraction' qualifier. - addDecoration(result, TranslateNoContractionDecoration(node->getType().getQualifier())); builder.setAccessChainRValue(result); return false; } @@ -1073,6 +1067,7 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI operand = accessChainLoad(node->getOperand()->getType()); spv::Decoration precision = TranslatePrecisionDecoration(node->getType()); + spv::Decoration noContraction = TranslateNoContractionDecoration(node->getType().getQualifier()); // it could be a conversion if (! result) @@ -1080,11 +1075,9 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI // if not, then possibly an operation if (! result) - result = createUnaryOperation(node->getOp(), precision, convertGlslangToSpvType(node->getType()), operand, node->getOperand()->getBasicType()); + result = createUnaryOperation(node->getOp(), precision, noContraction, convertGlslangToSpvType(node->getType()), operand, node->getOperand()->getBasicType()); if (result) { - // Decorate this instruction, if this node has 'noContraction' qualifier. - addDecoration(result, TranslateNoContractionDecoration(node->getType().getQualifier())); builder.clearAccessChain(); builder.setAccessChainRValue(result); @@ -1113,12 +1106,11 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI else op = glslang::EOpSub; - spv::Id result = createBinaryOperation(op, TranslatePrecisionDecoration(node->getType()), + spv::Id result = createBinaryOperation(op, TranslatePrecisionDecoration(node->getType()), + TranslateNoContractionDecoration(node->getType().getQualifier()), convertGlslangToSpvType(node->getType()), operand, one, node->getType().getBasicType()); assert(result != spv::NoResult); - // Decorate this instruction, if this node has 'noContraction' qualifier. - addDecoration(result, TranslateNoContractionDecoration(node->getType().getQualifier())); // The result of operation is always stored, but conditionally the // consumed result. The consumed result is always an r-value. @@ -1350,7 +1342,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt break; } case glslang::EOpMul: - // compontent-wise matrix multiply + // compontent-wise matrix multiply binOp = glslang::EOpMul; break; case glslang::EOpOuterProduct: @@ -1359,7 +1351,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt break; case glslang::EOpDot: { - // for scalar dot product, use multiply + // for scalar dot product, use multiply glslang::TIntermSequence& glslangOperands = node->getSequence(); if (! glslangOperands[0]->getAsTyped()->isVector()) binOp = glslang::EOpMul; @@ -1414,8 +1406,8 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt right->traverse(this); spv::Id rightId = accessChainLoad(right->getType()); - result = createBinaryOperation(binOp, precision, - convertGlslangToSpvType(node->getType()), leftId, rightId, + result = createBinaryOperation(binOp, precision, TranslateNoContractionDecoration(node->getType().getQualifier()), + convertGlslangToSpvType(node->getType()), leftId, rightId, left->getType().getBasicType(), reduceComparison); // code above should only make binOp that exists in createBinaryOperation @@ -1488,7 +1480,11 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt result = createNoArgOperation(node->getOp()); break; case 1: - result = createUnaryOperation(node->getOp(), precision, convertGlslangToSpvType(node->getType()), operands.front(), glslangOperands[0]->getAsTyped()->getBasicType()); + result = createUnaryOperation( + node->getOp(), precision, + TranslateNoContractionDecoration(node->getType().getQualifier()), + convertGlslangToSpvType(node->getType()), operands.front(), + glslangOperands[0]->getAsTyped()->getBasicType()); break; default: result = createMiscOperation(node->getOp(), precision, convertGlslangToSpvType(node->getType()), operands, node->getBasicType()); @@ -1579,7 +1575,7 @@ bool TGlslangToSpvTraverser::visitSwitch(glslang::TVisit /* visit */, glslang::T codeSegments.push_back(child); } - // handle the case where the last code segment is missing, due to no code + // handle the case where the last code segment is missing, due to no code // statements between the last case and the end of the switch statement if ((caseValues.size() && (int)codeSegments.size() == valueIndexToSegment[caseValues.size() - 1]) || (int)codeSegments.size() == defaultSegment) @@ -1714,7 +1710,7 @@ bool TGlslangToSpvTraverser::visitBranch(glslang::TVisit /* visit */, glslang::T spv::Id TGlslangToSpvTraverser::createSpvVariable(const glslang::TIntermSymbol* node) { - // First, steer off constants, which are not SPIR-V variables, but + // First, steer off constants, which are not SPIR-V variables, but // can still have a mapping to a SPIR-V Id. // This includes specialization constants. if (node->getQualifier().isConstant()) { @@ -2018,7 +2014,7 @@ spv::Id TGlslangToSpvTraverser::makeArraySizeId(const glslang::TArraySizes& arra specNode->traverse(this); return accessChainLoad(specNode->getAsTyped()->getType()); } - + // Otherwise, need a compile-time (front end) size, get it: int size = arraySizes.getDimSize(dim); assert(size > 0); @@ -2165,7 +2161,7 @@ void TGlslangToSpvTraverser::updateMemberOffset(const glslang::TType& /*structTy // Getting this far means we need explicit offsets if (currentOffset < 0) currentOffset = 0; - + // Now, currentOffset is valid (either 0, or from a previous nextOffset), // but possibly not yet correctly aligned. @@ -2195,7 +2191,7 @@ void TGlslangToSpvTraverser::makeFunctions(const glslang::TIntermSequence& glslF // so that it's available to call. // Translating the body will happen later. // - // Typically (except for a "const in" parameter), an address will be passed to the + // Typically (except for a "const in" parameter), an address will be passed to the // function. What it is an address of varies: // // - "in" parameters not marked as "const" can be written to without modifying the argument, @@ -2265,7 +2261,7 @@ void TGlslangToSpvTraverser::visitFunctions(const glslang::TIntermSequence& glsl void TGlslangToSpvTraverser::handleFunctionEntry(const glslang::TIntermAggregate* node) { - // SPIR-V functions should already be in the functionMap from the prepass + // SPIR-V functions should already be in the functionMap from the prepass // that called makeFunctions(). spv::Function* function = functionMap[node->getName().c_str()]; spv::Block* functionBlock = function->getEntryBlock(); @@ -2679,7 +2675,8 @@ spv::Id TGlslangToSpvTraverser::handleUserFunctionCall(const glslang::TIntermAgg } // Translate AST operation to SPV operation, already having SPV-based operands/types. -spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, spv::Decoration precision, +spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, spv::Decoration precision, + spv::Decoration noContraction, spv::Id typeId, spv::Id left, spv::Id right, glslang::TBasicType typeProxy, bool reduceComparison) { @@ -2816,13 +2813,15 @@ spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, spv if (binOp != spv::OpNop) { assert(comparison == false); if (builder.isMatrix(left) || builder.isMatrix(right)) - return createBinaryMatrixOperation(binOp, precision, typeId, left, right); + return createBinaryMatrixOperation(binOp, precision, noContraction, typeId, left, right); // No matrix involved; make both operands be the same number of components, if needed if (needMatchingVectors) builder.promoteScalar(precision, left, right); - return builder.setPrecision(builder.createBinOp(binOp, typeId, left, right), precision); + spv::Id result = builder.createBinOp(binOp, typeId, left, right); + addDecoration(result, noContraction); + return builder.setPrecision(result, precision); } if (! comparison) @@ -2891,8 +2890,11 @@ spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, spv break; } - if (binOp != spv::OpNop) - return builder.setPrecision(builder.createBinOp(binOp, typeId, left, right), precision); + if (binOp != spv::OpNop) { + spv::Id result = builder.createBinOp(binOp, typeId, left, right); + addDecoration(result, noContraction); + return builder.setPrecision(result, precision); + } return 0; } @@ -2911,7 +2913,7 @@ spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, spv // matrix op scalar op in {+, -, /} // scalar op matrix op in {+, -, /} // -spv::Id TGlslangToSpvTraverser::createBinaryMatrixOperation(spv::Op op, spv::Decoration precision, spv::Id typeId, spv::Id left, spv::Id right) +spv::Id TGlslangToSpvTraverser::createBinaryMatrixOperation(spv::Op op, spv::Decoration precision, spv::Decoration noContraction, spv::Id typeId, spv::Id left, spv::Id right) { bool firstClass = true; @@ -2947,8 +2949,11 @@ spv::Id TGlslangToSpvTraverser::createBinaryMatrixOperation(spv::Op op, spv::Dec break; } - if (firstClass) - return builder.setPrecision(builder.createBinOp(op, typeId, left, right), precision); + if (firstClass) { + spv::Id result = builder.createBinOp(op, typeId, left, right); + addDecoration(result, noContraction); + return builder.setPrecision(result, precision); + } // Handle component-wise +, -, *, and / for all combinations of type. // The result type of all of them is the same type as the (a) matrix operand. @@ -2983,8 +2988,9 @@ spv::Id TGlslangToSpvTraverser::createBinaryMatrixOperation(spv::Op op, spv::Dec indexes.push_back(c); spv::Id leftVec = leftMat ? builder.createCompositeExtract( left, vecType, indexes) : smearVec; spv::Id rightVec = rightMat ? builder.createCompositeExtract(right, vecType, indexes) : smearVec; - results.push_back(builder.createBinOp(op, vecType, leftVec, rightVec)); - builder.setPrecision(results.back(), precision); + spv::Id result = builder.createBinOp(op, vecType, leftVec, rightVec); + addDecoration(result, noContraction); + results.push_back(builder.setPrecision(result, precision)); } // put the pieces together @@ -2996,7 +3002,7 @@ spv::Id TGlslangToSpvTraverser::createBinaryMatrixOperation(spv::Op op, spv::Dec } } -spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, spv::Id operand, glslang::TBasicType typeProxy) +spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv::Decoration precision, spv::Decoration noContraction, spv::Id typeId, spv::Id operand, glslang::TBasicType typeProxy) { spv::Op unaryOp = spv::OpNop; int libCall = -1; @@ -3008,7 +3014,7 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv: if (isFloat) { unaryOp = spv::OpFNegate; if (builder.isMatrixType(typeId)) - return createUnaryMatrixOperation(unaryOp, precision, typeId, operand, typeProxy); + return createUnaryMatrixOperation(unaryOp, precision, noContraction, typeId, operand, typeProxy); } else unaryOp = spv::OpSNegate; break; @@ -3290,11 +3296,12 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv: id = builder.createUnaryOp(unaryOp, typeId, operand); } + addDecoration(id, noContraction); return builder.setPrecision(id, precision); } // Create a unary operation on a matrix -spv::Id TGlslangToSpvTraverser::createUnaryMatrixOperation(spv::Op op, spv::Decoration precision, spv::Id typeId, spv::Id operand, glslang::TBasicType /* typeProxy */) +spv::Id TGlslangToSpvTraverser::createUnaryMatrixOperation(spv::Op op, spv::Decoration precision, spv::Decoration noContraction, spv::Id typeId, spv::Id operand, glslang::TBasicType /* typeProxy */) { // Handle unary operations vector by vector. // The result type is the same type as the original type. @@ -3315,8 +3322,9 @@ spv::Id TGlslangToSpvTraverser::createUnaryMatrixOperation(spv::Op op, spv::Deco std::vector indexes; indexes.push_back(c); spv::Id vec = builder.createCompositeExtract(operand, vecType, indexes); - results.push_back(builder.createUnaryOp(op, vecType, vec)); - builder.setPrecision(results.back(), precision); + spv::Id vec_result = builder.createUnaryOp(op, vecType, vec); + addDecoration(vec_result, noContraction); + results.push_back(builder.setPrecision(vec_result, precision)); } // put the pieces together @@ -4144,7 +4152,7 @@ bool TGlslangToSpvTraverser::isTrivialLeaf(const glslang::TIntermTyped* node) default: return false; } -} +} // A node is trivial if it is a single operation with no side effects. // Error on the side of saying non-trivial. diff --git a/glslang/MachineIndependent/propagateNoContraction.cpp b/glslang/MachineIndependent/propagateNoContraction.cpp index fa2b62a9..f4b88d16 100644 --- a/glslang/MachineIndependent/propagateNoContraction.cpp +++ b/glslang/MachineIndependent/propagateNoContraction.cpp @@ -47,18 +47,27 @@ #include "localintermediate.h" namespace { -// Use string to hold the accesschain information, as in most cases we the -// accesschain is short and may contain only one element, which is the symbol ID. +// Use string to hold the accesschain information, as in most cases the +// accesschain is short and may contain only one element, which is the symbol +// ID. +// Example: struct {float a; float b;} s; +// Object s.a will be represented with: /0 +// Object s.b will be represented with: /1 +// Object s will be representend with: +// For members of vector, matrix and arrays, they will be represented with the +// same symbol ID of their container symbol objects. This is because their +// precise'ness is always the same as their container symbol objects. using ObjectAccessChain = std::string; -#ifndef StructAccessChainDelimiter -#define StructAccessChainDelimiter '/' -#endif + +// The delimiter used in the ObjectAccessChain string to separate symbol ID and +// different level of struct indices. +const char OBJECT_ACCESSCHAIN_DELIMITER = '/'; // Mapping from Symbol IDs of symbol nodes, to their defining operation // nodes. -using NodeMapping = std::unordered_multimap; +using NodeMapping = std::unordered_multimap; // Mapping from object nodes to their accesschain info string. -using AccessChainMapping = std::unordered_map; +using AccessChainMapping = std::unordered_map; // Set of object IDs. using ObjectAccesschainSet = std::unordered_set; @@ -67,7 +76,7 @@ using ReturnBranchNodeSet = std::unordered_set; // A helper function to tell whether a node is 'noContraction'. Returns true if // the node has 'noContraction' qualifier, otherwise false. -bool isPreciseObjectNode(glslang::TIntermTyped *node) +bool isPreciseObjectNode(glslang::TIntermTyped* node) { return node->getType().getQualifier().noContraction; } @@ -118,7 +127,7 @@ bool isAssignOperation(glslang::TOperator op) // A helper function to get the unsigned int from a given constant union node. // Note the node should only holds a uint scalar. -unsigned getStructIndexFromConstantUnion(glslang::TIntermTyped *node) +unsigned getStructIndexFromConstantUnion(glslang::TIntermTyped* node) { assert(node->getAsConstantUnion() && node->getAsConstantUnion()->isScalar()); unsigned struct_dereference_index = node->getAsConstantUnion()->getConstArray()[0].getUConst(); @@ -126,9 +135,10 @@ unsigned getStructIndexFromConstantUnion(glslang::TIntermTyped *node) } // A helper function to generate symbol_label. -ObjectAccessChain generateSymbolLabel(glslang::TIntermSymbol *node) +ObjectAccessChain generateSymbolLabel(glslang::TIntermSymbol* node) { - ObjectAccessChain symbol_id = std::to_string(node->getId()) + "(" + node->getName().c_str() + ")"; + ObjectAccessChain symbol_id = + std::to_string(node->getId()) + "(" + node->getName().c_str() + ")"; return symbol_id; } @@ -180,43 +190,41 @@ bool isArithmeticOperation(glslang::TOperator op) // A helper class to help managing populating_initial_no_contraction_ flag. template class StateSettingGuard { public: - StateSettingGuard(T *state_ptr, T new_state_value) + StateSettingGuard(T* state_ptr, T new_state_value) : state_ptr_(state_ptr), previous_state_(*state_ptr) { *state_ptr = new_state_value; } - StateSettingGuard(T *state_ptr) : state_ptr_(state_ptr), previous_state_(*state_ptr) {} - void setState(T new_state_value) - { - *state_ptr_ = new_state_value; - } + StateSettingGuard(T* state_ptr) : state_ptr_(state_ptr), previous_state_(*state_ptr) {} + void setState(T new_state_value) { *state_ptr_ = new_state_value; } ~StateSettingGuard() { *state_ptr_ = previous_state_; } private: - T *state_ptr_; + T* state_ptr_; T previous_state_; }; // A helper function to get the front element from a given ObjectAccessChain -ObjectAccessChain getFrontElement(const ObjectAccessChain &chain) +ObjectAccessChain getFrontElement(const ObjectAccessChain& chain) { - size_t pos_delimiter = chain.find(StructAccessChainDelimiter); + size_t pos_delimiter = chain.find(OBJECT_ACCESSCHAIN_DELIMITER); return pos_delimiter == std::string::npos ? chain : chain.substr(0, pos_delimiter); } // A helper function to get the accesschain starting from the second element. ObjectAccessChain subAccessChainFromSecondElement(const ObjectAccessChain& chain) { - size_t pos_delimiter = chain.find(StructAccessChainDelimiter); + size_t pos_delimiter = chain.find(OBJECT_ACCESSCHAIN_DELIMITER); return pos_delimiter == std::string::npos ? "" : chain.substr(pos_delimiter + 1); } // A helper function to get the accesschain after removing a given prefix. -ObjectAccessChain getSubAccessChainAfterPrefix(const ObjectAccessChain &chain, const ObjectAccessChain &prefix) +ObjectAccessChain getSubAccessChainAfterPrefix(const ObjectAccessChain& chain, + const ObjectAccessChain& prefix) { size_t pos = chain.find(prefix); if (pos != 0) return chain; - return chain.substr(prefix.length() + sizeof(StructAccessChainDelimiter)); + return chain.substr(prefix.length() + sizeof(OBJECT_ACCESSCHAIN_DELIMITER)); } // @@ -226,34 +234,33 @@ ObjectAccessChain getSubAccessChainAfterPrefix(const ObjectAccessChain &chain, c // class TSymbolDefinitionCollectingTraverser : public glslang::TIntermTraverser { public: - TSymbolDefinitionCollectingTraverser( - NodeMapping *symbol_definition_mapping, AccessChainMapping *accesschain_mapping, - ObjectAccesschainSet *precise_objects, - ReturnBranchNodeSet *precise_return_nodes); + TSymbolDefinitionCollectingTraverser(NodeMapping* symbol_definition_mapping, + AccessChainMapping* accesschain_mapping, + ObjectAccesschainSet* precise_objects, + ReturnBranchNodeSet* precise_return_nodes); - // bool visitAggregate(glslang::TVisit, glslang::TIntermAggregate *) override; - bool visitUnary(glslang::TVisit, glslang::TIntermUnary *) override; - bool visitBinary(glslang::TVisit, glslang::TIntermBinary *) override; - void visitSymbol(glslang::TIntermSymbol *) override; - bool visitAggregate(glslang::TVisit, glslang::TIntermAggregate *) override; - bool visitBranch(glslang::TVisit, glslang::TIntermBranch *) override; + bool visitUnary(glslang::TVisit, glslang::TIntermUnary*) override; + bool visitBinary(glslang::TVisit, glslang::TIntermBinary*) override; + void visitSymbol(glslang::TIntermSymbol*) override; + bool visitAggregate(glslang::TVisit, glslang::TIntermAggregate*) override; + bool visitBranch(glslang::TVisit, glslang::TIntermBranch*) override; protected: // The mapping from symbol node IDs to their defining nodes. This should be // populated along traversing the AST. - NodeMapping &symbol_definition_mapping_; + NodeMapping& symbol_definition_mapping_; // The set of symbol node IDs for precise symbol nodes, the ones marked as // 'noContraction'. - ObjectAccesschainSet &precise_objects_; + ObjectAccesschainSet& precise_objects_; // The set of precise return nodes. - ReturnBranchNodeSet &precise_return_nodes_; + ReturnBranchNodeSet& precise_return_nodes_; // A temporary cache of the symbol node whose defining node is to be found // currently along traversing the AST. ObjectAccessChain object_to_be_defined_; // A map from object node to its accesschain. This traverser stores // the built accesschains into this map for each object node it has // visited. - AccessChainMapping &accesschain_mapping_; + AccessChainMapping& accesschain_mapping_; // The pointer to the Function Definition node, so we can get the // precise'ness of the return expression from it when we traverse the // return branch node. @@ -261,9 +268,9 @@ protected: }; TSymbolDefinitionCollectingTraverser::TSymbolDefinitionCollectingTraverser( - NodeMapping *symbol_definition_mapping, AccessChainMapping *accesschain_mapping, - ObjectAccesschainSet *precise_objects, - std::unordered_set *precise_return_nodes) + NodeMapping* symbol_definition_mapping, AccessChainMapping* accesschain_mapping, + ObjectAccesschainSet* precise_objects, + std::unordered_set* precise_return_nodes) : TIntermTraverser(true, false, false), symbol_definition_mapping_(*symbol_definition_mapping), precise_objects_(*precise_objects), object_to_be_defined_(), accesschain_mapping_(*accesschain_mapping), current_function_definition_node_(nullptr), @@ -273,7 +280,7 @@ TSymbolDefinitionCollectingTraverser::TSymbolDefinitionCollectingTraverser( // current node symbol ID, and record a mapping from this node to the current // object_to_be_defined_, which is the just obtained symbol // ID. -void TSymbolDefinitionCollectingTraverser::visitSymbol(glslang::TIntermSymbol *node) +void TSymbolDefinitionCollectingTraverser::visitSymbol(glslang::TIntermSymbol* node) { object_to_be_defined_ = generateSymbolLabel(node); accesschain_mapping_[node] = object_to_be_defined_; @@ -281,12 +288,12 @@ void TSymbolDefinitionCollectingTraverser::visitSymbol(glslang::TIntermSymbol *n // Visits an aggregate node, traverses all of its children. bool TSymbolDefinitionCollectingTraverser::visitAggregate(glslang::TVisit, - glslang::TIntermAggregate *node) + glslang::TIntermAggregate* node) { // This aggreagate node might be a function definition node, in which case we need to // cache this node, so we can get the precise'ness information of the return value // of this function later. - StateSettingGuard current_function_definition_node_setting_guard( + StateSettingGuard current_function_definition_node_setting_guard( ¤t_function_definition_node_); if (node->getOp() == glslang::EOpFunction) { // This is function definition node, we need to cache this node so that we can @@ -294,7 +301,7 @@ bool TSymbolDefinitionCollectingTraverser::visitAggregate(glslang::TVisit, current_function_definition_node_setting_guard.setState(node); } // Traverse the items in the sequence. - glslang::TIntermSequence &seq = node->getSequence(); + glslang::TIntermSequence& seq = node->getSequence(); for (int i = 0; i < (int)seq.size(); ++i) { object_to_be_defined_.clear(); seq[i]->traverse(this); @@ -303,7 +310,7 @@ bool TSymbolDefinitionCollectingTraverser::visitAggregate(glslang::TVisit, } bool TSymbolDefinitionCollectingTraverser::visitBranch(glslang::TVisit, - glslang::TIntermBranch *node) + glslang::TIntermBranch* node) { if (node->getFlowOp() == glslang::EOpReturn && node->getExpression() && current_function_definition_node_ && @@ -319,7 +326,7 @@ bool TSymbolDefinitionCollectingTraverser::visitBranch(glslang::TVisit, // Visits an unary node. This might be an implicit assignment like i++, i--. etc. bool TSymbolDefinitionCollectingTraverser::visitUnary(glslang::TVisit /* visit */, - glslang::TIntermUnary *node) + glslang::TIntermUnary* node) { object_to_be_defined_.clear(); node->getOperand()->traverse(this); @@ -351,7 +358,7 @@ bool TSymbolDefinitionCollectingTraverser::visitUnary(glslang::TVisit /* visit * // Visits a binary node and updates the mapping from symbol IDs to the definition // nodes. Also collects the accesschains for the initial precise objects. bool TSymbolDefinitionCollectingTraverser::visitBinary(glslang::TVisit /* visit */, - glslang::TIntermBinary *node) + glslang::TIntermBinary* node) { // Traverses the left node to build the accesschain info for the object. object_to_be_defined_.clear(); @@ -408,7 +415,7 @@ bool TSymbolDefinitionCollectingTraverser::visitBinary(glslang::TVisit /* visit // object. We need to record the accesschain information of the current // node into its object id. unsigned struct_dereference_index = getStructIndexFromConstantUnion(node->getRight()); - object_to_be_defined_.push_back(StructAccessChainDelimiter); + object_to_be_defined_.push_back(OBJECT_ACCESSCHAIN_DELIMITER); object_to_be_defined_.append(std::to_string(struct_dereference_index)); accesschain_mapping_[node] = object_to_be_defined_; @@ -428,17 +435,18 @@ bool TSymbolDefinitionCollectingTraverser::visitBinary(glslang::TVisit /* visit // 2) a mapping from object nodes in the AST to the accesschains of these objects. // 3) a set of accesschains of precise objects. std::tuple -getSymbolToDefinitionMappingAndPreciseSymbolIDs(const glslang::TIntermediate &intermediate) +getSymbolToDefinitionMappingAndPreciseSymbolIDs(const glslang::TIntermediate& intermediate) { - auto result_tuple = std::make_tuple(NodeMapping(), AccessChainMapping(), ObjectAccesschainSet(), ReturnBranchNodeSet()); + auto result_tuple = std::make_tuple(NodeMapping(), AccessChainMapping(), ObjectAccesschainSet(), + ReturnBranchNodeSet()); - TIntermNode *root = intermediate.getTreeRoot(); + TIntermNode* root = intermediate.getTreeRoot(); if (root == 0) return result_tuple; - NodeMapping &symbol_definition_mapping = std::get<0>(result_tuple); - AccessChainMapping &accesschain_mapping = std::get<1>(result_tuple); - ObjectAccesschainSet &precise_objects = std::get<2>(result_tuple); - ReturnBranchNodeSet &precise_return_nodes = std::get<3>(result_tuple); + NodeMapping& symbol_definition_mapping = std::get<0>(result_tuple); + AccessChainMapping& accesschain_mapping = std::get<1>(result_tuple); + ObjectAccesschainSet& precise_objects = std::get<2>(result_tuple); + ReturnBranchNodeSet& precise_return_nodes = std::get<3>(result_tuple); // Traverses the AST and populate the results. TSymbolDefinitionCollectingTraverser collector(&symbol_definition_mapping, &accesschain_mapping, @@ -474,7 +482,7 @@ class TNoContractionAssigneeCheckingTraverser : public glslang::TIntermTraverser }; public: - TNoContractionAssigneeCheckingTraverser(const AccessChainMapping &accesschain_mapping) + TNoContractionAssigneeCheckingTraverser(const AccessChainMapping& accesschain_mapping) : TIntermTraverser(true, false, false), accesschain_mapping_(accesschain_mapping), precise_object_(nullptr) {} @@ -494,7 +502,7 @@ public: // precise object. std::tuple getPrecisenessAndRemainedAccessChain(glslang::TIntermOperator* node, - const ObjectAccessChain &precise_object) + const ObjectAccessChain& precise_object) { assert(isAssignOperation(node->getOp())); precise_object_ = &precise_object; @@ -570,23 +578,23 @@ public: } protected: - bool visitBinary(glslang::TVisit, glslang::TIntermBinary *node) override; - void visitSymbol(glslang::TIntermSymbol *node) override; + bool visitBinary(glslang::TVisit, glslang::TIntermBinary* node) override; + void visitSymbol(glslang::TIntermSymbol* node) override; // A map from object nodes to their accesschain string (used as object ID). - const AccessChainMapping &accesschain_mapping_; + const AccessChainMapping& accesschain_mapping_; // A given precise object, represented in it accesschain string. This // precise object is used to be compared with the assignee node to tell if // the assignee node is 'precise', contains 'precise' object or not // 'precise'. - const ObjectAccessChain *precise_object_; + const ObjectAccessChain* precise_object_; }; // Visit a binary node. If the node is an object node, it must be a dereference // node. In such cases, if the left node is 'precise', this node should also be // 'precise'. bool TNoContractionAssigneeCheckingTraverser::visitBinary(glslang::TVisit, - glslang::TIntermBinary *node) + glslang::TIntermBinary* node) { // Traverses the left so that we transfer the 'precise' from nesting object // to its nested object. @@ -602,7 +610,7 @@ bool TNoContractionAssigneeCheckingTraverser::visitBinary(glslang::TVisit, // this node should be marked as 'precise'. if (isPreciseObjectNode(node->getLeft())) { node->getWritableType().getQualifier().noContraction = true; - } else if (accesschain_mapping_.at(node) == *precise_object_){ + } else if (accesschain_mapping_.at(node) == *precise_object_) { node->getWritableType().getQualifier().noContraction = true; } } @@ -611,7 +619,7 @@ bool TNoContractionAssigneeCheckingTraverser::visitBinary(glslang::TVisit, // Visit a symbol node, if the symbol node ID (its accesschain string) matches // with the given precise object, this node should be 'precise'. -void TNoContractionAssigneeCheckingTraverser::visitSymbol(glslang::TIntermSymbol *node) +void TNoContractionAssigneeCheckingTraverser::visitSymbol(glslang::TIntermSymbol* node) { // A symbol node should always be an object node, and should have been added // to the map from object nodes to their accesschain strings. @@ -632,27 +640,27 @@ void TNoContractionAssigneeCheckingTraverser::visitSymbol(glslang::TIntermSymbol // class TNoContractionPropagator : public glslang::TIntermTraverser { public: - TNoContractionPropagator(ObjectAccesschainSet *precise_objects, - const AccessChainMapping &accesschain_mapping) + TNoContractionPropagator(ObjectAccesschainSet* precise_objects, + const AccessChainMapping& accesschain_mapping) : TIntermTraverser(true, false, false), remained_accesschain_(), - precise_objects_(*precise_objects), - accesschain_mapping_(accesschain_mapping), added_precise_object_ids_() {} + precise_objects_(*precise_objects), accesschain_mapping_(accesschain_mapping), + added_precise_object_ids_() {} // Propagates 'precise' in the right nodes of a given assignment node with // accesschain record from the assignee node to a 'precise' object it // contains. void - propagateNoContractionInOneExpression(glslang::TIntermTyped *defining_node, - const ObjectAccessChain &assignee_remained_accesschain) + propagateNoContractionInOneExpression(glslang::TIntermTyped* defining_node, + const ObjectAccessChain& assignee_remained_accesschain) { remained_accesschain_ = assignee_remained_accesschain; - if (glslang::TIntermBinary *BN = defining_node->getAsBinaryNode()) { + if (glslang::TIntermBinary* BN = defining_node->getAsBinaryNode()) { assert(isAssignOperation(BN->getOp())); BN->getRight()->traverse(this); if (isArithmeticOperation(BN->getOp())) { BN->getWritableType().getQualifier().noContraction = true; } - } else if (glslang::TIntermUnary *UN = defining_node->getAsUnaryNode()) { + } else if (glslang::TIntermUnary* UN = defining_node->getAsUnaryNode()) { assert(isAssignOperation(UN->getOp())); UN->getOperand()->traverse(this); if (isArithmeticOperation(UN->getOp())) { @@ -662,8 +670,7 @@ public: } // Propagates 'precise' in a given precise return node. - void - propagateNoContractionInReturnNode(glslang::TIntermBranch *return_node) + void propagateNoContractionInReturnNode(glslang::TIntermBranch* return_node) { remained_accesschain_ = ""; assert(return_node->getFlowOp() == glslang::EOpReturn && return_node->getExpression()); @@ -675,7 +682,7 @@ protected: // case we need to find the 'precise' or 'precise' containing object node // with the accesschain record. In other cases, just need to traverse all // the children nodes. - bool visitAggregate(glslang::TVisit, glslang::TIntermAggregate *node) override + bool visitAggregate(glslang::TVisit, glslang::TIntermAggregate* node) override { if (!remained_accesschain_.empty() && node->getOp() == glslang::EOpConstructStruct) { // This is a struct initializer node, and the remained @@ -689,7 +696,7 @@ protected: getFrontElement(remained_accesschain_); unsigned precise_accesschain_index = std::stoul(precise_accesschain_index_str); // Gets the node pointed by the accesschain index extracted before. - glslang::TIntermTyped *potential_precise_node = + glslang::TIntermTyped* potential_precise_node = node->getSequence()[precise_accesschain_index]->getAsTyped(); assert(potential_precise_node); // Pop the front accesschain index from the path, and visit the nested node. @@ -700,16 +707,9 @@ protected: &remained_accesschain_, next_level_accesschain); potential_precise_node->traverse(this); } - - } else { - // If this is not a struct constructor, just visit each nested node. - glslang::TIntermSequence &seq = node->getSequence(); - for (int i = 0; i < (int)seq.size(); ++i) { - seq[i]->traverse(this); - } + return false; } - - return false; + return true; } // Visit a binary node. A binary node can be an object node, e.g. a dereference node. @@ -718,7 +718,7 @@ protected: // an object node. If the binary node does not represent an object node, it should // go on to traverse its children nodes and if it is an arithmetic operation node, this // operation should be marked as 'noContraction'. - bool visitBinary(glslang::TVisit, glslang::TIntermBinary *node) override + bool visitBinary(glslang::TVisit, glslang::TIntermBinary* node) override { if (isDereferenceOperation(node->getOp())) { // This binary node is an object node. Need to update the precise @@ -728,8 +728,7 @@ protected: if (remained_accesschain_.empty()) { node->getWritableType().getQualifier().noContraction = true; } else { - new_precise_accesschain += - StructAccessChainDelimiter + remained_accesschain_; + new_precise_accesschain += OBJECT_ACCESSCHAIN_DELIMITER + remained_accesschain_; } // Cache the accesschain as added precise object, so we won't add the // same object to the worklist again. @@ -746,21 +745,18 @@ protected: node->getWritableType().getQualifier().noContraction = true; } // As this node is not an object node, need to traverse the children nodes. - node->getLeft()->traverse(this); - node->getRight()->traverse(this); - return false; + return true; } // Visits an unary node. An unary node can not be an object node. If the operation // is an arithmetic operation, need to mark this node as 'noContraction'. - bool visitUnary(glslang::TVisit /* visit */, glslang::TIntermUnary *node) override + bool visitUnary(glslang::TVisit /* visit */, glslang::TIntermUnary* node) override { // If this is an arithmetic operation, marks this with 'noContraction' if (isArithmeticOperation(node->getOp())) { node->getWritableType().getQualifier().noContraction = true; } - node->getOperand()->traverse(this); - return false; + return true; } // Visits a symbol node. A symbol node is always an object node. So we @@ -768,7 +764,7 @@ protected: // nodes to accesschains. As an object node, a symbol node can be either // 'precise' or containing 'precise' objects according to unused // accesschain information we have when we visit this node. - void visitSymbol(glslang::TIntermSymbol *node) override + void visitSymbol(glslang::TIntermSymbol* node) override { // Symbol nodes are object nodes and should always have an // accesschain collected before matches with it. @@ -781,7 +777,7 @@ protected: if (remained_accesschain_.empty()) { node->getWritableType().getQualifier().noContraction = true; } else { - new_precise_accesschain += StructAccessChainDelimiter + remained_accesschain_; + new_precise_accesschain += OBJECT_ACCESSCHAIN_DELIMITER + remained_accesschain_; } // Add the new 'precise' accesschain to the worklist and make sure we // don't visit it again. @@ -792,7 +788,7 @@ protected: } // A set of precise objects, represented as accesschains. - ObjectAccesschainSet &precise_objects_; + ObjectAccesschainSet& precise_objects_; // Visited symbol nodes, should not revisit these nodes. ObjectAccesschainSet added_precise_object_ids_; // The left node of an assignment operation might be an parent of 'precise' objects. @@ -802,15 +798,13 @@ protected: // tell us how to find the corresponding 'precise' node in the right. ObjectAccessChain remained_accesschain_; // A map from node pointers to their accesschains. - const AccessChainMapping &accesschain_mapping_; + const AccessChainMapping& accesschain_mapping_; }; - -#undef StructAccessChainDelimiter } namespace glslang { -void PropagateNoContraction(const glslang::TIntermediate &intermediate) +void PropagateNoContraction(const glslang::TIntermediate& intermediate) { // First, traverses the AST, records symbols with their defining operations // and collects the initial set of precise symbols (symbol nodes that marked @@ -821,18 +815,17 @@ void PropagateNoContraction(const glslang::TIntermediate &intermediate) // The mapping of symbol node IDs to their defining nodes. This enables us // to get the defining node directly from a given symbol ID without // traversing the tree again. - NodeMapping &symbol_definition_mapping = std::get<0>(mappings_and_precise_objects); + NodeMapping& symbol_definition_mapping = std::get<0>(mappings_and_precise_objects); // The mapping of object nodes to their accesschains recorded. - AccessChainMapping &accesschain_mapping = std::get<1>(mappings_and_precise_objects); + AccessChainMapping& accesschain_mapping = std::get<1>(mappings_and_precise_objects); // The initial set of 'precise' objects which are represented as the // accesschain toward them. - ObjectAccesschainSet &precise_object_accesschains = - std::get<2>(mappings_and_precise_objects); + ObjectAccesschainSet& precise_object_accesschains = std::get<2>(mappings_and_precise_objects); // The set of 'precise' return nodes. - ReturnBranchNodeSet &precise_return_nodes = std::get<3>(mappings_and_precise_objects); + ReturnBranchNodeSet& precise_return_nodes = std::get<3>(mappings_and_precise_objects); // Second, uses the initial set of precise objects as a worklist, pops an // accesschain, extract the symbol ID from it. Then: @@ -845,10 +838,9 @@ void PropagateNoContraction(const glslang::TIntermediate &intermediate) // 'precise' accesschain worklist with new found object nodes. // Repeat above steps until the worklist is empty. TNoContractionAssigneeCheckingTraverser checker(accesschain_mapping); - TNoContractionPropagator propagator(&precise_object_accesschains, - accesschain_mapping); + TNoContractionPropagator propagator(&precise_object_accesschains, accesschain_mapping); - // We have to initial precise worklist to handle: + // We have two initial precise worklists to handle: // 1) precise return nodes // 2) precise object accesschains // We should process the precise return nodes first and the involved @@ -877,12 +869,12 @@ void PropagateNoContraction(const glslang::TIntermediate &intermediate) // objects, and mark arithmetic operations as 'noContraction'. for (NodeMapping::iterator defining_node_iter = range.first; defining_node_iter != range.second; defining_node_iter++) { - TIntermOperator *defining_node = defining_node_iter->second; + TIntermOperator* defining_node = defining_node_iter->second; // Check the assignee node. auto checker_result = checker.getPrecisenessAndRemainedAccessChain( defining_node, precise_object_accesschain); - bool &contain_precise = std::get<0>(checker_result); - ObjectAccessChain &remained_accesschain = std::get<1>(checker_result); + bool& contain_precise = std::get<0>(checker_result); + ObjectAccessChain& remained_accesschain = std::get<1>(checker_result); // If the assignee node is 'precise' or contains 'precise', propagate the // 'precise' to the right. Otherwise just skip this assignment node. if (contain_precise) { From 0c96db5a4ca3b50655c7500a2e44c324da56f613 Mon Sep 17 00:00:00 2001 From: qining Date: Fri, 6 May 2016 18:56:33 -0400 Subject: [PATCH 071/140] add a test for matrix, fix a variable name --- Test/baseResults/precise.tesc.out | 52 ++++++++++++++++++- Test/precise.tesc | 7 +++ .../propagateNoContraction.cpp | 15 +++--- 3 files changed, 65 insertions(+), 9 deletions(-) diff --git a/Test/baseResults/precise.tesc.out b/Test/baseResults/precise.tesc.out index 4976b9cb..a6b10adf 100644 --- a/Test/baseResults/precise.tesc.out +++ b/Test/baseResults/precise.tesc.out @@ -357,8 +357,32 @@ vertices = -1 0:99 subtract (temp float) 0:99 'a' (temp float) 0:99 'b' (in float) -0:102 Function Definition: main( (global void) +0:102 Function Definition: matrix(mf23;mf32; (global 3X3 matrix of float) 0:102 Function Parameters: +0:102 'a' (in 2X3 matrix of float) +0:102 'b' (in 3X2 matrix of float) +0:103 Sequence +0:103 Sequence +0:103 move second child to first child (temp 2X3 matrix of float) +0:103 'c' (noContraction temp 2X3 matrix of float) +0:103 Constant: +0:103 1.000000 +0:103 2.000000 +0:103 3.000000 +0:103 4.000000 +0:103 5.000000 +0:103 6.000000 +0:105 move second child to first child (temp 3X3 matrix of float) +0:105 'result' (noContraction temp 3X3 matrix of float) +0:105 matrix-multiply (noContraction temp 3X3 matrix of float) +0:105 add (noContraction temp 2X3 matrix of float) +0:105 'a' (noContraction in 2X3 matrix of float) +0:105 'c' (noContraction temp 2X3 matrix of float) +0:105 'b' (noContraction in 3X2 matrix of float) +0:106 Branch: Return with expression +0:106 'result' (noContraction temp 3X3 matrix of float) +0:109 Function Definition: main( (global void) +0:109 Function Parameters: 0:? Linker Objects @@ -722,7 +746,31 @@ vertices = -1 0:99 subtract (temp float) 0:99 'a' (temp float) 0:99 'b' (in float) -0:102 Function Definition: main( (global void) +0:102 Function Definition: matrix(mf23;mf32; (global 3X3 matrix of float) 0:102 Function Parameters: +0:102 'a' (in 2X3 matrix of float) +0:102 'b' (in 3X2 matrix of float) +0:103 Sequence +0:103 Sequence +0:103 move second child to first child (temp 2X3 matrix of float) +0:103 'c' (noContraction temp 2X3 matrix of float) +0:103 Constant: +0:103 1.000000 +0:103 2.000000 +0:103 3.000000 +0:103 4.000000 +0:103 5.000000 +0:103 6.000000 +0:105 move second child to first child (temp 3X3 matrix of float) +0:105 'result' (noContraction temp 3X3 matrix of float) +0:105 matrix-multiply (noContraction temp 3X3 matrix of float) +0:105 add (noContraction temp 2X3 matrix of float) +0:105 'a' (noContraction in 2X3 matrix of float) +0:105 'c' (noContraction temp 2X3 matrix of float) +0:105 'b' (noContraction in 3X2 matrix of float) +0:106 Branch: Return with expression +0:106 'result' (noContraction temp 3X3 matrix of float) +0:109 Function Definition: main( (global void) +0:109 Function Parameters: 0:? Linker Objects diff --git a/Test/precise.tesc b/Test/precise.tesc index 71a71e48..b4ac5795 100644 --- a/Test/precise.tesc +++ b/Test/precise.tesc @@ -99,4 +99,11 @@ float precise_func_parameter(float b, precise out float c) { return a - b; // Not noContraction } +mat3 matrix (mat2x3 a, mat3x2 b) { + mat2x3 c = mat2x3(1.0, 2.0, 3.0, 4.0, 5.0, 6.0); + precise mat3 result; + result = (a + c) * b; // should be noContraction + return result; +} + void main(){} diff --git a/glslang/MachineIndependent/propagateNoContraction.cpp b/glslang/MachineIndependent/propagateNoContraction.cpp index f4b88d16..be53ea31 100644 --- a/glslang/MachineIndependent/propagateNoContraction.cpp +++ b/glslang/MachineIndependent/propagateNoContraction.cpp @@ -61,7 +61,7 @@ using ObjectAccessChain = std::string; // The delimiter used in the ObjectAccessChain string to separate symbol ID and // different level of struct indices. -const char OBJECT_ACCESSCHAIN_DELIMITER = '/'; +const char ObjectAccesschainDelimiter = '/'; // Mapping from Symbol IDs of symbol nodes, to their defining operation // nodes. @@ -169,6 +169,7 @@ bool isArithmeticOperation(glslang::TOperator op) case glslang::EOpVectorTimesMatrix: case glslang::EOpMatrixTimesVector: case glslang::EOpMatrixTimesScalar: + case glslang::EOpMatrixTimesMatrix: case glslang::EOpDot: @@ -207,14 +208,14 @@ private: // A helper function to get the front element from a given ObjectAccessChain ObjectAccessChain getFrontElement(const ObjectAccessChain& chain) { - size_t pos_delimiter = chain.find(OBJECT_ACCESSCHAIN_DELIMITER); + size_t pos_delimiter = chain.find(ObjectAccesschainDelimiter); return pos_delimiter == std::string::npos ? chain : chain.substr(0, pos_delimiter); } // A helper function to get the accesschain starting from the second element. ObjectAccessChain subAccessChainFromSecondElement(const ObjectAccessChain& chain) { - size_t pos_delimiter = chain.find(OBJECT_ACCESSCHAIN_DELIMITER); + size_t pos_delimiter = chain.find(ObjectAccesschainDelimiter); return pos_delimiter == std::string::npos ? "" : chain.substr(pos_delimiter + 1); } @@ -224,7 +225,7 @@ ObjectAccessChain getSubAccessChainAfterPrefix(const ObjectAccessChain& chain, { size_t pos = chain.find(prefix); if (pos != 0) return chain; - return chain.substr(prefix.length() + sizeof(OBJECT_ACCESSCHAIN_DELIMITER)); + return chain.substr(prefix.length() + sizeof(ObjectAccesschainDelimiter)); } // @@ -415,7 +416,7 @@ bool TSymbolDefinitionCollectingTraverser::visitBinary(glslang::TVisit /* visit // object. We need to record the accesschain information of the current // node into its object id. unsigned struct_dereference_index = getStructIndexFromConstantUnion(node->getRight()); - object_to_be_defined_.push_back(OBJECT_ACCESSCHAIN_DELIMITER); + object_to_be_defined_.push_back(ObjectAccesschainDelimiter); object_to_be_defined_.append(std::to_string(struct_dereference_index)); accesschain_mapping_[node] = object_to_be_defined_; @@ -728,7 +729,7 @@ protected: if (remained_accesschain_.empty()) { node->getWritableType().getQualifier().noContraction = true; } else { - new_precise_accesschain += OBJECT_ACCESSCHAIN_DELIMITER + remained_accesschain_; + new_precise_accesschain += ObjectAccesschainDelimiter + remained_accesschain_; } // Cache the accesschain as added precise object, so we won't add the // same object to the worklist again. @@ -777,7 +778,7 @@ protected: if (remained_accesschain_.empty()) { node->getWritableType().getQualifier().noContraction = true; } else { - new_precise_accesschain += OBJECT_ACCESSCHAIN_DELIMITER + remained_accesschain_; + new_precise_accesschain += ObjectAccesschainDelimiter + remained_accesschain_; } // Add the new 'precise' accesschain to the worklist and make sure we // don't visit it again. From 34d257184ad9d96b6e1dfe038b8baef3ff6e31bd Mon Sep 17 00:00:00 2001 From: qining Date: Fri, 6 May 2016 20:00:44 -0400 Subject: [PATCH 072/140] simplified the symbol definition collector code, add assert() --- .../propagateNoContraction.cpp | 56 +++++-------------- 1 file changed, 13 insertions(+), 43 deletions(-) diff --git a/glslang/MachineIndependent/propagateNoContraction.cpp b/glslang/MachineIndependent/propagateNoContraction.cpp index be53ea31..ae9cec0e 100644 --- a/glslang/MachineIndependent/propagateNoContraction.cpp +++ b/glslang/MachineIndependent/propagateNoContraction.cpp @@ -333,9 +333,7 @@ bool TSymbolDefinitionCollectingTraverser::visitUnary(glslang::TVisit /* visit * node->getOperand()->traverse(this); if (isAssignOperation(node->getOp())) { // We should always be able to get an accesschain of the operand node. - // But we have some tests in which it is intented to have invalid operand - // nodes, so just return for now. - if (object_to_be_defined_.empty()) return false; + assert(!object_to_be_defined_.empty()); // If the operand node object is 'precise', we collect its accesschain // for the initial set of 'precise' objects. @@ -367,9 +365,7 @@ bool TSymbolDefinitionCollectingTraverser::visitBinary(glslang::TVisit /* visit if (isAssignOperation(node->getOp())) { // We should always be able to get an accesschain for the left node. - // But we have some tests in which it is intented to have invalid left - // nodes, so just return false in such cases for now. - if (object_to_be_defined_.empty()) return false; + assert(!object_to_be_defined_.empty()); // If the left node object is 'precise', it is an initial precise object // specified in the shader source. Adds it to the initial worklist to @@ -391,44 +387,26 @@ bool TSymbolDefinitionCollectingTraverser::visitBinary(glslang::TVisit /* visit object_to_be_defined_.clear(); node->getRight()->traverse(this); - return false; } else if (isDereferenceOperation(node->getOp())) { - // If the left node is 'precise' object node, this node should also - // be 'precise' object node, and all the members of this node too. There - // is no need to append accesschain information into the object id. - if (isPreciseObjectNode(node->getLeft())) { - node->getWritableType().getQualifier().noContraction = true; - accesschain_mapping_[node] = object_to_be_defined_; - return false; + // The left node (parent node) is a struct type object. We need to + // record the accesschain information of the current node into its + // object id. + if (node->getOp() == glslang::EOpIndexDirectStruct) { + unsigned struct_dereference_index = getStructIndexFromConstantUnion(node->getRight()); + object_to_be_defined_.push_back(ObjectAccesschainDelimiter); + object_to_be_defined_.append(std::to_string(struct_dereference_index)); } - - // If the opcode is not EOpIndexDirectStruct, the left node is not be a - // struct type object, hence there is no need to append dereference - // indices. For other composite type objects, the precise'ness of - // members should always matches with the 'precise'ness of the - // composite type object. - if (node->getOp() != glslang::EOpIndexDirectStruct) { - accesschain_mapping_[node] = object_to_be_defined_; - return false; - } - - // The left node (parent node) is not 'precise' and it is a struct type - // object. We need to record the accesschain information of the current - // node into its object id. - unsigned struct_dereference_index = getStructIndexFromConstantUnion(node->getRight()); - object_to_be_defined_.push_back(ObjectAccesschainDelimiter); - object_to_be_defined_.append(std::to_string(struct_dereference_index)); accesschain_mapping_[node] = object_to_be_defined_; // For dereference node, there is no need to traverse the right child // node as the right node should always be an integer type object. - return false; + } else { // For other binary nodes, still traverse the right node. object_to_be_defined_.clear(); node->getRight()->traverse(this); - return false; } + return false; } // Traverses the AST and returns a tuple of three members: @@ -511,11 +489,7 @@ public: if (glslang::TIntermBinary* BN = node->getAsBinaryNode()) { // This is a binary assignment node, we need to check the // precise'ness of the left node. - if (!accesschain_mapping_.count(BN->getLeft())) { - // If the left node is not an object node, it can not be - // 'precise'. - return make_tuple(false, ObjectAccessChain()); - } + assert(accesschain_mapping_.count(BN->getLeft())); // The left node (assignee node) is an object node, traverse the // node to let the 'precise' of nesting objects being transfered to // nested objects. @@ -534,11 +508,7 @@ public: // This is a unary assignment node, we need to check the // precise'ness of the operand node. For unary assignment node, the // operand node should always be an object node. - if (!accesschain_mapping_.count(UN->getOperand())) { - // If the operand node is not an object node, it can not be - // 'precise'. - return make_tuple(false, ObjectAccessChain()); - } + assert(accesschain_mapping_.count(UN->getOperand())); // Traverse the operand node to let the 'precise' being propagated // from lower nodes to upper nodes. UN->getOperand()->traverse(this); From 5bec2b5619df65bba3a21412fb386bbdd505da80 Mon Sep 17 00:00:00 2001 From: qining Date: Fri, 6 May 2016 21:52:28 -0400 Subject: [PATCH 073/140] integer type operation should not be noContraction --- Test/baseResults/precise.tesc.out | 208 +++++++++--------- .../baseResults/precise_struct_block.vert.out | 8 +- Test/precise.tesc | 20 +- Test/precise_struct_block.vert | 2 +- .../propagateNoContraction.cpp | 2 +- 5 files changed, 116 insertions(+), 124 deletions(-) diff --git a/Test/baseResults/precise.tesc.out b/Test/baseResults/precise.tesc.out index a6b10adf..962a3c98 100644 --- a/Test/baseResults/precise.tesc.out +++ b/Test/baseResults/precise.tesc.out @@ -55,46 +55,45 @@ vertices = -1 0:16 Constant: 0:16 5.000000 0:17 Sequence -0:17 move second child to first child (temp int) -0:17 'a' (noContraction temp int) +0:17 move second child to first child (temp float) +0:17 'a' (noContraction temp float) 0:17 Constant: -0:17 10 (const int) +0:17 10.000000 0:18 Sequence -0:18 move second child to first child (temp int) -0:18 'b' (noContraction temp int) +0:18 move second child to first child (temp float) +0:18 'b' (noContraction temp float) 0:18 Constant: -0:18 20 (const int) +0:18 20.000000 0:19 move second child to first child (temp float) 0:19 'result' (noContraction temp float) -0:19 Convert int to float (temp float) -0:19 move second child to first child (temp int) -0:19 'a' (noContraction temp int) -0:19 add (noContraction temp int) -0:19 'b' (noContraction temp int) -0:19 Constant: -0:19 4 (const int) +0:19 move second child to first child (temp float) +0:19 'a' (noContraction temp float) +0:19 add (noContraction temp float) +0:19 'b' (noContraction temp float) +0:19 Constant: +0:19 4.000000 0:22 Function Definition: convert( (global void) 0:22 Function Parameters: 0:? Sequence 0:24 Sequence -0:24 move second child to first child (temp int) -0:24 'a' (noContraction temp int) +0:24 move second child to first child (temp float) +0:24 'a' (noContraction temp float) 0:24 Constant: -0:24 10 (const int) +0:24 10.000000 0:25 Sequence -0:25 move second child to first child (temp int) -0:25 'b' (noContraction temp int) +0:25 move second child to first child (temp float) +0:25 'b' (noContraction temp float) 0:25 Constant: -0:25 20 (const int) -0:26 move second child to first child (temp int) -0:26 'b' (noContraction temp int) -0:26 add (noContraction temp int) -0:26 'a' (noContraction temp int) -0:26 'b' (noContraction temp int) -0:27 move second child to first child (temp float) -0:27 'result' (noContraction temp float) -0:27 Convert int to float (temp float) -0:27 'b' (noContraction temp int) +0:25 20.000000 +0:26 move second child to first child (temp float) +0:26 'b' (noContraction temp float) +0:26 add (noContraction temp float) +0:26 'a' (noContraction temp float) +0:26 'b' (noContraction temp float) +0:27 move second child to first child (temp double) +0:27 'result' (noContraction temp double) +0:27 Convert float to double (temp double) +0:27 'b' (noContraction temp float) 0:30 Function Definition: loop_for( (global float) 0:30 Function Parameters: 0:31 Sequence @@ -168,12 +167,7 @@ vertices = -1 0:42 'r2' (noContraction temp float) 0:45 Function Definition: loop_array( (global void) 0:45 Function Parameters: -0:46 Sequence -0:46 Sequence -0:46 move second child to first child (temp int) -0:46 'result' (noContraction temp int) -0:46 Constant: -0:46 5 (const int) +0:? Sequence 0:48 Sequence 0:48 move second child to first child (temp int) 0:48 'x' (noContraction temp int) @@ -184,11 +178,13 @@ vertices = -1 0:49 'y' (noContraction temp int) 0:49 Constant: 0:49 33 (const int) -0:52 add second child into first child (noContraction temp int) -0:52 'result' (noContraction temp int) -0:52 add (noContraction temp int) -0:52 'x' (noContraction temp int) -0:52 'y' (noContraction temp int) +0:52 add second child into first child (noContraction temp float) +0:52 'result' (noContraction temp float) +0:52 add (noContraction temp float) +0:52 Convert int to float (temp float) +0:52 'x' (noContraction temp int) +0:52 Convert int to float (temp float) +0:52 'y' (noContraction temp int) 0:54 Sequence 0:54 Sequence 0:54 move second child to first child (temp int) @@ -203,23 +199,23 @@ vertices = -1 0:54 3 (const int) 0:54 Loop Body 0:56 Sequence -0:56 add second child into first child (noContraction temp int) -0:56 'result' (noContraction temp int) -0:56 add (noContraction temp int) -0:56 indirect index (noContraction temp int) -0:56 'a0' (temp 3-element array of int) +0:56 add second child into first child (noContraction temp float) +0:56 'result' (noContraction temp float) +0:56 add (noContraction temp float) +0:56 indirect index (noContraction temp float) +0:56 'a0' (temp 3-element array of float) 0:56 'i' (temp int) 0:56 Constant: -0:56 2 (const int) -0:58 move second child to first child (temp int) -0:58 indirect index (noContraction temp int) -0:58 'a0' (noContraction temp 3-element array of int) +0:56 2.000000 +0:58 move second child to first child (temp float) +0:58 indirect index (noContraction temp float) +0:58 'a0' (noContraction temp 3-element array of float) 0:58 'i' (temp int) -0:58 subtract (noContraction temp int) +0:58 subtract (noContraction temp float) 0:58 Constant: -0:58 3 (const int) -0:58 Post-Increment (noContraction temp int) -0:58 'result' (noContraction temp int) +0:58 3.000000 +0:58 Post-Increment (noContraction temp float) +0:58 'result' (noContraction temp float) 0:54 Loop Terminal Expression 0:54 Pre-Increment (temp int) 0:54 'i' (temp int) @@ -259,8 +255,8 @@ vertices = -1 0:69 move second child to first child (temp float) 0:69 'result' (noContraction temp float) 0:69 Convert int to float (temp float) -0:69 add (noContraction temp int) -0:69 add (noContraction temp int) +0:69 add (temp int) +0:69 add (temp int) 0:69 'a' (noContraction temp int) 0:69 'b' (noContraction temp int) 0:69 Constant: @@ -444,46 +440,45 @@ vertices = -1 0:16 Constant: 0:16 5.000000 0:17 Sequence -0:17 move second child to first child (temp int) -0:17 'a' (noContraction temp int) +0:17 move second child to first child (temp float) +0:17 'a' (noContraction temp float) 0:17 Constant: -0:17 10 (const int) +0:17 10.000000 0:18 Sequence -0:18 move second child to first child (temp int) -0:18 'b' (noContraction temp int) +0:18 move second child to first child (temp float) +0:18 'b' (noContraction temp float) 0:18 Constant: -0:18 20 (const int) +0:18 20.000000 0:19 move second child to first child (temp float) 0:19 'result' (noContraction temp float) -0:19 Convert int to float (temp float) -0:19 move second child to first child (temp int) -0:19 'a' (noContraction temp int) -0:19 add (noContraction temp int) -0:19 'b' (noContraction temp int) -0:19 Constant: -0:19 4 (const int) +0:19 move second child to first child (temp float) +0:19 'a' (noContraction temp float) +0:19 add (noContraction temp float) +0:19 'b' (noContraction temp float) +0:19 Constant: +0:19 4.000000 0:22 Function Definition: convert( (global void) 0:22 Function Parameters: 0:? Sequence 0:24 Sequence -0:24 move second child to first child (temp int) -0:24 'a' (noContraction temp int) +0:24 move second child to first child (temp float) +0:24 'a' (noContraction temp float) 0:24 Constant: -0:24 10 (const int) +0:24 10.000000 0:25 Sequence -0:25 move second child to first child (temp int) -0:25 'b' (noContraction temp int) +0:25 move second child to first child (temp float) +0:25 'b' (noContraction temp float) 0:25 Constant: -0:25 20 (const int) -0:26 move second child to first child (temp int) -0:26 'b' (noContraction temp int) -0:26 add (noContraction temp int) -0:26 'a' (noContraction temp int) -0:26 'b' (noContraction temp int) -0:27 move second child to first child (temp float) -0:27 'result' (noContraction temp float) -0:27 Convert int to float (temp float) -0:27 'b' (noContraction temp int) +0:25 20.000000 +0:26 move second child to first child (temp float) +0:26 'b' (noContraction temp float) +0:26 add (noContraction temp float) +0:26 'a' (noContraction temp float) +0:26 'b' (noContraction temp float) +0:27 move second child to first child (temp double) +0:27 'result' (noContraction temp double) +0:27 Convert float to double (temp double) +0:27 'b' (noContraction temp float) 0:30 Function Definition: loop_for( (global float) 0:30 Function Parameters: 0:31 Sequence @@ -557,12 +552,7 @@ vertices = -1 0:42 'r2' (noContraction temp float) 0:45 Function Definition: loop_array( (global void) 0:45 Function Parameters: -0:46 Sequence -0:46 Sequence -0:46 move second child to first child (temp int) -0:46 'result' (noContraction temp int) -0:46 Constant: -0:46 5 (const int) +0:? Sequence 0:48 Sequence 0:48 move second child to first child (temp int) 0:48 'x' (noContraction temp int) @@ -573,11 +563,13 @@ vertices = -1 0:49 'y' (noContraction temp int) 0:49 Constant: 0:49 33 (const int) -0:52 add second child into first child (noContraction temp int) -0:52 'result' (noContraction temp int) -0:52 add (noContraction temp int) -0:52 'x' (noContraction temp int) -0:52 'y' (noContraction temp int) +0:52 add second child into first child (noContraction temp float) +0:52 'result' (noContraction temp float) +0:52 add (noContraction temp float) +0:52 Convert int to float (temp float) +0:52 'x' (noContraction temp int) +0:52 Convert int to float (temp float) +0:52 'y' (noContraction temp int) 0:54 Sequence 0:54 Sequence 0:54 move second child to first child (temp int) @@ -592,23 +584,23 @@ vertices = -1 0:54 3 (const int) 0:54 Loop Body 0:56 Sequence -0:56 add second child into first child (noContraction temp int) -0:56 'result' (noContraction temp int) -0:56 add (noContraction temp int) -0:56 indirect index (noContraction temp int) -0:56 'a0' (temp 3-element array of int) +0:56 add second child into first child (noContraction temp float) +0:56 'result' (noContraction temp float) +0:56 add (noContraction temp float) +0:56 indirect index (noContraction temp float) +0:56 'a0' (temp 3-element array of float) 0:56 'i' (temp int) 0:56 Constant: -0:56 2 (const int) -0:58 move second child to first child (temp int) -0:58 indirect index (noContraction temp int) -0:58 'a0' (noContraction temp 3-element array of int) +0:56 2.000000 +0:58 move second child to first child (temp float) +0:58 indirect index (noContraction temp float) +0:58 'a0' (noContraction temp 3-element array of float) 0:58 'i' (temp int) -0:58 subtract (noContraction temp int) +0:58 subtract (noContraction temp float) 0:58 Constant: -0:58 3 (const int) -0:58 Post-Increment (noContraction temp int) -0:58 'result' (noContraction temp int) +0:58 3.000000 +0:58 Post-Increment (noContraction temp float) +0:58 'result' (noContraction temp float) 0:54 Loop Terminal Expression 0:54 Pre-Increment (temp int) 0:54 'i' (temp int) @@ -648,8 +640,8 @@ vertices = -1 0:69 move second child to first child (temp float) 0:69 'result' (noContraction temp float) 0:69 Convert int to float (temp float) -0:69 add (noContraction temp int) -0:69 add (noContraction temp int) +0:69 add (temp int) +0:69 add (temp int) 0:69 'a' (noContraction temp int) 0:69 'b' (noContraction temp int) 0:69 Constant: diff --git a/Test/baseResults/precise_struct_block.vert.out b/Test/baseResults/precise_struct_block.vert.out index 7d783e55..9d726d65 100644 --- a/Test/baseResults/precise_struct_block.vert.out +++ b/Test/baseResults/precise_struct_block.vert.out @@ -325,8 +325,8 @@ Shader version: 450 0:63 0 (const int) 0:63 'k' (temp int) 0:63 Convert int to float (temp float) -0:63 add (noContraction temp int) -0:63 component-wise multiply (noContraction temp int) +0:63 add (temp int) +0:63 component-wise multiply (temp int) 0:63 'i' (noContraction temp int) 0:63 'j' (noContraction temp int) 0:63 'k' (noContraction temp int) @@ -848,8 +848,8 @@ Shader version: 450 0:63 0 (const int) 0:63 'k' (temp int) 0:63 Convert int to float (temp float) -0:63 add (noContraction temp int) -0:63 component-wise multiply (noContraction temp int) +0:63 add (temp int) +0:63 component-wise multiply (temp int) 0:63 'i' (noContraction temp int) 0:63 'j' (noContraction temp int) 0:63 'k' (noContraction temp int) diff --git a/Test/precise.tesc b/Test/precise.tesc index b4ac5795..c541540c 100644 --- a/Test/precise.tesc +++ b/Test/precise.tesc @@ -14,17 +14,17 @@ float minimal() { void continuous_assignment() { precise float result = 5.0; - int a = 10; - int b = 20; + float a = 10.0; + float b = 20.0; result = a = b + 4; // b + 4 should be 'noContraction'. } void convert() { - precise float result; - int a = 10; - int b = 20; + precise double result; + float a = 10.0; + float b = 20.0; b = a + b; // a + b should be 'noContraction'. - result = float(b); // convert operation should not be 'noContraction'. + result = double(b); // convert operation should not be 'noContraction'. } float loop_for() { @@ -43,13 +43,13 @@ float loop_for() { } void loop_array(void) { - precise int result = 5; + precise float result; int x = 22; int y = 33; - int a0[3]; - result += x + y; // x + y should be 'noContraction' also result + rvalue. + float a0[3]; + result += float(x) + float(y); // x + y should be 'noContraction' also result + rvalue. for (int i = 0; i < 3; ++i) { // a's dereference + 2 should be 'noContraction'. @@ -66,7 +66,7 @@ void loop_while() { while (result < 10) { result += 3.12 + b; // result + 3.12 should be 'noContraction'. } - result = a + b + 5; // b + 5 should be 'noCtraction' and also a + rvalue. + result = a + b + 5; // b + 5 should not be 'noCtraction' because all operands are integers. result = 11.1; } diff --git a/Test/precise_struct_block.vert b/Test/precise_struct_block.vert index a050ccd0..279b4b09 100644 --- a/Test/precise_struct_block.vert +++ b/Test/precise_struct_block.vert @@ -60,7 +60,7 @@ float complex_array_struct() { for(int j=0; j<6; j++) { for(int k = 0; k<3; k++) { - t3[i].t2.t1c[j].t1_array[k] = i * j + k; // NoContraction + t3[i].t2.t1c[j].t1_array[k] = i * j + k; // Not NoContraction because all operands are integers } t3[i].t2.t1c[j].t1_scalar = j * 2.0 / i; // Not NoContraction } diff --git a/glslang/MachineIndependent/propagateNoContraction.cpp b/glslang/MachineIndependent/propagateNoContraction.cpp index ae9cec0e..da8dfaf8 100644 --- a/glslang/MachineIndependent/propagateNoContraction.cpp +++ b/glslang/MachineIndependent/propagateNoContraction.cpp @@ -712,7 +712,7 @@ protected: return false; } // If this is an arithmetic operation, marks this node as 'noContraction'. - if (isArithmeticOperation(node->getOp())) { + if (isArithmeticOperation(node->getOp()) && node->getBasicType() != glslang::EbtInt) { node->getWritableType().getQualifier().noContraction = true; } // As this node is not an object node, need to traverse the children nodes. From 9c56d84b73e785d56fcd5cd0e776991ec296ce59 Mon Sep 17 00:00:00 2001 From: scygan Date: Mon, 9 May 2016 17:51:25 +0200 Subject: [PATCH 074/140] Use proper precision qualifiers for bitfield build-in functions on ES This change causes ES shaders to precision qualifiers for build-in functions as defined in ESSL spec. It especially mattersfor functions that are defined as highp or taking a highp. Fixes vulkanCTS dEQP-VK.glsl.builtin.function.integer.bitfieldreverse.*, where bitfieldReverse() retval was wrongly marked as RelaxedPrecision. Note: floatBitsToInt/floatBitsToUInt precision is also broken, but in different way - so it is not addressed here. --- Test/baseResults/310.vert.out | 16 +-- Test/baseResults/spv.intOps.vert.out | 4 + glslang/MachineIndependent/Initialize.cpp | 120 ++++++++++++++++------ 3 files changed, 102 insertions(+), 38 deletions(-) diff --git a/Test/baseResults/310.vert.out b/Test/baseResults/310.vert.out index c32f5d8e..9ce13f44 100644 --- a/Test/baseResults/310.vert.out +++ b/Test/baseResults/310.vert.out @@ -179,11 +179,11 @@ ERROR: node is still EOpNull! 0:31 'u4' (temp highp 4-component vector of uint) 0:32 move second child to first child (temp highp int) 0:32 'i1' (temp highp int) -0:32 bitCount (global highp int) +0:32 bitCount (global lowp int) 0:32 'i1' (temp highp int) 0:33 move second child to first child (temp highp 3-component vector of int) 0:33 'i3' (temp highp 3-component vector of int) -0:33 bitCount (global highp 3-component vector of int) +0:33 bitCount (global lowp 3-component vector of int) 0:33 'u3' (temp highp 3-component vector of uint) 0:34 move second child to first child (temp highp 2-component vector of int) 0:34 'i2' (temp highp 2-component vector of int) @@ -195,11 +195,11 @@ ERROR: node is still EOpNull! 0:35 'u4' (temp highp 4-component vector of uint) 0:36 move second child to first child (temp highp int) 0:36 'i1' (temp highp int) -0:36 findMSB (global highp int) +0:36 findMSB (global lowp int) 0:36 'i1' (temp highp int) 0:37 move second child to first child (temp highp 2-component vector of int) 0:37 'i2' (temp highp 2-component vector of int) -0:37 findMSB (global highp 2-component vector of int) +0:37 findMSB (global lowp 2-component vector of int) 0:37 'u2' (temp highp 2-component vector of uint) 0:40 move second child to first child (temp highp 3-component vector of float) 0:40 'v3' (temp highp 3-component vector of float) @@ -1110,11 +1110,11 @@ ERROR: node is still EOpNull! 0:31 'u4' (temp highp 4-component vector of uint) 0:32 move second child to first child (temp highp int) 0:32 'i1' (temp highp int) -0:32 bitCount (global highp int) +0:32 bitCount (global lowp int) 0:32 'i1' (temp highp int) 0:33 move second child to first child (temp highp 3-component vector of int) 0:33 'i3' (temp highp 3-component vector of int) -0:33 bitCount (global highp 3-component vector of int) +0:33 bitCount (global lowp 3-component vector of int) 0:33 'u3' (temp highp 3-component vector of uint) 0:34 move second child to first child (temp highp 2-component vector of int) 0:34 'i2' (temp highp 2-component vector of int) @@ -1126,11 +1126,11 @@ ERROR: node is still EOpNull! 0:35 'u4' (temp highp 4-component vector of uint) 0:36 move second child to first child (temp highp int) 0:36 'i1' (temp highp int) -0:36 findMSB (global highp int) +0:36 findMSB (global lowp int) 0:36 'i1' (temp highp int) 0:37 move second child to first child (temp highp 2-component vector of int) 0:37 'i2' (temp highp 2-component vector of int) -0:37 findMSB (global highp 2-component vector of int) +0:37 findMSB (global lowp 2-component vector of int) 0:37 'u2' (temp highp 2-component vector of uint) 0:40 move second child to first child (temp highp 3-component vector of float) 0:40 'v3' (temp highp 3-component vector of float) diff --git a/Test/baseResults/spv.intOps.vert.out b/Test/baseResults/spv.intOps.vert.out index a279c188..926ab7c6 100644 --- a/Test/baseResults/spv.intOps.vert.out +++ b/Test/baseResults/spv.intOps.vert.out @@ -44,8 +44,12 @@ Linked vertex stage: Name 173 "u3" Name 182 "i3" Name 247 "v4" + Decorate 210 RelaxedPrecision + Decorate 216 RelaxedPrecision Decorate 223 RelaxedPrecision Decorate 230 RelaxedPrecision + Decorate 234 RelaxedPrecision + Decorate 240 RelaxedPrecision Decorate 261 RelaxedPrecision Decorate 265 RelaxedPrecision 2: TypeVoid diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp index 3daa28bb..20f7c633 100644 --- a/glslang/MachineIndependent/Initialize.cpp +++ b/glslang/MachineIndependent/Initialize.cpp @@ -1242,26 +1242,6 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan) if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 400)) { commonBuiltins.append( - "highp uint uaddCarry( uint, uint, out uint carry);" - "highp uvec2 uaddCarry(uvec2, uvec2, out uvec2 carry);" - "highp uvec3 uaddCarry(uvec3, uvec3, out uvec3 carry);" - "highp uvec4 uaddCarry(uvec4, uvec4, out uvec4 carry);" - - "highp uint usubBorrow( uint, uint, out uint borrow);" - "highp uvec2 usubBorrow(uvec2, uvec2, out uvec2 borrow);" - "highp uvec3 usubBorrow(uvec3, uvec3, out uvec3 borrow);" - "highp uvec4 usubBorrow(uvec4, uvec4, out uvec4 borrow);" - - "void umulExtended( uint, uint, out uint, out uint lsb);" - "void umulExtended(uvec2, uvec2, out uvec2, out uvec2 lsb);" - "void umulExtended(uvec3, uvec3, out uvec3, out uvec3 lsb);" - "void umulExtended(uvec4, uvec4, out uvec4, out uvec4 lsb);" - - "void imulExtended( int, int, out int, out int lsb);" - "void imulExtended(ivec2, ivec2, out ivec2, out ivec2 lsb);" - "void imulExtended(ivec3, ivec3, out ivec3, out ivec3 lsb);" - "void imulExtended(ivec4, ivec4, out ivec4, out ivec4 lsb);" - " int bitfieldExtract( int, int, int);" "ivec2 bitfieldExtract(ivec2, int, int);" "ivec3 bitfieldExtract(ivec3, int, int);" @@ -1282,6 +1262,41 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan) "uvec3 bitfieldInsert(uvec3 base, uvec3, int, int);" "uvec4 bitfieldInsert(uvec4 base, uvec4, int, int);" + "lowp int findLSB( int);" + "lowp ivec2 findLSB(ivec2);" + "lowp ivec3 findLSB(ivec3);" + "lowp ivec4 findLSB(ivec4);" + + "lowp int findLSB( uint);" + "lowp ivec2 findLSB(uvec2);" + "lowp ivec3 findLSB(uvec3);" + "lowp ivec4 findLSB(uvec4);" + + "\n"); + } + + if (profile != EEsProfile && version >= 400) { + commonBuiltins.append( + " uint uaddCarry( uint, uint, out uint carry);" + "uvec2 uaddCarry(uvec2, uvec2, out uvec2 carry);" + "uvec3 uaddCarry(uvec3, uvec3, out uvec3 carry);" + "uvec4 uaddCarry(uvec4, uvec4, out uvec4 carry);" + + " uint usubBorrow( uint, uint, out uint borrow);" + "uvec2 usubBorrow(uvec2, uvec2, out uvec2 borrow);" + "uvec3 usubBorrow(uvec3, uvec3, out uvec3 borrow);" + "uvec4 usubBorrow(uvec4, uvec4, out uvec4 borrow);" + + "void umulExtended( uint, uint, out uint, out uint lsb);" + "void umulExtended(uvec2, uvec2, out uvec2, out uvec2 lsb);" + "void umulExtended(uvec3, uvec3, out uvec3, out uvec3 lsb);" + "void umulExtended(uvec4, uvec4, out uvec4, out uvec4 lsb);" + + "void imulExtended( int, int, out int, out int lsb);" + "void imulExtended(ivec2, ivec2, out ivec2, out ivec2 lsb);" + "void imulExtended(ivec3, ivec3, out ivec3, out ivec3 lsb);" + "void imulExtended(ivec4, ivec4, out ivec4, out ivec4 lsb);" + " int bitfieldReverse( int);" "ivec2 bitfieldReverse(ivec2);" "ivec3 bitfieldReverse(ivec3);" @@ -1302,16 +1317,6 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan) "ivec3 bitCount(uvec3);" "ivec4 bitCount(uvec4);" - "lowp int findLSB( int);" - "lowp ivec2 findLSB(ivec2);" - "lowp ivec3 findLSB(ivec3);" - "lowp ivec4 findLSB(ivec4);" - - "lowp int findLSB( uint);" - "lowp ivec2 findLSB(uvec2);" - "lowp ivec3 findLSB(uvec3);" - "lowp ivec4 findLSB(uvec4);" - " int findMSB( int);" "ivec2 findMSB(ivec2);" "ivec3 findMSB(ivec3);" @@ -1321,6 +1326,61 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan) "ivec2 findMSB(uvec2);" "ivec3 findMSB(uvec3);" "ivec4 findMSB(uvec4);" + + "\n"); + } + + if (profile == EEsProfile && version >= 310) { + commonBuiltins.append( + "highp uint uaddCarry(highp uint, highp uint, out lowp uint carry);" + "highp uvec2 uaddCarry(highp uvec2, highp uvec2, out lowp uvec2 carry);" + "highp uvec3 uaddCarry(highp uvec3, highp uvec3, out lowp uvec3 carry);" + "highp uvec4 uaddCarry(highp uvec4, highp uvec4, out lowp uvec4 carry);" + + "highp uint usubBorrow(highp uint, highp uint, out lowp uint borrow);" + "highp uvec2 usubBorrow(highp uvec2, highp uvec2, out lowp uvec2 borrow);" + "highp uvec3 usubBorrow(highp uvec3, highp uvec3, out lowp uvec3 borrow);" + "highp uvec4 usubBorrow(highp uvec4, highp uvec4, out lowp uvec4 borrow);" + + "void umulExtended(highp uint, highp uint, highp out uint, out highp uint lsb);" + "void umulExtended(highp uvec2, highp uvec2, highp out uvec2, out highp uvec2 lsb);" + "void umulExtended(highp uvec3, highp uvec3, highp out uvec3, out highp uvec3 lsb);" + "void umulExtended(highp uvec4, highp uvec4, highp out uvec4, out highp uvec4 lsb);" + + "void imulExtended(highp int, highp int, highp out int, out highp int lsb);" + "void imulExtended(highp ivec2, highp ivec2, highp out ivec2, out highp ivec2 lsb);" + "void imulExtended(highp ivec3, highp ivec3, highp out ivec3, out highp ivec3 lsb);" + "void imulExtended(highp ivec4, highp ivec4, highp out ivec4, out highp ivec4 lsb);" + + "highp int bitfieldReverse(highp int);" + "highp ivec2 bitfieldReverse(highp ivec2);" + "highp ivec3 bitfieldReverse(highp ivec3);" + "highp ivec4 bitfieldReverse(highp ivec4);" + + "highp uint bitfieldReverse(highp uint);" + "highp uvec2 bitfieldReverse(highp uvec2);" + "highp uvec3 bitfieldReverse(highp uvec3);" + "highp uvec4 bitfieldReverse(highp uvec4);" + + "lowp int bitCount( int);" + "lowp ivec2 bitCount(ivec2);" + "lowp ivec3 bitCount(ivec3);" + "lowp ivec4 bitCount(ivec4);" + + "lowp int bitCount( uint);" + "lowp ivec2 bitCount(uvec2);" + "lowp ivec3 bitCount(uvec3);" + "lowp ivec4 bitCount(uvec4);" + + "lowp int findMSB(highp int);" + "lowp ivec2 findMSB(highp ivec2);" + "lowp ivec3 findMSB(highp ivec3);" + "lowp ivec4 findMSB(highp ivec4);" + + "lowp int findMSB(highp uint);" + "lowp ivec2 findMSB(highp uvec2);" + "lowp ivec3 findMSB(highp uvec3);" + "lowp ivec4 findMSB(highp uvec4);" "\n"); } From 5bdf49cdc86ee5993641c3698929d81dac4b2f34 Mon Sep 17 00:00:00 2001 From: GregF Date: Mon, 9 May 2016 17:07:04 -0600 Subject: [PATCH 075/140] fix check for non-positive array size --- Test/baseResults/negativeArraySize.comp.out | 24 +++++++++++++++++++++ Test/negativeArraySize.comp | 10 +++++++++ Test/testlist | 1 + glslang/MachineIndependent/ParseHelper.cpp | 11 ++++++---- 4 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 Test/baseResults/negativeArraySize.comp.out create mode 100644 Test/negativeArraySize.comp diff --git a/Test/baseResults/negativeArraySize.comp.out b/Test/baseResults/negativeArraySize.comp.out new file mode 100644 index 00000000..ccbabf5f --- /dev/null +++ b/Test/baseResults/negativeArraySize.comp.out @@ -0,0 +1,24 @@ +negativeArraySize.comp +Warning, version 310 is not yet complete; most version-specific features are present, but some are missing. +ERROR: 0:9: '' : array size must be a positive integer +ERROR: 1 compilation errors. No code generated. + + +Shader version: 310 +local_size = (1, 1, 1) +ERROR: node is still EOpNull! +0:7 Function Definition: main( (global void) +0:7 Function Parameters: +0:? Linker Objects + + +Linked compute stage: + + +Shader version: 310 +local_size = (1, 1, 1) +ERROR: node is still EOpNull! +0:7 Function Definition: main( (global void) +0:7 Function Parameters: +0:? Linker Objects + diff --git a/Test/negativeArraySize.comp b/Test/negativeArraySize.comp new file mode 100644 index 00000000..20636c0a --- /dev/null +++ b/Test/negativeArraySize.comp @@ -0,0 +1,10 @@ +#version 310 es + +#ifdef GL_ES +precision mediump float; +#endif + +void main() +{ + float f[-2]; // cannot declare arrays with negative size +} diff --git a/Test/testlist b/Test/testlist index d60fbca4..1be8b8e2 100644 --- a/Test/testlist +++ b/Test/testlist @@ -128,4 +128,5 @@ varyingArrayIndirect.frag voidFunction.frag whileLoop.frag nonVulkan.frag +negativeArraySize.comp spv.atomic.comp diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index b9d77f2d..a98b3429 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -2869,13 +2869,14 @@ bool TParseContext::containsFieldWithBasicType(const TType& type, TBasicType bas void TParseContext::arraySizeCheck(const TSourceLoc& loc, TIntermTyped* expr, TArraySize& sizePair) { bool isConst = false; - sizePair.size = 1; sizePair.node = nullptr; + int size = 1; + TIntermConstantUnion* constant = expr->getAsConstantUnion(); if (constant) { // handle true (non-specialization) constant - sizePair.size = constant->getConstArray()[0].getIConst(); + size = constant->getConstArray()[0].getIConst(); isConst = true; } else { // see if it's a specialization constant instead @@ -2884,16 +2885,18 @@ void TParseContext::arraySizeCheck(const TSourceLoc& loc, TIntermTyped* expr, TA sizePair.node = expr; TIntermSymbol* symbol = expr->getAsSymbolNode(); if (symbol && symbol->getConstArray().size() > 0) - sizePair.size = symbol->getConstArray()[0].getIConst(); + size = symbol->getConstArray()[0].getIConst(); } } + sizePair.size = size; + if (! isConst || (expr->getBasicType() != EbtInt && expr->getBasicType() != EbtUint)) { error(loc, "array size must be a constant integer expression", "", ""); return; } - if (sizePair.size <= 0) { + if (size <= 0) { error(loc, "array size must be a positive integer", "", ""); return; } From bb0ac5466047f8ef14dda37cb0b160682d20ee26 Mon Sep 17 00:00:00 2001 From: qining Date: Mon, 9 May 2016 21:18:33 -0400 Subject: [PATCH 076/140] Rebase to d3d3ce7160001846ede74978954e67f4f9fd84e4,update comments, rename a member variable name, fix format issue --- .../propagateNoContraction.cpp | 72 +++++++++---------- 1 file changed, 35 insertions(+), 37 deletions(-) diff --git a/glslang/MachineIndependent/propagateNoContraction.cpp b/glslang/MachineIndependent/propagateNoContraction.cpp index da8dfaf8..b859dde1 100644 --- a/glslang/MachineIndependent/propagateNoContraction.cpp +++ b/glslang/MachineIndependent/propagateNoContraction.cpp @@ -142,7 +142,7 @@ ObjectAccessChain generateSymbolLabel(glslang::TIntermSymbol* node) return symbol_id; } -// Return true if the operation is an arithmetic operation and valid for +// Returns true if the operation is an arithmetic operation and valid for // 'NoContraction' decoration. bool isArithmeticOperation(glslang::TOperator op) { @@ -173,11 +173,6 @@ bool isArithmeticOperation(glslang::TOperator op) case glslang::EOpDot: - case glslang::EOpAddCarry: - case glslang::EOpSubBorrow: - case glslang::EOpUMulExtended: - case glslang::EOpIMulExtended: - case glslang::EOpPostIncrement: case glslang::EOpPostDecrement: case glslang::EOpPreIncrement: @@ -224,7 +219,8 @@ ObjectAccessChain getSubAccessChainAfterPrefix(const ObjectAccessChain& chain, const ObjectAccessChain& prefix) { size_t pos = chain.find(prefix); - if (pos != 0) return chain; + if (pos != 0) + return chain; return chain.substr(prefix.length() + sizeof(ObjectAccesschainDelimiter)); } @@ -257,7 +253,7 @@ protected: ReturnBranchNodeSet& precise_return_nodes_; // A temporary cache of the symbol node whose defining node is to be found // currently along traversing the AST. - ObjectAccessChain object_to_be_defined_; + ObjectAccessChain current_object__; // A map from object node to its accesschain. This traverser stores // the built accesschains into this map for each object node it has // visited. @@ -273,18 +269,18 @@ TSymbolDefinitionCollectingTraverser::TSymbolDefinitionCollectingTraverser( ObjectAccesschainSet* precise_objects, std::unordered_set* precise_return_nodes) : TIntermTraverser(true, false, false), symbol_definition_mapping_(*symbol_definition_mapping), - precise_objects_(*precise_objects), object_to_be_defined_(), + precise_objects_(*precise_objects), current_object__(), accesschain_mapping_(*accesschain_mapping), current_function_definition_node_(nullptr), precise_return_nodes_(*precise_return_nodes) {} -// Visits a symbol node, set the object_to_be_defined_ to the +// Visits a symbol node, set the current_object__ to the // current node symbol ID, and record a mapping from this node to the current -// object_to_be_defined_, which is the just obtained symbol +// current_object__, which is the just obtained symbol // ID. void TSymbolDefinitionCollectingTraverser::visitSymbol(glslang::TIntermSymbol* node) { - object_to_be_defined_ = generateSymbolLabel(node); - accesschain_mapping_[node] = object_to_be_defined_; + current_object__ = generateSymbolLabel(node); + accesschain_mapping_[node] = current_object__; } // Visits an aggregate node, traverses all of its children. @@ -304,7 +300,7 @@ bool TSymbolDefinitionCollectingTraverser::visitAggregate(glslang::TVisit, // Traverse the items in the sequence. glslang::TIntermSequence& seq = node->getSequence(); for (int i = 0; i < (int)seq.size(); ++i) { - object_to_be_defined_.clear(); + current_object__.clear(); seq[i]->traverse(this); } return false; @@ -329,11 +325,11 @@ bool TSymbolDefinitionCollectingTraverser::visitBranch(glslang::TVisit, bool TSymbolDefinitionCollectingTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TIntermUnary* node) { - object_to_be_defined_.clear(); + current_object__.clear(); node->getOperand()->traverse(this); if (isAssignOperation(node->getOp())) { // We should always be able to get an accesschain of the operand node. - assert(!object_to_be_defined_.empty()); + assert(!current_object__.empty()); // If the operand node object is 'precise', we collect its accesschain // for the initial set of 'precise' objects. @@ -341,16 +337,16 @@ bool TSymbolDefinitionCollectingTraverser::visitUnary(glslang::TVisit /* visit * // The operand node is an 'precise' object node, add its // accesschain to the set of 'precise' objects. This is to collect // the initial set of 'precise' objects. - precise_objects_.insert(object_to_be_defined_); + precise_objects_.insert(current_object__); } // Gets the symbol ID from the object's accesschain. - ObjectAccessChain id_symbol = getFrontElement(object_to_be_defined_); + ObjectAccessChain id_symbol = getFrontElement(current_object__); // Add a mapping from the symbol ID to this assignment operation node. symbol_definition_mapping_.insert(std::make_pair(id_symbol, node)); } // Unary node is not a dereference node, so we clear the accesschain which // is under construction. - object_to_be_defined_.clear(); + current_object__.clear(); return false; } @@ -360,12 +356,12 @@ bool TSymbolDefinitionCollectingTraverser::visitBinary(glslang::TVisit /* visit glslang::TIntermBinary* node) { // Traverses the left node to build the accesschain info for the object. - object_to_be_defined_.clear(); + current_object__.clear(); node->getLeft()->traverse(this); if (isAssignOperation(node->getOp())) { // We should always be able to get an accesschain for the left node. - assert(!object_to_be_defined_.empty()); + assert(!current_object__.empty()); // If the left node object is 'precise', it is an initial precise object // specified in the shader source. Adds it to the initial worklist to @@ -374,17 +370,17 @@ bool TSymbolDefinitionCollectingTraverser::visitBinary(glslang::TVisit /* visit // The left node is an 'precise' object node, add its accesschain to // the set of 'precise' objects. This is to collect the initial set // of 'precise' objects. - precise_objects_.insert(object_to_be_defined_); + precise_objects_.insert(current_object__); } // Gets the symbol ID from the object accesschain, which should be the // first element recorded in the accesschain. - ObjectAccessChain id_symbol = getFrontElement(object_to_be_defined_); + ObjectAccessChain id_symbol = getFrontElement(current_object__); // Adds a mapping from the symbol ID to this assignment operation node. symbol_definition_mapping_.insert(std::make_pair(id_symbol, node)); // Traverses the right node, there may be other 'assignment' // operatrions in the right. - object_to_be_defined_.clear(); + current_object__.clear(); node->getRight()->traverse(this); } else if (isDereferenceOperation(node->getOp())) { @@ -393,26 +389,27 @@ bool TSymbolDefinitionCollectingTraverser::visitBinary(glslang::TVisit /* visit // object id. if (node->getOp() == glslang::EOpIndexDirectStruct) { unsigned struct_dereference_index = getStructIndexFromConstantUnion(node->getRight()); - object_to_be_defined_.push_back(ObjectAccesschainDelimiter); - object_to_be_defined_.append(std::to_string(struct_dereference_index)); + current_object__.push_back(ObjectAccesschainDelimiter); + current_object__.append(std::to_string(struct_dereference_index)); } - accesschain_mapping_[node] = object_to_be_defined_; + accesschain_mapping_[node] = current_object__; // For dereference node, there is no need to traverse the right child // node as the right node should always be an integer type object. } else { // For other binary nodes, still traverse the right node. - object_to_be_defined_.clear(); - node->getRight()->traverse(this); + current_object__.clear(); + return true; } return false; } -// Traverses the AST and returns a tuple of three members: +// Traverses the AST and returns a tuple of four members: // 1) a mapping from symbol IDs to the definition nodes (aka. assignment nodes) of these symbols. // 2) a mapping from object nodes in the AST to the accesschains of these objects. // 3) a set of accesschains of precise objects. +// 4) a set of return nodes with precise expressions. std::tuple getSymbolToDefinitionMappingAndPreciseSymbolIDs(const glslang::TIntermediate& intermediate) { @@ -420,7 +417,8 @@ getSymbolToDefinitionMappingAndPreciseSymbolIDs(const glslang::TIntermediate& in ReturnBranchNodeSet()); TIntermNode* root = intermediate.getTreeRoot(); - if (root == 0) return result_tuple; + if (root == 0) + return result_tuple; NodeMapping& symbol_definition_mapping = std::get<0>(result_tuple); AccessChainMapping& accesschain_mapping = std::get<1>(result_tuple); @@ -561,7 +559,7 @@ protected: const ObjectAccessChain* precise_object_; }; -// Visit a binary node. If the node is an object node, it must be a dereference +// Visits a binary node. If the node is an object node, it must be a dereference // node. In such cases, if the left node is 'precise', this node should also be // 'precise'. bool TNoContractionAssigneeCheckingTraverser::visitBinary(glslang::TVisit, @@ -588,7 +586,7 @@ bool TNoContractionAssigneeCheckingTraverser::visitBinary(glslang::TVisit, return false; } -// Visit a symbol node, if the symbol node ID (its accesschain string) matches +// Visits a symbol node, if the symbol node ID (its accesschain string) matches // with the given precise object, this node should be 'precise'. void TNoContractionAssigneeCheckingTraverser::visitSymbol(glslang::TIntermSymbol* node) { @@ -649,7 +647,7 @@ public: } protected: - // Visit an aggregate node. The node can be a initializer list, in which + // Visits an aggregate node. The node can be a initializer list, in which // case we need to find the 'precise' or 'precise' containing object node // with the accesschain record. In other cases, just need to traverse all // the children nodes. @@ -683,7 +681,7 @@ protected: return true; } - // Visit a binary node. A binary node can be an object node, e.g. a dereference node. + // Visits a binary node. A binary node can be an object node, e.g. a dereference node. // As only the top object nodes in the right side of an assignment needs to be visited // and added to 'precise' worklist, this traverser won't visit the children nodes of // an object node. If the binary node does not represent an object node, it should @@ -779,7 +777,7 @@ void PropagateNoContraction(const glslang::TIntermediate& intermediate) { // First, traverses the AST, records symbols with their defining operations // and collects the initial set of precise symbols (symbol nodes that marked - // as 'noContraction'). + // as 'noContraction') and precise return nodes. auto mappings_and_precise_objects = getSymbolToDefinitionMappingAndPreciseSymbolIDs(intermediate); @@ -831,7 +829,7 @@ void PropagateNoContraction(const glslang::TIntermediate& intermediate) // Get all the defining nodes of that symbol ID. std::pair range = symbol_definition_mapping.equal_range(symbol_id); - // Visit all the assignment nodes of that symbol ID and + // Visits all the assignment nodes of that symbol ID and // 1) Check if the assignee node is 'precise' or contains 'precise' // objects. // 2) Propagate the 'precise' to the top layer object ndoes From e543cc35e954a0385195e0b52045b9cea59700ea Mon Sep 17 00:00:00 2001 From: qining Date: Mon, 9 May 2016 21:38:42 -0400 Subject: [PATCH 077/140] remove double underscore --- .../propagateNoContraction.cpp | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/glslang/MachineIndependent/propagateNoContraction.cpp b/glslang/MachineIndependent/propagateNoContraction.cpp index b859dde1..ab00829b 100644 --- a/glslang/MachineIndependent/propagateNoContraction.cpp +++ b/glslang/MachineIndependent/propagateNoContraction.cpp @@ -253,7 +253,7 @@ protected: ReturnBranchNodeSet& precise_return_nodes_; // A temporary cache of the symbol node whose defining node is to be found // currently along traversing the AST. - ObjectAccessChain current_object__; + ObjectAccessChain current_object_; // A map from object node to its accesschain. This traverser stores // the built accesschains into this map for each object node it has // visited. @@ -269,18 +269,18 @@ TSymbolDefinitionCollectingTraverser::TSymbolDefinitionCollectingTraverser( ObjectAccesschainSet* precise_objects, std::unordered_set* precise_return_nodes) : TIntermTraverser(true, false, false), symbol_definition_mapping_(*symbol_definition_mapping), - precise_objects_(*precise_objects), current_object__(), + precise_objects_(*precise_objects), current_object_(), accesschain_mapping_(*accesschain_mapping), current_function_definition_node_(nullptr), precise_return_nodes_(*precise_return_nodes) {} -// Visits a symbol node, set the current_object__ to the +// Visits a symbol node, set the current_object_ to the // current node symbol ID, and record a mapping from this node to the current -// current_object__, which is the just obtained symbol +// current_object_, which is the just obtained symbol // ID. void TSymbolDefinitionCollectingTraverser::visitSymbol(glslang::TIntermSymbol* node) { - current_object__ = generateSymbolLabel(node); - accesschain_mapping_[node] = current_object__; + current_object_ = generateSymbolLabel(node); + accesschain_mapping_[node] = current_object_; } // Visits an aggregate node, traverses all of its children. @@ -300,7 +300,7 @@ bool TSymbolDefinitionCollectingTraverser::visitAggregate(glslang::TVisit, // Traverse the items in the sequence. glslang::TIntermSequence& seq = node->getSequence(); for (int i = 0; i < (int)seq.size(); ++i) { - current_object__.clear(); + current_object_.clear(); seq[i]->traverse(this); } return false; @@ -325,11 +325,11 @@ bool TSymbolDefinitionCollectingTraverser::visitBranch(glslang::TVisit, bool TSymbolDefinitionCollectingTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TIntermUnary* node) { - current_object__.clear(); + current_object_.clear(); node->getOperand()->traverse(this); if (isAssignOperation(node->getOp())) { // We should always be able to get an accesschain of the operand node. - assert(!current_object__.empty()); + assert(!current_object_.empty()); // If the operand node object is 'precise', we collect its accesschain // for the initial set of 'precise' objects. @@ -337,16 +337,16 @@ bool TSymbolDefinitionCollectingTraverser::visitUnary(glslang::TVisit /* visit * // The operand node is an 'precise' object node, add its // accesschain to the set of 'precise' objects. This is to collect // the initial set of 'precise' objects. - precise_objects_.insert(current_object__); + precise_objects_.insert(current_object_); } // Gets the symbol ID from the object's accesschain. - ObjectAccessChain id_symbol = getFrontElement(current_object__); + ObjectAccessChain id_symbol = getFrontElement(current_object_); // Add a mapping from the symbol ID to this assignment operation node. symbol_definition_mapping_.insert(std::make_pair(id_symbol, node)); } // Unary node is not a dereference node, so we clear the accesschain which // is under construction. - current_object__.clear(); + current_object_.clear(); return false; } @@ -356,12 +356,12 @@ bool TSymbolDefinitionCollectingTraverser::visitBinary(glslang::TVisit /* visit glslang::TIntermBinary* node) { // Traverses the left node to build the accesschain info for the object. - current_object__.clear(); + current_object_.clear(); node->getLeft()->traverse(this); if (isAssignOperation(node->getOp())) { // We should always be able to get an accesschain for the left node. - assert(!current_object__.empty()); + assert(!current_object_.empty()); // If the left node object is 'precise', it is an initial precise object // specified in the shader source. Adds it to the initial worklist to @@ -370,17 +370,17 @@ bool TSymbolDefinitionCollectingTraverser::visitBinary(glslang::TVisit /* visit // The left node is an 'precise' object node, add its accesschain to // the set of 'precise' objects. This is to collect the initial set // of 'precise' objects. - precise_objects_.insert(current_object__); + precise_objects_.insert(current_object_); } // Gets the symbol ID from the object accesschain, which should be the // first element recorded in the accesschain. - ObjectAccessChain id_symbol = getFrontElement(current_object__); + ObjectAccessChain id_symbol = getFrontElement(current_object_); // Adds a mapping from the symbol ID to this assignment operation node. symbol_definition_mapping_.insert(std::make_pair(id_symbol, node)); // Traverses the right node, there may be other 'assignment' // operatrions in the right. - current_object__.clear(); + current_object_.clear(); node->getRight()->traverse(this); } else if (isDereferenceOperation(node->getOp())) { @@ -389,17 +389,17 @@ bool TSymbolDefinitionCollectingTraverser::visitBinary(glslang::TVisit /* visit // object id. if (node->getOp() == glslang::EOpIndexDirectStruct) { unsigned struct_dereference_index = getStructIndexFromConstantUnion(node->getRight()); - current_object__.push_back(ObjectAccesschainDelimiter); - current_object__.append(std::to_string(struct_dereference_index)); + current_object_.push_back(ObjectAccesschainDelimiter); + current_object_.append(std::to_string(struct_dereference_index)); } - accesschain_mapping_[node] = current_object__; + accesschain_mapping_[node] = current_object_; // For dereference node, there is no need to traverse the right child // node as the right node should always be an integer type object. } else { // For other binary nodes, still traverse the right node. - current_object__.clear(); + current_object_.clear(); return true; } return false; From f36d6e350eb22ab987abdde39c1b30b551eedf6b Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Tue, 10 May 2016 09:55:05 -0400 Subject: [PATCH 078/140] Add test configuration for Appveyor. --- .appveyor.yml | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .appveyor.yml diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 00000000..64e7ae64 --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,40 @@ +# Windows Build Configuration for AppVeyor +# http://www.appveyor.com/docs/appveyor-yml + +# build version format +version: "{build}" + +os: Visual Studio 2013 + +platform: + - Any CPU + +configuration: + - Debug + - Release + +branches: + only: + - master + +clone_depth: 5 + +matrix: + fast_finish: true # Show final status immediately if a test fails. + +# scripts that run after cloning repository +install: + - git clone https://github.com/google/googletest.git External/googletest + +build: + parallel: true # enable MSBuild parallel builds + verbosity: minimal + +build_script: + - mkdir build && cd build + - cmake .. -DCMAKE_INSTALL_PREFIX=install + - cmake --build . --config %CONFIGURATION% --target install + +test_script: + - ctest -C %CONFIGURATION% --output-on-failure + - cd ../Test && bash runtests From cb3236d9f9948985e1413aa42ed266f6fc279a08 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Tue, 10 May 2016 10:22:48 -0400 Subject: [PATCH 079/140] Use std::string for TBD/missing functionality reporting. We can have multiple instances of the same string, so comparing const char* is not guaranteed working. Fixed the failure on VS 2013 with Debug build. --- SPIRV/Logger.cpp | 4 ++-- SPIRV/Logger.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/SPIRV/Logger.cpp b/SPIRV/Logger.cpp index 2977ea39..7edf4265 100644 --- a/SPIRV/Logger.cpp +++ b/SPIRV/Logger.cpp @@ -40,13 +40,13 @@ namespace spv { -void SpvBuildLogger::tbdFunctionality(const char* f) +void SpvBuildLogger::tbdFunctionality(const std::string& f) { if (std::find(std::begin(tbdFeatures), std::end(tbdFeatures), f) == std::end(tbdFeatures)) tbdFeatures.push_back(f); } -void SpvBuildLogger::missingFunctionality(const char* f) +void SpvBuildLogger::missingFunctionality(const std::string& f) { if (std::find(std::begin(missingFeatures), std::end(missingFeatures), f) == std::end(missingFeatures)) missingFeatures.push_back(f); diff --git a/SPIRV/Logger.h b/SPIRV/Logger.h index 2b9eb0d5..15b5e354 100644 --- a/SPIRV/Logger.h +++ b/SPIRV/Logger.h @@ -48,9 +48,9 @@ public: SpvBuildLogger(const SpvBuildLogger&) = delete; // Registers a TBD functionality. - void tbdFunctionality(const char* f); + void tbdFunctionality(const std::string& f); // Registers a missing functionality. - void missingFunctionality(const char* f); + void missingFunctionality(const std::string& f); // Logs a warning. void warning(const std::string& w) { warnings.push_back(w); } @@ -62,8 +62,8 @@ public: std::string getAllMessages() const; private: - std::vector tbdFeatures; - std::vector missingFeatures; + std::vector tbdFeatures; + std::vector missingFeatures; std::vector warnings; std::vector errors; }; From 0e101c9613794b505629ca4e3cdab42de7643367 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Tue, 10 May 2016 13:04:55 -0400 Subject: [PATCH 080/140] Add badge status for Appveyor build in README. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 70d5b9e5..7a14f56a 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ glslang ======= [![Build Status](https://travis-ci.org/KhronosGroup/glslang.svg?branch=master)](https://travis-ci.org/KhronosGroup/glslang) +[![Build status](https://ci.appveyor.com/api/projects/status/q6fi9cb0qnhkla68/branch/master?svg=true)](https://ci.appveyor.com/project/Khronoswebmaster/glslang/branch/master) An OpenGL and OpenGL ES shader front end and validator. From 20daa7f64a3394a98deed5120d194eded477f7cf Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Tue, 10 May 2016 13:38:08 -0400 Subject: [PATCH 081/140] Use strtoul instead of stoul for Android. --- glslang/MachineIndependent/propagateNoContraction.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/glslang/MachineIndependent/propagateNoContraction.cpp b/glslang/MachineIndependent/propagateNoContraction.cpp index ab00829b..24e47a74 100644 --- a/glslang/MachineIndependent/propagateNoContraction.cpp +++ b/glslang/MachineIndependent/propagateNoContraction.cpp @@ -39,6 +39,7 @@ #include "propagateNoContraction.h" +#include #include #include #include @@ -663,7 +664,7 @@ protected: // Gets the struct dereference index that leads to 'precise' object. ObjectAccessChain precise_accesschain_index_str = getFrontElement(remained_accesschain_); - unsigned precise_accesschain_index = std::stoul(precise_accesschain_index_str); + unsigned precise_accesschain_index = strtoul(precise_accesschain_index_str.c_str(), nullptr, 10); // Gets the node pointed by the accesschain index extracted before. glslang::TIntermTyped* potential_precise_node = node->getSequence()[precise_accesschain_index]->getAsTyped(); From 827b23b8a1714975fc87ed734546c4a41b7d61cd Mon Sep 17 00:00:00 2001 From: Rex Xu Date: Wed, 11 May 2016 15:50:41 +0800 Subject: [PATCH 082/140] Parser: Redeclare gl_ClipDistance/gl_CullDistance should update their array sizes. --- Test/baseResults/150.tesc.out | 4 ++-- Test/baseResults/400.tese.out | 4 ++-- Test/baseResults/420.vert.out | 4 ++-- Test/baseResults/450.geom.out | 14 +++++++------- Test/baseResults/450.tesc.out | 16 ++++++++-------- Test/baseResults/450.tese.out | 14 +++++++------- Test/baseResults/450.vert.out | 6 +++--- glslang/MachineIndependent/ParseHelper.cpp | 3 +++ 8 files changed, 34 insertions(+), 31 deletions(-) diff --git a/Test/baseResults/150.tesc.out b/Test/baseResults/150.tesc.out index 667fcfbf..638ef82f 100644 --- a/Test/baseResults/150.tesc.out +++ b/Test/baseResults/150.tesc.out @@ -567,7 +567,7 @@ ERROR: node is still EOpNull! 0:? 'badp2' (flat patch in 4-component vector of float) 0:? 'badp3' (noperspective patch in 4-component vector of float) 0:? 'badp4' (patch sample in 3-component vector of float) -0:? 'gl_in' (in 32-element array of block{in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:? 'gl_in' (in 32-element array of block{in 1-element array of float ClipDistance gl_ClipDistance}) 0:? 'ina' (in 2-component vector of float) 0:? 'inb' (in 32-element array of 2-component vector of float) 0:? 'inc' (in 32-element array of 2-component vector of float) @@ -1577,7 +1577,7 @@ ERROR: node is still EOpNull! 0:? 'badp2' (flat patch in 4-component vector of float) 0:? 'badp3' (noperspective patch in 4-component vector of float) 0:? 'badp4' (patch sample in 3-component vector of float) -0:? 'gl_in' (in 32-element array of block{in 3-element array of float ClipDistance gl_ClipDistance}) +0:? 'gl_in' (in 32-element array of block{in 1-element array of float ClipDistance gl_ClipDistance}) 0:? 'ina' (in 2-component vector of float) 0:? 'inb' (in 32-element array of 2-component vector of float) 0:? 'inc' (in 32-element array of 2-component vector of float) diff --git a/Test/baseResults/400.tese.out b/Test/baseResults/400.tese.out index 76883aa7..324dbaa3 100644 --- a/Test/baseResults/400.tese.out +++ b/Test/baseResults/400.tese.out @@ -138,7 +138,7 @@ ERROR: node is still EOpNull! 0:? 'badp2' (flat patch in 4-component vector of float) 0:? 'badp3' (noperspective patch in 4-component vector of float) 0:? 'badp4' (patch sample in 3-component vector of float) -0:? 'gl_in' (in 32-element array of block{in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:? 'gl_in' (in 32-element array of block{in 1-element array of float ClipDistance gl_ClipDistance}) 0:? 'ina' (in 2-component vector of float) 0:? 'inb' (in 32-element array of 2-component vector of float) 0:? 'inc' (in 32-element array of 2-component vector of float) @@ -263,7 +263,7 @@ ERROR: node is still EOpNull! 0:? 'badp2' (flat patch in 4-component vector of float) 0:? 'badp3' (noperspective patch in 4-component vector of float) 0:? 'badp4' (patch sample in 3-component vector of float) -0:? 'gl_in' (in 32-element array of block{in 3-element array of float ClipDistance gl_ClipDistance}) +0:? 'gl_in' (in 32-element array of block{in 1-element array of float ClipDistance gl_ClipDistance}) 0:? 'ina' (in 2-component vector of float) 0:? 'inb' (in 32-element array of 2-component vector of float) 0:? 'inc' (in 32-element array of 2-component vector of float) diff --git a/Test/baseResults/420.vert.out b/Test/baseResults/420.vert.out index 3b0dfaea..0f5110cb 100644 --- a/Test/baseResults/420.vert.out +++ b/Test/baseResults/420.vert.out @@ -275,7 +275,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 implicitly-sized 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) @@ -527,7 +527,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 1-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/450.geom.out b/Test/baseResults/450.geom.out index 1579e18d..fef3486a 100644 --- a/Test/baseResults/450.geom.out +++ b/Test/baseResults/450.geom.out @@ -12,16 +12,16 @@ output primitive = none 0:13 Sequence 0:13 move second child to first child (temp float) 0:13 direct index (layout(stream=0 ) temp float CullDistance) -0:13 gl_CullDistance: direct index for structure (layout(stream=0 ) out implicitly-sized array of float CullDistance) -0:13 'anon@0' (layout(stream=0 ) out block{layout(stream=0 ) out implicitly-sized array of float CullDistance gl_CullDistance}) +0:13 gl_CullDistance: direct index for structure (layout(stream=0 ) out 3-element array of float CullDistance) +0:13 'anon@0' (layout(stream=0 ) out block{layout(stream=0 ) out 3-element array of float CullDistance gl_CullDistance}) 0:13 Constant: 0:13 3 (const uint) 0:13 Constant: 0:13 2 (const int) 0:13 direct index (temp float CullDistance) -0:13 gl_CullDistance: direct index for structure (in implicitly-sized array of float CullDistance) -0:13 direct index (temp block{in implicitly-sized array of float CullDistance gl_CullDistance}) -0:13 'gl_in' (in implicitly-sized array of block{in implicitly-sized array of float CullDistance gl_CullDistance}) +0:13 gl_CullDistance: direct index for structure (in 3-element array of float CullDistance) +0:13 direct index (temp block{in 3-element array of float CullDistance gl_CullDistance}) +0:13 'gl_in' (in implicitly-sized array of block{in 3-element array of float CullDistance gl_CullDistance}) 0:13 Constant: 0:13 1 (const int) 0:13 Constant: @@ -29,8 +29,8 @@ output primitive = none 0:13 Constant: 0:13 2 (const int) 0:? Linker Objects -0:? 'gl_in' (in implicitly-sized array of block{in implicitly-sized array of float CullDistance gl_CullDistance}) -0:? 'anon@0' (layout(stream=0 ) out block{layout(stream=0 ) out implicitly-sized array of float CullDistance gl_CullDistance}) +0:? 'gl_in' (in implicitly-sized array of block{in 3-element array of float CullDistance gl_CullDistance}) +0:? 'anon@0' (layout(stream=0 ) out block{layout(stream=0 ) out 3-element array of float CullDistance gl_CullDistance}) Linked geometry stage: diff --git a/Test/baseResults/450.tesc.out b/Test/baseResults/450.tesc.out index 66cd5c26..aeef6cb3 100644 --- a/Test/baseResults/450.tesc.out +++ b/Test/baseResults/450.tesc.out @@ -9,18 +9,18 @@ vertices = -1 0:13 Sequence 0:13 move second child to first child (temp float) 0:13 direct index (temp float CullDistance) -0:13 gl_CullDistance: direct index for structure (out implicitly-sized array of float CullDistance) -0:13 indirect index (temp block{out implicitly-sized array of float CullDistance gl_CullDistance}) -0:13 'gl_out' (out 4-element array of block{out implicitly-sized array of float CullDistance gl_CullDistance}) +0:13 gl_CullDistance: direct index for structure (out 3-element array of float CullDistance) +0:13 indirect index (temp block{out 3-element array of float CullDistance gl_CullDistance}) +0:13 'gl_out' (out 4-element array of block{out 3-element array of float CullDistance gl_CullDistance}) 0:13 'gl_InvocationID' (in int InvocationID) 0:13 Constant: 0:13 0 (const int) 0:13 Constant: 0:13 2 (const int) 0:13 direct index (temp float CullDistance) -0:13 gl_CullDistance: direct index for structure (in implicitly-sized array of float CullDistance) -0:13 direct index (temp block{in implicitly-sized array of float CullDistance gl_CullDistance}) -0:13 'gl_in' (in 32-element array of block{in implicitly-sized array of float CullDistance gl_CullDistance}) +0:13 gl_CullDistance: direct index for structure (in 3-element array of float CullDistance) +0:13 direct index (temp block{in 3-element array of float CullDistance gl_CullDistance}) +0:13 'gl_in' (in 32-element array of block{in 3-element array of float CullDistance gl_CullDistance}) 0:13 Constant: 0:13 1 (const int) 0:13 Constant: @@ -28,8 +28,8 @@ vertices = -1 0:13 Constant: 0:13 2 (const int) 0:? Linker Objects -0:? 'gl_in' (in 32-element array of block{in implicitly-sized array of float CullDistance gl_CullDistance}) -0:? 'gl_out' (out 4-element array of block{out implicitly-sized array of float CullDistance gl_CullDistance}) +0:? 'gl_in' (in 32-element array of block{in 3-element array of float CullDistance gl_CullDistance}) +0:? 'gl_out' (out 4-element array of block{out 3-element array of float CullDistance gl_CullDistance}) Linked tessellation control stage: diff --git a/Test/baseResults/450.tese.out b/Test/baseResults/450.tese.out index a1116b40..f988f108 100644 --- a/Test/baseResults/450.tese.out +++ b/Test/baseResults/450.tese.out @@ -11,16 +11,16 @@ triangle order = none 0:13 Sequence 0:13 move second child to first child (temp float) 0:13 direct index (temp float CullDistance) -0:13 gl_CullDistance: direct index for structure (out implicitly-sized array of float CullDistance) -0:13 'anon@0' (out block{out implicitly-sized array of float CullDistance gl_CullDistance}) +0:13 gl_CullDistance: direct index for structure (out 3-element array of float CullDistance) +0:13 'anon@0' (out block{out 3-element array of float CullDistance gl_CullDistance}) 0:13 Constant: 0:13 3 (const uint) 0:13 Constant: 0:13 2 (const int) 0:13 direct index (temp float CullDistance) -0:13 gl_CullDistance: direct index for structure (in implicitly-sized array of float CullDistance) -0:13 direct index (temp block{in implicitly-sized array of float CullDistance gl_CullDistance}) -0:13 'gl_in' (in 32-element array of block{in implicitly-sized array of float CullDistance gl_CullDistance}) +0:13 gl_CullDistance: direct index for structure (in 3-element array of float CullDistance) +0:13 direct index (temp block{in 3-element array of float CullDistance gl_CullDistance}) +0:13 'gl_in' (in 32-element array of block{in 3-element array of float CullDistance gl_CullDistance}) 0:13 Constant: 0:13 1 (const int) 0:13 Constant: @@ -28,8 +28,8 @@ triangle order = none 0:13 Constant: 0:13 2 (const int) 0:? Linker Objects -0:? 'gl_in' (in 32-element array of block{in implicitly-sized array of float CullDistance gl_CullDistance}) -0:? 'anon@0' (out block{out implicitly-sized array of float CullDistance gl_CullDistance}) +0:? 'gl_in' (in 32-element array of block{in 3-element array of float CullDistance gl_CullDistance}) +0:? 'anon@0' (out block{out 3-element array of float CullDistance gl_CullDistance}) Linked tessellation evaluation stage: diff --git a/Test/baseResults/450.vert.out b/Test/baseResults/450.vert.out index 39cce382..86338c76 100644 --- a/Test/baseResults/450.vert.out +++ b/Test/baseResults/450.vert.out @@ -12,8 +12,8 @@ ERROR: node is still EOpNull! 0:9 Sequence 0:9 move second child to first child (temp float) 0:9 direct index (temp float CullDistance) -0:9 gl_CullDistance: direct index for structure (out implicitly-sized array of float CullDistance) -0:9 'anon@0' (out block{out implicitly-sized array of float CullDistance gl_CullDistance}) +0:9 gl_CullDistance: direct index for structure (out 3-element array of float CullDistance) +0:9 'anon@0' (out block{out 3-element array of float CullDistance gl_CullDistance}) 0:9 Constant: 0:9 10 (const uint) 0:9 Constant: @@ -21,7 +21,7 @@ ERROR: node is still EOpNull! 0:9 Constant: 0:9 4.500000 0:? Linker Objects -0:? 'anon@0' (out block{out implicitly-sized array of float CullDistance gl_CullDistance}) +0:? 'anon@0' (out block{out 3-element array of float CullDistance gl_CullDistance}) 0:? 'outb' (smooth out bool) 0:? 'outo' (smooth out sampler2D) 0:? 'outa' (smooth out 4-element array of float) diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index a98b3429..4db9ef70 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -3465,6 +3465,9 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT oldType.getQualifier().flat = newType.getQualifier().flat; oldType.getQualifier().nopersp = newType.getQualifier().nopersp; + if (oldType.isImplicitlySizedArray() && newType.isExplicitlySizedArray()) + oldType.changeOuterArraySize(newType.getOuterArraySize()); + // go to next member ++member; } else { From 5839031759546805bcf6dfa81a0e869cd07906f9 Mon Sep 17 00:00:00 2001 From: Rex Xu Date: Wed, 11 May 2016 16:38:50 +0800 Subject: [PATCH 083/140] SPV: Add capability ImageGatherExtended if necessary. --- SPIRV/SpvBuilder.cpp | 4 +++- Test/baseResults/spv.400.frag.out | 1 + Test/baseResults/spv.420.geom.out | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/SPIRV/SpvBuilder.cpp b/SPIRV/SpvBuilder.cpp index 53410477..a08e5488 100644 --- a/SPIRV/SpvBuilder.cpp +++ b/SPIRV/SpvBuilder.cpp @@ -1464,8 +1464,10 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, if (parameters.offset) { if (isConstant(parameters.offset)) mask = (ImageOperandsMask)(mask | ImageOperandsConstOffsetMask); - else + else { + addCapability(CapabilityImageGatherExtended); mask = (ImageOperandsMask)(mask | ImageOperandsOffsetMask); + } texArgs[numArgs++] = parameters.offset; } if (parameters.offsets) { diff --git a/Test/baseResults/spv.400.frag.out b/Test/baseResults/spv.400.frag.out index 651d67de..4af713c4 100644 --- a/Test/baseResults/spv.400.frag.out +++ b/Test/baseResults/spv.400.frag.out @@ -11,6 +11,7 @@ Linked fragment stage: Capability Shader Capability Float64 + Capability ImageGatherExtended Capability ClipDistance Capability SampledRect 1: ExtInstImport "GLSL.std.450" diff --git a/Test/baseResults/spv.420.geom.out b/Test/baseResults/spv.420.geom.out index cb535599..78e3aaa2 100644 --- a/Test/baseResults/spv.420.geom.out +++ b/Test/baseResults/spv.420.geom.out @@ -11,6 +11,7 @@ Linked geometry stage: Capability Geometry Capability GeometryPointSize + Capability ImageGatherExtended Capability GeometryStreams Capability MultiViewport 1: ExtInstImport "GLSL.std.450" From 2713ed735d7fc5b7006391ec3204a9a7197c7982 Mon Sep 17 00:00:00 2001 From: GregF Date: Wed, 11 May 2016 14:46:48 -0600 Subject: [PATCH 084/140] fix for -Werror=non-virtual-dtor for Android system builds --- glslang/Public/ShaderLang.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/glslang/Public/ShaderLang.h b/glslang/Public/ShaderLang.h index 856af262..c45df689 100644 --- a/glslang/Public/ShaderLang.h +++ b/glslang/Public/ShaderLang.h @@ -356,6 +356,9 @@ public: // Signals that the parser will no longer use the contents of the // specified IncludeResult. virtual void releaseInclude(IncludeResult* result) = 0; +#ifdef __ANDROID__ + virtual ~Includer() {} // Pacify -Werror=non-virtual-dtor +#endif }; // Returns an error message for any #include directive. From 4678ca9dacfec7a084dbc69bbe568bdad6889f1b Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Fri, 13 May 2016 09:33:42 -0600 Subject: [PATCH 085/140] HLSL: Add function call syntax and AST building. --- Test/baseResults/hlsl.frag.out | 69 ++++++++++++++++++++++++++++------ Test/hlsl.frag | 7 ++-- hlsl/hlslGrammar.cpp | 19 +++++++--- hlsl/hlslGrammar.h | 2 +- hlsl/hlslParseHelper.cpp | 9 +++-- hlsl/hlslParseHelper.h | 2 +- 6 files changed, 83 insertions(+), 25 deletions(-) diff --git a/Test/baseResults/hlsl.frag.out b/Test/baseResults/hlsl.frag.out index 9afecf12..3ccbc898 100644 --- a/Test/baseResults/hlsl.frag.out +++ b/Test/baseResults/hlsl.frag.out @@ -2,10 +2,27 @@ hlsl.frag Shader version: 100 gl_FragCoord origin is upper left 0:? Sequence -0:12 Function Definition: PixelShaderFunction(vf4; (temp 4-component vector of float) +0:1 move second child to first child (temp 4-component vector of float) +0:1 'AmbientColor' (temp 4-component vector of float) +0:? Constant: +0:? 1.000000 +0:? 0.500000 +0:? 0.000000 +0:? 1.000000 +0:2 move second child to first child (temp float) +0:2 'AmbientIntensity' (temp float) +0:2 Constant: +0:2 0.100000 +0:13 Function Definition: PixelShaderFunction(vf4; (temp 4-component vector of float) 0:5 Function Parameters: 0:5 'input' (temp 4-component vector of float) 0:? Sequence +0:6 Branch: Return with expression +0:6 add (temp 4-component vector of float) +0:6 vector-scale (temp 4-component vector of float) +0:6 'input' (temp 4-component vector of float) +0:6 'AmbientIntensity' (temp float) +0:6 'AmbientColor' (temp 4-component vector of float) 0:7 Branch: Return with expression 0:7 add (temp 4-component vector of float) 0:7 component-wise multiply (temp 4-component vector of float) @@ -36,7 +53,12 @@ gl_FragCoord origin is upper left 0:10 'input' (temp 4-component vector of float) 0:10 Pre-Increment (temp 4-component vector of float) 0:10 'input' (temp 4-component vector of float) +0:11 Branch: Return with expression +0:11 sine (global 4-component vector of float) +0:11 'input' (temp 4-component vector of float) 0:? Linker Objects +0:? 'AmbientColor' (temp 4-component vector of float) +0:? 'AmbientIntensity' (temp float) Linked fragment stage: @@ -45,10 +67,27 @@ Linked fragment stage: Shader version: 100 gl_FragCoord origin is upper left 0:? Sequence -0:12 Function Definition: PixelShaderFunction(vf4; (temp 4-component vector of float) +0:1 move second child to first child (temp 4-component vector of float) +0:1 'AmbientColor' (temp 4-component vector of float) +0:? Constant: +0:? 1.000000 +0:? 0.500000 +0:? 0.000000 +0:? 1.000000 +0:2 move second child to first child (temp float) +0:2 'AmbientIntensity' (temp float) +0:2 Constant: +0:2 0.100000 +0:13 Function Definition: PixelShaderFunction(vf4; (temp 4-component vector of float) 0:5 Function Parameters: 0:5 'input' (temp 4-component vector of float) 0:? Sequence +0:6 Branch: Return with expression +0:6 add (temp 4-component vector of float) +0:6 vector-scale (temp 4-component vector of float) +0:6 'input' (temp 4-component vector of float) +0:6 'AmbientIntensity' (temp float) +0:6 'AmbientColor' (temp 4-component vector of float) 0:7 Branch: Return with expression 0:7 add (temp 4-component vector of float) 0:7 component-wise multiply (temp 4-component vector of float) @@ -79,11 +118,16 @@ gl_FragCoord origin is upper left 0:10 'input' (temp 4-component vector of float) 0:10 Pre-Increment (temp 4-component vector of float) 0:10 'input' (temp 4-component vector of float) +0:11 Branch: Return with expression +0:11 sine (global 4-component vector of float) +0:11 'input' (temp 4-component vector of float) 0:? Linker Objects +0:? 'AmbientColor' (temp 4-component vector of float) +0:? 'AmbientIntensity' (temp float) // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 45 +// Id's are bound by 57 Capability Shader 1: ExtInstImport "GLSL.std.450" @@ -93,21 +137,24 @@ gl_FragCoord origin is upper left Source HLSL 100 Name 4 "PixelShaderFunction" Name 9 "input" + Name 12 "AmbientIntensity" + Name 15 "AmbientColor" 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 7: TypeVector 6(float) 4 8: TypePointer Function 7(fvec4) - 27: 6(float) Constant 1065353216 + 11: TypePointer Function 6(float) + 36: 6(float) Constant 1065353216 4(PixelShaderFunction): 2 Function None 3 5: Label 9(input): 8(ptr) Variable Function +12(AmbientIntensity): 11(ptr) Variable Function +15(AmbientColor): 8(ptr) Variable Function 10: 7(fvec4) Load 9(input) - 11: 7(fvec4) Load 9(input) - 12: 7(fvec4) FMul 10 11 - 13: 7(fvec4) Load 9(input) - 14: 7(fvec4) Load 9(input) - 15: 7(fvec4) FMul 13 14 - 16: 7(fvec4) FAdd 12 15 - ReturnValue 16 + 13: 6(float) Load 12(AmbientIntensity) + 14: 7(fvec4) VectorTimesScalar 10 13 + 16: 7(fvec4) Load 15(AmbientColor) + 17: 7(fvec4) FAdd 14 16 + ReturnValue 17 FunctionEnd diff --git a/Test/hlsl.frag b/Test/hlsl.frag index ac6aa230..1620ed58 100644 --- a/Test/hlsl.frag +++ b/Test/hlsl.frag @@ -1,11 +1,12 @@ -//float4 AmbientColor = float4(1, 0.5, 0, 1); -//float AmbientIntensity = 0.1; +float4 AmbientColor = float4(1, 0.5, 0, 1); +float AmbientIntensity = 0.1; float4 PixelShaderFunction(float4 input) : COLOR0 { -// return input * AmbientIntensity + AmbientColor; + return input * AmbientIntensity + AmbientColor; return input * input + input * input; return input + input * input + input; return ++input * -+-+--input; return input++ + ++input; + return sin(input); } diff --git a/hlsl/hlslGrammar.cpp b/hlsl/hlslGrammar.cpp index 2339c2d4..9ab9f2c3 100755 --- a/hlsl/hlslGrammar.cpp +++ b/hlsl/hlslGrammar.cpp @@ -608,7 +608,7 @@ bool HlslGrammar::acceptConstructor(TIntermTyped*& node) return false; // arguments - TIntermAggregate* arguments = nullptr; + TIntermTyped* arguments = nullptr; if (! acceptArguments(constructorFunction, arguments)) { expected("constructor arguments"); return false; @@ -628,10 +628,17 @@ bool HlslGrammar::acceptConstructor(TIntermTyped*& node) // function_call // : [idToken] arguments // -bool HlslGrammar::acceptFunctionCall(HlslToken idToken, TIntermTyped*&) +bool HlslGrammar::acceptFunctionCall(HlslToken idToken, TIntermTyped*& node) { - // todo - return false; + // arguments + TFunction* function = new TFunction(idToken.string, TType(EbtVoid)); + TIntermTyped* arguments = nullptr; + if (! acceptArguments(function, arguments)) + return false; + + node = parseContext.handleFunctionCall(idToken.loc, function, arguments); + + return true; } // arguments @@ -640,7 +647,7 @@ bool HlslGrammar::acceptFunctionCall(HlslToken idToken, TIntermTyped*&) // The arguments are pushed onto the 'function' argument list and // onto the 'arguments' aggregate. // -bool HlslGrammar::acceptArguments(TFunction* function, TIntermAggregate*& arguments) +bool HlslGrammar::acceptArguments(TFunction* function, TIntermTyped*& arguments) { // LEFT_PAREN if (! acceptTokenClass(EHTokLeftParen)) @@ -649,7 +656,7 @@ bool HlslGrammar::acceptArguments(TFunction* function, TIntermAggregate*& argume do { // expression TIntermTyped* arg; - if (! acceptExpression(arg)) + if (! acceptAssignmentExpression(arg)) break; // hook it up diff --git a/hlsl/hlslGrammar.h b/hlsl/hlslGrammar.h index 61d30aff..d834aa93 100755 --- a/hlsl/hlslGrammar.h +++ b/hlsl/hlslGrammar.h @@ -71,7 +71,7 @@ namespace glslang { bool acceptPostfixExpression(TIntermTyped*&); bool acceptConstructor(TIntermTyped*&); bool acceptFunctionCall(HlslToken, TIntermTyped*&); - bool acceptArguments(TFunction*, TIntermAggregate*&); + bool acceptArguments(TFunction*, TIntermTyped*&); bool acceptLiteral(TIntermTyped*&); bool acceptCompoundStatement(TIntermAggregate*&); bool acceptStatement(TIntermNode*&); diff --git a/hlsl/hlslParseHelper.cpp b/hlsl/hlslParseHelper.cpp index 13887444..0d67a1d7 100755 --- a/hlsl/hlslParseHelper.cpp +++ b/hlsl/hlslParseHelper.cpp @@ -754,12 +754,15 @@ TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& l return paramNodes; } -void HlslParseContext::handleFunctionArgument(TFunction* function, TIntermAggregate*& arguments, TIntermTyped* arg) +void HlslParseContext::handleFunctionArgument(TFunction* function, TIntermTyped*& arguments, TIntermTyped* newArg) { TParameter param = { 0, new TType }; - param.type->shallowCopy(arg->getType()); + param.type->shallowCopy(newArg->getType()); function->addParameter(param); - arguments = intermediate.growAggregate(arguments, arg); + if (arguments) + arguments = intermediate.growAggregate(arguments, newArg); + else + arguments = newArg; } // diff --git a/hlsl/hlslParseHelper.h b/hlsl/hlslParseHelper.h index 661fd97b..ba5bcda3 100755 --- a/hlsl/hlslParseHelper.h +++ b/hlsl/hlslParseHelper.h @@ -83,7 +83,7 @@ public: TIntermTyped* handleDotDereference(const TSourceLoc&, TIntermTyped* base, const TString& field); TFunction* handleFunctionDeclarator(const TSourceLoc&, TFunction& function, bool prototype); TIntermAggregate* handleFunctionDefinition(const TSourceLoc&, TFunction&); - void handleFunctionArgument(TFunction*, TIntermAggregate*&, TIntermTyped*); + void handleFunctionArgument(TFunction*, TIntermTyped*& arguments, TIntermTyped* newArg); TIntermTyped* handleFunctionCall(const TSourceLoc&, TFunction*, TIntermNode*); TIntermTyped* handleLengthMethod(const TSourceLoc&, TFunction*, TIntermNode*); void addInputArgumentConversions(const TFunction&, TIntermNode*&) const; From 73e3ce78f4bdd9a172b0d812fc2163cf4b018e6f Mon Sep 17 00:00:00 2001 From: Rex Xu Date: Wed, 27 Apr 2016 18:48:17 +0800 Subject: [PATCH 086/140] SPV: Handle matrix's OpFConvert vector by vector. --- SPIRV/GlslangToSpv.cpp | 8 +- Test/baseResults/spv.matrix.frag.out | 277 +++++++++++++++------------ Test/spv.matrix.frag | 11 +- 3 files changed, 163 insertions(+), 133 deletions(-) diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 22575b5a..2b76c049 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -137,7 +137,7 @@ protected: spv::Id createBinaryMatrixOperation(spv::Op, spv::Decoration precision, spv::Decoration noContraction, spv::Id typeId, spv::Id left, spv::Id right); spv::Id createUnaryOperation(glslang::TOperator op, spv::Decoration precision, spv::Decoration noContraction, spv::Id typeId, spv::Id operand,glslang::TBasicType typeProxy); spv::Id createUnaryMatrixOperation(spv::Op, spv::Decoration precision, spv::Decoration noContraction, spv::Id typeId, spv::Id operand,glslang::TBasicType typeProxy); - spv::Id createConversion(glslang::TOperator op, spv::Decoration precision, spv::Id destTypeId, spv::Id operand); + spv::Id createConversion(glslang::TOperator op, spv::Decoration precision, spv::Decoration noContraction, spv::Id destTypeId, spv::Id operand, glslang::TBasicType typeProxy); spv::Id makeSmearedConstant(spv::Id constant, int vectorSize); spv::Id createAtomicOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, std::vector& operands, glslang::TBasicType typeProxy); spv::Id createInvocationsOperation(glslang::TOperator, spv::Id typeId, spv::Id operand); @@ -1071,7 +1071,7 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI // it could be a conversion if (! result) - result = createConversion(node->getOp(), precision, convertGlslangToSpvType(node->getType()), operand); + result = createConversion(node->getOp(), precision, noContraction, convertGlslangToSpvType(node->getType()), operand, node->getOperand()->getBasicType()); // if not, then possibly an operation if (! result) @@ -3331,7 +3331,7 @@ spv::Id TGlslangToSpvTraverser::createUnaryMatrixOperation(spv::Op op, spv::Deco return builder.setPrecision(builder.createCompositeConstruct(typeId, results), precision); } -spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Decoration precision, spv::Id destType, spv::Id operand) +spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Decoration precision, spv::Decoration noContraction, spv::Id destType, spv::Id operand, glslang::TBasicType typeProxy) { spv::Op convOp = spv::OpNop; spv::Id zero = 0; @@ -3400,6 +3400,8 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Dec case glslang::EOpConvDoubleToFloat: case glslang::EOpConvFloatToDouble: convOp = spv::OpFConvert; + if (builder.isMatrixType(destType)) + return createUnaryMatrixOperation(convOp, precision, noContraction, destType, operand, typeProxy); break; case glslang::EOpConvFloatToInt: diff --git a/Test/baseResults/spv.matrix.frag.out b/Test/baseResults/spv.matrix.frag.out index 8f0d6463..6a6b672b 100644 --- a/Test/baseResults/spv.matrix.frag.out +++ b/Test/baseResults/spv.matrix.frag.out @@ -1,30 +1,34 @@ spv.matrix.frag +Warning, version 420 is not yet complete; most version-specific features are present, but some are missing. + Linked fragment stage: // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 240 +// Id's are bound by 261 Capability Shader + Capability Float64 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 12 14 28 140 148 166 + EntryPoint Fragment 4 "main" 12 14 28 161 169 187 ExecutionMode 4 OriginUpperLeft - Source GLSL 140 + Source GLSL 420 Name 4 "main" Name 10 "sum34" Name 12 "m1" Name 14 "m2" Name 28 "f" - Name 138 "sum3" - Name 140 "v4" - Name 145 "sum4" - Name 148 "v3" - Name 153 "m43" - Name 158 "m4" - Name 166 "color" + Name 140 "dm" + Name 159 "sum3" + Name 161 "v4" + Name 166 "sum4" + Name 169 "v3" + Name 174 "m43" + Name 179 "m4" + Name 187 "color" 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -37,27 +41,32 @@ Linked fragment stage: 27: TypePointer Input 6(float) 28(f): 27(ptr) Variable Input 81: 6(float) Constant 1065353216 - 136: TypeVector 6(float) 3 - 137: TypePointer Function 136(fvec3) - 139: TypePointer Input 7(fvec4) - 140(v4): 139(ptr) Variable Input - 144: TypePointer Function 7(fvec4) - 147: TypePointer Input 136(fvec3) - 148(v3): 147(ptr) Variable Input - 151: TypeMatrix 136(fvec3) 4 - 152: TypePointer Function 151 - 156: TypeMatrix 7(fvec4) 4 - 157: TypePointer Function 156 - 165: TypePointer Output 7(fvec4) - 166(color): 165(ptr) Variable Output - 187: 6(float) Constant 0 + 136: TypeFloat 64 + 137: TypeVector 136(float) 4 + 138: TypeMatrix 137(fvec4) 3 + 139: TypePointer Function 138 + 157: TypeVector 6(float) 3 + 158: TypePointer Function 157(fvec3) + 160: TypePointer Input 7(fvec4) + 161(v4): 160(ptr) Variable Input + 165: TypePointer Function 7(fvec4) + 168: TypePointer Input 157(fvec3) + 169(v3): 168(ptr) Variable Input + 172: TypeMatrix 157(fvec3) 4 + 173: TypePointer Function 172 + 177: TypeMatrix 7(fvec4) 4 + 178: TypePointer Function 177 + 186: TypePointer Output 7(fvec4) + 187(color): 186(ptr) Variable Output + 208: 6(float) Constant 0 4(main): 2 Function None 3 5: Label 10(sum34): 9(ptr) Variable Function - 138(sum3): 137(ptr) Variable Function - 145(sum4): 144(ptr) Variable Function - 153(m43): 152(ptr) Variable Function - 158(m4): 157(ptr) Variable Function + 140(dm): 139(ptr) Variable Function + 159(sum3): 158(ptr) Variable Function + 166(sum4): 165(ptr) Variable Function + 174(m43): 173(ptr) Variable Function + 179(m4): 178(ptr) Variable Function 13: 8 Load 12(m1) 15: 8 Load 14(m2) 16: 7(fvec4) CompositeExtract 13 0 @@ -185,102 +194,120 @@ Linked fragment stage: 134: 7(fvec4) FSub 133 128 135: 8 CompositeConstruct 130 132 134 Store 10(sum34) 135 - 141: 7(fvec4) Load 140(v4) - 142: 8 Load 14(m2) - 143: 136(fvec3) VectorTimesMatrix 141 142 - Store 138(sum3) 143 - 146: 8 Load 14(m2) - 149: 136(fvec3) Load 148(v3) - 150: 7(fvec4) MatrixTimesVector 146 149 - Store 145(sum4) 150 - 154: 8 Load 10(sum34) - 155: 151 Transpose 154 - Store 153(m43) 155 - 159: 8 Load 12(m1) - 160: 151 Load 153(m43) - 161: 156 MatrixTimesMatrix 159 160 - Store 158(m4) 161 - 162: 7(fvec4) Load 140(v4) - 163: 156 Load 158(m4) - 164: 7(fvec4) VectorTimesMatrix 162 163 - Store 145(sum4) 164 - 167: 7(fvec4) Load 145(sum4) - Store 166(color) 167 - 168: 8 Load 10(sum34) - 169: 7(fvec4) CompositeConstruct 81 81 81 81 - 170: 7(fvec4) CompositeExtract 168 0 - 171: 7(fvec4) FAdd 170 169 - 172: 7(fvec4) CompositeExtract 168 1 - 173: 7(fvec4) FAdd 172 169 - 174: 7(fvec4) CompositeExtract 168 2 - 175: 7(fvec4) FAdd 174 169 - 176: 8 CompositeConstruct 171 173 175 - Store 10(sum34) 176 - 177: 8 Load 10(sum34) - 178: 7(fvec4) CompositeConstruct 81 81 81 81 - 179: 7(fvec4) CompositeExtract 177 0 - 180: 7(fvec4) FSub 179 178 - 181: 7(fvec4) CompositeExtract 177 1 - 182: 7(fvec4) FSub 181 178 - 183: 7(fvec4) CompositeExtract 177 2 - 184: 7(fvec4) FSub 183 178 - 185: 8 CompositeConstruct 180 182 184 - Store 10(sum34) 185 - 186: 6(float) Load 28(f) - 188: 7(fvec4) CompositeConstruct 186 187 187 187 - 189: 7(fvec4) CompositeConstruct 187 186 187 187 - 190: 7(fvec4) CompositeConstruct 187 187 186 187 - 191: 8 CompositeConstruct 188 189 190 - 192: 8 Load 10(sum34) - 193: 7(fvec4) CompositeExtract 192 0 - 194: 7(fvec4) CompositeExtract 191 0 - 195: 7(fvec4) FAdd 193 194 - 196: 7(fvec4) CompositeExtract 192 1 - 197: 7(fvec4) CompositeExtract 191 1 - 198: 7(fvec4) FAdd 196 197 - 199: 7(fvec4) CompositeExtract 192 2 - 200: 7(fvec4) CompositeExtract 191 2 - 201: 7(fvec4) FAdd 199 200 - 202: 8 CompositeConstruct 195 198 201 - Store 10(sum34) 202 - 203: 136(fvec3) Load 148(v3) - 204: 6(float) Load 28(f) - 205: 136(fvec3) Load 148(v3) - 206: 6(float) Load 28(f) - 207: 136(fvec3) Load 148(v3) - 208: 6(float) Load 28(f) - 209: 6(float) CompositeExtract 203 0 - 210: 6(float) CompositeExtract 203 1 - 211: 6(float) CompositeExtract 203 2 - 212: 6(float) CompositeExtract 205 0 - 213: 6(float) CompositeExtract 205 1 - 214: 6(float) CompositeExtract 205 2 - 215: 6(float) CompositeExtract 207 0 - 216: 6(float) CompositeExtract 207 1 - 217: 6(float) CompositeExtract 207 2 - 218: 7(fvec4) CompositeConstruct 209 210 211 204 - 219: 7(fvec4) CompositeConstruct 212 213 214 206 - 220: 7(fvec4) CompositeConstruct 215 216 217 208 - 221: 8 CompositeConstruct 218 219 220 - 222: 8 Load 10(sum34) - 223: 7(fvec4) CompositeExtract 222 0 - 224: 7(fvec4) CompositeExtract 221 0 - 225: 7(fvec4) FAdd 223 224 - 226: 7(fvec4) CompositeExtract 222 1 - 227: 7(fvec4) CompositeExtract 221 1 - 228: 7(fvec4) FAdd 226 227 - 229: 7(fvec4) CompositeExtract 222 2 - 230: 7(fvec4) CompositeExtract 221 2 - 231: 7(fvec4) FAdd 229 230 - 232: 8 CompositeConstruct 225 228 231 - Store 10(sum34) 232 - 233: 136(fvec3) Load 138(sum3) - 234: 151 Load 153(m43) - 235: 7(fvec4) VectorTimesMatrix 233 234 - 236: 7(fvec4) Load 145(sum4) - 237: 7(fvec4) FAdd 235 236 - 238: 7(fvec4) Load 166(color) - 239: 7(fvec4) FAdd 238 237 - Store 166(color) 239 + 141: 8 Load 10(sum34) + 142: 137(fvec4) CompositeExtract 141 0 + 143: 137(fvec4) FConvert 142 + 144: 137(fvec4) CompositeExtract 141 1 + 145: 137(fvec4) FConvert 144 + 146: 137(fvec4) CompositeExtract 141 2 + 147: 137(fvec4) FConvert 146 + 148: 138 CompositeConstruct 143 145 147 + Store 140(dm) 148 + 149: 138 Load 140(dm) + 150: 7(fvec4) CompositeExtract 149 0 + 151: 7(fvec4) FConvert 150 + 152: 7(fvec4) CompositeExtract 149 1 + 153: 7(fvec4) FConvert 152 + 154: 7(fvec4) CompositeExtract 149 2 + 155: 7(fvec4) FConvert 154 + 156: 8 CompositeConstruct 151 153 155 + Store 10(sum34) 156 + 162: 7(fvec4) Load 161(v4) + 163: 8 Load 14(m2) + 164: 157(fvec3) VectorTimesMatrix 162 163 + Store 159(sum3) 164 + 167: 8 Load 14(m2) + 170: 157(fvec3) Load 169(v3) + 171: 7(fvec4) MatrixTimesVector 167 170 + Store 166(sum4) 171 + 175: 8 Load 10(sum34) + 176: 172 Transpose 175 + Store 174(m43) 176 + 180: 8 Load 12(m1) + 181: 172 Load 174(m43) + 182: 177 MatrixTimesMatrix 180 181 + Store 179(m4) 182 + 183: 7(fvec4) Load 161(v4) + 184: 177 Load 179(m4) + 185: 7(fvec4) VectorTimesMatrix 183 184 + Store 166(sum4) 185 + 188: 7(fvec4) Load 166(sum4) + Store 187(color) 188 + 189: 8 Load 10(sum34) + 190: 7(fvec4) CompositeConstruct 81 81 81 81 + 191: 7(fvec4) CompositeExtract 189 0 + 192: 7(fvec4) FAdd 191 190 + 193: 7(fvec4) CompositeExtract 189 1 + 194: 7(fvec4) FAdd 193 190 + 195: 7(fvec4) CompositeExtract 189 2 + 196: 7(fvec4) FAdd 195 190 + 197: 8 CompositeConstruct 192 194 196 + Store 10(sum34) 197 + 198: 8 Load 10(sum34) + 199: 7(fvec4) CompositeConstruct 81 81 81 81 + 200: 7(fvec4) CompositeExtract 198 0 + 201: 7(fvec4) FSub 200 199 + 202: 7(fvec4) CompositeExtract 198 1 + 203: 7(fvec4) FSub 202 199 + 204: 7(fvec4) CompositeExtract 198 2 + 205: 7(fvec4) FSub 204 199 + 206: 8 CompositeConstruct 201 203 205 + Store 10(sum34) 206 + 207: 6(float) Load 28(f) + 209: 7(fvec4) CompositeConstruct 207 208 208 208 + 210: 7(fvec4) CompositeConstruct 208 207 208 208 + 211: 7(fvec4) CompositeConstruct 208 208 207 208 + 212: 8 CompositeConstruct 209 210 211 + 213: 8 Load 10(sum34) + 214: 7(fvec4) CompositeExtract 213 0 + 215: 7(fvec4) CompositeExtract 212 0 + 216: 7(fvec4) FAdd 214 215 + 217: 7(fvec4) CompositeExtract 213 1 + 218: 7(fvec4) CompositeExtract 212 1 + 219: 7(fvec4) FAdd 217 218 + 220: 7(fvec4) CompositeExtract 213 2 + 221: 7(fvec4) CompositeExtract 212 2 + 222: 7(fvec4) FAdd 220 221 + 223: 8 CompositeConstruct 216 219 222 + Store 10(sum34) 223 + 224: 157(fvec3) Load 169(v3) + 225: 6(float) Load 28(f) + 226: 157(fvec3) Load 169(v3) + 227: 6(float) Load 28(f) + 228: 157(fvec3) Load 169(v3) + 229: 6(float) Load 28(f) + 230: 6(float) CompositeExtract 224 0 + 231: 6(float) CompositeExtract 224 1 + 232: 6(float) CompositeExtract 224 2 + 233: 6(float) CompositeExtract 226 0 + 234: 6(float) CompositeExtract 226 1 + 235: 6(float) CompositeExtract 226 2 + 236: 6(float) CompositeExtract 228 0 + 237: 6(float) CompositeExtract 228 1 + 238: 6(float) CompositeExtract 228 2 + 239: 7(fvec4) CompositeConstruct 230 231 232 225 + 240: 7(fvec4) CompositeConstruct 233 234 235 227 + 241: 7(fvec4) CompositeConstruct 236 237 238 229 + 242: 8 CompositeConstruct 239 240 241 + 243: 8 Load 10(sum34) + 244: 7(fvec4) CompositeExtract 243 0 + 245: 7(fvec4) CompositeExtract 242 0 + 246: 7(fvec4) FAdd 244 245 + 247: 7(fvec4) CompositeExtract 243 1 + 248: 7(fvec4) CompositeExtract 242 1 + 249: 7(fvec4) FAdd 247 248 + 250: 7(fvec4) CompositeExtract 243 2 + 251: 7(fvec4) CompositeExtract 242 2 + 252: 7(fvec4) FAdd 250 251 + 253: 8 CompositeConstruct 246 249 252 + Store 10(sum34) 253 + 254: 157(fvec3) Load 159(sum3) + 255: 172 Load 174(m43) + 256: 7(fvec4) VectorTimesMatrix 254 255 + 257: 7(fvec4) Load 166(sum4) + 258: 7(fvec4) FAdd 256 257 + 259: 7(fvec4) Load 187(color) + 260: 7(fvec4) FAdd 259 258 + Store 187(color) 260 Return FunctionEnd diff --git a/Test/spv.matrix.frag b/Test/spv.matrix.frag index c62e9669..10a52566 100644 --- a/Test/spv.matrix.frag +++ b/Test/spv.matrix.frag @@ -1,4 +1,4 @@ -#version 140 +#version 420 in mat3x4 m1; in mat3x4 m2; @@ -11,6 +11,7 @@ out vec4 color; void main() { mat3x4 sum34; + dmat3x4 dm; vec3 sum3; vec4 sum4; @@ -22,6 +23,8 @@ void main() sum34 += f / m1; sum34 += f; sum34 -= f; + dm = dmat3x4(sum34); + sum34 = mat3x4(dm); sum3 = v4 * m2; sum4 = m2 * v3; @@ -33,10 +36,8 @@ void main() color = sum4; -//spv if (m1 != sum34) - ++sum34; -// else - --sum34; + ++sum34; + --sum34; sum34 += mat3x4(f); sum34 += mat3x4(v3, f, v3, f, v3, f); From 62dda787c780d7235e625336f9ce4875bf3e45c0 Mon Sep 17 00:00:00 2001 From: Rex Xu Date: Sat, 14 May 2016 14:21:16 +0800 Subject: [PATCH 087/140] Parser: Add missing vector relational functions for double type. --- Test/baseResults/spv.specConstant.vert.out | 6 +++--- glslang/MachineIndependent/Initialize.cpp | 24 ++++++++++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/Test/baseResults/spv.specConstant.vert.out b/Test/baseResults/spv.specConstant.vert.out index dadab07c..fb7c70a7 100644 --- a/Test/baseResults/spv.specConstant.vert.out +++ b/Test/baseResults/spv.specConstant.vert.out @@ -16,7 +16,7 @@ Linked vertex stage: EntryPoint Vertex 4 "main" 20 22 28 53 Source GLSL 400 Name 4 "main" - Name 14 "foo(vf4[s1498];" + Name 14 "foo(vf4[s1516];" Name 13 "p" Name 17 "builtin_spec_constant(" Name 20 "color" @@ -96,10 +96,10 @@ Linked vertex stage: Store 20(color) 46 48: 10 Load 22(ucol) Store 47(param) 48 - 49: 2 FunctionCall 14(foo(vf4[s1498];) 47(param) + 49: 2 FunctionCall 14(foo(vf4[s1516];) 47(param) Return FunctionEnd -14(foo(vf4[s1498];): 2 Function None 12 +14(foo(vf4[s1516];): 2 Function None 12 13(p): 11(ptr) FunctionParameter 15: Label 54: 24(ptr) AccessChain 53(dupUcol) 23 diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp index 20f7c633..0edb354c 100644 --- a/glslang/MachineIndependent/Initialize.cpp +++ b/glslang/MachineIndependent/Initialize.cpp @@ -629,6 +629,30 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan) "dmat3 inverse(dmat3);" "dmat4 inverse(dmat4);" + "bvec2 lessThan(dvec2, dvec2);" + "bvec3 lessThan(dvec3, dvec3);" + "bvec4 lessThan(dvec4, dvec4);" + + "bvec2 lessThanEqual(dvec2, dvec2);" + "bvec3 lessThanEqual(dvec3, dvec3);" + "bvec4 lessThanEqual(dvec4, dvec4);" + + "bvec2 greaterThan(dvec2, dvec2);" + "bvec3 greaterThan(dvec3, dvec3);" + "bvec4 greaterThan(dvec4, dvec4);" + + "bvec2 greaterThanEqual(dvec2, dvec2);" + "bvec3 greaterThanEqual(dvec3, dvec3);" + "bvec4 greaterThanEqual(dvec4, dvec4);" + + "bvec2 equal(dvec2, dvec2);" + "bvec3 equal(dvec3, dvec3);" + "bvec4 equal(dvec4, dvec4);" + + "bvec2 notEqual(dvec2, dvec2);" + "bvec3 notEqual(dvec3, dvec3);" + "bvec4 notEqual(dvec4, dvec4);" + "\n"); } From f2d75f76e5629d93bddfc16abc5ce6aead814641 Mon Sep 17 00:00:00 2001 From: baldurk Date: Sat, 14 May 2016 14:57:41 +0200 Subject: [PATCH 088/140] Use DetachThreadLinux wrapper on android * Fixes a warning - static function being defined but not used. * Just in case any more code is added to DetachThreadLinux, this will go through the same path on both platforms. --- glslang/OSDependent/Unix/ossource.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glslang/OSDependent/Unix/ossource.cpp b/glslang/OSDependent/Unix/ossource.cpp index 3bd725ea..123e0869 100644 --- a/glslang/OSDependent/Unix/ossource.cpp +++ b/glslang/OSDependent/Unix/ossource.cpp @@ -69,7 +69,7 @@ static void DetachThreadLinux(void *) void OS_CleanupThreadData(void) { #ifdef __ANDROID__ - DetachThread(); + DetachThreadLinux(NULL); #else int old_cancel_state, old_cancel_type; void *cleanupArg = NULL; From d6f0ed2c811c09a6c4f4f80f749b16afe8a17000 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 16 May 2016 12:50:30 -0400 Subject: [PATCH 089/140] Add support for testing file-based HLSL source code in GTest. --- gtests/AST.FromFile.cpp | 5 ++- gtests/CMakeLists.txt | 1 + gtests/Hlsl.FromFile.cpp | 81 ++++++++++++++++++++++++++++++++++++++++ gtests/Initializer.h | 2 +- gtests/Pp.FromFile.cpp | 2 +- gtests/Spv.FromFile.cpp | 10 +++-- gtests/TestFixture.cpp | 24 ++++++++---- gtests/TestFixture.h | 55 +++++++++++++++------------ 8 files changed, 142 insertions(+), 38 deletions(-) create mode 100644 gtests/Hlsl.FromFile.cpp diff --git a/gtests/AST.FromFile.cpp b/gtests/AST.FromFile.cpp index 5e0b31e9..3f4819a3 100644 --- a/gtests/AST.FromFile.cpp +++ b/gtests/AST.FromFile.cpp @@ -44,7 +44,8 @@ using CompileToAstTest = GlslangTest<::testing::TestWithParam>; TEST_P(CompileToAstTest, FromFile) { loadFileCompileAndCheck(GLSLANG_TEST_DIRECTORY, GetParam(), - Semantics::OpenGL, Target::AST); + Source::GLSL, Semantics::OpenGL, + Target::AST); } // clang-format off @@ -183,7 +184,7 @@ INSTANTIATE_TEST_CASE_P( "nonVulkan.frag", "spv.atomic.comp", })), - FileNameAsCustomTestName + FileNameAsCustomTestSuffix ); // clang-format on diff --git a/gtests/CMakeLists.txt b/gtests/CMakeLists.txt index de04ecee..d247a914 100644 --- a/gtests/CMakeLists.txt +++ b/gtests/CMakeLists.txt @@ -13,6 +13,7 @@ if (TARGET gmock) # Test related source files ${CMAKE_CURRENT_SOURCE_DIR}/AST.FromFile.cpp ${CMAKE_CURRENT_SOURCE_DIR}/BuiltInResource.FromFile.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Hlsl.FromFile.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Pp.FromFile.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Spv.FromFile.cpp ) diff --git a/gtests/Hlsl.FromFile.cpp b/gtests/Hlsl.FromFile.cpp new file mode 100644 index 00000000..6105185b --- /dev/null +++ b/gtests/Hlsl.FromFile.cpp @@ -0,0 +1,81 @@ +// +// Copyright (C) 2016 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 Google Inc. 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 "TestFixture.h" + +namespace glslangtest { +namespace { + +struct FileNameEntryPointPair { + const char* fileName; + const char* entryPoint; +}; + +// We are using FileNameEntryPointPair objects as parameters for instantiating +// the template, so the global FileNameAsCustomTestSuffix() won't work since +// it assumes std::string as parameters. Thus, an overriding one here. +std::string FileNameAsCustomTestSuffix( + const ::testing::TestParamInfo& info) { + std::string name = info.param.fileName; + // A valid test case suffix cannot have '.' and '-' inside. + std::replace(name.begin(), name.end(), '.', '_'); + std::replace(name.begin(), name.end(), '-', '_'); + return name; +} + +using HlslCompileTest = GlslangTest<::testing::TestWithParam>; + +// Compiling HLSL to SPIR-V under Vulkan semantics. Expected to successfully +// generate SPIR-V. +TEST_P(HlslCompileTest, FromFile) +{ + loadFileCompileAndCheck(GLSLANG_TEST_DIRECTORY, GetParam().fileName, + Source::HLSL, Semantics::Vulkan, + Target::BothASTAndSpv, GetParam().entryPoint); +} + +// clang-format off +INSTANTIATE_TEST_CASE_P( + ToSpirv, HlslCompileTest, + ::testing::ValuesIn(std::vector{ + {"hlsl.frag", "PixelShaderFunction"}, + }), + FileNameAsCustomTestSuffix +); +// clang-format on + +} // anonymous namespace +} // namespace glslangtest diff --git a/gtests/Initializer.h b/gtests/Initializer.h index 3cd91a08..3cafb52a 100644 --- a/gtests/Initializer.h +++ b/gtests/Initializer.h @@ -69,7 +69,7 @@ public: InitializationToken acquire(EShMessages new_messages) { if ((lastMessages ^ new_messages) & - (EShMsgVulkanRules | EShMsgSpvRules)) { + (EShMsgVulkanRules | EShMsgSpvRules | EShMsgReadHlsl)) { glslang::FinalizeProcess(); glslang::InitializeProcess(); } diff --git a/gtests/Pp.FromFile.cpp b/gtests/Pp.FromFile.cpp index cfd987ba..01bdfc32 100644 --- a/gtests/Pp.FromFile.cpp +++ b/gtests/Pp.FromFile.cpp @@ -66,7 +66,7 @@ INSTANTIATE_TEST_CASE_P( "preprocessor.defined.vert", "preprocessor.many.endif.vert", })), - FileNameAsCustomTestName + FileNameAsCustomTestSuffix ); // clang-format on diff --git a/gtests/Spv.FromFile.cpp b/gtests/Spv.FromFile.cpp index 8a4d0e25..04e204e3 100644 --- a/gtests/Spv.FromFile.cpp +++ b/gtests/Spv.FromFile.cpp @@ -49,7 +49,8 @@ using VulkanSemantics = GlslangTest<::testing::TestWithParam>; TEST_P(CompileToSpirvTest, FromFile) { loadFileCompileAndCheck(GLSLANG_TEST_DIRECTORY, GetParam(), - Semantics::Vulkan, Target::Spirv); + Source::GLSL, Semantics::Vulkan, + Target::Spv); } // GLSL-level Vulkan semantics test. Expected to error out before generating @@ -57,7 +58,8 @@ TEST_P(CompileToSpirvTest, FromFile) TEST_P(VulkanSemantics, FromFile) { loadFileCompileAndCheck(GLSLANG_TEST_DIRECTORY, GetParam(), - Semantics::Vulkan, Target::Spirv); + Source::GLSL, Semantics::Vulkan, + Target::Spv); } // clang-format off @@ -173,7 +175,7 @@ INSTANTIATE_TEST_CASE_P( "spv.specConstant.comp", "spv.specConstantComposite.vert", })), - FileNameAsCustomTestName + FileNameAsCustomTestSuffix ); INSTANTIATE_TEST_CASE_P( @@ -183,7 +185,7 @@ INSTANTIATE_TEST_CASE_P( "vulkan.vert", "vulkan.comp", })), - FileNameAsCustomTestName + FileNameAsCustomTestSuffix ); // clang-format on diff --git a/gtests/TestFixture.cpp b/gtests/TestFixture.cpp index 744fa558..ca128174 100644 --- a/gtests/TestFixture.cpp +++ b/gtests/TestFixture.cpp @@ -36,7 +36,7 @@ namespace glslangtest { -std::string FileNameAsCustomTestName( +std::string FileNameAsCustomTestSuffix( const ::testing::TestParamInfo& info) { std::string name = info.param; @@ -46,7 +46,7 @@ std::string FileNameAsCustomTestName( return name; } -EShLanguage GetGlslLanguageForStage(const std::string& stage) +EShLanguage GetShaderStage(const std::string& stage) { if (stage == "vert") { return EShLangVertex; @@ -66,17 +66,27 @@ EShLanguage GetGlslLanguageForStage(const std::string& stage) } } -EShMessages GetSpirvMessageOptionsForSemanticsAndTarget(Semantics semantics, - Target target) +EShMessages DeriveOptions(Source source, Semantics semantics, Target target) { EShMessages result = EShMsgDefault; + switch (source) { + case Source::GLSL: + break; + case Source::HLSL: + result = EShMsgReadHlsl; + break; + } + switch (target) { case Target::AST: - result = EShMsgAST; + result = static_cast(result | EShMsgAST); break; - case Target::Spirv: - result = EShMsgSpvRules; + case Target::Spv: + result = static_cast(result | EShMsgSpvRules); + break; + case Target::BothASTAndSpv: + result = static_cast(result | EShMsgSpvRules | EShMsgAST); break; }; diff --git a/gtests/TestFixture.h b/gtests/TestFixture.h index 8f744441..a13a50b3 100644 --- a/gtests/TestFixture.h +++ b/gtests/TestFixture.h @@ -65,9 +65,14 @@ namespace glslangtest { // This function is used to provide custom test name suffixes based on the // shader source file names. Otherwise, the test name suffixes will just be // numbers, which are not quite obvious. -std::string FileNameAsCustomTestName( +std::string FileNameAsCustomTestSuffix( const ::testing::TestParamInfo& info); +enum class Source { + GLSL, + HLSL, +}; + // Enum for shader compilation semantics. enum class Semantics { OpenGL, @@ -77,13 +82,13 @@ enum class Semantics { // Enum for compilation target. enum class Target { AST, - Spirv, + Spv, + BothASTAndSpv, }; -EShLanguage GetGlslLanguageForStage(const std::string& stage); +EShLanguage GetShaderStage(const std::string& stage); -EShMessages GetSpirvMessageOptionsForSemanticsAndTarget(Semantics semantics, - Target target); +EShMessages DeriveOptions(Source, Semantics, Target); // Reads the content of the file at the given |path|. On success, returns true // and the contents; otherwise, returns false and an empty string. @@ -160,23 +165,23 @@ public: const std::string spirv; // Optional SPIR-V disassembly text. }; - // Compiles and linkes the given GLSL |source| code of the given shader + // Compiles and linkes the given source |code| of the given shader // |stage| into the given |target| under the given |semantics|. Returns // a GlslangResult instance containing all the information generated // during the process. If |target| is Target::Spirv, also disassembles // the result and returns disassembly text. - GlslangResult compileGlsl(const std::string& source, - const std::string& stage, Semantics semantics, - Target target) + GlslangResult compile(const std::string& code, Source source, + const std::string& stage, Semantics semantics, + Target target, const std::string& entryPointName) { - const char* shaderStrings = source.data(); - const int shaderLengths = static_cast(source.size()); - const EShLanguage language = GetGlslLanguageForStage(stage); + const char* shaderStrings = code.data(); + const int shaderLengths = static_cast(code.size()); + const EShLanguage kind = GetShaderStage(stage); - glslang::TShader shader(language); + glslang::TShader shader(kind); shader.setStringsWithLengths(&shaderStrings, &shaderLengths, 1); - const EShMessages messages = - GetSpirvMessageOptionsForSemanticsAndTarget(semantics, target); + if (!entryPointName.empty()) shader.setEntryPoint(entryPointName.c_str()); + const EShMessages messages = DeriveOptions(source, semantics, target); // Reinitialize glslang if the semantics change. GlslangInitializer::InitializationToken token = GlobalTestSettings.initializer->acquire(messages); @@ -190,9 +195,9 @@ public: spv::SpvBuildLogger logger; - if (success && target == Target::Spirv) { + if (success && (target == Target::Spv || target == Target::BothASTAndSpv)) { std::vector spirv_binary; - glslang::GlslangToSpv(*program.getIntermediate(language), + glslang::GlslangToSpv(*program.getIntermediate(kind), spirv_binary, &logger); std::ostringstream disassembly_stream; @@ -210,7 +215,10 @@ public: void loadFileCompileAndCheck(const std::string& testDir, const std::string& testName, - Semantics semantics, Target target) + Source source, + Semantics semantics, + Target target, + const std::string& entryPointName="") { const std::string inputFname = testDir + "/" + testName; const std::string expectedOutputFname = @@ -221,7 +229,8 @@ public: tryLoadFile(expectedOutputFname, "expected output", &expectedOutput); GlslangResult result = - compileGlsl(input, GetSuffix(testName), semantics, target); + compile(input, source, GetSuffix(testName), + semantics, target, entryPointName); // Generate the hybrid output in the way of glslangValidator. std::ostringstream stream; @@ -236,7 +245,7 @@ public: outputIfNotEmpty(result.linkingOutput); outputIfNotEmpty(result.linkingError); stream << result.spirvWarningsErrors; - if (target == Target::Spirv) { + if (target == Target::Spv || target == Target::BothASTAndSpv) { stream << (result.spirv.empty() ? "SPIR-V is not generated for failed compile or link\n" @@ -247,10 +256,10 @@ public: expectedOutputFname); } - // Preprocesses the given GLSL |source| code. On success, returns true, the + // Preprocesses the given |source| code. On success, returns true, the // preprocessed shader, and warning messages. Otherwise, returns false, an // empty string, and error messages. - std::tuple preprocessGlsl( + std::tuple preprocess( const std::string& source) { const char* shaderStrings = source.data(); @@ -290,7 +299,7 @@ public: bool ppOk; std::string output, error; - std::tie(ppOk, output, error) = preprocessGlsl(input); + std::tie(ppOk, output, error) = preprocess(input); if (!output.empty()) output += '\n'; if (!error.empty()) error += '\n'; From 786cf4dc483c8959adfbe3487e75391050837817 Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 17 May 2016 01:16:46 +0200 Subject: [PATCH 090/140] [VS2010] Change "using X = Y;" to "typedef Y X;" --- glslang/MachineIndependent/propagateNoContraction.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/glslang/MachineIndependent/propagateNoContraction.cpp b/glslang/MachineIndependent/propagateNoContraction.cpp index 24e47a74..743a676e 100644 --- a/glslang/MachineIndependent/propagateNoContraction.cpp +++ b/glslang/MachineIndependent/propagateNoContraction.cpp @@ -58,7 +58,7 @@ namespace { // For members of vector, matrix and arrays, they will be represented with the // same symbol ID of their container symbol objects. This is because their // precise'ness is always the same as their container symbol objects. -using ObjectAccessChain = std::string; +typedef std::string ObjectAccessChain; // The delimiter used in the ObjectAccessChain string to separate symbol ID and // different level of struct indices. @@ -66,14 +66,14 @@ const char ObjectAccesschainDelimiter = '/'; // Mapping from Symbol IDs of symbol nodes, to their defining operation // nodes. -using NodeMapping = std::unordered_multimap; +typedef std::unordered_multimap NodeMapping; // Mapping from object nodes to their accesschain info string. -using AccessChainMapping = std::unordered_map; +typedef std::unordered_map AccessChainMapping; // Set of object IDs. -using ObjectAccesschainSet = std::unordered_set; +typedef std::unordered_set ObjectAccesschainSet; // Set of return branch nodes. -using ReturnBranchNodeSet = std::unordered_set; +typedef std::unordered_set ReturnBranchNodeSet; // A helper function to tell whether a node is 'noContraction'. Returns true if // the node has 'noContraction' qualifier, otherwise false. From c1d81cb171546191ce91ec14a9f5222bbc77c030 Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 17 May 2016 01:17:06 +0200 Subject: [PATCH 091/140] [VS2010] Remove use of "= default" and "= delete" --- SPIRV/Logger.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SPIRV/Logger.h b/SPIRV/Logger.h index 15b5e354..2e4ddaf5 100644 --- a/SPIRV/Logger.h +++ b/SPIRV/Logger.h @@ -44,8 +44,7 @@ namespace spv { // missing/TBD functionalities, warnings, and errors. class SpvBuildLogger { public: - SpvBuildLogger() = default; - SpvBuildLogger(const SpvBuildLogger&) = delete; + SpvBuildLogger() {} // Registers a TBD functionality. void tbdFunctionality(const std::string& f); @@ -62,6 +61,8 @@ public: std::string getAllMessages() const; private: + SpvBuildLogger(const SpvBuildLogger&); + std::vector tbdFeatures; std::vector missingFeatures; std::vector warnings; From ab44ba757ed97c399c4ad82af1240e00f53e8c61 Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 17 May 2016 01:19:23 +0200 Subject: [PATCH 092/140] [VS2010] Remove use of ranged-for loops --- SPIRV/Logger.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/SPIRV/Logger.cpp b/SPIRV/Logger.cpp index 7edf4265..48bd4e3a 100644 --- a/SPIRV/Logger.cpp +++ b/SPIRV/Logger.cpp @@ -54,14 +54,14 @@ void SpvBuildLogger::missingFunctionality(const std::string& f) std::string SpvBuildLogger::getAllMessages() const { std::ostringstream messages; - for (const auto& f : tbdFeatures) - messages << "TBD functionality: " << f << "\n"; - for (const auto& f : missingFeatures) - messages << "Missing functionality: " << f << "\n"; - for (const auto& w : warnings) - messages << "warning: " << w << "\n"; - for (const auto& e : errors) - messages << "error: " << e << "\n"; + for (auto it = tbdFeatures.cbegin(); it != tbdFeatures.cend(); ++it) + messages << "TBD functionality: " << *it << "\n"; + for (auto it = missingFeatures.cbegin(); it != missingFeatures.cend(); ++it) + messages << "Missing functionality: " << *it << "\n"; + for (auto it = warnings.cbegin(); it != warnings.cend(); ++it) + messages << "warning: " << *it << "\n"; + for (auto it = errors.cbegin(); it != errors.cend(); ++it) + messages << "error: " << *it << "\n"; return messages.str(); } From bf2c88b6d133d94bebdb5846de77f9c1087b43b5 Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 17 May 2016 01:23:57 +0200 Subject: [PATCH 093/140] [VS2010] Locally define std::to_string on VS2010 as well as android --- glslang/Include/Common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glslang/Include/Common.h b/glslang/Include/Common.h index 2872fac8..3825253d 100644 --- a/glslang/Include/Common.h +++ b/glslang/Include/Common.h @@ -51,7 +51,7 @@ #define UINT_PTR uintptr_t #endif -#ifdef __ANDROID__ +#if defined(__ANDROID__) || _MSC_VER < 1700 #include namespace std { template From a8018b8ee516f02657617ae72a0d3f745b721efd Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 17 May 2016 01:28:44 +0200 Subject: [PATCH 094/140] [VS2010] Define strtoll() and atoll() functions --- glslang/Include/Common.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/glslang/Include/Common.h b/glslang/Include/Common.h index 3825253d..e5c18b99 100644 --- a/glslang/Include/Common.h +++ b/glslang/Include/Common.h @@ -62,6 +62,18 @@ std::string to_string(const T& val) { } } #endif + +#if _MSC_VER < 1700 +inline long long int strtoll (const char* str, char** endptr, int base) +{ + return _strtoi64(str, endptr, base); +} +inline long long int atoll (const char* str) +{ + return strtoll(str, NULL, 10); +} +#endif + /* windows only pragma */ #ifdef _MSC_VER #pragma warning(disable : 4786) // Don't warn about too long identifiers From 6b32ae18fa36f471982bfc537e19bb21703a56c6 Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 17 May 2016 01:38:56 +0200 Subject: [PATCH 095/140] Compile fix - if _MSC_VER is undefined, _MSC_VER < 1700 is true! --- glslang/Include/Common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glslang/Include/Common.h b/glslang/Include/Common.h index e5c18b99..05c8447f 100644 --- a/glslang/Include/Common.h +++ b/glslang/Include/Common.h @@ -63,7 +63,7 @@ std::string to_string(const T& val) { } #endif -#if _MSC_VER < 1700 +#if defined(_MSC_VER) && _MSC_VER < 1700 inline long long int strtoll (const char* str, char** endptr, int base) { return _strtoi64(str, endptr, base); From e5f29393da1c624e22b7bde9b51d5f3678d73859 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Mon, 16 May 2016 17:39:50 -0600 Subject: [PATCH 096/140] Tests: Add a set of gtest-file-based HLSL tests. --- Test/baseResults/hlsl.assoc.frag.out | 113 +++++++++++++++++++++ Test/baseResults/hlsl.float4.frag.out | 79 ++++++++++++++ Test/baseResults/hlsl.max.frag.out | 60 +++++++++++ Test/baseResults/hlsl.precedence.frag.out | 80 +++++++++++++++ Test/baseResults/hlsl.precedence2.frag.out | 103 +++++++++++++++++++ Test/baseResults/hlsl.sin.frag.out | 53 ++++++++++ Test/hlsl.assoc.frag | 11 ++ Test/hlsl.float4.frag | 6 ++ Test/hlsl.max.frag | 4 + Test/hlsl.precedence.frag | 9 ++ Test/hlsl.precedence2.frag | 9 ++ Test/hlsl.sin.frag | 4 + gtests/Hlsl.FromFile.cpp | 7 +- 13 files changed, 537 insertions(+), 1 deletion(-) create mode 100755 Test/baseResults/hlsl.assoc.frag.out create mode 100755 Test/baseResults/hlsl.float4.frag.out create mode 100755 Test/baseResults/hlsl.max.frag.out create mode 100755 Test/baseResults/hlsl.precedence.frag.out create mode 100755 Test/baseResults/hlsl.precedence2.frag.out create mode 100755 Test/baseResults/hlsl.sin.frag.out create mode 100644 Test/hlsl.assoc.frag create mode 100644 Test/hlsl.float4.frag create mode 100644 Test/hlsl.max.frag create mode 100644 Test/hlsl.precedence.frag create mode 100644 Test/hlsl.precedence2.frag create mode 100644 Test/hlsl.sin.frag diff --git a/Test/baseResults/hlsl.assoc.frag.out b/Test/baseResults/hlsl.assoc.frag.out new file mode 100755 index 00000000..0bba2ee2 --- /dev/null +++ b/Test/baseResults/hlsl.assoc.frag.out @@ -0,0 +1,113 @@ +hlsl.assoc.frag +Shader version: 100 +gl_FragCoord origin is upper left +0:? Sequence +0:12 Function Definition: PixelShaderFunction(vf4;vf4;vf4;vf4;vf4; (temp 4-component vector of float) +0:8 Function Parameters: +0:8 'a1' (temp 4-component vector of float) +0:8 'a2' (temp 4-component vector of float) +0:8 'a3' (temp 4-component vector of float) +0:8 'a4' (temp 4-component vector of float) +0:8 'a5' (temp 4-component vector of float) +0:? Sequence +0:9 move second child to first child (temp 4-component vector of float) +0:9 'a1' (temp 4-component vector of float) +0:9 move second child to first child (temp 4-component vector of float) +0:9 'a2' (temp 4-component vector of float) +0:9 move second child to first child (temp 4-component vector of float) +0:9 'a3' (temp 4-component vector of float) +0:9 move second child to first child (temp 4-component vector of float) +0:9 'a4' (temp 4-component vector of float) +0:9 'a5' (temp 4-component vector of float) +0:10 Branch: Return with expression +0:10 add (temp 4-component vector of float) +0:10 add (temp 4-component vector of float) +0:10 add (temp 4-component vector of float) +0:10 'a1' (temp 4-component vector of float) +0:10 'a2' (temp 4-component vector of float) +0:10 add (temp 4-component vector of float) +0:10 'a3' (temp 4-component vector of float) +0:10 'a4' (temp 4-component vector of float) +0:10 'a5' (temp 4-component vector of float) +0:? Linker Objects + + +Linked fragment stage: + + +Shader version: 100 +gl_FragCoord origin is upper left +0:? Sequence +0:12 Function Definition: PixelShaderFunction(vf4;vf4;vf4;vf4;vf4; (temp 4-component vector of float) +0:8 Function Parameters: +0:8 'a1' (temp 4-component vector of float) +0:8 'a2' (temp 4-component vector of float) +0:8 'a3' (temp 4-component vector of float) +0:8 'a4' (temp 4-component vector of float) +0:8 'a5' (temp 4-component vector of float) +0:? Sequence +0:9 move second child to first child (temp 4-component vector of float) +0:9 'a1' (temp 4-component vector of float) +0:9 move second child to first child (temp 4-component vector of float) +0:9 'a2' (temp 4-component vector of float) +0:9 move second child to first child (temp 4-component vector of float) +0:9 'a3' (temp 4-component vector of float) +0:9 move second child to first child (temp 4-component vector of float) +0:9 'a4' (temp 4-component vector of float) +0:9 'a5' (temp 4-component vector of float) +0:10 Branch: Return with expression +0:10 add (temp 4-component vector of float) +0:10 add (temp 4-component vector of float) +0:10 add (temp 4-component vector of float) +0:10 'a1' (temp 4-component vector of float) +0:10 'a2' (temp 4-component vector of float) +0:10 add (temp 4-component vector of float) +0:10 'a3' (temp 4-component vector of float) +0:10 'a4' (temp 4-component vector of float) +0:10 'a5' (temp 4-component vector of float) +0:? Linker Objects + +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 25 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "PixelShaderFunction" + ExecutionMode 4 OriginUpperLeft + Source HLSL 100 + Name 4 "PixelShaderFunction" + Name 9 "a1" + Name 10 "a2" + Name 11 "a3" + Name 12 "a4" + Name 13 "a5" + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypePointer Function 7(fvec4) +4(PixelShaderFunction): 2 Function None 3 + 5: Label + 9(a1): 8(ptr) Variable Function + 10(a2): 8(ptr) Variable Function + 11(a3): 8(ptr) Variable Function + 12(a4): 8(ptr) Variable Function + 13(a5): 8(ptr) Variable Function + 14: 7(fvec4) Load 13(a5) + Store 12(a4) 14 + Store 11(a3) 14 + Store 10(a2) 14 + Store 9(a1) 14 + 15: 7(fvec4) Load 9(a1) + 16: 7(fvec4) Load 10(a2) + 17: 7(fvec4) FAdd 15 16 + 18: 7(fvec4) Load 11(a3) + 19: 7(fvec4) Load 12(a4) + 20: 7(fvec4) FAdd 18 19 + 21: 7(fvec4) FAdd 17 20 + 22: 7(fvec4) Load 13(a5) + 23: 7(fvec4) FAdd 21 22 + ReturnValue 23 + FunctionEnd diff --git a/Test/baseResults/hlsl.float4.frag.out b/Test/baseResults/hlsl.float4.frag.out new file mode 100755 index 00000000..c827f4d2 --- /dev/null +++ b/Test/baseResults/hlsl.float4.frag.out @@ -0,0 +1,79 @@ +hlsl.float4.frag +Shader version: 100 +gl_FragCoord origin is upper left +0:? Sequence +0:1 move second child to first child (temp 4-component vector of float) +0:1 'AmbientColor' (temp 4-component vector of float) +0:? Constant: +0:? 1.000000 +0:? 0.500000 +0:? 0.000000 +0:? 1.000000 +0:7 Function Definition: ShaderFunction(vf4; (temp 4-component vector of float) +0:4 Function Parameters: +0:4 'input' (temp 4-component vector of float) +0:? Sequence +0:5 Branch: Return with expression +0:5 component-wise multiply (temp 4-component vector of float) +0:5 'input' (temp 4-component vector of float) +0:5 'AmbientColor' (temp 4-component vector of float) +0:? Linker Objects +0:? 'AmbientColor' (temp 4-component vector of float) + + +Linked fragment stage: + + +Shader version: 100 +gl_FragCoord origin is upper left +0:? Sequence +0:1 move second child to first child (temp 4-component vector of float) +0:1 'AmbientColor' (temp 4-component vector of float) +0:? Constant: +0:? 1.000000 +0:? 0.500000 +0:? 0.000000 +0:? 1.000000 +0:7 Function Definition: ShaderFunction(vf4; (temp 4-component vector of float) +0:4 Function Parameters: +0:4 'input' (temp 4-component vector of float) +0:? Sequence +0:5 Branch: Return with expression +0:5 component-wise multiply (temp 4-component vector of float) +0:5 'input' (temp 4-component vector of float) +0:5 'AmbientColor' (temp 4-component vector of float) +0:? Linker Objects +0:? 'AmbientColor' (temp 4-component vector of float) + +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 19 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "PixelShaderFunction" + ExecutionMode 4 OriginUpperLeft + Source HLSL 100 + Name 4 "PixelShaderFunction" + Name 11 "ShaderFunction(vf4;" + Name 10 "input" + Name 14 "AmbientColor" + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypePointer Function 7(fvec4) + 9: TypeFunction 7(fvec4) 8(ptr) +4(PixelShaderFunction): 2 Function None 3 + 5: Label + FunctionEnd +11(ShaderFunction(vf4;): 7(fvec4) Function None 9 + 10(input): 8(ptr) FunctionParameter + 12: Label +14(AmbientColor): 8(ptr) Variable Function + 13: 7(fvec4) Load 10(input) + 15: 7(fvec4) Load 14(AmbientColor) + 16: 7(fvec4) FMul 13 15 + ReturnValue 16 + FunctionEnd diff --git a/Test/baseResults/hlsl.max.frag.out b/Test/baseResults/hlsl.max.frag.out new file mode 100755 index 00000000..addc965c --- /dev/null +++ b/Test/baseResults/hlsl.max.frag.out @@ -0,0 +1,60 @@ +hlsl.max.frag +Shader version: 100 +gl_FragCoord origin is upper left +0:? Sequence +0:5 Function Definition: PixelShaderFunction(vf4;vf4; (temp 4-component vector of float) +0:2 Function Parameters: +0:2 'input1' (temp 4-component vector of float) +0:2 'input2' (temp 4-component vector of float) +0:? Sequence +0:3 Branch: Return with expression +0:3 max (global 4-component vector of float) +0:3 'input1' (temp 4-component vector of float) +0:3 'input2' (temp 4-component vector of float) +0:? Linker Objects + + +Linked fragment stage: + + +Shader version: 100 +gl_FragCoord origin is upper left +0:? Sequence +0:5 Function Definition: PixelShaderFunction(vf4;vf4; (temp 4-component vector of float) +0:2 Function Parameters: +0:2 'input1' (temp 4-component vector of float) +0:2 'input2' (temp 4-component vector of float) +0:? Sequence +0:3 Branch: Return with expression +0:3 max (global 4-component vector of float) +0:3 'input1' (temp 4-component vector of float) +0:3 'input2' (temp 4-component vector of float) +0:? Linker Objects + +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 15 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "PixelShaderFunction" + ExecutionMode 4 OriginUpperLeft + Source HLSL 100 + Name 4 "PixelShaderFunction" + Name 9 "input1" + Name 11 "input2" + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypePointer Function 7(fvec4) +4(PixelShaderFunction): 2 Function None 3 + 5: Label + 9(input1): 8(ptr) Variable Function + 11(input2): 8(ptr) Variable Function + 10: 7(fvec4) Load 9(input1) + 12: 7(fvec4) Load 11(input2) + 13: 7(fvec4) ExtInst 1(GLSL.std.450) 40(FMax) 10 12 + ReturnValue 13 + FunctionEnd diff --git a/Test/baseResults/hlsl.precedence.frag.out b/Test/baseResults/hlsl.precedence.frag.out new file mode 100755 index 00000000..fc31f4b2 --- /dev/null +++ b/Test/baseResults/hlsl.precedence.frag.out @@ -0,0 +1,80 @@ +hlsl.precedence.frag +Shader version: 100 +gl_FragCoord origin is upper left +0:? Sequence +0:10 Function Definition: PixelShaderFunction(vf4;vf4;vf4;vf4; (temp 4-component vector of float) +0:7 Function Parameters: +0:7 'a1' (temp 4-component vector of float) +0:7 'a2' (temp 4-component vector of float) +0:7 'a3' (temp 4-component vector of float) +0:7 'a4' (temp 4-component vector of float) +0:? Sequence +0:8 Branch: Return with expression +0:8 add (temp 4-component vector of float) +0:8 add (temp 4-component vector of float) +0:8 'a1' (temp 4-component vector of float) +0:8 component-wise multiply (temp 4-component vector of float) +0:8 'a2' (temp 4-component vector of float) +0:8 'a3' (temp 4-component vector of float) +0:8 'a4' (temp 4-component vector of float) +0:? Linker Objects + + +Linked fragment stage: + + +Shader version: 100 +gl_FragCoord origin is upper left +0:? Sequence +0:10 Function Definition: PixelShaderFunction(vf4;vf4;vf4;vf4; (temp 4-component vector of float) +0:7 Function Parameters: +0:7 'a1' (temp 4-component vector of float) +0:7 'a2' (temp 4-component vector of float) +0:7 'a3' (temp 4-component vector of float) +0:7 'a4' (temp 4-component vector of float) +0:? Sequence +0:8 Branch: Return with expression +0:8 add (temp 4-component vector of float) +0:8 add (temp 4-component vector of float) +0:8 'a1' (temp 4-component vector of float) +0:8 component-wise multiply (temp 4-component vector of float) +0:8 'a2' (temp 4-component vector of float) +0:8 'a3' (temp 4-component vector of float) +0:8 'a4' (temp 4-component vector of float) +0:? Linker Objects + +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 21 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "PixelShaderFunction" + ExecutionMode 4 OriginUpperLeft + Source HLSL 100 + Name 4 "PixelShaderFunction" + Name 9 "a1" + Name 11 "a2" + Name 13 "a3" + Name 17 "a4" + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypePointer Function 7(fvec4) +4(PixelShaderFunction): 2 Function None 3 + 5: Label + 9(a1): 8(ptr) Variable Function + 11(a2): 8(ptr) Variable Function + 13(a3): 8(ptr) Variable Function + 17(a4): 8(ptr) Variable Function + 10: 7(fvec4) Load 9(a1) + 12: 7(fvec4) Load 11(a2) + 14: 7(fvec4) Load 13(a3) + 15: 7(fvec4) FMul 12 14 + 16: 7(fvec4) FAdd 10 15 + 18: 7(fvec4) Load 17(a4) + 19: 7(fvec4) FAdd 16 18 + ReturnValue 19 + FunctionEnd diff --git a/Test/baseResults/hlsl.precedence2.frag.out b/Test/baseResults/hlsl.precedence2.frag.out new file mode 100755 index 00000000..fc4ae025 --- /dev/null +++ b/Test/baseResults/hlsl.precedence2.frag.out @@ -0,0 +1,103 @@ +hlsl.precedence2.frag +Shader version: 100 +gl_FragCoord origin is upper left +0:? Sequence +0:10 Function Definition: PixelShaderFunction(i1;i1;i1;i1; (temp int) +0:7 Function Parameters: +0:7 'a1' (temp int) +0:7 'a2' (temp int) +0:7 'a3' (temp int) +0:7 'a4' (temp int) +0:? Sequence +0:8 Branch: Return with expression +0:8 add (temp int) +0:8 left-shift (temp int) +0:8 add (temp int) +0:8 component-wise multiply (temp int) +0:8 'a1' (temp int) +0:8 'a2' (temp int) +0:8 'a3' (temp int) +0:8 'a4' (temp int) +0:8 left-shift (temp int) +0:8 'a1' (temp int) +0:8 add (temp int) +0:8 'a2' (temp int) +0:8 component-wise multiply (temp int) +0:8 'a3' (temp int) +0:8 'a4' (temp int) +0:? Linker Objects + + +Linked fragment stage: + + +Shader version: 100 +gl_FragCoord origin is upper left +0:? Sequence +0:10 Function Definition: PixelShaderFunction(i1;i1;i1;i1; (temp int) +0:7 Function Parameters: +0:7 'a1' (temp int) +0:7 'a2' (temp int) +0:7 'a3' (temp int) +0:7 'a4' (temp int) +0:? Sequence +0:8 Branch: Return with expression +0:8 add (temp int) +0:8 left-shift (temp int) +0:8 add (temp int) +0:8 component-wise multiply (temp int) +0:8 'a1' (temp int) +0:8 'a2' (temp int) +0:8 'a3' (temp int) +0:8 'a4' (temp int) +0:8 left-shift (temp int) +0:8 'a1' (temp int) +0:8 add (temp int) +0:8 'a2' (temp int) +0:8 component-wise multiply (temp int) +0:8 'a3' (temp int) +0:8 'a4' (temp int) +0:? Linker Objects + +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 28 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "PixelShaderFunction" + ExecutionMode 4 OriginUpperLeft + Source HLSL 100 + Name 4 "PixelShaderFunction" + Name 8 "a1" + Name 10 "a2" + Name 13 "a3" + Name 16 "a4" + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 1 + 7: TypePointer Function 6(int) +4(PixelShaderFunction): 2 Function None 3 + 5: Label + 8(a1): 7(ptr) Variable Function + 10(a2): 7(ptr) Variable Function + 13(a3): 7(ptr) Variable Function + 16(a4): 7(ptr) Variable Function + 9: 6(int) Load 8(a1) + 11: 6(int) Load 10(a2) + 12: 6(int) IMul 9 11 + 14: 6(int) Load 13(a3) + 15: 6(int) IAdd 12 14 + 17: 6(int) Load 16(a4) + 18: 6(int) ShiftLeftLogical 15 17 + 19: 6(int) Load 8(a1) + 20: 6(int) Load 10(a2) + 21: 6(int) Load 13(a3) + 22: 6(int) Load 16(a4) + 23: 6(int) IMul 21 22 + 24: 6(int) IAdd 20 23 + 25: 6(int) ShiftLeftLogical 19 24 + 26: 6(int) IAdd 18 25 + ReturnValue 26 + FunctionEnd diff --git a/Test/baseResults/hlsl.sin.frag.out b/Test/baseResults/hlsl.sin.frag.out new file mode 100755 index 00000000..7d4f626d --- /dev/null +++ b/Test/baseResults/hlsl.sin.frag.out @@ -0,0 +1,53 @@ +hlsl.sin.frag +Shader version: 100 +gl_FragCoord origin is upper left +0:? Sequence +0:5 Function Definition: PixelShaderFunction(vf4; (temp 4-component vector of float) +0:2 Function Parameters: +0:2 'input' (temp 4-component vector of float) +0:? Sequence +0:3 Branch: Return with expression +0:3 sine (global 4-component vector of float) +0:3 'input' (temp 4-component vector of float) +0:? Linker Objects + + +Linked fragment stage: + + +Shader version: 100 +gl_FragCoord origin is upper left +0:? Sequence +0:5 Function Definition: PixelShaderFunction(vf4; (temp 4-component vector of float) +0:2 Function Parameters: +0:2 'input' (temp 4-component vector of float) +0:? Sequence +0:3 Branch: Return with expression +0:3 sine (global 4-component vector of float) +0:3 'input' (temp 4-component vector of float) +0:? Linker Objects + +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 13 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "PixelShaderFunction" + ExecutionMode 4 OriginUpperLeft + Source HLSL 100 + Name 4 "PixelShaderFunction" + Name 9 "input" + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypePointer Function 7(fvec4) +4(PixelShaderFunction): 2 Function None 3 + 5: Label + 9(input): 8(ptr) Variable Function + 10: 7(fvec4) Load 9(input) + 11: 7(fvec4) ExtInst 1(GLSL.std.450) 13(Sin) 10 + ReturnValue 11 + FunctionEnd diff --git a/Test/hlsl.assoc.frag b/Test/hlsl.assoc.frag new file mode 100644 index 00000000..8ce1050c --- /dev/null +++ b/Test/hlsl.assoc.frag @@ -0,0 +1,11 @@ +float4 PixelShaderFunction( + float4 a1, + float4 a2, + float4 a3, + float4 a4, + float4 a5 + ) : COLOR0 +{ + a1 = a2 = a3 = a4 = a5; + return a1 + a2 + a3 + a4 + a5; +} diff --git a/Test/hlsl.float4.frag b/Test/hlsl.float4.frag new file mode 100644 index 00000000..8ed4eab1 --- /dev/null +++ b/Test/hlsl.float4.frag @@ -0,0 +1,6 @@ +float4 AmbientColor = float4(1, 0.5, 0, 1); + +float4 ShaderFunction(float4 input) : COLOR0 +{ + return input * AmbientColor; +} diff --git a/Test/hlsl.max.frag b/Test/hlsl.max.frag new file mode 100644 index 00000000..6d1ea0b1 --- /dev/null +++ b/Test/hlsl.max.frag @@ -0,0 +1,4 @@ +float4 PixelShaderFunction(float4 input1, float4 input2) : COLOR0 +{ + return max(input1, input2); +} diff --git a/Test/hlsl.precedence.frag b/Test/hlsl.precedence.frag new file mode 100644 index 00000000..eae0435e --- /dev/null +++ b/Test/hlsl.precedence.frag @@ -0,0 +1,9 @@ +float4 PixelShaderFunction( + float4 a1, + float4 a2, + float4 a3, + float4 a4 + ) : COLOR0 +{ + return a1 + a2 * a3 + a4; +} diff --git a/Test/hlsl.precedence2.frag b/Test/hlsl.precedence2.frag new file mode 100644 index 00000000..0d3f583a --- /dev/null +++ b/Test/hlsl.precedence2.frag @@ -0,0 +1,9 @@ +int PixelShaderFunction( + int a1, + int a2, + int a3, + int a4 + ) : COLOR0 +{ + return (a1 * a2 + a3 << a4) + (a1 << a2 + a3 * a4); +} diff --git a/Test/hlsl.sin.frag b/Test/hlsl.sin.frag new file mode 100644 index 00000000..edf087de --- /dev/null +++ b/Test/hlsl.sin.frag @@ -0,0 +1,4 @@ +float4 PixelShaderFunction(float4 input) : COLOR0 +{ + return sin(input); +} diff --git a/gtests/Hlsl.FromFile.cpp b/gtests/Hlsl.FromFile.cpp index 6105185b..825179df 100644 --- a/gtests/Hlsl.FromFile.cpp +++ b/gtests/Hlsl.FromFile.cpp @@ -71,7 +71,12 @@ TEST_P(HlslCompileTest, FromFile) INSTANTIATE_TEST_CASE_P( ToSpirv, HlslCompileTest, ::testing::ValuesIn(std::vector{ - {"hlsl.frag", "PixelShaderFunction"}, + {"hlsl.assoc.frag", "PixelShaderFunction"}, + {"hlsl.float4.frag", "PixelShaderFunction"}, + {"hlsl.max.frag", "PixelShaderFunction"}, + {"hlsl.precedence.frag", "PixelShaderFunction"}, + {"hlsl.precedence2.frag", "PixelShaderFunction"}, + {"hlsl.sin.frag", "PixelShaderFunction"}, }), FileNameAsCustomTestSuffix ); From ebb505355d59f61dfc9547f81e14b2d9cd1eb2f0 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Mon, 16 May 2016 19:22:05 -0600 Subject: [PATCH 097/140] SPV: Don't add clip/cull distance capabilities unless used. These capabalities were added on declaration of the members, but that is considered too aggressive, as those members are automatically declared in some shaders that don't use them. Now, actual access is needed to make the capabalities be declared. --- SPIRV/GlslangToSpv.cpp | 33 +++++++++++++++++++++++----- Test/baseResults/spv.150.geom.out | 1 - Test/baseResults/spv.430.vert.out | 1 - Test/baseResults/spv.bool.vert.out | 2 -- Test/baseResults/spv.matFun.vert.out | 1 - 5 files changed, 27 insertions(+), 11 deletions(-) diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 2b76c049..92d20f84 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -109,7 +109,7 @@ public: protected: spv::Decoration TranslateInterpolationDecoration(const glslang::TQualifier& qualifier); - spv::BuiltIn TranslateBuiltInDecoration(glslang::TBuiltInVariable); + spv::BuiltIn TranslateBuiltInDecoration(glslang::TBuiltInVariable, bool member); spv::ImageFormat TranslateImageFormat(const glslang::TType& type); spv::Id createSpvVariable(const glslang::TIntermSymbol*); spv::Id getSampledType(const glslang::TSampler&); @@ -122,6 +122,7 @@ protected: int getArrayStride(const glslang::TType& arrayType, glslang::TLayoutPacking, glslang::TLayoutMatrix); int getMatrixStride(const glslang::TType& matrixType, glslang::TLayoutPacking, glslang::TLayoutMatrix); void updateMemberOffset(const glslang::TType& structType, const glslang::TType& memberType, int& currentOffset, int& nextOffset, glslang::TLayoutPacking, glslang::TLayoutMatrix); + void declareClipCullCapability(const glslang::TTypeList& members, int member); bool isShaderEntrypoint(const glslang::TIntermAggregate* node); void makeFunctions(const glslang::TIntermSequence&); @@ -393,7 +394,7 @@ spv::Decoration TranslateNoContractionDecoration(const glslang::TQualifier& qual } // Translate glslang built-in variable to SPIR-V built in decoration. -spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltInVariable builtIn) +spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltInVariable builtIn, bool member) { switch (builtIn) { case glslang::EbvPointSize: @@ -410,12 +411,20 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI } return spv::BuiltInPointSize; + // 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. + // Potentially, the specification should be more clear what the minimum + // use needed is to trigger the capability. + // case glslang::EbvClipDistance: - builder.addCapability(spv::CapabilityClipDistance); + if (! member) + builder.addCapability(spv::CapabilityClipDistance); return spv::BuiltInClipDistance; case glslang::EbvCullDistance: - builder.addCapability(spv::CapabilityCullDistance); + if (! member) + builder.addCapability(spv::CapabilityCullDistance); return spv::BuiltInCullDistance; case glslang::EbvViewportIndex: @@ -926,6 +935,10 @@ bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::T } else { // normal case for indexing array or structure or block builder.accessChainPush(builder.makeIntConstant(index)); + + // Add capabilities here for accessing clip/cull distance + if (node->getLeft()->getType().isStruct() && ! node->getLeft()->getType().isArray()) + declareClipCullCapability(*node->getLeft()->getType().getStruct(), index); } } return false; @@ -1919,7 +1932,7 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty builder.addMemberDecoration(spvType, member, spv::DecorationMatrixStride, getMatrixStride(glslangType, explicitLayout, subQualifier.layoutMatrix)); // built-in variable decorations - spv::BuiltIn builtIn = TranslateBuiltInDecoration(glslangType.getQualifier().builtIn); + spv::BuiltIn builtIn = TranslateBuiltInDecoration(glslangType.getQualifier().builtIn, true); if (builtIn != spv::BadValue) addMemberDecoration(spvType, member, spv::DecorationBuiltIn, (int)builtIn); } @@ -2172,6 +2185,14 @@ void TGlslangToSpvTraverser::updateMemberOffset(const glslang::TType& /*structTy nextOffset = currentOffset + memberSize; } +void TGlslangToSpvTraverser::declareClipCullCapability(const glslang::TTypeList& members, int member) +{ + if (members[member].type->getQualifier().builtIn == glslang::EbvClipDistance) + builder.addCapability(spv::CapabilityClipDistance); + if (members[member].type->getQualifier().builtIn == glslang::EbvCullDistance) + builder.addCapability(spv::CapabilityCullDistance); +} + bool TGlslangToSpvTraverser::isShaderEntrypoint(const glslang::TIntermAggregate* node) { // have to ignore mangling and just look at the base name @@ -3936,7 +3957,7 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol } // built-in variable decorations - spv::BuiltIn builtIn = TranslateBuiltInDecoration(symbol->getQualifier().builtIn); + spv::BuiltIn builtIn = TranslateBuiltInDecoration(symbol->getQualifier().builtIn, false); if (builtIn != spv::BadValue) addDecoration(id, spv::DecorationBuiltIn, (int)builtIn); diff --git a/Test/baseResults/spv.150.geom.out b/Test/baseResults/spv.150.geom.out index b09f0c04..8b021ff9 100755 --- a/Test/baseResults/spv.150.geom.out +++ b/Test/baseResults/spv.150.geom.out @@ -9,7 +9,6 @@ Linked geometry stage: Capability Geometry Capability GeometryPointSize - Capability ClipDistance Capability GeometryStreams 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 diff --git a/Test/baseResults/spv.430.vert.out b/Test/baseResults/spv.430.vert.out index a1487d53..12a6c33f 100755 --- a/Test/baseResults/spv.430.vert.out +++ b/Test/baseResults/spv.430.vert.out @@ -10,7 +10,6 @@ Linked vertex stage: // Id's are bound by 66 Capability Shader - Capability ClipDistance 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 EntryPoint Vertex 4 "main" 12 23 34 38 41 42 62 65 diff --git a/Test/baseResults/spv.bool.vert.out b/Test/baseResults/spv.bool.vert.out index b6960f94..49a69a0e 100644 --- a/Test/baseResults/spv.bool.vert.out +++ b/Test/baseResults/spv.bool.vert.out @@ -10,8 +10,6 @@ Linked vertex stage: // Id's are bound by 49 Capability Shader - Capability ClipDistance - Capability CullDistance 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 EntryPoint Vertex 4 "main" 24 diff --git a/Test/baseResults/spv.matFun.vert.out b/Test/baseResults/spv.matFun.vert.out index ab487763..0aa0a52d 100755 --- a/Test/baseResults/spv.matFun.vert.out +++ b/Test/baseResults/spv.matFun.vert.out @@ -10,7 +10,6 @@ Linked vertex stage: // Id's are bound by 103 Capability Shader - Capability ClipDistance 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 EntryPoint Vertex 4 "main" 76 81 From c1992e5e573a0a206e70ca5b65d1203b2b6c25c2 Mon Sep 17 00:00:00 2001 From: Rex Xu Date: Tue, 17 May 2016 18:57:18 +0800 Subject: [PATCH 098/140] SPV: Correct an issue in createUnaryMatrixOperation(). Type of the source is not necessarily the same as that of the destination. --- SPIRV/GlslangToSpv.cpp | 12 ++++++------ Test/baseResults/spv.matrix.frag.out | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 92d20f84..66194663 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -3334,18 +3334,18 @@ spv::Id TGlslangToSpvTraverser::createUnaryMatrixOperation(spv::Op op, spv::Deco // get the types sorted out int numCols = builder.getNumColumns(operand); int numRows = builder.getNumRows(operand); - spv::Id scalarType = builder.getScalarTypeId(typeId); - spv::Id vecType = builder.makeVectorType(scalarType, numRows); + spv::Id srcVecType = builder.makeVectorType(builder.getScalarTypeId(builder.getTypeId(operand)), numRows); + spv::Id destVecType = builder.makeVectorType(builder.getScalarTypeId(typeId), numRows); std::vector results; // do each vector op for (int c = 0; c < numCols; ++c) { std::vector indexes; indexes.push_back(c); - spv::Id vec = builder.createCompositeExtract(operand, vecType, indexes); - spv::Id vec_result = builder.createUnaryOp(op, vecType, vec); - addDecoration(vec_result, noContraction); - results.push_back(builder.setPrecision(vec_result, precision)); + spv::Id srcVec = builder.createCompositeExtract(operand, srcVecType, indexes); + spv::Id destVec = builder.createUnaryOp(op, destVecType, srcVec); + addDecoration(destVec, noContraction); + results.push_back(builder.setPrecision(destVec, precision)); } // put the pieces together diff --git a/Test/baseResults/spv.matrix.frag.out b/Test/baseResults/spv.matrix.frag.out index 6a6b672b..7b34fca4 100644 --- a/Test/baseResults/spv.matrix.frag.out +++ b/Test/baseResults/spv.matrix.frag.out @@ -195,20 +195,20 @@ Linked fragment stage: 135: 8 CompositeConstruct 130 132 134 Store 10(sum34) 135 141: 8 Load 10(sum34) - 142: 137(fvec4) CompositeExtract 141 0 + 142: 7(fvec4) CompositeExtract 141 0 143: 137(fvec4) FConvert 142 - 144: 137(fvec4) CompositeExtract 141 1 + 144: 7(fvec4) CompositeExtract 141 1 145: 137(fvec4) FConvert 144 - 146: 137(fvec4) CompositeExtract 141 2 + 146: 7(fvec4) CompositeExtract 141 2 147: 137(fvec4) FConvert 146 148: 138 CompositeConstruct 143 145 147 Store 140(dm) 148 149: 138 Load 140(dm) - 150: 7(fvec4) CompositeExtract 149 0 + 150: 137(fvec4) CompositeExtract 149 0 151: 7(fvec4) FConvert 150 - 152: 7(fvec4) CompositeExtract 149 1 + 152: 137(fvec4) CompositeExtract 149 1 153: 7(fvec4) FConvert 152 - 154: 7(fvec4) CompositeExtract 149 2 + 154: 137(fvec4) CompositeExtract 149 2 155: 7(fvec4) FConvert 154 156: 8 CompositeConstruct 151 153 155 Store 10(sum34) 156 From 9af54c33372728e9a931b33e4a14813e4c4042a1 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Tue, 17 May 2016 10:24:00 -0600 Subject: [PATCH 099/140] Non-functional: Fix some comments English and brace formatting in recent merges. --- SPIRV/GlslangToSpv.cpp | 10 +- .../propagateNoContraction.cpp | 208 +++++++++--------- .../propagateNoContraction.h | 2 +- 3 files changed, 108 insertions(+), 112 deletions(-) diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index d95060dc..0efccf46 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -1891,8 +1891,7 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty addMemberDecoration(spvType, member, TranslateLayoutDecoration(glslangType, subQualifier.layoutMatrix)); addMemberDecoration(spvType, member, TranslatePrecisionDecoration(glslangType)); // Add interpolation decorations only to top-level members of Input and Output storage classes - if (type.getQualifier().storage == glslang::EvqVaryingIn || type.getQualifier().storage == glslang::EvqVaryingOut) - { + if (type.getQualifier().storage == glslang::EvqVaryingIn || type.getQualifier().storage == glslang::EvqVaryingOut) { addMemberDecoration(spvType, member, TranslateInterpolationDecoration(subQualifier)); } addMemberDecoration(spvType, member, TranslateInvariantDecoration(subQualifier)); @@ -1909,14 +1908,11 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty // probably move to the linker stage of the front end proper, and just have the // answer sitting already distributed throughout the individual member locations. int location = -1; // will only decorate if present or inherited - if (subQualifier.hasLocation()) // no inheritance, or override of inheritance - { + if (subQualifier.hasLocation()) { // no inheritance, or override of inheritance // struct members should not have explicit locations assert(type.getBasicType() != glslang::EbtStruct); location = subQualifier.layoutLocation; - } - else if (type.getBasicType() != glslang::EbtBlock) - { + } else if (type.getBasicType() != glslang::EbtBlock) { // If it is a not a Block, (...) Its members are assigned consecutive locations (...) // The members, and their nested types, must not themselves have Location decorations. } diff --git a/glslang/MachineIndependent/propagateNoContraction.cpp b/glslang/MachineIndependent/propagateNoContraction.cpp index 743a676e..dcb75711 100644 --- a/glslang/MachineIndependent/propagateNoContraction.cpp +++ b/glslang/MachineIndependent/propagateNoContraction.cpp @@ -34,7 +34,7 @@ // // Visit the nodes in the glslang intermediate tree representation to -// propagate 'noContraction' qualifier. +// propagate the 'noContraction' qualifier. // #include "propagateNoContraction.h" @@ -48,16 +48,16 @@ #include "localintermediate.h" namespace { -// Use string to hold the accesschain information, as in most cases the -// accesschain is short and may contain only one element, which is the symbol +// Use a string to hold the access chain information, as in most cases the +// access chain is short and may contain only one element, which is the symbol // ID. // Example: struct {float a; float b;} s; // Object s.a will be represented with: /0 // Object s.b will be represented with: /1 -// Object s will be representend with: +// Object s will be represented with: // For members of vector, matrix and arrays, they will be represented with the // same symbol ID of their container symbol objects. This is because their -// precise'ness is always the same as their container symbol objects. +// preciseness is always the same as their container symbol objects. typedef std::string ObjectAccessChain; // The delimiter used in the ObjectAccessChain string to separate symbol ID and @@ -67,7 +67,7 @@ const char ObjectAccesschainDelimiter = '/'; // Mapping from Symbol IDs of symbol nodes, to their defining operation // nodes. typedef std::unordered_multimap NodeMapping; -// Mapping from object nodes to their accesschain info string. +// Mapping from object nodes to their access chain info string. typedef std::unordered_map AccessChainMapping; // Set of object IDs. @@ -127,7 +127,7 @@ bool isAssignOperation(glslang::TOperator op) } // A helper function to get the unsigned int from a given constant union node. -// Note the node should only holds a uint scalar. +// Note the node should only hold a uint scalar. unsigned getStructIndexFromConstantUnion(glslang::TIntermTyped* node) { assert(node->getAsConstantUnion() && node->getAsConstantUnion()->isScalar()); @@ -144,7 +144,7 @@ ObjectAccessChain generateSymbolLabel(glslang::TIntermSymbol* node) } // Returns true if the operation is an arithmetic operation and valid for -// 'NoContraction' decoration. +// the 'NoContraction' decoration. bool isArithmeticOperation(glslang::TOperator op) { switch (op) { @@ -184,7 +184,7 @@ bool isArithmeticOperation(glslang::TOperator op) } } -// A helper class to help managing populating_initial_no_contraction_ flag. +// A helper class to help manage the populating_initial_no_contraction_ flag. template class StateSettingGuard { public: StateSettingGuard(T* state_ptr, T new_state_value) @@ -208,14 +208,14 @@ ObjectAccessChain getFrontElement(const ObjectAccessChain& chain) return pos_delimiter == std::string::npos ? chain : chain.substr(0, pos_delimiter); } -// A helper function to get the accesschain starting from the second element. +// A helper function to get the access chain starting from the second element. ObjectAccessChain subAccessChainFromSecondElement(const ObjectAccessChain& chain) { size_t pos_delimiter = chain.find(ObjectAccesschainDelimiter); return pos_delimiter == std::string::npos ? "" : chain.substr(pos_delimiter + 1); } -// A helper function to get the accesschain after removing a given prefix. +// A helper function to get the access chain after removing a given prefix. ObjectAccessChain getSubAccessChainAfterPrefix(const ObjectAccessChain& chain, const ObjectAccessChain& prefix) { @@ -228,7 +228,7 @@ ObjectAccessChain getSubAccessChainAfterPrefix(const ObjectAccessChain& chain, // // A traverser which traverses the whole AST and populates: // 1) A mapping from symbol nodes' IDs to their defining operation nodes. -// 2) A set of accesschains of the initial precise object nodes. +// 2) A set of access chains of the initial precise object nodes. // class TSymbolDefinitionCollectingTraverser : public glslang::TIntermTraverser { public: @@ -255,12 +255,12 @@ protected: // A temporary cache of the symbol node whose defining node is to be found // currently along traversing the AST. ObjectAccessChain current_object_; - // A map from object node to its accesschain. This traverser stores - // the built accesschains into this map for each object node it has + // A map from object node to its access chain. This traverser stores + // the built access chains into this map for each object node it has // visited. AccessChainMapping& accesschain_mapping_; // The pointer to the Function Definition node, so we can get the - // precise'ness of the return expression from it when we traverse the + // preciseness of the return expression from it when we traverse the // return branch node. glslang::TIntermAggregate* current_function_definition_node_; }; @@ -288,14 +288,14 @@ void TSymbolDefinitionCollectingTraverser::visitSymbol(glslang::TIntermSymbol* n bool TSymbolDefinitionCollectingTraverser::visitAggregate(glslang::TVisit, glslang::TIntermAggregate* node) { - // This aggreagate node might be a function definition node, in which case we need to - // cache this node, so we can get the precise'ness information of the return value + // This aggregate node might be a function definition node, in which case we need to + // cache this node, so we can get the preciseness information of the return value // of this function later. StateSettingGuard current_function_definition_node_setting_guard( ¤t_function_definition_node_); if (node->getOp() == glslang::EOpFunction) { // This is function definition node, we need to cache this node so that we can - // get the precise'ness of the return value later. + // get the preciseness of the return value later. current_function_definition_node_setting_guard.setState(node); } // Traverse the items in the sequence. @@ -313,7 +313,7 @@ bool TSymbolDefinitionCollectingTraverser::visitBranch(glslang::TVisit, if (node->getFlowOp() == glslang::EOpReturn && node->getExpression() && current_function_definition_node_ && current_function_definition_node_->getType().getQualifier().noContraction) { - // This node is a return node with expression, and its function has + // This node is a return node with an expression, and its function has a // precise return value. We need to find the involved objects in its // expression and add them to the set of initial precise objects. precise_return_nodes_.insert(node); @@ -322,71 +322,71 @@ bool TSymbolDefinitionCollectingTraverser::visitBranch(glslang::TVisit, return false; } -// Visits an unary node. This might be an implicit assignment like i++, i--. etc. +// Visits a unary node. This might be an implicit assignment like i++, i--. etc. bool TSymbolDefinitionCollectingTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TIntermUnary* node) { current_object_.clear(); node->getOperand()->traverse(this); if (isAssignOperation(node->getOp())) { - // We should always be able to get an accesschain of the operand node. + // We should always be able to get an access chain of the operand node. assert(!current_object_.empty()); - // If the operand node object is 'precise', we collect its accesschain + // If the operand node object is 'precise', we collect its access chain // for the initial set of 'precise' objects. if (isPreciseObjectNode(node->getOperand())) { // The operand node is an 'precise' object node, add its - // accesschain to the set of 'precise' objects. This is to collect + // access chain to the set of 'precise' objects. This is to collect // the initial set of 'precise' objects. precise_objects_.insert(current_object_); } - // Gets the symbol ID from the object's accesschain. + // Gets the symbol ID from the object's access chain. ObjectAccessChain id_symbol = getFrontElement(current_object_); // Add a mapping from the symbol ID to this assignment operation node. symbol_definition_mapping_.insert(std::make_pair(id_symbol, node)); } - // Unary node is not a dereference node, so we clear the accesschain which + // A unary node is not a dereference node, so we clear the access chain which // is under construction. current_object_.clear(); return false; } // Visits a binary node and updates the mapping from symbol IDs to the definition -// nodes. Also collects the accesschains for the initial precise objects. +// nodes. Also collects the access chains for the initial precise objects. bool TSymbolDefinitionCollectingTraverser::visitBinary(glslang::TVisit /* visit */, glslang::TIntermBinary* node) { - // Traverses the left node to build the accesschain info for the object. + // Traverses the left node to build the access chain info for the object. current_object_.clear(); node->getLeft()->traverse(this); if (isAssignOperation(node->getOp())) { - // We should always be able to get an accesschain for the left node. + // We should always be able to get an access chain for the left node. assert(!current_object_.empty()); // If the left node object is 'precise', it is an initial precise object - // specified in the shader source. Adds it to the initial worklist to + // specified in the shader source. Adds it to the initial work list to // process later. if (isPreciseObjectNode(node->getLeft())) { - // The left node is an 'precise' object node, add its accesschain to + // The left node is an 'precise' object node, add its access chain to // the set of 'precise' objects. This is to collect the initial set // of 'precise' objects. precise_objects_.insert(current_object_); } - // Gets the symbol ID from the object accesschain, which should be the - // first element recorded in the accesschain. + // Gets the symbol ID from the object access chain, which should be the + // first element recorded in the access chain. ObjectAccessChain id_symbol = getFrontElement(current_object_); // Adds a mapping from the symbol ID to this assignment operation node. symbol_definition_mapping_.insert(std::make_pair(id_symbol, node)); // Traverses the right node, there may be other 'assignment' - // operatrions in the right. + // operations in the right. current_object_.clear(); node->getRight()->traverse(this); } else if (isDereferenceOperation(node->getOp())) { // The left node (parent node) is a struct type object. We need to - // record the accesschain information of the current node into its + // record the access chain information of the current node into its // object id. if (node->getOp() == glslang::EOpIndexDirectStruct) { unsigned struct_dereference_index = getStructIndexFromConstantUnion(node->getRight()); @@ -395,7 +395,7 @@ bool TSymbolDefinitionCollectingTraverser::visitBinary(glslang::TVisit /* visit } accesschain_mapping_[node] = current_object_; - // For dereference node, there is no need to traverse the right child + // For a dereference node, there is no need to traverse the right child // node as the right node should always be an integer type object. } else { @@ -408,8 +408,8 @@ bool TSymbolDefinitionCollectingTraverser::visitBinary(glslang::TVisit /* visit // Traverses the AST and returns a tuple of four members: // 1) a mapping from symbol IDs to the definition nodes (aka. assignment nodes) of these symbols. -// 2) a mapping from object nodes in the AST to the accesschains of these objects. -// 3) a set of accesschains of precise objects. +// 2) a mapping from object nodes in the AST to the access chains of these objects. +// 3) a set of access chains of precise objects. // 4) a set of return nodes with precise expressions. std::tuple getSymbolToDefinitionMappingAndPreciseSymbolIDs(const glslang::TIntermediate& intermediate) @@ -437,15 +437,15 @@ getSymbolToDefinitionMappingAndPreciseSymbolIDs(const glslang::TIntermediate& in // // A traverser that determine whether the left node (or operand node for unary // node) of an assignment node is 'precise', containing 'precise' or not, -// according to the accesschain a given precise object which share the same +// according to the access chain a given precise object which share the same // symbol as the left node. // // Post-orderly traverses the left node subtree of an binary assignment node and: // // 1) Propagates the 'precise' from the left object nodes to this object node. // -// 2) Builds object accesschain along the traversal, and also compares with -// the accesschain of the given 'precise' object along with the traversal to +// 2) Builds object access chain along the traversal, and also compares with +// the access chain of the given 'precise' object along with the traversal to // tell if the node to be defined is 'precise' or not. // class TNoContractionAssigneeCheckingTraverser : public glslang::TIntermTraverser { @@ -464,18 +464,18 @@ public: : TIntermTraverser(true, false, false), accesschain_mapping_(accesschain_mapping), precise_object_(nullptr) {} - // Checks the precise'ness of a given assignment node with a precise object - // represented as accesschain. The precise object shares the same symbol + // Checks the preciseness of a given assignment node with a precise object + // represented as access chain. The precise object shares the same symbol // with the assignee of the given assignment node. Return a tuple of two: // - // 1) The precise'ness of the assignee node of this assignment node. True + // 1) The preciseness of the assignee node of this assignment node. True // if the assignee contains 'precise' objects or is 'precise', false if - // the assignee is not 'precise' according to the accesschain of the given + // the assignee is not 'precise' according to the access chain of the given // precise object. // - // 2) The incremental accesschain from the assignee node to its nested - // 'precise' object, according to the accesschain of the given precise - // object. This incremental accesschain can be empty, which means the + // 2) The incremental access chain from the assignee node to its nested + // 'precise' object, according to the access chain of the given precise + // object. This incremental access chain can be empty, which means the // assignee is 'precise'. Otherwise it shows the path to the nested // precise object. std::tuple @@ -487,7 +487,7 @@ public: ObjectAccessChain assignee_object; if (glslang::TIntermBinary* BN = node->getAsBinaryNode()) { // This is a binary assignment node, we need to check the - // precise'ness of the left node. + // preciseness of the left node. assert(accesschain_mapping_.count(BN->getLeft())); // The left node (assignee node) is an object node, traverse the // node to let the 'precise' of nesting objects being transfered to @@ -498,14 +498,14 @@ public: if (isPreciseObjectNode(BN->getLeft())) { return make_tuple(true, ObjectAccessChain()); } - // If the precise'ness of the left node (assignee node) can not - // be determined by now, we need to compare the accesschain string + // If the preciseness of the left node (assignee node) can not + // be determined by now, we need to compare the access chain string // of the assignee object with the given precise object. assignee_object = accesschain_mapping_.at(BN->getLeft()); } else if (glslang::TIntermUnary* UN = node->getAsUnaryNode()) { // This is a unary assignment node, we need to check the - // precise'ness of the operand node. For unary assignment node, the + // preciseness of the operand node. For unary assignment node, the // operand node should always be an object node. assert(accesschain_mapping_.count(UN->getOperand())); // Traverse the operand node to let the 'precise' being propagated @@ -516,8 +516,8 @@ public: if (isPreciseObjectNode(UN->getOperand())) { return make_tuple(true, ObjectAccessChain()); } - // If the precise'ness of the operand node (assignee node) can not - // be determined by now, we need to compare the accesschain string + // If the preciseness of the operand node (assignee node) can not + // be determined by now, we need to compare the access chain string // of the assignee object with the given precise object. assignee_object = accesschain_mapping_.at(UN->getOperand()); } else { @@ -525,23 +525,23 @@ public: assert(false); } - // Compare the accesschain string of the assignee node with the given + // Compare the access chain string of the assignee node with the given // precise object to determine if this assignment should propagate // 'precise'. if (assignee_object.find(precise_object) == 0) { - // The accesschain string of the given precise object is a prefix - // of assignee's accesschain string. The assignee should be + // The access chain string of the given precise object is a prefix + // of assignee's access chain string. The assignee should be // 'precise'. return make_tuple(true, ObjectAccessChain()); } else if (precise_object.find(assignee_object) == 0) { - // The assignee's accesschain string is a prefix of the given + // The assignee's access chain string is a prefix of the given // precise object, the assignee object contains 'precise' object, - // and we need to pass the remained accesschain to the object nodes + // and we need to pass the remained access chain to the object nodes // in the right. return make_tuple(true, getSubAccessChainAfterPrefix(precise_object, assignee_object)); } else { - // The accesschain strings do not match, the assignee object can - // not be labelled as 'precise' according to the given precise + // The access chain strings do not match, the assignee object can + // not be labeled as 'precise' according to the given precise // object. return make_tuple(false, ObjectAccessChain()); } @@ -551,9 +551,9 @@ protected: bool visitBinary(glslang::TVisit, glslang::TIntermBinary* node) override; void visitSymbol(glslang::TIntermSymbol* node) override; - // A map from object nodes to their accesschain string (used as object ID). + // A map from object nodes to their access chain string (used as object ID). const AccessChainMapping& accesschain_mapping_; - // A given precise object, represented in it accesschain string. This + // A given precise object, represented in it access chain string. This // precise object is used to be compared with the assignee node to tell if // the assignee node is 'precise', contains 'precise' object or not // 'precise'. @@ -576,7 +576,7 @@ bool TNoContractionAssigneeCheckingTraverser::visitBinary(glslang::TVisit, assert(isDereferenceOperation(node->getOp())); // If the left node is 'precise', this node should also be precise, // otherwise, compare with the given precise_object_. If the - // accesschain of this node matches with the given precise_object_, + // access chain of this node matches with the given precise_object_, // this node should be marked as 'precise'. if (isPreciseObjectNode(node->getLeft())) { node->getWritableType().getQualifier().noContraction = true; @@ -587,12 +587,12 @@ bool TNoContractionAssigneeCheckingTraverser::visitBinary(glslang::TVisit, return false; } -// Visits a symbol node, if the symbol node ID (its accesschain string) matches +// Visits a symbol node, if the symbol node ID (its access chain string) matches // with the given precise object, this node should be 'precise'. void TNoContractionAssigneeCheckingTraverser::visitSymbol(glslang::TIntermSymbol* node) { // A symbol node should always be an object node, and should have been added - // to the map from object nodes to their accesschain strings. + // to the map from object nodes to their access chain strings. assert(accesschain_mapping_.count(node)); if (accesschain_mapping_.at(node) == *precise_object_) { node->getWritableType().getQualifier().noContraction = true; @@ -603,10 +603,10 @@ void TNoContractionAssigneeCheckingTraverser::visitSymbol(glslang::TIntermSymbol // A traverser that only traverses the right side of binary assignment nodes // and the operand node of unary assignment nodes. // -// 1) Marks arithmetic operations 'NoContraction'. +// 1) Marks arithmetic operations as 'NoContraction'. // // 2) Find the object which should be marked as 'precise' in the right and -// update the 'precise' object worklist. +// update the 'precise' object work list. // class TNoContractionPropagator : public glslang::TIntermTraverser { public: @@ -617,7 +617,7 @@ public: added_precise_object_ids_() {} // Propagates 'precise' in the right nodes of a given assignment node with - // accesschain record from the assignee node to a 'precise' object it + // access chain record from the assignee node to a 'precise' object it // contains. void propagateNoContractionInOneExpression(glslang::TIntermTyped* defining_node, @@ -650,26 +650,26 @@ public: protected: // Visits an aggregate node. The node can be a initializer list, in which // case we need to find the 'precise' or 'precise' containing object node - // with the accesschain record. In other cases, just need to traverse all + // with the access chain record. In other cases, just need to traverse all // the children nodes. bool visitAggregate(glslang::TVisit, glslang::TIntermAggregate* node) override { if (!remained_accesschain_.empty() && node->getOp() == glslang::EOpConstructStruct) { // This is a struct initializer node, and the remained - // accesschain is not empty, we need to refer to the + // access chain is not empty, we need to refer to the // assignee_remained_access_chain_ to find the nested // 'precise' object. And we don't need to visit other nodes in this - // aggreagate node. + // aggregate node. // Gets the struct dereference index that leads to 'precise' object. ObjectAccessChain precise_accesschain_index_str = getFrontElement(remained_accesschain_); unsigned precise_accesschain_index = strtoul(precise_accesschain_index_str.c_str(), nullptr, 10); - // Gets the node pointed by the accesschain index extracted before. + // Gets the node pointed by the access chain index extracted before. glslang::TIntermTyped* potential_precise_node = node->getSequence()[precise_accesschain_index]->getAsTyped(); assert(potential_precise_node); - // Pop the front accesschain index from the path, and visit the nested node. + // Pop the front access chain index from the path, and visit the nested node. { ObjectAccessChain next_level_accesschain = subAccessChainFromSecondElement(remained_accesschain_); @@ -684,7 +684,7 @@ protected: // Visits a binary node. A binary node can be an object node, e.g. a dereference node. // As only the top object nodes in the right side of an assignment needs to be visited - // and added to 'precise' worklist, this traverser won't visit the children nodes of + // and added to 'precise' work list, this traverser won't visit the children nodes of // an object node. If the binary node does not represent an object node, it should // go on to traverse its children nodes and if it is an arithmetic operation node, this // operation should be marked as 'noContraction'. @@ -692,16 +692,16 @@ protected: { if (isDereferenceOperation(node->getOp())) { // This binary node is an object node. Need to update the precise - // object set with the accesschain of this node + remained - // accesschain . + // object set with the access chain of this node + remained + // access chain . ObjectAccessChain new_precise_accesschain = accesschain_mapping_.at(node); if (remained_accesschain_.empty()) { node->getWritableType().getQualifier().noContraction = true; } else { new_precise_accesschain += ObjectAccesschainDelimiter + remained_accesschain_; } - // Cache the accesschain as added precise object, so we won't add the - // same object to the worklist again. + // Cache the access chain as added precise object, so we won't add the + // same object to the work list again. if (!added_precise_object_ids_.count(new_precise_accesschain)) { precise_objects_.insert(new_precise_accesschain); added_precise_object_ids_.insert(new_precise_accesschain); @@ -718,7 +718,7 @@ protected: return true; } - // Visits an unary node. An unary node can not be an object node. If the operation + // Visits a unary node. A unary node can not be an object node. If the operation // is an arithmetic operation, need to mark this node as 'noContraction'. bool visitUnary(glslang::TVisit /* visit */, glslang::TIntermUnary* node) override { @@ -730,26 +730,26 @@ protected: } // Visits a symbol node. A symbol node is always an object node. So we - // should always be able to find its in our colected mapping from object - // nodes to accesschains. As an object node, a symbol node can be either + // should always be able to find its in our collected mapping from object + // nodes to access chains. As an object node, a symbol node can be either // 'precise' or containing 'precise' objects according to unused - // accesschain information we have when we visit this node. + // access chain information we have when we visit this node. void visitSymbol(glslang::TIntermSymbol* node) override { // Symbol nodes are object nodes and should always have an - // accesschain collected before matches with it. + // access chain collected before matches with it. assert(accesschain_mapping_.count(node)); ObjectAccessChain new_precise_accesschain = accesschain_mapping_.at(node); - // If the unused accesschain is empty, this symbol node should be - // marked as 'precise'. Otherwise, the unused accesschain should be - // appended to the symbol ID to build a new accesschain which points to + // If the unused access chain is empty, this symbol node should be + // marked as 'precise'. Otherwise, the unused access chain should be + // appended to the symbol ID to build a new access chain which points to // the nested 'precise' object in this symbol object. if (remained_accesschain_.empty()) { node->getWritableType().getQualifier().noContraction = true; } else { new_precise_accesschain += ObjectAccesschainDelimiter + remained_accesschain_; } - // Add the new 'precise' accesschain to the worklist and make sure we + // Add the new 'precise' access chain to the work list and make sure we // don't visit it again. if (!added_precise_object_ids_.count(new_precise_accesschain)) { precise_objects_.insert(new_precise_accesschain); @@ -757,7 +757,7 @@ protected: } } - // A set of precise objects, represented as accesschains. + // A set of precise objects, represented as access chains. ObjectAccesschainSet& precise_objects_; // Visited symbol nodes, should not revisit these nodes. ObjectAccesschainSet added_precise_object_ids_; @@ -767,7 +767,7 @@ protected: // the right. So we need the path from the left node to its nested 'precise' node to // tell us how to find the corresponding 'precise' node in the right. ObjectAccessChain remained_accesschain_; - // A map from node pointers to their accesschains. + // A map from node pointers to their access chains. const AccessChainMapping& accesschain_mapping_; }; } @@ -787,35 +787,35 @@ void PropagateNoContraction(const glslang::TIntermediate& intermediate) // traversing the tree again. NodeMapping& symbol_definition_mapping = std::get<0>(mappings_and_precise_objects); - // The mapping of object nodes to their accesschains recorded. + // The mapping of object nodes to their access chains recorded. AccessChainMapping& accesschain_mapping = std::get<1>(mappings_and_precise_objects); // The initial set of 'precise' objects which are represented as the - // accesschain toward them. + // access chain toward them. ObjectAccesschainSet& precise_object_accesschains = std::get<2>(mappings_and_precise_objects); // The set of 'precise' return nodes. ReturnBranchNodeSet& precise_return_nodes = std::get<3>(mappings_and_precise_objects); - // Second, uses the initial set of precise objects as a worklist, pops an - // accesschain, extract the symbol ID from it. Then: + // Second, uses the initial set of precise objects as a work list, pops an + // access chain, extract the symbol ID from it. Then: // 1) Check the assignee object, see if it is 'precise' object node or - // contains 'precise' object. Obtain the incremental accesschain from the + // contains 'precise' object. Obtain the incremental access chain from the // assignee node to its nested 'precise' node (if any). // 2) If the assignee object node is 'precise' or it contains 'precise' // objects, traverses the right side of the assignment operation // expression to mark arithmetic operations as 'noContration' and update - // 'precise' accesschain worklist with new found object nodes. - // Repeat above steps until the worklist is empty. + // 'precise' access chain work list with new found object nodes. + // Repeat above steps until the work list is empty. TNoContractionAssigneeCheckingTraverser checker(accesschain_mapping); TNoContractionPropagator propagator(&precise_object_accesschains, accesschain_mapping); - // We have two initial precise worklists to handle: + // We have two initial precise work lists to handle: // 1) precise return nodes - // 2) precise object accesschains + // 2) precise object access chains // We should process the precise return nodes first and the involved // objects in the return expression should be added to the precise object - // accesschain set. + // access chain set. while (!precise_return_nodes.empty()) { glslang::TIntermBranch* precise_return_node = *precise_return_nodes.begin(); propagator.propagateNoContractionInReturnNode(precise_return_node); @@ -823,9 +823,9 @@ void PropagateNoContraction(const glslang::TIntermediate& intermediate) } while (!precise_object_accesschains.empty()) { - // Get the accesschain of a precise object from the worklist. + // Get the access chain of a precise object from the work list. ObjectAccessChain precise_object_accesschain = *precise_object_accesschains.begin(); - // Get the symbol id from the accesschain. + // Get the symbol id from the access chain. ObjectAccessChain symbol_id = getFrontElement(precise_object_accesschain); // Get all the defining nodes of that symbol ID. std::pair range = @@ -833,9 +833,9 @@ void PropagateNoContraction(const glslang::TIntermediate& intermediate) // Visits all the assignment nodes of that symbol ID and // 1) Check if the assignee node is 'precise' or contains 'precise' // objects. - // 2) Propagate the 'precise' to the top layer object ndoes + // 2) Propagate the 'precise' to the top layer object nodes // in the right side of the assignment operation, update the 'precise' - // worklist with new accesschains representing the new 'precise' + // work list with new access chains representing the new 'precise' // objects, and mark arithmetic operations as 'noContraction'. for (NodeMapping::iterator defining_node_iter = range.first; defining_node_iter != range.second; defining_node_iter++) { @@ -852,7 +852,7 @@ void PropagateNoContraction(const glslang::TIntermediate& intermediate) remained_accesschain); } } - // Remove the last processed 'precise' object from the worklist. + // Remove the last processed 'precise' object from the work list. precise_object_accesschains.erase(precise_object_accesschain); } } diff --git a/glslang/MachineIndependent/propagateNoContraction.h b/glslang/MachineIndependent/propagateNoContraction.h index 43c2116b..3412c85d 100644 --- a/glslang/MachineIndependent/propagateNoContraction.h +++ b/glslang/MachineIndependent/propagateNoContraction.h @@ -20,7 +20,7 @@ // 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 +// "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, From fc697cc93818e4c8a3962baf61bd2150a1eba377 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Tue, 17 May 2016 16:43:05 -0400 Subject: [PATCH 100/140] Fix several comments in GTest fixture. --- gtests/Hlsl.FromFile.cpp | 2 +- gtests/TestFixture.h | 15 ++++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/gtests/Hlsl.FromFile.cpp b/gtests/Hlsl.FromFile.cpp index 825179df..e5922bc1 100644 --- a/gtests/Hlsl.FromFile.cpp +++ b/gtests/Hlsl.FromFile.cpp @@ -59,7 +59,7 @@ std::string FileNameAsCustomTestSuffix( using HlslCompileTest = GlslangTest<::testing::TestWithParam>; // Compiling HLSL to SPIR-V under Vulkan semantics. Expected to successfully -// generate SPIR-V. +// generate both AST and SPIR-V. TEST_P(HlslCompileTest, FromFile) { loadFileCompileAndCheck(GLSLANG_TEST_DIRECTORY, GetParam().fileName, diff --git a/gtests/TestFixture.h b/gtests/TestFixture.h index a13a50b3..0b389ada 100644 --- a/gtests/TestFixture.h +++ b/gtests/TestFixture.h @@ -129,14 +129,13 @@ public: } // Checks the equality of |expected| and |real|. If they are not equal, - // write - // |real| to the given file named as |fname| if update mode is on. + // write |real| to the given file named as |fname| if update mode is on. void checkEqAndUpdateIfRequested(const std::string& expected, const std::string& real, const std::string& fname) { - // In order to output the message we want under proper circumstances, we - // need the following operator<< stuff. + // In order to output the message we want under proper circumstances, + // we need the following operator<< stuff. EXPECT_EQ(expected, real) << (GlobalTestSettings.updateMode ? ("Mismatch found and update mode turned on - " @@ -145,10 +144,8 @@ public: // Update the expected output file if requested. // It looks weird to duplicate the comparison between expected_output - // and - // stream.str(). However, if creating a variable for the comparison - // result, - // we cannot have pretty print of the string diff in the above. + // and stream.str(). However, if creating a variable for the comparison + // result, we cannot have pretty print of the string diff in the above. if (GlobalTestSettings.updateMode && expected != real) { EXPECT_TRUE(WriteFile(fname, real)) << "Flushing failed"; } @@ -165,7 +162,7 @@ public: const std::string spirv; // Optional SPIR-V disassembly text. }; - // Compiles and linkes the given source |code| of the given shader + // Compiles and links the given source |code| of the given shader // |stage| into the given |target| under the given |semantics|. Returns // a GlslangResult instance containing all the information generated // during the process. If |target| is Target::Spirv, also disassembles From 2c86427640187c3f5efa55a62464d8732cabfb4a Mon Sep 17 00:00:00 2001 From: scygan Date: Wed, 18 May 2016 18:09:17 +0200 Subject: [PATCH 101/140] Fix missing location decoration for structures put directly on input/output interfaces Spec for decorating the OpVariable: "The remaining variables listed by OpEntryPoint with the Input or Output storage class form the user-defined variable interface. These variables must be identified with a Location decoration" Spec for decorating struct type: "The layout of a structure type used as an Input or Output depends on whether it is also a Block (i.e. has a Block decoration). If it is a not a Block, then the structure type must have a Location decoration" --- SPIRV/GlslangToSpv.cpp | 12 ++++++++++-- Test/baseResults/spv.430.vert.out | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 0efccf46..8971470b 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -1961,6 +1961,14 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty if (type.getQualifier().hasXfbBuffer()) builder.addDecoration(spvType, spv::DecorationXfbBuffer, type.getQualifier().layoutXfbBuffer); } + + if (type.getBasicType() != glslang::EbtBlock && (type.getQualifier().storage == glslang::EvqVaryingIn || type.getQualifier().storage == glslang::EvqVaryingOut)) + { + // The layout of a structure type used as an Input or Output depends on whether it is also a Block (i.e. has a Block decoration). + // If it is a not a Block, then the structure type must have a Location decoration. + if (type.getQualifier().hasLocation()) + builder.addDecoration(spvType, spv::DecorationLocation, type.getQualifier().layoutLocation); + } } break; default: @@ -3918,8 +3926,6 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol addDecoration(id, TranslateInterpolationDecoration(symbol->getType().getQualifier())); if (symbol->getType().getQualifier().hasSpecConstantId()) addDecoration(id, spv::DecorationSpecId, symbol->getType().getQualifier().layoutSpecConstantId); - if (symbol->getQualifier().hasLocation()) - builder.addDecoration(id, spv::DecorationLocation, symbol->getQualifier().layoutLocation); if (symbol->getQualifier().hasIndex()) builder.addDecoration(id, spv::DecorationIndex, symbol->getQualifier().layoutIndex); if (symbol->getQualifier().hasComponent()) @@ -3935,6 +3941,8 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol } } + if (symbol->getQualifier().hasLocation()) + builder.addDecoration(id, spv::DecorationLocation, symbol->getQualifier().layoutLocation); addDecoration(id, TranslateInvariantDecoration(symbol->getType().getQualifier())); if (symbol->getQualifier().hasStream() && glslangIntermediate->isMultiStream()) { builder.addCapability(spv::CapabilityGeometryStreams); diff --git a/Test/baseResults/spv.430.vert.out b/Test/baseResults/spv.430.vert.out index e01b5aea..89483d9c 100755 --- a/Test/baseResults/spv.430.vert.out +++ b/Test/baseResults/spv.430.vert.out @@ -65,6 +65,8 @@ Linked vertex stage: MemberDecorate 60(SS) 0 Flat MemberDecorate 60(SS) 1 Flat MemberDecorate 60(SS) 2 Flat + Decorate 60(SS) Location 0 + Decorate 62(var) Location 0 MemberDecorate 63(MS) 0 Location 17 Decorate 63(MS) Block 2: TypeVoid From 2f1ee4525da5bb5e058245c29a47a477dd159e33 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Tue, 17 May 2016 23:03:28 -0400 Subject: [PATCH 102/140] Run link tests in the GTest framework. --- gtests/CMakeLists.txt | 1 + gtests/Link.FromFile.cpp | 107 +++++++++++++++++++++++++++++++++++ gtests/TestFixture.h | 117 +++++++++++++++++++++++---------------- 3 files changed, 177 insertions(+), 48 deletions(-) create mode 100644 gtests/Link.FromFile.cpp diff --git a/gtests/CMakeLists.txt b/gtests/CMakeLists.txt index d247a914..fe122c51 100644 --- a/gtests/CMakeLists.txt +++ b/gtests/CMakeLists.txt @@ -14,6 +14,7 @@ if (TARGET gmock) ${CMAKE_CURRENT_SOURCE_DIR}/AST.FromFile.cpp ${CMAKE_CURRENT_SOURCE_DIR}/BuiltInResource.FromFile.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Hlsl.FromFile.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Link.FromFile.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Pp.FromFile.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Spv.FromFile.cpp ) diff --git a/gtests/Link.FromFile.cpp b/gtests/Link.FromFile.cpp new file mode 100644 index 00000000..6db43d9c --- /dev/null +++ b/gtests/Link.FromFile.cpp @@ -0,0 +1,107 @@ +// +// Copyright (C) 2016 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 Google Inc. 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 + +#include "TestFixture.h" + +namespace glslangtest { +namespace { + +using LinkTest = GlslangTest< + ::testing::TestWithParam>>; + +TEST_P(LinkTest, FromFile) +{ + const auto& fileNames = GetParam(); + const size_t fileCount = fileNames.size(); + const EShMessages controls = DeriveOptions( + Source::GLSL, Semantics::OpenGL, Target::AST); + GlslangResult result; + + // Compile each input shader file. + std::vector> shaders; + for (size_t i = 0; i < fileCount; ++i) { + std::string contents; + tryLoadFile(GLSLANG_TEST_DIRECTORY "/" + fileNames[i], + "input", &contents); + shaders.emplace_back( + new glslang::TShader(GetShaderStage(GetSuffix(fileNames[i])))); + auto* shader = shaders.back().get(); + compile(shader, contents, "", controls); + result.shaderResults.push_back( + {fileNames[i], shader->getInfoLog(), shader->getInfoDebugLog()}); + } + + // Link all of them. + glslang::TProgram program; + for (const auto& shader : shaders) program.addShader(shader.get()); + program.link(controls); + result.linkingOutput = program.getInfoLog(); + result.linkingError = program.getInfoDebugLog(); + + std::ostringstream stream; + outputResultToStream(&stream, result, controls); + + // Check with expected results. + const std::string expectedOutputFname = + GLSLANG_TEST_DIRECTORY "/baseResults/" + fileNames.front() + ".out"; + std::string expectedOutput; + tryLoadFile(expectedOutputFname, "expected output", &expectedOutput); + + checkEqAndUpdateIfRequested(expectedOutput, stream.str(), expectedOutputFname); +} + +// clang-format off +INSTANTIATE_TEST_CASE_P( + Glsl, LinkTest, + ::testing::ValuesIn(std::vector>({ + {"mains1.frag", "mains2.frag", "noMain1.geom", "noMain2.geom"}, + {"noMain.vert", "mains.frag"}, + {"link1.frag", "link2.frag", "link3.frag"}, + {"recurse1.vert", "recurse1.frag", "recurse2.frag"}, + {"300link.frag"}, + {"300link2.frag"}, + {"300link3.frag"}, + {"empty.frag", "empty2.frag", "empty3.frag"}, + {"150.tesc", "150.tese", "400.tesc", "400.tese", "410.tesc", "420.tesc", "420.tese"}, + {"max_vertices_0.geom"}, + })), +); +// clang-format on + +} // anonymous namespace +} // namespace glslangtest diff --git a/gtests/TestFixture.h b/gtests/TestFixture.h index 0b389ada..1d692ed6 100644 --- a/gtests/TestFixture.h +++ b/gtests/TestFixture.h @@ -151,48 +151,61 @@ public: } } + struct ShaderResult { + std::string shaderName; + std::string output; + std::string error; + }; + // A struct for holding all the information returned by glslang compilation // and linking. struct GlslangResult { - const std::string compilationOutput; - const std::string compilationError; - const std::string linkingOutput; - const std::string linkingError; - const std::string spirvWarningsErrors; - const std::string spirv; // Optional SPIR-V disassembly text. + std::vector shaderResults; + std::string linkingOutput; + std::string linkingError; + std::string spirvWarningsErrors; + std::string spirv; // Optional SPIR-V disassembly text. }; - // Compiles and links the given source |code| of the given shader - // |stage| into the given |target| under the given |semantics|. Returns - // a GlslangResult instance containing all the information generated - // during the process. If |target| is Target::Spirv, also disassembles - // the result and returns disassembly text. - GlslangResult compile(const std::string& code, Source source, - const std::string& stage, Semantics semantics, - Target target, const std::string& entryPointName) + // Compiles and the given source |code| of the given shader |stage| into + // the target under the semantics conveyed via |controls|. Returns true + // and modifies |shader| on success. + bool compile(glslang::TShader* shader, const std::string& code, + const std::string& entryPointName, EShMessages controls) { const char* shaderStrings = code.data(); const int shaderLengths = static_cast(code.size()); - const EShLanguage kind = GetShaderStage(stage); - glslang::TShader shader(kind); - shader.setStringsWithLengths(&shaderStrings, &shaderLengths, 1); - if (!entryPointName.empty()) shader.setEntryPoint(entryPointName.c_str()); - const EShMessages messages = DeriveOptions(source, semantics, target); + shader->setStringsWithLengths(&shaderStrings, &shaderLengths, 1); + if (!entryPointName.empty()) shader->setEntryPoint(entryPointName.c_str()); // Reinitialize glslang if the semantics change. GlslangInitializer::InitializationToken token = - GlobalTestSettings.initializer->acquire(messages); - bool success = - shader.parse(&glslang::DefaultTBuiltInResource, defaultVersion, - isForwardCompatible, messages); + GlobalTestSettings.initializer->acquire(controls); + return shader->parse(&glslang::DefaultTBuiltInResource, defaultVersion, + isForwardCompatible, controls); + } + + // Compiles and links the given source |code| of the given shader + // |stage| into the target under the semantics specified via |controls|. + // Returns a GlslangResult instance containing all the information generated + // during the process. If the target includes SPIR-V, also disassembles + // the result and returns disassembly text. + GlslangResult compileAndLink( + const std::string shaderName, const std::string& code, + const std::string& entryPointName, EShMessages controls) + { + const EShLanguage kind = GetShaderStage(GetSuffix(shaderName)); + + glslang::TShader shader(kind); + bool success = compile(&shader, code, entryPointName, controls); glslang::TProgram program; program.addShader(&shader); - success &= program.link(messages); + success &= program.link(controls); spv::SpvBuildLogger logger; - if (success && (target == Target::Spv || target == Target::BothASTAndSpv)) { + if (success && (controls & EShMsgSpvRules)) { std::vector spirv_binary; glslang::GlslangToSpv(*program.getIntermediate(kind), spirv_binary, &logger); @@ -200,13 +213,37 @@ public: std::ostringstream disassembly_stream; spv::Parameterize(); spv::Disassemble(disassembly_stream, spirv_binary); - return {shader.getInfoLog(), shader.getInfoDebugLog(), + return {{{shaderName, shader.getInfoLog(), shader.getInfoDebugLog()},}, program.getInfoLog(), program.getInfoDebugLog(), logger.getAllMessages(), disassembly_stream.str()}; } else { - return {shader.getInfoLog(), shader.getInfoDebugLog(), - program.getInfoLog(), program.getInfoDebugLog(), - "", ""}; + return {{{shaderName, shader.getInfoLog(), shader.getInfoDebugLog()},}, + program.getInfoLog(), program.getInfoDebugLog(), "", ""}; + } + } + + void outputResultToStream(std::ostringstream* stream, + const GlslangResult& result, + EShMessages controls) + { + const auto outputIfNotEmpty = [&stream](const std::string& str) { + if (!str.empty()) *stream << str << "\n"; + }; + + for (const auto& shaderResult : result.shaderResults) { + *stream << shaderResult.shaderName << "\n"; + outputIfNotEmpty(shaderResult.output); + outputIfNotEmpty(shaderResult.error); + } + outputIfNotEmpty(result.linkingOutput); + outputIfNotEmpty(result.linkingError); + *stream << result.spirvWarningsErrors; + + if (controls & EShMsgSpvRules) { + *stream + << (result.spirv.empty() + ? "SPIR-V is not generated for failed compile or link\n" + : result.spirv); } } @@ -225,29 +262,13 @@ public: tryLoadFile(inputFname, "input", &input); tryLoadFile(expectedOutputFname, "expected output", &expectedOutput); + const EShMessages controls = DeriveOptions(source, semantics, target); GlslangResult result = - compile(input, source, GetSuffix(testName), - semantics, target, entryPointName); + compileAndLink(testName, input, entryPointName, controls); // Generate the hybrid output in the way of glslangValidator. std::ostringstream stream; - - const auto outputIfNotEmpty = [&stream](const std::string& str) { - if (!str.empty()) stream << str << "\n"; - }; - - stream << testName << "\n"; - outputIfNotEmpty(result.compilationOutput); - outputIfNotEmpty(result.compilationError); - outputIfNotEmpty(result.linkingOutput); - outputIfNotEmpty(result.linkingError); - stream << result.spirvWarningsErrors; - if (target == Target::Spv || target == Target::BothASTAndSpv) { - stream - << (result.spirv.empty() - ? "SPIR-V is not generated for failed compile or link\n" - : result.spirv); - } + outputResultToStream(&stream, result, controls); checkEqAndUpdateIfRequested(expectedOutput, stream.str(), expectedOutputFname); From 3d9165fde4085fc43e098ab827619c9fec9f5e00 Mon Sep 17 00:00:00 2001 From: Rex Xu Date: Thu, 19 May 2016 07:10:01 +0800 Subject: [PATCH 103/140] Parser: Redeclaration of gl_CullDistance is disallowed mistakenly. --- Test/450.frag | 7 +++ Test/baseResults/450.frag.out | 48 +++++++++++++++++++-- glslang/MachineIndependent/ParseHelper.cpp | 8 +++- glslang/MachineIndependent/linkValidate.cpp | 2 + 4 files changed, 59 insertions(+), 6 deletions(-) diff --git a/Test/450.frag b/Test/450.frag index a2d99e8c..04f3aa1c 100644 --- a/Test/450.frag +++ b/Test/450.frag @@ -47,3 +47,10 @@ void foo() s += imageSamples(i2dmsa); float f = imageAtomicExchange(i2dmsa, ivec3(in3), 2, 4.5); } + +in float gl_CullDistance[6]; + +float cull(int i) +{ + return (i >= 6) ? gl_CullDistance[5] : gl_CullDistance[i]; +} diff --git a/Test/baseResults/450.frag.out b/Test/baseResults/450.frag.out index 5d7035f9..23682e8a 100644 --- a/Test/baseResults/450.frag.out +++ b/Test/baseResults/450.frag.out @@ -51,7 +51,7 @@ Shader version: 450 0:18 move second child to first child (temp float) 0:18 'cull' (temp float) 0:18 direct index (smooth temp float CullDistance) -0:18 'gl_CullDistance' (smooth in implicitly-sized array of float CullDistance) +0:18 'gl_CullDistance' (smooth in 6-element array of float CullDistance) 0:18 Constant: 0:18 2 (const int) 0:19 Sequence @@ -130,12 +130,32 @@ Shader version: 450 0:48 2 (const int) 0:48 Constant: 0:48 4.500000 +0:53 Function Definition: cull(i1; (global float) +0:53 Function Parameters: +0:53 'i' (in int) +0:55 Sequence +0:55 Branch: Return with expression +0:55 Test condition and select (temp float) +0:55 Condition +0:55 Compare Greater Than or Equal (temp bool) +0:55 'i' (in int) +0:55 Constant: +0:55 6 (const int) +0:55 true case +0:55 direct index (smooth temp float CullDistance) +0:55 'gl_CullDistance' (smooth in 6-element array of float CullDistance) +0:55 Constant: +0:55 5 (const int) +0:55 false case +0:55 indirect index (smooth temp float CullDistance) +0:55 'gl_CullDistance' (smooth in 6-element array of float CullDistance) +0:55 'i' (in int) 0:? Linker Objects 0:? 'in1' (smooth in float) 0:? 'in2' (smooth in 2-component vector of float) 0:? 'in3' (smooth in 3-component vector of float) 0:? 'in4' (smooth in 4-component vector of float) -0:? 'gl_CullDistance' (smooth in implicitly-sized array of float CullDistance) +0:? 'gl_CullDistance' (smooth in 6-element array of float CullDistance) 0:? 's2dms' (uniform sampler2DMS) 0:? 'us2dmsa' (uniform usampler2DMSArray) 0:? 'ii2dms' (layout(rgba32i ) uniform iimage2DMS) @@ -195,7 +215,7 @@ Shader version: 450 0:18 move second child to first child (temp float) 0:18 'cull' (temp float) 0:18 direct index (smooth temp float CullDistance) -0:18 'gl_CullDistance' (smooth in 3-element array of float CullDistance) +0:18 'gl_CullDistance' (smooth in 6-element array of float CullDistance) 0:18 Constant: 0:18 2 (const int) 0:19 Sequence @@ -274,12 +294,32 @@ Shader version: 450 0:48 2 (const int) 0:48 Constant: 0:48 4.500000 +0:53 Function Definition: cull(i1; (global float) +0:53 Function Parameters: +0:53 'i' (in int) +0:55 Sequence +0:55 Branch: Return with expression +0:55 Test condition and select (temp float) +0:55 Condition +0:55 Compare Greater Than or Equal (temp bool) +0:55 'i' (in int) +0:55 Constant: +0:55 6 (const int) +0:55 true case +0:55 direct index (smooth temp float CullDistance) +0:55 'gl_CullDistance' (smooth in 6-element array of float CullDistance) +0:55 Constant: +0:55 5 (const int) +0:55 false case +0:55 indirect index (smooth temp float CullDistance) +0:55 'gl_CullDistance' (smooth in 6-element array of float CullDistance) +0:55 'i' (in int) 0:? Linker Objects 0:? 'in1' (smooth in float) 0:? 'in2' (smooth in 2-component vector of float) 0:? 'in3' (smooth in 3-component vector of float) 0:? 'in4' (smooth in 4-component vector of float) -0:? 'gl_CullDistance' (smooth in 3-element array of float CullDistance) +0:? 'gl_CullDistance' (smooth in 6-element array of float CullDistance) 0:? 's2dms' (uniform sampler2DMS) 0:? 'us2dmsa' (uniform usampler2DMSArray) 0:? 'ii2dms' (layout(rgba32i ) uniform iimage2DMS) diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 4db9ef70..93c674ee 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -3268,6 +3268,7 @@ TSymbol* TParseContext::redeclareBuiltinVariable(const TSourceLoc& loc, const TS (identifier == "gl_FragDepth" && ((nonEsRedecls && version >= 420) || esRedecls)) || (identifier == "gl_FragCoord" && ((nonEsRedecls && version >= 150) || esRedecls)) || identifier == "gl_ClipDistance" || + identifier == "gl_CullDistance" || identifier == "gl_FrontColor" || identifier == "gl_BackColor" || identifier == "gl_FrontSecondaryColor" || @@ -3320,8 +3321,9 @@ TSymbol* TParseContext::redeclareBuiltinVariable(const TSourceLoc& loc, const TS error(loc, "cannot apply layout qualifier to", "redeclaration", symbol->getName().c_str()); if (qualifier.isMemory() || qualifier.isAuxiliary() || symbol->getType().getQualifier().storage != qualifier.storage) error(loc, "cannot change storage, memory, or auxiliary qualification of", "redeclaration", symbol->getName().c_str()); - } else if (identifier == "gl_TexCoord" || - identifier == "gl_ClipDistance") { + } else if (identifier == "gl_TexCoord" || + identifier == "gl_ClipDistance" || + identifier == "gl_CullDistance") { if (qualifier.hasLayout() || qualifier.isMemory() || qualifier.isAuxiliary() || qualifier.nopersp != symbolQualifier.nopersp || qualifier.flat != symbolQualifier.flat || symbolQualifier.storage != qualifier.storage) @@ -3744,6 +3746,8 @@ void TParseContext::arrayLimitCheck(const TSourceLoc& loc, const TString& identi limitCheck(loc, size, "gl_MaxTextureCoords", "gl_TexCoord array size"); else if (identifier.compare("gl_ClipDistance") == 0) 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"); } // See if the provided value is less than the symbol indicated by limit, diff --git a/glslang/MachineIndependent/linkValidate.cpp b/glslang/MachineIndependent/linkValidate.cpp index 4a6e7e5b..c48e7bff 100644 --- a/glslang/MachineIndependent/linkValidate.cpp +++ b/glslang/MachineIndependent/linkValidate.cpp @@ -392,6 +392,8 @@ void TIntermediate::finalCheck(TInfoSink& infoSink) if (inIoAccessed("gl_ClipDistance") && inIoAccessed("gl_ClipVertex")) error(infoSink, "Can only use one of gl_ClipDistance or gl_ClipVertex (gl_ClipDistance is preferred)"); + if (inIoAccessed("gl_CullDistance") && inIoAccessed("gl_ClipVertex")) + error(infoSink, "Can only use one of gl_CullDistance or gl_ClipVertex (gl_ClipDistance is preferred)"); if (userOutputUsed() && (inIoAccessed("gl_FragColor") || inIoAccessed("gl_FragData"))) error(infoSink, "Cannot use gl_FragColor or gl_FragData when using user-defined outputs"); From d6e1a5b1f8415c9ef89f8d1cd842b2ca2655305c Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Tue, 17 May 2016 13:59:13 +0200 Subject: [PATCH 104/140] Add support for querying vertex attributes in reflection API --- glslang/MachineIndependent/ShaderLang.cpp | 3 +++ glslang/MachineIndependent/reflection.cpp | 24 +++++++++++++++++++++++ glslang/MachineIndependent/reflection.h | 13 +++++++++++- glslang/Public/ShaderLang.h | 3 +++ 4 files changed, 42 insertions(+), 1 deletion(-) diff --git a/glslang/MachineIndependent/ShaderLang.cpp b/glslang/MachineIndependent/ShaderLang.cpp index 5fd6f421..b6af0374 100644 --- a/glslang/MachineIndependent/ShaderLang.cpp +++ b/glslang/MachineIndependent/ShaderLang.cpp @@ -1572,6 +1572,9 @@ int TProgram::getUniformBlockIndex(int index) { return reflection->getUni int TProgram::getUniformType(int index) { return reflection->getUniform(index).glDefineType; } int TProgram::getUniformBufferOffset(int index) { return reflection->getUniform(index).offset; } int TProgram::getUniformArraySize(int index) { return reflection->getUniform(index).size; } +int TProgram::getNumLiveAttributes() { return reflection->getNumAttributes(); } +const char* TProgram::getAttributeName(int index) { return reflection->getAttribute(index).name.c_str(); } +int TProgram::getAttributeType(int index) { return reflection->getAttribute(index).glDefineType; } void TProgram::dumpReflection() { reflection->dump(); } diff --git a/glslang/MachineIndependent/reflection.cpp b/glslang/MachineIndependent/reflection.cpp index 19e08e16..d3e04af7 100644 --- a/glslang/MachineIndependent/reflection.cpp +++ b/glslang/MachineIndependent/reflection.cpp @@ -108,6 +108,22 @@ public: } } + void addAttribute(const TIntermSymbol& base) + { + if (processedDerefs.find(&base) == processedDerefs.end()) { + processedDerefs.insert(&base); + + const TString &name = base.getName(); + const TType &type = base.getType(); + + TReflection::TNameToIndex::const_iterator it = reflection.nameToIndex.find(name); + if (it == reflection.nameToIndex.end()) { + reflection.nameToIndex[name] = (int)reflection.indexToAttribute.size(); + reflection.indexToAttribute.push_back(TObjectReflection(name, 0, mapToGlType(type), 0, 0)); + } + } + } + // Lookup or calculate the offset of a block member, using the recursively // defined block offset rules. int getOffset(const TType& type, int index) @@ -671,6 +687,9 @@ void TLiveTraverser::visitSymbol(TIntermSymbol* base) { if (base->getQualifier().storage == EvqUniform) addUniform(*base); + + if (intermediate.getStage() == EShLangVertex && base->getQualifier().isPipeInput()) + addAttribute(*base); } // To prune semantically dead paths. @@ -728,6 +747,11 @@ void TReflection::dump() indexToUniformBlock[i].dump(); printf("\n"); + printf("Vertex attribute reflection:\n"); + for (size_t i = 0; i < indexToAttribute.size(); ++i) + indexToAttribute[i].dump(); + printf("\n"); + //printf("Live names\n"); //for (TNameToIndex::const_iterator it = nameToIndex.begin(); it != nameToIndex.end(); ++it) // printf("%s: %d\n", it->first.c_str(), it->second); diff --git a/glslang/MachineIndependent/reflection.h b/glslang/MachineIndependent/reflection.h index 42f0ccd8..5d930c7a 100644 --- a/glslang/MachineIndependent/reflection.h +++ b/glslang/MachineIndependent/reflection.h @@ -93,7 +93,17 @@ public: return badReflection; } - // for mapping any name to its index (both block names and uniforms names) + // for mapping an attribute index to the attribute's description + int getNumAttributes() { return (int)indexToAttribute.size(); } + const TObjectReflection& getAttribute(int i) const + { + if (i >= 0 && i < (int)indexToAttribute.size()) + return indexToAttribute[i]; + else + return badReflection; + } + + // for mapping any name to its index (block names, uniform names and attribute names) int getIndex(const char* name) const { TNameToIndex::const_iterator it = nameToIndex.find(name); @@ -116,6 +126,7 @@ protected: TNameToIndex nameToIndex; // maps names to indexes; can hold all types of data: uniform/buffer and which function names have been processed TMapIndexToReflection indexToUniform; TMapIndexToReflection indexToUniformBlock; + TMapIndexToReflection indexToAttribute; }; } // end namespace glslang diff --git a/glslang/Public/ShaderLang.h b/glslang/Public/ShaderLang.h index c45df689..f49e7b03 100644 --- a/glslang/Public/ShaderLang.h +++ b/glslang/Public/ShaderLang.h @@ -461,6 +461,9 @@ public: int getUniformType(int index); // can be used for glGetActiveUniformsiv(GL_UNIFORM_TYPE) int getUniformBufferOffset(int index); // can be used for glGetActiveUniformsiv(GL_UNIFORM_OFFSET) int getUniformArraySize(int index); // can be used for glGetActiveUniformsiv(GL_UNIFORM_SIZE) + int getNumLiveAttributes(); // can be used for glGetProgramiv(GL_ACTIVE_ATTRIBUTES) + const char *getAttributeName(int index); // can be used for glGetActiveAttrib() + int getAttributeType(int index); // can be used for glGetActiveAttrib() void dumpReflection(); protected: From bef7428dfdada02b51e32c2ee202e4780313d8dc Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Thu, 19 May 2016 09:26:20 +0200 Subject: [PATCH 105/140] Update test cases for vertex attribute reflection --- Test/baseResults/reflection.vert.out | 7 +++++++ Test/reflection.vert | 12 ++++++++++++ 2 files changed, 19 insertions(+) diff --git a/Test/baseResults/reflection.vert.out b/Test/baseResults/reflection.vert.out index 43fb2340..24ee7809 100644 --- a/Test/baseResults/reflection.vert.out +++ b/Test/baseResults/reflection.vert.out @@ -95,3 +95,10 @@ abl2[1]: offset -1, type ffffffff, size 4, index -1 abl2[2]: offset -1, type ffffffff, size 4, index -1 abl2[3]: offset -1, type ffffffff, size 4, index -1 +Vertex attribute reflection: +attributeFloat: offset 0, type 1406, size 0, index 0 +attributeFloat2: offset 0, type 8b50, size 0, index 0 +attributeFloat3: offset 0, type 8b51, size 0, index 0 +attributeFloat4: offset 0, type 8b52, size 0, index 0 +attributeMat4: offset 0, type 8b5c, size 0, index 0 + diff --git a/Test/reflection.vert b/Test/reflection.vert index 101f5ffc..be498225 100644 --- a/Test/reflection.vert +++ b/Test/reflection.vert @@ -94,6 +94,12 @@ struct deep3 { ivec3 v3; }; +in float attributeFloat; +layout(location = 2) in vec2 attributeFloat2; +in vec3 attributeFloat3; +in vec4 attributeFloat4; +in mat4 attributeMat4; + uniform deep3 deepA[2], deepB[2], deepC[3], deepD[2]; const bool control = true; @@ -167,4 +173,10 @@ void main() f += arrBl[2].foo + arrBl[0].foo; f += arrBl2[i].foo; + + f += attributeFloat; + f += attributeFloat2.x; + f += attributeFloat3.x; + f += attributeFloat4.x; + f += attributeMat4[0][1]; } From 8a9b1ee3b40c56a4ad1012b9fd9f7e0a3d47aca2 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 19 May 2016 13:31:43 -0400 Subject: [PATCH 106/140] Rename DefaultResourceLimits.* to ResourceLimits.*. --- StandAlone/CMakeLists.txt | 2 +- .../{DefaultResourceLimits.cpp => ResourceLimits.cpp} | 2 +- StandAlone/{DefaultResourceLimits.h => ResourceLimits.h} | 6 +++--- StandAlone/StandAlone.cpp | 2 +- gtests/BuiltInResource.FromFile.cpp | 2 +- gtests/TestFixture.h | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) rename StandAlone/{DefaultResourceLimits.cpp => ResourceLimits.cpp} (99%) rename StandAlone/{DefaultResourceLimits.h => ResourceLimits.h} (93%) diff --git a/StandAlone/CMakeLists.txt b/StandAlone/CMakeLists.txt index cd173c6c..e2e884a5 100644 --- a/StandAlone/CMakeLists.txt +++ b/StandAlone/CMakeLists.txt @@ -1,5 +1,5 @@ add_library(glslang-default-resource-limits - ${CMAKE_CURRENT_SOURCE_DIR}/DefaultResourceLimits.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/ResourceLimits.cpp ) set_property(TARGET glslang-default-resource-limits PROPERTY FOLDER glslang) diff --git a/StandAlone/DefaultResourceLimits.cpp b/StandAlone/ResourceLimits.cpp similarity index 99% rename from StandAlone/DefaultResourceLimits.cpp rename to StandAlone/ResourceLimits.cpp index 66032de1..374cd200 100644 --- a/StandAlone/DefaultResourceLimits.cpp +++ b/StandAlone/ResourceLimits.cpp @@ -34,7 +34,7 @@ #include -#include "DefaultResourceLimits.h" +#include "ResourceLimits.h" namespace glslang { diff --git a/StandAlone/DefaultResourceLimits.h b/StandAlone/ResourceLimits.h similarity index 93% rename from StandAlone/DefaultResourceLimits.h rename to StandAlone/ResourceLimits.h index fa52a2a7..06b67964 100644 --- a/StandAlone/DefaultResourceLimits.h +++ b/StandAlone/ResourceLimits.h @@ -32,8 +32,8 @@ // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. -#ifndef _DEFAULT_RESOURCE_LIMITS_INCLUDED_ -#define _DEFAULT_RESOURCE_LIMITS_INCLUDED_ +#ifndef _STAND_ALONE_RESOURCE_LIMITS_INCLUDED_ +#define _STAND_ALONE_RESOURCE_LIMITS_INCLUDED_ #include @@ -51,4 +51,4 @@ std::string GetDefaultTBuiltInResourceString(); } // end namespace glslang -#endif // _DEFAULT_RESOURCE_LIMITS_INCLUDED_ +#endif // _STAND_ALONE_RESOURCE_LIMITS_INCLUDED_ diff --git a/StandAlone/StandAlone.cpp b/StandAlone/StandAlone.cpp index 5c4be73d..8a497a2b 100644 --- a/StandAlone/StandAlone.cpp +++ b/StandAlone/StandAlone.cpp @@ -37,7 +37,7 @@ // this only applies to the standalone wrapper, not the front end in general #define _CRT_SECURE_NO_WARNINGS -#include "DefaultResourceLimits.h" +#include "ResourceLimits.h" #include "Worklist.h" #include "./../glslang/Include/ShHandle.h" #include "./../glslang/Include/revision.h" diff --git a/gtests/BuiltInResource.FromFile.cpp b/gtests/BuiltInResource.FromFile.cpp index c2d2b8b6..4d68d873 100644 --- a/gtests/BuiltInResource.FromFile.cpp +++ b/gtests/BuiltInResource.FromFile.cpp @@ -36,7 +36,7 @@ #include -#include "StandAlone/DefaultResourceLimits.h" +#include "StandAlone/ResourceLimits.h" #include "TestFixture.h" namespace glslangtest { diff --git a/gtests/TestFixture.h b/gtests/TestFixture.h index 1d692ed6..c5f3b87e 100644 --- a/gtests/TestFixture.h +++ b/gtests/TestFixture.h @@ -46,7 +46,7 @@ #include "SPIRV/GlslangToSpv.h" #include "SPIRV/disassemble.h" #include "SPIRV/doc.h" -#include "StandAlone/DefaultResourceLimits.h" +#include "StandAlone/ResourceLimits.h" #include "glslang/Public/ShaderLang.h" #include "Initializer.h" From 1b141728a6c5ca325f4744ef5f80e0c1b54bbdca Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 19 May 2016 13:50:49 -0400 Subject: [PATCH 107/140] Test compiling shaders with given resource limits using GTest. --- StandAlone/ResourceLimits.cpp | 204 ++++++++++++++++++++++++ StandAlone/ResourceLimits.h | 3 + StandAlone/StandAlone.cpp | 200 +---------------------- Test/baseResults/100LimitsConf.vert.out | 4 + Test/runtests | 2 +- gtests/CMakeLists.txt | 1 + gtests/Config.FromFile.cpp | 107 +++++++++++++ gtests/TestFixture.h | 8 +- 8 files changed, 326 insertions(+), 203 deletions(-) create mode 100644 gtests/Config.FromFile.cpp diff --git a/StandAlone/ResourceLimits.cpp b/StandAlone/ResourceLimits.cpp index 374cd200..434050a8 100644 --- a/StandAlone/ResourceLimits.cpp +++ b/StandAlone/ResourceLimits.cpp @@ -32,6 +32,7 @@ // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. +#include #include #include "ResourceLimits.h" @@ -236,4 +237,207 @@ std::string GetDefaultTBuiltInResourceString() return ostream.str(); } +void DecodeResourceLimits(TBuiltInResource* resources, char* config) { + const char* delims = " \t\n\r"; + const char* token = strtok(config, delims); + while (token) { + const char* valueStr = strtok(0, delims); + if (valueStr == 0 || ! (valueStr[0] == '-' || (valueStr[0] >= '0' && valueStr[0] <= '9'))) { + printf("Error: '%s' bad .conf file. Each name must be followed by one number.\n", valueStr ? valueStr : ""); + return; + } + int value = atoi(valueStr); + + if (strcmp(token, "MaxLights") == 0) + resources->maxLights = value; + else if (strcmp(token, "MaxClipPlanes") == 0) + resources->maxClipPlanes = value; + else if (strcmp(token, "MaxTextureUnits") == 0) + resources->maxTextureUnits = value; + else if (strcmp(token, "MaxTextureCoords") == 0) + resources->maxTextureCoords = value; + else if (strcmp(token, "MaxVertexAttribs") == 0) + resources->maxVertexAttribs = value; + else if (strcmp(token, "MaxVertexUniformComponents") == 0) + resources->maxVertexUniformComponents = value; + else if (strcmp(token, "MaxVaryingFloats") == 0) + resources->maxVaryingFloats = value; + else if (strcmp(token, "MaxVertexTextureImageUnits") == 0) + resources->maxVertexTextureImageUnits = value; + else if (strcmp(token, "MaxCombinedTextureImageUnits") == 0) + resources->maxCombinedTextureImageUnits = value; + else if (strcmp(token, "MaxTextureImageUnits") == 0) + resources->maxTextureImageUnits = value; + else if (strcmp(token, "MaxFragmentUniformComponents") == 0) + resources->maxFragmentUniformComponents = value; + else if (strcmp(token, "MaxDrawBuffers") == 0) + resources->maxDrawBuffers = value; + else if (strcmp(token, "MaxVertexUniformVectors") == 0) + resources->maxVertexUniformVectors = value; + else if (strcmp(token, "MaxVaryingVectors") == 0) + resources->maxVaryingVectors = value; + else if (strcmp(token, "MaxFragmentUniformVectors") == 0) + resources->maxFragmentUniformVectors = value; + else if (strcmp(token, "MaxVertexOutputVectors") == 0) + resources->maxVertexOutputVectors = value; + else if (strcmp(token, "MaxFragmentInputVectors") == 0) + resources->maxFragmentInputVectors = value; + else if (strcmp(token, "MinProgramTexelOffset") == 0) + resources->minProgramTexelOffset = value; + else if (strcmp(token, "MaxProgramTexelOffset") == 0) + resources->maxProgramTexelOffset = value; + else if (strcmp(token, "MaxClipDistances") == 0) + resources->maxClipDistances = value; + else if (strcmp(token, "MaxComputeWorkGroupCountX") == 0) + resources->maxComputeWorkGroupCountX = value; + else if (strcmp(token, "MaxComputeWorkGroupCountY") == 0) + resources->maxComputeWorkGroupCountY = value; + else if (strcmp(token, "MaxComputeWorkGroupCountZ") == 0) + resources->maxComputeWorkGroupCountZ = value; + else if (strcmp(token, "MaxComputeWorkGroupSizeX") == 0) + resources->maxComputeWorkGroupSizeX = value; + else if (strcmp(token, "MaxComputeWorkGroupSizeY") == 0) + resources->maxComputeWorkGroupSizeY = value; + else if (strcmp(token, "MaxComputeWorkGroupSizeZ") == 0) + resources->maxComputeWorkGroupSizeZ = value; + else if (strcmp(token, "MaxComputeUniformComponents") == 0) + resources->maxComputeUniformComponents = value; + else if (strcmp(token, "MaxComputeTextureImageUnits") == 0) + resources->maxComputeTextureImageUnits = value; + else if (strcmp(token, "MaxComputeImageUniforms") == 0) + resources->maxComputeImageUniforms = value; + else if (strcmp(token, "MaxComputeAtomicCounters") == 0) + resources->maxComputeAtomicCounters = value; + else if (strcmp(token, "MaxComputeAtomicCounterBuffers") == 0) + resources->maxComputeAtomicCounterBuffers = value; + else if (strcmp(token, "MaxVaryingComponents") == 0) + resources->maxVaryingComponents = value; + else if (strcmp(token, "MaxVertexOutputComponents") == 0) + resources->maxVertexOutputComponents = value; + else if (strcmp(token, "MaxGeometryInputComponents") == 0) + resources->maxGeometryInputComponents = value; + else if (strcmp(token, "MaxGeometryOutputComponents") == 0) + resources->maxGeometryOutputComponents = value; + else if (strcmp(token, "MaxFragmentInputComponents") == 0) + resources->maxFragmentInputComponents = value; + else if (strcmp(token, "MaxImageUnits") == 0) + resources->maxImageUnits = value; + else if (strcmp(token, "MaxCombinedImageUnitsAndFragmentOutputs") == 0) + resources->maxCombinedImageUnitsAndFragmentOutputs = value; + else if (strcmp(token, "MaxCombinedShaderOutputResources") == 0) + resources->maxCombinedShaderOutputResources = value; + else if (strcmp(token, "MaxImageSamples") == 0) + resources->maxImageSamples = value; + else if (strcmp(token, "MaxVertexImageUniforms") == 0) + resources->maxVertexImageUniforms = value; + else if (strcmp(token, "MaxTessControlImageUniforms") == 0) + resources->maxTessControlImageUniforms = value; + else if (strcmp(token, "MaxTessEvaluationImageUniforms") == 0) + resources->maxTessEvaluationImageUniforms = value; + else if (strcmp(token, "MaxGeometryImageUniforms") == 0) + resources->maxGeometryImageUniforms = value; + else if (strcmp(token, "MaxFragmentImageUniforms") == 0) + resources->maxFragmentImageUniforms = value; + else if (strcmp(token, "MaxCombinedImageUniforms") == 0) + resources->maxCombinedImageUniforms = value; + else if (strcmp(token, "MaxGeometryTextureImageUnits") == 0) + resources->maxGeometryTextureImageUnits = value; + else if (strcmp(token, "MaxGeometryOutputVertices") == 0) + resources->maxGeometryOutputVertices = value; + else if (strcmp(token, "MaxGeometryTotalOutputComponents") == 0) + resources->maxGeometryTotalOutputComponents = value; + else if (strcmp(token, "MaxGeometryUniformComponents") == 0) + resources->maxGeometryUniformComponents = value; + else if (strcmp(token, "MaxGeometryVaryingComponents") == 0) + resources->maxGeometryVaryingComponents = value; + else if (strcmp(token, "MaxTessControlInputComponents") == 0) + resources->maxTessControlInputComponents = value; + else if (strcmp(token, "MaxTessControlOutputComponents") == 0) + resources->maxTessControlOutputComponents = value; + else if (strcmp(token, "MaxTessControlTextureImageUnits") == 0) + resources->maxTessControlTextureImageUnits = value; + else if (strcmp(token, "MaxTessControlUniformComponents") == 0) + resources->maxTessControlUniformComponents = value; + else if (strcmp(token, "MaxTessControlTotalOutputComponents") == 0) + resources->maxTessControlTotalOutputComponents = value; + else if (strcmp(token, "MaxTessEvaluationInputComponents") == 0) + resources->maxTessEvaluationInputComponents = value; + else if (strcmp(token, "MaxTessEvaluationOutputComponents") == 0) + resources->maxTessEvaluationOutputComponents = value; + else if (strcmp(token, "MaxTessEvaluationTextureImageUnits") == 0) + resources->maxTessEvaluationTextureImageUnits = value; + else if (strcmp(token, "MaxTessEvaluationUniformComponents") == 0) + resources->maxTessEvaluationUniformComponents = value; + else if (strcmp(token, "MaxTessPatchComponents") == 0) + resources->maxTessPatchComponents = value; + else if (strcmp(token, "MaxPatchVertices") == 0) + resources->maxPatchVertices = value; + else if (strcmp(token, "MaxTessGenLevel") == 0) + resources->maxTessGenLevel = value; + else if (strcmp(token, "MaxViewports") == 0) + resources->maxViewports = value; + else if (strcmp(token, "MaxVertexAtomicCounters") == 0) + resources->maxVertexAtomicCounters = value; + else if (strcmp(token, "MaxTessControlAtomicCounters") == 0) + resources->maxTessControlAtomicCounters = value; + else if (strcmp(token, "MaxTessEvaluationAtomicCounters") == 0) + resources->maxTessEvaluationAtomicCounters = value; + else if (strcmp(token, "MaxGeometryAtomicCounters") == 0) + resources->maxGeometryAtomicCounters = value; + else if (strcmp(token, "MaxFragmentAtomicCounters") == 0) + resources->maxFragmentAtomicCounters = value; + else if (strcmp(token, "MaxCombinedAtomicCounters") == 0) + resources->maxCombinedAtomicCounters = value; + else if (strcmp(token, "MaxAtomicCounterBindings") == 0) + resources->maxAtomicCounterBindings = value; + else if (strcmp(token, "MaxVertexAtomicCounterBuffers") == 0) + resources->maxVertexAtomicCounterBuffers = value; + else if (strcmp(token, "MaxTessControlAtomicCounterBuffers") == 0) + resources->maxTessControlAtomicCounterBuffers = value; + else if (strcmp(token, "MaxTessEvaluationAtomicCounterBuffers") == 0) + resources->maxTessEvaluationAtomicCounterBuffers = value; + else if (strcmp(token, "MaxGeometryAtomicCounterBuffers") == 0) + resources->maxGeometryAtomicCounterBuffers = value; + else if (strcmp(token, "MaxFragmentAtomicCounterBuffers") == 0) + resources->maxFragmentAtomicCounterBuffers = value; + else if (strcmp(token, "MaxCombinedAtomicCounterBuffers") == 0) + resources->maxCombinedAtomicCounterBuffers = value; + else if (strcmp(token, "MaxAtomicCounterBufferSize") == 0) + resources->maxAtomicCounterBufferSize = value; + else if (strcmp(token, "MaxTransformFeedbackBuffers") == 0) + resources->maxTransformFeedbackBuffers = value; + else if (strcmp(token, "MaxTransformFeedbackInterleavedComponents") == 0) + resources->maxTransformFeedbackInterleavedComponents = value; + else if (strcmp(token, "MaxCullDistances") == 0) + resources->maxCullDistances = value; + else if (strcmp(token, "MaxCombinedClipAndCullDistances") == 0) + resources->maxCombinedClipAndCullDistances = value; + else if (strcmp(token, "MaxSamples") == 0) + resources->maxSamples = value; + + else if (strcmp(token, "nonInductiveForLoops") == 0) + resources->limits.nonInductiveForLoops = (value != 0); + else if (strcmp(token, "whileLoops") == 0) + resources->limits.whileLoops = (value != 0); + else if (strcmp(token, "doWhileLoops") == 0) + resources->limits.doWhileLoops = (value != 0); + else if (strcmp(token, "generalUniformIndexing") == 0) + resources->limits.generalUniformIndexing = (value != 0); + else if (strcmp(token, "generalAttributeMatrixVectorIndexing") == 0) + resources->limits.generalAttributeMatrixVectorIndexing = (value != 0); + else if (strcmp(token, "generalVaryingIndexing") == 0) + resources->limits.generalVaryingIndexing = (value != 0); + else if (strcmp(token, "generalSamplerIndexing") == 0) + resources->limits.generalSamplerIndexing = (value != 0); + else if (strcmp(token, "generalVariableIndexing") == 0) + resources->limits.generalVariableIndexing = (value != 0); + else if (strcmp(token, "generalConstantMatrixVectorIndexing") == 0) + resources->limits.generalConstantMatrixVectorIndexing = (value != 0); + else + printf("Warning: unrecognized limit (%s) in configuration file.\n", token); + + token = strtok(0, delims); + } +} + } // end namespace glslang diff --git a/StandAlone/ResourceLimits.h b/StandAlone/ResourceLimits.h index 06b67964..9c3eb3e9 100644 --- a/StandAlone/ResourceLimits.h +++ b/StandAlone/ResourceLimits.h @@ -49,6 +49,9 @@ extern const TBuiltInResource DefaultTBuiltInResource; // Returns the DefaultTBuiltInResource as a human-readable string. std::string GetDefaultTBuiltInResourceString(); +// Decodes the resource limits from |config| to |resources|. +void DecodeResourceLimits(TBuiltInResource* resources, char* config); + } // end namespace glslang #endif // _STAND_ALONE_RESOURCE_LIMITS_INCLUDED_ diff --git a/StandAlone/StandAlone.cpp b/StandAlone/StandAlone.cpp index 8a497a2b..3fd7e7d2 100644 --- a/StandAlone/StandAlone.cpp +++ b/StandAlone/StandAlone.cpp @@ -134,206 +134,8 @@ void ProcessConfigFile() return; } - const char* delims = " \t\n\r"; - const char* token = strtok(config, delims); - while (token) { - const char* valueStr = strtok(0, delims); - if (valueStr == 0 || ! (valueStr[0] == '-' || (valueStr[0] >= '0' && valueStr[0] <= '9'))) { - printf("Error: '%s' bad .conf file. Each name must be followed by one number.\n", valueStr ? valueStr : ""); - return; - } - int value = atoi(valueStr); + glslang::DecodeResourceLimits(&Resources, config); - if (strcmp(token, "MaxLights") == 0) - Resources.maxLights = value; - else if (strcmp(token, "MaxClipPlanes") == 0) - Resources.maxClipPlanes = value; - else if (strcmp(token, "MaxTextureUnits") == 0) - Resources.maxTextureUnits = value; - else if (strcmp(token, "MaxTextureCoords") == 0) - Resources.maxTextureCoords = value; - else if (strcmp(token, "MaxVertexAttribs") == 0) - Resources.maxVertexAttribs = value; - else if (strcmp(token, "MaxVertexUniformComponents") == 0) - Resources.maxVertexUniformComponents = value; - else if (strcmp(token, "MaxVaryingFloats") == 0) - Resources.maxVaryingFloats = value; - else if (strcmp(token, "MaxVertexTextureImageUnits") == 0) - Resources.maxVertexTextureImageUnits = value; - else if (strcmp(token, "MaxCombinedTextureImageUnits") == 0) - Resources.maxCombinedTextureImageUnits = value; - else if (strcmp(token, "MaxTextureImageUnits") == 0) - Resources.maxTextureImageUnits = value; - else if (strcmp(token, "MaxFragmentUniformComponents") == 0) - Resources.maxFragmentUniformComponents = value; - else if (strcmp(token, "MaxDrawBuffers") == 0) - Resources.maxDrawBuffers = value; - else if (strcmp(token, "MaxVertexUniformVectors") == 0) - Resources.maxVertexUniformVectors = value; - else if (strcmp(token, "MaxVaryingVectors") == 0) - Resources.maxVaryingVectors = value; - else if (strcmp(token, "MaxFragmentUniformVectors") == 0) - Resources.maxFragmentUniformVectors = value; - else if (strcmp(token, "MaxVertexOutputVectors") == 0) - Resources.maxVertexOutputVectors = value; - else if (strcmp(token, "MaxFragmentInputVectors") == 0) - Resources.maxFragmentInputVectors = value; - else if (strcmp(token, "MinProgramTexelOffset") == 0) - Resources.minProgramTexelOffset = value; - else if (strcmp(token, "MaxProgramTexelOffset") == 0) - Resources.maxProgramTexelOffset = value; - else if (strcmp(token, "MaxClipDistances") == 0) - Resources.maxClipDistances = value; - else if (strcmp(token, "MaxComputeWorkGroupCountX") == 0) - Resources.maxComputeWorkGroupCountX = value; - else if (strcmp(token, "MaxComputeWorkGroupCountY") == 0) - Resources.maxComputeWorkGroupCountY = value; - else if (strcmp(token, "MaxComputeWorkGroupCountZ") == 0) - Resources.maxComputeWorkGroupCountZ = value; - else if (strcmp(token, "MaxComputeWorkGroupSizeX") == 0) - Resources.maxComputeWorkGroupSizeX = value; - else if (strcmp(token, "MaxComputeWorkGroupSizeY") == 0) - Resources.maxComputeWorkGroupSizeY = value; - else if (strcmp(token, "MaxComputeWorkGroupSizeZ") == 0) - Resources.maxComputeWorkGroupSizeZ = value; - else if (strcmp(token, "MaxComputeUniformComponents") == 0) - Resources.maxComputeUniformComponents = value; - else if (strcmp(token, "MaxComputeTextureImageUnits") == 0) - Resources.maxComputeTextureImageUnits = value; - else if (strcmp(token, "MaxComputeImageUniforms") == 0) - Resources.maxComputeImageUniforms = value; - else if (strcmp(token, "MaxComputeAtomicCounters") == 0) - Resources.maxComputeAtomicCounters = value; - else if (strcmp(token, "MaxComputeAtomicCounterBuffers") == 0) - Resources.maxComputeAtomicCounterBuffers = value; - else if (strcmp(token, "MaxVaryingComponents") == 0) - Resources.maxVaryingComponents = value; - else if (strcmp(token, "MaxVertexOutputComponents") == 0) - Resources.maxVertexOutputComponents = value; - else if (strcmp(token, "MaxGeometryInputComponents") == 0) - Resources.maxGeometryInputComponents = value; - else if (strcmp(token, "MaxGeometryOutputComponents") == 0) - Resources.maxGeometryOutputComponents = value; - else if (strcmp(token, "MaxFragmentInputComponents") == 0) - Resources.maxFragmentInputComponents = value; - else if (strcmp(token, "MaxImageUnits") == 0) - Resources.maxImageUnits = value; - else if (strcmp(token, "MaxCombinedImageUnitsAndFragmentOutputs") == 0) - Resources.maxCombinedImageUnitsAndFragmentOutputs = value; - else if (strcmp(token, "MaxCombinedShaderOutputResources") == 0) - Resources.maxCombinedShaderOutputResources = value; - else if (strcmp(token, "MaxImageSamples") == 0) - Resources.maxImageSamples = value; - else if (strcmp(token, "MaxVertexImageUniforms") == 0) - Resources.maxVertexImageUniforms = value; - else if (strcmp(token, "MaxTessControlImageUniforms") == 0) - Resources.maxTessControlImageUniforms = value; - else if (strcmp(token, "MaxTessEvaluationImageUniforms") == 0) - Resources.maxTessEvaluationImageUniforms = value; - else if (strcmp(token, "MaxGeometryImageUniforms") == 0) - Resources.maxGeometryImageUniforms = value; - else if (strcmp(token, "MaxFragmentImageUniforms") == 0) - Resources.maxFragmentImageUniforms = value; - else if (strcmp(token, "MaxCombinedImageUniforms") == 0) - Resources.maxCombinedImageUniforms = value; - else if (strcmp(token, "MaxGeometryTextureImageUnits") == 0) - Resources.maxGeometryTextureImageUnits = value; - else if (strcmp(token, "MaxGeometryOutputVertices") == 0) - Resources.maxGeometryOutputVertices = value; - else if (strcmp(token, "MaxGeometryTotalOutputComponents") == 0) - Resources.maxGeometryTotalOutputComponents = value; - else if (strcmp(token, "MaxGeometryUniformComponents") == 0) - Resources.maxGeometryUniformComponents = value; - else if (strcmp(token, "MaxGeometryVaryingComponents") == 0) - Resources.maxGeometryVaryingComponents = value; - else if (strcmp(token, "MaxTessControlInputComponents") == 0) - Resources.maxTessControlInputComponents = value; - else if (strcmp(token, "MaxTessControlOutputComponents") == 0) - Resources.maxTessControlOutputComponents = value; - else if (strcmp(token, "MaxTessControlTextureImageUnits") == 0) - Resources.maxTessControlTextureImageUnits = value; - else if (strcmp(token, "MaxTessControlUniformComponents") == 0) - Resources.maxTessControlUniformComponents = value; - else if (strcmp(token, "MaxTessControlTotalOutputComponents") == 0) - Resources.maxTessControlTotalOutputComponents = value; - else if (strcmp(token, "MaxTessEvaluationInputComponents") == 0) - Resources.maxTessEvaluationInputComponents = value; - else if (strcmp(token, "MaxTessEvaluationOutputComponents") == 0) - Resources.maxTessEvaluationOutputComponents = value; - else if (strcmp(token, "MaxTessEvaluationTextureImageUnits") == 0) - Resources.maxTessEvaluationTextureImageUnits = value; - else if (strcmp(token, "MaxTessEvaluationUniformComponents") == 0) - Resources.maxTessEvaluationUniformComponents = value; - else if (strcmp(token, "MaxTessPatchComponents") == 0) - Resources.maxTessPatchComponents = value; - else if (strcmp(token, "MaxPatchVertices") == 0) - Resources.maxPatchVertices = value; - else if (strcmp(token, "MaxTessGenLevel") == 0) - Resources.maxTessGenLevel = value; - else if (strcmp(token, "MaxViewports") == 0) - Resources.maxViewports = value; - else if (strcmp(token, "MaxVertexAtomicCounters") == 0) - Resources.maxVertexAtomicCounters = value; - else if (strcmp(token, "MaxTessControlAtomicCounters") == 0) - Resources.maxTessControlAtomicCounters = value; - else if (strcmp(token, "MaxTessEvaluationAtomicCounters") == 0) - Resources.maxTessEvaluationAtomicCounters = value; - else if (strcmp(token, "MaxGeometryAtomicCounters") == 0) - Resources.maxGeometryAtomicCounters = value; - else if (strcmp(token, "MaxFragmentAtomicCounters") == 0) - Resources.maxFragmentAtomicCounters = value; - else if (strcmp(token, "MaxCombinedAtomicCounters") == 0) - Resources.maxCombinedAtomicCounters = value; - else if (strcmp(token, "MaxAtomicCounterBindings") == 0) - Resources.maxAtomicCounterBindings = value; - else if (strcmp(token, "MaxVertexAtomicCounterBuffers") == 0) - Resources.maxVertexAtomicCounterBuffers = value; - else if (strcmp(token, "MaxTessControlAtomicCounterBuffers") == 0) - Resources.maxTessControlAtomicCounterBuffers = value; - else if (strcmp(token, "MaxTessEvaluationAtomicCounterBuffers") == 0) - Resources.maxTessEvaluationAtomicCounterBuffers = value; - else if (strcmp(token, "MaxGeometryAtomicCounterBuffers") == 0) - Resources.maxGeometryAtomicCounterBuffers = value; - else if (strcmp(token, "MaxFragmentAtomicCounterBuffers") == 0) - Resources.maxFragmentAtomicCounterBuffers = value; - else if (strcmp(token, "MaxCombinedAtomicCounterBuffers") == 0) - Resources.maxCombinedAtomicCounterBuffers = value; - else if (strcmp(token, "MaxAtomicCounterBufferSize") == 0) - Resources.maxAtomicCounterBufferSize = value; - else if (strcmp(token, "MaxTransformFeedbackBuffers") == 0) - Resources.maxTransformFeedbackBuffers = value; - else if (strcmp(token, "MaxTransformFeedbackInterleavedComponents") == 0) - Resources.maxTransformFeedbackInterleavedComponents = value; - else if (strcmp(token, "MaxCullDistances") == 0) - Resources.maxCullDistances = value; - else if (strcmp(token, "MaxCombinedClipAndCullDistances") == 0) - Resources.maxCombinedClipAndCullDistances = value; - else if (strcmp(token, "MaxSamples") == 0) - Resources.maxSamples = value; - - else if (strcmp(token, "nonInductiveForLoops") == 0) - Resources.limits.nonInductiveForLoops = (value != 0); - else if (strcmp(token, "whileLoops") == 0) - Resources.limits.whileLoops = (value != 0); - else if (strcmp(token, "doWhileLoops") == 0) - Resources.limits.doWhileLoops = (value != 0); - else if (strcmp(token, "generalUniformIndexing") == 0) - Resources.limits.generalUniformIndexing = (value != 0); - else if (strcmp(token, "generalAttributeMatrixVectorIndexing") == 0) - Resources.limits.generalAttributeMatrixVectorIndexing = (value != 0); - else if (strcmp(token, "generalVaryingIndexing") == 0) - Resources.limits.generalVaryingIndexing = (value != 0); - else if (strcmp(token, "generalSamplerIndexing") == 0) - Resources.limits.generalSamplerIndexing = (value != 0); - else if (strcmp(token, "generalVariableIndexing") == 0) - Resources.limits.generalVariableIndexing = (value != 0); - else if (strcmp(token, "generalConstantMatrixVectorIndexing") == 0) - Resources.limits.generalConstantMatrixVectorIndexing = (value != 0); - else - printf("Warning: unrecognized limit (%s) in configuration file.\n", token); - - token = strtok(0, delims); - } if (configStrings) FreeFileData(configStrings); else diff --git a/Test/baseResults/100LimitsConf.vert.out b/Test/baseResults/100LimitsConf.vert.out index 46cb8453..e27c2cc7 100644 --- a/Test/baseResults/100LimitsConf.vert.out +++ b/Test/baseResults/100LimitsConf.vert.out @@ -22,3 +22,7 @@ ERROR: 0:65: 'limitations' : Non-constant-index-expression ERROR: 20 compilation errors. No code generated. + +Linked vertex stage: + + diff --git a/Test/runtests b/Test/runtests index d5099a91..6e6524ab 100755 --- a/Test/runtests +++ b/Test/runtests @@ -14,7 +14,7 @@ $EXE -c > $TARGETDIR/test.conf diff -b $BASEDIR/test.conf $TARGETDIR/test.conf || HASERROR=1 $EXE -i -l $TARGETDIR/test.conf specExamples.vert > $TARGETDIR/specExamples.vert.out diff -b $BASEDIR/specExamples.vert.out $TARGETDIR || HASERROR=1 -$EXE 100Limits.vert 100.conf > $TARGETDIR/100LimitsConf.vert.out +$EXE -l 100Limits.vert 100.conf > $TARGETDIR/100LimitsConf.vert.out diff -b $BASEDIR/100LimitsConf.vert.out $TARGETDIR/100LimitsConf.vert.out || HASERROR=1 # diff --git a/gtests/CMakeLists.txt b/gtests/CMakeLists.txt index fe122c51..dae0df3c 100644 --- a/gtests/CMakeLists.txt +++ b/gtests/CMakeLists.txt @@ -13,6 +13,7 @@ if (TARGET gmock) # Test related source files ${CMAKE_CURRENT_SOURCE_DIR}/AST.FromFile.cpp ${CMAKE_CURRENT_SOURCE_DIR}/BuiltInResource.FromFile.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Config.FromFile.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Hlsl.FromFile.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Link.FromFile.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Pp.FromFile.cpp diff --git a/gtests/Config.FromFile.cpp b/gtests/Config.FromFile.cpp new file mode 100644 index 00000000..20c98be5 --- /dev/null +++ b/gtests/Config.FromFile.cpp @@ -0,0 +1,107 @@ +// +// Copyright (C) 2016 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 Google Inc. 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 "StandAlone/ResourceLimits.h" +#include "TestFixture.h" + +namespace glslangtest { +namespace { + +struct TestCaseSpec { + std::string input; + std::string config; + std::string output; + EShMessages controls; +}; + +using ConfigTest = GlslangTest<::testing::TestWithParam>; + +TEST_P(ConfigTest, FromFile) +{ + TestCaseSpec testCase = GetParam(); + GlslangResult result; + + // Get the contents for input shader and limit configurations. + std::string shaderContents, configContents; + tryLoadFile(GLSLANG_TEST_DIRECTORY "/" + testCase.input, "input", &shaderContents); + tryLoadFile(GLSLANG_TEST_DIRECTORY "/" + testCase.config, "limits config", &configContents); + + // Decode limit configurations. + TBuiltInResource resources = {}; + { + const size_t len = configContents.size(); + char* configChars = new char[len + 1]; + memcpy(configChars, configContents.data(), len); + configChars[len] = 0; + glslang::DecodeResourceLimits(&resources, configChars); + delete[] configChars; + } + + // Compile the shader. + glslang::TShader shader(GetShaderStage(GetSuffix(testCase.input))); + compile(&shader, shaderContents, "", testCase.controls, &resources); + result.shaderResults.push_back( + {testCase.input, shader.getInfoLog(), shader.getInfoDebugLog()}); + + // Link the shader. + glslang::TProgram program; + program.addShader(&shader); + program.link(testCase.controls); + result.linkingOutput = program.getInfoLog(); + result.linkingError = program.getInfoDebugLog(); + + std::ostringstream stream; + outputResultToStream(&stream, result, testCase.controls); + + // Check with expected results. + const std::string expectedOutputFname = + GLSLANG_TEST_DIRECTORY "/baseResults/" + testCase.output; + std::string expectedOutput; + tryLoadFile(expectedOutputFname, "expected output", &expectedOutput); + + checkEqAndUpdateIfRequested(expectedOutput, stream.str(), expectedOutputFname); +} + +// clang-format off +INSTANTIATE_TEST_CASE_P( + Glsl, ConfigTest, + ::testing::ValuesIn(std::vector({ + {"specExamples.vert", "baseResults/test.conf", "specExamples.vert.out", EShMsgAST}, + {"100Limits.vert", "100.conf", "100LimitsConf.vert.out", EShMsgDefault}, + })), +); +// clang-format on + +} // anonymous namespace +} // namespace glslangtest diff --git a/gtests/TestFixture.h b/gtests/TestFixture.h index c5f3b87e..e71bab1c 100644 --- a/gtests/TestFixture.h +++ b/gtests/TestFixture.h @@ -171,7 +171,8 @@ public: // the target under the semantics conveyed via |controls|. Returns true // and modifies |shader| on success. bool compile(glslang::TShader* shader, const std::string& code, - const std::string& entryPointName, EShMessages controls) + const std::string& entryPointName, EShMessages controls, + const TBuiltInResource* resources=nullptr) { const char* shaderStrings = code.data(); const int shaderLengths = static_cast(code.size()); @@ -181,8 +182,9 @@ public: // Reinitialize glslang if the semantics change. GlslangInitializer::InitializationToken token = GlobalTestSettings.initializer->acquire(controls); - return shader->parse(&glslang::DefaultTBuiltInResource, defaultVersion, - isForwardCompatible, controls); + return shader->parse( + (resources ? resources : &glslang::DefaultTBuiltInResource), + defaultVersion, isForwardCompatible, controls); } // Compiles and links the given source |code| of the given shader From 00852b12d9a0495db9b3513fe7222ade793d896d Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Thu, 19 May 2016 22:19:58 +0200 Subject: [PATCH 108/140] Remove declaration for ShGetPhysicalAttributeBindings The function ShGetPhysicalAttributeBindings() is declared in the header, but not defined (or referenced) anywhere in the codebase. --- glslang/Public/ShaderLang.h | 1 - 1 file changed, 1 deletion(-) diff --git a/glslang/Public/ShaderLang.h b/glslang/Public/ShaderLang.h index f49e7b03..385955a9 100644 --- a/glslang/Public/ShaderLang.h +++ b/glslang/Public/ShaderLang.h @@ -222,7 +222,6 @@ SH_IMPORT_EXPORT const char* ShGetInfoLog(const ShHandle); SH_IMPORT_EXPORT const void* ShGetExecutable(const ShHandle); SH_IMPORT_EXPORT int ShSetVirtualAttributeBindings(const ShHandle, const ShBindingTable*); // to detect user aliasing SH_IMPORT_EXPORT int ShSetFixedAttributeBindings(const ShHandle, const ShBindingTable*); // to force any physical mappings -SH_IMPORT_EXPORT int ShGetPhysicalAttributeBindings(const ShHandle, const ShBindingTable**); // for all attributes // // Tell the linker to never assign a vertex attribute to this list of physical attributes // From 823fc656445946b805f46024a4499ee354b5824c Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Thu, 19 May 2016 18:26:42 -0600 Subject: [PATCH 109/140] SPV: Don't emit memory barrier for ESSL barrier(), but still do for GLSL barrier(). Addresses issue #205. Current open Khronos bug for finalizing this. --- SPIRV/GlslangToSpv.cpp | 3 +- Test/baseResults/spv.310.comp.out | 208 +++++++++++++++--------------- 2 files changed, 105 insertions(+), 106 deletions(-) diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 8971470b..ec63d63d 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -3881,7 +3881,8 @@ spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op) builder.createNoResultOp(spv::OpEndPrimitive); return 0; case glslang::EOpBarrier: - builder.createMemoryBarrier(spv::ScopeDevice, spv::MemorySemanticsAllMemory); + if (glslangIntermediate->getProfile() != EEsProfile) + builder.createMemoryBarrier(spv::ScopeDevice, spv::MemorySemanticsAllMemory); builder.createControlBarrier(spv::ScopeDevice, spv::ScopeDevice, spv::MemorySemanticsMaskNone); return 0; case glslang::EOpMemoryBarrier: diff --git a/Test/baseResults/spv.310.comp.out b/Test/baseResults/spv.310.comp.out index fa23af92..3eafc2b5 100755 --- a/Test/baseResults/spv.310.comp.out +++ b/Test/baseResults/spv.310.comp.out @@ -7,123 +7,121 @@ Linked compute stage: // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 67 +// Id's are bound by 66 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint GLCompute 4 "main" 53 + EntryPoint GLCompute 4 "main" 52 ExecutionMode 4 LocalSize 16 32 4 Source ESSL 310 Name 4 "main" - Name 13 "outb" - MemberName 13(outb) 0 "f" - MemberName 13(outb) 1 "g" - MemberName 13(outb) 2 "h" - MemberName 13(outb) 3 "uns" - Name 15 "outbname" - Name 19 "s" - Name 24 "outbna" - MemberName 24(outbna) 0 "k" - MemberName 24(outbna) 1 "na" - Name 26 "outbnamena" - Name 42 "i" - Name 48 "outs" - MemberName 48(outs) 0 "s" - MemberName 48(outs) 1 "va" - Name 50 "outnames" - Name 53 "gl_LocalInvocationID" - Decorate 12 ArrayStride 16 - MemberDecorate 13(outb) 0 Offset 0 - MemberDecorate 13(outb) 1 Offset 4 - MemberDecorate 13(outb) 2 Offset 8 - MemberDecorate 13(outb) 3 Offset 16 - Decorate 13(outb) BufferBlock - Decorate 15(outbname) DescriptorSet 0 - MemberDecorate 24(outbna) 0 Offset 0 - MemberDecorate 24(outbna) 1 Offset 16 - Decorate 24(outbna) BufferBlock - Decorate 26(outbnamena) DescriptorSet 0 - Decorate 47 ArrayStride 16 - MemberDecorate 48(outs) 0 Offset 0 - MemberDecorate 48(outs) 1 Offset 16 - Decorate 48(outs) BufferBlock - Decorate 50(outnames) DescriptorSet 0 - Decorate 53(gl_LocalInvocationID) BuiltIn LocalInvocationId - Decorate 66 BuiltIn WorkgroupSize + Name 12 "outb" + MemberName 12(outb) 0 "f" + MemberName 12(outb) 1 "g" + MemberName 12(outb) 2 "h" + MemberName 12(outb) 3 "uns" + Name 14 "outbname" + Name 18 "s" + Name 23 "outbna" + MemberName 23(outbna) 0 "k" + MemberName 23(outbna) 1 "na" + Name 25 "outbnamena" + Name 41 "i" + Name 47 "outs" + MemberName 47(outs) 0 "s" + MemberName 47(outs) 1 "va" + Name 49 "outnames" + Name 52 "gl_LocalInvocationID" + Decorate 11 ArrayStride 16 + MemberDecorate 12(outb) 0 Offset 0 + MemberDecorate 12(outb) 1 Offset 4 + MemberDecorate 12(outb) 2 Offset 8 + MemberDecorate 12(outb) 3 Offset 16 + Decorate 12(outb) BufferBlock + Decorate 14(outbname) DescriptorSet 0 + MemberDecorate 23(outbna) 0 Offset 0 + MemberDecorate 23(outbna) 1 Offset 16 + Decorate 23(outbna) BufferBlock + Decorate 25(outbnamena) DescriptorSet 0 + Decorate 46 ArrayStride 16 + MemberDecorate 47(outs) 0 Offset 0 + MemberDecorate 47(outs) 1 Offset 16 + Decorate 47(outs) BufferBlock + Decorate 49(outnames) DescriptorSet 0 + Decorate 52(gl_LocalInvocationID) BuiltIn LocalInvocationId + Decorate 65 BuiltIn WorkgroupSize 2: TypeVoid 3: TypeFunction 2 6: TypeInt 32 0 7: 6(int) Constant 1 - 8: 6(int) Constant 4062 - 9: 6(int) Constant 0 - 10: TypeFloat 32 - 11: TypeVector 10(float) 3 - 12: TypeRuntimeArray 11(fvec3) - 13(outb): TypeStruct 10(float) 10(float) 10(float) 12 - 14: TypePointer Uniform 13(outb) - 15(outbname): 14(ptr) Variable Uniform - 16: TypeInt 32 1 - 17: 16(int) Constant 0 - 18: TypePointer Workgroup 10(float) - 19(s): 18(ptr) Variable Workgroup - 21: TypePointer Uniform 10(float) - 23: TypeVector 10(float) 4 - 24(outbna): TypeStruct 16(int) 23(fvec4) - 25: TypePointer Uniform 24(outbna) - 26(outbnamena): 25(ptr) Variable Uniform - 27: 16(int) Constant 1 - 30: TypePointer Uniform 23(fvec4) - 32: 16(int) Constant 3 - 33: 16(int) Constant 18 - 36: 16(int) Constant 17 - 37: 10(float) Constant 1077936128 - 38: 11(fvec3) ConstantComposite 37 37 37 - 39: TypePointer Uniform 11(fvec3) - 41: TypePointer Workgroup 16(int) - 42(i): 41(ptr) Variable Workgroup - 47: TypeRuntimeArray 23(fvec4) - 48(outs): TypeStruct 16(int) 47 - 49: TypePointer Uniform 48(outs) - 50(outnames): 49(ptr) Variable Uniform - 51: TypeVector 6(int) 3 - 52: TypePointer Input 51(ivec3) -53(gl_LocalInvocationID): 52(ptr) Variable Input - 54: TypePointer Input 6(int) - 61: TypePointer Uniform 16(int) - 63: 6(int) Constant 16 - 64: 6(int) Constant 32 - 65: 6(int) Constant 4 - 66: 51(ivec3) ConstantComposite 63 64 65 + 8: 6(int) Constant 0 + 9: TypeFloat 32 + 10: TypeVector 9(float) 3 + 11: TypeRuntimeArray 10(fvec3) + 12(outb): TypeStruct 9(float) 9(float) 9(float) 11 + 13: TypePointer Uniform 12(outb) + 14(outbname): 13(ptr) Variable Uniform + 15: TypeInt 32 1 + 16: 15(int) Constant 0 + 17: TypePointer Workgroup 9(float) + 18(s): 17(ptr) Variable Workgroup + 20: TypePointer Uniform 9(float) + 22: TypeVector 9(float) 4 + 23(outbna): TypeStruct 15(int) 22(fvec4) + 24: TypePointer Uniform 23(outbna) + 25(outbnamena): 24(ptr) Variable Uniform + 26: 15(int) Constant 1 + 29: TypePointer Uniform 22(fvec4) + 31: 15(int) Constant 3 + 32: 15(int) Constant 18 + 35: 15(int) Constant 17 + 36: 9(float) Constant 1077936128 + 37: 10(fvec3) ConstantComposite 36 36 36 + 38: TypePointer Uniform 10(fvec3) + 40: TypePointer Workgroup 15(int) + 41(i): 40(ptr) Variable Workgroup + 46: TypeRuntimeArray 22(fvec4) + 47(outs): TypeStruct 15(int) 46 + 48: TypePointer Uniform 47(outs) + 49(outnames): 48(ptr) Variable Uniform + 50: TypeVector 6(int) 3 + 51: TypePointer Input 50(ivec3) +52(gl_LocalInvocationID): 51(ptr) Variable Input + 53: TypePointer Input 6(int) + 60: TypePointer Uniform 15(int) + 62: 6(int) Constant 16 + 63: 6(int) Constant 32 + 64: 6(int) Constant 4 + 65: 50(ivec3) ConstantComposite 62 63 64 4(main): 2 Function None 3 5: Label - MemoryBarrier 7 8 - ControlBarrier 7 7 9 - 20: 10(float) Load 19(s) - 22: 21(ptr) AccessChain 15(outbname) 17 - Store 22 20 - 28: 10(float) Load 19(s) - 29: 23(fvec4) CompositeConstruct 28 28 28 28 - 31: 30(ptr) AccessChain 26(outbnamena) 27 - Store 31 29 - 34: 21(ptr) AccessChain 15(outbname) 32 33 9 - 35: 10(float) Load 34 - Store 19(s) 35 - 40: 39(ptr) AccessChain 15(outbname) 32 36 - Store 40 38 - 43: 16(int) Load 42(i) - 44: 10(float) Load 19(s) - 45: 11(fvec3) CompositeConstruct 44 44 44 - 46: 39(ptr) AccessChain 15(outbname) 32 43 - Store 46 45 - 55: 54(ptr) AccessChain 53(gl_LocalInvocationID) 9 - 56: 6(int) Load 55 - 57: 10(float) Load 19(s) - 58: 23(fvec4) CompositeConstruct 57 57 57 57 - 59: 30(ptr) AccessChain 50(outnames) 27 56 - Store 59 58 - 60: 16(int) ArrayLength 15(outbname) 3 - 62: 61(ptr) AccessChain 50(outnames) 17 - Store 62 60 + ControlBarrier 7 7 8 + 19: 9(float) Load 18(s) + 21: 20(ptr) AccessChain 14(outbname) 16 + Store 21 19 + 27: 9(float) Load 18(s) + 28: 22(fvec4) CompositeConstruct 27 27 27 27 + 30: 29(ptr) AccessChain 25(outbnamena) 26 + Store 30 28 + 33: 20(ptr) AccessChain 14(outbname) 31 32 8 + 34: 9(float) Load 33 + Store 18(s) 34 + 39: 38(ptr) AccessChain 14(outbname) 31 35 + Store 39 37 + 42: 15(int) Load 41(i) + 43: 9(float) Load 18(s) + 44: 10(fvec3) CompositeConstruct 43 43 43 + 45: 38(ptr) AccessChain 14(outbname) 31 42 + Store 45 44 + 54: 53(ptr) AccessChain 52(gl_LocalInvocationID) 8 + 55: 6(int) Load 54 + 56: 9(float) Load 18(s) + 57: 22(fvec4) CompositeConstruct 56 56 56 56 + 58: 29(ptr) AccessChain 49(outnames) 26 55 + Store 58 57 + 59: 15(int) ArrayLength 14(outbname) 3 + 61: 60(ptr) AccessChain 49(outnames) 16 + Store 61 59 Return FunctionEnd From e5712a2549616f866a31853b98618a7b99666d58 Mon Sep 17 00:00:00 2001 From: qining Date: Fri, 20 May 2016 14:11:28 -0400 Subject: [PATCH 110/140] Fix the slow down in noContraction propagation --- glslang/MachineIndependent/propagateNoContraction.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/glslang/MachineIndependent/propagateNoContraction.cpp b/glslang/MachineIndependent/propagateNoContraction.cpp index dcb75711..c7f3bc3a 100644 --- a/glslang/MachineIndependent/propagateNoContraction.cpp +++ b/glslang/MachineIndependent/propagateNoContraction.cpp @@ -401,7 +401,8 @@ bool TSymbolDefinitionCollectingTraverser::visitBinary(glslang::TVisit /* visit } else { // For other binary nodes, still traverse the right node. current_object_.clear(); - return true; + node->getRight()->traverse(this); + return false; } return false; } From 8d72f1a2c429c7bdbf1468f2348282ae59e018ca Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Fri, 20 May 2016 12:06:03 -0600 Subject: [PATCH 111/140] Full stack: distinguish between a scalar and a vector of size 1. There have been GLSL extensions considering this, and HLSL does it. This is a fully backward compatible change that allows this distinction. --- SPIRV/GlslangToSpv.cpp | 6 +- Test/baseResults/hlsl.float1.frag.out | 100 ++++++++++++++++++++ Test/hlsl.float1.frag | 7 ++ glslang/Include/Types.h | 49 ++++++---- glslang/MachineIndependent/Intermediate.cpp | 6 +- gtests/Hlsl.FromFile.cpp | 1 + hlsl/hlslGrammar.cpp | 4 + hlsl/hlslParseHelper.cpp | 7 -- hlsl/hlslParseHelper.h | 1 - 9 files changed, 152 insertions(+), 29 deletions(-) create mode 100755 Test/baseResults/hlsl.float1.frag.out create mode 100644 Test/hlsl.float1.frag diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index ec63d63d..d9d3555e 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -1366,7 +1366,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt { // for scalar dot product, use multiply glslang::TIntermSequence& glslangOperands = node->getSequence(); - if (! glslangOperands[0]->getAsTyped()->isVector()) + if (glslangOperands[0]->getAsTyped()->getVectorSize() == 1) binOp = glslang::EOpMul; break; } @@ -2750,7 +2750,7 @@ spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, spv break; case glslang::EOpVectorTimesScalar: case glslang::EOpVectorTimesScalarAssign: - if (isFloat) { + if (isFloat && (builder.isVector(left) || builder.isVector(right))) { if (builder.isVector(right)) std::swap(left, right); assert(builder.isScalar(right)); @@ -4096,7 +4096,7 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstUnionArray(const glsla glslang::TVector::const_iterator iter; for (iter = glslangType.getStruct()->begin(); iter != glslangType.getStruct()->end(); ++iter) spvConsts.push_back(createSpvConstantFromConstUnionArray(*iter->type, consts, nextConst, false)); - } else if (glslangType.isVector()) { + } else if (glslangType.getVectorSize() > 1) { for (unsigned int i = 0; i < (unsigned int)glslangType.getVectorSize(); ++i) { bool zero = nextConst >= consts.size(); switch (glslangType.getBasicType()) { diff --git a/Test/baseResults/hlsl.float1.frag.out b/Test/baseResults/hlsl.float1.frag.out new file mode 100755 index 00000000..ce6ea59e --- /dev/null +++ b/Test/baseResults/hlsl.float1.frag.out @@ -0,0 +1,100 @@ +hlsl.float1.frag +Shader version: 100 +gl_FragCoord origin is upper left +0:? Sequence +0:1 move second child to first child (temp 1-component vector of float) +0:1 'f1' (temp 1-component vector of float) +0:1 Constant: +0:1 1.000000 +0:2 move second child to first child (temp float) +0:2 'scalar' (temp float) +0:2 Constant: +0:2 2.000000 +0:8 Function Definition: ShaderFunction(vf1;f1; (temp 1-component vector of float) +0:5 Function Parameters: +0:5 'inFloat1' (temp 1-component vector of float) +0:5 'inScalar' (temp float) +0:? Sequence +0:6 Branch: Return with expression +0:6 add (temp 1-component vector of float) +0:6 vector-scale (temp 1-component vector of float) +0:6 'f1' (temp 1-component vector of float) +0:6 'scalar' (temp float) +0:6 vector-scale (temp 1-component vector of float) +0:6 'inFloat1' (temp 1-component vector of float) +0:6 'inScalar' (temp float) +0:? Linker Objects +0:? 'f1' (temp 1-component vector of float) +0:? 'scalar' (temp float) + + +Linked fragment stage: + + +Shader version: 100 +gl_FragCoord origin is upper left +0:? Sequence +0:1 move second child to first child (temp 1-component vector of float) +0:1 'f1' (temp 1-component vector of float) +0:1 Constant: +0:1 1.000000 +0:2 move second child to first child (temp float) +0:2 'scalar' (temp float) +0:2 Constant: +0:2 2.000000 +0:8 Function Definition: ShaderFunction(vf1;f1; (temp 1-component vector of float) +0:5 Function Parameters: +0:5 'inFloat1' (temp 1-component vector of float) +0:5 'inScalar' (temp float) +0:? Sequence +0:6 Branch: Return with expression +0:6 add (temp 1-component vector of float) +0:6 vector-scale (temp 1-component vector of float) +0:6 'f1' (temp 1-component vector of float) +0:6 'scalar' (temp float) +0:6 vector-scale (temp 1-component vector of float) +0:6 'inFloat1' (temp 1-component vector of float) +0:6 'inScalar' (temp float) +0:? Linker Objects +0:? 'f1' (temp 1-component vector of float) +0:? 'scalar' (temp float) + +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 24 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "PixelShaderFunction" + ExecutionMode 4 OriginUpperLeft + Source HLSL 100 + Name 4 "PixelShaderFunction" + Name 11 "ShaderFunction(vf1;f1;" + Name 9 "inFloat1" + Name 10 "inScalar" + Name 13 "f1" + Name 15 "scalar" + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypePointer Function 6(float) + 8: TypeFunction 6(float) 7(ptr) 7(ptr) +4(PixelShaderFunction): 2 Function None 3 + 5: Label + FunctionEnd +11(ShaderFunction(vf1;f1;): 6(float) Function None 8 + 9(inFloat1): 7(ptr) FunctionParameter + 10(inScalar): 7(ptr) FunctionParameter + 12: Label + 13(f1): 7(ptr) Variable Function + 15(scalar): 7(ptr) Variable Function + 14: 6(float) Load 13(f1) + 16: 6(float) Load 15(scalar) + 17: 6(float) IMul 14 16 + 18: 6(float) Load 9(inFloat1) + 19: 6(float) Load 10(inScalar) + 20: 6(float) IMul 18 19 + 21: 6(float) FAdd 17 20 + ReturnValue 21 + FunctionEnd diff --git a/Test/hlsl.float1.frag b/Test/hlsl.float1.frag new file mode 100644 index 00000000..5000dced --- /dev/null +++ b/Test/hlsl.float1.frag @@ -0,0 +1,7 @@ +float1 f1 = float1(1.0); +float scalar = 2.0; + +float1 ShaderFunction(float1 inFloat1, float inScalar) : COLOR0 +{ + return f1 * scalar + inFloat1 * inScalar; +} diff --git a/glslang/Include/Types.h b/glslang/Include/Types.h index d4a9d101..98de1646 100644 --- a/glslang/Include/Types.h +++ b/glslang/Include/Types.h @@ -1044,8 +1044,8 @@ public: // for "empty" type (no args) or simple scalar/vector/matrix explicit TType(TBasicType t = EbtVoid, TStorageQualifier q = EvqTemporary, int vs = 1, int mc = 0, int mr = 0) : - basicType(t), vectorSize(vs), matrixCols(mc), matrixRows(mr), arraySizes(nullptr), - structure(nullptr), fieldName(nullptr), typeName(nullptr) + basicType(t), vectorSize(vs), matrixCols(mc), matrixRows(mr), vector1(false), + arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr) { sampler.clear(); qualifier.clear(); @@ -1053,8 +1053,8 @@ public: } // for explicit precision qualifier TType(TBasicType t, TStorageQualifier q, TPrecisionQualifier p, int vs = 1, int mc = 0, int mr = 0) : - basicType(t), vectorSize(vs), matrixCols(mc), matrixRows(mr), arraySizes(nullptr), - structure(nullptr), fieldName(nullptr), typeName(nullptr) + basicType(t), vectorSize(vs), matrixCols(mc), matrixRows(mr), vector1(false), + arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr) { sampler.clear(); qualifier.clear(); @@ -1064,8 +1064,9 @@ public: } // for turning a TPublicType into a TType, using a shallow copy explicit TType(const TPublicType& p) : - basicType(p.basicType), vectorSize(p.vectorSize), matrixCols(p.matrixCols), matrixRows(p.matrixRows), arraySizes(p.arraySizes), - structure(nullptr), fieldName(nullptr), typeName(nullptr) + basicType(p.basicType), + vectorSize(p.vectorSize), matrixCols(p.matrixCols), matrixRows(p.matrixRows), vector1(false), + arraySizes(p.arraySizes), structure(nullptr), fieldName(nullptr), typeName(nullptr) { if (basicType == EbtSampler) sampler = p.sampler; @@ -1100,19 +1101,25 @@ public: // do a vector/matrix dereference shallowCopy(type); if (matrixCols > 0) { + // dereference from matrix to vector if (rowMajor) vectorSize = matrixCols; else vectorSize = matrixRows; matrixCols = 0; matrixRows = 0; - } else if (vectorSize > 1) + if (vectorSize == 1) + vector1 = true; + } else if (isVector()) { + // dereference from vector to scalar vectorSize = 1; + vector1 = false; + } } } // for making structures, ... TType(TTypeList* userDef, const TString& n) : - basicType(EbtStruct), vectorSize(1), matrixCols(0), matrixRows(0), + basicType(EbtStruct), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), arraySizes(nullptr), structure(userDef), fieldName(nullptr) { sampler.clear(); @@ -1121,7 +1128,7 @@ public: } // For interface blocks TType(TTypeList* userDef, const TString& n, const TQualifier& q) : - basicType(EbtBlock), vectorSize(1), matrixCols(0), matrixRows(0), + basicType(EbtBlock), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), qualifier(q), arraySizes(nullptr), structure(userDef), fieldName(nullptr) { sampler.clear(); @@ -1140,6 +1147,7 @@ public: vectorSize = copyOf.vectorSize; matrixCols = copyOf.matrixCols; matrixRows = copyOf.matrixRows; + vector1 = copyOf.vector1; arraySizes = copyOf.arraySizes; // copying the pointer only, not the contents structure = copyOf.structure; fieldName = copyOf.fieldName; @@ -1180,6 +1188,8 @@ public: return newType; } + void makeVector() { vector1 = true; } + // Merge type from parent, where a parentType is at the beginning of a declaration, // establishing some characteristics for all subsequent names, while this type // is on the individual names. @@ -1190,6 +1200,7 @@ public: vectorSize = parentType.vectorSize; matrixCols = parentType.matrixCols; matrixRows = parentType.matrixRows; + vector1 = false; // TPublicType is only GLSL which so far has no vec1 qualifier = parentType.qualifier; sampler = parentType.sampler; if (parentType.arraySizes) @@ -1223,7 +1234,7 @@ public: virtual TQualifier& getQualifier() { return qualifier; } virtual const TQualifier& getQualifier() const { return qualifier; } - virtual int getVectorSize() const { return vectorSize; } + virtual int getVectorSize() const { return vectorSize; } // returns 1 for either scalar or vector of size 1, valid for both virtual int getMatrixCols() const { return matrixCols; } virtual int getMatrixRows() const { return matrixRows; } virtual int getOuterArraySize() const { return arraySizes->getOuterSize(); } @@ -1234,8 +1245,8 @@ public: virtual const TArraySizes* getArraySizes() const { return arraySizes; } virtual TArraySizes& getArraySizes() { assert(arraySizes != nullptr); return *arraySizes; } - virtual bool isScalar() const { return vectorSize == 1 && ! isStruct() && ! isArray(); } - virtual bool isVector() const { return vectorSize > 1; } + virtual bool isScalar() const { return ! isVector() && ! isMatrix() && ! isStruct() && ! isArray(); } + virtual bool isVector() const { return vectorSize > 1 || vector1; } virtual bool isMatrix() const { return matrixCols ? true : false; } virtual bool isArray() const { return arraySizes != nullptr; } virtual bool isExplicitlySizedArray() const { return isArray() && getOuterArraySize() != UnsizedArraySize; } @@ -1508,7 +1519,7 @@ public: if (qualifier.specConstant) p += snprintf(p, end - p, "specialization-constant "); p += snprintf(p, end - p, "%s ", getStorageQualifierString()); - if (arraySizes) { + if (isArray()) { for(int i = 0; i < (int)arraySizes->getNumDims(); ++i) { int size = arraySizes->getDimSize(i); if (size == 0) @@ -1519,9 +1530,9 @@ public: } if (qualifier.precision != EpqNone) p += snprintf(p, end - p, "%s ", getPrecisionQualifierString()); - if (matrixCols > 0) + if (isMatrix()) p += snprintf(p, end - p, "%dX%d matrix of ", matrixCols, matrixRows); - else if (vectorSize > 1) + else if (isVector()) p += snprintf(p, end - p, "%d-component vector of ", vectorSize); *p = 0; @@ -1653,6 +1664,7 @@ public: vectorSize == right.vectorSize && matrixCols == right.matrixCols && matrixRows == right.matrixRows && + vector1 == right.vector1 && sameStructType(right); } @@ -1675,9 +1687,14 @@ protected: void buildMangledName(TString&); TBasicType basicType : 8; - int vectorSize : 4; + int vectorSize : 4; // 1 means either scalar or 1-component vector; see vector1 to disambiguate. int matrixCols : 4; int matrixRows : 4; + bool vector1 : 1; // Backward-compatible tracking of a 1-component vector distinguished from a scalar. + // GLSL 4.5 never has a 1-component vector; so this will always be false until such + // functionality is added. + // HLSL does have a 1-component vectors, so this will be true to disambiguate + // from a scalar. TSampler sampler; TQualifier qualifier; diff --git a/glslang/MachineIndependent/Intermediate.cpp b/glslang/MachineIndependent/Intermediate.cpp index d3aa5853..f8f9237b 100644 --- a/glslang/MachineIndependent/Intermediate.cpp +++ b/glslang/MachineIndependent/Intermediate.cpp @@ -1629,8 +1629,10 @@ bool TIntermBinary::promote() return false; if (left->isVector() && right->isVector() && left->getVectorSize() != right->getVectorSize()) return false; - if (right->isVector() || right->isMatrix()) - setType(TType(basicType, EvqTemporary, right->getVectorSize(), right->getMatrixCols(), right->getMatrixRows())); + if (right->isVector() || right->isMatrix()) { + type.shallowCopy(right->getType()); + type.getQualifier().makeTemporary(); + } break; default: diff --git a/gtests/Hlsl.FromFile.cpp b/gtests/Hlsl.FromFile.cpp index e5922bc1..90e13113 100644 --- a/gtests/Hlsl.FromFile.cpp +++ b/gtests/Hlsl.FromFile.cpp @@ -72,6 +72,7 @@ INSTANTIATE_TEST_CASE_P( ToSpirv, HlslCompileTest, ::testing::ValuesIn(std::vector{ {"hlsl.assoc.frag", "PixelShaderFunction"}, + {"hlsl.float1.frag", "PixelShaderFunction"}, {"hlsl.float4.frag", "PixelShaderFunction"}, {"hlsl.max.frag", "PixelShaderFunction"}, {"hlsl.precedence.frag", "PixelShaderFunction"}, diff --git a/hlsl/hlslGrammar.cpp b/hlsl/hlslGrammar.cpp index 9ab9f2c3..75f9818d 100755 --- a/hlsl/hlslGrammar.cpp +++ b/hlsl/hlslGrammar.cpp @@ -219,8 +219,12 @@ bool HlslGrammar::acceptType(TType& type) new(&type) TType(EbtInt); break; case EHTokFloat: + new(&type) TType(EbtFloat); + break; + case EHTokFloat1: new(&type) TType(EbtFloat); + type.makeVector(); break; case EHTokFloat2: diff --git a/hlsl/hlslParseHelper.cpp b/hlsl/hlslParseHelper.cpp index 0d67a1d7..2cdaf0c0 100755 --- a/hlsl/hlslParseHelper.cpp +++ b/hlsl/hlslParseHelper.cpp @@ -1655,13 +1655,6 @@ void HlslParseContext::boolCheck(const TSourceLoc& loc, const TIntermTyped* type error(loc, "boolean expression expected", "", ""); } -// This function checks to see if the node (for the expression) contains a scalar boolean expression or not -void HlslParseContext::boolCheck(const TSourceLoc& loc, const TPublicType& pType) -{ - if (pType.basicType != EbtBool || pType.arraySizes || pType.matrixCols > 1 || (pType.vectorSize > 1)) - error(loc, "boolean expression expected", "", ""); -} - // // Fix just a full qualifier (no variables or types yet, but qualifier is complete) at global level. // diff --git a/hlsl/hlslParseHelper.h b/hlsl/hlslParseHelper.h index ba5bcda3..7fa267ff 100755 --- a/hlsl/hlslParseHelper.h +++ b/hlsl/hlslParseHelper.h @@ -107,7 +107,6 @@ public: void arrayDimMerge(TType& type, const TArraySizes* sizes); bool voidErrorCheck(const TSourceLoc&, const TString&, TBasicType); void boolCheck(const TSourceLoc&, const TIntermTyped*); - void boolCheck(const TSourceLoc&, const TPublicType&); void globalQualifierFix(const TSourceLoc&, TQualifier&); bool structQualifierErrorCheck(const TSourceLoc&, const TPublicType& pType); void mergeQualifiers(const TSourceLoc&, TQualifier& dst, const TQualifier& src, bool force); From 0133c1233ecf992700f5c445ef71256a6ea1014d Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Fri, 20 May 2016 12:17:26 -0600 Subject: [PATCH 112/140] HLSL: Add more matrix types to the grammar. --- Test/baseResults/hlsl.matType.frag.out | 101 +++++++++++++++++++++ Test/hlsl.matType.frag | 10 +++ gtests/Hlsl.FromFile.cpp | 1 + hlsl/hlslGrammar.cpp | 119 +++++++++++++++++++++++++ 4 files changed, 231 insertions(+) create mode 100755 Test/baseResults/hlsl.matType.frag.out create mode 100644 Test/hlsl.matType.frag diff --git a/Test/baseResults/hlsl.matType.frag.out b/Test/baseResults/hlsl.matType.frag.out new file mode 100755 index 00000000..438a06a4 --- /dev/null +++ b/Test/baseResults/hlsl.matType.frag.out @@ -0,0 +1,101 @@ +hlsl.matType.frag +Shader version: 100 +gl_FragCoord origin is upper left +0:? Sequence +0:1 move second child to first child (temp 1-component vector of float) +0:1 'f1' (temp 1-component vector of float) +0:1 Constant: +0:1 1.000000 +0:11 Function Definition: ShaderFunction(vf1;f1; (temp 1-component vector of float) +0:9 Function Parameters: +0:9 'inFloat1' (temp 1-component vector of float) +0:9 'inScalar' (temp float) +0:? Linker Objects +0:? 'f1' (temp 1-component vector of float) +0:? 'fmat11' (temp 1X1 matrix of float) +0:? 'fmat41' (temp 1X4 matrix of float) +0:? 'fmat12' (temp 2X1 matrix of float) +0:? 'dmat23' (temp 3X2 matrix of double) +0:? 'int44' (temp 4X4 matrix of int) + + +Linked fragment stage: + + +Shader version: 100 +gl_FragCoord origin is upper left +0:? Sequence +0:1 move second child to first child (temp 1-component vector of float) +0:1 'f1' (temp 1-component vector of float) +0:1 Constant: +0:1 1.000000 +0:11 Function Definition: ShaderFunction(vf1;f1; (temp 1-component vector of float) +0:9 Function Parameters: +0:9 'inFloat1' (temp 1-component vector of float) +0:9 'inScalar' (temp float) +0:? Linker Objects +0:? 'f1' (temp 1-component vector of float) +0:? 'fmat11' (temp 1X1 matrix of float) +0:? 'fmat41' (temp 1X4 matrix of float) +0:? 'fmat12' (temp 2X1 matrix of float) +0:? 'dmat23' (temp 3X2 matrix of double) +0:? 'int44' (temp 4X4 matrix of int) + +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 36 + + Capability Shader + Capability Float64 + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "PixelShaderFunction" + ExecutionMode 4 OriginUpperLeft + Source HLSL 100 + Name 4 "PixelShaderFunction" + Name 11 "ShaderFunction(vf1;f1;" + Name 9 "inFloat1" + Name 10 "inScalar" + Name 14 "f1" + Name 18 "fmat11" + Name 22 "fmat41" + Name 25 "fmat12" + Name 30 "dmat23" + Name 35 "int44" + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypePointer Function 6(float) + 8: TypeFunction 6(float) 7(ptr) 7(ptr) + 15: TypeVector 6(float) 1 + 16: TypeMatrix 15(fvec) 1 + 17: TypePointer Function 16 + 19: TypeVector 6(float) 4 + 20: TypeMatrix 19(fvec4) 1 + 21: TypePointer Function 20 + 23: TypeMatrix 15(fvec) 2 + 24: TypePointer Function 23 + 26: TypeFloat 64 + 27: TypeVector 26(float) 2 + 28: TypeMatrix 27(fvec2) 3 + 29: TypePointer Function 28 + 31: TypeInt 32 1 + 32: TypeVector 31(int) 4 + 33: TypeMatrix 32(ivec4) 4 + 34: TypePointer Function 33 +4(PixelShaderFunction): 2 Function None 3 + 5: Label + FunctionEnd +11(ShaderFunction(vf1;f1;): 6(float) Function None 8 + 9(inFloat1): 7(ptr) FunctionParameter + 10(inScalar): 7(ptr) FunctionParameter + 12: Label + 14(f1): 7(ptr) Variable Function + 18(fmat11): 17(ptr) Variable Function + 22(fmat41): 21(ptr) Variable Function + 25(fmat12): 24(ptr) Variable Function + 30(dmat23): 29(ptr) Variable Function + 35(int44): 34(ptr) Variable Function + 13: 6(float) Undef + ReturnValue 13 + FunctionEnd diff --git a/Test/hlsl.matType.frag b/Test/hlsl.matType.frag new file mode 100644 index 00000000..36d71e3b --- /dev/null +++ b/Test/hlsl.matType.frag @@ -0,0 +1,10 @@ +float1 f1 = float1(1.0); +float1x1 fmat11; +float4x1 fmat41; +float1x2 fmat12; +double2x3 dmat23; +int4x4 int44; + +float1 ShaderFunction(float1 inFloat1, float inScalar) : COLOR0 +{ +} diff --git a/gtests/Hlsl.FromFile.cpp b/gtests/Hlsl.FromFile.cpp index 90e13113..1307dae1 100644 --- a/gtests/Hlsl.FromFile.cpp +++ b/gtests/Hlsl.FromFile.cpp @@ -74,6 +74,7 @@ INSTANTIATE_TEST_CASE_P( {"hlsl.assoc.frag", "PixelShaderFunction"}, {"hlsl.float1.frag", "PixelShaderFunction"}, {"hlsl.float4.frag", "PixelShaderFunction"}, + {"hlsl.matType.frag", "PixelShaderFunction"}, {"hlsl.max.frag", "PixelShaderFunction"}, {"hlsl.precedence.frag", "PixelShaderFunction"}, {"hlsl.precedence2.frag", "PixelShaderFunction"}, diff --git a/hlsl/hlslGrammar.cpp b/hlsl/hlslGrammar.cpp index 75f9818d..443db4ba 100755 --- a/hlsl/hlslGrammar.cpp +++ b/hlsl/hlslGrammar.cpp @@ -257,6 +257,70 @@ bool HlslGrammar::acceptType(TType& type) new(&type) TType(EbtBool, EvqTemporary, 4); break; + case EHTokInt1x1: + new(&type) TType(EbtInt, EvqTemporary, 0, 1, 1); + break; + case EHTokInt1x2: + new(&type) TType(EbtInt, EvqTemporary, 0, 2, 1); + break; + case EHTokInt1x3: + new(&type) TType(EbtInt, EvqTemporary, 0, 3, 1); + break; + case EHTokInt1x4: + new(&type) TType(EbtInt, EvqTemporary, 0, 4, 1); + break; + case EHTokInt2x1: + new(&type) TType(EbtInt, EvqTemporary, 0, 1, 2); + break; + case EHTokInt2x2: + new(&type) TType(EbtInt, EvqTemporary, 0, 2, 2); + break; + case EHTokInt2x3: + new(&type) TType(EbtInt, EvqTemporary, 0, 3, 2); + break; + case EHTokInt2x4: + new(&type) TType(EbtInt, EvqTemporary, 0, 4, 2); + break; + case EHTokInt3x1: + new(&type) TType(EbtInt, EvqTemporary, 0, 1, 3); + break; + case EHTokInt3x2: + new(&type) TType(EbtInt, EvqTemporary, 0, 2, 3); + break; + case EHTokInt3x3: + new(&type) TType(EbtInt, EvqTemporary, 0, 3, 3); + break; + case EHTokInt3x4: + new(&type) TType(EbtInt, EvqTemporary, 0, 4, 3); + break; + case EHTokInt4x1: + new(&type) TType(EbtInt, EvqTemporary, 0, 1, 4); + break; + case EHTokInt4x2: + new(&type) TType(EbtInt, EvqTemporary, 0, 2, 4); + break; + case EHTokInt4x3: + new(&type) TType(EbtInt, EvqTemporary, 0, 3, 4); + break; + case EHTokInt4x4: + new(&type) TType(EbtInt, EvqTemporary, 0, 4, 4); + break; + + case EHTokFloat1x1: + new(&type) TType(EbtFloat, EvqTemporary, 0, 1, 1); + break; + case EHTokFloat1x2: + new(&type) TType(EbtFloat, EvqTemporary, 0, 2, 1); + break; + case EHTokFloat1x3: + new(&type) TType(EbtFloat, EvqTemporary, 0, 3, 1); + break; + case EHTokFloat1x4: + new(&type) TType(EbtFloat, EvqTemporary, 0, 4, 1); + break; + case EHTokFloat2x1: + new(&type) TType(EbtFloat, EvqTemporary, 0, 1, 2); + break; case EHTokFloat2x2: new(&type) TType(EbtFloat, EvqTemporary, 0, 2, 2); break; @@ -266,6 +330,9 @@ bool HlslGrammar::acceptType(TType& type) case EHTokFloat2x4: new(&type) TType(EbtFloat, EvqTemporary, 0, 4, 2); break; + case EHTokFloat3x1: + new(&type) TType(EbtFloat, EvqTemporary, 0, 1, 3); + break; case EHTokFloat3x2: new(&type) TType(EbtFloat, EvqTemporary, 0, 2, 3); break; @@ -275,6 +342,9 @@ bool HlslGrammar::acceptType(TType& type) case EHTokFloat3x4: new(&type) TType(EbtFloat, EvqTemporary, 0, 4, 3); break; + case EHTokFloat4x1: + new(&type) TType(EbtFloat, EvqTemporary, 0, 1, 4); + break; case EHTokFloat4x2: new(&type) TType(EbtFloat, EvqTemporary, 0, 2, 4); break; @@ -285,6 +355,55 @@ bool HlslGrammar::acceptType(TType& type) new(&type) TType(EbtFloat, EvqTemporary, 0, 4, 4); break; + case EHTokDouble1x1: + new(&type) TType(EbtDouble, EvqTemporary, 0, 1, 1); + break; + case EHTokDouble1x2: + new(&type) TType(EbtDouble, EvqTemporary, 0, 2, 1); + break; + case EHTokDouble1x3: + new(&type) TType(EbtDouble, EvqTemporary, 0, 3, 1); + break; + case EHTokDouble1x4: + new(&type) TType(EbtDouble, EvqTemporary, 0, 4, 1); + break; + case EHTokDouble2x1: + new(&type) TType(EbtDouble, EvqTemporary, 0, 1, 2); + break; + case EHTokDouble2x2: + new(&type) TType(EbtDouble, EvqTemporary, 0, 2, 2); + break; + case EHTokDouble2x3: + new(&type) TType(EbtDouble, EvqTemporary, 0, 3, 2); + break; + case EHTokDouble2x4: + new(&type) TType(EbtDouble, EvqTemporary, 0, 4, 2); + break; + case EHTokDouble3x1: + new(&type) TType(EbtDouble, EvqTemporary, 0, 1, 3); + break; + case EHTokDouble3x2: + new(&type) TType(EbtDouble, EvqTemporary, 0, 2, 3); + break; + case EHTokDouble3x3: + new(&type) TType(EbtDouble, EvqTemporary, 0, 3, 3); + break; + case EHTokDouble3x4: + new(&type) TType(EbtDouble, EvqTemporary, 0, 4, 3); + break; + case EHTokDouble4x1: + new(&type) TType(EbtDouble, EvqTemporary, 0, 1, 4); + break; + case EHTokDouble4x2: + new(&type) TType(EbtDouble, EvqTemporary, 0, 2, 4); + break; + case EHTokDouble4x3: + new(&type) TType(EbtDouble, EvqTemporary, 0, 3, 4); + break; + case EHTokDouble4x4: + new(&type) TType(EbtDouble, EvqTemporary, 0, 4, 4); + break; + default: return false; } From 507308b26d1a90c741db759e4c6d55cf8702e5f0 Mon Sep 17 00:00:00 2001 From: qining Date: Fri, 20 May 2016 14:30:38 -0400 Subject: [PATCH 113/140] remove redundant 'return false' --- glslang/MachineIndependent/propagateNoContraction.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/glslang/MachineIndependent/propagateNoContraction.cpp b/glslang/MachineIndependent/propagateNoContraction.cpp index c7f3bc3a..835f57f6 100644 --- a/glslang/MachineIndependent/propagateNoContraction.cpp +++ b/glslang/MachineIndependent/propagateNoContraction.cpp @@ -402,7 +402,6 @@ bool TSymbolDefinitionCollectingTraverser::visitBinary(glslang::TVisit /* visit // For other binary nodes, still traverse the right node. current_object_.clear(); node->getRight()->traverse(this); - return false; } return false; } From 2ed1d9bba02568967fb652addcce2d1e80a52ac0 Mon Sep 17 00:00:00 2001 From: David Neto Date: Fri, 20 May 2016 16:05:21 -0400 Subject: [PATCH 114/140] atoi comes from stddef.h or cstddef This is required to fix the Android build for ARM. --- StandAlone/ResourceLimits.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/StandAlone/ResourceLimits.cpp b/StandAlone/ResourceLimits.cpp index 434050a8..80491980 100644 --- a/StandAlone/ResourceLimits.cpp +++ b/StandAlone/ResourceLimits.cpp @@ -32,7 +32,8 @@ // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. -#include +#include +#include #include #include "ResourceLimits.h" From 22e0d41448487645ca4bdbab6b14034ed8c4f36f Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Fri, 20 May 2016 15:40:53 -0600 Subject: [PATCH 115/140] SPV: Don't put locations on OpTypeStruct. Related to Issue #291. --- SPIRV/GlslangToSpv.cpp | 8 -------- Test/baseResults/spv.430.vert.out | 1 - 2 files changed, 9 deletions(-) diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index d9d3555e..70f5a120 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -1961,14 +1961,6 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty if (type.getQualifier().hasXfbBuffer()) builder.addDecoration(spvType, spv::DecorationXfbBuffer, type.getQualifier().layoutXfbBuffer); } - - if (type.getBasicType() != glslang::EbtBlock && (type.getQualifier().storage == glslang::EvqVaryingIn || type.getQualifier().storage == glslang::EvqVaryingOut)) - { - // The layout of a structure type used as an Input or Output depends on whether it is also a Block (i.e. has a Block decoration). - // If it is a not a Block, then the structure type must have a Location decoration. - if (type.getQualifier().hasLocation()) - builder.addDecoration(spvType, spv::DecorationLocation, type.getQualifier().layoutLocation); - } } break; default: diff --git a/Test/baseResults/spv.430.vert.out b/Test/baseResults/spv.430.vert.out index 89483d9c..f84fa556 100755 --- a/Test/baseResults/spv.430.vert.out +++ b/Test/baseResults/spv.430.vert.out @@ -65,7 +65,6 @@ Linked vertex stage: MemberDecorate 60(SS) 0 Flat MemberDecorate 60(SS) 1 Flat MemberDecorate 60(SS) 2 Flat - Decorate 60(SS) Location 0 Decorate 62(var) Location 0 MemberDecorate 63(MS) 0 Location 17 Decorate 63(MS) Block From 2921e0c54a95264a6fd193c79c814f2869ef9a2d Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Fri, 20 May 2016 16:59:27 -0600 Subject: [PATCH 116/140] KHR_vulkan_glsl: name mangle distinguish pure textures. Fixes issue #252. --- Test/baseResults/vulkan.frag.out | 4 +++- Test/vulkan.frag | 6 ++++++ glslang/MachineIndependent/SymbolTable.cpp | 8 ++++++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Test/baseResults/vulkan.frag.out b/Test/baseResults/vulkan.frag.out index b5b9d91a..fe8b045b 100644 --- a/Test/baseResults/vulkan.frag.out +++ b/Test/baseResults/vulkan.frag.out @@ -31,7 +31,9 @@ ERROR: 0:66: 'non-opaque uniforms outside a block' : not allowed when using GLSL ERROR: 0:67: 'subroutine' : not allowed when generating SPIR-V ERROR: 0:67: 'uniform' : no qualifiers allowed for function return ERROR: 0:69: 'non-opaque uniforms outside a block' : not allowed when using GLSL for Vulkan -ERROR: 31 compilation errors. No code generated. +ERROR: 0:73: 'texture' : no matching overloaded function found +ERROR: 0:74: 'imageStore' : no matching overloaded function found +ERROR: 33 compilation errors. No code generated. diff --git a/Test/vulkan.frag b/Test/vulkan.frag index b96647c7..0148507f 100644 --- a/Test/vulkan.frag +++ b/Test/vulkan.frag @@ -67,3 +67,9 @@ subroutine int fooS; // ERROR, not in SPV subroutine int fooSub(); // ERROR, not in SPV uniform vec4 dv4; // ERROR, no default uniforms + +void fooTex() +{ + texture(t2d, vec2(1.0)); // ERROR, need a sampler, not a pure texture + imageStore(t2d, ivec2(4, 5), vec4(1.2)); // ERROR, need an image, not a pure texture +} \ No newline at end of file diff --git a/glslang/MachineIndependent/SymbolTable.cpp b/glslang/MachineIndependent/SymbolTable.cpp index 4c9b0e2c..bf0f1f9f 100644 --- a/glslang/MachineIndependent/SymbolTable.cpp +++ b/glslang/MachineIndependent/SymbolTable.cpp @@ -73,9 +73,13 @@ void TType::buildMangledName(TString& mangledName) default: break; // some compilers want this } if (sampler.image) - mangledName += "I"; + mangledName += "I"; // a normal image + else if (sampler.sampler) + mangledName += "p"; // a "pure" sampler + else if (!sampler.combined) + mangledName += "t"; // a "pure" texture else - mangledName += "s"; + mangledName += "s"; // traditional combined sampler if (sampler.arrayed) mangledName += "A"; if (sampler.shadow) From bbceed7be350d0e158dfe38e3fc5770c274083a2 Mon Sep 17 00:00:00 2001 From: Rex Xu Date: Sat, 21 May 2016 09:40:44 +0800 Subject: [PATCH 117/140] SPV: Fix an issue of interpolation decoration. GLSL interpolation qualifiers and auxiliary storage qualifiers are not mutually exclusive. So when they are translated to SPIR-V decorations, two independent utility methods should be employed to do this job. --- SPIRV/GlslangToSpv.cpp | 26 ++++++++++++++++-------- Test/baseResults/spv.qualifiers.vert.out | 2 ++ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 70f5a120..950f7bdd 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -108,7 +108,7 @@ public: void dumpSpv(std::vector& out); protected: - spv::Decoration TranslateInterpolationDecoration(const glslang::TQualifier& qualifier); + spv::Decoration TranslateAuxiliaryStorageDecoration(const glslang::TQualifier& qualifier); spv::BuiltIn TranslateBuiltInDecoration(glslang::TBuiltInVariable, bool member); spv::ImageFormat TranslateImageFormat(const glslang::TType& type); spv::Id createSpvVariable(const glslang::TIntermSymbol*); @@ -354,18 +354,26 @@ spv::Decoration TranslateLayoutDecoration(const glslang::TType& type, glslang::T // Translate glslang type to SPIR-V interpolation decorations. // Returns spv::Decoration(spv::BadValue) when no decoration // should be applied. -spv::Decoration TGlslangToSpvTraverser::TranslateInterpolationDecoration(const glslang::TQualifier& qualifier) +spv::Decoration TranslateInterpolationDecoration(const glslang::TQualifier& qualifier) { - if (qualifier.smooth) { + if (qualifier.smooth) // Smooth decoration doesn't exist in SPIR-V 1.0 return (spv::Decoration)spv::BadValue; - } - if (qualifier.nopersp) + else if (qualifier.nopersp) return spv::DecorationNoPerspective; - else if (qualifier.patch) - return spv::DecorationPatch; else if (qualifier.flat) return spv::DecorationFlat; + else + return (spv::Decoration)spv::BadValue; +} + +// Translate glslang type to SPIR-V auxiliary storage decorations. +// Returns spv::Decoration(spv::BadValue) when no decoration +// should be applied. +spv::Decoration TGlslangToSpvTraverser::TranslateAuxiliaryStorageDecoration(const glslang::TQualifier& qualifier) +{ + if (qualifier.patch) + return spv::DecorationPatch; else if (qualifier.centroid) return spv::DecorationCentroid; else if (qualifier.sample) { @@ -1890,9 +1898,10 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty builder.addMemberName(spvType, member, glslangType.getFieldName().c_str()); addMemberDecoration(spvType, member, TranslateLayoutDecoration(glslangType, subQualifier.layoutMatrix)); addMemberDecoration(spvType, member, TranslatePrecisionDecoration(glslangType)); - // Add interpolation decorations only to top-level members of Input and Output storage classes + // Add interpolation and auxiliary storage decorations only to top-level members of Input and Output storage classes if (type.getQualifier().storage == glslang::EvqVaryingIn || type.getQualifier().storage == glslang::EvqVaryingOut) { addMemberDecoration(spvType, member, TranslateInterpolationDecoration(subQualifier)); + addMemberDecoration(spvType, member, TranslateAuxiliaryStorageDecoration(subQualifier)); } addMemberDecoration(spvType, member, TranslateInvariantDecoration(subQualifier)); @@ -3917,6 +3926,7 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol if (! symbol->getType().isStruct()) { addDecoration(id, TranslatePrecisionDecoration(symbol->getType())); addDecoration(id, TranslateInterpolationDecoration(symbol->getType().getQualifier())); + addDecoration(id, TranslateAuxiliaryStorageDecoration(symbol->getType().getQualifier())); if (symbol->getType().getQualifier().hasSpecConstantId()) addDecoration(id, spv::DecorationSpecId, symbol->getType().getQualifier().layoutSpecConstantId); if (symbol->getQualifier().hasIndex()) diff --git a/Test/baseResults/spv.qualifiers.vert.out b/Test/baseResults/spv.qualifiers.vert.out index bedd6912..d2baf722 100755 --- a/Test/baseResults/spv.qualifiers.vert.out +++ b/Test/baseResults/spv.qualifiers.vert.out @@ -21,9 +21,11 @@ Linked vertex stage: Name 15 "outVf" Name 17 "outVn" Name 19 "outVcn" + Decorate 9(outVc) Centroid Decorate 15(outVf) Flat Decorate 17(outVn) NoPerspective Decorate 19(outVcn) NoPerspective + Decorate 19(outVcn) Centroid 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 From 0ae28ea647e38398205e5f32253dcfbe67a4a1f5 Mon Sep 17 00:00:00 2001 From: LoopDawg Date: Fri, 20 May 2016 13:45:20 -0600 Subject: [PATCH 118/140] Add base class TParseables for intrinsic / builtin generation. Add stubbed HLSL derivation. GLSL derivation is still called TBuiltIns, for historical compatibility. --- glslang/MachineIndependent/Initialize.cpp | 21 +++- glslang/MachineIndependent/Initialize.h | 41 ++++++-- glslang/MachineIndependent/ShaderLang.cpp | 72 ++++++++----- hlsl/CMakeLists.txt | 6 +- hlsl/hlslParseables.cpp | 117 ++++++++++++++++++++++ hlsl/hlslParseables.h | 61 +++++++++++ 6 files changed, 277 insertions(+), 41 deletions(-) create mode 100755 hlsl/hlslParseables.cpp create mode 100755 hlsl/hlslParseables.h diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp index 0edb354c..034962a2 100644 --- a/glslang/MachineIndependent/Initialize.cpp +++ b/glslang/MachineIndependent/Initialize.cpp @@ -1,6 +1,6 @@ // //Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -//Copyright (C) 2012-2015 LunarG, Inc. +//Copyright (C) 2012-2016 LunarG, Inc. //Copyright (C) 2015-2016 Google, Inc. // //All rights reserved. @@ -43,9 +43,9 @@ // Where to put a built-in: // TBuiltIns::initialize(version,profile) context-independent textual built-ins; add them to the right string // TBuiltIns::initialize(resources,...) context-dependent textual built-ins; add them to the right string -// IdentifyBuiltIns(...,symbolTable) context-independent programmatic additions/mappings to the symbol table, +// TBuiltIns::identifyBuiltIns(...,symbolTable) context-independent programmatic additions/mappings to the symbol table, // including identifying what extensions are needed if a version does not allow a symbol -// IdentifyBuiltIns(...,symbolTable, resources) context-dependent programmatic additions/mappings to the symbol table, +// TBuiltIns::identifyBuiltIns(...,symbolTable, resources) context-dependent programmatic additions/mappings to the symbol table, // including identifying what extensions are needed if a version does not allow a symbol // @@ -68,6 +68,16 @@ inline bool IncludeLegacy(int version, EProfile profile, int spv) return profile != EEsProfile && (version <= 130 || (spv == 0 && ARBCompatibility) || profile == ECompatibilityProfile); } +// Construct TBuiltInParseables base class. This can be used for language-common constructs. +TBuiltInParseables::TBuiltInParseables() +{ +} + +// Destroy TBuiltInParseables. +TBuiltInParseables::~TBuiltInParseables() +{ +} + TBuiltIns::TBuiltIns() { // Set up textual representations for making all the permutations @@ -95,6 +105,7 @@ TBuiltIns::~TBuiltIns() { } + // // Add all context-independent built-in functions and variables that are present // for the given version and profile. Share common ones across stages, otherwise @@ -3525,7 +3536,7 @@ static void BuiltInVariable(const char* blockName, const char* name, TBuiltInVar // 3) Tag extension-related symbols added to their base version with their extensions, so // that if an early version has the extension turned off, there is an error reported on use. // -void IdentifyBuiltIns(int version, EProfile profile, int spv, int vulkan, EShLanguage language, TSymbolTable& symbolTable) +void TBuiltIns::identifyBuiltIns(int version, EProfile profile, int spv, int vulkan, EShLanguage language, TSymbolTable& symbolTable) { // // Tag built-in variables and functions with additional qualifier and extension information @@ -4221,7 +4232,7 @@ void IdentifyBuiltIns(int version, EProfile profile, int spv, int vulkan, EShLan // 2) Tag extension-related symbols added to their base version with their extensions, so // that if an early version has the extension turned off, there is an error reported on use. // -void IdentifyBuiltIns(int version, EProfile profile, int spv, int /*vulkan*/, EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources) +void TBuiltIns::identifyBuiltIns(int version, EProfile profile, int spv, int /*vulkan*/, EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources) { if (profile != EEsProfile && version >= 430 && version < 440) { symbolTable.setVariableExtensions("gl_MaxTransformFeedbackBuffers", 1, &E_GL_ARB_enhanced_layouts); diff --git a/glslang/MachineIndependent/Initialize.h b/glslang/MachineIndependent/Initialize.h index ab21a2f9..40551cdd 100644 --- a/glslang/MachineIndependent/Initialize.h +++ b/glslang/MachineIndependent/Initialize.h @@ -1,6 +1,6 @@ // //Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -//Copyright (C) 2013 LunarG, Inc. +//Copyright (C) 2013-2016 LunarG, Inc. // //All rights reserved. // @@ -49,20 +49,48 @@ namespace glslang { // This is made to hold parseable strings for almost all the built-in // functions and variables for one specific combination of version // and profile. (Some still need to be added programmatically.) +// This is a base class for language-specific derivations, which +// can be used for language independent builtins. // // The strings are organized by // commonBuiltins: intersection of all stages' built-ins, processed just once // stageBuiltins[]: anything a stage needs that's not in commonBuiltins // -class TBuiltIns { +class TBuiltInParseables { +public: + POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) + TBuiltInParseables(); + virtual ~TBuiltInParseables(); + virtual void initialize(int version, EProfile, int spv, int vulkan) = 0; + virtual void initialize(const TBuiltInResource& resources, int version, EProfile, int spv, int vulkan, EShLanguage) = 0; + virtual const TString& getCommonString() const { return commonBuiltins; } + virtual const TString& getStageString(EShLanguage language) const { return stageBuiltins[language]; } + + virtual void identifyBuiltIns(int version, EProfile profile, int spv, int vulkan, EShLanguage language, TSymbolTable& symbolTable) = 0; + + virtual void identifyBuiltIns(int version, EProfile profile, int spv, int /*vulkan*/, EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources) = 0; + +protected: + TString commonBuiltins; + TString stageBuiltins[EShLangCount]; +}; + +// +// This is a GLSL specific derivation of TBuiltInParseables. To present a stable +// interface and match other similar code, it is called TBuiltIns, rather +// than TBuiltInParseablesGlsl. +// +class TBuiltIns : public TBuiltInParseables { public: POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) TBuiltIns(); virtual ~TBuiltIns(); void initialize(int version, EProfile, int spv, int vulkan); void initialize(const TBuiltInResource& resources, int version, EProfile, int spv, int vulkan, EShLanguage); - const TString& getCommonString() const { return commonBuiltins; } - const TString& getStageString(EShLanguage language) const { return stageBuiltins[language]; } + + void identifyBuiltIns(int version, EProfile profile, int spv, int vulkan, EShLanguage language, TSymbolTable& symbolTable); + + void identifyBuiltIns(int version, EProfile profile, int spv, int /*vulkan*/, EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources); protected: void add2ndGenerationSamplingImaging(int version, EProfile profile, int spv, int vulkan); @@ -72,9 +100,6 @@ protected: void addSamplingFunctions(TSampler, TString& typeName, int version, EProfile profile); void addGatherFunctions(TSampler, TString& typeName, int version, EProfile profile); - TString commonBuiltins; - TString stageBuiltins[EShLangCount]; - // Helpers for making textual representations of the permutations // of texturing/imaging functions. const char* postfixes[5]; @@ -82,8 +107,6 @@ protected: int dimMap[EsdNumDims]; }; -void IdentifyBuiltIns(int version, EProfile profile, int spv, int vulkan, EShLanguage, TSymbolTable&); -void IdentifyBuiltIns(int version, EProfile profile, int spv, int vulkan, EShLanguage, TSymbolTable&, const TBuiltInResource &resources); } // end namespace glslang diff --git a/glslang/MachineIndependent/ShaderLang.cpp b/glslang/MachineIndependent/ShaderLang.cpp index b6af0374..3a3bd58c 100644 --- a/glslang/MachineIndependent/ShaderLang.cpp +++ b/glslang/MachineIndependent/ShaderLang.cpp @@ -1,6 +1,6 @@ // //Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -//Copyright (C) 2013-2015 LunarG, Inc. +//Copyright (C) 2013-2016 LunarG, Inc. //Copyright (C) 2015-2016 Google, Inc. // //All rights reserved. @@ -44,9 +44,11 @@ #include #include #include +#include #include "SymbolTable.h" #include "ParseHelper.h" #include "../../hlsl/hlslParseHelper.h" +#include "../../hlsl/hlslParseables.h" #include "Scan.h" #include "ScanContext.h" @@ -64,6 +66,22 @@ namespace { // anonymous namespace for file-local functions and symbols using namespace glslang; +// Create a language specific version of parseables. +TBuiltInParseables* CreateBuiltInParseables(TInfoSink& infoSink, EShSource source) +{ + // TODO: hardcode to the GLSL path, until HLSL intrinsics are available. + source = EShSourceGlsl; // REMOVE + + switch (source) { + case EShSourceGlsl: return new TBuiltIns(); // GLSL builtIns + case EShSourceHlsl: return new TBuiltInParseablesHlsl(); // HLSL intrinsics + + default: + infoSink.info.message(EPrefixInternalError, "Unable to determine source language"); + return nullptr; + } +} + // Local mapping functions for making arrays of symbol tables.... int MapVersionToIndex(int version) @@ -171,11 +189,12 @@ int CommonIndex(EProfile profile, EShLanguage language) // // To initialize per-stage shared tables, with the common table already complete. // -void InitializeStageSymbolTable(TBuiltIns& builtIns, int version, EProfile profile, int spv, int vulkan, EShLanguage language, TInfoSink& infoSink, TSymbolTable** commonTable, TSymbolTable** symbolTables) +void InitializeStageSymbolTable(TBuiltInParseables& builtInParseables, int version, EProfile profile, int spv, int vulkan, + EShLanguage language, TInfoSink& infoSink, TSymbolTable** commonTable, TSymbolTable** symbolTables) { (*symbolTables[language]).adoptLevels(*commonTable[CommonIndex(profile, language)]); - InitializeSymbolTable(builtIns.getStageString(language), version, profile, spv, vulkan, language, infoSink, *symbolTables[language]); - IdentifyBuiltIns(version, profile, spv, vulkan, language, *symbolTables[language]); + InitializeSymbolTable(builtInParseables.getStageString(language), version, profile, spv, vulkan, language, infoSink, *symbolTables[language]); + builtInParseables.identifyBuiltIns(version, profile, spv, vulkan, language, *symbolTables[language]); if (profile == EEsProfile && version >= 300) (*symbolTables[language]).setNoBuiltInRedeclarations(); if (version == 110) @@ -186,49 +205,51 @@ void InitializeStageSymbolTable(TBuiltIns& builtIns, int version, EProfile profi // Initialize the full set of shareable symbol tables; // The common (cross-stage) and those shareable per-stage. // -bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TSymbolTable** symbolTables, int version, EProfile profile, int spv, int vulkan) +bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TSymbolTable** symbolTables, int version, EProfile profile, int spv, int vulkan, EShSource source) { - TBuiltIns builtIns; - builtIns.initialize(version, profile, spv, vulkan); + std::unique_ptr builtInParseables(CreateBuiltInParseables(infoSink, source)); + + builtInParseables->initialize(version, profile, spv, vulkan); // do the common tables - InitializeSymbolTable(builtIns.getCommonString(), version, profile, spv, vulkan, EShLangVertex, infoSink, *commonTable[EPcGeneral]); + InitializeSymbolTable(builtInParseables->getCommonString(), version, profile, spv, vulkan, EShLangVertex, infoSink, *commonTable[EPcGeneral]); if (profile == EEsProfile) - InitializeSymbolTable(builtIns.getCommonString(), version, profile, spv, vulkan, EShLangFragment, infoSink, *commonTable[EPcFragment]); + InitializeSymbolTable(builtInParseables->getCommonString(), version, profile, spv, vulkan, EShLangFragment, infoSink, *commonTable[EPcFragment]); // do the per-stage tables // always have vertex and fragment - InitializeStageSymbolTable(builtIns, version, profile, spv, vulkan, EShLangVertex, infoSink, commonTable, symbolTables); - InitializeStageSymbolTable(builtIns, version, profile, spv, vulkan, EShLangFragment, infoSink, commonTable, symbolTables); + InitializeStageSymbolTable(*builtInParseables, version, profile, spv, vulkan, EShLangVertex, infoSink, commonTable, symbolTables); + InitializeStageSymbolTable(*builtInParseables, version, profile, spv, vulkan, EShLangFragment, infoSink, commonTable, symbolTables); // check for tessellation if ((profile != EEsProfile && version >= 150) || (profile == EEsProfile && version >= 310)) { - InitializeStageSymbolTable(builtIns, version, profile, spv, vulkan, EShLangTessControl, infoSink, commonTable, symbolTables); - InitializeStageSymbolTable(builtIns, version, profile, spv, vulkan, EShLangTessEvaluation, infoSink, commonTable, symbolTables); + InitializeStageSymbolTable(*builtInParseables, version, profile, spv, vulkan, EShLangTessControl, infoSink, commonTable, symbolTables); + InitializeStageSymbolTable(*builtInParseables, version, profile, spv, vulkan, EShLangTessEvaluation, infoSink, commonTable, symbolTables); } // check for geometry if ((profile != EEsProfile && version >= 150) || (profile == EEsProfile && version >= 310)) - InitializeStageSymbolTable(builtIns, version, profile, spv, vulkan, EShLangGeometry, infoSink, commonTable, symbolTables); + InitializeStageSymbolTable(*builtInParseables, version, profile, spv, vulkan, EShLangGeometry, infoSink, commonTable, symbolTables); // check for compute if ((profile != EEsProfile && version >= 430) || (profile == EEsProfile && version >= 310)) - InitializeStageSymbolTable(builtIns, version, profile, spv, vulkan, EShLangCompute, infoSink, commonTable, symbolTables); - + InitializeStageSymbolTable(*builtInParseables, version, profile, spv, vulkan, EShLangCompute, infoSink, commonTable, symbolTables); + return true; } -bool AddContextSpecificSymbols(const TBuiltInResource* resources, TInfoSink& infoSink, TSymbolTable& symbolTable, int version, EProfile profile, int spv, int vulkan, EShLanguage language) +bool AddContextSpecificSymbols(const TBuiltInResource* resources, TInfoSink& infoSink, TSymbolTable& symbolTable, int version, + EProfile profile, int spv, int vulkan, EShLanguage language, EShSource source) { - TBuiltIns builtIns; + std::unique_ptr builtInParseables(CreateBuiltInParseables(infoSink, source)); - builtIns.initialize(*resources, version, profile, spv, vulkan, language); - InitializeSymbolTable(builtIns.getCommonString(), version, profile, spv, vulkan, language, infoSink, symbolTable); - IdentifyBuiltIns(version, profile, spv, vulkan, language, symbolTable, *resources); + builtInParseables->initialize(*resources, version, profile, spv, vulkan, language); + InitializeSymbolTable(builtInParseables->getCommonString(), version, profile, spv, vulkan, language, infoSink, symbolTable); + builtInParseables->identifyBuiltIns(version, profile, spv, vulkan, language, symbolTable, *resources); return true; } @@ -245,7 +266,7 @@ bool AddContextSpecificSymbols(const TBuiltInResource* resources, TInfoSink& inf // This only gets done the first time any thread needs a particular symbol table // (lazy evaluation). // -void SetupBuiltinSymbolTable(int version, EProfile profile, int spv, int vulkan) +void SetupBuiltinSymbolTable(int version, EProfile profile, int spv, int vulkan, EShSource source) { TInfoSink infoSink; @@ -275,7 +296,7 @@ void SetupBuiltinSymbolTable(int version, EProfile profile, int spv, int vulkan) stageTables[stage] = new TSymbolTable; // Generate the local symbol tables using the new pool - InitializeSymbolTables(infoSink, commonTable, stageTables, version, profile, spv, vulkan); + InitializeSymbolTables(infoSink, commonTable, stageTables, version, profile, spv, vulkan, source); // Switch to the process-global pool SetThreadPoolAllocator(*PerProcessGPA); @@ -579,7 +600,7 @@ bool ProcessDeferred( intermediate.setSpv(spv); if (vulkan) intermediate.setOriginUpperLeft(); - SetupBuiltinSymbolTable(version, profile, spv, vulkan); + SetupBuiltinSymbolTable(version, profile, spv, vulkan, source); TSymbolTable* cachedTable = SharedSymbolTables[MapVersionToIndex(version)] [MapProfileToIndex(profile)] @@ -593,7 +614,8 @@ bool ProcessDeferred( // Add built-in symbols that are potentially context dependent; // they get popped again further down. - AddContextSpecificSymbols(resources, compiler->infoSink, symbolTable, version, profile, spv, vulkan, compiler->getLanguage()); + AddContextSpecificSymbols(resources, compiler->infoSink, symbolTable, version, profile, spv, vulkan, + compiler->getLanguage(), source); // // Now we can process the full shader under proper symbols and rules. diff --git a/hlsl/CMakeLists.txt b/hlsl/CMakeLists.txt index 5e39b455..c7537e27 100755 --- a/hlsl/CMakeLists.txt +++ b/hlsl/CMakeLists.txt @@ -3,7 +3,8 @@ set(SOURCES hlslScanContext.cpp hlslOpMap.cpp hlslTokenStream.cpp - hlslGrammar.cpp) + hlslGrammar.cpp + hlslParseables.cpp) set(HEADERS hlslParseHelper.h @@ -11,7 +12,8 @@ set(HEADERS hlslScanContext.h hlslOpMap.h hlslTokenStream.h - hlslGrammar.h) + hlslGrammar.h + hlslParseables.h) add_library(HLSL STATIC ${SOURCES} ${HEADERS}) set_property(TARGET HLSL PROPERTY FOLDER hlsl) diff --git a/hlsl/hlslParseables.cpp b/hlsl/hlslParseables.cpp new file mode 100755 index 00000000..b29226d2 --- /dev/null +++ b/hlsl/hlslParseables.cpp @@ -0,0 +1,117 @@ +// +//Copyright (C) 2016 LunarG, 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. +// + +// +// Create strings that declare built-in definitions, add built-ins programmatically +// that cannot be expressed in the strings, and establish mappings between +// built-in functions and operators. +// +// Where to put a built-in: +// TBuiltInParseablesHlsl::initialize(version,profile) context-independent textual built-ins; add them to the right string +// TBuiltInParseablesHlsl::initialize(resources,...) context-dependent textual built-ins; add them to the right string +// TBuiltInParseablesHlsl::identifyBuiltIns(...,symbolTable) context-independent programmatic additions/mappings to the symbol table, +// including identifying what extensions are needed if a version does not allow a symbol +// TBuiltInParseablesHlsl::identifyBuiltIns(...,symbolTable, resources) context-dependent programmatic additions/mappings to the +// symbol table, including identifying what extensions are needed if a version does +// not allow a symbol +// + +#include "hlslParseables.h" + +namespace glslang { + +TBuiltInParseablesHlsl::TBuiltInParseablesHlsl() +{ + assert(0 && "Unimplemented TBuiltInParseablesHlsl::TBuiltInParseablesHlsl"); +} + +// +// Add all context-independent built-in functions and variables that are present +// for the given version and profile. Share common ones across stages, otherwise +// make stage-specific entries. +// +// Most built-ins variables can be added as simple text strings. Some need to +// be added programmatically, which is done later in IdentifyBuiltIns() below. +// +void TBuiltInParseablesHlsl::initialize(int version, EProfile profile, int spv, int vulkan) +{ + assert(0 && "Unimplemented TBuiltInParseablesHlsl::initialize"); +} + +// +// Add context-dependent built-in functions and variables that are present +// for the given version and profile. All the results are put into just the +// commonBuiltins, because it is called for just a specific stage. So, +// add stage-specific entries to the commonBuiltins, and only if that stage +// was requested. +// +void TBuiltInParseablesHlsl::initialize(const TBuiltInResource &resources, int version, EProfile profile, int spv, + int vulkan, EShLanguage language) +{ + assert(0 && "Unimplemented TBuiltInParseablesHlsl::initialize"); +} + + +// +// Finish adding/processing context-independent built-in symbols. +// 1) Programmatically add symbols that could not be added by simple text strings above. +// 2) Map built-in functions to operators, for those that will turn into an operation node +// instead of remaining a function call. +// 3) Tag extension-related symbols added to their base version with their extensions, so +// that if an early version has the extension turned off, there is an error reported on use. +// +void TBuiltInParseablesHlsl::identifyBuiltIns(int version, EProfile profile, int spv, int vulkan, EShLanguage language, + TSymbolTable& symbolTable) +{ + assert(0 && "Unimplemented TBuiltInParseablesHlsl::identifyBuiltIns"); +} + +// +// Add context-dependent (resource-specific) built-ins not handled by the above. These +// would be ones that need to be programmatically added because they cannot +// be added by simple text strings. For these, also +// 1) Map built-in functions to operators, for those that will turn into an operation node +// instead of remaining a function call. +// 2) Tag extension-related symbols added to their base version with their extensions, so +// that if an early version has the extension turned off, there is an error reported on use. +// +void TBuiltInParseablesHlsl::identifyBuiltIns(int version, EProfile profile, int spv, int /*vulkan*/, EShLanguage language, + TSymbolTable& symbolTable, const TBuiltInResource &resources) +{ + assert(0 && "Unimplemented TBuiltInParseablesHlsl::identifyBuiltIns"); +} + + +} // end namespace glslang diff --git a/hlsl/hlslParseables.h b/hlsl/hlslParseables.h new file mode 100755 index 00000000..c09c1ecf --- /dev/null +++ b/hlsl/hlslParseables.h @@ -0,0 +1,61 @@ +// +//Copyright (C) 2016 LunarG, 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. +// + +#ifndef _HLSLPARSEABLES_INCLUDED_ +#define _HLSLPARSEABLES_INCLUDED_ + +#include "../glslang/MachineIndependent/Initialize.h" + +namespace glslang { + +// +// This is an HLSL specific derivation of TBuiltInParseables. See comment +// above TBuiltInParseables for details. +// +class TBuiltInParseablesHlsl : public TBuiltInParseables { +public: + POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) + TBuiltInParseablesHlsl(); + void initialize(int version, EProfile, int spv, int vulkan); + void initialize(const TBuiltInResource& resources, int version, EProfile, int spv, int vulkan, EShLanguage); + + void identifyBuiltIns(int version, EProfile profile, int spv, int vulkan, EShLanguage language, TSymbolTable& symbolTable); + + void identifyBuiltIns(int version, EProfile profile, int spv, int /*vulkan*/, EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources); +}; + +} // end namespace glslang + +#endif // _HLSLPARSEABLES_INCLUDED_ From d82c906378e6829ed8d1444e5be2cdac55ad1d7a Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Mon, 23 May 2016 16:07:07 -0600 Subject: [PATCH 119/140] Vulkan: Finish semantics for what creates spec-const-semantics. Note: This required adding a new test mode to see the AST for vulkan tests. This also required reworking some deeper parts of type creation, regarding when storage qualification and constness is deduced bottom-up or dictated top-down. --- Test/baseResults/100.frag.out | 3 +- Test/baseResults/150.tesc.out | 18 +- Test/baseResults/420.tese.out | 18 +- Test/baseResults/430AofA.frag.out | 2 +- .../spv.specConstantComposite.vert.out | 130 +------ .../spv.specConstantOperations.vert.out | 83 +++-- Test/baseResults/vulkan.ast.vert.out | 324 ++++++++++++++++++ Test/spv.specConstantComposite.vert | 64 ++-- Test/spv.specConstantOperations.vert | 2 +- Test/vulkan.ast.vert | 42 +++ glslang/Include/Types.h | 1 + glslang/MachineIndependent/Intermediate.cpp | 54 ++- glslang/MachineIndependent/ParseHelper.cpp | 94 +++-- .../MachineIndependent/localintermediate.h | 1 - gtests/Spv.FromFile.cpp | 17 + gtests/TestFixture.cpp | 2 +- 16 files changed, 610 insertions(+), 245 deletions(-) create mode 100755 Test/baseResults/vulkan.ast.vert.out create mode 100644 Test/vulkan.ast.vert diff --git a/Test/baseResults/100.frag.out b/Test/baseResults/100.frag.out index 2c39cad4..7af716d8 100644 --- a/Test/baseResults/100.frag.out +++ b/Test/baseResults/100.frag.out @@ -2,7 +2,6 @@ ERROR: 0:3: '{ } style initializers' : not supported with this profile: es ERROR: 0:3: 'initializer' : not supported for this version or the enabled extensions ERROR: 0:3: 'array initializer' : not supported for this version or the enabled extensions -ERROR: 0:3: 'non-constant global initializer' : not supported with this profile: es ERROR: 0:4: '#version' : must occur first in shader ERROR: 0:7: 'attribute' : not supported in this stage: fragment ERROR: 0:7: 'float' : type requires declaration of default precision qualifier @@ -86,7 +85,7 @@ ERROR: 0:194: 'a' : can't use function syntax on variable ERROR: 0:214: 'non-constant global initializer' : not supported with this profile: es ERROR: 0:3000: '#error' : line of this error should be 3000 ERROR: 0:3002: '' : syntax error -ERROR: 78 compilation errors. No code generated. +ERROR: 77 compilation errors. No code generated. Shader version: 100 diff --git a/Test/baseResults/150.tesc.out b/Test/baseResults/150.tesc.out index 638ef82f..78020e12 100644 --- a/Test/baseResults/150.tesc.out +++ b/Test/baseResults/150.tesc.out @@ -720,18 +720,18 @@ ERROR: node is still EOpNull! 420.tese Warning, version 420 is not yet complete; most version-specific features are present, but some are missing. -ERROR: 0:7: '=' : cannot convert from 'global 3-element array of float' to 'global 2-element array of float' -ERROR: 0:8: 'initializer list' : wrong vector size (or rows in a matrix column): global 2-component vector of float -ERROR: 0:9: 'initializer list' : wrong number of matrix columns: global 3X3 matrix of float -ERROR: 0:10: 'initializer list' : wrong number of matrix columns: global 2X2 matrix of float +ERROR: 0:7: '=' : cannot convert from 'const 3-element array of float' to 'global 2-element array of float' +ERROR: 0:8: 'initializer list' : wrong vector size (or rows in a matrix column): temp 2-component vector of float +ERROR: 0:9: 'initializer list' : wrong number of matrix columns: temp 3X3 matrix of float +ERROR: 0:10: 'initializer list' : wrong number of matrix columns: temp 2X2 matrix of float ERROR: 0:25: 'initializer list' : wrong number of structure members ERROR: 0:27: '=' : cannot convert from 'const bool' to 'global int' -ERROR: 0:28: 'constructor' : cannot convert parameter 2 from 'const float' to 'global 4-component vector of float' +ERROR: 0:28: 'constructor' : cannot convert parameter 2 from 'const float' to 'temp 4-component vector of float' ERROR: 0:29: 'constructor' : cannot convert parameter 2 from 'const 2X2 matrix of float' to 'const 4-component vector of float' ERROR: 0:29: 'const 2-element array of 4-component vector of float' : cannot construct with these arguments ERROR: 0:29: '=' : cannot convert from 'const float' to 'global 2-element array of 4-component vector of float' -ERROR: 0:30: 'initializer list' : wrong number of matrix columns: global 4X2 matrix of float -ERROR: 0:40: 'constructor' : cannot convert parameter 1 from 'temp float' to 'global structure{global float s, global float t}' +ERROR: 0:30: 'initializer list' : wrong number of matrix columns: temp 4X2 matrix of float +ERROR: 0:40: 'constructor' : cannot convert parameter 1 from 'temp float' to 'temp structure{global float s, global float t}' ERROR: 0:58: 'initializer list' : wrong number of structure members ERROR: 13 compilation errors. No code generated. @@ -780,7 +780,7 @@ ERROR: node is still EOpNull! 0:68 Sequence 0:68 move second child to first child (temp 3-component vector of float) 0:68 'bv3' (global 3-component vector of float) -0:68 Construct vec3 (global 3-component vector of float) +0:68 Construct vec3 (temp 3-component vector of float) 0:68 'vc1' (global float) 0:68 'vc2' (global float) 0:68 'vc3' (global float) @@ -1534,7 +1534,7 @@ ERROR: node is still EOpNull! 0:68 Sequence 0:68 move second child to first child (temp 3-component vector of float) 0:68 'bv3' (global 3-component vector of float) -0:68 Construct vec3 (global 3-component vector of float) +0:68 Construct vec3 (temp 3-component vector of float) 0:68 'vc1' (global float) 0:68 'vc2' (global float) 0:68 'vc3' (global float) diff --git a/Test/baseResults/420.tese.out b/Test/baseResults/420.tese.out index 26eac103..fb9bc201 100644 --- a/Test/baseResults/420.tese.out +++ b/Test/baseResults/420.tese.out @@ -1,17 +1,17 @@ 420.tese Warning, version 420 is not yet complete; most version-specific features are present, but some are missing. -ERROR: 0:7: '=' : cannot convert from 'global 3-element array of float' to 'global 2-element array of float' -ERROR: 0:8: 'initializer list' : wrong vector size (or rows in a matrix column): global 2-component vector of float -ERROR: 0:9: 'initializer list' : wrong number of matrix columns: global 3X3 matrix of float -ERROR: 0:10: 'initializer list' : wrong number of matrix columns: global 2X2 matrix of float +ERROR: 0:7: '=' : cannot convert from 'const 3-element array of float' to 'global 2-element array of float' +ERROR: 0:8: 'initializer list' : wrong vector size (or rows in a matrix column): temp 2-component vector of float +ERROR: 0:9: 'initializer list' : wrong number of matrix columns: temp 3X3 matrix of float +ERROR: 0:10: 'initializer list' : wrong number of matrix columns: temp 2X2 matrix of float ERROR: 0:25: 'initializer list' : wrong number of structure members ERROR: 0:27: '=' : cannot convert from 'const bool' to 'global int' -ERROR: 0:28: 'constructor' : cannot convert parameter 2 from 'const float' to 'global 4-component vector of float' +ERROR: 0:28: 'constructor' : cannot convert parameter 2 from 'const float' to 'temp 4-component vector of float' ERROR: 0:29: 'constructor' : cannot convert parameter 2 from 'const 2X2 matrix of float' to 'const 4-component vector of float' ERROR: 0:29: 'const 2-element array of 4-component vector of float' : cannot construct with these arguments ERROR: 0:29: '=' : cannot convert from 'const float' to 'global 2-element array of 4-component vector of float' -ERROR: 0:30: 'initializer list' : wrong number of matrix columns: global 4X2 matrix of float -ERROR: 0:40: 'constructor' : cannot convert parameter 1 from 'temp float' to 'global structure{global float s, global float t}' +ERROR: 0:30: 'initializer list' : wrong number of matrix columns: temp 4X2 matrix of float +ERROR: 0:40: 'constructor' : cannot convert parameter 1 from 'temp float' to 'temp structure{global float s, global float t}' ERROR: 0:58: 'initializer list' : wrong number of structure members ERROR: 13 compilation errors. No code generated. @@ -60,7 +60,7 @@ ERROR: node is still EOpNull! 0:68 Sequence 0:68 move second child to first child (temp 3-component vector of float) 0:68 'bv3' (global 3-component vector of float) -0:68 Construct vec3 (global 3-component vector of float) +0:68 Construct vec3 (temp 3-component vector of float) 0:68 'vc1' (global float) 0:68 'vc2' (global float) 0:68 'vc3' (global float) @@ -210,7 +210,7 @@ ERROR: node is still EOpNull! 0:68 Sequence 0:68 move second child to first child (temp 3-component vector of float) 0:68 'bv3' (global 3-component vector of float) -0:68 Construct vec3 (global 3-component vector of float) +0:68 Construct vec3 (temp 3-component vector of float) 0:68 'vc1' (global float) 0:68 'vc2' (global float) 0:68 'vc3' (global float) diff --git a/Test/baseResults/430AofA.frag.out b/Test/baseResults/430AofA.frag.out index e8b79b7e..68285f73 100644 --- a/Test/baseResults/430AofA.frag.out +++ b/Test/baseResults/430AofA.frag.out @@ -6,7 +6,7 @@ ERROR: 0:15: 'constructior' : array constructor argument not correct type to con ERROR: 0:28: '[' : array index out of range '4' ERROR: 0:56: 'constructor' : cannot convert parameter 2 from 'const 3-element array of 4-component vector of float' to 'temp 2-element array of 4-component vector of float' ERROR: 0:60: 'constructor' : cannot convert parameter 2 from 'const 2-element array of 4-component vector of float' to 'temp 3-element array of 4-component vector of float' -ERROR: 0:64: '=' : cannot convert from 'temp 3-element array of 2-element array of 4-component vector of float' to 'temp 4-element array of 2-element array of 4-component vector of float' +ERROR: 0:64: '=' : cannot convert from 'const 3-element array of 2-element array of 4-component vector of float' to 'temp 4-element array of 2-element array of 4-component vector of float' ERROR: 0:70: 'assign' : cannot convert from 'global 4-element array of 7-element array of float' to 'global 5-element array of 7-element array of float' ERROR: 0:71: 'assign' : cannot convert from 'global 4-element array of 7-element array of float' to 'global implicitly-sized array of 7-element array of float' ERROR: 0:73: 'foo' : no matching overloaded function found diff --git a/Test/baseResults/spv.specConstantComposite.vert.out b/Test/baseResults/spv.specConstantComposite.vert.out index ac101f28..c4585e40 100644 --- a/Test/baseResults/spv.specConstantComposite.vert.out +++ b/Test/baseResults/spv.specConstantComposite.vert.out @@ -7,13 +7,13 @@ Linked vertex stage: // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 119 +// Id's are bound by 43 Capability Shader Capability Float64 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Vertex 4 "main" 27 118 + EntryPoint Vertex 4 "main" 27 42 Source GLSL 450 Name 4 "main" Name 6 "refer_primary_spec_const(" @@ -23,23 +23,12 @@ Linked vertex stage: Name 16 "refer_spec_const_array_length(" Name 18 "declare_spec_const_in_func(" Name 27 "color" - Name 42 "flat_struct" - MemberName 42(flat_struct) 0 "i" - MemberName 42(flat_struct) 1 "f" - MemberName 42(flat_struct) 2 "d" - MemberName 42(flat_struct) 3 "b" - Name 44 "nesting_struct" - MemberName 44(nesting_struct) 0 "nested" - MemberName 44(nesting_struct) 1 "v" - MemberName 44(nesting_struct) 2 "i" - Name 72 "indexable" - Name 76 "indexable" - Name 83 "len" - Name 118 "global_vec4_array_with_spec_length" + Name 33 "len" + Name 42 "global_vec4_array_with_spec_length" Decorate 21 SpecId 203 Decorate 28 SpecId 200 - Decorate 32 SpecId 201 - Decorate 41 SpecId 202 + Decorate 37 SpecId 201 + Decorate 39 SpecId 202 2: TypeVoid 3: TypeFunction 2 14: TypeInt 32 1 @@ -51,58 +40,13 @@ Linked vertex stage: 26: TypePointer Output 25(fvec4) 27(color): 26(ptr) Variable Output 28: 14(int) SpecConstant 3 - 32: 24(float) SpecConstant 1078523331 - 33: 25(fvec4) SpecConstantComposite 32 32 32 32 - 36: 24(float) Constant 1133908460 - 37: 25(fvec4) SpecConstantComposite 32 32 36 36 - 40: TypeFloat 64 - 41: 40(float) SpecConstant 1413754136 1074340347 - 42(flat_struct): TypeStruct 14(int) 24(float) 40(float) 20(bool) - 43:42(flat_struct) SpecConstantComposite 28 32 41 21 -44(nesting_struct): TypeStruct 42(flat_struct) 25(fvec4) 14(int) - 45:44(nesting_struct) SpecConstantComposite 43 33 28 - 46: 14(int) Constant 2 - 51: TypeInt 32 0 - 52: 51(int) Constant 0 - 57: 24(float) Constant 1065353216 - 58: 24(float) Constant 1073741824 - 59: 24(float) Constant 1077936128 - 60: 51(int) Constant 5 - 61: TypeArray 24(float) 60 - 62: 61 SpecConstantComposite 32 32 57 58 59 - 63: 14(int) Constant 1 - 68: 14(int) Constant 30 - 69: TypeArray 14(int) 60 - 70: 69 SpecConstantComposite 28 28 63 46 68 - 71: TypePointer Function 69 - 73: TypePointer Function 14(int) - 87: 24(float) Constant 1106321080 - 88:42(flat_struct) SpecConstantComposite 68 87 41 21 - 89: 14(int) Constant 10 - 90:44(nesting_struct) SpecConstantComposite 88 37 89 - 96: 20(bool) ConstantFalse - 97:42(flat_struct) SpecConstantComposite 28 32 41 96 - 98: 24(float) Constant 1036831949 - 99: 25(fvec4) ConstantComposite 98 98 98 98 - 100:44(nesting_struct) SpecConstantComposite 97 99 28 - 101: 25(fvec4) SpecConstantComposite 32 32 32 32 - 102: 24(float) Constant 1066192077 - 103: 24(float) Constant 1074580685 - 104: 24(float) Constant 1079194419 - 105: TypeVector 24(float) 3 - 106: TypeMatrix 105(fvec3) 2 - 107: 24(float) Constant 0 - 108: 105(fvec3) SpecConstantComposite 32 32 32 - 109: 105(fvec3) ConstantComposite 102 103 104 - 110: 106 SpecConstantComposite 108 109 - 111: 105(fvec3) SpecConstantComposite 32 107 107 - 112: 105(fvec3) SpecConstantComposite 107 32 107 - 113: 106 SpecConstantComposite 111 112 - 114: 14(int) Constant 3000 - 115:44(nesting_struct) SpecConstantComposite 88 37 114 - 116: TypeArray 25(fvec4) 28 - 117: TypePointer Input 116 -118(global_vec4_array_with_spec_length): 117(ptr) Variable Input + 32: TypePointer Function 14(int) + 37: 24(float) SpecConstant 1078523331 + 38: TypeFloat 64 + 39: 38(float) SpecConstant 1413754136 1074340347 + 40: TypeArray 25(fvec4) 28 + 41: TypePointer Input 40 +42(global_vec4_array_with_spec_length): 41(ptr) Variable Input 4(main): 2 Function None 3 5: Label Return @@ -122,64 +66,24 @@ Linked vertex stage: FunctionEnd 8(refer_composite_spec_const(): 2 Function None 3 9: Label - 34: 25(fvec4) Load 27(color) - 35: 25(fvec4) FAdd 34 33 - Store 27(color) 35 - 38: 25(fvec4) Load 27(color) - 39: 25(fvec4) FSub 38 37 - Store 27(color) 39 Return FunctionEnd 10(refer_copmosite_dot_dereference(): 2 Function None 3 11: Label - 47: 14(int) CompositeExtract 45 2 - 48: 24(float) ConvertSToF 47 - 49: 25(fvec4) Load 27(color) - 50: 25(fvec4) VectorTimesScalar 49 48 - Store 27(color) 50 - 53: 24(float) CompositeExtract 33 0 - 54: 25(fvec4) Load 27(color) - 55: 25(fvec4) CompositeConstruct 53 53 53 53 - 56: 25(fvec4) FAdd 54 55 - Store 27(color) 56 Return FunctionEnd 12(refer_composite_bracket_dereference(): 2 Function None 3 13: Label - 72(indexable): 71(ptr) Variable Function - 76(indexable): 71(ptr) Variable Function - 64: 24(float) CompositeExtract 62 1 - 65: 25(fvec4) Load 27(color) - 66: 25(fvec4) CompositeConstruct 64 64 64 64 - 67: 25(fvec4) FSub 65 66 - Store 27(color) 67 - Store 72(indexable) 70 - 74: 73(ptr) AccessChain 72(indexable) 28 - 75: 14(int) Load 74 - Store 76(indexable) 70 - 77: 73(ptr) AccessChain 76(indexable) 75 - 78: 14(int) Load 77 - 79: 24(float) ConvertSToF 78 - 80: 25(fvec4) Load 27(color) - 81: 25(fvec4) CompositeConstruct 79 79 79 79 - 82: 25(fvec4) FDiv 80 81 - Store 27(color) 82 Return FunctionEnd 16(refer_spec_const_array_length(): 14(int) Function None 15 17: Label - 83(len): 73(ptr) Variable Function - Store 83(len) 28 - 84: 14(int) Load 83(len) - ReturnValue 84 + 33(len): 32(ptr) Variable Function + Store 33(len) 28 + 34: 14(int) Load 33(len) + ReturnValue 34 FunctionEnd 18(declare_spec_const_in_func(): 2 Function None 3 19: Label - 91: 14(int) CompositeExtract 90 2 - 92: 24(float) ConvertSToF 91 - 93: 25(fvec4) Load 27(color) - 94: 25(fvec4) CompositeConstruct 92 92 92 92 - 95: 25(fvec4) FDiv 93 94 - Store 27(color) 95 Return FunctionEnd diff --git a/Test/baseResults/spv.specConstantOperations.vert.out b/Test/baseResults/spv.specConstantOperations.vert.out index 39de987d..ea4c69a2 100644 --- a/Test/baseResults/spv.specConstantOperations.vert.out +++ b/Test/baseResults/spv.specConstantOperations.vert.out @@ -7,7 +7,7 @@ Linked vertex stage: // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 134 +// Id's are bound by 131 Capability Shader 1: ExtInstImport "GLSL.std.450" @@ -91,48 +91,45 @@ Linked vertex stage: 89: 41(int) Constant 4294967294 90: TypeVector 41(int) 4 91: 90(ivec4) SpecConstantComposite 42 42 88 89 - 92: 39(float) Constant 1067450368 - 93: TypeVector 39(float) 4 - 94: 93(fvec4) SpecConstantComposite 40 92 40 92 - 95: TypeVector 22(bool) 4 - 96: 90(ivec4) ConstantComposite 44 44 44 44 - 97: 95(bvec4) SpecConstantOp 171 87 96 - 98: 95(bvec4) SpecConstantOp 171 91 96 - 99: 86(ivec4) ConstantComposite 12 12 12 12 - 100: 86(ivec4) ConstantComposite 32 32 32 32 - 101: 86(ivec4) SpecConstantOp 169 97 100 99 - 102: 90(ivec4) ConstantComposite 48 48 48 48 - 103: 90(ivec4) SpecConstantOp 169 97 102 96 - 104: 90(ivec4) SpecConstantOp 128 87 96 - 105: 86(ivec4) SpecConstantOp 128 91 96 - 106: 86(ivec4) SpecConstantOp 200 87 - 107: 86(ivec4) SpecConstantOp 126 87 - 108: 86(ivec4) ConstantComposite 20 20 20 20 - 109: 86(ivec4) SpecConstantOp 128 87 108 - 110: 86(ivec4) SpecConstantOp 128 87 108 - 111: 86(ivec4) ConstantComposite 56 56 56 56 - 112: 86(ivec4) SpecConstantOp 130 110 111 - 113: 86(ivec4) ConstantComposite 58 58 58 58 - 114: 86(ivec4) SpecConstantOp 130 112 113 - 115: 86(ivec4) SpecConstantOp 132 87 108 - 116: 86(ivec4) ConstantComposite 63 63 63 63 - 117: 86(ivec4) SpecConstantOp 135 115 116 - 118: 86(ivec4) SpecConstantOp 139 87 113 - 119: 86(ivec4) ConstantComposite 72 72 72 72 - 120: 86(ivec4) SpecConstantOp 195 87 119 - 121: 86(ivec4) SpecConstantOp 196 87 108 - 122: 6(int) Constant 1024 - 123: 86(ivec4) ConstantComposite 122 122 122 122 - 124: 86(ivec4) SpecConstantOp 197 87 123 - 125: 41(int) Constant 2048 - 126: 90(ivec4) ConstantComposite 125 125 125 125 - 127: 90(ivec4) SpecConstantOp 198 91 126 - 128: 6(int) SpecConstantOp 81 87 0 - 129: TypeVector 6(int) 2 - 130: 129(ivec2) SpecConstantOp 79 87 87 1(GLSL.std.450) 0 - 131: TypeVector 6(int) 3 - 132: 131(ivec3) SpecConstantOp 79 87 87 2 1(GLSL.std.450) 0 - 133: 86(ivec4) SpecConstantOp 79 87 87 1(GLSL.std.450) 2 0 3 + 92: TypeVector 22(bool) 4 + 93: 90(ivec4) ConstantComposite 44 44 44 44 + 94: 92(bvec4) SpecConstantOp 171 87 93 + 95: 92(bvec4) SpecConstantOp 171 91 93 + 96: 86(ivec4) ConstantComposite 12 12 12 12 + 97: 86(ivec4) ConstantComposite 32 32 32 32 + 98: 86(ivec4) SpecConstantOp 169 94 97 96 + 99: 90(ivec4) ConstantComposite 48 48 48 48 + 100: 90(ivec4) SpecConstantOp 169 94 99 93 + 101: 90(ivec4) SpecConstantOp 128 87 93 + 102: 86(ivec4) SpecConstantOp 128 91 93 + 103: 86(ivec4) SpecConstantOp 200 87 + 104: 86(ivec4) SpecConstantOp 126 87 + 105: 86(ivec4) ConstantComposite 20 20 20 20 + 106: 86(ivec4) SpecConstantOp 128 87 105 + 107: 86(ivec4) SpecConstantOp 128 87 105 + 108: 86(ivec4) ConstantComposite 56 56 56 56 + 109: 86(ivec4) SpecConstantOp 130 107 108 + 110: 86(ivec4) ConstantComposite 58 58 58 58 + 111: 86(ivec4) SpecConstantOp 130 109 110 + 112: 86(ivec4) SpecConstantOp 132 87 105 + 113: 86(ivec4) ConstantComposite 63 63 63 63 + 114: 86(ivec4) SpecConstantOp 135 112 113 + 115: 86(ivec4) SpecConstantOp 139 87 110 + 116: 86(ivec4) ConstantComposite 72 72 72 72 + 117: 86(ivec4) SpecConstantOp 195 87 116 + 118: 86(ivec4) SpecConstantOp 196 87 105 + 119: 6(int) Constant 1024 + 120: 86(ivec4) ConstantComposite 119 119 119 119 + 121: 86(ivec4) SpecConstantOp 197 87 120 + 122: 41(int) Constant 2048 + 123: 90(ivec4) ConstantComposite 122 122 122 122 + 124: 90(ivec4) SpecConstantOp 198 91 123 + 125: 6(int) SpecConstantOp 81 87 0 + 126: TypeVector 6(int) 2 + 127: 126(ivec2) SpecConstantOp 79 87 87 1(GLSL.std.450) 0 + 128: TypeVector 6(int) 3 + 129: 128(ivec3) SpecConstantOp 79 87 87 2 1(GLSL.std.450) 0 + 130: 86(ivec4) SpecConstantOp 79 87 87 1(GLSL.std.450) 2 0 3 4(main): 2 Function None 3 5: Label Return diff --git a/Test/baseResults/vulkan.ast.vert.out b/Test/baseResults/vulkan.ast.vert.out new file mode 100755 index 00000000..31ac4940 --- /dev/null +++ b/Test/baseResults/vulkan.ast.vert.out @@ -0,0 +1,324 @@ +vulkan.ast.vert +Warning, version 450 is not yet complete; most version-specific features are present, but some are missing. + +Shader version: 450 +0:? Sequence +0:7 Function Definition: main( (global void) +0:7 Function Parameters: +0:9 Sequence +0:9 Convert float to bool (temp bool) +0:9 'scf1' (specialization-constant const float) +0:9 1.000000 +0:10 Construct bool (specialization-constant const bool) +0:10 'scbt' (specialization-constant const bool) +0:10 true (const bool) +0:11 Convert int to bool (specialization-constant const bool) +0:11 'sci2' (specialization-constant const int) +0:11 2 (const int) +0:13 Construct float (temp float) +0:13 'scf1' (specialization-constant const float) +0:13 1.000000 +0:14 Convert bool to float (temp float) +0:14 'scbt' (specialization-constant const bool) +0:14 true (const bool) +0:15 Convert int to float (temp float) +0:15 'sci2' (specialization-constant const int) +0:15 2 (const int) +0:17 Convert float to int (temp int) +0:17 'scf1' (specialization-constant const float) +0:17 1.000000 +0:18 Convert bool to int (specialization-constant const int) +0:18 'scbt' (specialization-constant const bool) +0:18 true (const bool) +0:19 Construct int (specialization-constant const int) +0:19 'sci2' (specialization-constant const int) +0:19 2 (const int) +0:21 component-wise multiply (temp float) +0:21 'scf1' (specialization-constant const float) +0:21 1.000000 +0:21 'scf1' (specialization-constant const float) +0:21 1.000000 +0:22 logical-or (specialization-constant const bool) +0:22 'scbt' (specialization-constant const bool) +0:22 true (const bool) +0:22 'scbt' (specialization-constant const bool) +0:22 true (const bool) +0:23 component-wise multiply (specialization-constant const int) +0:23 'sci2' (specialization-constant const int) +0:23 2 (const int) +0:23 'sci2' (specialization-constant const int) +0:23 2 (const int) +0:24 add (temp float) +0:24 'scf1' (specialization-constant const float) +0:24 1.000000 +0:24 Convert int to float (temp float) +0:24 'sci2' (specialization-constant const int) +0:24 2 (const int) +0:26 Negate value (temp float) +0:26 'scf1' (specialization-constant const float) +0:26 1.000000 +0:27 Negate conditional (specialization-constant const bool) +0:27 'scbt' (specialization-constant const bool) +0:27 true (const bool) +0:28 Negate value (specialization-constant const int) +0:28 'sci2' (specialization-constant const int) +0:28 2 (const int) +0:30 Compare Greater Than (temp bool) +0:30 'scf1' (specialization-constant const float) +0:30 1.000000 +0:30 'scf1' (specialization-constant const float) +0:30 1.000000 +0:31 Compare Greater Than (specialization-constant const bool) +0:31 'sci2' (specialization-constant const int) +0:31 2 (const int) +0:31 'sci2' (specialization-constant const int) +0:31 2 (const int) +0:33 Compare Not Equal (temp bool) +0:33 'scf1' (specialization-constant const float) +0:33 1.000000 +0:33 'scf1' (specialization-constant const float) +0:33 1.000000 +0:34 Compare Not Equal (specialization-constant const bool) +0:34 'scbt' (specialization-constant const bool) +0:34 true (const bool) +0:34 'scbt' (specialization-constant const bool) +0:34 true (const bool) +0:35 Compare Not Equal (specialization-constant const bool) +0:35 'sci2' (specialization-constant const int) +0:35 2 (const int) +0:35 'sci2' (specialization-constant const int) +0:35 2 (const int) +0:37 Construct ivec2 (specialization-constant const 2-component vector of int) +0:37 'sci2' (specialization-constant const int) +0:37 2 (const int) +0:37 'sci2' (specialization-constant const int) +0:37 2 (const int) +0:38 Construct ivec2 (temp 2-element array of 2-component vector of int) +0:38 Construct ivec2 (specialization-constant const 2-component vector of int) +0:38 'sci2' (specialization-constant const int) +0:38 2 (const int) +0:38 'sci2' (specialization-constant const int) +0:38 2 (const int) +0:38 Construct ivec2 (specialization-constant const 2-component vector of int) +0:38 'sci2' (specialization-constant const int) +0:38 2 (const int) +0:38 'sci2' (specialization-constant const int) +0:38 2 (const int) +0:40 Construct vec2 (temp 2-component vector of float) +0:40 'scf1' (specialization-constant const float) +0:40 1.000000 +0:40 'scf1' (specialization-constant const float) +0:40 1.000000 +0:41 Construct vec2 (temp 2-element array of 2-component vector of float) +0:41 Construct vec2 (temp 2-component vector of float) +0:41 'scf1' (specialization-constant const float) +0:41 1.000000 +0:41 'scf1' (specialization-constant const float) +0:41 1.000000 +0:41 Construct vec2 (temp 2-component vector of float) +0:41 'scf1' (specialization-constant const float) +0:41 1.000000 +0:41 'scf1' (specialization-constant const float) +0:41 1.000000 +0:? Linker Objects +0:? 'scf1' (specialization-constant const float) +0:? 1.000000 +0:? 'scbt' (specialization-constant const bool) +0:? true (const bool) +0:? 'sci2' (specialization-constant const int) +0:? 2 (const int) + + +Linked vertex stage: + + +Shader version: 450 +0:? Sequence +0:7 Function Definition: main( (global void) +0:7 Function Parameters: +0:9 Sequence +0:9 Convert float to bool (temp bool) +0:9 'scf1' (specialization-constant const float) +0:9 1.000000 +0:10 Construct bool (specialization-constant const bool) +0:10 'scbt' (specialization-constant const bool) +0:10 true (const bool) +0:11 Convert int to bool (specialization-constant const bool) +0:11 'sci2' (specialization-constant const int) +0:11 2 (const int) +0:13 Construct float (temp float) +0:13 'scf1' (specialization-constant const float) +0:13 1.000000 +0:14 Convert bool to float (temp float) +0:14 'scbt' (specialization-constant const bool) +0:14 true (const bool) +0:15 Convert int to float (temp float) +0:15 'sci2' (specialization-constant const int) +0:15 2 (const int) +0:17 Convert float to int (temp int) +0:17 'scf1' (specialization-constant const float) +0:17 1.000000 +0:18 Convert bool to int (specialization-constant const int) +0:18 'scbt' (specialization-constant const bool) +0:18 true (const bool) +0:19 Construct int (specialization-constant const int) +0:19 'sci2' (specialization-constant const int) +0:19 2 (const int) +0:21 component-wise multiply (temp float) +0:21 'scf1' (specialization-constant const float) +0:21 1.000000 +0:21 'scf1' (specialization-constant const float) +0:21 1.000000 +0:22 logical-or (specialization-constant const bool) +0:22 'scbt' (specialization-constant const bool) +0:22 true (const bool) +0:22 'scbt' (specialization-constant const bool) +0:22 true (const bool) +0:23 component-wise multiply (specialization-constant const int) +0:23 'sci2' (specialization-constant const int) +0:23 2 (const int) +0:23 'sci2' (specialization-constant const int) +0:23 2 (const int) +0:24 add (temp float) +0:24 'scf1' (specialization-constant const float) +0:24 1.000000 +0:24 Convert int to float (temp float) +0:24 'sci2' (specialization-constant const int) +0:24 2 (const int) +0:26 Negate value (temp float) +0:26 'scf1' (specialization-constant const float) +0:26 1.000000 +0:27 Negate conditional (specialization-constant const bool) +0:27 'scbt' (specialization-constant const bool) +0:27 true (const bool) +0:28 Negate value (specialization-constant const int) +0:28 'sci2' (specialization-constant const int) +0:28 2 (const int) +0:30 Compare Greater Than (temp bool) +0:30 'scf1' (specialization-constant const float) +0:30 1.000000 +0:30 'scf1' (specialization-constant const float) +0:30 1.000000 +0:31 Compare Greater Than (specialization-constant const bool) +0:31 'sci2' (specialization-constant const int) +0:31 2 (const int) +0:31 'sci2' (specialization-constant const int) +0:31 2 (const int) +0:33 Compare Not Equal (temp bool) +0:33 'scf1' (specialization-constant const float) +0:33 1.000000 +0:33 'scf1' (specialization-constant const float) +0:33 1.000000 +0:34 Compare Not Equal (specialization-constant const bool) +0:34 'scbt' (specialization-constant const bool) +0:34 true (const bool) +0:34 'scbt' (specialization-constant const bool) +0:34 true (const bool) +0:35 Compare Not Equal (specialization-constant const bool) +0:35 'sci2' (specialization-constant const int) +0:35 2 (const int) +0:35 'sci2' (specialization-constant const int) +0:35 2 (const int) +0:37 Construct ivec2 (specialization-constant const 2-component vector of int) +0:37 'sci2' (specialization-constant const int) +0:37 2 (const int) +0:37 'sci2' (specialization-constant const int) +0:37 2 (const int) +0:38 Construct ivec2 (temp 2-element array of 2-component vector of int) +0:38 Construct ivec2 (specialization-constant const 2-component vector of int) +0:38 'sci2' (specialization-constant const int) +0:38 2 (const int) +0:38 'sci2' (specialization-constant const int) +0:38 2 (const int) +0:38 Construct ivec2 (specialization-constant const 2-component vector of int) +0:38 'sci2' (specialization-constant const int) +0:38 2 (const int) +0:38 'sci2' (specialization-constant const int) +0:38 2 (const int) +0:40 Construct vec2 (temp 2-component vector of float) +0:40 'scf1' (specialization-constant const float) +0:40 1.000000 +0:40 'scf1' (specialization-constant const float) +0:40 1.000000 +0:41 Construct vec2 (temp 2-element array of 2-component vector of float) +0:41 Construct vec2 (temp 2-component vector of float) +0:41 'scf1' (specialization-constant const float) +0:41 1.000000 +0:41 'scf1' (specialization-constant const float) +0:41 1.000000 +0:41 Construct vec2 (temp 2-component vector of float) +0:41 'scf1' (specialization-constant const float) +0:41 1.000000 +0:41 'scf1' (specialization-constant const float) +0:41 1.000000 +0:? Linker Objects +0:? 'scf1' (specialization-constant const float) +0:? 1.000000 +0:? 'scbt' (specialization-constant const bool) +0:? true (const bool) +0:? 'sci2' (specialization-constant const int) +0:? 2 (const int) + +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 50 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" + Source GLSL 450 + Name 4 "main" + Decorate 7 SpecId 200 + Decorate 11 SpecId 201 + Decorate 13 SpecId 202 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: 6(float) SpecConstant 1065353216 + 8: TypeBool + 9: 6(float) Constant 0 + 11: 8(bool) SpecConstantTrue + 12: TypeInt 32 1 + 13: 12(int) SpecConstant 2 + 14: TypeInt 32 0 + 15: 14(int) Constant 0 + 16: 8(bool) SpecConstantOp 171 13 15 + 17: 6(float) Constant 1065353216 + 21: 12(int) Constant 0 + 22: 12(int) Constant 1 + 23: 12(int) SpecConstantOp 169 11 22 21 + 25: 8(bool) SpecConstantOp 166 11 11 + 26: 12(int) SpecConstantOp 132 13 13 + 30: 8(bool) SpecConstantOp 168 11 + 31: 12(int) SpecConstantOp 126 13 + 33: 8(bool) SpecConstantOp 173 13 13 + 35: 8(bool) SpecConstantOp 165 11 11 + 36: 8(bool) SpecConstantOp 171 13 13 + 37: TypeVector 12(int) 2 + 38: 37(ivec2) SpecConstantComposite 13 13 + 39: 37(ivec2) SpecConstantComposite 13 13 + 40: 37(ivec2) SpecConstantComposite 13 13 + 41: 14(int) Constant 2 + 42: TypeArray 37(ivec2) 41 + 44: TypeVector 6(float) 2 + 48: TypeArray 44(fvec2) 41 + 4(main): 2 Function None 3 + 5: Label + 10: 8(bool) FOrdNotEqual 7 9 + 18: 6(float) Select 11 17 9 + 19: 6(float) ConvertSToF 13 + 20: 12(int) ConvertFToS 7 + 24: 6(float) FMul 7 7 + 27: 6(float) ConvertSToF 13 + 28: 6(float) FAdd 7 27 + 29: 6(float) FNegate 7 + 32: 8(bool) FOrdGreaterThan 7 7 + 34: 8(bool) FOrdNotEqual 7 7 + 43: 42 CompositeConstruct 39 40 + 45: 44(fvec2) CompositeConstruct 7 7 + 46: 44(fvec2) CompositeConstruct 7 7 + 47: 44(fvec2) CompositeConstruct 7 7 + 49: 48 CompositeConstruct 46 47 + Return + FunctionEnd diff --git a/Test/spv.specConstantComposite.vert b/Test/spv.specConstantComposite.vert index 01103302..d9d07a3e 100644 --- a/Test/spv.specConstantComposite.vert +++ b/Test/spv.specConstantComposite.vert @@ -7,7 +7,7 @@ layout(constant_id = 202) const double spec_double = 3.1415926535897932384626433832795; layout(constant_id = 203) const bool spec_bool = true; -const float cast_spec_float = float(spec_float); +// const float cast_spec_float = float(spec_float); // Flat struct struct flat_struct { @@ -26,40 +26,40 @@ struct nesting_struct { // Expect OpSpecConstantComposite // Flat struct initializer -const flat_struct spec_flat_struct_all_spec = {spec_int, spec_float, - spec_double, spec_bool}; -const flat_struct spec_flat_struct_partial_spec = {30, 30.14, spec_double, - spec_bool}; +//const flat_struct spec_flat_struct_all_spec = {spec_int, spec_float, +// spec_double, spec_bool}; +//const flat_struct spec_flat_struct_partial_spec = {30, 30.14, spec_double, +// spec_bool}; // Nesting struct initializer -const nesting_struct nesting_struct_ctor = { - {spec_int, spec_float, spec_double, false}, - vec4(0.1, 0.1, 0.1, 0.1), - spec_int}; +//const nesting_struct nesting_struct_ctor = { +// {spec_int, spec_float, spec_double, false}, +// vec4(0.1, 0.1, 0.1, 0.1), +// spec_int}; // Vector constructor -const vec4 spec_vec4_all_spec = - vec4(spec_float, spec_float, spec_float, spec_float); -const vec4 spec_vec4_partial_spec = - vec4(spec_float, spec_float, 300.14, 300.14); -const vec4 spec_vec4_from_one_scalar = vec4(spec_float); +//const vec4 spec_vec4_all_spec = +// vec4(spec_float, spec_float, spec_float, spec_float); +//const vec4 spec_vec4_partial_spec = +// vec4(spec_float, spec_float, 300.14, 300.14); +//const vec4 spec_vec4_from_one_scalar = vec4(spec_float); // Matrix constructor -const mat2x3 spec_mat2x3 = mat2x3(spec_float, spec_float, spec_float, 1.1, 2.2, 3.3); -const mat2x3 spec_mat2x3_from_one_scalar = mat2x3(spec_float); +//const mat2x3 spec_mat2x3 = mat2x3(spec_float, spec_float, spec_float, 1.1, 2.2, 3.3); +//const mat2x3 spec_mat2x3_from_one_scalar = mat2x3(spec_float); // Struct nesting constructor -const nesting_struct spec_nesting_struct_all_spec = { - spec_flat_struct_all_spec, spec_vec4_all_spec, spec_int}; -const nesting_struct spec_nesting_struct_partial_spec = { - spec_flat_struct_partial_spec, spec_vec4_partial_spec, 3000}; +//const nesting_struct spec_nesting_struct_all_spec = { +// spec_flat_struct_all_spec, spec_vec4_all_spec, spec_int}; +//const nesting_struct spec_nesting_struct_partial_spec = { +// spec_flat_struct_partial_spec, spec_vec4_partial_spec, 3000}; -const float spec_float_array[5] = {spec_float, spec_float, 1.0, 2.0, 3.0}; -const int spec_int_array[5] = {spec_int, spec_int, 1, 2, 30}; +//const float spec_float_array[5] = {spec_float, spec_float, 1.0, 2.0, 3.0}; +//const int spec_int_array[5] = {spec_int, spec_int, 1, 2, 30}; // global_vec4_array_with_spec_length is not a spec constant, but its array // size is. When calling global_vec4_array_with_spec_length.length(), A -// TIntermSymbol Node shoule be returned, instead of a TIntermConstantUnion +// TIntermSymbol Node should be returned, instead of a TIntermConstantUnion // node which represents a known constant value. in vec4 global_vec4_array_with_spec_length[spec_int]; @@ -70,18 +70,18 @@ void refer_primary_spec_const() { } void refer_composite_spec_const() { - color += spec_vec4_all_spec; - color -= spec_vec4_partial_spec; + //color += spec_vec4_all_spec; + //color -= spec_vec4_partial_spec; } void refer_copmosite_dot_dereference() { - color *= spec_nesting_struct_all_spec.i; - color += spec_vec4_all_spec.x; + //color *= spec_nesting_struct_all_spec.i; + //color += spec_vec4_all_spec.x; } void refer_composite_bracket_dereference() { - color -= spec_float_array[1]; - color /= spec_int_array[spec_int_array[spec_int]]; + //color -= spec_float_array[1]; + //color /= spec_int_array[spec_int_array[spec_int]]; } int refer_spec_const_array_length() { @@ -90,9 +90,9 @@ int refer_spec_const_array_length() { } void declare_spec_const_in_func() { - const nesting_struct spec_const_declared_in_func = { - spec_flat_struct_partial_spec, spec_vec4_partial_spec, 10}; - color /= spec_const_declared_in_func.i; + //const nesting_struct spec_const_declared_in_func = { + // spec_flat_struct_partial_spec, spec_vec4_partial_spec, 10}; + //color /= spec_const_declared_in_func.i; } void main() {} diff --git a/Test/spv.specConstantOperations.vert b/Test/spv.specConstantOperations.vert index f2d57bf0..b5e46ad4 100644 --- a/Test/spv.specConstantOperations.vert +++ b/Test/spv.specConstantOperations.vert @@ -58,7 +58,7 @@ const bool sp_int_gt_sp_sint = sp_int > sp_sint; // const ivec4 iv = ivec4(20, 30, sp_int, sp_int); const uvec4 uv = uvec4(sp_uint, sp_uint, -1, -2); -const vec4 fv = vec4(sp_float, 1.25, sp_float, 1.25); +//const vec4 fv = vec4(sp_float, 1.25, sp_float, 1.25); // uint/int <-> bool conversion const bvec4 bv_from_iv = bvec4(iv); diff --git a/Test/vulkan.ast.vert b/Test/vulkan.ast.vert new file mode 100644 index 00000000..c5a6a42c --- /dev/null +++ b/Test/vulkan.ast.vert @@ -0,0 +1,42 @@ +#version 450 + +layout(constant_id = 200) const float scf1 = 1.0; +layout(constant_id = 201) const bool scbt = true; +layout(constant_id = 202) const int sci2 = 2; + +void main() +{ + bool(scf1); // not a spec-const + bool(scbt); // spec-const + bool(sci2); // spec-const + + float(scf1); // not a spec-const + float(scbt); // not a spec-const + float(sci2); // not a spec-const + + int(scf1); // not a spec-const + int(scbt); // spec-const + int(sci2); // spec-const + + scf1 * scf1; // not a spec-const + scbt || scbt; // spec-const + sci2 * sci2; // spec-const + scf1 + sci2; // implicit conversion not a spec-const + + -scf1; // not a spec-const + !scbt; // spec-const + -sci2; // spec-const + + scf1 > scf1; // not a spec-const + sci2 > sci2; // spec-const + + scf1 != scf1; // not a spec-const + scbt != scbt; // spec-const + sci2 != sci2; // spec-const + + ivec2(sci2, sci2); // spec-const + ivec2[2](ivec2(sci2, sci2), ivec2(sci2, sci2)); // not a spec-const + + vec2(scf1, scf1); // not spec-const + vec2[2](vec2(scf1, scf1), vec2(scf1, scf1)); // not a spec-const +} diff --git a/glslang/Include/Types.h b/glslang/Include/Types.h index 98de1646..c4933e07 100644 --- a/glslang/Include/Types.h +++ b/glslang/Include/Types.h @@ -1253,6 +1253,7 @@ public: virtual bool isImplicitlySizedArray() const { return isArray() && getOuterArraySize() == UnsizedArraySize && qualifier.storage != EvqBuffer; } virtual bool isRuntimeSizedArray() const { return isArray() && getOuterArraySize() == UnsizedArraySize && qualifier.storage == EvqBuffer; } virtual bool isStruct() const { return structure != nullptr; } + virtual bool isFloatingDomain() const { return basicType == EbtFloat || basicType == EbtDouble; } // "Image" is a superset of "Subpass" virtual bool isImage() const { return basicType == EbtSampler && getSampler().isImage(); } diff --git a/glslang/MachineIndependent/Intermediate.cpp b/glslang/MachineIndependent/Intermediate.cpp index f8f9237b..416dc34a 100644 --- a/glslang/MachineIndependent/Intermediate.cpp +++ b/glslang/MachineIndependent/Intermediate.cpp @@ -922,6 +922,7 @@ TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* true TIntermConstantUnion* TIntermediate::addConstantUnion(const TConstUnionArray& unionArray, const TType& t, const TSourceLoc& loc, bool literal) const { TIntermConstantUnion* node = new TIntermConstantUnion(unionArray, t); + node->getQualifier().storage = EvqConst; node->setLoc(loc); if (literal) node->setLiteral(); @@ -1165,20 +1166,44 @@ void TIntermediate::removeTree() // // "5.x Specialization Constant Operations" // -// ... +// Only some operations discussed in this section may be applied to a +// specialization constant and still yield a result that is as +// specialization constant. The operations allowed are listed below. +// When a specialization constant is operated on with one of these +// operators and with another constant or specialization constant, the +// result is implicitly a specialization constant. // -// It also needs to allow basic construction, swizzling, and indexing -// operations. +// - int(), uint(), and bool() constructors for type conversions +// from any of the following types to any of the following types: +// * int +// * uint +// * bool +// - vector versions of the above conversion constructors +// - allowed implicit conversions of the above +// - swizzles (e.g., foo.yx) +// - The following when applied to integer or unsigned integer types: +// * unary negative ( - ) +// * binary operations ( + , - , * , / , % ) +// * shift ( <<, >> ) +// * bitwise operations ( & , | , ^ ) +// - The following when applied to integer or unsigned integer scalar types: +// * comparison ( == , != , > , >= , < , <= ) +// - The following when applied to the Boolean scalar type: +// * not ( ! ) +// * logical operations ( && , || , ^^ ) +// * comparison ( == , != )" +// +// This function just handles binary and unary nodes. Construction +// rules are handled in construction paths that are not covered by the unary +// and binary paths, while required conversions will still show up here +// as unary converters in the from a construction operator. // bool TIntermediate::isSpecializationOperation(const TIntermOperator& node) const { - // allow construction - if (node.isConstructor()) - return true; - - // The set for floating point is quite limited - if (node.getBasicType() == EbtFloat || - node.getBasicType() == EbtDouble) { + // The operations resulting in floating point are quite limited + // (However, some floating-point operations result in bool, like ">", + // so are handled later.) + if (node.getType().isFloatingDomain()) { switch (node.getOp()) { case EOpIndexDirect: case EOpIndexIndirect: @@ -1190,7 +1215,14 @@ bool TIntermediate::isSpecializationOperation(const TIntermOperator& node) const } } - // Floating-point is out of the way. + // Check for floating-point arguments + if (const TIntermBinary* bin = node.getAsBinaryNode()) + if (bin->getLeft() ->getType().isFloatingDomain() || + bin->getRight()->getType().isFloatingDomain()) + return false; + + // So, for now, we can assume everything left is non-floating-point... + // Now check for integer/bool-based operations switch (node.getOp()) { diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 93c674ee..15d0dae3 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -2208,6 +2208,18 @@ bool TParseContext::builtInName(const TString& identifier) // constructor to build something of the type of the constructor. Also returns // the type of the constructor. // +// Part of establishing type is establishing specialization-constness. +// We don't yet know "top down" whether type is a specialization constant, +// but a const constructor can becomes a specialization constant if any of +// its children are, subject to KHR_vulkan_glsl rules: +// +// - int(), uint(), and bool() constructors for type conversions +// from any of the following types to any of the following types: +// * int +// * uint +// * bool +// - vector versions of the above conversion constructors +// // Returns true if there was an error in construction. // bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, TFunction& function, TOperator op, TType& type) @@ -2253,6 +2265,7 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T bool overFull = false; bool matrixInMatrix = false; bool arrayArg = false; + bool floatArgument = false; for (int arg = 0; arg < function.getParamCount(); ++arg) { if (function[arg].type->isArray()) { if (! function[arg].type->isExplicitlySizedArray()) { @@ -2281,11 +2294,52 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T constType = false; if (function[arg].type->getQualifier().isSpecConstant()) specConstType = true; + if (function[arg].type->isFloatingDomain()) + floatArgument = true; } + // inherit constness from children if (constType) { - if (specConstType) + bool makeSpecConst; + // Finish pinning down spec-const semantics + if (specConstType) { + switch (op) { + 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: + case EOpConstructI64Vec2: + case EOpConstructI64Vec3: + case EOpConstructI64Vec4: + case EOpConstructU64Vec2: + case EOpConstructU64Vec3: + case EOpConstructU64Vec4: + // This was the list of valid ones, if they aren't converting from float + // and aren't making an array. + makeSpecConst = ! floatArgument && ! type.isArray(); + break; + default: + // anything else wasn't white-listed in the spec as a conversion + makeSpecConst = false; + break; + } + } else + makeSpecConst = false; + + if (makeSpecConst) type.getQualifier().makeSpecConstant(); + else if (specConstType) + type.getQualifier().makeTemporary(); else type.getQualifier().storage = EvqConst; } @@ -4941,7 +4995,14 @@ TIntermNode* TParseContext::executeInitializer(const TSourceLoc& loc, TIntermTyp // constructor-style subtree, allowing the rest of the code to operate // identically for both kinds of initializers. // - initializer = convertInitializerList(loc, variable->getType(), initializer); + // Type can't be deduced from the initializer list, so a skeletal type to + // follow has to be passed in. Constness and specialization-constness + // should be deduced bottom up, not dictated by the skeletal type. + // + TType skeletalType; + skeletalType.shallowCopy(variable->getType()); + skeletalType.getQualifier().makeTemporary(); + initializer = convertInitializerList(loc, skeletalType, initializer); if (! initializer) { // error recovery; don't leave const without constant values if (qualifier == EvqConst) @@ -5030,7 +5091,7 @@ TIntermNode* TParseContext::executeInitializer(const TSourceLoc& loc, TIntermTyp // normal assigning of a value to a variable... specializationCheck(loc, initializer->getType(), "initializer"); TIntermSymbol* intermSymbol = intermediate.addSymbol(*variable, loc); - TIntermNode* initNode = intermediate.addAssign(EOpAssign, intermSymbol, initializer, loc); + TIntermTyped* initNode = intermediate.addAssign(EOpAssign, intermSymbol, initializer, loc); if (! initNode) assignError(loc, "=", intermSymbol->getCompleteString(), initializer->getCompleteString()); @@ -5041,11 +5102,14 @@ TIntermNode* TParseContext::executeInitializer(const TSourceLoc& loc, TIntermTyp } // -// Reprocess any initializer-list { ... } parts of the initializer. +// Reprocess any initializer-list (the "{ ... }" syntax) parts of the +// initializer. +// // Need to hierarchically assign correct types and implicit // conversions. Will do this mimicking the same process used for // creating a constructor-style initializer, ensuring we get the -// same form. +// same form. However, it has to in parallel walk the 'type' +// passed in, as type cannot be deduced from an initializer list. // TIntermTyped* TParseContext::convertInitializerList(const TSourceLoc& loc, const TType& type, TIntermTyped* initializer) { @@ -5191,12 +5255,6 @@ TIntermTyped* TParseContext::addConstructor(const TSourceLoc& loc, TIntermNode* // for each parameter to the constructor call, check to see if the right type is passed or convert them // to the right type if possible (and allowed). // for structure constructors, just check if the right type is passed, no conversion is allowed. - - // We don't know "top down" whether type is a specialization constant, - // but a const becomes a specialization constant if any of its children are. - bool hasSpecConst = false; - bool isConstConstrutor = true; - for (TIntermSequence::iterator p = sequenceVector.begin(); p != sequenceVector.end(); p++, paramCount++) { if (type.isArray()) @@ -5206,21 +5264,13 @@ TIntermTyped* TParseContext::addConstructor(const TSourceLoc& loc, TIntermNode* else newNode = constructBuiltIn(type, op, (*p)->getAsTyped(), node->getLoc(), true); - if (newNode) { + if (newNode) *p = newNode; - if (! newNode->getType().getQualifier().isConstant()) - isConstConstrutor = false; - if (newNode->getType().getQualifier().isSpecConstant()) - hasSpecConst = true; - } else + else return nullptr; } - TIntermTyped* constructor = intermediate.setAggregateOperator(aggrNode, op, type, loc); - if (isConstConstrutor && hasSpecConst) - constructor->getWritableType().getQualifier().makeSpecConstant(); - - return constructor; + return intermediate.setAggregateOperator(aggrNode, op, type, loc); } // Function for constructor implementation. Calls addUnaryMath with appropriate EOp value diff --git a/glslang/MachineIndependent/localintermediate.h b/glslang/MachineIndependent/localintermediate.h index 17b7d21c..d60c59ed 100644 --- a/glslang/MachineIndependent/localintermediate.h +++ b/glslang/MachineIndependent/localintermediate.h @@ -346,7 +346,6 @@ protected: static int getBaseAlignmentScalar(const TType&, int& size); bool isSpecializationOperation(const TIntermOperator&) const; - const EShLanguage language; // stage, known at construction time EShSource source; // source language, known a bit later std::string entryPoint; diff --git a/gtests/Spv.FromFile.cpp b/gtests/Spv.FromFile.cpp index 04e204e3..054e293a 100644 --- a/gtests/Spv.FromFile.cpp +++ b/gtests/Spv.FromFile.cpp @@ -43,6 +43,7 @@ namespace { using CompileToSpirvTest = GlslangTest<::testing::TestWithParam>; using VulkanSemantics = GlslangTest<::testing::TestWithParam>; +using VulkanAstSemantics = GlslangTest<::testing::TestWithParam>; // Compiling GLSL to SPIR-V under Vulkan semantics. Expected to successfully // generate SPIR-V. @@ -62,6 +63,14 @@ TEST_P(VulkanSemantics, FromFile) Target::Spv); } +// GLSL-level Vulkan semantics test that need to see the AST for validation. +TEST_P(VulkanAstSemantics, FromFile) +{ + loadFileCompileAndCheck(GLSLANG_TEST_DIRECTORY, GetParam(), + Source::GLSL, Semantics::Vulkan, + Target::AST); +} + // clang-format off INSTANTIATE_TEST_CASE_P( Glsl, CompileToSpirvTest, @@ -187,6 +196,14 @@ INSTANTIATE_TEST_CASE_P( })), FileNameAsCustomTestSuffix ); + +INSTANTIATE_TEST_CASE_P( + Glsl, VulkanAstSemantics, + ::testing::ValuesIn(std::vector({ + "vulkan.ast.vert", + })), + FileNameAsCustomTestSuffix +); // clang-format on } // anonymous namespace diff --git a/gtests/TestFixture.cpp b/gtests/TestFixture.cpp index ca128174..2cf70707 100644 --- a/gtests/TestFixture.cpp +++ b/gtests/TestFixture.cpp @@ -94,7 +94,7 @@ EShMessages DeriveOptions(Source source, Semantics semantics, Target target) case Semantics::OpenGL: break; case Semantics::Vulkan: - result = static_cast(result | EShMsgVulkanRules); + result = static_cast(result | EShMsgVulkanRules | EShMsgSpvRules); break; } From 63d4794e8ef11a0ea0832b578c8c37da805c51cb Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Tue, 24 May 2016 13:15:01 +0200 Subject: [PATCH 120/140] Add test case: Link 2 ESSL fragment shader units --- Test/baseResults/es-link1.frag.out | 48 ++++++++++++++++++++++++++++++ Test/es-link1.frag | 8 +++++ Test/es-link2.frag | 8 +++++ Test/runtests | 1 + 4 files changed, 65 insertions(+) create mode 100644 Test/baseResults/es-link1.frag.out create mode 100644 Test/es-link1.frag create mode 100644 Test/es-link2.frag diff --git a/Test/baseResults/es-link1.frag.out b/Test/baseResults/es-link1.frag.out new file mode 100644 index 00000000..c033e210 --- /dev/null +++ b/Test/baseResults/es-link1.frag.out @@ -0,0 +1,48 @@ +es-link1.frag +Shader version: 100 +0:? Sequence +0:5 Function Definition: main( (global void) +0:5 Function Parameters: +0:7 Sequence +0:7 move second child to first child (temp mediump 4-component vector of float) +0:7 'gl_FragColor' (fragColor mediump 4-component vector of float FragColor) +0:7 Function Call: calculateColor( (global mediump 4-component vector of float) +0:? Linker Objects + +es-link2.frag +Shader version: 100 +0:? Sequence +0:5 Function Definition: calculateColor( (global mediump 4-component vector of float) +0:5 Function Parameters: +0:7 Sequence +0:7 Branch: Return with expression +0:7 vector-scale (temp mediump 4-component vector of float) +0:7 'varyingColor' (smooth in mediump 4-component vector of float) +0:7 Constant: +0:7 0.500000 +0:? Linker Objects +0:? 'varyingColor' (smooth in mediump 4-component vector of float) + + +Linked fragment stage: + + +Shader version: 100 +0:? Sequence +0:5 Function Definition: main( (global void) +0:5 Function Parameters: +0:7 Sequence +0:7 move second child to first child (temp mediump 4-component vector of float) +0:7 'gl_FragColor' (fragColor mediump 4-component vector of float FragColor) +0:7 Function Call: calculateColor( (global mediump 4-component vector of float) +0:5 Function Definition: calculateColor( (global mediump 4-component vector of float) +0:5 Function Parameters: +0:7 Sequence +0:7 Branch: Return with expression +0:7 vector-scale (temp mediump 4-component vector of float) +0:7 'varyingColor' (smooth in mediump 4-component vector of float) +0:7 Constant: +0:7 0.500000 +0:? Linker Objects +0:? 'varyingColor' (smooth in mediump 4-component vector of float) + diff --git a/Test/es-link1.frag b/Test/es-link1.frag new file mode 100644 index 00000000..fe4da41d --- /dev/null +++ b/Test/es-link1.frag @@ -0,0 +1,8 @@ +#version 100 + +mediump vec4 calculateColor(); + +void main() +{ + gl_FragColor = calculateColor(); +} diff --git a/Test/es-link2.frag b/Test/es-link2.frag new file mode 100644 index 00000000..e7b5a477 --- /dev/null +++ b/Test/es-link2.frag @@ -0,0 +1,8 @@ +#version 100 + +varying mediump vec4 varyingColor; + +mediump vec4 calculateColor() +{ + return varyingColor * 0.5; +} diff --git a/Test/runtests b/Test/runtests index 6e6524ab..d54fb580 100755 --- a/Test/runtests +++ b/Test/runtests @@ -96,6 +96,7 @@ function runBulkTest { runBulkTest mains1.frag mains2.frag noMain1.geom noMain2.geom runBulkTest noMain.vert mains.frag runBulkTest link1.frag link2.frag link3.frag +runBulkTest es-link1.frag es-link2.frag runBulkTest recurse1.vert recurse1.frag recurse2.frag runBulkTest 300link.frag runBulkTest 300link2.frag From b40a6d6b40a46c1206a9a309885a7e1fbbc1cf93 Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Tue, 24 May 2016 13:16:08 +0200 Subject: [PATCH 121/140] Use version/profile from first compilation stage When linking multiple compilation units per shader stage, the code creates a new intermediate, but fails to set its version and profile. This change makes it so that the new intermediate inherits the version and profile of the first compilation unit, so that two ES SL compilation units can be combined. --- glslang/MachineIndependent/ShaderLang.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/glslang/MachineIndependent/ShaderLang.cpp b/glslang/MachineIndependent/ShaderLang.cpp index 3a3bd58c..2c5a1ca7 100644 --- a/glslang/MachineIndependent/ShaderLang.cpp +++ b/glslang/MachineIndependent/ShaderLang.cpp @@ -1530,10 +1530,13 @@ bool TProgram::linkStage(EShLanguage stage, EShMessages messages) // Be efficient for the common single compilation unit per stage case, // reusing it's TIntermediate instead of merging into a new one. // + TIntermediate *firstIntermediate = stages[stage].front()->intermediate; if (stages[stage].size() == 1) - intermediate[stage] = stages[stage].front()->intermediate; + intermediate[stage] = firstIntermediate; else { - intermediate[stage] = new TIntermediate(stage); + intermediate[stage] = new TIntermediate(stage, + firstIntermediate->getVersion(), + firstIntermediate->getProfile()); newedIntermediate[stage] = true; } From 0bb546f8ae76a595fb08c288a0a868930f222d77 Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Tue, 24 May 2016 13:18:31 +0200 Subject: [PATCH 122/140] Fix test case for the "empty" linker test case The test result should only give one error about linking ES and non-ES shading language compilation units: - empty.frag: No version info, interpreted as 100, ES - empty2.frag: No version info, interpreted as 100, ES - empty3.frag: Version declared as 110, non-ES Previously, because the new intermediate is always created without version/profile information, there would be two linker errors: 1.) When merging the new intermediate with empty.frag 2.) When merging (new intermediate + empty.frag + empty2.frag) with empty3.frag Now, there is only one error; as the error with merging the new intermediate with empty.frag has been removed. --- Test/baseResults/empty.frag.out | 2 -- 1 file changed, 2 deletions(-) diff --git a/Test/baseResults/empty.frag.out b/Test/baseResults/empty.frag.out index d3c244a5..95db9ef8 100644 --- a/Test/baseResults/empty.frag.out +++ b/Test/baseResults/empty.frag.out @@ -18,8 +18,6 @@ Linked fragment stage: ERROR: Linking fragment stage: Cannot mix ES profile with non-ES profile shaders -ERROR: Linking fragment stage: Cannot mix ES profile with non-ES profile shaders - ERROR: Linking fragment stage: Missing entry point: Each stage requires one "void main()" entry point Shader version: 110 From 7bfd08d21c449c75d56022d0e9b7022d227aac47 Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Wed, 25 May 2016 09:26:43 +0200 Subject: [PATCH 123/140] Check for linking multiple ES shaders to the same stage --- Test/baseResults/empty.frag.out | 11 +- Test/baseResults/es-link1.frag.out | 23 +--- Test/baseResults/link1.frag.out | 133 +------------------- glslang/MachineIndependent/ShaderLang.cpp | 17 +++ glslang/MachineIndependent/linkValidate.cpp | 4 - gtests/Link.FromFile.cpp | 1 + 6 files changed, 21 insertions(+), 168 deletions(-) diff --git a/Test/baseResults/empty.frag.out b/Test/baseResults/empty.frag.out index 95db9ef8..be186bb9 100644 --- a/Test/baseResults/empty.frag.out +++ b/Test/baseResults/empty.frag.out @@ -13,14 +13,5 @@ Shader version: 110 0:? Sequence 0:? Linker Objects - -Linked fragment stage: - -ERROR: Linking fragment stage: Cannot mix ES profile with non-ES profile shaders - -ERROR: Linking fragment stage: Missing entry point: Each stage requires one "void main()" entry point - -Shader version: 110 -0:? Sequence -0:? Linker Objects +ERROR: Cannot mix ES profile with non-ES profile shaders diff --git a/Test/baseResults/es-link1.frag.out b/Test/baseResults/es-link1.frag.out index c033e210..41ce9a0f 100644 --- a/Test/baseResults/es-link1.frag.out +++ b/Test/baseResults/es-link1.frag.out @@ -23,26 +23,5 @@ Shader version: 100 0:? Linker Objects 0:? 'varyingColor' (smooth in mediump 4-component vector of float) - -Linked fragment stage: - - -Shader version: 100 -0:? Sequence -0:5 Function Definition: main( (global void) -0:5 Function Parameters: -0:7 Sequence -0:7 move second child to first child (temp mediump 4-component vector of float) -0:7 'gl_FragColor' (fragColor mediump 4-component vector of float FragColor) -0:7 Function Call: calculateColor( (global mediump 4-component vector of float) -0:5 Function Definition: calculateColor( (global mediump 4-component vector of float) -0:5 Function Parameters: -0:7 Sequence -0:7 Branch: Return with expression -0:7 vector-scale (temp mediump 4-component vector of float) -0:7 'varyingColor' (smooth in mediump 4-component vector of float) -0:7 Constant: -0:7 0.500000 -0:? Linker Objects -0:? 'varyingColor' (smooth in mediump 4-component vector of float) +ERROR: Cannot attach multiple ES shaders of the same type to a single program diff --git a/Test/baseResults/link1.frag.out b/Test/baseResults/link1.frag.out index bc6cf5c8..51d7475a 100644 --- a/Test/baseResults/link1.frag.out +++ b/Test/baseResults/link1.frag.out @@ -158,136 +158,5 @@ Requested GL_OES_texture_3D 0:? Linker Objects 0:? 'iv3' (smooth in highp 2-component vector of float) - -Linked fragment stage: - -ERROR: Linking fragment stage: Types must match: - glass: "uniform 3-component vector of float" versus "uniform 2-component vector of float" -ERROR: Linking fragment stage: Interpolation and auxiliary storage qualifiers must match: - cup: "smooth in 4-component vector of float" versus "flat in 4-component vector of float" -ERROR: Linking fragment stage: Initializers must match: - cv3e -ERROR: Linking fragment stage: Initializers must match: - um2e -ERROR: Linking fragment stage: Initializers must match: - se -ERROR: Linking fragment stage: Cannot mix ES profile with non-ES profile shaders - -ERROR: Linking fragment stage: Types must match: -ERROR: Linking fragment stage: Precision qualifiers must match: - iv3: "smooth in 3-component vector of float" versus "smooth in highp 2-component vector of float" - -Shader version: 300 -Requested GL_OES_EGL_image_external -Requested GL_OES_standard_derivatives -Requested GL_OES_texture_3D -0:? Sequence -0:8 Sequence -0:8 move second child to first child (temp 4-component vector of float) -0:8 'a' (global 4-component vector of float) -0:8 vector-scale (temp 4-component vector of float) -0:8 Constant: -0:8 8.000000 -0:8 'uv4' (uniform 4-component vector of float) -0:13 Function Definition: main( (global void) -0:13 Function Parameters: -0:17 Sequence -0:17 move second child to first child (temp 4-component vector of float) -0:17 'b' (global 4-component vector of float) -0:17 vector-scale (temp 4-component vector of float) -0:17 Constant: -0:17 8.000000 -0:17 'a' (global 4-component vector of float) -0:19 Function Definition: foo(mf22; (global 2-component vector of int) -0:19 Function Parameters: -0:19 'm' (in 2X2 matrix of float) -0:21 Sequence -0:21 Branch: Return with expression -0:21 Convert float to int (temp 2-component vector of int) -0:21 direct index (temp 2-component vector of float) -0:21 'm' (in 2X2 matrix of float) -0:21 Constant: -0:21 0 (const int) -0:24 Sequence -0:24 move second child to first child (temp 4-component vector of float) -0:24 'c' (global 4-component vector of float) -0:24 component-wise multiply (temp 4-component vector of float) -0:24 'b' (global 4-component vector of float) -0:24 'b' (global 4-component vector of float) -0:8 Sequence -0:8 move second child to first child (temp 4-component vector of float) -0:8 'd' (global 4-component vector of float) -0:8 vector-scale (temp 4-component vector of float) -0:8 Constant: -0:8 8.000000 -0:8 'uv4' (uniform 4-component vector of float) -0:13 Sequence -0:13 move second child to first child (temp 4-component vector of float) -0:13 'e' (global 4-component vector of float) -0:13 vector-scale (temp 4-component vector of float) -0:13 Constant: -0:13 8.000000 -0:13 'd' (global 4-component vector of float) -0:15 Function Definition: foo( (global 2-component vector of int) -0:15 Function Parameters: -0:17 Sequence -0:17 Branch: Return with expression -0:17 Constant: -0:17 2 (const int) -0:17 2 (const int) -0:20 Sequence -0:20 move second child to first child (temp 4-component vector of float) -0:20 'f' (global 4-component vector of float) -0:20 component-wise multiply (temp 4-component vector of float) -0:20 'e' (global 4-component vector of float) -0:20 'e' (global 4-component vector of float) -0:? Linker Objects -0:? 'uv4' (uniform 4-component vector of float) -0:? 'glass' (uniform 3-component vector of float) -0:? 'ci' (const int) -0:? 8 (const int) -0:? 'a' (global 4-component vector of float) -0:? 'iv3' (smooth in 3-component vector of float) -0:? 'cup' (smooth in 4-component vector of float) -0:? 'b' (global 4-component vector of float) -0:? 'c' (global 4-component vector of float) -0:? 'cv3' (const 3-component vector of float) -0:? 43.000000 -0:? 0.340000 -0:? 9.900000 -0:? 'cv3n' (const 3-component vector of float) -0:? 43.000000 -0:? 0.340000 -0:? 9.900000 -0:? 'cv3e' (const 3-component vector of float) -0:? 43.000000 -0:? 0.340000 -0:? 9.900000 -0:? 'um2' (uniform 2X2 matrix of float) -0:? 4.000000 -0:? 0.000000 -0:? 0.000000 -0:? 4.000000 -0:? 'um2n' (uniform 2X2 matrix of float) -0:? 4.000000 -0:? 0.000000 -0:? 0.000000 -0:? 4.000000 -0:? 'um2e' (uniform 2X2 matrix of float) -0:? 4.000000 -0:? 0.000000 -0:? 0.000000 -0:? 4.000000 -0:? 's' (uniform structure{global int a, global float b}) -0:? 82 (const int) -0:? 3.900000 -0:? 'sn' (uniform structure{global int a, global float b}) -0:? 82 (const int) -0:? 3.900000 -0:? 'se' (uniform structure{global int a, global float b}) -0:? 82 (const int) -0:? 3.900000 -0:? 'd' (global 4-component vector of float) -0:? 'e' (global 4-component vector of float) -0:? 'f' (global 4-component vector of float) +ERROR: Cannot mix ES profile with non-ES profile shaders diff --git a/glslang/MachineIndependent/ShaderLang.cpp b/glslang/MachineIndependent/ShaderLang.cpp index 2c5a1ca7..1446298c 100644 --- a/glslang/MachineIndependent/ShaderLang.cpp +++ b/glslang/MachineIndependent/ShaderLang.cpp @@ -1526,6 +1526,23 @@ bool TProgram::linkStage(EShLanguage stage, EShMessages messages) if (stages[stage].size() == 0) return true; + int numEsShaders = 0, numNonEsShaders = 0; + for (auto it = stages[stage].begin(); it != stages[stage].end(); ++it) { + if ((*it)->intermediate->getProfile() == EEsProfile) { + numEsShaders++; + } else { + numNonEsShaders++; + } + } + + if (numEsShaders > 0 && numNonEsShaders > 0) { + infoSink->info.message(EPrefixError, "Cannot mix ES profile with non-ES profile shaders"); + return false; + } else if (numEsShaders > 1) { + infoSink->info.message(EPrefixError, "Cannot attach multiple ES shaders of the same type to a single program"); + return false; + } + // // Be efficient for the common single compilation unit per stage case, // reusing it's TIntermediate instead of merging into a new one. diff --git a/glslang/MachineIndependent/linkValidate.cpp b/glslang/MachineIndependent/linkValidate.cpp index c48e7bff..1cda57d3 100644 --- a/glslang/MachineIndependent/linkValidate.cpp +++ b/glslang/MachineIndependent/linkValidate.cpp @@ -86,10 +86,6 @@ void TIntermediate::merge(TInfoSink& infoSink, TIntermediate& unit) numPushConstants += unit.numPushConstants; callGraph.insert(callGraph.end(), unit.callGraph.begin(), unit.callGraph.end()); - if ((profile != EEsProfile && unit.profile == EEsProfile) || - (profile == EEsProfile && unit.profile != EEsProfile)) - error(infoSink, "Cannot mix ES profile with non-ES profile shaders\n"); - if (originUpperLeft != unit.originUpperLeft || pixelCenterInteger != unit.pixelCenterInteger) error(infoSink, "gl_FragCoord redeclarations must match across shaders\n"); diff --git a/gtests/Link.FromFile.cpp b/gtests/Link.FromFile.cpp index 6db43d9c..331c5b27 100644 --- a/gtests/Link.FromFile.cpp +++ b/gtests/Link.FromFile.cpp @@ -99,6 +99,7 @@ INSTANTIATE_TEST_CASE_P( {"empty.frag", "empty2.frag", "empty3.frag"}, {"150.tesc", "150.tese", "400.tesc", "400.tese", "410.tesc", "420.tesc", "420.tese"}, {"max_vertices_0.geom"}, + {"es-link1.frag", "es-link2.frag"}, })), ); // clang-format on From 1e194e86130faadf37232221c03ad3511034b701 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Wed, 25 May 2016 13:08:34 -0700 Subject: [PATCH 124/140] Produce different names for files in debug builds on MSVC --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a3722bac..9af56b7c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,7 @@ set(CMAKE_INSTALL_PREFIX "install" CACHE STRING "prefix") project(glslang) if(WIN32) + set(CMAKE_DEBUG_POSTFIX "d") include(ChooseMSVCCRT.cmake) add_definitions(-DGLSLANG_OSINCLUDE_WIN32) elseif(UNIX) From 76d0ac1a6f6f84f54d9e04e378da7823d69b3cc1 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 25 May 2016 11:50:21 -0700 Subject: [PATCH 125/140] SPV: Don't shadow sampler parameters when performing function calls Fixes #179 --- SPIRV/GlslangToSpv.cpp | 15 ++++++++++----- Test/baseResults/spv.subpass.frag.out | 8 ++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 950f7bdd..d6ae9415 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -2652,12 +2652,13 @@ spv::Id TGlslangToSpvTraverser::handleUserFunctionCall(const glslang::TIntermAgg std::vector rValues; std::vector argTypes; for (int a = 0; a < (int)glslangArgs.size(); ++a) { + const glslang::TType& paramType = glslangArgs[a]->getAsTyped()->getType(); // build l-value builder.clearAccessChain(); glslangArgs[a]->traverse(this); - argTypes.push_back(&glslangArgs[a]->getAsTyped()->getType()); - // keep outputs as l-values, evaluate input-only as r-values - if (qualifiers[a] != glslang::EvqConstReadOnly) { + argTypes.push_back(¶mType); + // keep outputs as and samplers l-values, evaluate input-only as r-values + if (qualifiers[a] != glslang::EvqConstReadOnly || paramType.getBasicType() == glslang::EbtSampler) { // save l-value lValues.push_back(builder.getAccessChain()); } else { @@ -2674,10 +2675,14 @@ spv::Id TGlslangToSpvTraverser::handleUserFunctionCall(const glslang::TIntermAgg int rValueCount = 0; std::vector spvArgs; for (int a = 0; a < (int)glslangArgs.size(); ++a) { + const glslang::TType& paramType = glslangArgs[a]->getAsTyped()->getType(); spv::Id arg; - if (qualifiers[a] != glslang::EvqConstReadOnly) { + if (paramType.getBasicType() == glslang::EbtSampler) { + builder.setAccessChain(lValues[lValueCount]); + arg = builder.accessChainGetLValue(); + ++lValueCount; + } else if (qualifiers[a] != glslang::EvqConstReadOnly) { // need space to hold the copy - const glslang::TType& paramType = glslangArgs[a]->getAsTyped()->getType(); arg = builder.createVariable(spv::StorageClassFunction, convertGlslangToSpvType(paramType), "param"); if (qualifiers[a] == glslang::EvqIn || qualifiers[a] == glslang::EvqInOut) { // need to copy the input into output space diff --git a/Test/baseResults/spv.subpass.frag.out b/Test/baseResults/spv.subpass.frag.out index 6393f6f2..4b972aca 100644 --- a/Test/baseResults/spv.subpass.frag.out +++ b/Test/baseResults/spv.subpass.frag.out @@ -7,7 +7,7 @@ Linked fragment stage: // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 70 +// Id's are bound by 68 Capability Shader Capability InputAttachment @@ -28,7 +28,6 @@ Linked fragment stage: Name 54 "ucolor" Name 57 "usub" Name 62 "usubMS" - Name 67 "param" Decorate 30(sub) DescriptorSet 0 Decorate 30(sub) InputAttachmentIndex 1 Decorate 35(subMS) DescriptorSet 0 @@ -81,7 +80,6 @@ Linked fragment stage: 62(usubMS): 61(ptr) Variable UniformConstant 4(main): 2 Function None 3 5: Label - 67(param): 8(ptr) Variable Function 31: 28 Load 30(sub) 32: 25(fvec4) ImageRead 31 20 Store 27(color) 32 @@ -106,9 +104,7 @@ Linked fragment stage: 65: 52(ivec4) Load 54(ucolor) 66: 52(ivec4) IAdd 65 64 Store 54(ucolor) 66 - 68: 7 Load 46(isubMS) - Store 67(param) 68 - 69: 2 FunctionCall 11(foo(iIPM1;) 67(param) + 67: 2 FunctionCall 11(foo(iIPM1;) 46(isubMS) Return FunctionEnd 11(foo(iIPM1;): 2 Function None 9 From 0f5e3ad23cb69c46bfbeff9c61047e6ceccfa62e Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Sun, 29 May 2016 18:24:31 -0600 Subject: [PATCH 126/140] Fix issue #313: Catch internal attempts to modify built-in symbols that don't exist. Also beefed up support for running compute shaders is #version 420, but this work is only partially done. --- Test/420.comp | 7 +++++ Test/baseResults/420.comp.out | 32 ++++++++++++++++++++++ glslang/MachineIndependent/Initialize.cpp | 11 +++++++- glslang/MachineIndependent/ParseHelper.cpp | 20 ++++++++++++-- glslang/MachineIndependent/ShaderLang.cpp | 6 ++-- gtests/AST.FromFile.cpp | 1 + 6 files changed, 70 insertions(+), 7 deletions(-) create mode 100755 Test/420.comp create mode 100755 Test/baseResults/420.comp.out diff --git a/Test/420.comp b/Test/420.comp new file mode 100755 index 00000000..4e6885be --- /dev/null +++ b/Test/420.comp @@ -0,0 +1,7 @@ +#version 420 + +layout(local_size_x = 2) in; // ERROR, no compute + +#extension GL_ARB_compute_shader : enable + +layout(local_size_x = 2) in; diff --git a/Test/baseResults/420.comp.out b/Test/baseResults/420.comp.out new file mode 100755 index 00000000..c21df076 --- /dev/null +++ b/Test/baseResults/420.comp.out @@ -0,0 +1,32 @@ +420.comp +Warning, version 420 is not yet complete; most version-specific features are present, but some are missing. +ERROR: 0:3: 'gl_WorkgroupSize' : not supported for this version or the enabled extensions +WARNING: 0:5: '#extension' : extension is only partially supported: GL_ARB_compute_shader +ERROR: 1 compilation errors. No code generated. + + +Shader version: 420 +Requested GL_ARB_compute_shader +local_size = (2, 1, 1) +ERROR: node is still EOpNull! +0:? Linker Objects +0:? 'gl_WorkGroupSize' (const 3-component vector of uint WorkGroupSize) +0:? 2 (const uint) +0:? 1 (const uint) +0:? 1 (const uint) + + +Linked compute stage: + +ERROR: Linking compute stage: Missing entry point: Each stage requires one "void main()" entry point + +Shader version: 420 +Requested GL_ARB_compute_shader +local_size = (2, 1, 1) +ERROR: node is still EOpNull! +0:? Linker Objects +0:? 'gl_WorkGroupSize' (const 3-component vector of uint WorkGroupSize) +0:? 2 (const uint) +0:? 1 (const uint) +0:? 1 (const uint) + diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp index 034962a2..c4ffdf20 100644 --- a/glslang/MachineIndependent/Initialize.cpp +++ b/glslang/MachineIndependent/Initialize.cpp @@ -1871,7 +1871,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan) // //============================================================================ - if ((profile != EEsProfile && version >= 430) || + if ((profile != EEsProfile && version >= 420) || (profile == EEsProfile && version >= 310)) { stageBuiltins[EShLangCompute].append( "in highp uvec3 gl_NumWorkGroups;" @@ -3896,6 +3896,15 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, int spv, int vul BuiltInVariable("gl_LocalInvocationID", EbvLocalInvocationId, symbolTable); BuiltInVariable("gl_GlobalInvocationID", EbvGlobalInvocationId, symbolTable); BuiltInVariable("gl_LocalInvocationIndex", EbvLocalInvocationIndex, symbolTable); + + if (profile != EEsProfile && version < 430) { + symbolTable.setVariableExtensions("gl_NumWorkGroups", 1, &E_GL_ARB_compute_shader); + symbolTable.setVariableExtensions("gl_WorkGroupSize", 1, &E_GL_ARB_compute_shader); + symbolTable.setVariableExtensions("gl_WorkGroupID", 1, &E_GL_ARB_compute_shader); + symbolTable.setVariableExtensions("gl_LocalInvocationID", 1, &E_GL_ARB_compute_shader); + symbolTable.setVariableExtensions("gl_GlobalInvocationID", 1, &E_GL_ARB_compute_shader); + symbolTable.setVariableExtensions("gl_LocalInvocationIndex", 1, &E_GL_ARB_compute_shader); + } break; default: diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 15d0dae3..39344cf5 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -622,10 +622,20 @@ void TParseContext::makeEditable(TSymbol*& symbol) intermediate.addSymbolLinkageNode(linkage, *symbol); } +// Return a writable version of the variable 'name'. +// +// Return nullptr if 'name' is not found. This should mean +// something is seriously wrong (e.g., compiler asking self for +// built-in that doesn't exist). TVariable* TParseContext::getEditableVariable(const char* name) { bool builtIn; TSymbol* symbol = symbolTable.find(name, &builtIn); + + assert(symbol != nullptr); + if (symbol == nullptr) + return nullptr; + if (builtIn) makeEditable(symbol); @@ -3844,7 +3854,7 @@ void TParseContext::finalErrorCheck() break; case EShLangCompute: if (profile != EEsProfile && version < 430) - requireExtensions(getCurrentLoc(), 1, &E_GL_ARB_compute_shader, "tessellation shaders"); + requireExtensions(getCurrentLoc(), 1, &E_GL_ARB_compute_shader, "compute shaders"); break; default: break; @@ -4222,6 +4232,8 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi case EShLangCompute: if (id.compare(0, 11, "local_size_") == 0) { + profileRequires(loc, EEsProfile, 310, 0, "gl_WorkgroupSize"); + profileRequires(loc, ~EEsProfile, 430, E_GL_ARB_compute_shader, "gl_WorkgroupSize"); if (id == "local_size_x") { publicType.shaderQualifiers.localSize[0] = value; return; @@ -5967,7 +5979,8 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con // Fix the existing constant gl_WorkGroupSize with this new information. TVariable* workGroupSize = getEditableVariable("gl_WorkGroupSize"); - workGroupSize->getWritableConstArray()[i].setUConst(intermediate.getLocalSize(i)); + if (workGroupSize != nullptr) + workGroupSize->getWritableConstArray()[i].setUConst(intermediate.getLocalSize(i)); } } else error(loc, "can only apply to 'in'", "local_size", ""); @@ -5980,7 +5993,8 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con error(loc, "can only apply to 'in'", "local_size id", ""); // Set the workgroup built-in variable as a specialization constant TVariable* workGroupSize = getEditableVariable("gl_WorkGroupSize"); - workGroupSize->getWritableType().getQualifier().specConstant = true; + if (workGroupSize != nullptr) + workGroupSize->getWritableType().getQualifier().specConstant = true; } } if (publicType.shaderQualifiers.earlyFragmentTests) { diff --git a/glslang/MachineIndependent/ShaderLang.cpp b/glslang/MachineIndependent/ShaderLang.cpp index 1446298c..1abb5535 100644 --- a/glslang/MachineIndependent/ShaderLang.cpp +++ b/glslang/MachineIndependent/ShaderLang.cpp @@ -235,10 +235,10 @@ bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TS InitializeStageSymbolTable(*builtInParseables, version, profile, spv, vulkan, EShLangGeometry, infoSink, commonTable, symbolTables); // check for compute - if ((profile != EEsProfile && version >= 430) || + if ((profile != EEsProfile && version >= 420) || (profile == EEsProfile && version >= 310)) InitializeStageSymbolTable(*builtInParseables, version, profile, spv, vulkan, EShLangCompute, infoSink, commonTable, symbolTables); - + return true; } @@ -417,7 +417,7 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo (profile != EEsProfile && version < 420)) { correct = false; infoSink.info.message(EPrefixError, "#version: compute shaders require es profile with version 310 or above, or non-es profile with version 420 or above"); - version = profile == EEsProfile ? 310 : 430; // 420 supports the extension, correction is to 430 which does not + version = profile == EEsProfile ? 310 : 420; } break; default: diff --git a/gtests/AST.FromFile.cpp b/gtests/AST.FromFile.cpp index 3f4819a3..08ec919b 100644 --- a/gtests/AST.FromFile.cpp +++ b/gtests/AST.FromFile.cpp @@ -113,6 +113,7 @@ INSTANTIATE_TEST_CASE_P( "110scope.vert", "300scope.vert", "400.frag", + "420.comp", "420.frag", "420.vert", "420.geom", From d94c003fb7d2be208d0a80e1f2707f0553c8ed41 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Mon, 30 May 2016 19:29:40 -0600 Subject: [PATCH 127/140] Front-end: Complete GL_ARB_compute_shader implementation. Core compute shaders were working, but the extension wasn't implemented. --- SPIRV/GlslangToSpv.cpp | 2 +- Test/420.comp | 17 +++- Test/baseResults/420.comp.out | 94 +++++++++++++++++++--- glslang/MachineIndependent/Initialize.cpp | 10 ++- glslang/MachineIndependent/ParseHelper.cpp | 4 +- glslang/MachineIndependent/Versions.cpp | 2 +- glslang/MachineIndependent/glslang.y | 2 +- glslang/MachineIndependent/glslang_tab.cpp | 2 +- 8 files changed, 116 insertions(+), 17 deletions(-) diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index d6ae9415..5609769b 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -4042,7 +4042,7 @@ spv::Id TGlslangToSpvTraverser::createSpvConstant(const glslang::TIntermTyped& n // We now know we have a specialization constant to build - // gl_WorkgroupSize is a special case until the front-end handles hierarchical specialization constants, + // 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) { std::vector dimConstId; diff --git a/Test/420.comp b/Test/420.comp index 4e6885be..e8cee3c7 100755 --- a/Test/420.comp +++ b/Test/420.comp @@ -4,4 +4,19 @@ layout(local_size_x = 2) in; // ERROR, no compute #extension GL_ARB_compute_shader : enable -layout(local_size_x = 2) in; +layout(local_size_x = 2, local_size_y = 4, local_size_z = 6) in; + +shared vec3 sfoo; + +void main() +{ + sfoo = vec3(gl_WorkGroupSize.x, gl_WorkGroupSize.y, gl_WorkGroupSize.z); + sfoo += gl_WorkGroupSize + gl_NumWorkGroups + gl_WorkGroupID + gl_LocalInvocationID + gl_GlobalInvocationID; + sfoo *= gl_LocalInvocationIndex; + sfoo += gl_MaxComputeWorkGroupCount + gl_MaxComputeWorkGroupSize; + sfoo *= gl_MaxComputeUniformComponents + + gl_MaxComputeTextureImageUnits + + gl_MaxComputeImageUniforms + + gl_MaxComputeAtomicCounters + + gl_MaxComputeAtomicCounterBuffers; +} \ No newline at end of file diff --git a/Test/baseResults/420.comp.out b/Test/baseResults/420.comp.out index c21df076..719054df 100755 --- a/Test/baseResults/420.comp.out +++ b/Test/baseResults/420.comp.out @@ -1,32 +1,108 @@ 420.comp Warning, version 420 is not yet complete; most version-specific features are present, but some are missing. -ERROR: 0:3: 'gl_WorkgroupSize' : not supported for this version or the enabled extensions -WARNING: 0:5: '#extension' : extension is only partially supported: GL_ARB_compute_shader +ERROR: 0:3: 'gl_WorkGroupSize' : not supported for this version or the enabled extensions ERROR: 1 compilation errors. No code generated. Shader version: 420 Requested GL_ARB_compute_shader -local_size = (2, 1, 1) +local_size = (2, 4, 6) ERROR: node is still EOpNull! +0:11 Function Definition: main( (global void) +0:11 Function Parameters: +0:13 Sequence +0:13 move second child to first child (temp 3-component vector of float) +0:13 'sfoo' (shared 3-component vector of float) +0:13 Constant: +0:13 2.000000 +0:13 4.000000 +0:13 6.000000 +0:14 add second child into first child (temp 3-component vector of float) +0:14 'sfoo' (shared 3-component vector of float) +0:14 Convert uint to float (temp 3-component vector of float) +0:14 add (temp 3-component vector of uint) +0:14 add (temp 3-component vector of uint) +0:14 add (temp 3-component vector of uint) +0:14 add (temp 3-component vector of uint) +0:14 Constant: +0:14 2 (const uint) +0:14 4 (const uint) +0:14 6 (const uint) +0:14 'gl_NumWorkGroups' (in 3-component vector of uint NumWorkGroups) +0:14 'gl_WorkGroupID' (in 3-component vector of uint WorkGroupID) +0:14 'gl_LocalInvocationID' (in 3-component vector of uint LocalInvocationID) +0:14 'gl_GlobalInvocationID' (in 3-component vector of uint GlobalInvocationID) +0:15 vector scale second child into first child (temp 3-component vector of float) +0:15 'sfoo' (shared 3-component vector of float) +0:15 Convert uint to float (temp float) +0:15 'gl_LocalInvocationIndex' (in uint LocalInvocationIndex) +0:16 add second child into first child (temp 3-component vector of float) +0:16 'sfoo' (shared 3-component vector of float) +0:16 Constant: +0:16 66559.000000 +0:16 66559.000000 +0:16 65599.000000 +0:17 vector scale second child into first child (temp 3-component vector of float) +0:17 'sfoo' (shared 3-component vector of float) +0:17 Constant: +0:17 1057.000000 0:? Linker Objects 0:? 'gl_WorkGroupSize' (const 3-component vector of uint WorkGroupSize) 0:? 2 (const uint) -0:? 1 (const uint) -0:? 1 (const uint) +0:? 4 (const uint) +0:? 6 (const uint) +0:? 'sfoo' (shared 3-component vector of float) Linked compute stage: -ERROR: Linking compute stage: Missing entry point: Each stage requires one "void main()" entry point Shader version: 420 Requested GL_ARB_compute_shader -local_size = (2, 1, 1) +local_size = (2, 4, 6) ERROR: node is still EOpNull! +0:11 Function Definition: main( (global void) +0:11 Function Parameters: +0:13 Sequence +0:13 move second child to first child (temp 3-component vector of float) +0:13 'sfoo' (shared 3-component vector of float) +0:13 Constant: +0:13 2.000000 +0:13 4.000000 +0:13 6.000000 +0:14 add second child into first child (temp 3-component vector of float) +0:14 'sfoo' (shared 3-component vector of float) +0:14 Convert uint to float (temp 3-component vector of float) +0:14 add (temp 3-component vector of uint) +0:14 add (temp 3-component vector of uint) +0:14 add (temp 3-component vector of uint) +0:14 add (temp 3-component vector of uint) +0:14 Constant: +0:14 2 (const uint) +0:14 4 (const uint) +0:14 6 (const uint) +0:14 'gl_NumWorkGroups' (in 3-component vector of uint NumWorkGroups) +0:14 'gl_WorkGroupID' (in 3-component vector of uint WorkGroupID) +0:14 'gl_LocalInvocationID' (in 3-component vector of uint LocalInvocationID) +0:14 'gl_GlobalInvocationID' (in 3-component vector of uint GlobalInvocationID) +0:15 vector scale second child into first child (temp 3-component vector of float) +0:15 'sfoo' (shared 3-component vector of float) +0:15 Convert uint to float (temp float) +0:15 'gl_LocalInvocationIndex' (in uint LocalInvocationIndex) +0:16 add second child into first child (temp 3-component vector of float) +0:16 'sfoo' (shared 3-component vector of float) +0:16 Constant: +0:16 66559.000000 +0:16 66559.000000 +0:16 65599.000000 +0:17 vector scale second child into first child (temp 3-component vector of float) +0:17 'sfoo' (shared 3-component vector of float) +0:17 Constant: +0:17 1057.000000 0:? Linker Objects 0:? 'gl_WorkGroupSize' (const 3-component vector of uint WorkGroupSize) 0:? 2 (const uint) -0:? 1 (const uint) -0:? 1 (const uint) +0:? 4 (const uint) +0:? 6 (const uint) +0:? 'sfoo' (shared 3-component vector of float) diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp index c4ffdf20..35d7be13 100644 --- a/glslang/MachineIndependent/Initialize.cpp +++ b/glslang/MachineIndependent/Initialize.cpp @@ -3421,7 +3421,7 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf // compute - if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 430)) { + if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 420)) { snprintf(builtInConstant, maxSize, "const ivec3 gl_MaxComputeWorkGroupCount = ivec3(%d,%d,%d);", resources.maxComputeWorkGroupCountX, resources.maxComputeWorkGroupCountY, resources.maxComputeWorkGroupCountZ); @@ -3904,6 +3904,14 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, int spv, int vul symbolTable.setVariableExtensions("gl_LocalInvocationID", 1, &E_GL_ARB_compute_shader); symbolTable.setVariableExtensions("gl_GlobalInvocationID", 1, &E_GL_ARB_compute_shader); symbolTable.setVariableExtensions("gl_LocalInvocationIndex", 1, &E_GL_ARB_compute_shader); + + symbolTable.setVariableExtensions("gl_MaxComputeWorkGroupCount", 1, &E_GL_ARB_compute_shader); + symbolTable.setVariableExtensions("gl_MaxComputeWorkGroupSize", 1, &E_GL_ARB_compute_shader); + symbolTable.setVariableExtensions("gl_MaxComputeUniformComponents", 1, &E_GL_ARB_compute_shader); + symbolTable.setVariableExtensions("gl_MaxComputeTextureImageUnits", 1, &E_GL_ARB_compute_shader); + symbolTable.setVariableExtensions("gl_MaxComputeImageUniforms", 1, &E_GL_ARB_compute_shader); + symbolTable.setVariableExtensions("gl_MaxComputeAtomicCounters", 1, &E_GL_ARB_compute_shader); + symbolTable.setVariableExtensions("gl_MaxComputeAtomicCounterBuffers", 1, &E_GL_ARB_compute_shader); } break; diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 39344cf5..31a94d26 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -4232,8 +4232,8 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi case EShLangCompute: if (id.compare(0, 11, "local_size_") == 0) { - profileRequires(loc, EEsProfile, 310, 0, "gl_WorkgroupSize"); - profileRequires(loc, ~EEsProfile, 430, E_GL_ARB_compute_shader, "gl_WorkgroupSize"); + profileRequires(loc, EEsProfile, 310, 0, "gl_WorkGroupSize"); + profileRequires(loc, ~EEsProfile, 430, E_GL_ARB_compute_shader, "gl_WorkGroupSize"); if (id == "local_size_x") { publicType.shaderQualifiers.localSize[0] = value; return; diff --git a/glslang/MachineIndependent/Versions.cpp b/glslang/MachineIndependent/Versions.cpp index eeff270a..c1192071 100644 --- a/glslang/MachineIndependent/Versions.cpp +++ b/glslang/MachineIndependent/Versions.cpp @@ -162,7 +162,7 @@ void TParseVersions::initializeExtensionBehavior() extensionBehavior[E_GL_ARB_texture_gather] = EBhDisable; extensionBehavior[E_GL_ARB_gpu_shader5] = EBhDisablePartial; extensionBehavior[E_GL_ARB_separate_shader_objects] = EBhDisable; - extensionBehavior[E_GL_ARB_compute_shader] = EBhDisablePartial; + extensionBehavior[E_GL_ARB_compute_shader] = EBhDisable; extensionBehavior[E_GL_ARB_tessellation_shader] = EBhDisable; extensionBehavior[E_GL_ARB_enhanced_layouts] = EBhDisable; extensionBehavior[E_GL_ARB_texture_cube_map_array] = EBhDisable; diff --git a/glslang/MachineIndependent/glslang.y b/glslang/MachineIndependent/glslang.y index f4c7857c..4f8e3fc1 100644 --- a/glslang/MachineIndependent/glslang.y +++ b/glslang/MachineIndependent/glslang.y @@ -1208,7 +1208,7 @@ storage_qualifier $$.qualifier.storage = EvqBuffer; } | SHARED { - parseContext.profileRequires($1.loc, ECoreProfile | ECompatibilityProfile, 430, 0, "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, EShLangCompute, "shared"); $$.init($1.loc); diff --git a/glslang/MachineIndependent/glslang_tab.cpp b/glslang/MachineIndependent/glslang_tab.cpp index 9d632d8a..a284fda4 100644 --- a/glslang/MachineIndependent/glslang_tab.cpp +++ b/glslang/MachineIndependent/glslang_tab.cpp @@ -4737,7 +4737,7 @@ yyreduce: case 155: #line 1210 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, 430, 0, "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, EShLangCompute, "shared"); (yyval.interm.type).init((yyvsp[0].lex).loc); From 548c3adecd615d85bae2e94cdc367342ae4403bf Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Mon, 30 May 2016 19:38:39 -0600 Subject: [PATCH 128/140] Front-end: Complete GL_ARB_compute_shader, previous commit was missing new barriers. This amends the previous commit, which ommitted barriers in version 420 for compute shader. --- Test/420.comp | 8 ++++++++ Test/baseResults/420.comp.out | 14 ++++++++++++++ glslang/MachineIndependent/Initialize.cpp | 11 +++++++++-- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/Test/420.comp b/Test/420.comp index e8cee3c7..d92e6f0d 100755 --- a/Test/420.comp +++ b/Test/420.comp @@ -19,4 +19,12 @@ void main() gl_MaxComputeImageUniforms + gl_MaxComputeAtomicCounters + gl_MaxComputeAtomicCounterBuffers; + + barrier(); + memoryBarrier(); + memoryBarrierAtomicCounter(); + memoryBarrierBuffer(); + memoryBarrierImage(); + memoryBarrierShared(); + groupMemoryBarrier(); } \ No newline at end of file diff --git a/Test/baseResults/420.comp.out b/Test/baseResults/420.comp.out index 719054df..a2311d5a 100755 --- a/Test/baseResults/420.comp.out +++ b/Test/baseResults/420.comp.out @@ -46,6 +46,13 @@ ERROR: node is still EOpNull! 0:17 'sfoo' (shared 3-component vector of float) 0:17 Constant: 0:17 1057.000000 +0:23 Barrier (global void) +0:24 MemoryBarrier (global void) +0:25 MemoryBarrierAtomicCounter (global void) +0:26 MemoryBarrierBuffer (global void) +0:27 MemoryBarrierImage (global void) +0:28 MemoryBarrierShared (global void) +0:29 GroupMemoryBarrier (global void) 0:? Linker Objects 0:? 'gl_WorkGroupSize' (const 3-component vector of uint WorkGroupSize) 0:? 2 (const uint) @@ -99,6 +106,13 @@ ERROR: node is still EOpNull! 0:17 'sfoo' (shared 3-component vector of float) 0:17 Constant: 0:17 1057.000000 +0:23 Barrier (global void) +0:24 MemoryBarrier (global void) +0:25 MemoryBarrierAtomicCounter (global void) +0:26 MemoryBarrierBuffer (global void) +0:27 MemoryBarrierImage (global void) +0:28 MemoryBarrierShared (global void) +0:29 GroupMemoryBarrier (global void) 0:? Linker Objects 0:? 'gl_WorkGroupSize' (const 3-component vector of uint WorkGroupSize) 0:? 2 (const uint) diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp index 35d7be13..6a9fb201 100644 --- a/glslang/MachineIndependent/Initialize.cpp +++ b/glslang/MachineIndependent/Initialize.cpp @@ -1572,7 +1572,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan) stageBuiltins[EShLangTessControl].append( "void barrier();" ); - if ((profile != EEsProfile && version >= 430) || esBarrier) + if ((profile != EEsProfile && version >= 420) || esBarrier) stageBuiltins[EShLangCompute].append( "void barrier();" ); @@ -1580,7 +1580,7 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan) commonBuiltins.append( "void memoryBarrier();" ); - if ((profile != EEsProfile && version >= 430) || esBarrier) { + if ((profile != EEsProfile && version >= 420) || esBarrier) { commonBuiltins.append( "void memoryBarrierAtomicCounter();" "void memoryBarrierBuffer();" @@ -3912,6 +3912,13 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, int spv, int vul symbolTable.setVariableExtensions("gl_MaxComputeImageUniforms", 1, &E_GL_ARB_compute_shader); symbolTable.setVariableExtensions("gl_MaxComputeAtomicCounters", 1, &E_GL_ARB_compute_shader); symbolTable.setVariableExtensions("gl_MaxComputeAtomicCounterBuffers", 1, &E_GL_ARB_compute_shader); + + symbolTable.setFunctionExtensions("barrier", 1, &E_GL_ARB_compute_shader); + symbolTable.setFunctionExtensions("memoryBarrierAtomicCounter", 1, &E_GL_ARB_compute_shader); + symbolTable.setFunctionExtensions("memoryBarrierBuffer", 1, &E_GL_ARB_compute_shader); + symbolTable.setFunctionExtensions("memoryBarrierImage", 1, &E_GL_ARB_compute_shader); + symbolTable.setFunctionExtensions("memoryBarrierShared", 1, &E_GL_ARB_compute_shader); + symbolTable.setFunctionExtensions("groupMemoryBarrier", 1, &E_GL_ARB_compute_shader); } break; From af7f1c8f24df636a06cd9e78c767d6df77d3945b Mon Sep 17 00:00:00 2001 From: iostrows Date: Wed, 1 Jun 2016 16:40:00 +0200 Subject: [PATCH 129/140] Fix double matrix creation --- SPIRV/SpvBuilder.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/SPIRV/SpvBuilder.cpp b/SPIRV/SpvBuilder.cpp index a08e5488..152a4639 100644 --- a/SPIRV/SpvBuilder.cpp +++ b/SPIRV/SpvBuilder.cpp @@ -1830,6 +1830,9 @@ Id Builder::createMatrixConstructor(Decoration precision, const std::vector& int numCols = getTypeNumColumns(resultTypeId); int numRows = getTypeNumRows(resultTypeId); + Instruction* instr = module.getInstruction(componentTypeId); + Id bitCount = instr->getIdOperand(0); + // Will use a two step process // 1. make a compile-time 2D array of values // 2. construct a matrix from that array @@ -1838,8 +1841,8 @@ Id Builder::createMatrixConstructor(Decoration precision, const std::vector& // initialize the array to the identity matrix Id ids[maxMatrixSize][maxMatrixSize]; - Id one = makeFloatConstant(1.0); - Id zero = makeFloatConstant(0.0); + Id one = (bitCount == 64 ? makeDoubleConstant(1.0) : makeFloatConstant(1.0)); + Id zero = (bitCount == 64 ? makeDoubleConstant(0.0) : makeFloatConstant(0.0)); for (int col = 0; col < 4; ++col) { for (int row = 0; row < 4; ++row) { if (col == row) From b37dc0e4584301f60a3efc026d34877071028c9d Mon Sep 17 00:00:00 2001 From: David Neto Date: Thu, 2 Jun 2016 14:37:24 -0400 Subject: [PATCH 130/140] For MinGW, statically link exes against basic runtimes Avoids the need to ship basic runtimes like libgcc_s_sjlj-1.dll with the executables. --- CMakeLists.txt | 11 +++++++++++ StandAlone/CMakeLists.txt | 2 ++ gtests/CMakeLists.txt | 1 + 3 files changed, 14 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9af56b7c..f2f23559 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,17 @@ elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") add_definitions(-std=c++11) endif() +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. + if(WIN32) + if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU") + set_target_properties(${TARGET} PROPERTIES + LINK_FLAGS "-static -static-libgcc -static-libstdc++") + endif() + endif(WIN32) +endfunction(glslang_set_link_args) + # We depend on these for later projects, so they should come first. add_subdirectory(External) diff --git a/StandAlone/CMakeLists.txt b/StandAlone/CMakeLists.txt index e2e884a5..d69351ef 100644 --- a/StandAlone/CMakeLists.txt +++ b/StandAlone/CMakeLists.txt @@ -15,6 +15,8 @@ add_executable(glslangValidator ${SOURCES}) add_executable(spirv-remap ${REMAPPER_SOURCES}) set_property(TARGET glslangValidator PROPERTY FOLDER tools) set_property(TARGET spirv-remap PROPERTY FOLDER tools) +glslang_set_link_args(glslangValidator) +glslang_set_link_args(spirv-remap) set(LIBRARIES glslang diff --git a/gtests/CMakeLists.txt b/gtests/CMakeLists.txt index dae0df3c..4aafd11f 100644 --- a/gtests/CMakeLists.txt +++ b/gtests/CMakeLists.txt @@ -22,6 +22,7 @@ if (TARGET gmock) add_executable(glslangtests ${TEST_SOURCES}) set_property(TARGET glslangtests PROPERTY FOLDER tests) + glslang_set_link_args(glslangtests) install(TARGETS glslangtests RUNTIME DESTINATION bin) From a5c33d6ffb34ccede5b233bc724c907166b6e479 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Thu, 2 Jun 2016 23:45:21 -0600 Subject: [PATCH 131/140] SPV: Fix issue #320: Fetch needs to extract the image. GLSL takes a traditional sampler, but SPIR-V wants just the sampled image, not the combined sampler and image. --- SPIRV/GlslangToSpv.cpp | 7 + Test/baseResults/spv.newTexture.frag.out | 490 +++++++------- Test/baseResults/spv.sparseTexture.frag.out | 693 ++++++++++---------- Test/baseResults/spv.texture.frag.out | 183 +++--- 4 files changed, 695 insertions(+), 678 deletions(-) diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 5609769b..cfbee00f 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -2558,6 +2558,13 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO bias = true; } + // See if the sampler param should really be just the SPV image part + if (cracked.fetch) { + // a fetch needs to have the image extracted first + if (builder.isSampledImage(params.sampler)) + params.sampler = builder.createUnaryOp(spv::OpImage, builder.getImageType(params.sampler), params.sampler); + } + // set the rest of the arguments params.coords = arguments[1]; diff --git a/Test/baseResults/spv.newTexture.frag.out b/Test/baseResults/spv.newTexture.frag.out index 1c99ac01..4390e26d 100755 --- a/Test/baseResults/spv.newTexture.frag.out +++ b/Test/baseResults/spv.newTexture.frag.out @@ -7,7 +7,7 @@ Linked fragment stage: // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 278 +// Id's are bound by 282 Capability Shader Capability SampledRect @@ -15,7 +15,7 @@ Linked fragment stage: Capability ImageQuery 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 17 26 29 55 81 84 91 247 277 + EntryPoint Fragment 4 "main" 17 26 29 55 81 84 92 251 281 ExecutionMode 4 OriginUpperLeft Source GLSL 430 Name 4 "main" @@ -31,24 +31,24 @@ Linked fragment stage: Name 64 "s2DShadow" Name 81 "ic3D" Name 84 "ic1D" - Name 91 "ic2D" - Name 100 "sr" - Name 125 "sCube" - Name 136 "s2DArrayShadow" - Name 164 "iv" - Name 168 "is2D" - Name 203 "is3D" - Name 215 "isCube" - Name 227 "is2DArray" - Name 237 "iv2" - Name 241 "sCubeShadow" - Name 247 "FragData" - Name 259 "is2Dms" - Name 263 "us2D" - Name 267 "us3D" - Name 271 "usCube" - Name 275 "us2DArray" - Name 277 "ic4D" + Name 92 "ic2D" + Name 102 "sr" + Name 128 "sCube" + Name 139 "s2DArrayShadow" + Name 167 "iv" + Name 171 "is2D" + Name 206 "is3D" + Name 218 "isCube" + Name 230 "is2DArray" + Name 241 "iv2" + Name 245 "sCubeShadow" + Name 251 "FragData" + Name 263 "is2Dms" + Name 267 "us2D" + Name 271 "us3D" + Name 275 "usCube" + Name 279 "us2DArray" + Name 281 "ic4D" Decorate 13(s2D) DescriptorSet 0 Decorate 23(sCubeArrayShadow) DescriptorSet 0 Decorate 42(s3D) DescriptorSet 0 @@ -56,21 +56,21 @@ Linked fragment stage: Decorate 64(s2DShadow) DescriptorSet 0 Decorate 81(ic3D) Flat Decorate 84(ic1D) Flat - Decorate 91(ic2D) Flat - Decorate 100(sr) DescriptorSet 0 - Decorate 125(sCube) DescriptorSet 0 - Decorate 136(s2DArrayShadow) DescriptorSet 0 - Decorate 168(is2D) DescriptorSet 0 - Decorate 203(is3D) DescriptorSet 0 - Decorate 215(isCube) DescriptorSet 0 - Decorate 227(is2DArray) DescriptorSet 0 - Decorate 241(sCubeShadow) DescriptorSet 0 - Decorate 259(is2Dms) DescriptorSet 0 - Decorate 263(us2D) DescriptorSet 0 - Decorate 267(us3D) DescriptorSet 0 - Decorate 271(usCube) DescriptorSet 0 - Decorate 275(us2DArray) DescriptorSet 0 - Decorate 277(ic4D) Flat + Decorate 92(ic2D) Flat + Decorate 102(sr) DescriptorSet 0 + Decorate 128(sCube) DescriptorSet 0 + Decorate 139(s2DArrayShadow) DescriptorSet 0 + Decorate 171(is2D) DescriptorSet 0 + Decorate 206(is3D) DescriptorSet 0 + Decorate 218(isCube) DescriptorSet 0 + Decorate 230(is2DArray) DescriptorSet 0 + Decorate 245(sCubeShadow) DescriptorSet 0 + Decorate 263(is2Dms) DescriptorSet 0 + Decorate 267(us2D) DescriptorSet 0 + Decorate 271(us3D) DescriptorSet 0 + Decorate 275(usCube) DescriptorSet 0 + Decorate 279(us2DArray) DescriptorSet 0 + Decorate 281(ic4D) Flat 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -119,78 +119,78 @@ Linked fragment stage: 81(ic3D): 80(ptr) Variable Input 83: TypePointer Input 67(int) 84(ic1D): 83(ptr) Variable Input - 90: TypePointer Input 68(ivec2) - 91(ic2D): 90(ptr) Variable Input - 93: 67(int) Constant 4 - 97: TypeImage 6(float) Rect sampled format:Unknown - 98: TypeSampledImage 97 - 99: TypePointer UniformConstant 98 - 100(sr): 99(ptr) Variable UniformConstant - 103: 68(ivec2) ConstantComposite 93 93 - 122: TypeImage 6(float) Cube sampled format:Unknown - 123: TypeSampledImage 122 - 124: TypePointer UniformConstant 123 - 125(sCube): 124(ptr) Variable UniformConstant - 133: TypeImage 6(float) 2D depth array sampled format:Unknown - 134: TypeSampledImage 133 - 135: TypePointer UniformConstant 134 -136(s2DArrayShadow): 135(ptr) Variable UniformConstant - 143: 32(int) Constant 0 - 162: TypeVector 67(int) 4 - 163: TypePointer Function 162(ivec4) - 165: TypeImage 67(int) 2D sampled format:Unknown - 166: TypeSampledImage 165 - 167: TypePointer UniformConstant 166 - 168(is2D): 167(ptr) Variable UniformConstant - 200: TypeImage 67(int) 3D sampled format:Unknown - 201: TypeSampledImage 200 - 202: TypePointer UniformConstant 201 - 203(is3D): 202(ptr) Variable UniformConstant - 206: 6(float) Constant 1082549862 - 212: TypeImage 67(int) Cube sampled format:Unknown - 213: TypeSampledImage 212 - 214: TypePointer UniformConstant 213 - 215(isCube): 214(ptr) Variable UniformConstant - 224: TypeImage 67(int) 2D array sampled format:Unknown - 225: TypeSampledImage 224 - 226: TypePointer UniformConstant 225 - 227(is2DArray): 226(ptr) Variable UniformConstant - 236: TypePointer Function 68(ivec2) - 238: TypeImage 6(float) Cube depth sampled format:Unknown - 239: TypeSampledImage 238 - 240: TypePointer UniformConstant 239 -241(sCubeShadow): 240(ptr) Variable UniformConstant - 243: 67(int) Constant 2 - 246: TypePointer Output 7(fvec4) - 247(FragData): 246(ptr) Variable Output - 251: 6(float) Constant 0 - 256: TypeImage 67(int) 2D multi-sampled sampled format:Unknown - 257: TypeSampledImage 256 - 258: TypePointer UniformConstant 257 - 259(is2Dms): 258(ptr) Variable UniformConstant - 260: TypeImage 32(int) 2D sampled format:Unknown + 91: TypePointer Input 68(ivec2) + 92(ic2D): 91(ptr) Variable Input + 94: 67(int) Constant 4 + 99: TypeImage 6(float) Rect sampled format:Unknown + 100: TypeSampledImage 99 + 101: TypePointer UniformConstant 100 + 102(sr): 101(ptr) Variable UniformConstant + 105: 68(ivec2) ConstantComposite 94 94 + 125: TypeImage 6(float) Cube sampled format:Unknown + 126: TypeSampledImage 125 + 127: TypePointer UniformConstant 126 + 128(sCube): 127(ptr) Variable UniformConstant + 136: TypeImage 6(float) 2D depth array sampled format:Unknown + 137: TypeSampledImage 136 + 138: TypePointer UniformConstant 137 +139(s2DArrayShadow): 138(ptr) Variable UniformConstant + 146: 32(int) Constant 0 + 165: TypeVector 67(int) 4 + 166: TypePointer Function 165(ivec4) + 168: TypeImage 67(int) 2D sampled format:Unknown + 169: TypeSampledImage 168 + 170: TypePointer UniformConstant 169 + 171(is2D): 170(ptr) Variable UniformConstant + 203: TypeImage 67(int) 3D sampled format:Unknown + 204: TypeSampledImage 203 + 205: TypePointer UniformConstant 204 + 206(is3D): 205(ptr) Variable UniformConstant + 209: 6(float) Constant 1082549862 + 215: TypeImage 67(int) Cube sampled format:Unknown + 216: TypeSampledImage 215 + 217: TypePointer UniformConstant 216 + 218(isCube): 217(ptr) Variable UniformConstant + 227: TypeImage 67(int) 2D array sampled format:Unknown + 228: TypeSampledImage 227 + 229: TypePointer UniformConstant 228 + 230(is2DArray): 229(ptr) Variable UniformConstant + 240: TypePointer Function 68(ivec2) + 242: TypeImage 6(float) Cube depth sampled format:Unknown + 243: TypeSampledImage 242 + 244: TypePointer UniformConstant 243 +245(sCubeShadow): 244(ptr) Variable UniformConstant + 247: 67(int) Constant 2 + 250: TypePointer Output 7(fvec4) + 251(FragData): 250(ptr) Variable Output + 255: 6(float) Constant 0 + 260: TypeImage 67(int) 2D multi-sampled sampled format:Unknown 261: TypeSampledImage 260 262: TypePointer UniformConstant 261 - 263(us2D): 262(ptr) Variable UniformConstant - 264: TypeImage 32(int) 3D sampled format:Unknown + 263(is2Dms): 262(ptr) Variable UniformConstant + 264: TypeImage 32(int) 2D sampled format:Unknown 265: TypeSampledImage 264 266: TypePointer UniformConstant 265 - 267(us3D): 266(ptr) Variable UniformConstant - 268: TypeImage 32(int) Cube sampled format:Unknown + 267(us2D): 266(ptr) Variable UniformConstant + 268: TypeImage 32(int) 3D sampled format:Unknown 269: TypeSampledImage 268 270: TypePointer UniformConstant 269 - 271(usCube): 270(ptr) Variable UniformConstant - 272: TypeImage 32(int) 2D array sampled format:Unknown + 271(us3D): 270(ptr) Variable UniformConstant + 272: TypeImage 32(int) Cube sampled format:Unknown 273: TypeSampledImage 272 274: TypePointer UniformConstant 273 - 275(us2DArray): 274(ptr) Variable UniformConstant - 276: TypePointer Input 162(ivec4) - 277(ic4D): 276(ptr) Variable Input + 275(usCube): 274(ptr) Variable UniformConstant + 276: TypeImage 32(int) 2D array sampled format:Unknown + 277: TypeSampledImage 276 + 278: TypePointer UniformConstant 277 + 279(us2DArray): 278(ptr) Variable UniformConstant + 280: TypePointer Input 165(ivec4) + 281(ic4D): 280(ptr) Variable Input 4(main): 2 Function None 3 5: Label 9(v): 8(ptr) Variable Function - 164(iv): 163(ptr) Variable Function - 237(iv2): 236(ptr) Variable Function + 167(iv): 166(ptr) Variable Function + 241(iv2): 240(ptr) Variable Function 14: 11 Load 13(s2D) 18: 15(fvec2) Load 17(c2D) 19: 7(fvec4) ImageSampleImplicitLod 14 18 @@ -229,153 +229,157 @@ Linked fragment stage: 78: 40 Load 42(s3D) 82: 79(ivec3) Load 81(ic3D) 85: 67(int) Load 84(ic1D) - 86: 7(fvec4) ImageFetch 78 82 Lod 85 - 87: 7(fvec4) Load 9(v) - 88: 7(fvec4) FAdd 87 86 - Store 9(v) 88 - 89: 11 Load 13(s2D) - 92: 68(ivec2) Load 91(ic2D) - 94: 7(fvec4) ImageFetch 89 92 Lod ConstOffset 93 70 - 95: 7(fvec4) Load 9(v) - 96: 7(fvec4) FAdd 95 94 - Store 9(v) 96 - 101: 98 Load 100(sr) - 102: 68(ivec2) Load 91(ic2D) - 104: 7(fvec4) ImageFetch 101 102 ConstOffset 103 - 105: 7(fvec4) Load 9(v) - 106: 7(fvec4) FAdd 105 104 - Store 9(v) 106 - 107: 62 Load 64(s2DShadow) - 108: 53(fvec3) Load 55(c3D) - 109: 6(float) Load 29(c1D) - 110: 6(float) CompositeExtract 108 2 - 111: 6(float) ImageSampleDrefExplicitLod 107 108 110 Lod ConstOffset 109 70 - 112: 34(ptr) AccessChain 9(v) 33 - 113: 6(float) Load 112 - 114: 6(float) FAdd 113 111 + 86: 39 Image 78 + 87: 7(fvec4) ImageFetch 86 82 Lod 85 + 88: 7(fvec4) Load 9(v) + 89: 7(fvec4) FAdd 88 87 + Store 9(v) 89 + 90: 11 Load 13(s2D) + 93: 68(ivec2) Load 92(ic2D) + 95: 10 Image 90 + 96: 7(fvec4) ImageFetch 95 93 Lod ConstOffset 94 70 + 97: 7(fvec4) Load 9(v) + 98: 7(fvec4) FAdd 97 96 + Store 9(v) 98 + 103: 100 Load 102(sr) + 104: 68(ivec2) Load 92(ic2D) + 106: 99 Image 103 + 107: 7(fvec4) ImageFetch 106 104 ConstOffset 105 + 108: 7(fvec4) Load 9(v) + 109: 7(fvec4) FAdd 108 107 + Store 9(v) 109 + 110: 62 Load 64(s2DShadow) + 111: 53(fvec3) Load 55(c3D) + 112: 6(float) Load 29(c1D) + 113: 6(float) CompositeExtract 111 2 + 114: 6(float) ImageSampleDrefExplicitLod 110 111 113 Lod ConstOffset 112 70 115: 34(ptr) AccessChain 9(v) 33 - Store 115 114 - 116: 11 Load 13(s2D) - 117: 53(fvec3) Load 55(c3D) - 118: 6(float) Load 29(c1D) - 119: 7(fvec4) ImageSampleProjExplicitLod 116 117 Lod ConstOffset 118 70 - 120: 7(fvec4) Load 9(v) - 121: 7(fvec4) FAdd 120 119 - Store 9(v) 121 - 126: 123 Load 125(sCube) - 127: 53(fvec3) Load 55(c3D) - 128: 53(fvec3) Load 55(c3D) - 129: 53(fvec3) Load 55(c3D) - 130: 7(fvec4) ImageSampleExplicitLod 126 127 Grad 128 129 - 131: 7(fvec4) Load 9(v) - 132: 7(fvec4) FAdd 131 130 - Store 9(v) 132 - 137: 134 Load 136(s2DArrayShadow) - 138: 7(fvec4) Load 26(c4D) - 139: 15(fvec2) Load 17(c2D) - 140: 15(fvec2) Load 17(c2D) - 141: 6(float) CompositeExtract 138 3 - 142: 6(float) ImageSampleDrefExplicitLod 137 138 141 Grad ConstOffset 139 140 70 - 144: 34(ptr) AccessChain 9(v) 143 - 145: 6(float) Load 144 - 146: 6(float) FAdd 145 142 - 147: 34(ptr) AccessChain 9(v) 143 - Store 147 146 - 148: 40 Load 42(s3D) - 149: 7(fvec4) Load 26(c4D) - 150: 53(fvec3) Load 55(c3D) - 151: 53(fvec3) Load 55(c3D) - 152: 7(fvec4) ImageSampleProjExplicitLod 148 149 Grad 150 151 - 153: 7(fvec4) Load 9(v) - 154: 7(fvec4) FAdd 153 152 - Store 9(v) 154 - 155: 11 Load 13(s2D) - 156: 53(fvec3) Load 55(c3D) - 157: 15(fvec2) Load 17(c2D) - 158: 15(fvec2) Load 17(c2D) - 159: 7(fvec4) ImageSampleProjExplicitLod 155 156 Grad ConstOffset 157 158 70 - 160: 7(fvec4) Load 9(v) - 161: 7(fvec4) FAdd 160 159 - Store 9(v) 161 - 169: 166 Load 168(is2D) - 170: 15(fvec2) Load 17(c2D) - 171: 162(ivec4) ImageSampleImplicitLod 169 170 - Store 164(iv) 171 - 172: 162(ivec4) Load 164(iv) - 173: 7(fvec4) ConvertSToF 172 - 174: 7(fvec4) Load 9(v) - 175: 7(fvec4) FAdd 174 173 - Store 9(v) 175 - 176: 166 Load 168(is2D) - 177: 7(fvec4) Load 26(c4D) - 178: 162(ivec4) ImageSampleProjImplicitLod 176 177 ConstOffset 70 - Store 164(iv) 178 - 179: 162(ivec4) Load 164(iv) - 180: 7(fvec4) ConvertSToF 179 - 181: 7(fvec4) Load 9(v) - 182: 7(fvec4) FAdd 181 180 - Store 9(v) 182 - 183: 166 Load 168(is2D) - 184: 53(fvec3) Load 55(c3D) - 185: 6(float) Load 29(c1D) - 186: 162(ivec4) ImageSampleProjExplicitLod 183 184 Lod 185 - Store 164(iv) 186 - 187: 162(ivec4) Load 164(iv) - 188: 7(fvec4) ConvertSToF 187 - 189: 7(fvec4) Load 9(v) - 190: 7(fvec4) FAdd 189 188 - Store 9(v) 190 - 191: 166 Load 168(is2D) - 192: 53(fvec3) Load 55(c3D) - 193: 15(fvec2) Load 17(c2D) - 194: 15(fvec2) Load 17(c2D) - 195: 162(ivec4) ImageSampleProjExplicitLod 191 192 Grad 193 194 - Store 164(iv) 195 - 196: 162(ivec4) Load 164(iv) - 197: 7(fvec4) ConvertSToF 196 - 198: 7(fvec4) Load 9(v) - 199: 7(fvec4) FAdd 198 197 - Store 9(v) 199 - 204: 201 Load 203(is3D) - 205: 53(fvec3) Load 55(c3D) - 207: 162(ivec4) ImageSampleImplicitLod 204 205 Bias 206 - Store 164(iv) 207 - 208: 162(ivec4) Load 164(iv) - 209: 7(fvec4) ConvertSToF 208 - 210: 7(fvec4) Load 9(v) - 211: 7(fvec4) FAdd 210 209 - Store 9(v) 211 - 216: 213 Load 215(isCube) - 217: 53(fvec3) Load 55(c3D) - 218: 6(float) Load 29(c1D) - 219: 162(ivec4) ImageSampleExplicitLod 216 217 Lod 218 - Store 164(iv) 219 - 220: 162(ivec4) Load 164(iv) - 221: 7(fvec4) ConvertSToF 220 - 222: 7(fvec4) Load 9(v) - 223: 7(fvec4) FAdd 222 221 - Store 9(v) 223 - 228: 225 Load 227(is2DArray) - 229: 79(ivec3) Load 81(ic3D) - 230: 67(int) Load 84(ic1D) - 231: 162(ivec4) ImageFetch 228 229 Lod 230 - Store 164(iv) 231 - 232: 162(ivec4) Load 164(iv) - 233: 7(fvec4) ConvertSToF 232 - 234: 7(fvec4) Load 9(v) - 235: 7(fvec4) FAdd 234 233 - Store 9(v) 235 - 242: 239 Load 241(sCubeShadow) - 244: 238 Image 242 - 245: 68(ivec2) ImageQuerySizeLod 244 243 - Store 237(iv2) 245 - 248: 7(fvec4) Load 9(v) - 249: 68(ivec2) Load 237(iv2) - 250: 15(fvec2) ConvertSToF 249 - 252: 6(float) CompositeExtract 250 0 - 253: 6(float) CompositeExtract 250 1 - 254: 7(fvec4) CompositeConstruct 252 253 251 251 - 255: 7(fvec4) FAdd 248 254 - Store 247(FragData) 255 + 116: 6(float) Load 115 + 117: 6(float) FAdd 116 114 + 118: 34(ptr) AccessChain 9(v) 33 + Store 118 117 + 119: 11 Load 13(s2D) + 120: 53(fvec3) Load 55(c3D) + 121: 6(float) Load 29(c1D) + 122: 7(fvec4) ImageSampleProjExplicitLod 119 120 Lod ConstOffset 121 70 + 123: 7(fvec4) Load 9(v) + 124: 7(fvec4) FAdd 123 122 + Store 9(v) 124 + 129: 126 Load 128(sCube) + 130: 53(fvec3) Load 55(c3D) + 131: 53(fvec3) Load 55(c3D) + 132: 53(fvec3) Load 55(c3D) + 133: 7(fvec4) ImageSampleExplicitLod 129 130 Grad 131 132 + 134: 7(fvec4) Load 9(v) + 135: 7(fvec4) FAdd 134 133 + Store 9(v) 135 + 140: 137 Load 139(s2DArrayShadow) + 141: 7(fvec4) Load 26(c4D) + 142: 15(fvec2) Load 17(c2D) + 143: 15(fvec2) Load 17(c2D) + 144: 6(float) CompositeExtract 141 3 + 145: 6(float) ImageSampleDrefExplicitLod 140 141 144 Grad ConstOffset 142 143 70 + 147: 34(ptr) AccessChain 9(v) 146 + 148: 6(float) Load 147 + 149: 6(float) FAdd 148 145 + 150: 34(ptr) AccessChain 9(v) 146 + Store 150 149 + 151: 40 Load 42(s3D) + 152: 7(fvec4) Load 26(c4D) + 153: 53(fvec3) Load 55(c3D) + 154: 53(fvec3) Load 55(c3D) + 155: 7(fvec4) ImageSampleProjExplicitLod 151 152 Grad 153 154 + 156: 7(fvec4) Load 9(v) + 157: 7(fvec4) FAdd 156 155 + Store 9(v) 157 + 158: 11 Load 13(s2D) + 159: 53(fvec3) Load 55(c3D) + 160: 15(fvec2) Load 17(c2D) + 161: 15(fvec2) Load 17(c2D) + 162: 7(fvec4) ImageSampleProjExplicitLod 158 159 Grad ConstOffset 160 161 70 + 163: 7(fvec4) Load 9(v) + 164: 7(fvec4) FAdd 163 162 + Store 9(v) 164 + 172: 169 Load 171(is2D) + 173: 15(fvec2) Load 17(c2D) + 174: 165(ivec4) ImageSampleImplicitLod 172 173 + Store 167(iv) 174 + 175: 165(ivec4) Load 167(iv) + 176: 7(fvec4) ConvertSToF 175 + 177: 7(fvec4) Load 9(v) + 178: 7(fvec4) FAdd 177 176 + Store 9(v) 178 + 179: 169 Load 171(is2D) + 180: 7(fvec4) Load 26(c4D) + 181: 165(ivec4) ImageSampleProjImplicitLod 179 180 ConstOffset 70 + Store 167(iv) 181 + 182: 165(ivec4) Load 167(iv) + 183: 7(fvec4) ConvertSToF 182 + 184: 7(fvec4) Load 9(v) + 185: 7(fvec4) FAdd 184 183 + Store 9(v) 185 + 186: 169 Load 171(is2D) + 187: 53(fvec3) Load 55(c3D) + 188: 6(float) Load 29(c1D) + 189: 165(ivec4) ImageSampleProjExplicitLod 186 187 Lod 188 + Store 167(iv) 189 + 190: 165(ivec4) Load 167(iv) + 191: 7(fvec4) ConvertSToF 190 + 192: 7(fvec4) Load 9(v) + 193: 7(fvec4) FAdd 192 191 + Store 9(v) 193 + 194: 169 Load 171(is2D) + 195: 53(fvec3) Load 55(c3D) + 196: 15(fvec2) Load 17(c2D) + 197: 15(fvec2) Load 17(c2D) + 198: 165(ivec4) ImageSampleProjExplicitLod 194 195 Grad 196 197 + Store 167(iv) 198 + 199: 165(ivec4) Load 167(iv) + 200: 7(fvec4) ConvertSToF 199 + 201: 7(fvec4) Load 9(v) + 202: 7(fvec4) FAdd 201 200 + Store 9(v) 202 + 207: 204 Load 206(is3D) + 208: 53(fvec3) Load 55(c3D) + 210: 165(ivec4) ImageSampleImplicitLod 207 208 Bias 209 + Store 167(iv) 210 + 211: 165(ivec4) Load 167(iv) + 212: 7(fvec4) ConvertSToF 211 + 213: 7(fvec4) Load 9(v) + 214: 7(fvec4) FAdd 213 212 + Store 9(v) 214 + 219: 216 Load 218(isCube) + 220: 53(fvec3) Load 55(c3D) + 221: 6(float) Load 29(c1D) + 222: 165(ivec4) ImageSampleExplicitLod 219 220 Lod 221 + Store 167(iv) 222 + 223: 165(ivec4) Load 167(iv) + 224: 7(fvec4) ConvertSToF 223 + 225: 7(fvec4) Load 9(v) + 226: 7(fvec4) FAdd 225 224 + Store 9(v) 226 + 231: 228 Load 230(is2DArray) + 232: 79(ivec3) Load 81(ic3D) + 233: 67(int) Load 84(ic1D) + 234: 227 Image 231 + 235: 165(ivec4) ImageFetch 234 232 Lod 233 + Store 167(iv) 235 + 236: 165(ivec4) Load 167(iv) + 237: 7(fvec4) ConvertSToF 236 + 238: 7(fvec4) Load 9(v) + 239: 7(fvec4) FAdd 238 237 + Store 9(v) 239 + 246: 243 Load 245(sCubeShadow) + 248: 242 Image 246 + 249: 68(ivec2) ImageQuerySizeLod 248 247 + Store 241(iv2) 249 + 252: 7(fvec4) Load 9(v) + 253: 68(ivec2) Load 241(iv2) + 254: 15(fvec2) ConvertSToF 253 + 256: 6(float) CompositeExtract 254 0 + 257: 6(float) CompositeExtract 254 1 + 258: 7(fvec4) CompositeConstruct 256 257 255 255 + 259: 7(fvec4) FAdd 252 258 + Store 251(FragData) 259 Return FunctionEnd diff --git a/Test/baseResults/spv.sparseTexture.frag.out b/Test/baseResults/spv.sparseTexture.frag.out index 315e1bb4..ae48f41d 100644 --- a/Test/baseResults/spv.sparseTexture.frag.out +++ b/Test/baseResults/spv.sparseTexture.frag.out @@ -7,7 +7,7 @@ Linked fragment stage: // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 433 +// Id's are bound by 438 Capability Shader Capability SampledRect @@ -15,7 +15,7 @@ Linked fragment stage: Capability SampledCubeArray 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 33 48 89 360 388 400 418 + EntryPoint Fragment 4 "main" 33 48 89 365 393 405 423 ExecutionMode 4 OriginUpperLeft Source GLSL 450 SourceExtension "GL_ARB_sparse_texture2" @@ -39,17 +39,17 @@ Linked fragment stage: Name 111 "ResType" Name 140 "us2DRect" Name 154 "s2DArrayShadow" - Name 186 "s2DMS" - Name 223 "is2DArray" - Name 256 "sCubeShadow" - Name 289 "s2DRectShadow" - Name 360 "offsets" - Name 385 "i2D" - Name 388 "ic2" - Name 397 "ii3D" - Name 400 "ic3" - Name 409 "i2DMS" - Name 418 "outColor" + Name 188 "s2DMS" + Name 228 "is2DArray" + Name 261 "sCubeShadow" + Name 294 "s2DRectShadow" + Name 365 "offsets" + Name 390 "i2D" + Name 393 "ic2" + Name 402 "ii3D" + Name 405 "ic3" + Name 414 "i2DMS" + Name 423 "outColor" Decorate 29(s2D) DescriptorSet 0 Decorate 44(s3D) DescriptorSet 0 Decorate 59(isCube) DescriptorSet 0 @@ -58,16 +58,16 @@ Linked fragment stage: Decorate 108(usCubeArray) DescriptorSet 0 Decorate 140(us2DRect) DescriptorSet 0 Decorate 154(s2DArrayShadow) DescriptorSet 0 - Decorate 186(s2DMS) DescriptorSet 0 - Decorate 223(is2DArray) DescriptorSet 0 - Decorate 256(sCubeShadow) DescriptorSet 0 - Decorate 289(s2DRectShadow) DescriptorSet 0 - Decorate 360(offsets) Flat - Decorate 385(i2D) DescriptorSet 0 - Decorate 388(ic2) Flat - Decorate 397(ii3D) DescriptorSet 0 - Decorate 400(ic3) Flat - Decorate 409(i2DMS) DescriptorSet 0 + Decorate 188(s2DMS) DescriptorSet 0 + Decorate 228(is2DArray) DescriptorSet 0 + Decorate 261(sCubeShadow) DescriptorSet 0 + Decorate 294(s2DRectShadow) DescriptorSet 0 + Decorate 365(offsets) Flat + Decorate 390(i2D) DescriptorSet 0 + Decorate 393(ic2) Flat + Decorate 402(ii3D) DescriptorSet 0 + Decorate 405(ic3) Flat + Decorate 414(i2DMS) DescriptorSet 0 2: TypeVoid 3: TypeFunction 2 6: TypeInt 32 1 @@ -143,58 +143,58 @@ Linked fragment stage: 157: 6(int) Constant 5 158: 143(ivec2) ConstantComposite 157 157 159: 20(int) Constant 2 - 183: TypeImage 10(float) 2D multi-sampled sampled format:Unknown - 184: TypeSampledImage 183 - 185: TypePointer UniformConstant 184 - 186(s2DMS): 185(ptr) Variable UniformConstant - 190: 6(int) Constant 4 - 199: 129(ivec3) ConstantComposite 190 190 190 - 220: TypeImage 6(int) 2D array sampled format:Unknown - 221: TypeSampledImage 220 - 222: TypePointer UniformConstant 221 - 223(is2DArray): 222(ptr) Variable UniformConstant - 226: 6(int) Constant 6 - 227: 143(ivec2) ConstantComposite 226 226 - 235: 6(int) Constant 7 - 236: 143(ivec2) ConstantComposite 235 235 - 253: TypeImage 10(float) Cube depth sampled format:Unknown - 254: TypeSampledImage 253 - 255: TypePointer UniformConstant 254 -256(sCubeShadow): 255(ptr) Variable UniformConstant - 286: TypeImage 10(float) Rect depth sampled format:Unknown - 287: TypeSampledImage 286 - 288: TypePointer UniformConstant 287 -289(s2DRectShadow): 288(ptr) Variable UniformConstant - 294: 20(int) Constant 3 - 306: 143(ivec2) ConstantComposite 130 130 - 335: 143(ivec2) ConstantComposite 190 190 - 357: 20(int) Constant 4 - 358: TypeArray 143(ivec2) 357 - 359: TypePointer Input 358 - 360(offsets): 359(ptr) Variable Input - 383: TypeImage 10(float) 2D nonsampled format:Rgba32f - 384: TypePointer UniformConstant 383 - 385(i2D): 384(ptr) Variable UniformConstant - 387: TypePointer Input 143(ivec2) - 388(ic2): 387(ptr) Variable Input - 395: TypeImage 6(int) 3D nonsampled format:Rgba32i - 396: TypePointer UniformConstant 395 - 397(ii3D): 396(ptr) Variable UniformConstant - 399: TypePointer Input 129(ivec3) - 400(ic3): 399(ptr) Variable Input - 407: TypeImage 10(float) 2D multi-sampled nonsampled format:Rgba32f - 408: TypePointer UniformConstant 407 - 409(i2DMS): 408(ptr) Variable UniformConstant - 417: TypePointer Output 11(fvec4) - 418(outColor): 417(ptr) Variable Output - 421: TypeBool + 185: TypeImage 10(float) 2D multi-sampled sampled format:Unknown + 186: TypeSampledImage 185 + 187: TypePointer UniformConstant 186 + 188(s2DMS): 187(ptr) Variable UniformConstant + 192: 6(int) Constant 4 + 202: 129(ivec3) ConstantComposite 192 192 192 + 225: TypeImage 6(int) 2D array sampled format:Unknown + 226: TypeSampledImage 225 + 227: TypePointer UniformConstant 226 + 228(is2DArray): 227(ptr) Variable UniformConstant + 231: 6(int) Constant 6 + 232: 143(ivec2) ConstantComposite 231 231 + 240: 6(int) Constant 7 + 241: 143(ivec2) ConstantComposite 240 240 + 258: TypeImage 10(float) Cube depth sampled format:Unknown + 259: TypeSampledImage 258 + 260: TypePointer UniformConstant 259 +261(sCubeShadow): 260(ptr) Variable UniformConstant + 291: TypeImage 10(float) Rect depth sampled format:Unknown + 292: TypeSampledImage 291 + 293: TypePointer UniformConstant 292 +294(s2DRectShadow): 293(ptr) Variable UniformConstant + 299: 20(int) Constant 3 + 311: 143(ivec2) ConstantComposite 130 130 + 340: 143(ivec2) ConstantComposite 192 192 + 362: 20(int) Constant 4 + 363: TypeArray 143(ivec2) 362 + 364: TypePointer Input 363 + 365(offsets): 364(ptr) Variable Input + 388: TypeImage 10(float) 2D nonsampled format:Rgba32f + 389: TypePointer UniformConstant 388 + 390(i2D): 389(ptr) Variable UniformConstant + 392: TypePointer Input 143(ivec2) + 393(ic2): 392(ptr) Variable Input + 400: TypeImage 6(int) 3D nonsampled format:Rgba32i + 401: TypePointer UniformConstant 400 + 402(ii3D): 401(ptr) Variable UniformConstant + 404: TypePointer Input 129(ivec3) + 405(ic3): 404(ptr) Variable Input + 412: TypeImage 10(float) 2D multi-sampled nonsampled format:Rgba32f + 413: TypePointer UniformConstant 412 + 414(i2DMS): 413(ptr) Variable UniformConstant + 422: TypePointer Output 11(fvec4) + 423(outColor): 422(ptr) Variable Output + 426: TypeBool 4(main): 2 Function None 3 5: Label 8(resident): 7(ptr) Variable Function 13(texel): 12(ptr) Variable Function 18(itexel): 17(ptr) Variable Function 23(utexel): 22(ptr) Variable Function - 419: 12(ptr) Variable Function + 424: 12(ptr) Variable Function Store 8(resident) 9 Store 13(texel) 15 Store 18(itexel) 19 @@ -308,281 +308,286 @@ Linked fragment stage: 167: 27 Load 29(s2D) 168: 31(fvec2) Load 33(c2) 169: 143(ivec2) ConvertFToS 168 - 170: 35(ResType) ImageSparseFetch 167 169 Lod 130 - 171: 11(fvec4) CompositeExtract 170 1 - Store 13(texel) 171 - 172: 6(int) CompositeExtract 170 0 - 173: 6(int) Load 8(resident) - 174: 6(int) BitwiseOr 173 172 - Store 8(resident) 174 - 175: 138 Load 140(us2DRect) - 176: 31(fvec2) Load 33(c2) - 177: 143(ivec2) ConvertFToS 176 - 178:111(ResType) ImageSparseFetch 175 177 - 179: 21(ivec4) CompositeExtract 178 1 - Store 23(utexel) 179 - 180: 6(int) CompositeExtract 178 0 - 181: 6(int) Load 8(resident) - 182: 6(int) BitwiseOr 181 180 - Store 8(resident) 182 - 187: 184 Load 186(s2DMS) - 188: 31(fvec2) Load 33(c2) - 189: 143(ivec2) ConvertFToS 188 - 191: 35(ResType) ImageSparseFetch 187 189 Sample 190 - 192: 11(fvec4) CompositeExtract 191 1 - Store 13(texel) 192 - 193: 6(int) CompositeExtract 191 0 - 194: 6(int) Load 8(resident) - 195: 6(int) BitwiseOr 194 193 - Store 8(resident) 195 - 196: 42 Load 44(s3D) - 197: 46(fvec3) Load 48(c3) - 198: 129(ivec3) ConvertFToS 197 - 200: 35(ResType) ImageSparseFetch 196 198 Lod ConstOffset 130 199 - 201: 11(fvec4) CompositeExtract 200 1 - Store 13(texel) 201 - 202: 6(int) CompositeExtract 200 0 - 203: 6(int) Load 8(resident) - 204: 6(int) BitwiseOr 203 202 - Store 8(resident) 204 - 205: 138 Load 140(us2DRect) - 206: 31(fvec2) Load 33(c2) - 207: 143(ivec2) ConvertFToS 206 - 208:111(ResType) ImageSparseFetch 205 207 ConstOffset 145 - 209: 21(ivec4) CompositeExtract 208 1 - Store 23(utexel) 209 - 210: 6(int) CompositeExtract 208 0 - 211: 6(int) Load 8(resident) - 212: 6(int) BitwiseOr 211 210 - Store 8(resident) 212 - 213: 27 Load 29(s2D) - 214: 31(fvec2) Load 33(c2) - 215: 35(ResType) ImageSparseSampleExplicitLod 213 214 Lod ConstOffset 50 158 - 216: 11(fvec4) CompositeExtract 215 1 - Store 13(texel) 216 - 217: 6(int) CompositeExtract 215 0 - 218: 6(int) Load 8(resident) - 219: 6(int) BitwiseOr 218 217 - Store 8(resident) 219 - 224: 221 Load 223(is2DArray) - 225: 46(fvec3) Load 48(c3) - 228: 62(ResType) ImageSparseSampleExplicitLod 224 225 Lod ConstOffset 50 227 - 229: 16(ivec4) CompositeExtract 228 1 - Store 18(itexel) 229 - 230: 6(int) CompositeExtract 228 0 - 231: 6(int) Load 8(resident) - 232: 6(int) BitwiseOr 231 230 - Store 8(resident) 232 - 233: 69 Load 71(s2DShadow) - 234: 46(fvec3) Load 48(c3) - 237: 74(ptr) AccessChain 13(texel) 159 - 238: 10(float) CompositeExtract 234 2 - 239: 77(ResType) ImageSparseSampleDrefExplicitLod 233 234 238 Lod ConstOffset 50 236 - 240: 10(float) CompositeExtract 239 1 - Store 237 240 - 241: 6(int) CompositeExtract 239 0 - 242: 6(int) Load 8(resident) - 243: 6(int) BitwiseOr 242 241 - Store 8(resident) 243 - 244: 42 Load 44(s3D) - 245: 46(fvec3) Load 48(c3) - 246: 46(fvec3) Load 48(c3) - 247: 46(fvec3) Load 48(c3) - 248: 35(ResType) ImageSparseSampleExplicitLod 244 245 Grad 246 247 - 249: 11(fvec4) CompositeExtract 248 1 - Store 13(texel) 249 - 250: 6(int) CompositeExtract 248 0 - 251: 6(int) Load 8(resident) - 252: 6(int) BitwiseOr 251 250 - Store 8(resident) 252 - 257: 254 Load 256(sCubeShadow) - 258: 11(fvec4) Load 89(c4) - 259: 46(fvec3) Load 48(c3) - 260: 46(fvec3) Load 48(c3) - 261: 74(ptr) AccessChain 13(texel) 119 - 262: 10(float) CompositeExtract 258 3 - 263: 77(ResType) ImageSparseSampleDrefExplicitLod 257 258 262 Grad 259 260 - 264: 10(float) CompositeExtract 263 1 - Store 261 264 - 265: 6(int) CompositeExtract 263 0 - 266: 6(int) Load 8(resident) - 267: 6(int) BitwiseOr 266 265 - Store 8(resident) 267 - 268: 106 Load 108(usCubeArray) - 269: 11(fvec4) Load 89(c4) - 270: 46(fvec3) Load 48(c3) - 271: 46(fvec3) Load 48(c3) - 272:111(ResType) ImageSparseSampleExplicitLod 268 269 Grad 270 271 - 273: 21(ivec4) CompositeExtract 272 1 - Store 23(utexel) 273 - 274: 6(int) CompositeExtract 272 0 - 275: 6(int) Load 8(resident) - 276: 6(int) BitwiseOr 275 274 - Store 8(resident) 276 - 277: 27 Load 29(s2D) - 278: 31(fvec2) Load 33(c2) - 279: 31(fvec2) Load 33(c2) - 280: 31(fvec2) Load 33(c2) - 281: 35(ResType) ImageSparseSampleExplicitLod 277 278 Grad ConstOffset 279 280 158 - 282: 11(fvec4) CompositeExtract 281 1 - Store 13(texel) 282 - 283: 6(int) CompositeExtract 281 0 - 284: 6(int) Load 8(resident) - 285: 6(int) BitwiseOr 284 283 - Store 8(resident) 285 - 290: 287 Load 289(s2DRectShadow) - 291: 46(fvec3) Load 48(c3) - 292: 31(fvec2) Load 33(c2) - 293: 31(fvec2) Load 33(c2) - 295: 74(ptr) AccessChain 13(texel) 294 - 296: 10(float) CompositeExtract 291 2 - 297: 77(ResType) ImageSparseSampleDrefExplicitLod 290 291 296 Grad ConstOffset 292 293 227 - 298: 10(float) CompositeExtract 297 1 - Store 295 298 - 299: 6(int) CompositeExtract 297 0 - 300: 6(int) Load 8(resident) - 301: 6(int) BitwiseOr 300 299 - Store 8(resident) 301 - 302: 221 Load 223(is2DArray) - 303: 46(fvec3) Load 48(c3) - 304: 31(fvec2) Load 33(c2) - 305: 31(fvec2) Load 33(c2) - 307: 62(ResType) ImageSparseSampleExplicitLod 302 303 Grad ConstOffset 304 305 306 - 308: 16(ivec4) CompositeExtract 307 1 - Store 18(itexel) 308 - 309: 6(int) CompositeExtract 307 0 - 310: 6(int) Load 8(resident) - 311: 6(int) BitwiseOr 310 309 - Store 8(resident) 311 - 312: 27 Load 29(s2D) - 313: 31(fvec2) Load 33(c2) - 314: 35(ResType) ImageSparseGather 312 313 9 - 315: 11(fvec4) CompositeExtract 314 1 - Store 13(texel) 315 - 316: 6(int) CompositeExtract 314 0 - 317: 6(int) Load 8(resident) - 318: 6(int) BitwiseOr 317 316 - Store 8(resident) 318 - 319: 221 Load 223(is2DArray) - 320: 46(fvec3) Load 48(c3) - 321: 62(ResType) ImageSparseGather 319 320 130 - 322: 16(ivec4) CompositeExtract 321 1 - Store 18(itexel) 322 - 323: 6(int) CompositeExtract 321 0 - 324: 6(int) Load 8(resident) - 325: 6(int) BitwiseOr 324 323 - Store 8(resident) 325 - 326: 152 Load 154(s2DArrayShadow) - 327: 46(fvec3) Load 48(c3) - 328: 35(ResType) ImageSparseDrefGather 326 327 50 - 329: 11(fvec4) CompositeExtract 328 1 - Store 13(texel) 329 - 330: 6(int) CompositeExtract 328 0 - 331: 6(int) Load 8(resident) - 332: 6(int) BitwiseOr 331 330 - Store 8(resident) 332 - 333: 27 Load 29(s2D) - 334: 31(fvec2) Load 33(c2) - 336: 35(ResType) ImageSparseGather 333 334 9 ConstOffset 335 - 337: 11(fvec4) CompositeExtract 336 1 - Store 13(texel) 337 - 338: 6(int) CompositeExtract 336 0 - 339: 6(int) Load 8(resident) - 340: 6(int) BitwiseOr 339 338 - Store 8(resident) 340 - 341: 221 Load 223(is2DArray) - 342: 46(fvec3) Load 48(c3) - 343: 62(ResType) ImageSparseGather 341 342 130 ConstOffset 158 - 344: 16(ivec4) CompositeExtract 343 1 - Store 18(itexel) 344 - 345: 6(int) CompositeExtract 343 0 - 346: 6(int) Load 8(resident) - 347: 6(int) BitwiseOr 346 345 - Store 8(resident) 347 - 348: 287 Load 289(s2DRectShadow) - 349: 31(fvec2) Load 33(c2) - 350: 35(ResType) ImageSparseDrefGather 348 349 50 ConstOffset 236 - 351: 11(fvec4) CompositeExtract 350 1 - Store 13(texel) 351 - 352: 6(int) CompositeExtract 350 0 - 353: 6(int) Load 8(resident) - 354: 6(int) BitwiseOr 353 352 - Store 8(resident) 354 - 355: 27 Load 29(s2D) - 356: 31(fvec2) Load 33(c2) - 361: 358 Load 360(offsets) - 362: 35(ResType) ImageSparseGather 355 356 9 ConstOffsets 361 - 363: 11(fvec4) CompositeExtract 362 1 - Store 13(texel) 363 - 364: 6(int) CompositeExtract 362 0 - 365: 6(int) Load 8(resident) - 366: 6(int) BitwiseOr 365 364 - Store 8(resident) 366 - 367: 221 Load 223(is2DArray) - 368: 46(fvec3) Load 48(c3) - 369: 358 Load 360(offsets) - 370: 62(ResType) ImageSparseGather 367 368 130 ConstOffsets 369 - 371: 16(ivec4) CompositeExtract 370 1 - Store 18(itexel) 371 - 372: 6(int) CompositeExtract 370 0 - 373: 6(int) Load 8(resident) - 374: 6(int) BitwiseOr 373 372 - Store 8(resident) 374 - 375: 287 Load 289(s2DRectShadow) - 376: 31(fvec2) Load 33(c2) - 377: 358 Load 360(offsets) - 378: 35(ResType) ImageSparseDrefGather 375 376 50 ConstOffsets 377 - 379: 11(fvec4) CompositeExtract 378 1 - Store 13(texel) 379 - 380: 6(int) CompositeExtract 378 0 - 381: 6(int) Load 8(resident) - 382: 6(int) BitwiseOr 381 380 - Store 8(resident) 382 - 386: 383 Load 385(i2D) - 389: 143(ivec2) Load 388(ic2) - 390: 35(ResType) ImageSparseRead 386 389 - 391: 11(fvec4) CompositeExtract 390 1 - Store 13(texel) 391 - 392: 6(int) CompositeExtract 390 0 - 393: 6(int) Load 8(resident) - 394: 6(int) BitwiseOr 393 392 - Store 8(resident) 394 - 398: 395 Load 397(ii3D) - 401: 129(ivec3) Load 400(ic3) - 402: 62(ResType) ImageSparseRead 398 401 - 403: 16(ivec4) CompositeExtract 402 1 - Store 18(itexel) 403 - 404: 6(int) CompositeExtract 402 0 - 405: 6(int) Load 8(resident) - 406: 6(int) BitwiseOr 405 404 - Store 8(resident) 406 - 410: 407 Load 409(i2DMS) - 411: 143(ivec2) Load 388(ic2) - 412: 35(ResType) ImageSparseRead 410 411 Sample 144 - 413: 11(fvec4) CompositeExtract 412 1 - Store 13(texel) 413 - 414: 6(int) CompositeExtract 412 0 - 415: 6(int) Load 8(resident) - 416: 6(int) BitwiseOr 415 414 - Store 8(resident) 416 + 170: 26 Image 167 + 171: 35(ResType) ImageSparseFetch 170 169 Lod 130 + 172: 11(fvec4) CompositeExtract 171 1 + Store 13(texel) 172 + 173: 6(int) CompositeExtract 171 0 + 174: 6(int) Load 8(resident) + 175: 6(int) BitwiseOr 174 173 + Store 8(resident) 175 + 176: 138 Load 140(us2DRect) + 177: 31(fvec2) Load 33(c2) + 178: 143(ivec2) ConvertFToS 177 + 179: 137 Image 176 + 180:111(ResType) ImageSparseFetch 179 178 + 181: 21(ivec4) CompositeExtract 180 1 + Store 23(utexel) 181 + 182: 6(int) CompositeExtract 180 0 + 183: 6(int) Load 8(resident) + 184: 6(int) BitwiseOr 183 182 + Store 8(resident) 184 + 189: 186 Load 188(s2DMS) + 190: 31(fvec2) Load 33(c2) + 191: 143(ivec2) ConvertFToS 190 + 193: 185 Image 189 + 194: 35(ResType) ImageSparseFetch 193 191 Sample 192 + 195: 11(fvec4) CompositeExtract 194 1 + Store 13(texel) 195 + 196: 6(int) CompositeExtract 194 0 + 197: 6(int) Load 8(resident) + 198: 6(int) BitwiseOr 197 196 + Store 8(resident) 198 + 199: 42 Load 44(s3D) + 200: 46(fvec3) Load 48(c3) + 201: 129(ivec3) ConvertFToS 200 + 203: 41 Image 199 + 204: 35(ResType) ImageSparseFetch 203 201 Lod ConstOffset 130 202 + 205: 11(fvec4) CompositeExtract 204 1 + Store 13(texel) 205 + 206: 6(int) CompositeExtract 204 0 + 207: 6(int) Load 8(resident) + 208: 6(int) BitwiseOr 207 206 + Store 8(resident) 208 + 209: 138 Load 140(us2DRect) + 210: 31(fvec2) Load 33(c2) + 211: 143(ivec2) ConvertFToS 210 + 212: 137 Image 209 + 213:111(ResType) ImageSparseFetch 212 211 ConstOffset 145 + 214: 21(ivec4) CompositeExtract 213 1 + Store 23(utexel) 214 + 215: 6(int) CompositeExtract 213 0 + 216: 6(int) Load 8(resident) + 217: 6(int) BitwiseOr 216 215 + Store 8(resident) 217 + 218: 27 Load 29(s2D) + 219: 31(fvec2) Load 33(c2) + 220: 35(ResType) ImageSparseSampleExplicitLod 218 219 Lod ConstOffset 50 158 + 221: 11(fvec4) CompositeExtract 220 1 + Store 13(texel) 221 + 222: 6(int) CompositeExtract 220 0 + 223: 6(int) Load 8(resident) + 224: 6(int) BitwiseOr 223 222 + Store 8(resident) 224 + 229: 226 Load 228(is2DArray) + 230: 46(fvec3) Load 48(c3) + 233: 62(ResType) ImageSparseSampleExplicitLod 229 230 Lod ConstOffset 50 232 + 234: 16(ivec4) CompositeExtract 233 1 + Store 18(itexel) 234 + 235: 6(int) CompositeExtract 233 0 + 236: 6(int) Load 8(resident) + 237: 6(int) BitwiseOr 236 235 + Store 8(resident) 237 + 238: 69 Load 71(s2DShadow) + 239: 46(fvec3) Load 48(c3) + 242: 74(ptr) AccessChain 13(texel) 159 + 243: 10(float) CompositeExtract 239 2 + 244: 77(ResType) ImageSparseSampleDrefExplicitLod 238 239 243 Lod ConstOffset 50 241 + 245: 10(float) CompositeExtract 244 1 + Store 242 245 + 246: 6(int) CompositeExtract 244 0 + 247: 6(int) Load 8(resident) + 248: 6(int) BitwiseOr 247 246 + Store 8(resident) 248 + 249: 42 Load 44(s3D) + 250: 46(fvec3) Load 48(c3) + 251: 46(fvec3) Load 48(c3) + 252: 46(fvec3) Load 48(c3) + 253: 35(ResType) ImageSparseSampleExplicitLod 249 250 Grad 251 252 + 254: 11(fvec4) CompositeExtract 253 1 + Store 13(texel) 254 + 255: 6(int) CompositeExtract 253 0 + 256: 6(int) Load 8(resident) + 257: 6(int) BitwiseOr 256 255 + Store 8(resident) 257 + 262: 259 Load 261(sCubeShadow) + 263: 11(fvec4) Load 89(c4) + 264: 46(fvec3) Load 48(c3) + 265: 46(fvec3) Load 48(c3) + 266: 74(ptr) AccessChain 13(texel) 119 + 267: 10(float) CompositeExtract 263 3 + 268: 77(ResType) ImageSparseSampleDrefExplicitLod 262 263 267 Grad 264 265 + 269: 10(float) CompositeExtract 268 1 + Store 266 269 + 270: 6(int) CompositeExtract 268 0 + 271: 6(int) Load 8(resident) + 272: 6(int) BitwiseOr 271 270 + Store 8(resident) 272 + 273: 106 Load 108(usCubeArray) + 274: 11(fvec4) Load 89(c4) + 275: 46(fvec3) Load 48(c3) + 276: 46(fvec3) Load 48(c3) + 277:111(ResType) ImageSparseSampleExplicitLod 273 274 Grad 275 276 + 278: 21(ivec4) CompositeExtract 277 1 + Store 23(utexel) 278 + 279: 6(int) CompositeExtract 277 0 + 280: 6(int) Load 8(resident) + 281: 6(int) BitwiseOr 280 279 + Store 8(resident) 281 + 282: 27 Load 29(s2D) + 283: 31(fvec2) Load 33(c2) + 284: 31(fvec2) Load 33(c2) + 285: 31(fvec2) Load 33(c2) + 286: 35(ResType) ImageSparseSampleExplicitLod 282 283 Grad ConstOffset 284 285 158 + 287: 11(fvec4) CompositeExtract 286 1 + Store 13(texel) 287 + 288: 6(int) CompositeExtract 286 0 + 289: 6(int) Load 8(resident) + 290: 6(int) BitwiseOr 289 288 + Store 8(resident) 290 + 295: 292 Load 294(s2DRectShadow) + 296: 46(fvec3) Load 48(c3) + 297: 31(fvec2) Load 33(c2) + 298: 31(fvec2) Load 33(c2) + 300: 74(ptr) AccessChain 13(texel) 299 + 301: 10(float) CompositeExtract 296 2 + 302: 77(ResType) ImageSparseSampleDrefExplicitLod 295 296 301 Grad ConstOffset 297 298 232 + 303: 10(float) CompositeExtract 302 1 + Store 300 303 + 304: 6(int) CompositeExtract 302 0 + 305: 6(int) Load 8(resident) + 306: 6(int) BitwiseOr 305 304 + Store 8(resident) 306 + 307: 226 Load 228(is2DArray) + 308: 46(fvec3) Load 48(c3) + 309: 31(fvec2) Load 33(c2) + 310: 31(fvec2) Load 33(c2) + 312: 62(ResType) ImageSparseSampleExplicitLod 307 308 Grad ConstOffset 309 310 311 + 313: 16(ivec4) CompositeExtract 312 1 + Store 18(itexel) 313 + 314: 6(int) CompositeExtract 312 0 + 315: 6(int) Load 8(resident) + 316: 6(int) BitwiseOr 315 314 + Store 8(resident) 316 + 317: 27 Load 29(s2D) + 318: 31(fvec2) Load 33(c2) + 319: 35(ResType) ImageSparseGather 317 318 9 + 320: 11(fvec4) CompositeExtract 319 1 + Store 13(texel) 320 + 321: 6(int) CompositeExtract 319 0 + 322: 6(int) Load 8(resident) + 323: 6(int) BitwiseOr 322 321 + Store 8(resident) 323 + 324: 226 Load 228(is2DArray) + 325: 46(fvec3) Load 48(c3) + 326: 62(ResType) ImageSparseGather 324 325 130 + 327: 16(ivec4) CompositeExtract 326 1 + Store 18(itexel) 327 + 328: 6(int) CompositeExtract 326 0 + 329: 6(int) Load 8(resident) + 330: 6(int) BitwiseOr 329 328 + Store 8(resident) 330 + 331: 152 Load 154(s2DArrayShadow) + 332: 46(fvec3) Load 48(c3) + 333: 35(ResType) ImageSparseDrefGather 331 332 50 + 334: 11(fvec4) CompositeExtract 333 1 + Store 13(texel) 334 + 335: 6(int) CompositeExtract 333 0 + 336: 6(int) Load 8(resident) + 337: 6(int) BitwiseOr 336 335 + Store 8(resident) 337 + 338: 27 Load 29(s2D) + 339: 31(fvec2) Load 33(c2) + 341: 35(ResType) ImageSparseGather 338 339 9 ConstOffset 340 + 342: 11(fvec4) CompositeExtract 341 1 + Store 13(texel) 342 + 343: 6(int) CompositeExtract 341 0 + 344: 6(int) Load 8(resident) + 345: 6(int) BitwiseOr 344 343 + Store 8(resident) 345 + 346: 226 Load 228(is2DArray) + 347: 46(fvec3) Load 48(c3) + 348: 62(ResType) ImageSparseGather 346 347 130 ConstOffset 158 + 349: 16(ivec4) CompositeExtract 348 1 + Store 18(itexel) 349 + 350: 6(int) CompositeExtract 348 0 + 351: 6(int) Load 8(resident) + 352: 6(int) BitwiseOr 351 350 + Store 8(resident) 352 + 353: 292 Load 294(s2DRectShadow) + 354: 31(fvec2) Load 33(c2) + 355: 35(ResType) ImageSparseDrefGather 353 354 50 ConstOffset 241 + 356: 11(fvec4) CompositeExtract 355 1 + Store 13(texel) 356 + 357: 6(int) CompositeExtract 355 0 + 358: 6(int) Load 8(resident) + 359: 6(int) BitwiseOr 358 357 + Store 8(resident) 359 + 360: 27 Load 29(s2D) + 361: 31(fvec2) Load 33(c2) + 366: 363 Load 365(offsets) + 367: 35(ResType) ImageSparseGather 360 361 9 ConstOffsets 366 + 368: 11(fvec4) CompositeExtract 367 1 + Store 13(texel) 368 + 369: 6(int) CompositeExtract 367 0 + 370: 6(int) Load 8(resident) + 371: 6(int) BitwiseOr 370 369 + Store 8(resident) 371 + 372: 226 Load 228(is2DArray) + 373: 46(fvec3) Load 48(c3) + 374: 363 Load 365(offsets) + 375: 62(ResType) ImageSparseGather 372 373 130 ConstOffsets 374 + 376: 16(ivec4) CompositeExtract 375 1 + Store 18(itexel) 376 + 377: 6(int) CompositeExtract 375 0 + 378: 6(int) Load 8(resident) + 379: 6(int) BitwiseOr 378 377 + Store 8(resident) 379 + 380: 292 Load 294(s2DRectShadow) + 381: 31(fvec2) Load 33(c2) + 382: 363 Load 365(offsets) + 383: 35(ResType) ImageSparseDrefGather 380 381 50 ConstOffsets 382 + 384: 11(fvec4) CompositeExtract 383 1 + Store 13(texel) 384 + 385: 6(int) CompositeExtract 383 0 + 386: 6(int) Load 8(resident) + 387: 6(int) BitwiseOr 386 385 + Store 8(resident) 387 + 391: 388 Load 390(i2D) + 394: 143(ivec2) Load 393(ic2) + 395: 35(ResType) ImageSparseRead 391 394 + 396: 11(fvec4) CompositeExtract 395 1 + Store 13(texel) 396 + 397: 6(int) CompositeExtract 395 0 + 398: 6(int) Load 8(resident) + 399: 6(int) BitwiseOr 398 397 + Store 8(resident) 399 + 403: 400 Load 402(ii3D) + 406: 129(ivec3) Load 405(ic3) + 407: 62(ResType) ImageSparseRead 403 406 + 408: 16(ivec4) CompositeExtract 407 1 + Store 18(itexel) 408 + 409: 6(int) CompositeExtract 407 0 + 410: 6(int) Load 8(resident) + 411: 6(int) BitwiseOr 410 409 + Store 8(resident) 411 + 415: 412 Load 414(i2DMS) + 416: 143(ivec2) Load 393(ic2) + 417: 35(ResType) ImageSparseRead 415 416 Sample 144 + 418: 11(fvec4) CompositeExtract 417 1 + Store 13(texel) 418 + 419: 6(int) CompositeExtract 417 0 420: 6(int) Load 8(resident) - 422: 421(bool) ImageSparseTexelsResident 420 - SelectionMerge 424 None - BranchConditional 422 423 426 - 423: Label - 425: 11(fvec4) Load 13(texel) - Store 419 425 - Branch 424 - 426: Label - 427: 16(ivec4) Load 18(itexel) - 428: 11(fvec4) ConvertSToF 427 - 429: 21(ivec4) Load 23(utexel) - 430: 11(fvec4) ConvertUToF 429 - 431: 11(fvec4) FAdd 428 430 - Store 419 431 - Branch 424 - 424: Label - 432: 11(fvec4) Load 419 - Store 418(outColor) 432 + 421: 6(int) BitwiseOr 420 419 + Store 8(resident) 421 + 425: 6(int) Load 8(resident) + 427: 426(bool) ImageSparseTexelsResident 425 + SelectionMerge 429 None + BranchConditional 427 428 431 + 428: Label + 430: 11(fvec4) Load 13(texel) + Store 424 430 + Branch 429 + 431: Label + 432: 16(ivec4) Load 18(itexel) + 433: 11(fvec4) ConvertSToF 432 + 434: 21(ivec4) Load 23(utexel) + 435: 11(fvec4) ConvertUToF 434 + 436: 11(fvec4) FAdd 433 435 + Store 424 436 + Branch 429 + 429: Label + 437: 11(fvec4) Load 424 + Store 423(outColor) 437 Return FunctionEnd diff --git a/Test/baseResults/spv.texture.frag.out b/Test/baseResults/spv.texture.frag.out index df5fe2be..b5794751 100755 --- a/Test/baseResults/spv.texture.frag.out +++ b/Test/baseResults/spv.texture.frag.out @@ -9,13 +9,13 @@ Linked fragment stage: // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 290 +// Id's are bound by 291 Capability Shader Capability Sampled1D 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 47 276 279 282 288 289 + EntryPoint Fragment 4 "main" 47 277 280 283 289 290 ExecutionMode 4 OriginUpperLeft Source GLSL 140 Name 4 "main" @@ -36,13 +36,13 @@ Linked fragment stage: Name 158 "shadowSampler2D" Name 207 "iCoords2D" Name 212 "iLod" - Name 221 "gradX" - Name 224 "gradY" - Name 276 "gl_FragColor" - Name 279 "u" - Name 282 "blend" - Name 288 "scale" - Name 289 "t" + Name 222 "gradX" + Name 225 "gradY" + Name 277 "gl_FragColor" + Name 280 "u" + Name 283 "blend" + Name 289 "scale" + Name 290 "t" Decorate 32(texSampler1D) DescriptorSet 0 Decorate 72(texSampler2D) DescriptorSet 0 Decorate 98(texSampler3D) DescriptorSet 0 @@ -101,18 +101,18 @@ Linked fragment stage: 210: 205(ivec2) ConstantComposite 208 209 211: TypePointer Function 204(int) 213: 204(int) Constant 1 - 220: TypePointer Function 45(fvec2) - 249: 204(int) Constant 3 - 250: 204(int) Constant 4294967289 - 251: 205(ivec2) ConstantComposite 249 250 - 275: TypePointer Output 22(fvec4) -276(gl_FragColor): 275(ptr) Variable Output - 278: TypePointer Input 22(fvec4) - 279(u): 278(ptr) Variable Input - 281: TypePointer Input 6(float) - 282(blend): 281(ptr) Variable Input - 288(scale): 46(ptr) Variable Input - 289(t): 46(ptr) Variable Input + 221: TypePointer Function 45(fvec2) + 250: 204(int) Constant 3 + 251: 204(int) Constant 4294967289 + 252: 205(ivec2) ConstantComposite 250 251 + 276: TypePointer Output 22(fvec4) +277(gl_FragColor): 276(ptr) Variable Output + 279: TypePointer Input 22(fvec4) + 280(u): 279(ptr) Variable Input + 282: TypePointer Input 6(float) + 283(blend): 282(ptr) Variable Input + 289(scale): 46(ptr) Variable Input + 290(t): 46(ptr) Variable Input 4(main): 2 Function None 3 5: Label 8(blendscale): 7(ptr) Variable Function @@ -125,8 +125,8 @@ Linked fragment stage: 26(color): 23(ptr) Variable Function 207(iCoords2D): 206(ptr) Variable Function 212(iLod): 211(ptr) Variable Function - 221(gradX): 220(ptr) Variable Function - 224(gradY): 220(ptr) Variable Function + 222(gradX): 221(ptr) Variable Function + 225(gradY): 221(ptr) Variable Function Store 8(blendscale) 9 Store 10(bias) 11 Store 12(lod) 13 @@ -312,73 +312,74 @@ Linked fragment stage: 214: 70 Load 72(texSampler2D) 215: 205(ivec2) Load 207(iCoords2D) 216: 204(int) Load 212(iLod) - 217: 22(fvec4) ImageFetch 214 215 Lod 216 - 218: 22(fvec4) Load 26(color) - 219: 22(fvec4) FAdd 218 217 - Store 26(color) 219 - 222: 45(fvec2) Load 47(coords2D) - 223: 45(fvec2) DPdx 222 - Store 221(gradX) 223 - 225: 45(fvec2) Load 47(coords2D) - 226: 45(fvec2) DPdy 225 - Store 224(gradY) 226 - 227: 70 Load 72(texSampler2D) - 228: 45(fvec2) Load 47(coords2D) - 229: 45(fvec2) Load 221(gradX) - 230: 45(fvec2) Load 224(gradY) - 231: 22(fvec4) ImageSampleExplicitLod 227 228 Grad 229 230 - 232: 22(fvec4) Load 26(color) - 233: 22(fvec4) FAdd 232 231 - Store 26(color) 233 - 234: 70 Load 72(texSampler2D) - 235: 45(fvec2) Load 47(coords2D) - 236: 6(float) Load 14(proj) - 237: 6(float) CompositeExtract 235 0 - 238: 6(float) CompositeExtract 235 1 - 239: 16(fvec3) CompositeConstruct 237 238 236 - 240: 45(fvec2) Load 221(gradX) - 241: 45(fvec2) Load 224(gradY) - 242: 22(fvec4) ImageSampleProjExplicitLod 234 239 Grad 240 241 - 243: 22(fvec4) Load 26(color) - 244: 22(fvec4) FAdd 243 242 - Store 26(color) 244 - 245: 70 Load 72(texSampler2D) - 246: 45(fvec2) Load 47(coords2D) - 247: 45(fvec2) Load 221(gradX) - 248: 45(fvec2) Load 224(gradY) - 252: 22(fvec4) ImageSampleExplicitLod 245 246 Grad ConstOffset 247 248 251 - 253: 22(fvec4) Load 26(color) - 254: 22(fvec4) FAdd 253 252 - Store 26(color) 254 - 255: 70 Load 72(texSampler2D) - 256: 16(fvec3) Load 18(coords3D) - 257: 45(fvec2) Load 221(gradX) - 258: 45(fvec2) Load 224(gradY) - 259: 22(fvec4) ImageSampleProjExplicitLod 255 256 Grad ConstOffset 257 258 251 - 260: 22(fvec4) Load 26(color) - 261: 22(fvec4) FAdd 260 259 - Store 26(color) 261 - 262: 156 Load 158(shadowSampler2D) - 263: 45(fvec2) Load 47(coords2D) - 264: 6(float) Load 12(lod) - 265: 6(float) CompositeExtract 263 0 - 266: 6(float) CompositeExtract 263 1 - 267: 16(fvec3) CompositeConstruct 265 266 264 - 268: 45(fvec2) Load 221(gradX) - 269: 45(fvec2) Load 224(gradY) - 270: 6(float) CompositeExtract 267 2 - 271: 6(float) ImageSampleDrefExplicitLod 262 267 270 Grad 268 269 - 272: 22(fvec4) Load 26(color) - 273: 22(fvec4) CompositeConstruct 271 271 271 271 - 274: 22(fvec4) FAdd 272 273 - Store 26(color) 274 - 277: 22(fvec4) Load 26(color) - 280: 22(fvec4) Load 279(u) - 283: 6(float) Load 282(blend) - 284: 6(float) Load 8(blendscale) - 285: 6(float) FMul 283 284 - 286: 22(fvec4) CompositeConstruct 285 285 285 285 - 287: 22(fvec4) ExtInst 1(GLSL.std.450) 46(FMix) 277 280 286 - Store 276(gl_FragColor) 287 + 217: 69 Image 214 + 218: 22(fvec4) ImageFetch 217 215 Lod 216 + 219: 22(fvec4) Load 26(color) + 220: 22(fvec4) FAdd 219 218 + Store 26(color) 220 + 223: 45(fvec2) Load 47(coords2D) + 224: 45(fvec2) DPdx 223 + Store 222(gradX) 224 + 226: 45(fvec2) Load 47(coords2D) + 227: 45(fvec2) DPdy 226 + Store 225(gradY) 227 + 228: 70 Load 72(texSampler2D) + 229: 45(fvec2) Load 47(coords2D) + 230: 45(fvec2) Load 222(gradX) + 231: 45(fvec2) Load 225(gradY) + 232: 22(fvec4) ImageSampleExplicitLod 228 229 Grad 230 231 + 233: 22(fvec4) Load 26(color) + 234: 22(fvec4) FAdd 233 232 + Store 26(color) 234 + 235: 70 Load 72(texSampler2D) + 236: 45(fvec2) Load 47(coords2D) + 237: 6(float) Load 14(proj) + 238: 6(float) CompositeExtract 236 0 + 239: 6(float) CompositeExtract 236 1 + 240: 16(fvec3) CompositeConstruct 238 239 237 + 241: 45(fvec2) Load 222(gradX) + 242: 45(fvec2) Load 225(gradY) + 243: 22(fvec4) ImageSampleProjExplicitLod 235 240 Grad 241 242 + 244: 22(fvec4) Load 26(color) + 245: 22(fvec4) FAdd 244 243 + Store 26(color) 245 + 246: 70 Load 72(texSampler2D) + 247: 45(fvec2) Load 47(coords2D) + 248: 45(fvec2) Load 222(gradX) + 249: 45(fvec2) Load 225(gradY) + 253: 22(fvec4) ImageSampleExplicitLod 246 247 Grad ConstOffset 248 249 252 + 254: 22(fvec4) Load 26(color) + 255: 22(fvec4) FAdd 254 253 + Store 26(color) 255 + 256: 70 Load 72(texSampler2D) + 257: 16(fvec3) Load 18(coords3D) + 258: 45(fvec2) Load 222(gradX) + 259: 45(fvec2) Load 225(gradY) + 260: 22(fvec4) ImageSampleProjExplicitLod 256 257 Grad ConstOffset 258 259 252 + 261: 22(fvec4) Load 26(color) + 262: 22(fvec4) FAdd 261 260 + Store 26(color) 262 + 263: 156 Load 158(shadowSampler2D) + 264: 45(fvec2) Load 47(coords2D) + 265: 6(float) Load 12(lod) + 266: 6(float) CompositeExtract 264 0 + 267: 6(float) CompositeExtract 264 1 + 268: 16(fvec3) CompositeConstruct 266 267 265 + 269: 45(fvec2) Load 222(gradX) + 270: 45(fvec2) Load 225(gradY) + 271: 6(float) CompositeExtract 268 2 + 272: 6(float) ImageSampleDrefExplicitLod 263 268 271 Grad 269 270 + 273: 22(fvec4) Load 26(color) + 274: 22(fvec4) CompositeConstruct 272 272 272 272 + 275: 22(fvec4) FAdd 273 274 + Store 26(color) 275 + 278: 22(fvec4) Load 26(color) + 281: 22(fvec4) Load 280(u) + 284: 6(float) Load 283(blend) + 285: 6(float) Load 8(blendscale) + 286: 6(float) FMul 284 285 + 287: 22(fvec4) CompositeConstruct 286 286 286 286 + 288: 22(fvec4) ExtInst 1(GLSL.std.450) 46(FMix) 278 281 287 + Store 277(gl_FragColor) 288 Return FunctionEnd From 4b67732c137bca313f0eb6f87f67969b1c9727b4 Mon Sep 17 00:00:00 2001 From: LoopDawg Date: Thu, 26 May 2016 10:10:16 -0600 Subject: [PATCH 132/140] Initial implementation of direct-mapped subset of HLSL intrinsics with type subset. This checkin implements about half of the HLSL intrinsics for a subset of their entire type support (but a useful subset). The uncommented lines in TBuiltInParseablesHlsl::identifyBuiltIns shows which are connected. --- Test/baseResults/hlsl.assoc.frag.out | 6 +- Test/baseResults/hlsl.float1.frag.out | 6 +- Test/baseResults/hlsl.float4.frag.out | 6 +- Test/baseResults/hlsl.frag.out | 6 +- Test/baseResults/hlsl.intrinsics.frag.out | 2178 ++++++++++++++++++++ Test/baseResults/hlsl.intrinsics.vert.out | 1994 ++++++++++++++++++ Test/baseResults/hlsl.matType.frag.out | 6 +- Test/baseResults/hlsl.max.frag.out | 6 +- Test/baseResults/hlsl.precedence.frag.out | 6 +- Test/baseResults/hlsl.precedence2.frag.out | 6 +- Test/baseResults/hlsl.sin.frag.out | 6 +- Test/hlsl.intrinsics.frag | 353 ++++ Test/hlsl.intrinsics.vert | 323 +++ glslang/MachineIndependent/ShaderLang.cpp | 10 +- gtests/Hlsl.FromFile.cpp | 3 + hlsl/hlslParseables.cpp | 555 ++++- 16 files changed, 5433 insertions(+), 37 deletions(-) create mode 100644 Test/baseResults/hlsl.intrinsics.frag.out create mode 100644 Test/baseResults/hlsl.intrinsics.vert.out create mode 100644 Test/hlsl.intrinsics.frag create mode 100644 Test/hlsl.intrinsics.vert diff --git a/Test/baseResults/hlsl.assoc.frag.out b/Test/baseResults/hlsl.assoc.frag.out index 0bba2ee2..a027a62c 100755 --- a/Test/baseResults/hlsl.assoc.frag.out +++ b/Test/baseResults/hlsl.assoc.frag.out @@ -1,5 +1,5 @@ hlsl.assoc.frag -Shader version: 100 +Shader version: 450 gl_FragCoord origin is upper left 0:? Sequence 0:12 Function Definition: PixelShaderFunction(vf4;vf4;vf4;vf4;vf4; (temp 4-component vector of float) @@ -35,7 +35,7 @@ gl_FragCoord origin is upper left Linked fragment stage: -Shader version: 100 +Shader version: 450 gl_FragCoord origin is upper left 0:? Sequence 0:12 Function Definition: PixelShaderFunction(vf4;vf4;vf4;vf4;vf4; (temp 4-component vector of float) @@ -76,7 +76,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "PixelShaderFunction" ExecutionMode 4 OriginUpperLeft - Source HLSL 100 + Source HLSL 450 Name 4 "PixelShaderFunction" Name 9 "a1" Name 10 "a2" diff --git a/Test/baseResults/hlsl.float1.frag.out b/Test/baseResults/hlsl.float1.frag.out index ce6ea59e..4cf0a0d1 100755 --- a/Test/baseResults/hlsl.float1.frag.out +++ b/Test/baseResults/hlsl.float1.frag.out @@ -1,5 +1,5 @@ hlsl.float1.frag -Shader version: 100 +Shader version: 450 gl_FragCoord origin is upper left 0:? Sequence 0:1 move second child to first child (temp 1-component vector of float) @@ -31,7 +31,7 @@ gl_FragCoord origin is upper left Linked fragment stage: -Shader version: 100 +Shader version: 450 gl_FragCoord origin is upper left 0:? Sequence 0:1 move second child to first child (temp 1-component vector of float) @@ -68,7 +68,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "PixelShaderFunction" ExecutionMode 4 OriginUpperLeft - Source HLSL 100 + Source HLSL 450 Name 4 "PixelShaderFunction" Name 11 "ShaderFunction(vf1;f1;" Name 9 "inFloat1" diff --git a/Test/baseResults/hlsl.float4.frag.out b/Test/baseResults/hlsl.float4.frag.out index c827f4d2..ba757c98 100755 --- a/Test/baseResults/hlsl.float4.frag.out +++ b/Test/baseResults/hlsl.float4.frag.out @@ -1,5 +1,5 @@ hlsl.float4.frag -Shader version: 100 +Shader version: 450 gl_FragCoord origin is upper left 0:? Sequence 0:1 move second child to first child (temp 4-component vector of float) @@ -24,7 +24,7 @@ gl_FragCoord origin is upper left Linked fragment stage: -Shader version: 100 +Shader version: 450 gl_FragCoord origin is upper left 0:? Sequence 0:1 move second child to first child (temp 4-component vector of float) @@ -54,7 +54,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "PixelShaderFunction" ExecutionMode 4 OriginUpperLeft - Source HLSL 100 + Source HLSL 450 Name 4 "PixelShaderFunction" Name 11 "ShaderFunction(vf4;" Name 10 "input" diff --git a/Test/baseResults/hlsl.frag.out b/Test/baseResults/hlsl.frag.out index 3ccbc898..cfed9051 100644 --- a/Test/baseResults/hlsl.frag.out +++ b/Test/baseResults/hlsl.frag.out @@ -1,5 +1,5 @@ hlsl.frag -Shader version: 100 +Shader version: 450 gl_FragCoord origin is upper left 0:? Sequence 0:1 move second child to first child (temp 4-component vector of float) @@ -64,7 +64,7 @@ gl_FragCoord origin is upper left Linked fragment stage: -Shader version: 100 +Shader version: 450 gl_FragCoord origin is upper left 0:? Sequence 0:1 move second child to first child (temp 4-component vector of float) @@ -134,7 +134,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "PixelShaderFunction" ExecutionMode 4 OriginUpperLeft - Source HLSL 100 + Source HLSL 450 Name 4 "PixelShaderFunction" Name 9 "input" Name 12 "AmbientIntensity" diff --git a/Test/baseResults/hlsl.intrinsics.frag.out b/Test/baseResults/hlsl.intrinsics.frag.out new file mode 100644 index 00000000..ec057844 --- /dev/null +++ b/Test/baseResults/hlsl.intrinsics.frag.out @@ -0,0 +1,2178 @@ +hlsl.intrinsics.frag +Shader version: 450 +gl_FragCoord origin is upper left +0:? Sequence +0:62 Function Definition: PixelShaderFunction(f1;f1;f1; (temp float) +0:2 Function Parameters: +0:2 'inF0' (temp float) +0:2 'inF1' (temp float) +0:2 'inF2' (temp float) +0:? Sequence +0:3 all (global bool) +0:3 'inF0' (temp float) +0:4 Absolute value (global float) +0:4 'inF0' (temp float) +0:5 arc cosine (global float) +0:5 'inF0' (temp float) +0:6 any (global bool) +0:6 'inF0' (temp float) +0:7 arc sine (global float) +0:7 'inF0' (temp float) +0:8 arc tangent (global float) +0:8 'inF0' (temp float) +0:9 arc tangent (global float) +0:9 'inF0' (temp float) +0:9 'inF1' (temp float) +0:10 Ceiling (global float) +0:10 'inF0' (temp float) +0:11 clamp (global float) +0:11 'inF0' (temp float) +0:11 'inF1' (temp float) +0:11 'inF2' (temp float) +0:12 cosine (global float) +0:12 'inF0' (temp float) +0:13 hyp. cosine (global float) +0:13 'inF0' (temp float) +0:14 bitCount (global uint) +0:14 Constant: +0:14 7 (const uint) +0:15 dPdx (global float) +0:15 'inF0' (temp float) +0:16 dPdxCoarse (global float) +0:16 'inF0' (temp float) +0:17 dPdxFine (global float) +0:17 'inF0' (temp float) +0:18 dPdy (global float) +0:18 'inF0' (temp float) +0:19 dPdyCoarse (global float) +0:19 'inF0' (temp float) +0:20 dPdyFine (global float) +0:20 'inF0' (temp float) +0:21 degrees (global float) +0:21 'inF0' (temp float) +0:25 exp (global float) +0:25 'inF0' (temp float) +0:26 exp2 (global float) +0:26 'inF0' (temp float) +0:27 findMSB (global int) +0:27 Constant: +0:27 7 (const int) +0:28 findLSB (global int) +0:28 Constant: +0:28 7 (const int) +0:29 Floor (global float) +0:29 'inF0' (temp float) +0:31 Function Call: fmod(f1;f1; (global float) +0:31 'inF0' (temp float) +0:31 'inF1' (temp float) +0:32 Fraction (global float) +0:32 'inF0' (temp float) +0:33 frexp (global float) +0:33 'inF0' (temp float) +0:33 'inF1' (temp float) +0:34 fwidth (global float) +0:34 'inF0' (temp float) +0:35 isinf (global bool) +0:35 'inF0' (temp float) +0:36 isnan (global bool) +0:36 'inF0' (temp float) +0:37 ldexp (global float) +0:37 'inF0' (temp float) +0:37 'inF1' (temp float) +0:38 log (global float) +0:38 'inF0' (temp float) +0:39 log2 (global float) +0:39 'inF0' (temp float) +0:40 max (global float) +0:40 'inF0' (temp float) +0:40 'inF1' (temp float) +0:41 min (global float) +0:41 'inF0' (temp float) +0:41 'inF1' (temp float) +0:43 pow (global float) +0:43 'inF0' (temp float) +0:43 'inF1' (temp float) +0:44 radians (global float) +0:44 'inF0' (temp float) +0:45 bitFieldReverse (global uint) +0:45 Constant: +0:45 2 (const uint) +0:46 roundEven (global float) +0:46 'inF0' (temp float) +0:47 inverse sqrt (global float) +0:47 'inF0' (temp float) +0:48 Sign (global float) +0:48 'inF0' (temp float) +0:49 sine (global float) +0:49 'inF0' (temp float) +0:50 hyp. sine (global float) +0:50 'inF0' (temp float) +0:51 smoothstep (global float) +0:51 'inF0' (temp float) +0:51 'inF1' (temp float) +0:51 'inF2' (temp float) +0:52 sqrt (global float) +0:52 'inF0' (temp float) +0:53 step (global float) +0:53 'inF0' (temp float) +0:53 'inF1' (temp float) +0:54 tangent (global float) +0:54 'inF0' (temp float) +0:55 hyp. tangent (global float) +0:55 'inF0' (temp float) +0:57 trunc (global float) +0:57 'inF0' (temp float) +0:59 Branch: Return with expression +0:59 Constant: +0:59 0.000000 +0:68 Function Definition: PixelShaderFunction(vf1;vf1;vf1; (temp 1-component vector of float) +0:63 Function Parameters: +0:63 'inF0' (temp 1-component vector of float) +0:63 'inF1' (temp 1-component vector of float) +0:63 'inF2' (temp 1-component vector of float) +0:? Sequence +0:65 Branch: Return with expression +0:65 Constant: +0:65 0.000000 +0:137 Function Definition: PixelShaderFunction(vf2;vf2;vf2; (temp 2-component vector of float) +0:69 Function Parameters: +0:69 'inF0' (temp 2-component vector of float) +0:69 'inF1' (temp 2-component vector of float) +0:69 'inF2' (temp 2-component vector of float) +0:? Sequence +0:70 all (global bool) +0:70 'inF0' (temp 2-component vector of float) +0:71 Absolute value (global 2-component vector of float) +0:71 'inF0' (temp 2-component vector of float) +0:72 arc cosine (global 2-component vector of float) +0:72 'inF0' (temp 2-component vector of float) +0:73 any (global bool) +0:73 'inF0' (temp 2-component vector of float) +0:74 arc sine (global 2-component vector of float) +0:74 'inF0' (temp 2-component vector of float) +0:75 arc tangent (global 2-component vector of float) +0:75 'inF0' (temp 2-component vector of float) +0:76 arc tangent (global 2-component vector of float) +0:76 'inF0' (temp 2-component vector of float) +0:76 'inF1' (temp 2-component vector of float) +0:77 Ceiling (global 2-component vector of float) +0:77 'inF0' (temp 2-component vector of float) +0:78 clamp (global 2-component vector of float) +0:78 'inF0' (temp 2-component vector of float) +0:78 'inF1' (temp 2-component vector of float) +0:78 'inF2' (temp 2-component vector of float) +0:79 cosine (global 2-component vector of float) +0:79 'inF0' (temp 2-component vector of float) +0:80 hyp. cosine (global 2-component vector of float) +0:80 'inF0' (temp 2-component vector of float) +0:? bitCount (global 2-component vector of uint) +0:? Constant: +0:? 7 (const uint) +0:? 3 (const uint) +0:82 dPdx (global 2-component vector of float) +0:82 'inF0' (temp 2-component vector of float) +0:83 dPdxCoarse (global 2-component vector of float) +0:83 'inF0' (temp 2-component vector of float) +0:84 dPdxFine (global 2-component vector of float) +0:84 'inF0' (temp 2-component vector of float) +0:85 dPdy (global 2-component vector of float) +0:85 'inF0' (temp 2-component vector of float) +0:86 dPdyCoarse (global 2-component vector of float) +0:86 'inF0' (temp 2-component vector of float) +0:87 dPdyFine (global 2-component vector of float) +0:87 'inF0' (temp 2-component vector of float) +0:88 degrees (global 2-component vector of float) +0:88 'inF0' (temp 2-component vector of float) +0:89 distance (global float) +0:89 'inF0' (temp 2-component vector of float) +0:89 'inF1' (temp 2-component vector of float) +0:90 dot-product (global float) +0:90 'inF0' (temp 2-component vector of float) +0:90 'inF1' (temp 2-component vector of float) +0:94 exp (global 2-component vector of float) +0:94 'inF0' (temp 2-component vector of float) +0:95 exp2 (global 2-component vector of float) +0:95 'inF0' (temp 2-component vector of float) +0:96 face-forward (global 2-component vector of float) +0:96 'inF0' (temp 2-component vector of float) +0:96 'inF1' (temp 2-component vector of float) +0:96 'inF2' (temp 2-component vector of float) +0:97 findMSB (global int) +0:97 Constant: +0:97 7 (const int) +0:98 findLSB (global int) +0:98 Constant: +0:98 7 (const int) +0:99 Floor (global 2-component vector of float) +0:99 'inF0' (temp 2-component vector of float) +0:101 Function Call: fmod(vf2;vf2; (global 2-component vector of float) +0:101 'inF0' (temp 2-component vector of float) +0:101 'inF1' (temp 2-component vector of float) +0:102 Fraction (global 2-component vector of float) +0:102 'inF0' (temp 2-component vector of float) +0:103 frexp (global 2-component vector of float) +0:103 'inF0' (temp 2-component vector of float) +0:103 'inF1' (temp 2-component vector of float) +0:104 fwidth (global 2-component vector of float) +0:104 'inF0' (temp 2-component vector of float) +0:105 isinf (global 2-component vector of bool) +0:105 'inF0' (temp 2-component vector of float) +0:106 isnan (global 2-component vector of bool) +0:106 'inF0' (temp 2-component vector of float) +0:107 ldexp (global 2-component vector of float) +0:107 'inF0' (temp 2-component vector of float) +0:107 'inF1' (temp 2-component vector of float) +0:108 length (global float) +0:108 'inF0' (temp 2-component vector of float) +0:109 log (global 2-component vector of float) +0:109 'inF0' (temp 2-component vector of float) +0:110 log2 (global 2-component vector of float) +0:110 'inF0' (temp 2-component vector of float) +0:111 max (global 2-component vector of float) +0:111 'inF0' (temp 2-component vector of float) +0:111 'inF1' (temp 2-component vector of float) +0:112 min (global 2-component vector of float) +0:112 'inF0' (temp 2-component vector of float) +0:112 'inF1' (temp 2-component vector of float) +0:114 normalize (global 2-component vector of float) +0:114 'inF0' (temp 2-component vector of float) +0:115 pow (global 2-component vector of float) +0:115 'inF0' (temp 2-component vector of float) +0:115 'inF1' (temp 2-component vector of float) +0:116 radians (global 2-component vector of float) +0:116 'inF0' (temp 2-component vector of float) +0:117 reflect (global 2-component vector of float) +0:117 'inF0' (temp 2-component vector of float) +0:117 'inF1' (temp 2-component vector of float) +0:118 refract (global 2-component vector of float) +0:118 'inF0' (temp 2-component vector of float) +0:118 'inF1' (temp 2-component vector of float) +0:118 Constant: +0:118 2.000000 +0:? bitFieldReverse (global 2-component vector of uint) +0:? Constant: +0:? 1 (const uint) +0:? 2 (const uint) +0:120 roundEven (global 2-component vector of float) +0:120 'inF0' (temp 2-component vector of float) +0:121 inverse sqrt (global 2-component vector of float) +0:121 'inF0' (temp 2-component vector of float) +0:122 Sign (global 2-component vector of float) +0:122 'inF0' (temp 2-component vector of float) +0:123 sine (global 2-component vector of float) +0:123 'inF0' (temp 2-component vector of float) +0:124 hyp. sine (global 2-component vector of float) +0:124 'inF0' (temp 2-component vector of float) +0:125 smoothstep (global 2-component vector of float) +0:125 'inF0' (temp 2-component vector of float) +0:125 'inF1' (temp 2-component vector of float) +0:125 'inF2' (temp 2-component vector of float) +0:126 sqrt (global 2-component vector of float) +0:126 'inF0' (temp 2-component vector of float) +0:127 step (global 2-component vector of float) +0:127 'inF0' (temp 2-component vector of float) +0:127 'inF1' (temp 2-component vector of float) +0:128 tangent (global 2-component vector of float) +0:128 'inF0' (temp 2-component vector of float) +0:129 hyp. tangent (global 2-component vector of float) +0:129 'inF0' (temp 2-component vector of float) +0:131 trunc (global 2-component vector of float) +0:131 'inF0' (temp 2-component vector of float) +0:134 Branch: Return with expression +0:? Constant: +0:? 1.000000 +0:? 2.000000 +0:207 Function Definition: PixelShaderFunction(vf3;vf3;vf3; (temp 3-component vector of float) +0:138 Function Parameters: +0:138 'inF0' (temp 3-component vector of float) +0:138 'inF1' (temp 3-component vector of float) +0:138 'inF2' (temp 3-component vector of float) +0:? Sequence +0:139 all (global bool) +0:139 'inF0' (temp 3-component vector of float) +0:140 Absolute value (global 3-component vector of float) +0:140 'inF0' (temp 3-component vector of float) +0:141 arc cosine (global 3-component vector of float) +0:141 'inF0' (temp 3-component vector of float) +0:142 any (global bool) +0:142 'inF0' (temp 3-component vector of float) +0:143 arc sine (global 3-component vector of float) +0:143 'inF0' (temp 3-component vector of float) +0:144 arc tangent (global 3-component vector of float) +0:144 'inF0' (temp 3-component vector of float) +0:145 arc tangent (global 3-component vector of float) +0:145 'inF0' (temp 3-component vector of float) +0:145 'inF1' (temp 3-component vector of float) +0:146 Ceiling (global 3-component vector of float) +0:146 'inF0' (temp 3-component vector of float) +0:147 clamp (global 3-component vector of float) +0:147 'inF0' (temp 3-component vector of float) +0:147 'inF1' (temp 3-component vector of float) +0:147 'inF2' (temp 3-component vector of float) +0:148 cosine (global 3-component vector of float) +0:148 'inF0' (temp 3-component vector of float) +0:149 hyp. cosine (global 3-component vector of float) +0:149 'inF0' (temp 3-component vector of float) +0:? bitCount (global 3-component vector of uint) +0:? Constant: +0:? 7 (const uint) +0:? 3 (const uint) +0:? 5 (const uint) +0:151 cross-product (global 3-component vector of float) +0:151 'inF0' (temp 3-component vector of float) +0:151 'inF1' (temp 3-component vector of float) +0:152 dPdx (global 3-component vector of float) +0:152 'inF0' (temp 3-component vector of float) +0:153 dPdxCoarse (global 3-component vector of float) +0:153 'inF0' (temp 3-component vector of float) +0:154 dPdxFine (global 3-component vector of float) +0:154 'inF0' (temp 3-component vector of float) +0:155 dPdy (global 3-component vector of float) +0:155 'inF0' (temp 3-component vector of float) +0:156 dPdyCoarse (global 3-component vector of float) +0:156 'inF0' (temp 3-component vector of float) +0:157 dPdyFine (global 3-component vector of float) +0:157 'inF0' (temp 3-component vector of float) +0:158 degrees (global 3-component vector of float) +0:158 'inF0' (temp 3-component vector of float) +0:159 distance (global float) +0:159 'inF0' (temp 3-component vector of float) +0:159 'inF1' (temp 3-component vector of float) +0:160 dot-product (global float) +0:160 'inF0' (temp 3-component vector of float) +0:160 'inF1' (temp 3-component vector of float) +0:164 exp (global 3-component vector of float) +0:164 'inF0' (temp 3-component vector of float) +0:165 exp2 (global 3-component vector of float) +0:165 'inF0' (temp 3-component vector of float) +0:166 face-forward (global 3-component vector of float) +0:166 'inF0' (temp 3-component vector of float) +0:166 'inF1' (temp 3-component vector of float) +0:166 'inF2' (temp 3-component vector of float) +0:167 findMSB (global int) +0:167 Constant: +0:167 7 (const int) +0:168 findLSB (global int) +0:168 Constant: +0:168 7 (const int) +0:169 Floor (global 3-component vector of float) +0:169 'inF0' (temp 3-component vector of float) +0:171 Function Call: fmod(vf3;vf3; (global 3-component vector of float) +0:171 'inF0' (temp 3-component vector of float) +0:171 'inF1' (temp 3-component vector of float) +0:172 Fraction (global 3-component vector of float) +0:172 'inF0' (temp 3-component vector of float) +0:173 frexp (global 3-component vector of float) +0:173 'inF0' (temp 3-component vector of float) +0:173 'inF1' (temp 3-component vector of float) +0:174 fwidth (global 3-component vector of float) +0:174 'inF0' (temp 3-component vector of float) +0:175 isinf (global 3-component vector of bool) +0:175 'inF0' (temp 3-component vector of float) +0:176 isnan (global 3-component vector of bool) +0:176 'inF0' (temp 3-component vector of float) +0:177 ldexp (global 3-component vector of float) +0:177 'inF0' (temp 3-component vector of float) +0:177 'inF1' (temp 3-component vector of float) +0:178 length (global float) +0:178 'inF0' (temp 3-component vector of float) +0:179 log (global 3-component vector of float) +0:179 'inF0' (temp 3-component vector of float) +0:180 log2 (global 3-component vector of float) +0:180 'inF0' (temp 3-component vector of float) +0:181 max (global 3-component vector of float) +0:181 'inF0' (temp 3-component vector of float) +0:181 'inF1' (temp 3-component vector of float) +0:182 min (global 3-component vector of float) +0:182 'inF0' (temp 3-component vector of float) +0:182 'inF1' (temp 3-component vector of float) +0:184 normalize (global 3-component vector of float) +0:184 'inF0' (temp 3-component vector of float) +0:185 pow (global 3-component vector of float) +0:185 'inF0' (temp 3-component vector of float) +0:185 'inF1' (temp 3-component vector of float) +0:186 radians (global 3-component vector of float) +0:186 'inF0' (temp 3-component vector of float) +0:187 reflect (global 3-component vector of float) +0:187 'inF0' (temp 3-component vector of float) +0:187 'inF1' (temp 3-component vector of float) +0:188 refract (global 3-component vector of float) +0:188 'inF0' (temp 3-component vector of float) +0:188 'inF1' (temp 3-component vector of float) +0:188 Constant: +0:188 2.000000 +0:? bitFieldReverse (global 3-component vector of uint) +0:? Constant: +0:? 1 (const uint) +0:? 2 (const uint) +0:? 3 (const uint) +0:190 roundEven (global 3-component vector of float) +0:190 'inF0' (temp 3-component vector of float) +0:191 inverse sqrt (global 3-component vector of float) +0:191 'inF0' (temp 3-component vector of float) +0:192 Sign (global 3-component vector of float) +0:192 'inF0' (temp 3-component vector of float) +0:193 sine (global 3-component vector of float) +0:193 'inF0' (temp 3-component vector of float) +0:194 hyp. sine (global 3-component vector of float) +0:194 'inF0' (temp 3-component vector of float) +0:195 smoothstep (global 3-component vector of float) +0:195 'inF0' (temp 3-component vector of float) +0:195 'inF1' (temp 3-component vector of float) +0:195 'inF2' (temp 3-component vector of float) +0:196 sqrt (global 3-component vector of float) +0:196 'inF0' (temp 3-component vector of float) +0:197 step (global 3-component vector of float) +0:197 'inF0' (temp 3-component vector of float) +0:197 'inF1' (temp 3-component vector of float) +0:198 tangent (global 3-component vector of float) +0:198 'inF0' (temp 3-component vector of float) +0:199 hyp. tangent (global 3-component vector of float) +0:199 'inF0' (temp 3-component vector of float) +0:201 trunc (global 3-component vector of float) +0:201 'inF0' (temp 3-component vector of float) +0:204 Branch: Return with expression +0:? Constant: +0:? 1.000000 +0:? 2.000000 +0:? 3.000000 +0:328 Function Definition: PixelShaderFunction(vf4;vf4;vf4; (temp 4-component vector of float) +0:208 Function Parameters: +0:208 'inF0' (temp 4-component vector of float) +0:208 'inF1' (temp 4-component vector of float) +0:208 'inF2' (temp 4-component vector of float) +0:? Sequence +0:209 all (global bool) +0:209 'inF0' (temp 4-component vector of float) +0:210 Absolute value (global 4-component vector of float) +0:210 'inF0' (temp 4-component vector of float) +0:211 arc cosine (global 4-component vector of float) +0:211 'inF0' (temp 4-component vector of float) +0:212 any (global bool) +0:212 'inF0' (temp 4-component vector of float) +0:213 arc sine (global 4-component vector of float) +0:213 'inF0' (temp 4-component vector of float) +0:214 arc tangent (global 4-component vector of float) +0:214 'inF0' (temp 4-component vector of float) +0:215 arc tangent (global 4-component vector of float) +0:215 'inF0' (temp 4-component vector of float) +0:215 'inF1' (temp 4-component vector of float) +0:216 Ceiling (global 4-component vector of float) +0:216 'inF0' (temp 4-component vector of float) +0:217 clamp (global 4-component vector of float) +0:217 'inF0' (temp 4-component vector of float) +0:217 'inF1' (temp 4-component vector of float) +0:217 'inF2' (temp 4-component vector of float) +0:218 cosine (global 4-component vector of float) +0:218 'inF0' (temp 4-component vector of float) +0:219 hyp. cosine (global 4-component vector of float) +0:219 'inF0' (temp 4-component vector of float) +0:? bitCount (global 4-component vector of uint) +0:? Constant: +0:? 7 (const uint) +0:? 3 (const uint) +0:? 5 (const uint) +0:? 2 (const uint) +0:221 dPdx (global 4-component vector of float) +0:221 'inF0' (temp 4-component vector of float) +0:222 dPdxCoarse (global 4-component vector of float) +0:222 'inF0' (temp 4-component vector of float) +0:223 dPdxFine (global 4-component vector of float) +0:223 'inF0' (temp 4-component vector of float) +0:224 dPdy (global 4-component vector of float) +0:224 'inF0' (temp 4-component vector of float) +0:225 dPdyCoarse (global 4-component vector of float) +0:225 'inF0' (temp 4-component vector of float) +0:226 dPdyFine (global 4-component vector of float) +0:226 'inF0' (temp 4-component vector of float) +0:227 degrees (global 4-component vector of float) +0:227 'inF0' (temp 4-component vector of float) +0:228 distance (global float) +0:228 'inF0' (temp 4-component vector of float) +0:228 'inF1' (temp 4-component vector of float) +0:229 dot-product (global float) +0:229 'inF0' (temp 4-component vector of float) +0:229 'inF1' (temp 4-component vector of float) +0:233 exp (global 4-component vector of float) +0:233 'inF0' (temp 4-component vector of float) +0:234 exp2 (global 4-component vector of float) +0:234 'inF0' (temp 4-component vector of float) +0:235 face-forward (global 4-component vector of float) +0:235 'inF0' (temp 4-component vector of float) +0:235 'inF1' (temp 4-component vector of float) +0:235 'inF2' (temp 4-component vector of float) +0:236 findMSB (global int) +0:236 Constant: +0:236 7 (const int) +0:237 findLSB (global int) +0:237 Constant: +0:237 7 (const int) +0:238 Floor (global 4-component vector of float) +0:238 'inF0' (temp 4-component vector of float) +0:240 Function Call: fmod(vf4;vf4; (global 4-component vector of float) +0:240 'inF0' (temp 4-component vector of float) +0:240 'inF1' (temp 4-component vector of float) +0:241 Fraction (global 4-component vector of float) +0:241 'inF0' (temp 4-component vector of float) +0:242 frexp (global 4-component vector of float) +0:242 'inF0' (temp 4-component vector of float) +0:242 'inF1' (temp 4-component vector of float) +0:243 fwidth (global 4-component vector of float) +0:243 'inF0' (temp 4-component vector of float) +0:244 isinf (global 4-component vector of bool) +0:244 'inF0' (temp 4-component vector of float) +0:245 isnan (global 4-component vector of bool) +0:245 'inF0' (temp 4-component vector of float) +0:246 ldexp (global 4-component vector of float) +0:246 'inF0' (temp 4-component vector of float) +0:246 'inF1' (temp 4-component vector of float) +0:247 length (global float) +0:247 'inF0' (temp 4-component vector of float) +0:248 log (global 4-component vector of float) +0:248 'inF0' (temp 4-component vector of float) +0:249 log2 (global 4-component vector of float) +0:249 'inF0' (temp 4-component vector of float) +0:250 max (global 4-component vector of float) +0:250 'inF0' (temp 4-component vector of float) +0:250 'inF1' (temp 4-component vector of float) +0:251 min (global 4-component vector of float) +0:251 'inF0' (temp 4-component vector of float) +0:251 'inF1' (temp 4-component vector of float) +0:253 normalize (global 4-component vector of float) +0:253 'inF0' (temp 4-component vector of float) +0:254 pow (global 4-component vector of float) +0:254 'inF0' (temp 4-component vector of float) +0:254 'inF1' (temp 4-component vector of float) +0:255 radians (global 4-component vector of float) +0:255 'inF0' (temp 4-component vector of float) +0:256 reflect (global 4-component vector of float) +0:256 'inF0' (temp 4-component vector of float) +0:256 'inF1' (temp 4-component vector of float) +0:257 refract (global 4-component vector of float) +0:257 'inF0' (temp 4-component vector of float) +0:257 'inF1' (temp 4-component vector of float) +0:257 Constant: +0:257 2.000000 +0:? bitFieldReverse (global 4-component vector of uint) +0:? Constant: +0:? 1 (const uint) +0:? 2 (const uint) +0:? 3 (const uint) +0:? 4 (const uint) +0:259 roundEven (global 4-component vector of float) +0:259 'inF0' (temp 4-component vector of float) +0:260 inverse sqrt (global 4-component vector of float) +0:260 'inF0' (temp 4-component vector of float) +0:261 Sign (global 4-component vector of float) +0:261 'inF0' (temp 4-component vector of float) +0:262 sine (global 4-component vector of float) +0:262 'inF0' (temp 4-component vector of float) +0:263 hyp. sine (global 4-component vector of float) +0:263 'inF0' (temp 4-component vector of float) +0:264 smoothstep (global 4-component vector of float) +0:264 'inF0' (temp 4-component vector of float) +0:264 'inF1' (temp 4-component vector of float) +0:264 'inF2' (temp 4-component vector of float) +0:265 sqrt (global 4-component vector of float) +0:265 'inF0' (temp 4-component vector of float) +0:266 step (global 4-component vector of float) +0:266 'inF0' (temp 4-component vector of float) +0:266 'inF1' (temp 4-component vector of float) +0:267 tangent (global 4-component vector of float) +0:267 'inF0' (temp 4-component vector of float) +0:268 hyp. tangent (global 4-component vector of float) +0:268 'inF0' (temp 4-component vector of float) +0:270 trunc (global 4-component vector of float) +0:270 'inF0' (temp 4-component vector of float) +0:273 Branch: Return with expression +0:? Constant: +0:? 1.000000 +0:? 2.000000 +0:? 3.000000 +0:? 4.000000 +0:337 Function Definition: PixelShaderFunction(mf22;mf22;mf22; (temp 2X2 matrix of float) +0:329 Function Parameters: +0:329 'inF0' (temp 2X2 matrix of float) +0:329 'inF1' (temp 2X2 matrix of float) +0:329 'inF2' (temp 2X2 matrix of float) +0:? Sequence +0:331 all (global bool) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 Absolute value (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 arc cosine (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 any (global bool) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 arc sine (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 arc tangent (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 arc tangent (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 'inF1' (temp 2X2 matrix of float) +0:331 Ceiling (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 clamp (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 'inF1' (temp 2X2 matrix of float) +0:331 'inF2' (temp 2X2 matrix of float) +0:331 cosine (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 hyp. cosine (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 dPdx (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 dPdxCoarse (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 dPdxFine (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 dPdy (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 dPdyCoarse (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 dPdyFine (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 degrees (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 determinant (global float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 exp (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 exp2 (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 findMSB (global int) +0:331 Constant: +0:331 7 (const int) +0:331 findLSB (global int) +0:331 Constant: +0:331 7 (const int) +0:331 Floor (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 Function Call: fmod(mf22;mf22; (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 'inF1' (temp 2X2 matrix of float) +0:331 Fraction (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 frexp (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 'inF1' (temp 2X2 matrix of float) +0:331 fwidth (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 ldexp (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 'inF1' (temp 2X2 matrix of float) +0:331 log (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 log2 (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 max (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 'inF1' (temp 2X2 matrix of float) +0:331 min (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 'inF1' (temp 2X2 matrix of float) +0:331 pow (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 'inF1' (temp 2X2 matrix of float) +0:331 radians (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 roundEven (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 inverse sqrt (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 Sign (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 sine (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 hyp. sine (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 smoothstep (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 'inF1' (temp 2X2 matrix of float) +0:331 'inF2' (temp 2X2 matrix of float) +0:331 sqrt (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 step (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 'inF1' (temp 2X2 matrix of float) +0:331 tangent (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 hyp. tangent (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 transpose (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 trunc (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:334 Branch: Return with expression +0:? Constant: +0:? 2.000000 +0:? 2.000000 +0:? 2.000000 +0:? 2.000000 +0:346 Function Definition: PixelShaderFunction(mf33;mf33;mf33; (temp 3X3 matrix of float) +0:338 Function Parameters: +0:338 'inF0' (temp 3X3 matrix of float) +0:338 'inF1' (temp 3X3 matrix of float) +0:338 'inF2' (temp 3X3 matrix of float) +0:? Sequence +0:340 all (global bool) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 Absolute value (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 arc cosine (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 any (global bool) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 arc sine (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 arc tangent (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 arc tangent (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 'inF1' (temp 3X3 matrix of float) +0:340 Ceiling (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 clamp (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 'inF1' (temp 3X3 matrix of float) +0:340 'inF2' (temp 3X3 matrix of float) +0:340 cosine (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 hyp. cosine (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 dPdx (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 dPdxCoarse (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 dPdxFine (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 dPdy (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 dPdyCoarse (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 dPdyFine (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 degrees (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 determinant (global float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 exp (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 exp2 (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 findMSB (global int) +0:340 Constant: +0:340 7 (const int) +0:340 findLSB (global int) +0:340 Constant: +0:340 7 (const int) +0:340 Floor (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 Function Call: fmod(mf33;mf33; (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 'inF1' (temp 3X3 matrix of float) +0:340 Fraction (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 frexp (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 'inF1' (temp 3X3 matrix of float) +0:340 fwidth (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 ldexp (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 'inF1' (temp 3X3 matrix of float) +0:340 log (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 log2 (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 max (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 'inF1' (temp 3X3 matrix of float) +0:340 min (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 'inF1' (temp 3X3 matrix of float) +0:340 pow (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 'inF1' (temp 3X3 matrix of float) +0:340 radians (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 roundEven (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 inverse sqrt (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 Sign (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 sine (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 hyp. sine (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 smoothstep (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 'inF1' (temp 3X3 matrix of float) +0:340 'inF2' (temp 3X3 matrix of float) +0:340 sqrt (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 step (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 'inF1' (temp 3X3 matrix of float) +0:340 tangent (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 hyp. tangent (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 transpose (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 trunc (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:343 Branch: Return with expression +0:? Constant: +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:354 Function Definition: PixelShaderFunction(mf44;mf44;mf44; (temp 4X4 matrix of float) +0:347 Function Parameters: +0:347 'inF0' (temp 4X4 matrix of float) +0:347 'inF1' (temp 4X4 matrix of float) +0:347 'inF2' (temp 4X4 matrix of float) +0:? Sequence +0:349 all (global bool) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 Absolute value (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 arc cosine (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 any (global bool) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 arc sine (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 arc tangent (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 arc tangent (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 'inF1' (temp 4X4 matrix of float) +0:349 Ceiling (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 clamp (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 'inF1' (temp 4X4 matrix of float) +0:349 'inF2' (temp 4X4 matrix of float) +0:349 cosine (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 hyp. cosine (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 dPdx (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 dPdxCoarse (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 dPdxFine (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 dPdy (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 dPdyCoarse (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 dPdyFine (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 degrees (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 determinant (global float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 exp (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 exp2 (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 findMSB (global int) +0:349 Constant: +0:349 7 (const int) +0:349 findLSB (global int) +0:349 Constant: +0:349 7 (const int) +0:349 Floor (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 Function Call: fmod(mf44;mf44; (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 'inF1' (temp 4X4 matrix of float) +0:349 Fraction (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 frexp (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 'inF1' (temp 4X4 matrix of float) +0:349 fwidth (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 ldexp (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 'inF1' (temp 4X4 matrix of float) +0:349 log (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 log2 (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 max (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 'inF1' (temp 4X4 matrix of float) +0:349 min (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 'inF1' (temp 4X4 matrix of float) +0:349 pow (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 'inF1' (temp 4X4 matrix of float) +0:349 radians (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 roundEven (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 inverse sqrt (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 Sign (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 sine (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 hyp. sine (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 smoothstep (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 'inF1' (temp 4X4 matrix of float) +0:349 'inF2' (temp 4X4 matrix of float) +0:349 sqrt (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 step (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 'inF1' (temp 4X4 matrix of float) +0:349 tangent (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 hyp. tangent (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 transpose (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 trunc (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:352 Branch: Return with expression +0:? Constant: +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? Linker Objects + + +Linked fragment stage: + + +Shader version: 450 +gl_FragCoord origin is upper left +0:? Sequence +0:62 Function Definition: PixelShaderFunction(f1;f1;f1; (temp float) +0:2 Function Parameters: +0:2 'inF0' (temp float) +0:2 'inF1' (temp float) +0:2 'inF2' (temp float) +0:? Sequence +0:3 all (global bool) +0:3 'inF0' (temp float) +0:4 Absolute value (global float) +0:4 'inF0' (temp float) +0:5 arc cosine (global float) +0:5 'inF0' (temp float) +0:6 any (global bool) +0:6 'inF0' (temp float) +0:7 arc sine (global float) +0:7 'inF0' (temp float) +0:8 arc tangent (global float) +0:8 'inF0' (temp float) +0:9 arc tangent (global float) +0:9 'inF0' (temp float) +0:9 'inF1' (temp float) +0:10 Ceiling (global float) +0:10 'inF0' (temp float) +0:11 clamp (global float) +0:11 'inF0' (temp float) +0:11 'inF1' (temp float) +0:11 'inF2' (temp float) +0:12 cosine (global float) +0:12 'inF0' (temp float) +0:13 hyp. cosine (global float) +0:13 'inF0' (temp float) +0:14 bitCount (global uint) +0:14 Constant: +0:14 7 (const uint) +0:15 dPdx (global float) +0:15 'inF0' (temp float) +0:16 dPdxCoarse (global float) +0:16 'inF0' (temp float) +0:17 dPdxFine (global float) +0:17 'inF0' (temp float) +0:18 dPdy (global float) +0:18 'inF0' (temp float) +0:19 dPdyCoarse (global float) +0:19 'inF0' (temp float) +0:20 dPdyFine (global float) +0:20 'inF0' (temp float) +0:21 degrees (global float) +0:21 'inF0' (temp float) +0:25 exp (global float) +0:25 'inF0' (temp float) +0:26 exp2 (global float) +0:26 'inF0' (temp float) +0:27 findMSB (global int) +0:27 Constant: +0:27 7 (const int) +0:28 findLSB (global int) +0:28 Constant: +0:28 7 (const int) +0:29 Floor (global float) +0:29 'inF0' (temp float) +0:31 Function Call: fmod(f1;f1; (global float) +0:31 'inF0' (temp float) +0:31 'inF1' (temp float) +0:32 Fraction (global float) +0:32 'inF0' (temp float) +0:33 frexp (global float) +0:33 'inF0' (temp float) +0:33 'inF1' (temp float) +0:34 fwidth (global float) +0:34 'inF0' (temp float) +0:35 isinf (global bool) +0:35 'inF0' (temp float) +0:36 isnan (global bool) +0:36 'inF0' (temp float) +0:37 ldexp (global float) +0:37 'inF0' (temp float) +0:37 'inF1' (temp float) +0:38 log (global float) +0:38 'inF0' (temp float) +0:39 log2 (global float) +0:39 'inF0' (temp float) +0:40 max (global float) +0:40 'inF0' (temp float) +0:40 'inF1' (temp float) +0:41 min (global float) +0:41 'inF0' (temp float) +0:41 'inF1' (temp float) +0:43 pow (global float) +0:43 'inF0' (temp float) +0:43 'inF1' (temp float) +0:44 radians (global float) +0:44 'inF0' (temp float) +0:45 bitFieldReverse (global uint) +0:45 Constant: +0:45 2 (const uint) +0:46 roundEven (global float) +0:46 'inF0' (temp float) +0:47 inverse sqrt (global float) +0:47 'inF0' (temp float) +0:48 Sign (global float) +0:48 'inF0' (temp float) +0:49 sine (global float) +0:49 'inF0' (temp float) +0:50 hyp. sine (global float) +0:50 'inF0' (temp float) +0:51 smoothstep (global float) +0:51 'inF0' (temp float) +0:51 'inF1' (temp float) +0:51 'inF2' (temp float) +0:52 sqrt (global float) +0:52 'inF0' (temp float) +0:53 step (global float) +0:53 'inF0' (temp float) +0:53 'inF1' (temp float) +0:54 tangent (global float) +0:54 'inF0' (temp float) +0:55 hyp. tangent (global float) +0:55 'inF0' (temp float) +0:57 trunc (global float) +0:57 'inF0' (temp float) +0:59 Branch: Return with expression +0:59 Constant: +0:59 0.000000 +0:68 Function Definition: PixelShaderFunction(vf1;vf1;vf1; (temp 1-component vector of float) +0:63 Function Parameters: +0:63 'inF0' (temp 1-component vector of float) +0:63 'inF1' (temp 1-component vector of float) +0:63 'inF2' (temp 1-component vector of float) +0:? Sequence +0:65 Branch: Return with expression +0:65 Constant: +0:65 0.000000 +0:137 Function Definition: PixelShaderFunction(vf2;vf2;vf2; (temp 2-component vector of float) +0:69 Function Parameters: +0:69 'inF0' (temp 2-component vector of float) +0:69 'inF1' (temp 2-component vector of float) +0:69 'inF2' (temp 2-component vector of float) +0:? Sequence +0:70 all (global bool) +0:70 'inF0' (temp 2-component vector of float) +0:71 Absolute value (global 2-component vector of float) +0:71 'inF0' (temp 2-component vector of float) +0:72 arc cosine (global 2-component vector of float) +0:72 'inF0' (temp 2-component vector of float) +0:73 any (global bool) +0:73 'inF0' (temp 2-component vector of float) +0:74 arc sine (global 2-component vector of float) +0:74 'inF0' (temp 2-component vector of float) +0:75 arc tangent (global 2-component vector of float) +0:75 'inF0' (temp 2-component vector of float) +0:76 arc tangent (global 2-component vector of float) +0:76 'inF0' (temp 2-component vector of float) +0:76 'inF1' (temp 2-component vector of float) +0:77 Ceiling (global 2-component vector of float) +0:77 'inF0' (temp 2-component vector of float) +0:78 clamp (global 2-component vector of float) +0:78 'inF0' (temp 2-component vector of float) +0:78 'inF1' (temp 2-component vector of float) +0:78 'inF2' (temp 2-component vector of float) +0:79 cosine (global 2-component vector of float) +0:79 'inF0' (temp 2-component vector of float) +0:80 hyp. cosine (global 2-component vector of float) +0:80 'inF0' (temp 2-component vector of float) +0:? bitCount (global 2-component vector of uint) +0:? Constant: +0:? 7 (const uint) +0:? 3 (const uint) +0:82 dPdx (global 2-component vector of float) +0:82 'inF0' (temp 2-component vector of float) +0:83 dPdxCoarse (global 2-component vector of float) +0:83 'inF0' (temp 2-component vector of float) +0:84 dPdxFine (global 2-component vector of float) +0:84 'inF0' (temp 2-component vector of float) +0:85 dPdy (global 2-component vector of float) +0:85 'inF0' (temp 2-component vector of float) +0:86 dPdyCoarse (global 2-component vector of float) +0:86 'inF0' (temp 2-component vector of float) +0:87 dPdyFine (global 2-component vector of float) +0:87 'inF0' (temp 2-component vector of float) +0:88 degrees (global 2-component vector of float) +0:88 'inF0' (temp 2-component vector of float) +0:89 distance (global float) +0:89 'inF0' (temp 2-component vector of float) +0:89 'inF1' (temp 2-component vector of float) +0:90 dot-product (global float) +0:90 'inF0' (temp 2-component vector of float) +0:90 'inF1' (temp 2-component vector of float) +0:94 exp (global 2-component vector of float) +0:94 'inF0' (temp 2-component vector of float) +0:95 exp2 (global 2-component vector of float) +0:95 'inF0' (temp 2-component vector of float) +0:96 face-forward (global 2-component vector of float) +0:96 'inF0' (temp 2-component vector of float) +0:96 'inF1' (temp 2-component vector of float) +0:96 'inF2' (temp 2-component vector of float) +0:97 findMSB (global int) +0:97 Constant: +0:97 7 (const int) +0:98 findLSB (global int) +0:98 Constant: +0:98 7 (const int) +0:99 Floor (global 2-component vector of float) +0:99 'inF0' (temp 2-component vector of float) +0:101 Function Call: fmod(vf2;vf2; (global 2-component vector of float) +0:101 'inF0' (temp 2-component vector of float) +0:101 'inF1' (temp 2-component vector of float) +0:102 Fraction (global 2-component vector of float) +0:102 'inF0' (temp 2-component vector of float) +0:103 frexp (global 2-component vector of float) +0:103 'inF0' (temp 2-component vector of float) +0:103 'inF1' (temp 2-component vector of float) +0:104 fwidth (global 2-component vector of float) +0:104 'inF0' (temp 2-component vector of float) +0:105 isinf (global 2-component vector of bool) +0:105 'inF0' (temp 2-component vector of float) +0:106 isnan (global 2-component vector of bool) +0:106 'inF0' (temp 2-component vector of float) +0:107 ldexp (global 2-component vector of float) +0:107 'inF0' (temp 2-component vector of float) +0:107 'inF1' (temp 2-component vector of float) +0:108 length (global float) +0:108 'inF0' (temp 2-component vector of float) +0:109 log (global 2-component vector of float) +0:109 'inF0' (temp 2-component vector of float) +0:110 log2 (global 2-component vector of float) +0:110 'inF0' (temp 2-component vector of float) +0:111 max (global 2-component vector of float) +0:111 'inF0' (temp 2-component vector of float) +0:111 'inF1' (temp 2-component vector of float) +0:112 min (global 2-component vector of float) +0:112 'inF0' (temp 2-component vector of float) +0:112 'inF1' (temp 2-component vector of float) +0:114 normalize (global 2-component vector of float) +0:114 'inF0' (temp 2-component vector of float) +0:115 pow (global 2-component vector of float) +0:115 'inF0' (temp 2-component vector of float) +0:115 'inF1' (temp 2-component vector of float) +0:116 radians (global 2-component vector of float) +0:116 'inF0' (temp 2-component vector of float) +0:117 reflect (global 2-component vector of float) +0:117 'inF0' (temp 2-component vector of float) +0:117 'inF1' (temp 2-component vector of float) +0:118 refract (global 2-component vector of float) +0:118 'inF0' (temp 2-component vector of float) +0:118 'inF1' (temp 2-component vector of float) +0:118 Constant: +0:118 2.000000 +0:? bitFieldReverse (global 2-component vector of uint) +0:? Constant: +0:? 1 (const uint) +0:? 2 (const uint) +0:120 roundEven (global 2-component vector of float) +0:120 'inF0' (temp 2-component vector of float) +0:121 inverse sqrt (global 2-component vector of float) +0:121 'inF0' (temp 2-component vector of float) +0:122 Sign (global 2-component vector of float) +0:122 'inF0' (temp 2-component vector of float) +0:123 sine (global 2-component vector of float) +0:123 'inF0' (temp 2-component vector of float) +0:124 hyp. sine (global 2-component vector of float) +0:124 'inF0' (temp 2-component vector of float) +0:125 smoothstep (global 2-component vector of float) +0:125 'inF0' (temp 2-component vector of float) +0:125 'inF1' (temp 2-component vector of float) +0:125 'inF2' (temp 2-component vector of float) +0:126 sqrt (global 2-component vector of float) +0:126 'inF0' (temp 2-component vector of float) +0:127 step (global 2-component vector of float) +0:127 'inF0' (temp 2-component vector of float) +0:127 'inF1' (temp 2-component vector of float) +0:128 tangent (global 2-component vector of float) +0:128 'inF0' (temp 2-component vector of float) +0:129 hyp. tangent (global 2-component vector of float) +0:129 'inF0' (temp 2-component vector of float) +0:131 trunc (global 2-component vector of float) +0:131 'inF0' (temp 2-component vector of float) +0:134 Branch: Return with expression +0:? Constant: +0:? 1.000000 +0:? 2.000000 +0:207 Function Definition: PixelShaderFunction(vf3;vf3;vf3; (temp 3-component vector of float) +0:138 Function Parameters: +0:138 'inF0' (temp 3-component vector of float) +0:138 'inF1' (temp 3-component vector of float) +0:138 'inF2' (temp 3-component vector of float) +0:? Sequence +0:139 all (global bool) +0:139 'inF0' (temp 3-component vector of float) +0:140 Absolute value (global 3-component vector of float) +0:140 'inF0' (temp 3-component vector of float) +0:141 arc cosine (global 3-component vector of float) +0:141 'inF0' (temp 3-component vector of float) +0:142 any (global bool) +0:142 'inF0' (temp 3-component vector of float) +0:143 arc sine (global 3-component vector of float) +0:143 'inF0' (temp 3-component vector of float) +0:144 arc tangent (global 3-component vector of float) +0:144 'inF0' (temp 3-component vector of float) +0:145 arc tangent (global 3-component vector of float) +0:145 'inF0' (temp 3-component vector of float) +0:145 'inF1' (temp 3-component vector of float) +0:146 Ceiling (global 3-component vector of float) +0:146 'inF0' (temp 3-component vector of float) +0:147 clamp (global 3-component vector of float) +0:147 'inF0' (temp 3-component vector of float) +0:147 'inF1' (temp 3-component vector of float) +0:147 'inF2' (temp 3-component vector of float) +0:148 cosine (global 3-component vector of float) +0:148 'inF0' (temp 3-component vector of float) +0:149 hyp. cosine (global 3-component vector of float) +0:149 'inF0' (temp 3-component vector of float) +0:? bitCount (global 3-component vector of uint) +0:? Constant: +0:? 7 (const uint) +0:? 3 (const uint) +0:? 5 (const uint) +0:151 cross-product (global 3-component vector of float) +0:151 'inF0' (temp 3-component vector of float) +0:151 'inF1' (temp 3-component vector of float) +0:152 dPdx (global 3-component vector of float) +0:152 'inF0' (temp 3-component vector of float) +0:153 dPdxCoarse (global 3-component vector of float) +0:153 'inF0' (temp 3-component vector of float) +0:154 dPdxFine (global 3-component vector of float) +0:154 'inF0' (temp 3-component vector of float) +0:155 dPdy (global 3-component vector of float) +0:155 'inF0' (temp 3-component vector of float) +0:156 dPdyCoarse (global 3-component vector of float) +0:156 'inF0' (temp 3-component vector of float) +0:157 dPdyFine (global 3-component vector of float) +0:157 'inF0' (temp 3-component vector of float) +0:158 degrees (global 3-component vector of float) +0:158 'inF0' (temp 3-component vector of float) +0:159 distance (global float) +0:159 'inF0' (temp 3-component vector of float) +0:159 'inF1' (temp 3-component vector of float) +0:160 dot-product (global float) +0:160 'inF0' (temp 3-component vector of float) +0:160 'inF1' (temp 3-component vector of float) +0:164 exp (global 3-component vector of float) +0:164 'inF0' (temp 3-component vector of float) +0:165 exp2 (global 3-component vector of float) +0:165 'inF0' (temp 3-component vector of float) +0:166 face-forward (global 3-component vector of float) +0:166 'inF0' (temp 3-component vector of float) +0:166 'inF1' (temp 3-component vector of float) +0:166 'inF2' (temp 3-component vector of float) +0:167 findMSB (global int) +0:167 Constant: +0:167 7 (const int) +0:168 findLSB (global int) +0:168 Constant: +0:168 7 (const int) +0:169 Floor (global 3-component vector of float) +0:169 'inF0' (temp 3-component vector of float) +0:171 Function Call: fmod(vf3;vf3; (global 3-component vector of float) +0:171 'inF0' (temp 3-component vector of float) +0:171 'inF1' (temp 3-component vector of float) +0:172 Fraction (global 3-component vector of float) +0:172 'inF0' (temp 3-component vector of float) +0:173 frexp (global 3-component vector of float) +0:173 'inF0' (temp 3-component vector of float) +0:173 'inF1' (temp 3-component vector of float) +0:174 fwidth (global 3-component vector of float) +0:174 'inF0' (temp 3-component vector of float) +0:175 isinf (global 3-component vector of bool) +0:175 'inF0' (temp 3-component vector of float) +0:176 isnan (global 3-component vector of bool) +0:176 'inF0' (temp 3-component vector of float) +0:177 ldexp (global 3-component vector of float) +0:177 'inF0' (temp 3-component vector of float) +0:177 'inF1' (temp 3-component vector of float) +0:178 length (global float) +0:178 'inF0' (temp 3-component vector of float) +0:179 log (global 3-component vector of float) +0:179 'inF0' (temp 3-component vector of float) +0:180 log2 (global 3-component vector of float) +0:180 'inF0' (temp 3-component vector of float) +0:181 max (global 3-component vector of float) +0:181 'inF0' (temp 3-component vector of float) +0:181 'inF1' (temp 3-component vector of float) +0:182 min (global 3-component vector of float) +0:182 'inF0' (temp 3-component vector of float) +0:182 'inF1' (temp 3-component vector of float) +0:184 normalize (global 3-component vector of float) +0:184 'inF0' (temp 3-component vector of float) +0:185 pow (global 3-component vector of float) +0:185 'inF0' (temp 3-component vector of float) +0:185 'inF1' (temp 3-component vector of float) +0:186 radians (global 3-component vector of float) +0:186 'inF0' (temp 3-component vector of float) +0:187 reflect (global 3-component vector of float) +0:187 'inF0' (temp 3-component vector of float) +0:187 'inF1' (temp 3-component vector of float) +0:188 refract (global 3-component vector of float) +0:188 'inF0' (temp 3-component vector of float) +0:188 'inF1' (temp 3-component vector of float) +0:188 Constant: +0:188 2.000000 +0:? bitFieldReverse (global 3-component vector of uint) +0:? Constant: +0:? 1 (const uint) +0:? 2 (const uint) +0:? 3 (const uint) +0:190 roundEven (global 3-component vector of float) +0:190 'inF0' (temp 3-component vector of float) +0:191 inverse sqrt (global 3-component vector of float) +0:191 'inF0' (temp 3-component vector of float) +0:192 Sign (global 3-component vector of float) +0:192 'inF0' (temp 3-component vector of float) +0:193 sine (global 3-component vector of float) +0:193 'inF0' (temp 3-component vector of float) +0:194 hyp. sine (global 3-component vector of float) +0:194 'inF0' (temp 3-component vector of float) +0:195 smoothstep (global 3-component vector of float) +0:195 'inF0' (temp 3-component vector of float) +0:195 'inF1' (temp 3-component vector of float) +0:195 'inF2' (temp 3-component vector of float) +0:196 sqrt (global 3-component vector of float) +0:196 'inF0' (temp 3-component vector of float) +0:197 step (global 3-component vector of float) +0:197 'inF0' (temp 3-component vector of float) +0:197 'inF1' (temp 3-component vector of float) +0:198 tangent (global 3-component vector of float) +0:198 'inF0' (temp 3-component vector of float) +0:199 hyp. tangent (global 3-component vector of float) +0:199 'inF0' (temp 3-component vector of float) +0:201 trunc (global 3-component vector of float) +0:201 'inF0' (temp 3-component vector of float) +0:204 Branch: Return with expression +0:? Constant: +0:? 1.000000 +0:? 2.000000 +0:? 3.000000 +0:328 Function Definition: PixelShaderFunction(vf4;vf4;vf4; (temp 4-component vector of float) +0:208 Function Parameters: +0:208 'inF0' (temp 4-component vector of float) +0:208 'inF1' (temp 4-component vector of float) +0:208 'inF2' (temp 4-component vector of float) +0:? Sequence +0:209 all (global bool) +0:209 'inF0' (temp 4-component vector of float) +0:210 Absolute value (global 4-component vector of float) +0:210 'inF0' (temp 4-component vector of float) +0:211 arc cosine (global 4-component vector of float) +0:211 'inF0' (temp 4-component vector of float) +0:212 any (global bool) +0:212 'inF0' (temp 4-component vector of float) +0:213 arc sine (global 4-component vector of float) +0:213 'inF0' (temp 4-component vector of float) +0:214 arc tangent (global 4-component vector of float) +0:214 'inF0' (temp 4-component vector of float) +0:215 arc tangent (global 4-component vector of float) +0:215 'inF0' (temp 4-component vector of float) +0:215 'inF1' (temp 4-component vector of float) +0:216 Ceiling (global 4-component vector of float) +0:216 'inF0' (temp 4-component vector of float) +0:217 clamp (global 4-component vector of float) +0:217 'inF0' (temp 4-component vector of float) +0:217 'inF1' (temp 4-component vector of float) +0:217 'inF2' (temp 4-component vector of float) +0:218 cosine (global 4-component vector of float) +0:218 'inF0' (temp 4-component vector of float) +0:219 hyp. cosine (global 4-component vector of float) +0:219 'inF0' (temp 4-component vector of float) +0:? bitCount (global 4-component vector of uint) +0:? Constant: +0:? 7 (const uint) +0:? 3 (const uint) +0:? 5 (const uint) +0:? 2 (const uint) +0:221 dPdx (global 4-component vector of float) +0:221 'inF0' (temp 4-component vector of float) +0:222 dPdxCoarse (global 4-component vector of float) +0:222 'inF0' (temp 4-component vector of float) +0:223 dPdxFine (global 4-component vector of float) +0:223 'inF0' (temp 4-component vector of float) +0:224 dPdy (global 4-component vector of float) +0:224 'inF0' (temp 4-component vector of float) +0:225 dPdyCoarse (global 4-component vector of float) +0:225 'inF0' (temp 4-component vector of float) +0:226 dPdyFine (global 4-component vector of float) +0:226 'inF0' (temp 4-component vector of float) +0:227 degrees (global 4-component vector of float) +0:227 'inF0' (temp 4-component vector of float) +0:228 distance (global float) +0:228 'inF0' (temp 4-component vector of float) +0:228 'inF1' (temp 4-component vector of float) +0:229 dot-product (global float) +0:229 'inF0' (temp 4-component vector of float) +0:229 'inF1' (temp 4-component vector of float) +0:233 exp (global 4-component vector of float) +0:233 'inF0' (temp 4-component vector of float) +0:234 exp2 (global 4-component vector of float) +0:234 'inF0' (temp 4-component vector of float) +0:235 face-forward (global 4-component vector of float) +0:235 'inF0' (temp 4-component vector of float) +0:235 'inF1' (temp 4-component vector of float) +0:235 'inF2' (temp 4-component vector of float) +0:236 findMSB (global int) +0:236 Constant: +0:236 7 (const int) +0:237 findLSB (global int) +0:237 Constant: +0:237 7 (const int) +0:238 Floor (global 4-component vector of float) +0:238 'inF0' (temp 4-component vector of float) +0:240 Function Call: fmod(vf4;vf4; (global 4-component vector of float) +0:240 'inF0' (temp 4-component vector of float) +0:240 'inF1' (temp 4-component vector of float) +0:241 Fraction (global 4-component vector of float) +0:241 'inF0' (temp 4-component vector of float) +0:242 frexp (global 4-component vector of float) +0:242 'inF0' (temp 4-component vector of float) +0:242 'inF1' (temp 4-component vector of float) +0:243 fwidth (global 4-component vector of float) +0:243 'inF0' (temp 4-component vector of float) +0:244 isinf (global 4-component vector of bool) +0:244 'inF0' (temp 4-component vector of float) +0:245 isnan (global 4-component vector of bool) +0:245 'inF0' (temp 4-component vector of float) +0:246 ldexp (global 4-component vector of float) +0:246 'inF0' (temp 4-component vector of float) +0:246 'inF1' (temp 4-component vector of float) +0:247 length (global float) +0:247 'inF0' (temp 4-component vector of float) +0:248 log (global 4-component vector of float) +0:248 'inF0' (temp 4-component vector of float) +0:249 log2 (global 4-component vector of float) +0:249 'inF0' (temp 4-component vector of float) +0:250 max (global 4-component vector of float) +0:250 'inF0' (temp 4-component vector of float) +0:250 'inF1' (temp 4-component vector of float) +0:251 min (global 4-component vector of float) +0:251 'inF0' (temp 4-component vector of float) +0:251 'inF1' (temp 4-component vector of float) +0:253 normalize (global 4-component vector of float) +0:253 'inF0' (temp 4-component vector of float) +0:254 pow (global 4-component vector of float) +0:254 'inF0' (temp 4-component vector of float) +0:254 'inF1' (temp 4-component vector of float) +0:255 radians (global 4-component vector of float) +0:255 'inF0' (temp 4-component vector of float) +0:256 reflect (global 4-component vector of float) +0:256 'inF0' (temp 4-component vector of float) +0:256 'inF1' (temp 4-component vector of float) +0:257 refract (global 4-component vector of float) +0:257 'inF0' (temp 4-component vector of float) +0:257 'inF1' (temp 4-component vector of float) +0:257 Constant: +0:257 2.000000 +0:? bitFieldReverse (global 4-component vector of uint) +0:? Constant: +0:? 1 (const uint) +0:? 2 (const uint) +0:? 3 (const uint) +0:? 4 (const uint) +0:259 roundEven (global 4-component vector of float) +0:259 'inF0' (temp 4-component vector of float) +0:260 inverse sqrt (global 4-component vector of float) +0:260 'inF0' (temp 4-component vector of float) +0:261 Sign (global 4-component vector of float) +0:261 'inF0' (temp 4-component vector of float) +0:262 sine (global 4-component vector of float) +0:262 'inF0' (temp 4-component vector of float) +0:263 hyp. sine (global 4-component vector of float) +0:263 'inF0' (temp 4-component vector of float) +0:264 smoothstep (global 4-component vector of float) +0:264 'inF0' (temp 4-component vector of float) +0:264 'inF1' (temp 4-component vector of float) +0:264 'inF2' (temp 4-component vector of float) +0:265 sqrt (global 4-component vector of float) +0:265 'inF0' (temp 4-component vector of float) +0:266 step (global 4-component vector of float) +0:266 'inF0' (temp 4-component vector of float) +0:266 'inF1' (temp 4-component vector of float) +0:267 tangent (global 4-component vector of float) +0:267 'inF0' (temp 4-component vector of float) +0:268 hyp. tangent (global 4-component vector of float) +0:268 'inF0' (temp 4-component vector of float) +0:270 trunc (global 4-component vector of float) +0:270 'inF0' (temp 4-component vector of float) +0:273 Branch: Return with expression +0:? Constant: +0:? 1.000000 +0:? 2.000000 +0:? 3.000000 +0:? 4.000000 +0:337 Function Definition: PixelShaderFunction(mf22;mf22;mf22; (temp 2X2 matrix of float) +0:329 Function Parameters: +0:329 'inF0' (temp 2X2 matrix of float) +0:329 'inF1' (temp 2X2 matrix of float) +0:329 'inF2' (temp 2X2 matrix of float) +0:? Sequence +0:331 all (global bool) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 Absolute value (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 arc cosine (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 any (global bool) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 arc sine (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 arc tangent (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 arc tangent (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 'inF1' (temp 2X2 matrix of float) +0:331 Ceiling (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 clamp (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 'inF1' (temp 2X2 matrix of float) +0:331 'inF2' (temp 2X2 matrix of float) +0:331 cosine (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 hyp. cosine (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 dPdx (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 dPdxCoarse (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 dPdxFine (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 dPdy (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 dPdyCoarse (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 dPdyFine (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 degrees (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 determinant (global float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 exp (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 exp2 (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 findMSB (global int) +0:331 Constant: +0:331 7 (const int) +0:331 findLSB (global int) +0:331 Constant: +0:331 7 (const int) +0:331 Floor (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 Function Call: fmod(mf22;mf22; (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 'inF1' (temp 2X2 matrix of float) +0:331 Fraction (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 frexp (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 'inF1' (temp 2X2 matrix of float) +0:331 fwidth (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 ldexp (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 'inF1' (temp 2X2 matrix of float) +0:331 log (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 log2 (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 max (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 'inF1' (temp 2X2 matrix of float) +0:331 min (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 'inF1' (temp 2X2 matrix of float) +0:331 pow (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 'inF1' (temp 2X2 matrix of float) +0:331 radians (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 roundEven (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 inverse sqrt (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 Sign (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 sine (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 hyp. sine (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 smoothstep (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 'inF1' (temp 2X2 matrix of float) +0:331 'inF2' (temp 2X2 matrix of float) +0:331 sqrt (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 step (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 'inF1' (temp 2X2 matrix of float) +0:331 tangent (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 hyp. tangent (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 transpose (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:331 trunc (global 2X2 matrix of float) +0:331 'inF0' (temp 2X2 matrix of float) +0:334 Branch: Return with expression +0:? Constant: +0:? 2.000000 +0:? 2.000000 +0:? 2.000000 +0:? 2.000000 +0:346 Function Definition: PixelShaderFunction(mf33;mf33;mf33; (temp 3X3 matrix of float) +0:338 Function Parameters: +0:338 'inF0' (temp 3X3 matrix of float) +0:338 'inF1' (temp 3X3 matrix of float) +0:338 'inF2' (temp 3X3 matrix of float) +0:? Sequence +0:340 all (global bool) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 Absolute value (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 arc cosine (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 any (global bool) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 arc sine (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 arc tangent (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 arc tangent (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 'inF1' (temp 3X3 matrix of float) +0:340 Ceiling (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 clamp (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 'inF1' (temp 3X3 matrix of float) +0:340 'inF2' (temp 3X3 matrix of float) +0:340 cosine (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 hyp. cosine (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 dPdx (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 dPdxCoarse (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 dPdxFine (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 dPdy (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 dPdyCoarse (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 dPdyFine (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 degrees (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 determinant (global float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 exp (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 exp2 (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 findMSB (global int) +0:340 Constant: +0:340 7 (const int) +0:340 findLSB (global int) +0:340 Constant: +0:340 7 (const int) +0:340 Floor (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 Function Call: fmod(mf33;mf33; (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 'inF1' (temp 3X3 matrix of float) +0:340 Fraction (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 frexp (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 'inF1' (temp 3X3 matrix of float) +0:340 fwidth (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 ldexp (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 'inF1' (temp 3X3 matrix of float) +0:340 log (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 log2 (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 max (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 'inF1' (temp 3X3 matrix of float) +0:340 min (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 'inF1' (temp 3X3 matrix of float) +0:340 pow (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 'inF1' (temp 3X3 matrix of float) +0:340 radians (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 roundEven (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 inverse sqrt (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 Sign (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 sine (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 hyp. sine (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 smoothstep (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 'inF1' (temp 3X3 matrix of float) +0:340 'inF2' (temp 3X3 matrix of float) +0:340 sqrt (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 step (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 'inF1' (temp 3X3 matrix of float) +0:340 tangent (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 hyp. tangent (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 transpose (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:340 trunc (global 3X3 matrix of float) +0:340 'inF0' (temp 3X3 matrix of float) +0:343 Branch: Return with expression +0:? Constant: +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:354 Function Definition: PixelShaderFunction(mf44;mf44;mf44; (temp 4X4 matrix of float) +0:347 Function Parameters: +0:347 'inF0' (temp 4X4 matrix of float) +0:347 'inF1' (temp 4X4 matrix of float) +0:347 'inF2' (temp 4X4 matrix of float) +0:? Sequence +0:349 all (global bool) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 Absolute value (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 arc cosine (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 any (global bool) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 arc sine (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 arc tangent (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 arc tangent (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 'inF1' (temp 4X4 matrix of float) +0:349 Ceiling (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 clamp (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 'inF1' (temp 4X4 matrix of float) +0:349 'inF2' (temp 4X4 matrix of float) +0:349 cosine (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 hyp. cosine (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 dPdx (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 dPdxCoarse (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 dPdxFine (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 dPdy (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 dPdyCoarse (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 dPdyFine (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 degrees (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 determinant (global float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 exp (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 exp2 (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 findMSB (global int) +0:349 Constant: +0:349 7 (const int) +0:349 findLSB (global int) +0:349 Constant: +0:349 7 (const int) +0:349 Floor (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 Function Call: fmod(mf44;mf44; (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 'inF1' (temp 4X4 matrix of float) +0:349 Fraction (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 frexp (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 'inF1' (temp 4X4 matrix of float) +0:349 fwidth (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 ldexp (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 'inF1' (temp 4X4 matrix of float) +0:349 log (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 log2 (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 max (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 'inF1' (temp 4X4 matrix of float) +0:349 min (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 'inF1' (temp 4X4 matrix of float) +0:349 pow (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 'inF1' (temp 4X4 matrix of float) +0:349 radians (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 roundEven (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 inverse sqrt (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 Sign (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 sine (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 hyp. sine (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 smoothstep (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 'inF1' (temp 4X4 matrix of float) +0:349 'inF2' (temp 4X4 matrix of float) +0:349 sqrt (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 step (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 'inF1' (temp 4X4 matrix of float) +0:349 tangent (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 hyp. tangent (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 transpose (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:349 trunc (global 4X4 matrix of float) +0:349 'inF0' (temp 4X4 matrix of float) +0:352 Branch: Return with expression +0:? Constant: +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? Linker Objects + +Missing functionality: missing user function; linker needs to catch that +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 880 + + Capability Shader + Capability DerivativeControl + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "PixelShaderFunction" + ExecutionMode 4 OriginUpperLeft + Source HLSL 450 + Name 4 "PixelShaderFunction" + Name 8 "inF0" + Name 23 "inF1" + Name 30 "inF2" + Name 67 "ResType" + Name 127 "inF0" + Name 141 "inF1" + Name 148 "inF2" + Name 195 "ResType" + Name 268 "inF0" + Name 282 "inF1" + Name 289 "inF2" + Name 339 "ResType" + Name 410 "inF0" + Name 424 "inF1" + Name 431 "inF2" + Name 477 "ResType" + Name 549 "inF0" + Name 563 "inF1" + Name 570 "inF2" + Name 604 "ResType" + Name 660 "inF0" + Name 674 "inF1" + Name 681 "inF2" + Name 715 "ResType" + Name 771 "inF0" + Name 785 "inF1" + Name 792 "inF2" + Name 826 "ResType" + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypePointer Function 6(float) + 10: TypeBool + 37: TypeInt 32 0 + 38: 37(int) Constant 7 + 58: TypeInt 32 1 + 59: 58(int) Constant 7 + 67(ResType): TypeStruct 6(float) 58(int) + 95: 37(int) Constant 2 + 122: 6(float) Constant 0 + 125: TypeVector 6(float) 2 + 126: TypePointer Function 125(fvec2) + 155: TypeVector 37(int) 2 + 156: 37(int) Constant 3 + 157: 155(ivec2) ConstantComposite 38 156 + 194: TypeVector 58(int) 2 + 195(ResType): TypeStruct 125(fvec2) 194(ivec2) + 202: TypeVector 10(bool) 2 + 233: 6(float) Constant 1073741824 + 235: 37(int) Constant 1 + 236: 155(ivec2) ConstantComposite 235 95 + 263: 6(float) Constant 1065353216 + 264: 125(fvec2) ConstantComposite 263 233 + 266: TypeVector 6(float) 3 + 267: TypePointer Function 266(fvec3) + 296: TypeVector 37(int) 3 + 297: 37(int) Constant 5 + 298: 296(ivec3) ConstantComposite 38 156 297 + 338: TypeVector 58(int) 3 + 339(ResType): TypeStruct 266(fvec3) 338(ivec3) + 346: TypeVector 10(bool) 3 + 378: 296(ivec3) ConstantComposite 235 95 156 + 405: 6(float) Constant 1077936128 + 406: 266(fvec3) ConstantComposite 263 233 405 + 408: TypeVector 6(float) 4 + 409: TypePointer Function 408(fvec4) + 438: TypeVector 37(int) 4 + 439: 438(ivec4) ConstantComposite 38 156 297 95 + 476: TypeVector 58(int) 4 + 477(ResType): TypeStruct 408(fvec4) 476(ivec4) + 484: TypeVector 10(bool) 4 + 516: 37(int) Constant 4 + 517: 438(ivec4) ConstantComposite 235 95 156 516 + 544: 6(float) Constant 1082130432 + 545: 408(fvec4) ConstantComposite 263 233 405 544 + 547: TypeMatrix 125(fvec2) 2 + 548: TypePointer Function 547 + 604(ResType): TypeStruct 547 194(ivec2) + 655: 125(fvec2) ConstantComposite 233 233 + 656: 547 ConstantComposite 655 655 + 658: TypeMatrix 266(fvec3) 3 + 659: TypePointer Function 658 + 715(ResType): TypeStruct 658 338(ivec3) + 766: 266(fvec3) ConstantComposite 405 405 405 + 767: 658 ConstantComposite 766 766 766 + 769: TypeMatrix 408(fvec4) 4 + 770: TypePointer Function 769 + 826(ResType): TypeStruct 769 476(ivec4) + 877: 408(fvec4) ConstantComposite 544 544 544 544 + 878: 769 ConstantComposite 877 877 877 877 +4(PixelShaderFunction): 2 Function None 3 + 5: Label + 8(inF0): 7(ptr) Variable Function + 23(inF1): 7(ptr) Variable Function + 30(inF2): 7(ptr) Variable Function + 127(inF0): 126(ptr) Variable Function + 141(inF1): 126(ptr) Variable Function + 148(inF2): 126(ptr) Variable Function + 268(inF0): 267(ptr) Variable Function + 282(inF1): 267(ptr) Variable Function + 289(inF2): 267(ptr) Variable Function + 410(inF0): 409(ptr) Variable Function + 424(inF1): 409(ptr) Variable Function + 431(inF2): 409(ptr) Variable Function + 549(inF0): 548(ptr) Variable Function + 563(inF1): 548(ptr) Variable Function + 570(inF2): 548(ptr) Variable Function + 660(inF0): 659(ptr) Variable Function + 674(inF1): 659(ptr) Variable Function + 681(inF2): 659(ptr) Variable Function + 771(inF0): 770(ptr) Variable Function + 785(inF1): 770(ptr) Variable Function + 792(inF2): 770(ptr) Variable Function + 9: 6(float) Load 8(inF0) + 11: 10(bool) All 9 + 12: 6(float) Load 8(inF0) + 13: 6(float) ExtInst 1(GLSL.std.450) 4(FAbs) 12 + 14: 6(float) Load 8(inF0) + 15: 6(float) ExtInst 1(GLSL.std.450) 17(Acos) 14 + 16: 6(float) Load 8(inF0) + 17: 10(bool) Any 16 + 18: 6(float) Load 8(inF0) + 19: 6(float) ExtInst 1(GLSL.std.450) 16(Asin) 18 + 20: 6(float) Load 8(inF0) + 21: 6(float) ExtInst 1(GLSL.std.450) 18(Atan) 20 + 22: 6(float) Load 8(inF0) + 24: 6(float) Load 23(inF1) + 25: 6(float) ExtInst 1(GLSL.std.450) 25(Atan2) 22 24 + 26: 6(float) Load 8(inF0) + 27: 6(float) ExtInst 1(GLSL.std.450) 9(Ceil) 26 + 28: 6(float) Load 8(inF0) + 29: 6(float) Load 23(inF1) + 31: 6(float) Load 30(inF2) + 32: 6(float) ExtInst 1(GLSL.std.450) 43(FClamp) 28 29 31 + 33: 6(float) Load 8(inF0) + 34: 6(float) ExtInst 1(GLSL.std.450) 14(Cos) 33 + 35: 6(float) Load 8(inF0) + 36: 6(float) ExtInst 1(GLSL.std.450) 20(Cosh) 35 + 39: 37(int) BitCount 38 + 40: 6(float) Load 8(inF0) + 41: 6(float) DPdx 40 + 42: 6(float) Load 8(inF0) + 43: 6(float) DPdxCoarse 42 + 44: 6(float) Load 8(inF0) + 45: 6(float) DPdxFine 44 + 46: 6(float) Load 8(inF0) + 47: 6(float) DPdy 46 + 48: 6(float) Load 8(inF0) + 49: 6(float) DPdyCoarse 48 + 50: 6(float) Load 8(inF0) + 51: 6(float) DPdyFine 50 + 52: 6(float) Load 8(inF0) + 53: 6(float) ExtInst 1(GLSL.std.450) 12(Degrees) 52 + 54: 6(float) Load 8(inF0) + 55: 6(float) ExtInst 1(GLSL.std.450) 27(Exp) 54 + 56: 6(float) Load 8(inF0) + 57: 6(float) ExtInst 1(GLSL.std.450) 29(Exp2) 56 + 60: 58(int) ExtInst 1(GLSL.std.450) 74(FindSMsb) 59 + 61: 58(int) ExtInst 1(GLSL.std.450) 73(FindILsb) 59 + 62: 6(float) Load 8(inF0) + 63: 6(float) ExtInst 1(GLSL.std.450) 8(Floor) 62 + 64: 6(float) Load 8(inF0) + 65: 6(float) ExtInst 1(GLSL.std.450) 10(Fract) 64 + 66: 6(float) Load 8(inF0) + 68: 67(ResType) ExtInst 1(GLSL.std.450) 52(FrexpStruct) 66 + 69: 58(int) CompositeExtract 68 1 + Store 23(inF1) 69 + 70: 6(float) CompositeExtract 68 0 + 71: 6(float) Load 8(inF0) + 72: 6(float) Fwidth 71 + 73: 6(float) Load 8(inF0) + 74: 10(bool) IsInf 73 + 75: 6(float) Load 8(inF0) + 76: 10(bool) IsNan 75 + 77: 6(float) Load 8(inF0) + 78: 6(float) Load 23(inF1) + 79: 6(float) ExtInst 1(GLSL.std.450) 53(Ldexp) 77 78 + 80: 6(float) Load 8(inF0) + 81: 6(float) ExtInst 1(GLSL.std.450) 28(Log) 80 + 82: 6(float) Load 8(inF0) + 83: 6(float) ExtInst 1(GLSL.std.450) 30(Log2) 82 + 84: 6(float) Load 8(inF0) + 85: 6(float) Load 23(inF1) + 86: 6(float) ExtInst 1(GLSL.std.450) 40(FMax) 84 85 + 87: 6(float) Load 8(inF0) + 88: 6(float) Load 23(inF1) + 89: 6(float) ExtInst 1(GLSL.std.450) 37(FMin) 87 88 + 90: 6(float) Load 8(inF0) + 91: 6(float) Load 23(inF1) + 92: 6(float) ExtInst 1(GLSL.std.450) 26(Pow) 90 91 + 93: 6(float) Load 8(inF0) + 94: 6(float) ExtInst 1(GLSL.std.450) 11(Radians) 93 + 96: 37(int) BitReverse 95 + 97: 6(float) Load 8(inF0) + 98: 6(float) ExtInst 1(GLSL.std.450) 2(RoundEven) 97 + 99: 6(float) Load 8(inF0) + 100: 6(float) ExtInst 1(GLSL.std.450) 32(InverseSqrt) 99 + 101: 6(float) Load 8(inF0) + 102: 6(float) ExtInst 1(GLSL.std.450) 6(FSign) 101 + 103: 6(float) Load 8(inF0) + 104: 6(float) ExtInst 1(GLSL.std.450) 13(Sin) 103 + 105: 6(float) Load 8(inF0) + 106: 6(float) ExtInst 1(GLSL.std.450) 19(Sinh) 105 + 107: 6(float) Load 8(inF0) + 108: 6(float) Load 23(inF1) + 109: 6(float) Load 30(inF2) + 110: 6(float) ExtInst 1(GLSL.std.450) 49(SmoothStep) 107 108 109 + 111: 6(float) Load 8(inF0) + 112: 6(float) ExtInst 1(GLSL.std.450) 31(Sqrt) 111 + 113: 6(float) Load 8(inF0) + 114: 6(float) Load 23(inF1) + 115: 6(float) ExtInst 1(GLSL.std.450) 48(Step) 113 114 + 116: 6(float) Load 8(inF0) + 117: 6(float) ExtInst 1(GLSL.std.450) 15(Tan) 116 + 118: 6(float) Load 8(inF0) + 119: 6(float) ExtInst 1(GLSL.std.450) 21(Tanh) 118 + 120: 6(float) Load 8(inF0) + 121: 6(float) ExtInst 1(GLSL.std.450) 3(Trunc) 120 + ReturnValue 122 + FunctionEnd diff --git a/Test/baseResults/hlsl.intrinsics.vert.out b/Test/baseResults/hlsl.intrinsics.vert.out new file mode 100644 index 00000000..22b301e0 --- /dev/null +++ b/Test/baseResults/hlsl.intrinsics.vert.out @@ -0,0 +1,1994 @@ +hlsl.intrinsics.vert +Shader version: 450 +0:? Sequence +0:56 Function Definition: VertexShaderFunction(f1;f1;f1; (temp float) +0:2 Function Parameters: +0:2 'inF0' (temp float) +0:2 'inF1' (temp float) +0:2 'inF2' (temp float) +0:? Sequence +0:3 all (global bool) +0:3 'inF0' (temp float) +0:4 Absolute value (global float) +0:4 'inF0' (temp float) +0:5 arc cosine (global float) +0:5 'inF0' (temp float) +0:6 any (global bool) +0:6 'inF0' (temp float) +0:7 arc sine (global float) +0:7 'inF0' (temp float) +0:8 arc tangent (global float) +0:8 'inF0' (temp float) +0:9 arc tangent (global float) +0:9 'inF0' (temp float) +0:9 'inF1' (temp float) +0:10 Ceiling (global float) +0:10 'inF0' (temp float) +0:11 clamp (global float) +0:11 'inF0' (temp float) +0:11 'inF1' (temp float) +0:11 'inF2' (temp float) +0:12 cosine (global float) +0:12 'inF0' (temp float) +0:13 hyp. cosine (global float) +0:13 'inF0' (temp float) +0:14 bitCount (global uint) +0:14 Constant: +0:14 7 (const uint) +0:15 degrees (global float) +0:15 'inF0' (temp float) +0:19 exp (global float) +0:19 'inF0' (temp float) +0:20 exp2 (global float) +0:20 'inF0' (temp float) +0:21 findMSB (global int) +0:21 Constant: +0:21 7 (const int) +0:22 findLSB (global int) +0:22 Constant: +0:22 7 (const int) +0:23 Floor (global float) +0:23 'inF0' (temp float) +0:25 Function Call: fmod(f1;f1; (global float) +0:25 'inF0' (temp float) +0:25 'inF1' (temp float) +0:26 Fraction (global float) +0:26 'inF0' (temp float) +0:27 frexp (global float) +0:27 'inF0' (temp float) +0:27 'inF1' (temp float) +0:28 fwidth (global float) +0:28 'inF0' (temp float) +0:29 isinf (global bool) +0:29 'inF0' (temp float) +0:30 isnan (global bool) +0:30 'inF0' (temp float) +0:31 ldexp (global float) +0:31 'inF0' (temp float) +0:31 'inF1' (temp float) +0:32 log (global float) +0:32 'inF0' (temp float) +0:33 log2 (global float) +0:33 'inF0' (temp float) +0:34 max (global float) +0:34 'inF0' (temp float) +0:34 'inF1' (temp float) +0:35 min (global float) +0:35 'inF0' (temp float) +0:35 'inF1' (temp float) +0:37 pow (global float) +0:37 'inF0' (temp float) +0:37 'inF1' (temp float) +0:38 radians (global float) +0:38 'inF0' (temp float) +0:39 bitFieldReverse (global uint) +0:39 Constant: +0:39 2 (const uint) +0:40 roundEven (global float) +0:40 'inF0' (temp float) +0:41 inverse sqrt (global float) +0:41 'inF0' (temp float) +0:42 Sign (global float) +0:42 'inF0' (temp float) +0:43 sine (global float) +0:43 'inF0' (temp float) +0:44 hyp. sine (global float) +0:44 'inF0' (temp float) +0:45 smoothstep (global float) +0:45 'inF0' (temp float) +0:45 'inF1' (temp float) +0:45 'inF2' (temp float) +0:46 sqrt (global float) +0:46 'inF0' (temp float) +0:47 step (global float) +0:47 'inF0' (temp float) +0:47 'inF1' (temp float) +0:48 tangent (global float) +0:48 'inF0' (temp float) +0:49 hyp. tangent (global float) +0:49 'inF0' (temp float) +0:51 trunc (global float) +0:51 'inF0' (temp float) +0:53 Branch: Return with expression +0:53 Constant: +0:53 0.000000 +0:62 Function Definition: VertexShaderFunction(vf1;vf1;vf1; (temp 1-component vector of float) +0:57 Function Parameters: +0:57 'inF0' (temp 1-component vector of float) +0:57 'inF1' (temp 1-component vector of float) +0:57 'inF2' (temp 1-component vector of float) +0:? Sequence +0:59 Branch: Return with expression +0:59 Constant: +0:59 0.000000 +0:125 Function Definition: VertexShaderFunction(vf2;vf2;vf2; (temp 2-component vector of float) +0:63 Function Parameters: +0:63 'inF0' (temp 2-component vector of float) +0:63 'inF1' (temp 2-component vector of float) +0:63 'inF2' (temp 2-component vector of float) +0:? Sequence +0:64 all (global bool) +0:64 'inF0' (temp 2-component vector of float) +0:65 Absolute value (global 2-component vector of float) +0:65 'inF0' (temp 2-component vector of float) +0:66 arc cosine (global 2-component vector of float) +0:66 'inF0' (temp 2-component vector of float) +0:67 any (global bool) +0:67 'inF0' (temp 2-component vector of float) +0:68 arc sine (global 2-component vector of float) +0:68 'inF0' (temp 2-component vector of float) +0:69 arc tangent (global 2-component vector of float) +0:69 'inF0' (temp 2-component vector of float) +0:70 arc tangent (global 2-component vector of float) +0:70 'inF0' (temp 2-component vector of float) +0:70 'inF1' (temp 2-component vector of float) +0:71 Ceiling (global 2-component vector of float) +0:71 'inF0' (temp 2-component vector of float) +0:72 clamp (global 2-component vector of float) +0:72 'inF0' (temp 2-component vector of float) +0:72 'inF1' (temp 2-component vector of float) +0:72 'inF2' (temp 2-component vector of float) +0:73 cosine (global 2-component vector of float) +0:73 'inF0' (temp 2-component vector of float) +0:74 hyp. cosine (global 2-component vector of float) +0:74 'inF0' (temp 2-component vector of float) +0:? bitCount (global 2-component vector of uint) +0:? Constant: +0:? 7 (const uint) +0:? 3 (const uint) +0:76 degrees (global 2-component vector of float) +0:76 'inF0' (temp 2-component vector of float) +0:77 distance (global float) +0:77 'inF0' (temp 2-component vector of float) +0:77 'inF1' (temp 2-component vector of float) +0:78 dot-product (global float) +0:78 'inF0' (temp 2-component vector of float) +0:78 'inF1' (temp 2-component vector of float) +0:82 exp (global 2-component vector of float) +0:82 'inF0' (temp 2-component vector of float) +0:83 exp2 (global 2-component vector of float) +0:83 'inF0' (temp 2-component vector of float) +0:84 face-forward (global 2-component vector of float) +0:84 'inF0' (temp 2-component vector of float) +0:84 'inF1' (temp 2-component vector of float) +0:84 'inF2' (temp 2-component vector of float) +0:85 findMSB (global int) +0:85 Constant: +0:85 7 (const int) +0:86 findLSB (global int) +0:86 Constant: +0:86 7 (const int) +0:87 Floor (global 2-component vector of float) +0:87 'inF0' (temp 2-component vector of float) +0:89 Function Call: fmod(vf2;vf2; (global 2-component vector of float) +0:89 'inF0' (temp 2-component vector of float) +0:89 'inF1' (temp 2-component vector of float) +0:90 Fraction (global 2-component vector of float) +0:90 'inF0' (temp 2-component vector of float) +0:91 frexp (global 2-component vector of float) +0:91 'inF0' (temp 2-component vector of float) +0:91 'inF1' (temp 2-component vector of float) +0:92 fwidth (global 2-component vector of float) +0:92 'inF0' (temp 2-component vector of float) +0:93 isinf (global 2-component vector of bool) +0:93 'inF0' (temp 2-component vector of float) +0:94 isnan (global 2-component vector of bool) +0:94 'inF0' (temp 2-component vector of float) +0:95 ldexp (global 2-component vector of float) +0:95 'inF0' (temp 2-component vector of float) +0:95 'inF1' (temp 2-component vector of float) +0:96 length (global float) +0:96 'inF0' (temp 2-component vector of float) +0:97 log (global 2-component vector of float) +0:97 'inF0' (temp 2-component vector of float) +0:98 log2 (global 2-component vector of float) +0:98 'inF0' (temp 2-component vector of float) +0:99 max (global 2-component vector of float) +0:99 'inF0' (temp 2-component vector of float) +0:99 'inF1' (temp 2-component vector of float) +0:100 min (global 2-component vector of float) +0:100 'inF0' (temp 2-component vector of float) +0:100 'inF1' (temp 2-component vector of float) +0:102 normalize (global 2-component vector of float) +0:102 'inF0' (temp 2-component vector of float) +0:103 pow (global 2-component vector of float) +0:103 'inF0' (temp 2-component vector of float) +0:103 'inF1' (temp 2-component vector of float) +0:104 radians (global 2-component vector of float) +0:104 'inF0' (temp 2-component vector of float) +0:105 reflect (global 2-component vector of float) +0:105 'inF0' (temp 2-component vector of float) +0:105 'inF1' (temp 2-component vector of float) +0:106 refract (global 2-component vector of float) +0:106 'inF0' (temp 2-component vector of float) +0:106 'inF1' (temp 2-component vector of float) +0:106 Constant: +0:106 2.000000 +0:? bitFieldReverse (global 2-component vector of uint) +0:? Constant: +0:? 1 (const uint) +0:? 2 (const uint) +0:108 roundEven (global 2-component vector of float) +0:108 'inF0' (temp 2-component vector of float) +0:109 inverse sqrt (global 2-component vector of float) +0:109 'inF0' (temp 2-component vector of float) +0:110 Sign (global 2-component vector of float) +0:110 'inF0' (temp 2-component vector of float) +0:111 sine (global 2-component vector of float) +0:111 'inF0' (temp 2-component vector of float) +0:112 hyp. sine (global 2-component vector of float) +0:112 'inF0' (temp 2-component vector of float) +0:113 smoothstep (global 2-component vector of float) +0:113 'inF0' (temp 2-component vector of float) +0:113 'inF1' (temp 2-component vector of float) +0:113 'inF2' (temp 2-component vector of float) +0:114 sqrt (global 2-component vector of float) +0:114 'inF0' (temp 2-component vector of float) +0:115 step (global 2-component vector of float) +0:115 'inF0' (temp 2-component vector of float) +0:115 'inF1' (temp 2-component vector of float) +0:116 tangent (global 2-component vector of float) +0:116 'inF0' (temp 2-component vector of float) +0:117 hyp. tangent (global 2-component vector of float) +0:117 'inF0' (temp 2-component vector of float) +0:119 trunc (global 2-component vector of float) +0:119 'inF0' (temp 2-component vector of float) +0:122 Branch: Return with expression +0:? Constant: +0:? 1.000000 +0:? 2.000000 +0:189 Function Definition: VertexShaderFunction(vf3;vf3;vf3; (temp 3-component vector of float) +0:126 Function Parameters: +0:126 'inF0' (temp 3-component vector of float) +0:126 'inF1' (temp 3-component vector of float) +0:126 'inF2' (temp 3-component vector of float) +0:? Sequence +0:127 all (global bool) +0:127 'inF0' (temp 3-component vector of float) +0:128 Absolute value (global 3-component vector of float) +0:128 'inF0' (temp 3-component vector of float) +0:129 arc cosine (global 3-component vector of float) +0:129 'inF0' (temp 3-component vector of float) +0:130 any (global bool) +0:130 'inF0' (temp 3-component vector of float) +0:131 arc sine (global 3-component vector of float) +0:131 'inF0' (temp 3-component vector of float) +0:132 arc tangent (global 3-component vector of float) +0:132 'inF0' (temp 3-component vector of float) +0:133 arc tangent (global 3-component vector of float) +0:133 'inF0' (temp 3-component vector of float) +0:133 'inF1' (temp 3-component vector of float) +0:134 Ceiling (global 3-component vector of float) +0:134 'inF0' (temp 3-component vector of float) +0:135 clamp (global 3-component vector of float) +0:135 'inF0' (temp 3-component vector of float) +0:135 'inF1' (temp 3-component vector of float) +0:135 'inF2' (temp 3-component vector of float) +0:136 cosine (global 3-component vector of float) +0:136 'inF0' (temp 3-component vector of float) +0:137 hyp. cosine (global 3-component vector of float) +0:137 'inF0' (temp 3-component vector of float) +0:? bitCount (global 3-component vector of uint) +0:? Constant: +0:? 7 (const uint) +0:? 3 (const uint) +0:? 5 (const uint) +0:139 cross-product (global 3-component vector of float) +0:139 'inF0' (temp 3-component vector of float) +0:139 'inF1' (temp 3-component vector of float) +0:140 degrees (global 3-component vector of float) +0:140 'inF0' (temp 3-component vector of float) +0:141 distance (global float) +0:141 'inF0' (temp 3-component vector of float) +0:141 'inF1' (temp 3-component vector of float) +0:142 dot-product (global float) +0:142 'inF0' (temp 3-component vector of float) +0:142 'inF1' (temp 3-component vector of float) +0:146 exp (global 3-component vector of float) +0:146 'inF0' (temp 3-component vector of float) +0:147 exp2 (global 3-component vector of float) +0:147 'inF0' (temp 3-component vector of float) +0:148 face-forward (global 3-component vector of float) +0:148 'inF0' (temp 3-component vector of float) +0:148 'inF1' (temp 3-component vector of float) +0:148 'inF2' (temp 3-component vector of float) +0:149 findMSB (global int) +0:149 Constant: +0:149 7 (const int) +0:150 findLSB (global int) +0:150 Constant: +0:150 7 (const int) +0:151 Floor (global 3-component vector of float) +0:151 'inF0' (temp 3-component vector of float) +0:153 Function Call: fmod(vf3;vf3; (global 3-component vector of float) +0:153 'inF0' (temp 3-component vector of float) +0:153 'inF1' (temp 3-component vector of float) +0:154 Fraction (global 3-component vector of float) +0:154 'inF0' (temp 3-component vector of float) +0:155 frexp (global 3-component vector of float) +0:155 'inF0' (temp 3-component vector of float) +0:155 'inF1' (temp 3-component vector of float) +0:156 fwidth (global 3-component vector of float) +0:156 'inF0' (temp 3-component vector of float) +0:157 isinf (global 3-component vector of bool) +0:157 'inF0' (temp 3-component vector of float) +0:158 isnan (global 3-component vector of bool) +0:158 'inF0' (temp 3-component vector of float) +0:159 ldexp (global 3-component vector of float) +0:159 'inF0' (temp 3-component vector of float) +0:159 'inF1' (temp 3-component vector of float) +0:160 length (global float) +0:160 'inF0' (temp 3-component vector of float) +0:161 log (global 3-component vector of float) +0:161 'inF0' (temp 3-component vector of float) +0:162 log2 (global 3-component vector of float) +0:162 'inF0' (temp 3-component vector of float) +0:163 max (global 3-component vector of float) +0:163 'inF0' (temp 3-component vector of float) +0:163 'inF1' (temp 3-component vector of float) +0:164 min (global 3-component vector of float) +0:164 'inF0' (temp 3-component vector of float) +0:164 'inF1' (temp 3-component vector of float) +0:166 normalize (global 3-component vector of float) +0:166 'inF0' (temp 3-component vector of float) +0:167 pow (global 3-component vector of float) +0:167 'inF0' (temp 3-component vector of float) +0:167 'inF1' (temp 3-component vector of float) +0:168 radians (global 3-component vector of float) +0:168 'inF0' (temp 3-component vector of float) +0:169 reflect (global 3-component vector of float) +0:169 'inF0' (temp 3-component vector of float) +0:169 'inF1' (temp 3-component vector of float) +0:170 refract (global 3-component vector of float) +0:170 'inF0' (temp 3-component vector of float) +0:170 'inF1' (temp 3-component vector of float) +0:170 Constant: +0:170 2.000000 +0:? bitFieldReverse (global 3-component vector of uint) +0:? Constant: +0:? 1 (const uint) +0:? 2 (const uint) +0:? 3 (const uint) +0:172 roundEven (global 3-component vector of float) +0:172 'inF0' (temp 3-component vector of float) +0:173 inverse sqrt (global 3-component vector of float) +0:173 'inF0' (temp 3-component vector of float) +0:174 Sign (global 3-component vector of float) +0:174 'inF0' (temp 3-component vector of float) +0:175 sine (global 3-component vector of float) +0:175 'inF0' (temp 3-component vector of float) +0:176 hyp. sine (global 3-component vector of float) +0:176 'inF0' (temp 3-component vector of float) +0:177 smoothstep (global 3-component vector of float) +0:177 'inF0' (temp 3-component vector of float) +0:177 'inF1' (temp 3-component vector of float) +0:177 'inF2' (temp 3-component vector of float) +0:178 sqrt (global 3-component vector of float) +0:178 'inF0' (temp 3-component vector of float) +0:179 step (global 3-component vector of float) +0:179 'inF0' (temp 3-component vector of float) +0:179 'inF1' (temp 3-component vector of float) +0:180 tangent (global 3-component vector of float) +0:180 'inF0' (temp 3-component vector of float) +0:181 hyp. tangent (global 3-component vector of float) +0:181 'inF0' (temp 3-component vector of float) +0:183 trunc (global 3-component vector of float) +0:183 'inF0' (temp 3-component vector of float) +0:186 Branch: Return with expression +0:? Constant: +0:? 1.000000 +0:? 2.000000 +0:? 3.000000 +0:298 Function Definition: VertexShaderFunction(vf4;vf4;vf4; (temp 4-component vector of float) +0:190 Function Parameters: +0:190 'inF0' (temp 4-component vector of float) +0:190 'inF1' (temp 4-component vector of float) +0:190 'inF2' (temp 4-component vector of float) +0:? Sequence +0:191 all (global bool) +0:191 'inF0' (temp 4-component vector of float) +0:192 Absolute value (global 4-component vector of float) +0:192 'inF0' (temp 4-component vector of float) +0:193 arc cosine (global 4-component vector of float) +0:193 'inF0' (temp 4-component vector of float) +0:194 any (global bool) +0:194 'inF0' (temp 4-component vector of float) +0:195 arc sine (global 4-component vector of float) +0:195 'inF0' (temp 4-component vector of float) +0:196 arc tangent (global 4-component vector of float) +0:196 'inF0' (temp 4-component vector of float) +0:197 arc tangent (global 4-component vector of float) +0:197 'inF0' (temp 4-component vector of float) +0:197 'inF1' (temp 4-component vector of float) +0:198 Ceiling (global 4-component vector of float) +0:198 'inF0' (temp 4-component vector of float) +0:199 clamp (global 4-component vector of float) +0:199 'inF0' (temp 4-component vector of float) +0:199 'inF1' (temp 4-component vector of float) +0:199 'inF2' (temp 4-component vector of float) +0:200 cosine (global 4-component vector of float) +0:200 'inF0' (temp 4-component vector of float) +0:201 hyp. cosine (global 4-component vector of float) +0:201 'inF0' (temp 4-component vector of float) +0:? bitCount (global 4-component vector of uint) +0:? Constant: +0:? 7 (const uint) +0:? 3 (const uint) +0:? 5 (const uint) +0:? 2 (const uint) +0:203 degrees (global 4-component vector of float) +0:203 'inF0' (temp 4-component vector of float) +0:204 distance (global float) +0:204 'inF0' (temp 4-component vector of float) +0:204 'inF1' (temp 4-component vector of float) +0:205 dot-product (global float) +0:205 'inF0' (temp 4-component vector of float) +0:205 'inF1' (temp 4-component vector of float) +0:209 exp (global 4-component vector of float) +0:209 'inF0' (temp 4-component vector of float) +0:210 exp2 (global 4-component vector of float) +0:210 'inF0' (temp 4-component vector of float) +0:211 face-forward (global 4-component vector of float) +0:211 'inF0' (temp 4-component vector of float) +0:211 'inF1' (temp 4-component vector of float) +0:211 'inF2' (temp 4-component vector of float) +0:212 findMSB (global int) +0:212 Constant: +0:212 7 (const int) +0:213 findLSB (global int) +0:213 Constant: +0:213 7 (const int) +0:214 Floor (global 4-component vector of float) +0:214 'inF0' (temp 4-component vector of float) +0:216 Function Call: fmod(vf4;vf4; (global 4-component vector of float) +0:216 'inF0' (temp 4-component vector of float) +0:216 'inF1' (temp 4-component vector of float) +0:217 Fraction (global 4-component vector of float) +0:217 'inF0' (temp 4-component vector of float) +0:218 frexp (global 4-component vector of float) +0:218 'inF0' (temp 4-component vector of float) +0:218 'inF1' (temp 4-component vector of float) +0:219 fwidth (global 4-component vector of float) +0:219 'inF0' (temp 4-component vector of float) +0:220 isinf (global 4-component vector of bool) +0:220 'inF0' (temp 4-component vector of float) +0:221 isnan (global 4-component vector of bool) +0:221 'inF0' (temp 4-component vector of float) +0:222 ldexp (global 4-component vector of float) +0:222 'inF0' (temp 4-component vector of float) +0:222 'inF1' (temp 4-component vector of float) +0:223 length (global float) +0:223 'inF0' (temp 4-component vector of float) +0:224 log (global 4-component vector of float) +0:224 'inF0' (temp 4-component vector of float) +0:225 log2 (global 4-component vector of float) +0:225 'inF0' (temp 4-component vector of float) +0:226 max (global 4-component vector of float) +0:226 'inF0' (temp 4-component vector of float) +0:226 'inF1' (temp 4-component vector of float) +0:227 min (global 4-component vector of float) +0:227 'inF0' (temp 4-component vector of float) +0:227 'inF1' (temp 4-component vector of float) +0:229 normalize (global 4-component vector of float) +0:229 'inF0' (temp 4-component vector of float) +0:230 pow (global 4-component vector of float) +0:230 'inF0' (temp 4-component vector of float) +0:230 'inF1' (temp 4-component vector of float) +0:231 radians (global 4-component vector of float) +0:231 'inF0' (temp 4-component vector of float) +0:232 reflect (global 4-component vector of float) +0:232 'inF0' (temp 4-component vector of float) +0:232 'inF1' (temp 4-component vector of float) +0:233 refract (global 4-component vector of float) +0:233 'inF0' (temp 4-component vector of float) +0:233 'inF1' (temp 4-component vector of float) +0:233 Constant: +0:233 2.000000 +0:? bitFieldReverse (global 4-component vector of uint) +0:? Constant: +0:? 1 (const uint) +0:? 2 (const uint) +0:? 3 (const uint) +0:? 4 (const uint) +0:235 roundEven (global 4-component vector of float) +0:235 'inF0' (temp 4-component vector of float) +0:236 inverse sqrt (global 4-component vector of float) +0:236 'inF0' (temp 4-component vector of float) +0:237 Sign (global 4-component vector of float) +0:237 'inF0' (temp 4-component vector of float) +0:238 sine (global 4-component vector of float) +0:238 'inF0' (temp 4-component vector of float) +0:239 hyp. sine (global 4-component vector of float) +0:239 'inF0' (temp 4-component vector of float) +0:240 smoothstep (global 4-component vector of float) +0:240 'inF0' (temp 4-component vector of float) +0:240 'inF1' (temp 4-component vector of float) +0:240 'inF2' (temp 4-component vector of float) +0:241 sqrt (global 4-component vector of float) +0:241 'inF0' (temp 4-component vector of float) +0:242 step (global 4-component vector of float) +0:242 'inF0' (temp 4-component vector of float) +0:242 'inF1' (temp 4-component vector of float) +0:243 tangent (global 4-component vector of float) +0:243 'inF0' (temp 4-component vector of float) +0:244 hyp. tangent (global 4-component vector of float) +0:244 'inF0' (temp 4-component vector of float) +0:246 trunc (global 4-component vector of float) +0:246 'inF0' (temp 4-component vector of float) +0:249 Branch: Return with expression +0:? Constant: +0:? 1.000000 +0:? 2.000000 +0:? 3.000000 +0:? 4.000000 +0:307 Function Definition: VertexShaderFunction(mf22;mf22;mf22; (temp 2X2 matrix of float) +0:299 Function Parameters: +0:299 'inF0' (temp 2X2 matrix of float) +0:299 'inF1' (temp 2X2 matrix of float) +0:299 'inF2' (temp 2X2 matrix of float) +0:? Sequence +0:301 all (global bool) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 Absolute value (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 arc cosine (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 any (global bool) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 arc sine (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 arc tangent (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 arc tangent (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 'inF1' (temp 2X2 matrix of float) +0:301 Ceiling (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 clamp (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 'inF1' (temp 2X2 matrix of float) +0:301 'inF2' (temp 2X2 matrix of float) +0:301 cosine (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 hyp. cosine (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 degrees (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 determinant (global float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 exp (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 exp2 (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 findMSB (global int) +0:301 Constant: +0:301 7 (const int) +0:301 findLSB (global int) +0:301 Constant: +0:301 7 (const int) +0:301 Floor (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 Function Call: fmod(mf22;mf22; (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 'inF1' (temp 2X2 matrix of float) +0:301 Fraction (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 frexp (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 'inF1' (temp 2X2 matrix of float) +0:301 fwidth (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 ldexp (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 'inF1' (temp 2X2 matrix of float) +0:301 log (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 log2 (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 max (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 'inF1' (temp 2X2 matrix of float) +0:301 min (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 'inF1' (temp 2X2 matrix of float) +0:301 pow (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 'inF1' (temp 2X2 matrix of float) +0:301 radians (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 roundEven (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 inverse sqrt (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 Sign (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 sine (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 hyp. sine (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 smoothstep (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 'inF1' (temp 2X2 matrix of float) +0:301 'inF2' (temp 2X2 matrix of float) +0:301 sqrt (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 step (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 'inF1' (temp 2X2 matrix of float) +0:301 tangent (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 hyp. tangent (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 transpose (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 trunc (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:304 Branch: Return with expression +0:? Constant: +0:? 2.000000 +0:? 2.000000 +0:? 2.000000 +0:? 2.000000 +0:316 Function Definition: VertexShaderFunction(mf33;mf33;mf33; (temp 3X3 matrix of float) +0:308 Function Parameters: +0:308 'inF0' (temp 3X3 matrix of float) +0:308 'inF1' (temp 3X3 matrix of float) +0:308 'inF2' (temp 3X3 matrix of float) +0:? Sequence +0:310 all (global bool) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 Absolute value (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 arc cosine (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 any (global bool) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 arc sine (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 arc tangent (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 arc tangent (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 'inF1' (temp 3X3 matrix of float) +0:310 Ceiling (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 clamp (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 'inF1' (temp 3X3 matrix of float) +0:310 'inF2' (temp 3X3 matrix of float) +0:310 cosine (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 hyp. cosine (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 degrees (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 determinant (global float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 exp (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 exp2 (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 findMSB (global int) +0:310 Constant: +0:310 7 (const int) +0:310 findLSB (global int) +0:310 Constant: +0:310 7 (const int) +0:310 Floor (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 Function Call: fmod(mf33;mf33; (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 'inF1' (temp 3X3 matrix of float) +0:310 Fraction (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 frexp (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 'inF1' (temp 3X3 matrix of float) +0:310 fwidth (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 ldexp (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 'inF1' (temp 3X3 matrix of float) +0:310 log (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 log2 (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 max (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 'inF1' (temp 3X3 matrix of float) +0:310 min (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 'inF1' (temp 3X3 matrix of float) +0:310 pow (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 'inF1' (temp 3X3 matrix of float) +0:310 radians (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 roundEven (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 inverse sqrt (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 Sign (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 sine (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 hyp. sine (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 smoothstep (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 'inF1' (temp 3X3 matrix of float) +0:310 'inF2' (temp 3X3 matrix of float) +0:310 sqrt (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 step (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 'inF1' (temp 3X3 matrix of float) +0:310 tangent (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 hyp. tangent (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 transpose (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 trunc (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:313 Branch: Return with expression +0:? Constant: +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:324 Function Definition: VertexShaderFunction(mf44;mf44;mf44; (temp 4X4 matrix of float) +0:317 Function Parameters: +0:317 'inF0' (temp 4X4 matrix of float) +0:317 'inF1' (temp 4X4 matrix of float) +0:317 'inF2' (temp 4X4 matrix of float) +0:? Sequence +0:319 all (global bool) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 Absolute value (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 arc cosine (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 any (global bool) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 arc sine (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 arc tangent (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 arc tangent (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 'inF1' (temp 4X4 matrix of float) +0:319 Ceiling (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 clamp (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 'inF1' (temp 4X4 matrix of float) +0:319 'inF2' (temp 4X4 matrix of float) +0:319 cosine (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 hyp. cosine (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 degrees (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 determinant (global float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 exp (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 exp2 (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 findMSB (global int) +0:319 Constant: +0:319 7 (const int) +0:319 findLSB (global int) +0:319 Constant: +0:319 7 (const int) +0:319 Floor (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 Function Call: fmod(mf44;mf44; (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 'inF1' (temp 4X4 matrix of float) +0:319 Fraction (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 frexp (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 'inF1' (temp 4X4 matrix of float) +0:319 fwidth (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 ldexp (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 'inF1' (temp 4X4 matrix of float) +0:319 log (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 log2 (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 max (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 'inF1' (temp 4X4 matrix of float) +0:319 min (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 'inF1' (temp 4X4 matrix of float) +0:319 pow (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 'inF1' (temp 4X4 matrix of float) +0:319 radians (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 roundEven (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 inverse sqrt (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 Sign (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 sine (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 hyp. sine (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 smoothstep (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 'inF1' (temp 4X4 matrix of float) +0:319 'inF2' (temp 4X4 matrix of float) +0:319 sqrt (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 step (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 'inF1' (temp 4X4 matrix of float) +0:319 tangent (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 hyp. tangent (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 transpose (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 trunc (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:322 Branch: Return with expression +0:? Constant: +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? Linker Objects + + +Linked vertex stage: + + +Shader version: 450 +0:? Sequence +0:56 Function Definition: VertexShaderFunction(f1;f1;f1; (temp float) +0:2 Function Parameters: +0:2 'inF0' (temp float) +0:2 'inF1' (temp float) +0:2 'inF2' (temp float) +0:? Sequence +0:3 all (global bool) +0:3 'inF0' (temp float) +0:4 Absolute value (global float) +0:4 'inF0' (temp float) +0:5 arc cosine (global float) +0:5 'inF0' (temp float) +0:6 any (global bool) +0:6 'inF0' (temp float) +0:7 arc sine (global float) +0:7 'inF0' (temp float) +0:8 arc tangent (global float) +0:8 'inF0' (temp float) +0:9 arc tangent (global float) +0:9 'inF0' (temp float) +0:9 'inF1' (temp float) +0:10 Ceiling (global float) +0:10 'inF0' (temp float) +0:11 clamp (global float) +0:11 'inF0' (temp float) +0:11 'inF1' (temp float) +0:11 'inF2' (temp float) +0:12 cosine (global float) +0:12 'inF0' (temp float) +0:13 hyp. cosine (global float) +0:13 'inF0' (temp float) +0:14 bitCount (global uint) +0:14 Constant: +0:14 7 (const uint) +0:15 degrees (global float) +0:15 'inF0' (temp float) +0:19 exp (global float) +0:19 'inF0' (temp float) +0:20 exp2 (global float) +0:20 'inF0' (temp float) +0:21 findMSB (global int) +0:21 Constant: +0:21 7 (const int) +0:22 findLSB (global int) +0:22 Constant: +0:22 7 (const int) +0:23 Floor (global float) +0:23 'inF0' (temp float) +0:25 Function Call: fmod(f1;f1; (global float) +0:25 'inF0' (temp float) +0:25 'inF1' (temp float) +0:26 Fraction (global float) +0:26 'inF0' (temp float) +0:27 frexp (global float) +0:27 'inF0' (temp float) +0:27 'inF1' (temp float) +0:28 fwidth (global float) +0:28 'inF0' (temp float) +0:29 isinf (global bool) +0:29 'inF0' (temp float) +0:30 isnan (global bool) +0:30 'inF0' (temp float) +0:31 ldexp (global float) +0:31 'inF0' (temp float) +0:31 'inF1' (temp float) +0:32 log (global float) +0:32 'inF0' (temp float) +0:33 log2 (global float) +0:33 'inF0' (temp float) +0:34 max (global float) +0:34 'inF0' (temp float) +0:34 'inF1' (temp float) +0:35 min (global float) +0:35 'inF0' (temp float) +0:35 'inF1' (temp float) +0:37 pow (global float) +0:37 'inF0' (temp float) +0:37 'inF1' (temp float) +0:38 radians (global float) +0:38 'inF0' (temp float) +0:39 bitFieldReverse (global uint) +0:39 Constant: +0:39 2 (const uint) +0:40 roundEven (global float) +0:40 'inF0' (temp float) +0:41 inverse sqrt (global float) +0:41 'inF0' (temp float) +0:42 Sign (global float) +0:42 'inF0' (temp float) +0:43 sine (global float) +0:43 'inF0' (temp float) +0:44 hyp. sine (global float) +0:44 'inF0' (temp float) +0:45 smoothstep (global float) +0:45 'inF0' (temp float) +0:45 'inF1' (temp float) +0:45 'inF2' (temp float) +0:46 sqrt (global float) +0:46 'inF0' (temp float) +0:47 step (global float) +0:47 'inF0' (temp float) +0:47 'inF1' (temp float) +0:48 tangent (global float) +0:48 'inF0' (temp float) +0:49 hyp. tangent (global float) +0:49 'inF0' (temp float) +0:51 trunc (global float) +0:51 'inF0' (temp float) +0:53 Branch: Return with expression +0:53 Constant: +0:53 0.000000 +0:62 Function Definition: VertexShaderFunction(vf1;vf1;vf1; (temp 1-component vector of float) +0:57 Function Parameters: +0:57 'inF0' (temp 1-component vector of float) +0:57 'inF1' (temp 1-component vector of float) +0:57 'inF2' (temp 1-component vector of float) +0:? Sequence +0:59 Branch: Return with expression +0:59 Constant: +0:59 0.000000 +0:125 Function Definition: VertexShaderFunction(vf2;vf2;vf2; (temp 2-component vector of float) +0:63 Function Parameters: +0:63 'inF0' (temp 2-component vector of float) +0:63 'inF1' (temp 2-component vector of float) +0:63 'inF2' (temp 2-component vector of float) +0:? Sequence +0:64 all (global bool) +0:64 'inF0' (temp 2-component vector of float) +0:65 Absolute value (global 2-component vector of float) +0:65 'inF0' (temp 2-component vector of float) +0:66 arc cosine (global 2-component vector of float) +0:66 'inF0' (temp 2-component vector of float) +0:67 any (global bool) +0:67 'inF0' (temp 2-component vector of float) +0:68 arc sine (global 2-component vector of float) +0:68 'inF0' (temp 2-component vector of float) +0:69 arc tangent (global 2-component vector of float) +0:69 'inF0' (temp 2-component vector of float) +0:70 arc tangent (global 2-component vector of float) +0:70 'inF0' (temp 2-component vector of float) +0:70 'inF1' (temp 2-component vector of float) +0:71 Ceiling (global 2-component vector of float) +0:71 'inF0' (temp 2-component vector of float) +0:72 clamp (global 2-component vector of float) +0:72 'inF0' (temp 2-component vector of float) +0:72 'inF1' (temp 2-component vector of float) +0:72 'inF2' (temp 2-component vector of float) +0:73 cosine (global 2-component vector of float) +0:73 'inF0' (temp 2-component vector of float) +0:74 hyp. cosine (global 2-component vector of float) +0:74 'inF0' (temp 2-component vector of float) +0:? bitCount (global 2-component vector of uint) +0:? Constant: +0:? 7 (const uint) +0:? 3 (const uint) +0:76 degrees (global 2-component vector of float) +0:76 'inF0' (temp 2-component vector of float) +0:77 distance (global float) +0:77 'inF0' (temp 2-component vector of float) +0:77 'inF1' (temp 2-component vector of float) +0:78 dot-product (global float) +0:78 'inF0' (temp 2-component vector of float) +0:78 'inF1' (temp 2-component vector of float) +0:82 exp (global 2-component vector of float) +0:82 'inF0' (temp 2-component vector of float) +0:83 exp2 (global 2-component vector of float) +0:83 'inF0' (temp 2-component vector of float) +0:84 face-forward (global 2-component vector of float) +0:84 'inF0' (temp 2-component vector of float) +0:84 'inF1' (temp 2-component vector of float) +0:84 'inF2' (temp 2-component vector of float) +0:85 findMSB (global int) +0:85 Constant: +0:85 7 (const int) +0:86 findLSB (global int) +0:86 Constant: +0:86 7 (const int) +0:87 Floor (global 2-component vector of float) +0:87 'inF0' (temp 2-component vector of float) +0:89 Function Call: fmod(vf2;vf2; (global 2-component vector of float) +0:89 'inF0' (temp 2-component vector of float) +0:89 'inF1' (temp 2-component vector of float) +0:90 Fraction (global 2-component vector of float) +0:90 'inF0' (temp 2-component vector of float) +0:91 frexp (global 2-component vector of float) +0:91 'inF0' (temp 2-component vector of float) +0:91 'inF1' (temp 2-component vector of float) +0:92 fwidth (global 2-component vector of float) +0:92 'inF0' (temp 2-component vector of float) +0:93 isinf (global 2-component vector of bool) +0:93 'inF0' (temp 2-component vector of float) +0:94 isnan (global 2-component vector of bool) +0:94 'inF0' (temp 2-component vector of float) +0:95 ldexp (global 2-component vector of float) +0:95 'inF0' (temp 2-component vector of float) +0:95 'inF1' (temp 2-component vector of float) +0:96 length (global float) +0:96 'inF0' (temp 2-component vector of float) +0:97 log (global 2-component vector of float) +0:97 'inF0' (temp 2-component vector of float) +0:98 log2 (global 2-component vector of float) +0:98 'inF0' (temp 2-component vector of float) +0:99 max (global 2-component vector of float) +0:99 'inF0' (temp 2-component vector of float) +0:99 'inF1' (temp 2-component vector of float) +0:100 min (global 2-component vector of float) +0:100 'inF0' (temp 2-component vector of float) +0:100 'inF1' (temp 2-component vector of float) +0:102 normalize (global 2-component vector of float) +0:102 'inF0' (temp 2-component vector of float) +0:103 pow (global 2-component vector of float) +0:103 'inF0' (temp 2-component vector of float) +0:103 'inF1' (temp 2-component vector of float) +0:104 radians (global 2-component vector of float) +0:104 'inF0' (temp 2-component vector of float) +0:105 reflect (global 2-component vector of float) +0:105 'inF0' (temp 2-component vector of float) +0:105 'inF1' (temp 2-component vector of float) +0:106 refract (global 2-component vector of float) +0:106 'inF0' (temp 2-component vector of float) +0:106 'inF1' (temp 2-component vector of float) +0:106 Constant: +0:106 2.000000 +0:? bitFieldReverse (global 2-component vector of uint) +0:? Constant: +0:? 1 (const uint) +0:? 2 (const uint) +0:108 roundEven (global 2-component vector of float) +0:108 'inF0' (temp 2-component vector of float) +0:109 inverse sqrt (global 2-component vector of float) +0:109 'inF0' (temp 2-component vector of float) +0:110 Sign (global 2-component vector of float) +0:110 'inF0' (temp 2-component vector of float) +0:111 sine (global 2-component vector of float) +0:111 'inF0' (temp 2-component vector of float) +0:112 hyp. sine (global 2-component vector of float) +0:112 'inF0' (temp 2-component vector of float) +0:113 smoothstep (global 2-component vector of float) +0:113 'inF0' (temp 2-component vector of float) +0:113 'inF1' (temp 2-component vector of float) +0:113 'inF2' (temp 2-component vector of float) +0:114 sqrt (global 2-component vector of float) +0:114 'inF0' (temp 2-component vector of float) +0:115 step (global 2-component vector of float) +0:115 'inF0' (temp 2-component vector of float) +0:115 'inF1' (temp 2-component vector of float) +0:116 tangent (global 2-component vector of float) +0:116 'inF0' (temp 2-component vector of float) +0:117 hyp. tangent (global 2-component vector of float) +0:117 'inF0' (temp 2-component vector of float) +0:119 trunc (global 2-component vector of float) +0:119 'inF0' (temp 2-component vector of float) +0:122 Branch: Return with expression +0:? Constant: +0:? 1.000000 +0:? 2.000000 +0:189 Function Definition: VertexShaderFunction(vf3;vf3;vf3; (temp 3-component vector of float) +0:126 Function Parameters: +0:126 'inF0' (temp 3-component vector of float) +0:126 'inF1' (temp 3-component vector of float) +0:126 'inF2' (temp 3-component vector of float) +0:? Sequence +0:127 all (global bool) +0:127 'inF0' (temp 3-component vector of float) +0:128 Absolute value (global 3-component vector of float) +0:128 'inF0' (temp 3-component vector of float) +0:129 arc cosine (global 3-component vector of float) +0:129 'inF0' (temp 3-component vector of float) +0:130 any (global bool) +0:130 'inF0' (temp 3-component vector of float) +0:131 arc sine (global 3-component vector of float) +0:131 'inF0' (temp 3-component vector of float) +0:132 arc tangent (global 3-component vector of float) +0:132 'inF0' (temp 3-component vector of float) +0:133 arc tangent (global 3-component vector of float) +0:133 'inF0' (temp 3-component vector of float) +0:133 'inF1' (temp 3-component vector of float) +0:134 Ceiling (global 3-component vector of float) +0:134 'inF0' (temp 3-component vector of float) +0:135 clamp (global 3-component vector of float) +0:135 'inF0' (temp 3-component vector of float) +0:135 'inF1' (temp 3-component vector of float) +0:135 'inF2' (temp 3-component vector of float) +0:136 cosine (global 3-component vector of float) +0:136 'inF0' (temp 3-component vector of float) +0:137 hyp. cosine (global 3-component vector of float) +0:137 'inF0' (temp 3-component vector of float) +0:? bitCount (global 3-component vector of uint) +0:? Constant: +0:? 7 (const uint) +0:? 3 (const uint) +0:? 5 (const uint) +0:139 cross-product (global 3-component vector of float) +0:139 'inF0' (temp 3-component vector of float) +0:139 'inF1' (temp 3-component vector of float) +0:140 degrees (global 3-component vector of float) +0:140 'inF0' (temp 3-component vector of float) +0:141 distance (global float) +0:141 'inF0' (temp 3-component vector of float) +0:141 'inF1' (temp 3-component vector of float) +0:142 dot-product (global float) +0:142 'inF0' (temp 3-component vector of float) +0:142 'inF1' (temp 3-component vector of float) +0:146 exp (global 3-component vector of float) +0:146 'inF0' (temp 3-component vector of float) +0:147 exp2 (global 3-component vector of float) +0:147 'inF0' (temp 3-component vector of float) +0:148 face-forward (global 3-component vector of float) +0:148 'inF0' (temp 3-component vector of float) +0:148 'inF1' (temp 3-component vector of float) +0:148 'inF2' (temp 3-component vector of float) +0:149 findMSB (global int) +0:149 Constant: +0:149 7 (const int) +0:150 findLSB (global int) +0:150 Constant: +0:150 7 (const int) +0:151 Floor (global 3-component vector of float) +0:151 'inF0' (temp 3-component vector of float) +0:153 Function Call: fmod(vf3;vf3; (global 3-component vector of float) +0:153 'inF0' (temp 3-component vector of float) +0:153 'inF1' (temp 3-component vector of float) +0:154 Fraction (global 3-component vector of float) +0:154 'inF0' (temp 3-component vector of float) +0:155 frexp (global 3-component vector of float) +0:155 'inF0' (temp 3-component vector of float) +0:155 'inF1' (temp 3-component vector of float) +0:156 fwidth (global 3-component vector of float) +0:156 'inF0' (temp 3-component vector of float) +0:157 isinf (global 3-component vector of bool) +0:157 'inF0' (temp 3-component vector of float) +0:158 isnan (global 3-component vector of bool) +0:158 'inF0' (temp 3-component vector of float) +0:159 ldexp (global 3-component vector of float) +0:159 'inF0' (temp 3-component vector of float) +0:159 'inF1' (temp 3-component vector of float) +0:160 length (global float) +0:160 'inF0' (temp 3-component vector of float) +0:161 log (global 3-component vector of float) +0:161 'inF0' (temp 3-component vector of float) +0:162 log2 (global 3-component vector of float) +0:162 'inF0' (temp 3-component vector of float) +0:163 max (global 3-component vector of float) +0:163 'inF0' (temp 3-component vector of float) +0:163 'inF1' (temp 3-component vector of float) +0:164 min (global 3-component vector of float) +0:164 'inF0' (temp 3-component vector of float) +0:164 'inF1' (temp 3-component vector of float) +0:166 normalize (global 3-component vector of float) +0:166 'inF0' (temp 3-component vector of float) +0:167 pow (global 3-component vector of float) +0:167 'inF0' (temp 3-component vector of float) +0:167 'inF1' (temp 3-component vector of float) +0:168 radians (global 3-component vector of float) +0:168 'inF0' (temp 3-component vector of float) +0:169 reflect (global 3-component vector of float) +0:169 'inF0' (temp 3-component vector of float) +0:169 'inF1' (temp 3-component vector of float) +0:170 refract (global 3-component vector of float) +0:170 'inF0' (temp 3-component vector of float) +0:170 'inF1' (temp 3-component vector of float) +0:170 Constant: +0:170 2.000000 +0:? bitFieldReverse (global 3-component vector of uint) +0:? Constant: +0:? 1 (const uint) +0:? 2 (const uint) +0:? 3 (const uint) +0:172 roundEven (global 3-component vector of float) +0:172 'inF0' (temp 3-component vector of float) +0:173 inverse sqrt (global 3-component vector of float) +0:173 'inF0' (temp 3-component vector of float) +0:174 Sign (global 3-component vector of float) +0:174 'inF0' (temp 3-component vector of float) +0:175 sine (global 3-component vector of float) +0:175 'inF0' (temp 3-component vector of float) +0:176 hyp. sine (global 3-component vector of float) +0:176 'inF0' (temp 3-component vector of float) +0:177 smoothstep (global 3-component vector of float) +0:177 'inF0' (temp 3-component vector of float) +0:177 'inF1' (temp 3-component vector of float) +0:177 'inF2' (temp 3-component vector of float) +0:178 sqrt (global 3-component vector of float) +0:178 'inF0' (temp 3-component vector of float) +0:179 step (global 3-component vector of float) +0:179 'inF0' (temp 3-component vector of float) +0:179 'inF1' (temp 3-component vector of float) +0:180 tangent (global 3-component vector of float) +0:180 'inF0' (temp 3-component vector of float) +0:181 hyp. tangent (global 3-component vector of float) +0:181 'inF0' (temp 3-component vector of float) +0:183 trunc (global 3-component vector of float) +0:183 'inF0' (temp 3-component vector of float) +0:186 Branch: Return with expression +0:? Constant: +0:? 1.000000 +0:? 2.000000 +0:? 3.000000 +0:298 Function Definition: VertexShaderFunction(vf4;vf4;vf4; (temp 4-component vector of float) +0:190 Function Parameters: +0:190 'inF0' (temp 4-component vector of float) +0:190 'inF1' (temp 4-component vector of float) +0:190 'inF2' (temp 4-component vector of float) +0:? Sequence +0:191 all (global bool) +0:191 'inF0' (temp 4-component vector of float) +0:192 Absolute value (global 4-component vector of float) +0:192 'inF0' (temp 4-component vector of float) +0:193 arc cosine (global 4-component vector of float) +0:193 'inF0' (temp 4-component vector of float) +0:194 any (global bool) +0:194 'inF0' (temp 4-component vector of float) +0:195 arc sine (global 4-component vector of float) +0:195 'inF0' (temp 4-component vector of float) +0:196 arc tangent (global 4-component vector of float) +0:196 'inF0' (temp 4-component vector of float) +0:197 arc tangent (global 4-component vector of float) +0:197 'inF0' (temp 4-component vector of float) +0:197 'inF1' (temp 4-component vector of float) +0:198 Ceiling (global 4-component vector of float) +0:198 'inF0' (temp 4-component vector of float) +0:199 clamp (global 4-component vector of float) +0:199 'inF0' (temp 4-component vector of float) +0:199 'inF1' (temp 4-component vector of float) +0:199 'inF2' (temp 4-component vector of float) +0:200 cosine (global 4-component vector of float) +0:200 'inF0' (temp 4-component vector of float) +0:201 hyp. cosine (global 4-component vector of float) +0:201 'inF0' (temp 4-component vector of float) +0:? bitCount (global 4-component vector of uint) +0:? Constant: +0:? 7 (const uint) +0:? 3 (const uint) +0:? 5 (const uint) +0:? 2 (const uint) +0:203 degrees (global 4-component vector of float) +0:203 'inF0' (temp 4-component vector of float) +0:204 distance (global float) +0:204 'inF0' (temp 4-component vector of float) +0:204 'inF1' (temp 4-component vector of float) +0:205 dot-product (global float) +0:205 'inF0' (temp 4-component vector of float) +0:205 'inF1' (temp 4-component vector of float) +0:209 exp (global 4-component vector of float) +0:209 'inF0' (temp 4-component vector of float) +0:210 exp2 (global 4-component vector of float) +0:210 'inF0' (temp 4-component vector of float) +0:211 face-forward (global 4-component vector of float) +0:211 'inF0' (temp 4-component vector of float) +0:211 'inF1' (temp 4-component vector of float) +0:211 'inF2' (temp 4-component vector of float) +0:212 findMSB (global int) +0:212 Constant: +0:212 7 (const int) +0:213 findLSB (global int) +0:213 Constant: +0:213 7 (const int) +0:214 Floor (global 4-component vector of float) +0:214 'inF0' (temp 4-component vector of float) +0:216 Function Call: fmod(vf4;vf4; (global 4-component vector of float) +0:216 'inF0' (temp 4-component vector of float) +0:216 'inF1' (temp 4-component vector of float) +0:217 Fraction (global 4-component vector of float) +0:217 'inF0' (temp 4-component vector of float) +0:218 frexp (global 4-component vector of float) +0:218 'inF0' (temp 4-component vector of float) +0:218 'inF1' (temp 4-component vector of float) +0:219 fwidth (global 4-component vector of float) +0:219 'inF0' (temp 4-component vector of float) +0:220 isinf (global 4-component vector of bool) +0:220 'inF0' (temp 4-component vector of float) +0:221 isnan (global 4-component vector of bool) +0:221 'inF0' (temp 4-component vector of float) +0:222 ldexp (global 4-component vector of float) +0:222 'inF0' (temp 4-component vector of float) +0:222 'inF1' (temp 4-component vector of float) +0:223 length (global float) +0:223 'inF0' (temp 4-component vector of float) +0:224 log (global 4-component vector of float) +0:224 'inF0' (temp 4-component vector of float) +0:225 log2 (global 4-component vector of float) +0:225 'inF0' (temp 4-component vector of float) +0:226 max (global 4-component vector of float) +0:226 'inF0' (temp 4-component vector of float) +0:226 'inF1' (temp 4-component vector of float) +0:227 min (global 4-component vector of float) +0:227 'inF0' (temp 4-component vector of float) +0:227 'inF1' (temp 4-component vector of float) +0:229 normalize (global 4-component vector of float) +0:229 'inF0' (temp 4-component vector of float) +0:230 pow (global 4-component vector of float) +0:230 'inF0' (temp 4-component vector of float) +0:230 'inF1' (temp 4-component vector of float) +0:231 radians (global 4-component vector of float) +0:231 'inF0' (temp 4-component vector of float) +0:232 reflect (global 4-component vector of float) +0:232 'inF0' (temp 4-component vector of float) +0:232 'inF1' (temp 4-component vector of float) +0:233 refract (global 4-component vector of float) +0:233 'inF0' (temp 4-component vector of float) +0:233 'inF1' (temp 4-component vector of float) +0:233 Constant: +0:233 2.000000 +0:? bitFieldReverse (global 4-component vector of uint) +0:? Constant: +0:? 1 (const uint) +0:? 2 (const uint) +0:? 3 (const uint) +0:? 4 (const uint) +0:235 roundEven (global 4-component vector of float) +0:235 'inF0' (temp 4-component vector of float) +0:236 inverse sqrt (global 4-component vector of float) +0:236 'inF0' (temp 4-component vector of float) +0:237 Sign (global 4-component vector of float) +0:237 'inF0' (temp 4-component vector of float) +0:238 sine (global 4-component vector of float) +0:238 'inF0' (temp 4-component vector of float) +0:239 hyp. sine (global 4-component vector of float) +0:239 'inF0' (temp 4-component vector of float) +0:240 smoothstep (global 4-component vector of float) +0:240 'inF0' (temp 4-component vector of float) +0:240 'inF1' (temp 4-component vector of float) +0:240 'inF2' (temp 4-component vector of float) +0:241 sqrt (global 4-component vector of float) +0:241 'inF0' (temp 4-component vector of float) +0:242 step (global 4-component vector of float) +0:242 'inF0' (temp 4-component vector of float) +0:242 'inF1' (temp 4-component vector of float) +0:243 tangent (global 4-component vector of float) +0:243 'inF0' (temp 4-component vector of float) +0:244 hyp. tangent (global 4-component vector of float) +0:244 'inF0' (temp 4-component vector of float) +0:246 trunc (global 4-component vector of float) +0:246 'inF0' (temp 4-component vector of float) +0:249 Branch: Return with expression +0:? Constant: +0:? 1.000000 +0:? 2.000000 +0:? 3.000000 +0:? 4.000000 +0:307 Function Definition: VertexShaderFunction(mf22;mf22;mf22; (temp 2X2 matrix of float) +0:299 Function Parameters: +0:299 'inF0' (temp 2X2 matrix of float) +0:299 'inF1' (temp 2X2 matrix of float) +0:299 'inF2' (temp 2X2 matrix of float) +0:? Sequence +0:301 all (global bool) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 Absolute value (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 arc cosine (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 any (global bool) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 arc sine (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 arc tangent (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 arc tangent (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 'inF1' (temp 2X2 matrix of float) +0:301 Ceiling (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 clamp (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 'inF1' (temp 2X2 matrix of float) +0:301 'inF2' (temp 2X2 matrix of float) +0:301 cosine (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 hyp. cosine (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 degrees (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 determinant (global float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 exp (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 exp2 (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 findMSB (global int) +0:301 Constant: +0:301 7 (const int) +0:301 findLSB (global int) +0:301 Constant: +0:301 7 (const int) +0:301 Floor (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 Function Call: fmod(mf22;mf22; (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 'inF1' (temp 2X2 matrix of float) +0:301 Fraction (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 frexp (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 'inF1' (temp 2X2 matrix of float) +0:301 fwidth (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 ldexp (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 'inF1' (temp 2X2 matrix of float) +0:301 log (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 log2 (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 max (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 'inF1' (temp 2X2 matrix of float) +0:301 min (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 'inF1' (temp 2X2 matrix of float) +0:301 pow (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 'inF1' (temp 2X2 matrix of float) +0:301 radians (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 roundEven (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 inverse sqrt (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 Sign (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 sine (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 hyp. sine (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 smoothstep (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 'inF1' (temp 2X2 matrix of float) +0:301 'inF2' (temp 2X2 matrix of float) +0:301 sqrt (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 step (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 'inF1' (temp 2X2 matrix of float) +0:301 tangent (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 hyp. tangent (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 transpose (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:301 trunc (global 2X2 matrix of float) +0:301 'inF0' (temp 2X2 matrix of float) +0:304 Branch: Return with expression +0:? Constant: +0:? 2.000000 +0:? 2.000000 +0:? 2.000000 +0:? 2.000000 +0:316 Function Definition: VertexShaderFunction(mf33;mf33;mf33; (temp 3X3 matrix of float) +0:308 Function Parameters: +0:308 'inF0' (temp 3X3 matrix of float) +0:308 'inF1' (temp 3X3 matrix of float) +0:308 'inF2' (temp 3X3 matrix of float) +0:? Sequence +0:310 all (global bool) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 Absolute value (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 arc cosine (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 any (global bool) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 arc sine (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 arc tangent (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 arc tangent (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 'inF1' (temp 3X3 matrix of float) +0:310 Ceiling (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 clamp (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 'inF1' (temp 3X3 matrix of float) +0:310 'inF2' (temp 3X3 matrix of float) +0:310 cosine (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 hyp. cosine (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 degrees (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 determinant (global float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 exp (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 exp2 (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 findMSB (global int) +0:310 Constant: +0:310 7 (const int) +0:310 findLSB (global int) +0:310 Constant: +0:310 7 (const int) +0:310 Floor (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 Function Call: fmod(mf33;mf33; (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 'inF1' (temp 3X3 matrix of float) +0:310 Fraction (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 frexp (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 'inF1' (temp 3X3 matrix of float) +0:310 fwidth (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 ldexp (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 'inF1' (temp 3X3 matrix of float) +0:310 log (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 log2 (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 max (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 'inF1' (temp 3X3 matrix of float) +0:310 min (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 'inF1' (temp 3X3 matrix of float) +0:310 pow (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 'inF1' (temp 3X3 matrix of float) +0:310 radians (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 roundEven (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 inverse sqrt (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 Sign (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 sine (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 hyp. sine (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 smoothstep (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 'inF1' (temp 3X3 matrix of float) +0:310 'inF2' (temp 3X3 matrix of float) +0:310 sqrt (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 step (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 'inF1' (temp 3X3 matrix of float) +0:310 tangent (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 hyp. tangent (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 transpose (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:310 trunc (global 3X3 matrix of float) +0:310 'inF0' (temp 3X3 matrix of float) +0:313 Branch: Return with expression +0:? Constant: +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:324 Function Definition: VertexShaderFunction(mf44;mf44;mf44; (temp 4X4 matrix of float) +0:317 Function Parameters: +0:317 'inF0' (temp 4X4 matrix of float) +0:317 'inF1' (temp 4X4 matrix of float) +0:317 'inF2' (temp 4X4 matrix of float) +0:? Sequence +0:319 all (global bool) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 Absolute value (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 arc cosine (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 any (global bool) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 arc sine (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 arc tangent (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 arc tangent (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 'inF1' (temp 4X4 matrix of float) +0:319 Ceiling (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 clamp (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 'inF1' (temp 4X4 matrix of float) +0:319 'inF2' (temp 4X4 matrix of float) +0:319 cosine (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 hyp. cosine (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 degrees (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 determinant (global float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 exp (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 exp2 (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 findMSB (global int) +0:319 Constant: +0:319 7 (const int) +0:319 findLSB (global int) +0:319 Constant: +0:319 7 (const int) +0:319 Floor (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 Function Call: fmod(mf44;mf44; (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 'inF1' (temp 4X4 matrix of float) +0:319 Fraction (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 frexp (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 'inF1' (temp 4X4 matrix of float) +0:319 fwidth (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 ldexp (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 'inF1' (temp 4X4 matrix of float) +0:319 log (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 log2 (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 max (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 'inF1' (temp 4X4 matrix of float) +0:319 min (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 'inF1' (temp 4X4 matrix of float) +0:319 pow (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 'inF1' (temp 4X4 matrix of float) +0:319 radians (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 roundEven (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 inverse sqrt (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 Sign (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 sine (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 hyp. sine (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 smoothstep (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 'inF1' (temp 4X4 matrix of float) +0:319 'inF2' (temp 4X4 matrix of float) +0:319 sqrt (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 step (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 'inF1' (temp 4X4 matrix of float) +0:319 tangent (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 hyp. tangent (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 transpose (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:319 trunc (global 4X4 matrix of float) +0:319 'inF0' (temp 4X4 matrix of float) +0:322 Branch: Return with expression +0:? Constant: +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? Linker Objects + +Missing functionality: missing user function; linker needs to catch that +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 796 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "VertexShaderFunction" + Source HLSL 450 + Name 4 "VertexShaderFunction" + Name 8 "inF0" + Name 23 "inF1" + Name 30 "inF2" + Name 55 "ResType" + Name 115 "inF0" + Name 129 "inF1" + Name 136 "inF2" + Name 171 "ResType" + Name 244 "inF0" + Name 258 "inF1" + Name 265 "inF2" + Name 303 "ResType" + Name 374 "inF0" + Name 388 "inF1" + Name 395 "inF2" + Name 429 "ResType" + Name 501 "inF0" + Name 515 "inF1" + Name 522 "inF2" + Name 544 "ResType" + Name 600 "inF0" + Name 614 "inF1" + Name 621 "inF2" + Name 643 "ResType" + Name 699 "inF0" + Name 713 "inF1" + Name 720 "inF2" + Name 742 "ResType" + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypePointer Function 6(float) + 10: TypeBool + 37: TypeInt 32 0 + 38: 37(int) Constant 7 + 46: TypeInt 32 1 + 47: 46(int) Constant 7 + 55(ResType): TypeStruct 6(float) 46(int) + 83: 37(int) Constant 2 + 110: 6(float) Constant 0 + 113: TypeVector 6(float) 2 + 114: TypePointer Function 113(fvec2) + 143: TypeVector 37(int) 2 + 144: 37(int) Constant 3 + 145: 143(ivec2) ConstantComposite 38 144 + 170: TypeVector 46(int) 2 + 171(ResType): TypeStruct 113(fvec2) 170(ivec2) + 178: TypeVector 10(bool) 2 + 209: 6(float) Constant 1073741824 + 211: 37(int) Constant 1 + 212: 143(ivec2) ConstantComposite 211 83 + 239: 6(float) Constant 1065353216 + 240: 113(fvec2) ConstantComposite 239 209 + 242: TypeVector 6(float) 3 + 243: TypePointer Function 242(fvec3) + 272: TypeVector 37(int) 3 + 273: 37(int) Constant 5 + 274: 272(ivec3) ConstantComposite 38 144 273 + 302: TypeVector 46(int) 3 + 303(ResType): TypeStruct 242(fvec3) 302(ivec3) + 310: TypeVector 10(bool) 3 + 342: 272(ivec3) ConstantComposite 211 83 144 + 369: 6(float) Constant 1077936128 + 370: 242(fvec3) ConstantComposite 239 209 369 + 372: TypeVector 6(float) 4 + 373: TypePointer Function 372(fvec4) + 402: TypeVector 37(int) 4 + 403: 402(ivec4) ConstantComposite 38 144 273 83 + 428: TypeVector 46(int) 4 + 429(ResType): TypeStruct 372(fvec4) 428(ivec4) + 436: TypeVector 10(bool) 4 + 468: 37(int) Constant 4 + 469: 402(ivec4) ConstantComposite 211 83 144 468 + 496: 6(float) Constant 1082130432 + 497: 372(fvec4) ConstantComposite 239 209 369 496 + 499: TypeMatrix 113(fvec2) 2 + 500: TypePointer Function 499 + 544(ResType): TypeStruct 499 170(ivec2) + 595: 113(fvec2) ConstantComposite 209 209 + 596: 499 ConstantComposite 595 595 + 598: TypeMatrix 242(fvec3) 3 + 599: TypePointer Function 598 + 643(ResType): TypeStruct 598 302(ivec3) + 694: 242(fvec3) ConstantComposite 369 369 369 + 695: 598 ConstantComposite 694 694 694 + 697: TypeMatrix 372(fvec4) 4 + 698: TypePointer Function 697 + 742(ResType): TypeStruct 697 428(ivec4) + 793: 372(fvec4) ConstantComposite 496 496 496 496 + 794: 697 ConstantComposite 793 793 793 793 +4(VertexShaderFunction): 2 Function None 3 + 5: Label + 8(inF0): 7(ptr) Variable Function + 23(inF1): 7(ptr) Variable Function + 30(inF2): 7(ptr) Variable Function + 115(inF0): 114(ptr) Variable Function + 129(inF1): 114(ptr) Variable Function + 136(inF2): 114(ptr) Variable Function + 244(inF0): 243(ptr) Variable Function + 258(inF1): 243(ptr) Variable Function + 265(inF2): 243(ptr) Variable Function + 374(inF0): 373(ptr) Variable Function + 388(inF1): 373(ptr) Variable Function + 395(inF2): 373(ptr) Variable Function + 501(inF0): 500(ptr) Variable Function + 515(inF1): 500(ptr) Variable Function + 522(inF2): 500(ptr) Variable Function + 600(inF0): 599(ptr) Variable Function + 614(inF1): 599(ptr) Variable Function + 621(inF2): 599(ptr) Variable Function + 699(inF0): 698(ptr) Variable Function + 713(inF1): 698(ptr) Variable Function + 720(inF2): 698(ptr) Variable Function + 9: 6(float) Load 8(inF0) + 11: 10(bool) All 9 + 12: 6(float) Load 8(inF0) + 13: 6(float) ExtInst 1(GLSL.std.450) 4(FAbs) 12 + 14: 6(float) Load 8(inF0) + 15: 6(float) ExtInst 1(GLSL.std.450) 17(Acos) 14 + 16: 6(float) Load 8(inF0) + 17: 10(bool) Any 16 + 18: 6(float) Load 8(inF0) + 19: 6(float) ExtInst 1(GLSL.std.450) 16(Asin) 18 + 20: 6(float) Load 8(inF0) + 21: 6(float) ExtInst 1(GLSL.std.450) 18(Atan) 20 + 22: 6(float) Load 8(inF0) + 24: 6(float) Load 23(inF1) + 25: 6(float) ExtInst 1(GLSL.std.450) 25(Atan2) 22 24 + 26: 6(float) Load 8(inF0) + 27: 6(float) ExtInst 1(GLSL.std.450) 9(Ceil) 26 + 28: 6(float) Load 8(inF0) + 29: 6(float) Load 23(inF1) + 31: 6(float) Load 30(inF2) + 32: 6(float) ExtInst 1(GLSL.std.450) 43(FClamp) 28 29 31 + 33: 6(float) Load 8(inF0) + 34: 6(float) ExtInst 1(GLSL.std.450) 14(Cos) 33 + 35: 6(float) Load 8(inF0) + 36: 6(float) ExtInst 1(GLSL.std.450) 20(Cosh) 35 + 39: 37(int) BitCount 38 + 40: 6(float) Load 8(inF0) + 41: 6(float) ExtInst 1(GLSL.std.450) 12(Degrees) 40 + 42: 6(float) Load 8(inF0) + 43: 6(float) ExtInst 1(GLSL.std.450) 27(Exp) 42 + 44: 6(float) Load 8(inF0) + 45: 6(float) ExtInst 1(GLSL.std.450) 29(Exp2) 44 + 48: 46(int) ExtInst 1(GLSL.std.450) 74(FindSMsb) 47 + 49: 46(int) ExtInst 1(GLSL.std.450) 73(FindILsb) 47 + 50: 6(float) Load 8(inF0) + 51: 6(float) ExtInst 1(GLSL.std.450) 8(Floor) 50 + 52: 6(float) Load 8(inF0) + 53: 6(float) ExtInst 1(GLSL.std.450) 10(Fract) 52 + 54: 6(float) Load 8(inF0) + 56: 55(ResType) ExtInst 1(GLSL.std.450) 52(FrexpStruct) 54 + 57: 46(int) CompositeExtract 56 1 + Store 23(inF1) 57 + 58: 6(float) CompositeExtract 56 0 + 59: 6(float) Load 8(inF0) + 60: 6(float) Fwidth 59 + 61: 6(float) Load 8(inF0) + 62: 10(bool) IsInf 61 + 63: 6(float) Load 8(inF0) + 64: 10(bool) IsNan 63 + 65: 6(float) Load 8(inF0) + 66: 6(float) Load 23(inF1) + 67: 6(float) ExtInst 1(GLSL.std.450) 53(Ldexp) 65 66 + 68: 6(float) Load 8(inF0) + 69: 6(float) ExtInst 1(GLSL.std.450) 28(Log) 68 + 70: 6(float) Load 8(inF0) + 71: 6(float) ExtInst 1(GLSL.std.450) 30(Log2) 70 + 72: 6(float) Load 8(inF0) + 73: 6(float) Load 23(inF1) + 74: 6(float) ExtInst 1(GLSL.std.450) 40(FMax) 72 73 + 75: 6(float) Load 8(inF0) + 76: 6(float) Load 23(inF1) + 77: 6(float) ExtInst 1(GLSL.std.450) 37(FMin) 75 76 + 78: 6(float) Load 8(inF0) + 79: 6(float) Load 23(inF1) + 80: 6(float) ExtInst 1(GLSL.std.450) 26(Pow) 78 79 + 81: 6(float) Load 8(inF0) + 82: 6(float) ExtInst 1(GLSL.std.450) 11(Radians) 81 + 84: 37(int) BitReverse 83 + 85: 6(float) Load 8(inF0) + 86: 6(float) ExtInst 1(GLSL.std.450) 2(RoundEven) 85 + 87: 6(float) Load 8(inF0) + 88: 6(float) ExtInst 1(GLSL.std.450) 32(InverseSqrt) 87 + 89: 6(float) Load 8(inF0) + 90: 6(float) ExtInst 1(GLSL.std.450) 6(FSign) 89 + 91: 6(float) Load 8(inF0) + 92: 6(float) ExtInst 1(GLSL.std.450) 13(Sin) 91 + 93: 6(float) Load 8(inF0) + 94: 6(float) ExtInst 1(GLSL.std.450) 19(Sinh) 93 + 95: 6(float) Load 8(inF0) + 96: 6(float) Load 23(inF1) + 97: 6(float) Load 30(inF2) + 98: 6(float) ExtInst 1(GLSL.std.450) 49(SmoothStep) 95 96 97 + 99: 6(float) Load 8(inF0) + 100: 6(float) ExtInst 1(GLSL.std.450) 31(Sqrt) 99 + 101: 6(float) Load 8(inF0) + 102: 6(float) Load 23(inF1) + 103: 6(float) ExtInst 1(GLSL.std.450) 48(Step) 101 102 + 104: 6(float) Load 8(inF0) + 105: 6(float) ExtInst 1(GLSL.std.450) 15(Tan) 104 + 106: 6(float) Load 8(inF0) + 107: 6(float) ExtInst 1(GLSL.std.450) 21(Tanh) 106 + 108: 6(float) Load 8(inF0) + 109: 6(float) ExtInst 1(GLSL.std.450) 3(Trunc) 108 + ReturnValue 110 + FunctionEnd diff --git a/Test/baseResults/hlsl.matType.frag.out b/Test/baseResults/hlsl.matType.frag.out index 438a06a4..298211df 100755 --- a/Test/baseResults/hlsl.matType.frag.out +++ b/Test/baseResults/hlsl.matType.frag.out @@ -1,5 +1,5 @@ hlsl.matType.frag -Shader version: 100 +Shader version: 450 gl_FragCoord origin is upper left 0:? Sequence 0:1 move second child to first child (temp 1-component vector of float) @@ -22,7 +22,7 @@ gl_FragCoord origin is upper left Linked fragment stage: -Shader version: 100 +Shader version: 450 gl_FragCoord origin is upper left 0:? Sequence 0:1 move second child to first child (temp 1-component vector of float) @@ -51,7 +51,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "PixelShaderFunction" ExecutionMode 4 OriginUpperLeft - Source HLSL 100 + Source HLSL 450 Name 4 "PixelShaderFunction" Name 11 "ShaderFunction(vf1;f1;" Name 9 "inFloat1" diff --git a/Test/baseResults/hlsl.max.frag.out b/Test/baseResults/hlsl.max.frag.out index addc965c..7c3c7e69 100755 --- a/Test/baseResults/hlsl.max.frag.out +++ b/Test/baseResults/hlsl.max.frag.out @@ -1,5 +1,5 @@ hlsl.max.frag -Shader version: 100 +Shader version: 450 gl_FragCoord origin is upper left 0:? Sequence 0:5 Function Definition: PixelShaderFunction(vf4;vf4; (temp 4-component vector of float) @@ -17,7 +17,7 @@ gl_FragCoord origin is upper left Linked fragment stage: -Shader version: 100 +Shader version: 450 gl_FragCoord origin is upper left 0:? Sequence 0:5 Function Definition: PixelShaderFunction(vf4;vf4; (temp 4-component vector of float) @@ -40,7 +40,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "PixelShaderFunction" ExecutionMode 4 OriginUpperLeft - Source HLSL 100 + Source HLSL 450 Name 4 "PixelShaderFunction" Name 9 "input1" Name 11 "input2" diff --git a/Test/baseResults/hlsl.precedence.frag.out b/Test/baseResults/hlsl.precedence.frag.out index fc31f4b2..dc0b0e93 100755 --- a/Test/baseResults/hlsl.precedence.frag.out +++ b/Test/baseResults/hlsl.precedence.frag.out @@ -1,5 +1,5 @@ hlsl.precedence.frag -Shader version: 100 +Shader version: 450 gl_FragCoord origin is upper left 0:? Sequence 0:10 Function Definition: PixelShaderFunction(vf4;vf4;vf4;vf4; (temp 4-component vector of float) @@ -23,7 +23,7 @@ gl_FragCoord origin is upper left Linked fragment stage: -Shader version: 100 +Shader version: 450 gl_FragCoord origin is upper left 0:? Sequence 0:10 Function Definition: PixelShaderFunction(vf4;vf4;vf4;vf4; (temp 4-component vector of float) @@ -52,7 +52,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "PixelShaderFunction" ExecutionMode 4 OriginUpperLeft - Source HLSL 100 + Source HLSL 450 Name 4 "PixelShaderFunction" Name 9 "a1" Name 11 "a2" diff --git a/Test/baseResults/hlsl.precedence2.frag.out b/Test/baseResults/hlsl.precedence2.frag.out index fc4ae025..73d500d3 100755 --- a/Test/baseResults/hlsl.precedence2.frag.out +++ b/Test/baseResults/hlsl.precedence2.frag.out @@ -1,5 +1,5 @@ hlsl.precedence2.frag -Shader version: 100 +Shader version: 450 gl_FragCoord origin is upper left 0:? Sequence 0:10 Function Definition: PixelShaderFunction(i1;i1;i1;i1; (temp int) @@ -31,7 +31,7 @@ gl_FragCoord origin is upper left Linked fragment stage: -Shader version: 100 +Shader version: 450 gl_FragCoord origin is upper left 0:? Sequence 0:10 Function Definition: PixelShaderFunction(i1;i1;i1;i1; (temp int) @@ -68,7 +68,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "PixelShaderFunction" ExecutionMode 4 OriginUpperLeft - Source HLSL 100 + Source HLSL 450 Name 4 "PixelShaderFunction" Name 8 "a1" Name 10 "a2" diff --git a/Test/baseResults/hlsl.sin.frag.out b/Test/baseResults/hlsl.sin.frag.out index 7d4f626d..331945ac 100755 --- a/Test/baseResults/hlsl.sin.frag.out +++ b/Test/baseResults/hlsl.sin.frag.out @@ -1,5 +1,5 @@ hlsl.sin.frag -Shader version: 100 +Shader version: 450 gl_FragCoord origin is upper left 0:? Sequence 0:5 Function Definition: PixelShaderFunction(vf4; (temp 4-component vector of float) @@ -15,7 +15,7 @@ gl_FragCoord origin is upper left Linked fragment stage: -Shader version: 100 +Shader version: 450 gl_FragCoord origin is upper left 0:? Sequence 0:5 Function Definition: PixelShaderFunction(vf4; (temp 4-component vector of float) @@ -36,7 +36,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "PixelShaderFunction" ExecutionMode 4 OriginUpperLeft - Source HLSL 100 + Source HLSL 450 Name 4 "PixelShaderFunction" Name 9 "input" 2: TypeVoid diff --git a/Test/hlsl.intrinsics.frag b/Test/hlsl.intrinsics.frag new file mode 100644 index 00000000..563ce225 --- /dev/null +++ b/Test/hlsl.intrinsics.frag @@ -0,0 +1,353 @@ +float PixelShaderFunction(float inF0, float inF1, float inF2) +{ + all(inF0); + abs(inF0); + acos(inF0); + any(inF0); + asin(inF0); + atan(inF0); + atan2(inF0, inF1); + ceil(inF0); + clamp(inF0, inF1, inF2); + cos(inF0); + cosh(inF0); + countbits(7); + ddx(inF0); + ddx_coarse(inF0); + ddx_fine(inF0); + ddy(inF0); + ddy_coarse(inF0); + ddy_fine(inF0); + degrees(inF0); + // EvaluateAttributeAtCentroid(inF0); + // EvaluateAttributeAtSample(inF0, 0); + // TODO: EvaluateAttributeSnapped(inF0, int2(1,2)); + exp(inF0); + exp2(inF0); + firstbithigh(7); + firstbitlow(7); + floor(inF0); + // TODO: fma(inD0, inD1, inD2); + fmod(inF0, inF1); + frac(inF0); + frexp(inF0, inF1); + fwidth(inF0); + isinf(inF0); + isnan(inF0); + ldexp(inF0, inF1); + log(inF0); + log2(inF0); + max(inF0, inF1); + min(inF0, inF1); + // TODO: mul(inF0, inF1); + pow(inF0, inF1); + radians(inF0); + reversebits(2); + round(inF0); + rsqrt(inF0); + sign(inF0); + sin(inF0); + sinh(inF0); + smoothstep(inF0, inF1, inF2); + sqrt(inF0); + step(inF0, inF1); + tan(inF0); + tanh(inF0); + // TODO: sampler intrinsics, when we can declare the types. + trunc(inF0); + + return 0.0; +} + +float1 PixelShaderFunction(float1 inF0, float1 inF1, float1 inF2) +{ + // TODO: ... add when float1 prototypes are generated + return 0.0; +} + +float2 PixelShaderFunction(float2 inF0, float2 inF1, float2 inF2) +{ + all(inF0); + abs(inF0); + acos(inF0); + any(inF0); + asin(inF0); + atan(inF0); + atan2(inF0, inF1); + ceil(inF0); + clamp(inF0, inF1, inF2); + cos(inF0); + cosh(inF0); + countbits(int2(7,3)); + ddx(inF0); + ddx_coarse(inF0); + ddx_fine(inF0); + ddy(inF0); + ddy_coarse(inF0); + ddy_fine(inF0); + degrees(inF0); + distance(inF0, inF1); + dot(inF0, inF1); + // EvaluateAttributeAtCentroid(inF0); + // EvaluateAttributeAtSample(inF0, 0); + // TODO: EvaluateAttributeSnapped(inF0, int2(1,2)); + exp(inF0); + exp2(inF0); + faceforward(inF0, inF1, inF2); + firstbithigh(7); + firstbitlow(7); + floor(inF0); + // TODO: fma(inD0, inD1, inD2); + fmod(inF0, inF1); + frac(inF0); + frexp(inF0, inF1); + fwidth(inF0); + isinf(inF0); + isnan(inF0); + ldexp(inF0, inF1); + length(inF0); + log(inF0); + log2(inF0); + max(inF0, inF1); + min(inF0, inF1); + // TODO: mul(inF0, inF1); + normalize(inF0); + pow(inF0, inF1); + radians(inF0); + reflect(inF0, inF1); + refract(inF0, inF1, 2.0); + reversebits(int2(1,2)); + round(inF0); + rsqrt(inF0); + sign(inF0); + sin(inF0); + sinh(inF0); + smoothstep(inF0, inF1, inF2); + sqrt(inF0); + step(inF0, inF1); + tan(inF0); + tanh(inF0); + // TODO: sampler intrinsics, when we can declare the types. + trunc(inF0); + + // TODO: ... add when float1 prototypes are generated + return float2(1,2); +} + +float3 PixelShaderFunction(float3 inF0, float3 inF1, float3 inF2) +{ + all(inF0); + abs(inF0); + acos(inF0); + any(inF0); + asin(inF0); + atan(inF0); + atan2(inF0, inF1); + ceil(inF0); + clamp(inF0, inF1, inF2); + cos(inF0); + cosh(inF0); + countbits(int3(7,3,5)); + cross(inF0, inF1); + ddx(inF0); + ddx_coarse(inF0); + ddx_fine(inF0); + ddy(inF0); + ddy_coarse(inF0); + ddy_fine(inF0); + degrees(inF0); + distance(inF0, inF1); + dot(inF0, inF1); + // EvaluateAttributeAtCentroid(inF0); + // EvaluateAttributeAtSample(inF0, 0); + // TODO: EvaluateAttributeSnapped(inF0, int2(1,2)); + exp(inF0); + exp2(inF0); + faceforward(inF0, inF1, inF2); + firstbithigh(7); + firstbitlow(7); + floor(inF0); + // TODO: fma(inD0, inD1, inD2); + fmod(inF0, inF1); + frac(inF0); + frexp(inF0, inF1); + fwidth(inF0); + isinf(inF0); + isnan(inF0); + ldexp(inF0, inF1); + length(inF0); + log(inF0); + log2(inF0); + max(inF0, inF1); + min(inF0, inF1); + // TODO: mul(inF0, inF1); + normalize(inF0); + pow(inF0, inF1); + radians(inF0); + reflect(inF0, inF1); + refract(inF0, inF1, 2.0); + reversebits(int3(1,2,3)); + round(inF0); + rsqrt(inF0); + sign(inF0); + sin(inF0); + sinh(inF0); + smoothstep(inF0, inF1, inF2); + sqrt(inF0); + step(inF0, inF1); + tan(inF0); + tanh(inF0); + // TODO: sampler intrinsics, when we can declare the types. + trunc(inF0); + + // TODO: ... add when float1 prototypes are generated + return float3(1,2,3); +} + +float4 PixelShaderFunction(float4 inF0, float4 inF1, float4 inF2) +{ + all(inF0); + abs(inF0); + acos(inF0); + any(inF0); + asin(inF0); + atan(inF0); + atan2(inF0, inF1); + ceil(inF0); + clamp(inF0, inF1, inF2); + cos(inF0); + cosh(inF0); + countbits(int4(7,3,5,2)); + ddx(inF0); + ddx_coarse(inF0); + ddx_fine(inF0); + ddy(inF0); + ddy_coarse(inF0); + ddy_fine(inF0); + degrees(inF0); + distance(inF0, inF1); + dot(inF0, inF1); + // EvaluateAttributeAtCentroid(inF0); + // EvaluateAttributeAtSample(inF0, 0); + // TODO: EvaluateAttributeSnapped(inF0, int2(1,2)); + exp(inF0); + exp2(inF0); + faceforward(inF0, inF1, inF2); + firstbithigh(7); + firstbitlow(7); + floor(inF0); + // TODO: fma(inD0, inD1, inD2); + fmod(inF0, inF1); + frac(inF0); + frexp(inF0, inF1); + fwidth(inF0); + isinf(inF0); + isnan(inF0); + ldexp(inF0, inF1); + length(inF0); + log(inF0); + log2(inF0); + max(inF0, inF1); + min(inF0, inF1); + // TODO: mul(inF0, inF1); + normalize(inF0); + pow(inF0, inF1); + radians(inF0); + reflect(inF0, inF1); + refract(inF0, inF1, 2.0); + reversebits(int4(1,2,3,4)); + round(inF0); + rsqrt(inF0); + sign(inF0); + sin(inF0); + sinh(inF0); + smoothstep(inF0, inF1, inF2); + sqrt(inF0); + step(inF0, inF1); + tan(inF0); + tanh(inF0); + // TODO: sampler intrinsics, when we can declare the types. + trunc(inF0); + + // TODO: ... add when float1 prototypes are generated + return float4(1,2,3,4); +} + +// TODO: FXC doesn't accept this with (), but glslang doesn't accept it without. +#define MATFNS() \ + all(inF0); \ + abs(inF0); \ + acos(inF0); \ + any(inF0); \ + asin(inF0); \ + atan(inF0); \ + atan2(inF0, inF1); \ + ceil(inF0); \ + clamp(inF0, inF1, inF2); \ + cos(inF0); \ + cosh(inF0); \ + ddx(inF0); \ + ddx_coarse(inF0); \ + ddx_fine(inF0); \ + ddy(inF0); \ + ddy_coarse(inF0); \ + ddy_fine(inF0); \ + degrees(inF0); \ + determinant(inF0); \ + exp(inF0); \ + exp2(inF0); \ + firstbithigh(7); \ + firstbitlow(7); \ + floor(inF0); \ + fmod(inF0, inF1); \ + frac(inF0); \ + frexp(inF0, inF1); \ + fwidth(inF0); \ + ldexp(inF0, inF1); \ + log(inF0); \ + log2(inF0); \ + max(inF0, inF1); \ + min(inF0, inF1); \ + pow(inF0, inF1); \ + radians(inF0); \ + round(inF0); \ + rsqrt(inF0); \ + sign(inF0); \ + sin(inF0); \ + sinh(inF0); \ + smoothstep(inF0, inF1, inF2); \ + sqrt(inF0); \ + step(inF0, inF1); \ + tan(inF0); \ + tanh(inF0); \ + transpose(inF0); \ + trunc(inF0); + +// TODO: turn on non-square matrix tests when protos are available. + +float2x2 PixelShaderFunction(float2x2 inF0, float2x2 inF1, float2x2 inF2) +{ + // TODO: FXC doesn't accept this with (), but glslang doesn't accept it without. + MATFNS() + + // TODO: ... add when float1 prototypes are generated + return float2x2(2,2,2,2); +} + +float3x3 PixelShaderFunction(float3x3 inF0, float3x3 inF1, float3x3 inF2) +{ + // TODO: FXC doesn't accept this with (), but glslang doesn't accept it without. + MATFNS() + + // TODO: ... add when float1 prototypes are generated + return float3x3(3,3,3,3,3,3,3,3,3); +} + +float4x4 PixelShaderFunction(float4x4 inF0, float4x4 inF1, float4x4 inF2) +{ + // TODO: FXC doesn't accept this with (), but glslang doesn't accept it without. + MATFNS() + + // TODO: ... add when float1 prototypes are generated + return float4x4(4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4); +} diff --git a/Test/hlsl.intrinsics.vert b/Test/hlsl.intrinsics.vert new file mode 100644 index 00000000..73243420 --- /dev/null +++ b/Test/hlsl.intrinsics.vert @@ -0,0 +1,323 @@ +float VertexShaderFunction(float inF0, float inF1, float inF2) +{ + all(inF0); + abs(inF0); + acos(inF0); + any(inF0); + asin(inF0); + atan(inF0); + atan2(inF0, inF1); + ceil(inF0); + clamp(inF0, inF1, inF2); + cos(inF0); + cosh(inF0); + countbits(7); + degrees(inF0); + // EvaluateAttributeAtCentroid(inF0); + // EvaluateAttributeAtSample(inF0, 0); + // TODO: EvaluateAttributeSnapped(inF0, int2(1,2)); + exp(inF0); + exp2(inF0); + firstbithigh(7); + firstbitlow(7); + floor(inF0); + // TODO: fma(inD0, inD1, inD2); + fmod(inF0, inF1); + frac(inF0); + frexp(inF0, inF1); + fwidth(inF0); + isinf(inF0); + isnan(inF0); + ldexp(inF0, inF1); + log(inF0); + log2(inF0); + max(inF0, inF1); + min(inF0, inF1); + // TODO: mul(inF0, inF1); + pow(inF0, inF1); + radians(inF0); + reversebits(2); + round(inF0); + rsqrt(inF0); + sign(inF0); + sin(inF0); + sinh(inF0); + smoothstep(inF0, inF1, inF2); + sqrt(inF0); + step(inF0, inF1); + tan(inF0); + tanh(inF0); + // TODO: sampler intrinsics, when we can declare the types. + trunc(inF0); + + return 0.0; +} + +float1 VertexShaderFunction(float1 inF0, float1 inF1, float1 inF2) +{ + // TODO: ... add when float1 prototypes are generated + return 0.0; +} + +float2 VertexShaderFunction(float2 inF0, float2 inF1, float2 inF2) +{ + all(inF0); + abs(inF0); + acos(inF0); + any(inF0); + asin(inF0); + atan(inF0); + atan2(inF0, inF1); + ceil(inF0); + clamp(inF0, inF1, inF2); + cos(inF0); + cosh(inF0); + countbits(int2(7,3)); + degrees(inF0); + distance(inF0, inF1); + dot(inF0, inF1); + // EvaluateAttributeAtCentroid(inF0); + // EvaluateAttributeAtSample(inF0, 0); + // TODO: EvaluateAttributeSnapped(inF0, int2(1,2)); + exp(inF0); + exp2(inF0); + faceforward(inF0, inF1, inF2); + firstbithigh(7); + firstbitlow(7); + floor(inF0); + // TODO: fma(inD0, inD1, inD2); + fmod(inF0, inF1); + frac(inF0); + frexp(inF0, inF1); + fwidth(inF0); + isinf(inF0); + isnan(inF0); + ldexp(inF0, inF1); + length(inF0); + log(inF0); + log2(inF0); + max(inF0, inF1); + min(inF0, inF1); + // TODO: mul(inF0, inF1); + normalize(inF0); + pow(inF0, inF1); + radians(inF0); + reflect(inF0, inF1); + refract(inF0, inF1, 2.0); + reversebits(int2(1,2)); + round(inF0); + rsqrt(inF0); + sign(inF0); + sin(inF0); + sinh(inF0); + smoothstep(inF0, inF1, inF2); + sqrt(inF0); + step(inF0, inF1); + tan(inF0); + tanh(inF0); + // TODO: sampler intrinsics, when we can declare the types. + trunc(inF0); + + // TODO: ... add when float1 prototypes are generated + return float2(1,2); +} + +float3 VertexShaderFunction(float3 inF0, float3 inF1, float3 inF2) +{ + all(inF0); + abs(inF0); + acos(inF0); + any(inF0); + asin(inF0); + atan(inF0); + atan2(inF0, inF1); + ceil(inF0); + clamp(inF0, inF1, inF2); + cos(inF0); + cosh(inF0); + countbits(int3(7,3,5)); + cross(inF0, inF1); + degrees(inF0); + distance(inF0, inF1); + dot(inF0, inF1); + // EvaluateAttributeAtCentroid(inF0); + // EvaluateAttributeAtSample(inF0, 0); + // TODO: EvaluateAttributeSnapped(inF0, int2(1,2)); + exp(inF0); + exp2(inF0); + faceforward(inF0, inF1, inF2); + firstbithigh(7); + firstbitlow(7); + floor(inF0); + // TODO: fma(inD0, inD1, inD2); + fmod(inF0, inF1); + frac(inF0); + frexp(inF0, inF1); + fwidth(inF0); + isinf(inF0); + isnan(inF0); + ldexp(inF0, inF1); + length(inF0); + log(inF0); + log2(inF0); + max(inF0, inF1); + min(inF0, inF1); + // TODO: mul(inF0, inF1); + normalize(inF0); + pow(inF0, inF1); + radians(inF0); + reflect(inF0, inF1); + refract(inF0, inF1, 2.0); + reversebits(int3(1,2,3)); + round(inF0); + rsqrt(inF0); + sign(inF0); + sin(inF0); + sinh(inF0); + smoothstep(inF0, inF1, inF2); + sqrt(inF0); + step(inF0, inF1); + tan(inF0); + tanh(inF0); + // TODO: sampler intrinsics, when we can declare the types. + trunc(inF0); + + // TODO: ... add when float1 prototypes are generated + return float3(1,2,3); +} + +float4 VertexShaderFunction(float4 inF0, float4 inF1, float4 inF2) +{ + all(inF0); + abs(inF0); + acos(inF0); + any(inF0); + asin(inF0); + atan(inF0); + atan2(inF0, inF1); + ceil(inF0); + clamp(inF0, inF1, inF2); + cos(inF0); + cosh(inF0); + countbits(int4(7,3,5,2)); + degrees(inF0); + distance(inF0, inF1); + dot(inF0, inF1); + // EvaluateAttributeAtCentroid(inF0); + // EvaluateAttributeAtSample(inF0, 0); + // TODO: EvaluateAttributeSnapped(inF0, int2(1,2)); + exp(inF0); + exp2(inF0); + faceforward(inF0, inF1, inF2); + firstbithigh(7); + firstbitlow(7); + floor(inF0); + // TODO: fma(inD0, inD1, inD2); + fmod(inF0, inF1); + frac(inF0); + frexp(inF0, inF1); + fwidth(inF0); + isinf(inF0); + isnan(inF0); + ldexp(inF0, inF1); + length(inF0); + log(inF0); + log2(inF0); + max(inF0, inF1); + min(inF0, inF1); + // TODO: mul(inF0, inF1); + normalize(inF0); + pow(inF0, inF1); + radians(inF0); + reflect(inF0, inF1); + refract(inF0, inF1, 2.0); + reversebits(int4(1,2,3,4)); + round(inF0); + rsqrt(inF0); + sign(inF0); + sin(inF0); + sinh(inF0); + smoothstep(inF0, inF1, inF2); + sqrt(inF0); + step(inF0, inF1); + tan(inF0); + tanh(inF0); + // TODO: sampler intrinsics, when we can declare the types. + trunc(inF0); + + // TODO: ... add when float1 prototypes are generated + return float4(1,2,3,4); +} + +// TODO: FXC doesn't accept this with (), but glslang doesn't accept it without. +#define MATFNS() \ + all(inF0); \ + abs(inF0); \ + acos(inF0); \ + any(inF0); \ + asin(inF0); \ + atan(inF0); \ + atan2(inF0, inF1); \ + ceil(inF0); \ + clamp(inF0, inF1, inF2); \ + cos(inF0); \ + cosh(inF0); \ + degrees(inF0); \ + determinant(inF0); \ + exp(inF0); \ + exp2(inF0); \ + firstbithigh(7); \ + firstbitlow(7); \ + floor(inF0); \ + fmod(inF0, inF1); \ + frac(inF0); \ + frexp(inF0, inF1); \ + fwidth(inF0); \ + ldexp(inF0, inF1); \ + log(inF0); \ + log2(inF0); \ + max(inF0, inF1); \ + min(inF0, inF1); \ + pow(inF0, inF1); \ + radians(inF0); \ + round(inF0); \ + rsqrt(inF0); \ + sign(inF0); \ + sin(inF0); \ + sinh(inF0); \ + smoothstep(inF0, inF1, inF2); \ + sqrt(inF0); \ + step(inF0, inF1); \ + tan(inF0); \ + tanh(inF0); \ + transpose(inF0); \ + trunc(inF0); + +// TODO: turn on non-square matrix tests when protos are available. + +float2x2 VertexShaderFunction(float2x2 inF0, float2x2 inF1, float2x2 inF2) +{ + // TODO: FXC doesn't accept this with (), but glslang doesn't accept it without. + MATFNS() + + // TODO: ... add when float1 prototypes are generated + return float2x2(2,2,2,2); +} + +float3x3 VertexShaderFunction(float3x3 inF0, float3x3 inF1, float3x3 inF2) +{ + // TODO: FXC doesn't accept this with (), but glslang doesn't accept it without. + MATFNS() + + // TODO: ... add when float1 prototypes are generated + return float3x3(3,3,3,3,3,3,3,3,3); +} + +float4x4 VertexShaderFunction(float4x4 inF0, float4x4 inF1, float4x4 inF2) +{ + // TODO: FXC doesn't accept this with (), but glslang doesn't accept it without. + MATFNS() + + // TODO: ... add when float1 prototypes are generated + return float4x4(4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4); +} diff --git a/glslang/MachineIndependent/ShaderLang.cpp b/glslang/MachineIndependent/ShaderLang.cpp index 1abb5535..c2b56055 100644 --- a/glslang/MachineIndependent/ShaderLang.cpp +++ b/glslang/MachineIndependent/ShaderLang.cpp @@ -69,9 +69,6 @@ using namespace glslang; // Create a language specific version of parseables. TBuiltInParseables* CreateBuiltInParseables(TInfoSink& infoSink, EShSource source) { - // TODO: hardcode to the GLSL path, until HLSL intrinsics are available. - source = EShSourceGlsl; // REMOVE - switch (source) { case EShSourceGlsl: return new TBuiltIns(); // GLSL builtIns case EShSourceHlsl: return new TBuiltInParseablesHlsl(); // HLSL intrinsics @@ -81,7 +78,7 @@ TBuiltInParseables* CreateBuiltInParseables(TInfoSink& infoSink, EShSource sourc return nullptr; } } - + // Local mapping functions for making arrays of symbol tables.... int MapVersionToIndex(int version) @@ -169,6 +166,9 @@ bool InitializeSymbolTable(const TString& builtIns, int version, EProfile profil builtInShaders[0] = builtIns.c_str(); builtInLengths[0] = builtIns.size(); + if (builtInLengths[0] == 0) + return true; + TInputScanner input(1, builtInShaders, builtInLengths); if (! parseContext.parseShaderStrings(ppContext, input) != 0) { infoSink.info.message(EPrefixInternalError, "Unable to parse built-ins"); @@ -338,7 +338,7 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo bool correct = true; if (source == EShSourceHlsl) { - version = defaultVersion; + version = 450; // TODO: GLSL parser is still used for builtins. profile = ENoProfile; return correct; } diff --git a/gtests/Hlsl.FromFile.cpp b/gtests/Hlsl.FromFile.cpp index 1307dae1..b5a38866 100644 --- a/gtests/Hlsl.FromFile.cpp +++ b/gtests/Hlsl.FromFile.cpp @@ -1,5 +1,6 @@ // // Copyright (C) 2016 Google, Inc. +// Copyright (C) 2016 LunarG, Inc. // // All rights reserved. // @@ -79,6 +80,8 @@ INSTANTIATE_TEST_CASE_P( {"hlsl.precedence.frag", "PixelShaderFunction"}, {"hlsl.precedence2.frag", "PixelShaderFunction"}, {"hlsl.sin.frag", "PixelShaderFunction"}, + {"hlsl.intrinsics.frag", "PixelShaderFunction"}, + {"hlsl.intrinsics.vert", "VertexShaderFunction"}, }), FileNameAsCustomTestSuffix ); diff --git a/hlsl/hlslParseables.cpp b/hlsl/hlslParseables.cpp index b29226d2..18f7ca4a 100755 --- a/hlsl/hlslParseables.cpp +++ b/hlsl/hlslParseables.cpp @@ -49,12 +49,165 @@ // #include "hlslParseables.h" +#include +#include + +namespace { // anonymous namespace functions + +const char* BaseTypeName(const char* argOrder, const char* scalarName, const char* vecName, const char* matName) +{ + switch (*argOrder) { + case 'S': return scalarName; + case 'V': return vecName; + case 'M': return matName; + default: return "UNKNOWN_TYPE"; + } +} + +// Create and return a type name. This is done in GLSL, not HLSL conventions, until such +// time as builtins are parsed using the HLSL parser. +// +// order: S = scalar, V = vector, M = matrix +// argType: F = float, D = double, I = int, U = uint, B = bool, S = sampler +// dim0 = vector dimension, or matrix 1st dimension +// dim1 = matrix 2nd dimension +glslang::TString& AppendTypeName(glslang::TString& s, const char* argOrder, const char* argType, int dim0, int dim1) +{ + const bool transpose = (argOrder[0] == '^'); + + // Take transpose of matrix dimensions + if (transpose) { + std::swap(dim0, dim1); + ++argOrder; + } + + switch (*argType) { + case '-': s += "void"; break; + case 'F': s += BaseTypeName(argOrder, "float", "vec", "mat"); break; + case 'D': s += BaseTypeName(argOrder, "double", "dvec", "dmat"); break; + case 'I': s += BaseTypeName(argOrder, "int", "ivec", "imat"); break; + case 'U': s += BaseTypeName(argOrder, "uint", "uvec", "umat"); break; + case 'B': s += BaseTypeName(argOrder, "bool", "bvec", "bmat"); break; + case 'S': s += BaseTypeName(argOrder, "sampler", "sampler", "sampler"); break; // TODO: + default: s += "UNKNOWN_TYPE"; break; + } + + // handle fixed vector sizes, such as float3, and only ever 3. + const int fixedVecSize = isdigit(argOrder[1]) ? (argOrder[1] - '0') : 0; + if (fixedVecSize != 0) + dim0 = dim1 = fixedVecSize; + + // Add sampler dimensions + if (*argType == 'S') { + switch (dim0) { + case 1: s += "1D"; break; + case 2: s += "2D"; break; + case 3: s += "3D"; break; + case 4: s += "Cube"; break; + default: s += "UNKNOWN_SAMPLER"; break; + } + } + + // verify dimensions + if ((*argOrder == 'V' || *argOrder == 'M') && (dim0 < 1 || dim0 > 4) || + (*argOrder == 'M' && (dim1 < 1 || dim1 > 4))) { + s += "UNKNOWN_DIMENSION"; + return s; + } + + switch (*argOrder) { + case '-': break; // no dimensions for voids + case 'S': break; // no dimensions on scalars + case 'V': s += ('0' + dim0); break; + case 'M': s += ('0' + dim0); s += 'x'; s += ('0' + dim1); break; + } + + return s; +} + +// TODO: the GLSL parser is currently used to parse HLSL prototypes. However, many valid HLSL prototypes +// are not valid GLSL prototypes. This rejects the invalid ones. Thus, there is a single switch below +// to enable creation of the entire HLSL space. +inline bool IsValidGlsl(const char* cname, char retOrder, char retType, char argOrder, char argType, + int dim0, int dim1, int dim0Max, int dim1Max) +{ + const bool isVec = dim0Max > 1 || argType == 'V'; + const bool isMat = dim1Max > 1 || argType == 'M'; + + if (argType == 'D' || // avoid double args + retType == 'D' || // avoid double return + (isVec && dim0 == 1) || // avoid vec1 + (isMat && dim0 == 1 && dim1 == 1)) // avoid mat1x1 + return false; + + const std::string name(cname); // for ease of comparison. slow, but temporary, until HLSL parser is online. + + if (isMat && dim0 != dim1) // TODO: avoid mats until we find the right GLSL profile + return false; + + if (isMat && (argType == 'I' || argType == 'U' || argType == 'B') || + retOrder == 'M' && (retType == 'I' || retType == 'U' || retType == 'B')) + return false; + + if (name == "GetRenderTargetSamplePosition" || + name == "tex1D" || + name == "tex1Dgrad") + return false; + + return true; +} + + +// Return true for the end of a single argument key, which can be the end of the string, or +// the comma separator. +inline bool IsEndOfArg(const char* arg) +{ + return arg == nullptr || *arg == '\0' || *arg == ','; +} + + +// return position of end of argument specifier +inline const char* FindEndOfArg(const char* arg) +{ + while (!IsEndOfArg(arg)) + ++arg; + + return *arg == '\0' ? nullptr : arg; +} + + +// Return pointer to beginning of Nth argument specifier in the string. +inline const char* NthArg(const char* arg, int n) +{ + for (int x=0; x 0) // handle fixed sized vectors + dim0Min = dim0Max = fixedVecSize; +} + +} // end anonymous namespace namespace glslang { TBuiltInParseablesHlsl::TBuiltInParseablesHlsl() { - assert(0 && "Unimplemented TBuiltInParseablesHlsl::TBuiltInParseablesHlsl"); } // @@ -67,7 +220,268 @@ TBuiltInParseablesHlsl::TBuiltInParseablesHlsl() // void TBuiltInParseablesHlsl::initialize(int version, EProfile profile, int spv, int vulkan) { - assert(0 && "Unimplemented TBuiltInParseablesHlsl::initialize"); + static const EShLanguageMask EShLangAll = EShLanguageMask(EShLangCount - 1); + + // This structure encodes the prototype information for each HLSL intrinsic. + // Because explicit enumeration would be cumbersome, it's procedurally generated. + // orderKey can be: + // S = scalar, V = vector, M = matrix, - = void + // typekey can be: + // D = double, F = float, U = uint, I = int, B = bool, S = sampler, - = void + // An empty order or type key repeats the first one. E.g: SVM,, means 3 args each of SVM. + // '>' as first letter of order creates an output paremeter + // '<' as first letter of order creates an input paremeter + // '^' as first letter of order takes transpose dimensions + + static const struct { + const char* name; // intrinsic name + const char* retOrder; // return type key: empty matches order of 1st argument + const char* retType; // return type key: empty matches type of 1st argument + const char* argOrder; // argument order key + const char* argType; // argument type key + unsigned int stage; // stage mask + } hlslIntrinsics[] = { + // name retOrd retType argOrder argType stage mask + // ----------------------------------------------------------------------------------------------- + { "abort", nullptr, nullptr, "-", "-", EShLangAll }, + { "abs", nullptr, nullptr, "SVM", "DFUI", EShLangAll }, + { "acos", nullptr, nullptr, "SVM", "F", EShLangAll }, + { "all", "S", "B", "SVM", "BFI", EShLangAll }, + { "AllMemoryBarrier", nullptr, nullptr, "-", "-", EShLangComputeMask }, + { "AllMemoryBarrierWithGroupSync", nullptr, nullptr, "-", "-", EShLangComputeMask }, + { "any", "S", "B", "SVM", "BFI", EShLangAll }, + { "asdouble", "S", "D", "S,", "U,", EShLangAll }, + { "asdouble", "V2", "D", "V2,", "U,", EShLangAll }, + { "asfloat", nullptr, "F", "SVM", "BFIU", EShLangAll }, + { "asin", nullptr, nullptr, "SVM", "F", EShLangAll }, + { "asint", nullptr, "I", "SVM", "FU", EShLangAll }, + { "asuint", nullptr, "U", "SVM", "FU", EShLangAll }, + { "atan", nullptr, nullptr, "SVM", "F", EShLangAll }, + { "atan2", nullptr, nullptr, "SVM,", "F,", EShLangAll }, + { "ceil", nullptr, nullptr, "SVM", "F", EShLangAll }, + { "CheckAccessFullyMapped", "S", "B" , "S", "U", EShLangFragmentMask | EShLangComputeMask }, + { "clamp", nullptr, nullptr, "SVM,,", "FUI,,", EShLangAll }, + { "clip", "-", "-", "SVM", "F", EShLangFragmentMask }, + { "cos", nullptr, nullptr, "SVM", "F", EShLangAll }, + { "cosh", nullptr, nullptr, "SVM", "F", EShLangAll }, + { "countbits", nullptr, nullptr, "SV", "U", EShLangAll }, + { "cross", nullptr, nullptr, "V3,", "F,", EShLangAll }, + { "D3DCOLORtoUBYTE4", "V4", "I", "V4", "F", EShLangAll }, + { "ddx", nullptr, nullptr, "SVM", "F", EShLangFragmentMask }, + { "ddx_coarse", nullptr, nullptr, "SVM", "F", EShLangFragmentMask }, + { "ddx_fine", nullptr, nullptr, "SVM", "F", EShLangFragmentMask }, + { "ddy", nullptr, nullptr, "SVM", "F", EShLangFragmentMask }, + { "ddy_coarse", nullptr, nullptr, "SVM", "F", EShLangFragmentMask }, + { "ddy_fine", nullptr, nullptr, "SVM", "F", EShLangFragmentMask }, + { "degrees", nullptr, nullptr, "SVM", "F", EShLangAll }, + { "determinant", "S", "F", "M", "F", EShLangAll }, + { "DeviceMemoryBarrier", nullptr, nullptr, "-", "-", EShLangFragmentMask | EShLangComputeMask }, + { "DeviceMemoryBarrierWithGroupSync", nullptr, nullptr, "-", "-", EShLangComputeMask }, + { "distance", "S", "F", "V,", "F,", EShLangAll }, + { "dot", "S", nullptr, "V,", "FI,", EShLangAll }, + { "dst", nullptr, nullptr, "V,", "F,", EShLangAll }, + // { "errorf", "-", "-", "", "", EShLangAll }, TODO: varargs + { "EvaluateAttributeAtCentroid", nullptr, nullptr, "SVM", "F", EShLangFragmentMask }, + { "EvaluateAttributeAtSample", nullptr, nullptr, "SVM,S", "F,U", EShLangFragmentMask }, + { "EvaluateAttributeSnapped", nullptr, nullptr, "SVM,V2", "F,F", EShLangFragmentMask }, + { "exp", nullptr, nullptr, "SVM", "F", EShLangAll }, + { "exp2", nullptr, nullptr, "SVM", "F", EShLangAll }, + { "f16tof32", nullptr, "F", "SV", "U", EShLangAll }, + { "f32tof16", nullptr, "U", "SV", "F", EShLangAll }, + { "faceforward", nullptr, nullptr, "V,,", "F,,", EShLangAll }, + { "firstbithigh", nullptr, nullptr, "SV", "UI", EShLangAll }, + { "firstbitlow", nullptr, nullptr, "SV", "UI", EShLangAll }, + { "floor", nullptr, nullptr, "SVM", "F", EShLangAll }, + { "fma", nullptr, nullptr, "SVM,,", "D,,", EShLangAll }, + { "fmod", nullptr, nullptr, "SVM,", "F,", EShLangAll }, + { "frac", nullptr, nullptr, "SVM", "F", EShLangAll }, + { "frexp", nullptr, nullptr, "SVM,", "F,", EShLangAll }, + { "fwidth", nullptr, nullptr, "SVM", "F", EShLangAll }, + { "GetRenderTargetSampleCount", "S", "U", "-", "-", EShLangAll }, + { "GetRenderTargetSamplePosition", "V2", "F", "V1", "I", EShLangAll }, + { "GroupMemoryBarrier", nullptr, nullptr, "-", "-", EShLangComputeMask }, + { "GroupMemoryBarrierWithGroupSync", nullptr, nullptr, "-", "-", EShLangComputeMask }, + { "InterlockedAdd", "-", "-", "SVM,,>", "UI,,", EShLangFragmentMask | EShLangComputeMask }, + { "InterlockedAnd", "-", "-", "SVM,,>", "UI,,", EShLangFragmentMask | EShLangComputeMask }, + { "InterlockedCompareExchange", "-", "-", "SVM,,,>", "UI,,,", EShLangFragmentMask | EShLangComputeMask }, + { "InterlockedCompareStore", "-", "-", "SVM,,", "UI,,", EShLangFragmentMask | EShLangComputeMask }, + { "InterlockedExchange", "-", "-", "SVM,,>", "UI,,", EShLangFragmentMask | EShLangComputeMask }, + { "InterlockedMax", "-", "-", "SVM,,>", "UI,,", EShLangFragmentMask | EShLangComputeMask }, + { "InterlockedMin", "-", "-", "SVM,,>", "UI,,", EShLangFragmentMask | EShLangComputeMask }, + { "InterlockedOr", "-", "-", "SVM,,>", "UI,,", EShLangFragmentMask | EShLangComputeMask }, + { "InterlockedXor", "-", "-", "SVM,,>", "UI,,", EShLangFragmentMask | EShLangComputeMask }, + { "isfinite", nullptr, "B" , "SVM", "F", EShLangAll }, + { "isinf", nullptr, "B" , "SVM", "F", EShLangAll }, + { "isnan", nullptr, "B" , "SVM", "F", EShLangAll }, + { "ldexp", nullptr, nullptr, "SVM,", "F,", EShLangAll }, + { "length", "S", "F", "V", "F", EShLangAll }, + { "lit", "V4", "F", "S,,", "F,,", EShLangAll }, + { "log", nullptr, nullptr, "SVM", "F", EShLangAll }, + { "log10", nullptr, nullptr, "SVM", "F", EShLangAll }, + { "log2", nullptr, nullptr, "SVM", "F", EShLangAll }, + { "mad", nullptr, nullptr, "SVM,,", "DFUI,,", EShLangAll }, + { "max", nullptr, nullptr, "SVM,", "FI,", EShLangAll }, + { "min", nullptr, nullptr, "SVM,", "FI,", EShLangAll }, + { "modf", nullptr, nullptr, "SVM,>", "FI,", EShLangAll }, + { "msad4", "V4", "U", "S,V2,V4", "U,,", EShLangAll }, + { "mul", "S", nullptr, "S,S", "FI,", EShLangAll }, + { "mul", "V", nullptr, "S,V", "FI,", EShLangAll }, + { "mul", "M", nullptr, "S,M", "FI,", EShLangAll }, + { "mul", "V", nullptr, "V,S", "FI,", EShLangAll }, + { "mul", "S", nullptr, "V,V", "FI,", EShLangAll }, + { "mul", "V", nullptr, "V,M", "FI,", EShLangAll }, + { "mul", "M", nullptr, "M,S", "FI,", EShLangAll }, + { "mul", "V", nullptr, "M,V", "FI,", EShLangAll }, + { "mul", "M", nullptr, "M,M", "FI,", EShLangAll }, + { "noise", "S", "F", "V", "F", EShLangFragmentMask }, + { "normalize", nullptr, nullptr, "V", "F", EShLangAll }, + { "pow", nullptr, nullptr, "SVM,", "F,", EShLangAll }, + // { "printf", "-", "-", "", "", EShLangAll }, TODO: varargs + { "Process2DQuadTessFactorsAvg", "-", "-", "V4,V2,>V4,>V2,>V2", "F,,,,", EShLangTessControlMask }, + { "Process2DQuadTessFactorsMax", "-", "-", "V4,V2,>V4,>V2,>V2", "F,,,,", EShLangTessControlMask }, + { "Process2DQuadTessFactorsMin", "-", "-", "V4,V2,>V4,>V2,>V2", "F,,,,", EShLangTessControlMask }, + { "ProcessIsolineTessFactors", "-", "-", "S,,>,>", "F,,,", EShLangTessControlMask }, + { "ProcessQuadTessFactorsAvg", "-", "-", "V4,S,>V4,>V2,>V2", "F,,,,", EShLangTessControlMask }, + { "ProcessQuadTessFactorsMax", "-", "-", "V4,S,>V4,>V2,>V2", "F,,,,", EShLangTessControlMask }, + { "ProcessQuadTessFactorsMin", "-", "-", "V4,S,>V4,>V2,>V2", "F,,,,", EShLangTessControlMask }, + { "ProcessTriTessFactorsAvg", "-", "-", "V3,S,>V3,>S,>S", "F,,,,", EShLangTessControlMask }, + { "ProcessTriTessFactorsMax", "-", "-", "V3,S,>V3,>S,>S", "F,,,,", EShLangTessControlMask }, + { "ProcessTriTessFactorsMin", "-", "-", "V3,S,>V3,>S,>S", "F,,,,", EShLangTessControlMask }, + { "radians", nullptr, nullptr, "SVM", "F", EShLangAll }, + { "rcp", nullptr, nullptr, "SVM", "FD", EShLangAll }, + { "reflect", nullptr, nullptr, "V,", "F,", EShLangAll }, + { "refract", nullptr, nullptr, "V,V,S", "F,,", EShLangAll }, + { "reversebits", nullptr, nullptr, "SV", "U", EShLangAll }, + { "round", nullptr, nullptr, "SVM", "F", EShLangAll }, + { "rsqrt", nullptr, nullptr, "SVM", "F", EShLangAll }, + { "saturate", nullptr, nullptr , "SVM", "F", EShLangAll }, + { "sign", nullptr, nullptr, "SVM", "FI", EShLangAll }, + { "sin", nullptr, nullptr, "SVM", "F", EShLangAll }, + { "sincos", "-", "-", "SVM,>,>", "F,,", EShLangAll }, + { "sinh", nullptr, nullptr, "SVM", "F", EShLangAll }, + { "smoothstep", nullptr, nullptr, "SVM,,", "F,,", EShLangAll }, + { "sqrt", nullptr, nullptr, "SVM", "F", EShLangAll }, + { "step", nullptr, nullptr, "SVM,", "F,", EShLangAll }, + { "tan", nullptr, nullptr, "SVM", "F", EShLangAll }, + { "tanh", nullptr, nullptr, "SVM", "F", EShLangAll }, + { "tex1D", "V4", "F", "S1,S", "S,F", EShLangFragmentMask }, + { "tex1D", "V4", "F", "S1,S,V1,V1", "S,F,F,F",EShLangFragmentMask }, + { "tex1Dbias", "V4", "F", "S1,V4", "S,F", EShLangFragmentMask }, + { "tex1Dgrad", "V4", "F", "S1,V1,V1,V1","S,F,F,F",EShLangFragmentMask }, + { "tex1Dlod", "V4", "F", "S1,V4", "S,F", EShLangFragmentMask }, + { "tex1Dproj", "V4", "F", "S1,V4", "S,F", EShLangFragmentMask }, + { "tex2D", "V4", "F", "S2,V2", "S,F", EShLangFragmentMask }, + { "tex2D", "V4", "F", "S2,V2,V2,V2","S,F,F,F",EShLangFragmentMask }, + { "tex2Dbias", "V4", "F", "S2,V4", "S,F", EShLangFragmentMask }, + { "tex2Dgrad", "V4", "F", "S2,V2,V2,V2","S,F,F,F",EShLangFragmentMask }, + { "tex2Dlod", "V4", "F", "S2,V4", "S,F", EShLangFragmentMask }, + { "tex2Dproj", "V4", "F", "S2,V4", "S,F", EShLangFragmentMask }, + { "tex3D", "V4", "F", "S3,V3", "S,F", EShLangFragmentMask }, + { "tex3D", "V4", "F", "S3,V3,V3,V3","S,F,F,F",EShLangFragmentMask }, + { "tex3Dbias", "V4", "F", "S3,V4", "S,F", EShLangFragmentMask }, + { "tex3Dgrad", "V4", "F", "S3,V3,V3,V3","S,F,F,F",EShLangFragmentMask }, + { "tex3Dlod", "V4", "F", "S3,V4", "S,F", EShLangFragmentMask }, + { "tex3Dproj", "V4", "F", "S3,V4", "S,F", EShLangFragmentMask }, + { "texCUBE", "V4", "F", "S4,V3", "S,F", EShLangFragmentMask }, + { "texCUBE", "V4", "F", "S4,V3,V3,V3","S,F,F,F",EShLangFragmentMask }, + { "texCUBEbias", "V4", "F", "S4,V4", "S,F", EShLangFragmentMask }, + { "texCUBEgrad", "V4", "F", "S4,V3,V3,V3","S,F,F,F",EShLangFragmentMask }, + { "texCUBElod", "V4", "F", "S4,V4", "S,F", EShLangFragmentMask }, + { "texCUBEproj", "V4", "F", "S4,V4", "S,F", EShLangFragmentMask }, + { "transpose", "^M", nullptr, "M", "F", EShLangAll }, + { "trunc", nullptr, nullptr, "SVM", "F", EShLangAll }, + + // Mark end of list, since we want to avoid a range-based for, as some compilers don't handle it yet. + { nullptr, nullptr, nullptr, nullptr, nullptr, 0 }, + }; + + // Set this to true to avoid generating prototypes that will be invalid for the GLSL parser. + // TODO: turn it off (and remove the code) when the HLSL parser can be used to parse builtins. + static const bool skipInvalidGlsl = true; + + // Create prototypes for the intrinsics. TODO: Avoid ranged based for until all compilers can handle it. + for (int icount = 0; hlslIntrinsics[icount].name; ++icount) { + const auto& intrinsic = hlslIntrinsics[icount]; + + for (int stage = 0; stage < EShLangCount; ++stage) { // for each stage... + if ((intrinsic.stage & (1< 0 ? ", ": ""); // comma separator if needed + + if (*nthArgOrder == '>') { // output params + ++nthArgOrder; + s.append("out "); + } else if (*nthArgOrder == '<') { // input params + ++nthArgOrder; + s.append("in "); + } + + // Comma means use the 1st argument order and type. + if (*nthArgOrder == ',' || *nthArgOrder == '\0') nthArgOrder = argOrder; + if (*nthArgType == ',' || *nthArgType == '\0') nthArgType = argType; + + AppendTypeName(s, nthArgOrder, nthArgType, dim0, dim1); // Add first argument + } + + s.append(");\n"); // close paren and trailing semicolon + } + } + } + + if (fixedVecSize > 0) // skip over number for fixed size vectors + ++argOrder; + } + + if (intrinsic.stage == EShLangAll) // common builtins are only added once. + break; + } + } + + // printf("Common:\n%s\n", getCommonString().c_str()); + // printf("Frag:\n%s\n", getStageString(EShLangFragment).c_str()); + // printf("Vertex:\n%s\n", getStageString(EShLangVertex).c_str()); + // printf("Geo:\n%s\n", getStageString(EShLangGeometry).c_str()); + // printf("TessCtrl:\n%s\n", getStageString(EShLangTessControl).c_str()); + // printf("TessEval:\n%s\n", getStageString(EShLangTessEvaluation).c_str()); + // printf("Compute:\n%s\n", getStageString(EShLangCompute).c_str()); } // @@ -80,7 +494,6 @@ void TBuiltInParseablesHlsl::initialize(int version, EProfile profile, int spv, void TBuiltInParseablesHlsl::initialize(const TBuiltInResource &resources, int version, EProfile profile, int spv, int vulkan, EShLanguage language) { - assert(0 && "Unimplemented TBuiltInParseablesHlsl::initialize"); } @@ -95,7 +508,140 @@ void TBuiltInParseablesHlsl::initialize(const TBuiltInResource &resources, int v void TBuiltInParseablesHlsl::identifyBuiltIns(int version, EProfile profile, int spv, int vulkan, EShLanguage language, TSymbolTable& symbolTable) { - assert(0 && "Unimplemented TBuiltInParseablesHlsl::identifyBuiltIns"); + // symbolTable.relateToOperator("abort"); + symbolTable.relateToOperator("abs", EOpAbs); + symbolTable.relateToOperator("acos", EOpAcos); + symbolTable.relateToOperator("all", EOpAll); + // symbolTable.relateToOperator("AllMemoryBarrier"); + // symbolTable.relateToOperator("AllMemoryBarrierWithGroupSync"); + symbolTable.relateToOperator("any", EOpAny); + // symbolTable.relateToOperator("asdouble"); + // symbolTable.relateToOperator("asfloat"); + symbolTable.relateToOperator("asin", EOpAsin); + // symbolTable.relateToOperator("asint"); + // symbolTable.relateToOperator("asuint"); + symbolTable.relateToOperator("atan", EOpAtan); + symbolTable.relateToOperator("atan2", EOpAtan); + symbolTable.relateToOperator("ceil", EOpCeil); + // symbolTable.relateToOperator("CheckAccessFullyMapped"); + symbolTable.relateToOperator("clamp", EOpClamp); + // symbolTable.relateToOperator("clip"); + symbolTable.relateToOperator("cos", EOpCos); + symbolTable.relateToOperator("cosh", EOpCosh); + symbolTable.relateToOperator("countbits", EOpBitCount); + symbolTable.relateToOperator("cross", EOpCross); + // symbolTable.relateToOperator("D3DCOLORtoUBYTE4"); + symbolTable.relateToOperator("ddx", EOpDPdx); + symbolTable.relateToOperator("ddx_coarse", EOpDPdxCoarse); + symbolTable.relateToOperator("ddx_fine", EOpDPdxFine); + symbolTable.relateToOperator("ddy", EOpDPdy); + symbolTable.relateToOperator("ddy_coarse", EOpDPdyCoarse); + symbolTable.relateToOperator("ddy_fine", EOpDPdyFine); + symbolTable.relateToOperator("degrees", EOpDegrees); + symbolTable.relateToOperator("determinant", EOpDeterminant); + // symbolTable.relateToOperator("DeviceMemoryBarrier"); + // symbolTable.relateToOperator("DeviceMemoryBarrierWithGroupSync"); + symbolTable.relateToOperator("distance", EOpDistance); + symbolTable.relateToOperator("dot", EOpDot); + // symbolTable.relateToOperator("dst"); + // symbolTable.relateToOperator("errorf"); + symbolTable.relateToOperator("EvaluateAttributeAtCentroid", EOpInterpolateAtCentroid); + symbolTable.relateToOperator("EvaluateAttributeAtSample", EOpInterpolateAtSample); + // symbolTable.relateToOperator("EvaluateAttributeSnapped"); // TODO: hsnflr positions. new op? + symbolTable.relateToOperator("exp", EOpExp); + symbolTable.relateToOperator("exp2", EOpExp2); + // symbolTable.relateToOperator("f16tof32"); + // symbolTable.relateToOperator("f32tof16"); + symbolTable.relateToOperator("faceforward", EOpFaceForward); + symbolTable.relateToOperator("firstbithigh", EOpFindMSB); + symbolTable.relateToOperator("firstbitlow", EOpFindLSB); + symbolTable.relateToOperator("floor", EOpFloor); + symbolTable.relateToOperator("fma", EOpFma); + // symbolTable.relateToOperator("fmod"); + symbolTable.relateToOperator("frac", EOpFract); + symbolTable.relateToOperator("frexp", EOpFrexp); + symbolTable.relateToOperator("fwidth", EOpFwidth); + // symbolTable.relateToOperator("GetRenderTargetSampleCount"); + // symbolTable.relateToOperator("GetRenderTargetSamplePosition"); + // symbolTable.relateToOperator("GroupMemoryBarrier"); + // symbolTable.relateToOperator("GroupMemoryBarrierWithGroupSync"); + // symbolTable.relateToOperator("InterlockedAdd"); + // symbolTable.relateToOperator("InterlockedAnd"); + // symbolTable.relateToOperator("InterlockedCompareExchange"); + // symbolTable.relateToOperator("InterlockedCompareStore"); + // symbolTable.relateToOperator("InterlockedExchange"); + // symbolTable.relateToOperator("InterlockedMax"); + // symbolTable.relateToOperator("InterlockedMin"); + // symbolTable.relateToOperator("InterlockedOr"); + // symbolTable.relateToOperator("InterlockedXor"); + // symbolTable.relateToOperator("isfinite"); + symbolTable.relateToOperator("isinf", EOpIsInf); + symbolTable.relateToOperator("isnan", EOpIsNan); + symbolTable.relateToOperator("ldexp", EOpLdexp); + symbolTable.relateToOperator("length", EOpLength); + // symbolTable.relateToOperator("lit"); + symbolTable.relateToOperator("log", EOpLog); + // symbolTable.relateToOperator("log10"); + symbolTable.relateToOperator("log2", EOpLog2); + // symbolTable.relateToOperator("mad"); + symbolTable.relateToOperator("max", EOpMax); + symbolTable.relateToOperator("min", EOpMin); + symbolTable.relateToOperator("modf", EOpModf); + // symbolTable.relateToOperator("msad4"); + // symbolTable.relateToOperator("mul"); + // symbolTable.relateToOperator("noise", EOpNoise); // TODO: check return type + symbolTable.relateToOperator("normalize", EOpNormalize); + symbolTable.relateToOperator("pow", EOpPow); + // symbolTable.relateToOperator("printf"); + // symbolTable.relateToOperator("Process2DQuadTessFactorsAvg"); + // symbolTable.relateToOperator("Process2DQuadTessFactorsMax"); + // symbolTable.relateToOperator("Process2DQuadTessFactorsMin"); + // symbolTable.relateToOperator("ProcessIsolineTessFactors"); + // symbolTable.relateToOperator("ProcessQuadTessFactorsAvg"); + // symbolTable.relateToOperator("ProcessQuadTessFactorsMax"); + // symbolTable.relateToOperator("ProcessQuadTessFactorsMin"); + // symbolTable.relateToOperator("ProcessTriTessFactorsAvg"); + // symbolTable.relateToOperator("ProcessTriTessFactorsMax"); + // symbolTable.relateToOperator("ProcessTriTessFactorsMin"); + symbolTable.relateToOperator("radians", EOpRadians); + // symbolTable.relateToOperator("rcp"); + symbolTable.relateToOperator("reflect", EOpReflect); + symbolTable.relateToOperator("refract", EOpRefract); + symbolTable.relateToOperator("reversebits", EOpBitFieldReverse); + symbolTable.relateToOperator("round", EOpRoundEven); + symbolTable.relateToOperator("rsqrt", EOpInverseSqrt); + // symbolTable.relateToOperator("saturate"); + symbolTable.relateToOperator("sign", EOpSign); + symbolTable.relateToOperator("sin", EOpSin); + // symbolTable.relateToOperator("sincos"); + symbolTable.relateToOperator("sinh", EOpSinh); + symbolTable.relateToOperator("smoothstep", EOpSmoothStep); + symbolTable.relateToOperator("sqrt", EOpSqrt); + symbolTable.relateToOperator("step", EOpStep); + symbolTable.relateToOperator("tan", EOpTan); + symbolTable.relateToOperator("tanh", EOpTanh); + symbolTable.relateToOperator("tex1D", EOpTexture); + // symbolTable.relateToOperator("tex1Dbias", // TODO: + symbolTable.relateToOperator("tex1Dgrad", EOpTextureGrad); + symbolTable.relateToOperator("tex1Dlod", EOpTextureLod); + symbolTable.relateToOperator("tex1Dproj", EOpTextureProj); + symbolTable.relateToOperator("tex2D", EOpTexture); + // symbolTable.relateToOperator("tex2Dbias", // TODO: + symbolTable.relateToOperator("tex2Dgrad", EOpTextureGrad); + symbolTable.relateToOperator("tex2Dlod", EOpTextureLod); + // symbolTable.relateToOperator("tex2Dproj", EOpTextureProj); + symbolTable.relateToOperator("tex3D", EOpTexture); + // symbolTable.relateToOperator("tex3Dbias"); // TODO + symbolTable.relateToOperator("tex3Dgrad", EOpTextureGrad); + symbolTable.relateToOperator("tex3Dlod", EOpTextureLod); + // symbolTable.relateToOperator("tex3Dproj", EOpTextureProj); + symbolTable.relateToOperator("texCUBE", EOpTexture); + // symbolTable.relateToOperator("texCUBEbias", // TODO + symbolTable.relateToOperator("texCUBEgrad", EOpTextureGrad); + symbolTable.relateToOperator("texCUBElod", EOpTextureLod); + // symbolTable.relateToOperator("texCUBEproj", EOpTextureProj); + symbolTable.relateToOperator("transpose", EOpTranspose); + symbolTable.relateToOperator("trunc", EOpTrunc); } // @@ -110,7 +656,6 @@ void TBuiltInParseablesHlsl::identifyBuiltIns(int version, EProfile profile, int void TBuiltInParseablesHlsl::identifyBuiltIns(int version, EProfile profile, int spv, int /*vulkan*/, EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources) { - assert(0 && "Unimplemented TBuiltInParseablesHlsl::identifyBuiltIns"); } From 39d5e711a700170724352e09834108a0428e9ebf Mon Sep 17 00:00:00 2001 From: GregF Date: Fri, 3 Jun 2016 09:53:47 -0600 Subject: [PATCH 133/140] remapper: do not eliminate interface variables in dce by default this is done by counting op_entrypoint as a use/def --- SPIRV/SPVRemapper.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/SPIRV/SPVRemapper.cpp b/SPIRV/SPVRemapper.cpp index 35dda17b..1bbd5892 100755 --- a/SPIRV/SPVRemapper.cpp +++ b/SPIRV/SPVRemapper.cpp @@ -926,8 +926,17 @@ namespace spv { // Count function variable use process( [&](spv::Op opCode, unsigned start) { - if (opCode == spv::OpVariable) { ++varUseCount[asId(start+2)]; return true; } - return false; + if (opCode == spv::OpVariable) { + ++varUseCount[asId(start+2)]; + return true; + } else if (opCode == spv::OpEntryPoint) { + const int wordCount = asWordCount(start); + for (int i = 4; i < wordCount; i++) { + ++varUseCount[asId(start+i)]; + } + return true; + } else + return false; }, [&](spv::Id& id) { if (varUseCount[id]) ++varUseCount[id]; } From ef764a24b2a72123b25e829272b6aac596224cee Mon Sep 17 00:00:00 2001 From: LoopDawg Date: Fri, 3 Jun 2016 09:17:51 -0600 Subject: [PATCH 134/140] Fix for empty statement segfault. --- Test/hlsl.intrinsics.vert | 6 +++--- hlsl/hlslGrammar.cpp | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Test/hlsl.intrinsics.vert b/Test/hlsl.intrinsics.vert index 73243420..efafb4ac 100644 --- a/Test/hlsl.intrinsics.vert +++ b/Test/hlsl.intrinsics.vert @@ -298,7 +298,7 @@ float4 VertexShaderFunction(float4 inF0, float4 inF1, float4 inF2) float2x2 VertexShaderFunction(float2x2 inF0, float2x2 inF1, float2x2 inF2) { // TODO: FXC doesn't accept this with (), but glslang doesn't accept it without. - MATFNS() + MATFNS(); // TODO: ... add when float1 prototypes are generated return float2x2(2,2,2,2); @@ -307,7 +307,7 @@ float2x2 VertexShaderFunction(float2x2 inF0, float2x2 inF1, float2x2 inF2) float3x3 VertexShaderFunction(float3x3 inF0, float3x3 inF1, float3x3 inF2) { // TODO: FXC doesn't accept this with (), but glslang doesn't accept it without. - MATFNS() + MATFNS(); // TODO: ... add when float1 prototypes are generated return float3x3(3,3,3,3,3,3,3,3,3); @@ -316,7 +316,7 @@ float3x3 VertexShaderFunction(float3x3 inF0, float3x3 inF1, float3x3 inF2) float4x4 VertexShaderFunction(float4x4 inF0, float4x4 inF1, float4x4 inF2) { // TODO: FXC doesn't accept this with (), but glslang doesn't accept it without. - MATFNS() + MATFNS(); // TODO: ... add when float1 prototypes are generated return float4x4(4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4); diff --git a/hlsl/hlslGrammar.cpp b/hlsl/hlslGrammar.cpp index 443db4ba..a6387b74 100755 --- a/hlsl/hlslGrammar.cpp +++ b/hlsl/hlslGrammar.cpp @@ -492,6 +492,8 @@ bool HlslGrammar::acceptFunctionDefinition(TFunction& function, TIntermNode*& no // bool HlslGrammar::acceptExpression(TIntermTyped*& node) { + node = nullptr; + // assignment_expression if (! acceptAssignmentExpression(node)) return false; From 643fcb5b43c7f45970d425dcd5b8d0a6bb4ce037 Mon Sep 17 00:00:00 2001 From: LoopDawg Date: Fri, 3 Jun 2016 10:53:28 -0600 Subject: [PATCH 135/140] Add negative intrinsics tests --- .../hlsl.intrinsics.negative.frag.out | 702 +++++++++++ .../hlsl.intrinsics.negative.vert.out | 1055 +++++++++++++++++ Test/hlsl.intrinsics.negative.frag | 137 +++ Test/hlsl.intrinsics.negative.vert | 196 +++ gtests/Hlsl.FromFile.cpp | 6 +- 5 files changed, 2094 insertions(+), 2 deletions(-) create mode 100644 Test/baseResults/hlsl.intrinsics.negative.frag.out create mode 100644 Test/baseResults/hlsl.intrinsics.negative.vert.out create mode 100644 Test/hlsl.intrinsics.negative.frag create mode 100644 Test/hlsl.intrinsics.negative.vert diff --git a/Test/baseResults/hlsl.intrinsics.negative.frag.out b/Test/baseResults/hlsl.intrinsics.negative.frag.out new file mode 100644 index 00000000..9ac39851 --- /dev/null +++ b/Test/baseResults/hlsl.intrinsics.negative.frag.out @@ -0,0 +1,702 @@ +hlsl.intrinsics.negative.frag +ERROR: 0:5: 'asdouble' : no matching overloaded function found +ERROR: 0:6: 'CheckAccessFullyMapped' : no matching overloaded function found +ERROR: 0:7: 'countbits' : no matching overloaded function found +ERROR: 0:8: 'cross' : no matching overloaded function found +ERROR: 0:9: 'D3DCOLORtoUBYTE4' : no matching overloaded function found +ERROR: 0:10: 'determinant' : no matching overloaded function found +ERROR: 0:12: 'f16tof32' : no matching overloaded function found +ERROR: 0:13: 'firstbithigh' : no matching overloaded function found +ERROR: 0:14: 'firstbitlow' : no matching overloaded function found +ERROR: 0:15: 'fma' : no matching overloaded function found +ERROR: 0:23: 'length' : no matching overloaded function found +ERROR: 0:24: 'msad4' : no matching overloaded function found +ERROR: 0:25: 'normalize' : no matching overloaded function found +ERROR: 0:26: 'reflect' : no matching overloaded function found +ERROR: 0:27: 'refract' : no matching overloaded function found +ERROR: 0:28: 'refract' : no matching overloaded function found +ERROR: 0:29: 'reversebits' : no matching overloaded function found +ERROR: 0:30: 'transpose' : no matching overloaded function found +ERROR: 0:39: 'GetRenderTargetSamplePosition' : no matching overloaded function found +ERROR: 0:46: 'asdouble' : no matching overloaded function found +ERROR: 0:47: 'CheckAccessFullyMapped' : no matching overloaded function found +ERROR: 0:48: 'countbits' : no matching overloaded function found +ERROR: 0:49: 'cross' : no matching overloaded function found +ERROR: 0:50: 'D3DCOLORtoUBYTE4' : no matching overloaded function found +ERROR: 0:51: 'determinant' : no matching overloaded function found +ERROR: 0:52: 'f16tof32' : no matching overloaded function found +ERROR: 0:53: 'firstbithigh' : no matching overloaded function found +ERROR: 0:54: 'firstbitlow' : no matching overloaded function found +ERROR: 0:55: 'fma' : no matching overloaded function found +ERROR: 0:56: 'reversebits' : no matching overloaded function found +ERROR: 0:57: 'transpose' : no matching overloaded function found +ERROR: 0:64: 'CheckAccessFullyMapped' : no matching overloaded function found +ERROR: 0:65: 'countbits' : no matching overloaded function found +ERROR: 0:66: 'D3DCOLORtoUBYTE4' : no matching overloaded function found +ERROR: 0:67: 'determinant' : no matching overloaded function found +ERROR: 0:68: 'f16tof32' : no matching overloaded function found +ERROR: 0:69: 'firstbithigh' : no matching overloaded function found +ERROR: 0:70: 'firstbitlow' : no matching overloaded function found +ERROR: 0:71: 'fma' : no matching overloaded function found +ERROR: 0:72: 'reversebits' : no matching overloaded function found +ERROR: 0:73: 'transpose' : no matching overloaded function found +ERROR: 0:81: 'CheckAccessFullyMapped' : no matching overloaded function found +ERROR: 0:82: 'countbits' : no matching overloaded function found +ERROR: 0:83: 'cross' : no matching overloaded function found +ERROR: 0:84: 'determinant' : no matching overloaded function found +ERROR: 0:85: 'f16tof32' : no matching overloaded function found +ERROR: 0:86: 'firstbithigh' : no matching overloaded function found +ERROR: 0:87: 'firstbitlow' : no matching overloaded function found +ERROR: 0:88: 'fma' : no matching overloaded function found +ERROR: 0:89: 'reversebits' : no matching overloaded function found +ERROR: 0:90: 'transpose' : no matching overloaded function found +ERROR: 0:118: 'countbits' : no matching overloaded function found +ERROR: 0:118: 'D3DCOLORtoUBYTE4' : no matching overloaded function found +ERROR: 0:118: 'cross' : no matching overloaded function found +ERROR: 0:118: 'f16tof32' : no matching overloaded function found +ERROR: 0:118: 'firstbithigh' : no matching overloaded function found +ERROR: 0:118: 'firstbitlow' : no matching overloaded function found +ERROR: 0:118: 'fma' : no matching overloaded function found +ERROR: 0:118: 'reversebits' : no matching overloaded function found +ERROR: 0:118: 'length' : no matching overloaded function found +ERROR: 0:118: 'noise' : no matching overloaded function found +ERROR: 0:118: 'normalize' : no matching overloaded function found +ERROR: 0:118: 'reflect' : no matching overloaded function found +ERROR: 0:118: 'refract' : no matching overloaded function found +ERROR: 0:118: 'reversebits' : no matching overloaded function found +ERROR: 0:126: 'countbits' : no matching overloaded function found +ERROR: 0:126: 'D3DCOLORtoUBYTE4' : no matching overloaded function found +ERROR: 0:126: 'cross' : no matching overloaded function found +ERROR: 0:126: 'f16tof32' : no matching overloaded function found +ERROR: 0:126: 'firstbithigh' : no matching overloaded function found +ERROR: 0:126: 'firstbitlow' : no matching overloaded function found +ERROR: 0:126: 'fma' : no matching overloaded function found +ERROR: 0:126: 'reversebits' : no matching overloaded function found +ERROR: 0:126: 'length' : no matching overloaded function found +ERROR: 0:126: 'noise' : no matching overloaded function found +ERROR: 0:126: 'normalize' : no matching overloaded function found +ERROR: 0:126: 'reflect' : no matching overloaded function found +ERROR: 0:126: 'refract' : no matching overloaded function found +ERROR: 0:126: 'reversebits' : no matching overloaded function found +ERROR: 0:134: 'countbits' : no matching overloaded function found +ERROR: 0:134: 'D3DCOLORtoUBYTE4' : no matching overloaded function found +ERROR: 0:134: 'cross' : no matching overloaded function found +ERROR: 0:134: 'f16tof32' : no matching overloaded function found +ERROR: 0:134: 'firstbithigh' : no matching overloaded function found +ERROR: 0:134: 'firstbitlow' : no matching overloaded function found +ERROR: 0:134: 'fma' : no matching overloaded function found +ERROR: 0:134: 'reversebits' : no matching overloaded function found +ERROR: 0:134: 'length' : no matching overloaded function found +ERROR: 0:134: 'noise' : no matching overloaded function found +ERROR: 0:134: 'normalize' : no matching overloaded function found +ERROR: 0:134: 'reflect' : no matching overloaded function found +ERROR: 0:134: 'refract' : no matching overloaded function found +ERROR: 0:134: 'reversebits' : no matching overloaded function found +ERROR: 93 compilation errors. No code generated. + + +Shader version: 450 +gl_FragCoord origin is upper left +ERROR: node is still EOpNull! +0:35 Function Definition: PixelShaderFunction(f1;f1;f1;i1; (temp float) +0:2 Function Parameters: +0:2 'inF0' (temp float) +0:2 'inF1' (temp float) +0:2 'inF2' (temp float) +0:2 'inI0' (temp int) +0:? Sequence +0:5 Constant: +0:5 0.000000 +0:6 Constant: +0:6 0.000000 +0:7 Constant: +0:7 0.000000 +0:8 Constant: +0:8 0.000000 +0:9 Constant: +0:9 0.000000 +0:10 Constant: +0:10 0.000000 +0:12 Constant: +0:12 0.000000 +0:13 Constant: +0:13 0.000000 +0:14 Constant: +0:14 0.000000 +0:15 Constant: +0:15 0.000000 +0:23 Constant: +0:23 0.000000 +0:24 Constant: +0:24 0.000000 +0:25 Constant: +0:25 0.000000 +0:26 Constant: +0:26 0.000000 +0:27 Constant: +0:27 0.000000 +0:28 Constant: +0:28 0.000000 +0:29 Constant: +0:29 0.000000 +0:30 Constant: +0:30 0.000000 +0:32 Branch: Return with expression +0:32 Constant: +0:32 0.000000 +0:44 Function Definition: PixelShaderFunction(vf1;vf1;vf1;i1; (temp 1-component vector of float) +0:36 Function Parameters: +0:36 'inF0' (temp 1-component vector of float) +0:36 'inF1' (temp 1-component vector of float) +0:36 'inF2' (temp 1-component vector of float) +0:36 'inI0' (temp int) +0:? Sequence +0:39 Constant: +0:39 0.000000 +0:41 Branch: Return with expression +0:41 Constant: +0:41 0.000000 +0:62 Function Definition: PixelShaderFunction(vf2;vf2;vf2;vi2; (temp 2-component vector of float) +0:45 Function Parameters: +0:45 'inF0' (temp 2-component vector of float) +0:45 'inF1' (temp 2-component vector of float) +0:45 'inF2' (temp 2-component vector of float) +0:45 'inI0' (temp 2-component vector of int) +0:? Sequence +0:46 Constant: +0:46 0.000000 +0:47 Constant: +0:47 0.000000 +0:48 Constant: +0:48 0.000000 +0:49 Constant: +0:49 0.000000 +0:50 Constant: +0:50 0.000000 +0:51 Constant: +0:51 0.000000 +0:52 Constant: +0:52 0.000000 +0:53 Constant: +0:53 0.000000 +0:54 Constant: +0:54 0.000000 +0:55 Constant: +0:55 0.000000 +0:56 Constant: +0:56 0.000000 +0:57 Constant: +0:57 0.000000 +0:59 Branch: Return with expression +0:? Constant: +0:? 1.000000 +0:? 2.000000 +0:79 Function Definition: PixelShaderFunction(vf3;vf3;vf3;vi3; (temp 3-component vector of float) +0:63 Function Parameters: +0:63 'inF0' (temp 3-component vector of float) +0:63 'inF1' (temp 3-component vector of float) +0:63 'inF2' (temp 3-component vector of float) +0:63 'inI0' (temp 3-component vector of int) +0:? Sequence +0:64 Constant: +0:64 0.000000 +0:65 Constant: +0:65 0.000000 +0:66 Constant: +0:66 0.000000 +0:67 Constant: +0:67 0.000000 +0:68 Constant: +0:68 0.000000 +0:69 Constant: +0:69 0.000000 +0:70 Constant: +0:70 0.000000 +0:71 Constant: +0:71 0.000000 +0:72 Constant: +0:72 0.000000 +0:73 Constant: +0:73 0.000000 +0:76 Branch: Return with expression +0:? Constant: +0:? 1.000000 +0:? 2.000000 +0:? 3.000000 +0:115 Function Definition: PixelShaderFunction(vf4;vf4;vf4;vi4; (temp 4-component vector of float) +0:80 Function Parameters: +0:80 'inF0' (temp 4-component vector of float) +0:80 'inF1' (temp 4-component vector of float) +0:80 'inF2' (temp 4-component vector of float) +0:80 'inI0' (temp 4-component vector of int) +0:? Sequence +0:81 Constant: +0:81 0.000000 +0:82 Constant: +0:82 0.000000 +0:83 Constant: +0:83 0.000000 +0:84 Constant: +0:84 0.000000 +0:85 Constant: +0:85 0.000000 +0:86 Constant: +0:86 0.000000 +0:87 Constant: +0:87 0.000000 +0:88 Constant: +0:88 0.000000 +0:89 Constant: +0:89 0.000000 +0:90 Constant: +0:90 0.000000 +0:92 Branch: Return with expression +0:? Constant: +0:? 1.000000 +0:? 2.000000 +0:? 3.000000 +0:? 4.000000 +0:123 Function Definition: PixelShaderFunction(mf22;mf22;mf22; (temp 2X2 matrix of float) +0:116 Function Parameters: +0:116 'inF0' (temp 2X2 matrix of float) +0:116 'inF1' (temp 2X2 matrix of float) +0:116 'inF2' (temp 2X2 matrix of float) +0:? Sequence +0:118 Constant: +0:118 0.000000 +0:118 Constant: +0:118 0.000000 +0:118 Constant: +0:118 0.000000 +0:118 Constant: +0:118 0.000000 +0:118 Constant: +0:118 0.000000 +0:118 Constant: +0:118 0.000000 +0:118 Constant: +0:118 0.000000 +0:118 Constant: +0:118 0.000000 +0:118 Constant: +0:118 0.000000 +0:118 Constant: +0:118 0.000000 +0:118 Constant: +0:118 0.000000 +0:118 Constant: +0:118 0.000000 +0:118 Constant: +0:118 0.000000 +0:118 Constant: +0:118 0.000000 +0:120 Branch: Return with expression +0:? Constant: +0:? 2.000000 +0:? 2.000000 +0:? 2.000000 +0:? 2.000000 +0:131 Function Definition: PixelShaderFunction(mf33;mf33;mf33; (temp 3X3 matrix of float) +0:124 Function Parameters: +0:124 'inF0' (temp 3X3 matrix of float) +0:124 'inF1' (temp 3X3 matrix of float) +0:124 'inF2' (temp 3X3 matrix of float) +0:? Sequence +0:126 Constant: +0:126 0.000000 +0:126 Constant: +0:126 0.000000 +0:126 Constant: +0:126 0.000000 +0:126 Constant: +0:126 0.000000 +0:126 Constant: +0:126 0.000000 +0:126 Constant: +0:126 0.000000 +0:126 Constant: +0:126 0.000000 +0:126 Constant: +0:126 0.000000 +0:126 Constant: +0:126 0.000000 +0:126 Constant: +0:126 0.000000 +0:126 Constant: +0:126 0.000000 +0:126 Constant: +0:126 0.000000 +0:126 Constant: +0:126 0.000000 +0:126 Constant: +0:126 0.000000 +0:128 Branch: Return with expression +0:? Constant: +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:138 Function Definition: PixelShaderFunction(mf44;mf44;mf44; (temp 4X4 matrix of float) +0:132 Function Parameters: +0:132 'inF0' (temp 4X4 matrix of float) +0:132 'inF1' (temp 4X4 matrix of float) +0:132 'inF2' (temp 4X4 matrix of float) +0:? Sequence +0:134 Constant: +0:134 0.000000 +0:134 Constant: +0:134 0.000000 +0:134 Constant: +0:134 0.000000 +0:134 Constant: +0:134 0.000000 +0:134 Constant: +0:134 0.000000 +0:134 Constant: +0:134 0.000000 +0:134 Constant: +0:134 0.000000 +0:134 Constant: +0:134 0.000000 +0:134 Constant: +0:134 0.000000 +0:134 Constant: +0:134 0.000000 +0:134 Constant: +0:134 0.000000 +0:134 Constant: +0:134 0.000000 +0:134 Constant: +0:134 0.000000 +0:134 Constant: +0:134 0.000000 +0:136 Branch: Return with expression +0:? Constant: +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? Linker Objects + + +Linked fragment stage: + + +Shader version: 450 +gl_FragCoord origin is upper left +ERROR: node is still EOpNull! +0:35 Function Definition: PixelShaderFunction(f1;f1;f1;i1; (temp float) +0:2 Function Parameters: +0:2 'inF0' (temp float) +0:2 'inF1' (temp float) +0:2 'inF2' (temp float) +0:2 'inI0' (temp int) +0:? Sequence +0:5 Constant: +0:5 0.000000 +0:6 Constant: +0:6 0.000000 +0:7 Constant: +0:7 0.000000 +0:8 Constant: +0:8 0.000000 +0:9 Constant: +0:9 0.000000 +0:10 Constant: +0:10 0.000000 +0:12 Constant: +0:12 0.000000 +0:13 Constant: +0:13 0.000000 +0:14 Constant: +0:14 0.000000 +0:15 Constant: +0:15 0.000000 +0:23 Constant: +0:23 0.000000 +0:24 Constant: +0:24 0.000000 +0:25 Constant: +0:25 0.000000 +0:26 Constant: +0:26 0.000000 +0:27 Constant: +0:27 0.000000 +0:28 Constant: +0:28 0.000000 +0:29 Constant: +0:29 0.000000 +0:30 Constant: +0:30 0.000000 +0:32 Branch: Return with expression +0:32 Constant: +0:32 0.000000 +0:44 Function Definition: PixelShaderFunction(vf1;vf1;vf1;i1; (temp 1-component vector of float) +0:36 Function Parameters: +0:36 'inF0' (temp 1-component vector of float) +0:36 'inF1' (temp 1-component vector of float) +0:36 'inF2' (temp 1-component vector of float) +0:36 'inI0' (temp int) +0:? Sequence +0:39 Constant: +0:39 0.000000 +0:41 Branch: Return with expression +0:41 Constant: +0:41 0.000000 +0:62 Function Definition: PixelShaderFunction(vf2;vf2;vf2;vi2; (temp 2-component vector of float) +0:45 Function Parameters: +0:45 'inF0' (temp 2-component vector of float) +0:45 'inF1' (temp 2-component vector of float) +0:45 'inF2' (temp 2-component vector of float) +0:45 'inI0' (temp 2-component vector of int) +0:? Sequence +0:46 Constant: +0:46 0.000000 +0:47 Constant: +0:47 0.000000 +0:48 Constant: +0:48 0.000000 +0:49 Constant: +0:49 0.000000 +0:50 Constant: +0:50 0.000000 +0:51 Constant: +0:51 0.000000 +0:52 Constant: +0:52 0.000000 +0:53 Constant: +0:53 0.000000 +0:54 Constant: +0:54 0.000000 +0:55 Constant: +0:55 0.000000 +0:56 Constant: +0:56 0.000000 +0:57 Constant: +0:57 0.000000 +0:59 Branch: Return with expression +0:? Constant: +0:? 1.000000 +0:? 2.000000 +0:79 Function Definition: PixelShaderFunction(vf3;vf3;vf3;vi3; (temp 3-component vector of float) +0:63 Function Parameters: +0:63 'inF0' (temp 3-component vector of float) +0:63 'inF1' (temp 3-component vector of float) +0:63 'inF2' (temp 3-component vector of float) +0:63 'inI0' (temp 3-component vector of int) +0:? Sequence +0:64 Constant: +0:64 0.000000 +0:65 Constant: +0:65 0.000000 +0:66 Constant: +0:66 0.000000 +0:67 Constant: +0:67 0.000000 +0:68 Constant: +0:68 0.000000 +0:69 Constant: +0:69 0.000000 +0:70 Constant: +0:70 0.000000 +0:71 Constant: +0:71 0.000000 +0:72 Constant: +0:72 0.000000 +0:73 Constant: +0:73 0.000000 +0:76 Branch: Return with expression +0:? Constant: +0:? 1.000000 +0:? 2.000000 +0:? 3.000000 +0:115 Function Definition: PixelShaderFunction(vf4;vf4;vf4;vi4; (temp 4-component vector of float) +0:80 Function Parameters: +0:80 'inF0' (temp 4-component vector of float) +0:80 'inF1' (temp 4-component vector of float) +0:80 'inF2' (temp 4-component vector of float) +0:80 'inI0' (temp 4-component vector of int) +0:? Sequence +0:81 Constant: +0:81 0.000000 +0:82 Constant: +0:82 0.000000 +0:83 Constant: +0:83 0.000000 +0:84 Constant: +0:84 0.000000 +0:85 Constant: +0:85 0.000000 +0:86 Constant: +0:86 0.000000 +0:87 Constant: +0:87 0.000000 +0:88 Constant: +0:88 0.000000 +0:89 Constant: +0:89 0.000000 +0:90 Constant: +0:90 0.000000 +0:92 Branch: Return with expression +0:? Constant: +0:? 1.000000 +0:? 2.000000 +0:? 3.000000 +0:? 4.000000 +0:123 Function Definition: PixelShaderFunction(mf22;mf22;mf22; (temp 2X2 matrix of float) +0:116 Function Parameters: +0:116 'inF0' (temp 2X2 matrix of float) +0:116 'inF1' (temp 2X2 matrix of float) +0:116 'inF2' (temp 2X2 matrix of float) +0:? Sequence +0:118 Constant: +0:118 0.000000 +0:118 Constant: +0:118 0.000000 +0:118 Constant: +0:118 0.000000 +0:118 Constant: +0:118 0.000000 +0:118 Constant: +0:118 0.000000 +0:118 Constant: +0:118 0.000000 +0:118 Constant: +0:118 0.000000 +0:118 Constant: +0:118 0.000000 +0:118 Constant: +0:118 0.000000 +0:118 Constant: +0:118 0.000000 +0:118 Constant: +0:118 0.000000 +0:118 Constant: +0:118 0.000000 +0:118 Constant: +0:118 0.000000 +0:118 Constant: +0:118 0.000000 +0:120 Branch: Return with expression +0:? Constant: +0:? 2.000000 +0:? 2.000000 +0:? 2.000000 +0:? 2.000000 +0:131 Function Definition: PixelShaderFunction(mf33;mf33;mf33; (temp 3X3 matrix of float) +0:124 Function Parameters: +0:124 'inF0' (temp 3X3 matrix of float) +0:124 'inF1' (temp 3X3 matrix of float) +0:124 'inF2' (temp 3X3 matrix of float) +0:? Sequence +0:126 Constant: +0:126 0.000000 +0:126 Constant: +0:126 0.000000 +0:126 Constant: +0:126 0.000000 +0:126 Constant: +0:126 0.000000 +0:126 Constant: +0:126 0.000000 +0:126 Constant: +0:126 0.000000 +0:126 Constant: +0:126 0.000000 +0:126 Constant: +0:126 0.000000 +0:126 Constant: +0:126 0.000000 +0:126 Constant: +0:126 0.000000 +0:126 Constant: +0:126 0.000000 +0:126 Constant: +0:126 0.000000 +0:126 Constant: +0:126 0.000000 +0:126 Constant: +0:126 0.000000 +0:128 Branch: Return with expression +0:? Constant: +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:138 Function Definition: PixelShaderFunction(mf44;mf44;mf44; (temp 4X4 matrix of float) +0:132 Function Parameters: +0:132 'inF0' (temp 4X4 matrix of float) +0:132 'inF1' (temp 4X4 matrix of float) +0:132 'inF2' (temp 4X4 matrix of float) +0:? Sequence +0:134 Constant: +0:134 0.000000 +0:134 Constant: +0:134 0.000000 +0:134 Constant: +0:134 0.000000 +0:134 Constant: +0:134 0.000000 +0:134 Constant: +0:134 0.000000 +0:134 Constant: +0:134 0.000000 +0:134 Constant: +0:134 0.000000 +0:134 Constant: +0:134 0.000000 +0:134 Constant: +0:134 0.000000 +0:134 Constant: +0:134 0.000000 +0:134 Constant: +0:134 0.000000 +0:134 Constant: +0:134 0.000000 +0:134 Constant: +0:134 0.000000 +0:134 Constant: +0:134 0.000000 +0:136 Branch: Return with expression +0:? Constant: +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? Linker Objects + +SPIR-V is not generated for failed compile or link diff --git a/Test/baseResults/hlsl.intrinsics.negative.vert.out b/Test/baseResults/hlsl.intrinsics.negative.vert.out new file mode 100644 index 00000000..6fc87bf3 --- /dev/null +++ b/Test/baseResults/hlsl.intrinsics.negative.vert.out @@ -0,0 +1,1055 @@ +hlsl.intrinsics.negative.vert +ERROR: 0:5: 'asdouble' : no matching overloaded function found +ERROR: 0:6: 'CheckAccessFullyMapped' : no matching overloaded function found +ERROR: 0:7: 'CheckAccessFullyMapped' : no matching overloaded function found +ERROR: 0:8: 'clip' : no matching overloaded function found +ERROR: 0:9: 'countbits' : no matching overloaded function found +ERROR: 0:10: 'cross' : no matching overloaded function found +ERROR: 0:11: 'D3DCOLORtoUBYTE4' : no matching overloaded function found +ERROR: 0:14: 'ddx' : no matching overloaded function found +ERROR: 0:15: 'ddx_coarse' : no matching overloaded function found +ERROR: 0:16: 'ddx_fine' : no matching overloaded function found +ERROR: 0:17: 'ddy' : no matching overloaded function found +ERROR: 0:18: 'ddy_coarse' : no matching overloaded function found +ERROR: 0:19: 'ddy_fine' : no matching overloaded function found +ERROR: 0:20: 'determinant' : no matching overloaded function found +ERROR: 0:21: 'EvaluateAttributeAtCentroid' : no matching overloaded function found +ERROR: 0:22: 'EvaluateAttributeAtSample' : no matching overloaded function found +ERROR: 0:23: 'EvaluateAttributeSnapped' : no matching overloaded function found +ERROR: 0:24: 'f16tof32' : no matching overloaded function found +ERROR: 0:25: 'firstbithigh' : no matching overloaded function found +ERROR: 0:26: 'firstbitlow' : no matching overloaded function found +ERROR: 0:27: 'fma' : no matching overloaded function found +ERROR: 0:35: 'length' : no matching overloaded function found +ERROR: 0:36: 'msad4' : no matching overloaded function found +ERROR: 0:37: 'normalize' : no matching overloaded function found +ERROR: 0:38: 'reflect' : no matching overloaded function found +ERROR: 0:39: 'refract' : no matching overloaded function found +ERROR: 0:40: 'refract' : no matching overloaded function found +ERROR: 0:41: 'reversebits' : no matching overloaded function found +ERROR: 0:42: 'transpose' : no matching overloaded function found +ERROR: 0:53: 'GetRenderTargetSamplePosition' : no matching overloaded function found +ERROR: 0:60: 'asdouble' : no matching overloaded function found +ERROR: 0:61: 'CheckAccessFullyMapped' : no matching overloaded function found +ERROR: 0:62: 'countbits' : no matching overloaded function found +ERROR: 0:63: 'cross' : no matching overloaded function found +ERROR: 0:64: 'D3DCOLORtoUBYTE4' : no matching overloaded function found +ERROR: 0:65: 'ddx' : no matching overloaded function found +ERROR: 0:66: 'ddx_coarse' : no matching overloaded function found +ERROR: 0:67: 'ddx_fine' : no matching overloaded function found +ERROR: 0:68: 'ddy' : no matching overloaded function found +ERROR: 0:69: 'ddy_coarse' : no matching overloaded function found +ERROR: 0:70: 'ddy_fine' : no matching overloaded function found +ERROR: 0:71: 'determinant' : no matching overloaded function found +ERROR: 0:72: 'EvaluateAttributeAtCentroid' : no matching overloaded function found +ERROR: 0:73: 'EvaluateAttributeAtSample' : no matching overloaded function found +ERROR: 0:74: 'EvaluateAttributeSnapped' : no matching overloaded function found +ERROR: 0:75: 'f16tof32' : no matching overloaded function found +ERROR: 0:76: 'firstbithigh' : no matching overloaded function found +ERROR: 0:77: 'firstbitlow' : no matching overloaded function found +ERROR: 0:78: 'fma' : no matching overloaded function found +ERROR: 0:79: 'noise' : no matching overloaded function found +ERROR: 0:80: 'reversebits' : no matching overloaded function found +ERROR: 0:81: 'transpose' : no matching overloaded function found +ERROR: 0:90: 'CheckAccessFullyMapped' : no matching overloaded function found +ERROR: 0:91: 'countbits' : no matching overloaded function found +ERROR: 0:92: 'ddx' : no matching overloaded function found +ERROR: 0:93: 'ddx_coarse' : no matching overloaded function found +ERROR: 0:94: 'ddx_fine' : no matching overloaded function found +ERROR: 0:95: 'ddy' : no matching overloaded function found +ERROR: 0:96: 'ddy_coarse' : no matching overloaded function found +ERROR: 0:97: 'ddy_fine' : no matching overloaded function found +ERROR: 0:98: 'D3DCOLORtoUBYTE4' : no matching overloaded function found +ERROR: 0:99: 'determinant' : no matching overloaded function found +ERROR: 0:100: 'EvaluateAttributeAtCentroid' : no matching overloaded function found +ERROR: 0:101: 'EvaluateAttributeAtSample' : no matching overloaded function found +ERROR: 0:102: 'EvaluateAttributeSnapped' : no matching overloaded function found +ERROR: 0:103: 'f16tof32' : no matching overloaded function found +ERROR: 0:104: 'firstbithigh' : no matching overloaded function found +ERROR: 0:105: 'firstbitlow' : no matching overloaded function found +ERROR: 0:106: 'fma' : no matching overloaded function found +ERROR: 0:107: 'noise' : no matching overloaded function found +ERROR: 0:108: 'reversebits' : no matching overloaded function found +ERROR: 0:109: 'transpose' : no matching overloaded function found +ERROR: 0:118: 'CheckAccessFullyMapped' : no matching overloaded function found +ERROR: 0:119: 'countbits' : no matching overloaded function found +ERROR: 0:120: 'cross' : no matching overloaded function found +ERROR: 0:121: 'determinant' : no matching overloaded function found +ERROR: 0:122: 'ddx' : no matching overloaded function found +ERROR: 0:123: 'ddx_coarse' : no matching overloaded function found +ERROR: 0:124: 'ddx_fine' : no matching overloaded function found +ERROR: 0:125: 'ddy' : no matching overloaded function found +ERROR: 0:126: 'ddy_coarse' : no matching overloaded function found +ERROR: 0:127: 'ddy_fine' : no matching overloaded function found +ERROR: 0:128: 'EvaluateAttributeAtCentroid' : no matching overloaded function found +ERROR: 0:129: 'EvaluateAttributeAtSample' : no matching overloaded function found +ERROR: 0:130: 'EvaluateAttributeSnapped' : no matching overloaded function found +ERROR: 0:131: 'f16tof32' : no matching overloaded function found +ERROR: 0:132: 'firstbithigh' : no matching overloaded function found +ERROR: 0:133: 'firstbitlow' : no matching overloaded function found +ERROR: 0:134: 'fma' : no matching overloaded function found +ERROR: 0:135: 'noise' : no matching overloaded function found +ERROR: 0:136: 'reversebits' : no matching overloaded function found +ERROR: 0:137: 'transpose' : no matching overloaded function found +ERROR: 0:177: 'countbits' : no matching overloaded function found +ERROR: 0:177: 'cross' : no matching overloaded function found +ERROR: 0:177: 'D3DCOLORtoUBYTE4' : no matching overloaded function found +ERROR: 0:177: 'ddx' : no matching overloaded function found +ERROR: 0:177: 'ddx_coarse' : no matching overloaded function found +ERROR: 0:177: 'ddx_fine' : no matching overloaded function found +ERROR: 0:177: 'ddy' : no matching overloaded function found +ERROR: 0:177: 'ddy_coarse' : no matching overloaded function found +ERROR: 0:177: 'ddy_fine' : no matching overloaded function found +ERROR: 0:177: 'EvaluateAttributeAtCentroid' : no matching overloaded function found +ERROR: 0:177: 'EvaluateAttributeAtSample' : no matching overloaded function found +ERROR: 0:177: 'EvaluateAttributeSnapped' : no matching overloaded function found +ERROR: 0:177: 'f16tof32' : no matching overloaded function found +ERROR: 0:177: 'firstbithigh' : no matching overloaded function found +ERROR: 0:177: 'firstbitlow' : no matching overloaded function found +ERROR: 0:177: 'fma' : no matching overloaded function found +ERROR: 0:177: 'noise' : no matching overloaded function found +ERROR: 0:177: 'reversebits' : no matching overloaded function found +ERROR: 0:177: 'length' : no matching overloaded function found +ERROR: 0:177: 'noise' : no matching overloaded function found +ERROR: 0:177: 'normalize' : no matching overloaded function found +ERROR: 0:177: 'reflect' : no matching overloaded function found +ERROR: 0:177: 'refract' : no matching overloaded function found +ERROR: 0:177: 'reversebits' : no matching overloaded function found +ERROR: 0:185: 'countbits' : no matching overloaded function found +ERROR: 0:185: 'cross' : no matching overloaded function found +ERROR: 0:185: 'D3DCOLORtoUBYTE4' : no matching overloaded function found +ERROR: 0:185: 'ddx' : no matching overloaded function found +ERROR: 0:185: 'ddx_coarse' : no matching overloaded function found +ERROR: 0:185: 'ddx_fine' : no matching overloaded function found +ERROR: 0:185: 'ddy' : no matching overloaded function found +ERROR: 0:185: 'ddy_coarse' : no matching overloaded function found +ERROR: 0:185: 'ddy_fine' : no matching overloaded function found +ERROR: 0:185: 'EvaluateAttributeAtCentroid' : no matching overloaded function found +ERROR: 0:185: 'EvaluateAttributeAtSample' : no matching overloaded function found +ERROR: 0:185: 'EvaluateAttributeSnapped' : no matching overloaded function found +ERROR: 0:185: 'f16tof32' : no matching overloaded function found +ERROR: 0:185: 'firstbithigh' : no matching overloaded function found +ERROR: 0:185: 'firstbitlow' : no matching overloaded function found +ERROR: 0:185: 'fma' : no matching overloaded function found +ERROR: 0:185: 'noise' : no matching overloaded function found +ERROR: 0:185: 'reversebits' : no matching overloaded function found +ERROR: 0:185: 'length' : no matching overloaded function found +ERROR: 0:185: 'noise' : no matching overloaded function found +ERROR: 0:185: 'normalize' : no matching overloaded function found +ERROR: 0:185: 'reflect' : no matching overloaded function found +ERROR: 0:185: 'refract' : no matching overloaded function found +ERROR: 0:185: 'reversebits' : no matching overloaded function found +ERROR: 0:193: 'countbits' : no matching overloaded function found +ERROR: 0:193: 'cross' : no matching overloaded function found +ERROR: 0:193: 'D3DCOLORtoUBYTE4' : no matching overloaded function found +ERROR: 0:193: 'ddx' : no matching overloaded function found +ERROR: 0:193: 'ddx_coarse' : no matching overloaded function found +ERROR: 0:193: 'ddx_fine' : no matching overloaded function found +ERROR: 0:193: 'ddy' : no matching overloaded function found +ERROR: 0:193: 'ddy_coarse' : no matching overloaded function found +ERROR: 0:193: 'ddy_fine' : no matching overloaded function found +ERROR: 0:193: 'EvaluateAttributeAtCentroid' : no matching overloaded function found +ERROR: 0:193: 'EvaluateAttributeAtSample' : no matching overloaded function found +ERROR: 0:193: 'EvaluateAttributeSnapped' : no matching overloaded function found +ERROR: 0:193: 'f16tof32' : no matching overloaded function found +ERROR: 0:193: 'firstbithigh' : no matching overloaded function found +ERROR: 0:193: 'firstbitlow' : no matching overloaded function found +ERROR: 0:193: 'fma' : no matching overloaded function found +ERROR: 0:193: 'noise' : no matching overloaded function found +ERROR: 0:193: 'reversebits' : no matching overloaded function found +ERROR: 0:193: 'length' : no matching overloaded function found +ERROR: 0:193: 'noise' : no matching overloaded function found +ERROR: 0:193: 'normalize' : no matching overloaded function found +ERROR: 0:193: 'reflect' : no matching overloaded function found +ERROR: 0:193: 'refract' : no matching overloaded function found +ERROR: 0:193: 'reversebits' : no matching overloaded function found +ERROR: 164 compilation errors. No code generated. + + +Shader version: 450 +ERROR: node is still EOpNull! +0:49 Function Definition: VertexShaderFunction(f1;f1;f1;i1; (temp float) +0:2 Function Parameters: +0:2 'inF0' (temp float) +0:2 'inF1' (temp float) +0:2 'inF2' (temp float) +0:2 'inI0' (temp int) +0:? Sequence +0:5 Constant: +0:5 0.000000 +0:6 Constant: +0:6 0.000000 +0:7 Constant: +0:7 0.000000 +0:8 Constant: +0:8 0.000000 +0:9 Constant: +0:9 0.000000 +0:10 Constant: +0:10 0.000000 +0:11 Constant: +0:11 0.000000 +0:14 Constant: +0:14 0.000000 +0:15 Constant: +0:15 0.000000 +0:16 Constant: +0:16 0.000000 +0:17 Constant: +0:17 0.000000 +0:18 Constant: +0:18 0.000000 +0:19 Constant: +0:19 0.000000 +0:20 Constant: +0:20 0.000000 +0:21 Constant: +0:21 0.000000 +0:22 Constant: +0:22 0.000000 +0:23 Constant: +0:23 0.000000 +0:24 Constant: +0:24 0.000000 +0:25 Constant: +0:25 0.000000 +0:26 Constant: +0:26 0.000000 +0:27 Constant: +0:27 0.000000 +0:35 Constant: +0:35 0.000000 +0:36 Constant: +0:36 0.000000 +0:37 Constant: +0:37 0.000000 +0:38 Constant: +0:38 0.000000 +0:39 Constant: +0:39 0.000000 +0:40 Constant: +0:40 0.000000 +0:41 Constant: +0:41 0.000000 +0:42 Constant: +0:42 0.000000 +0:46 Branch: Return with expression +0:46 Constant: +0:46 0.000000 +0:58 Function Definition: VertexShaderFunction(vf1;vf1;vf1;i1; (temp 1-component vector of float) +0:50 Function Parameters: +0:50 'inF0' (temp 1-component vector of float) +0:50 'inF1' (temp 1-component vector of float) +0:50 'inF2' (temp 1-component vector of float) +0:50 'inI0' (temp int) +0:? Sequence +0:53 Constant: +0:53 0.000000 +0:55 Branch: Return with expression +0:55 Constant: +0:55 0.000000 +0:88 Function Definition: VertexShaderFunction(vf2;vf2;vf2;vi2; (temp 2-component vector of float) +0:59 Function Parameters: +0:59 'inF0' (temp 2-component vector of float) +0:59 'inF1' (temp 2-component vector of float) +0:59 'inF2' (temp 2-component vector of float) +0:59 'inI0' (temp 2-component vector of int) +0:? Sequence +0:60 Constant: +0:60 0.000000 +0:61 Constant: +0:61 0.000000 +0:62 Constant: +0:62 0.000000 +0:63 Constant: +0:63 0.000000 +0:64 Constant: +0:64 0.000000 +0:65 Constant: +0:65 0.000000 +0:66 Constant: +0:66 0.000000 +0:67 Constant: +0:67 0.000000 +0:68 Constant: +0:68 0.000000 +0:69 Constant: +0:69 0.000000 +0:70 Constant: +0:70 0.000000 +0:71 Constant: +0:71 0.000000 +0:72 Constant: +0:72 0.000000 +0:73 Constant: +0:73 0.000000 +0:74 Constant: +0:74 0.000000 +0:75 Constant: +0:75 0.000000 +0:76 Constant: +0:76 0.000000 +0:77 Constant: +0:77 0.000000 +0:78 Constant: +0:78 0.000000 +0:79 Constant: +0:79 0.000000 +0:80 Constant: +0:80 0.000000 +0:81 Constant: +0:81 0.000000 +0:85 Branch: Return with expression +0:? Constant: +0:? 1.000000 +0:? 2.000000 +0:116 Function Definition: VertexShaderFunction(vf3;vf3;vf3;vi3; (temp 3-component vector of float) +0:89 Function Parameters: +0:89 'inF0' (temp 3-component vector of float) +0:89 'inF1' (temp 3-component vector of float) +0:89 'inF2' (temp 3-component vector of float) +0:89 'inI0' (temp 3-component vector of int) +0:? Sequence +0:90 Constant: +0:90 0.000000 +0:91 Constant: +0:91 0.000000 +0:92 Constant: +0:92 0.000000 +0:93 Constant: +0:93 0.000000 +0:94 Constant: +0:94 0.000000 +0:95 Constant: +0:95 0.000000 +0:96 Constant: +0:96 0.000000 +0:97 Constant: +0:97 0.000000 +0:98 Constant: +0:98 0.000000 +0:99 Constant: +0:99 0.000000 +0:100 Constant: +0:100 0.000000 +0:101 Constant: +0:101 0.000000 +0:102 Constant: +0:102 0.000000 +0:103 Constant: +0:103 0.000000 +0:104 Constant: +0:104 0.000000 +0:105 Constant: +0:105 0.000000 +0:106 Constant: +0:106 0.000000 +0:107 Constant: +0:107 0.000000 +0:108 Constant: +0:108 0.000000 +0:109 Constant: +0:109 0.000000 +0:113 Branch: Return with expression +0:? Constant: +0:? 1.000000 +0:? 2.000000 +0:? 3.000000 +0:174 Function Definition: VertexShaderFunction(vf4;vf4;vf4;vi4; (temp 4-component vector of float) +0:117 Function Parameters: +0:117 'inF0' (temp 4-component vector of float) +0:117 'inF1' (temp 4-component vector of float) +0:117 'inF2' (temp 4-component vector of float) +0:117 'inI0' (temp 4-component vector of int) +0:? Sequence +0:118 Constant: +0:118 0.000000 +0:119 Constant: +0:119 0.000000 +0:120 Constant: +0:120 0.000000 +0:121 Constant: +0:121 0.000000 +0:122 Constant: +0:122 0.000000 +0:123 Constant: +0:123 0.000000 +0:124 Constant: +0:124 0.000000 +0:125 Constant: +0:125 0.000000 +0:126 Constant: +0:126 0.000000 +0:127 Constant: +0:127 0.000000 +0:128 Constant: +0:128 0.000000 +0:129 Constant: +0:129 0.000000 +0:130 Constant: +0:130 0.000000 +0:131 Constant: +0:131 0.000000 +0:132 Constant: +0:132 0.000000 +0:133 Constant: +0:133 0.000000 +0:134 Constant: +0:134 0.000000 +0:135 Constant: +0:135 0.000000 +0:136 Constant: +0:136 0.000000 +0:137 Constant: +0:137 0.000000 +0:141 Branch: Return with expression +0:? Constant: +0:? 1.000000 +0:? 2.000000 +0:? 3.000000 +0:? 4.000000 +0:182 Function Definition: VertexShaderFunction(mf22;mf22;mf22; (temp 2X2 matrix of float) +0:175 Function Parameters: +0:175 'inF0' (temp 2X2 matrix of float) +0:175 'inF1' (temp 2X2 matrix of float) +0:175 'inF2' (temp 2X2 matrix of float) +0:? Sequence +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:179 Branch: Return with expression +0:? Constant: +0:? 2.000000 +0:? 2.000000 +0:? 2.000000 +0:? 2.000000 +0:190 Function Definition: VertexShaderFunction(mf33;mf33;mf33; (temp 3X3 matrix of float) +0:183 Function Parameters: +0:183 'inF0' (temp 3X3 matrix of float) +0:183 'inF1' (temp 3X3 matrix of float) +0:183 'inF2' (temp 3X3 matrix of float) +0:? Sequence +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:187 Branch: Return with expression +0:? Constant: +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:197 Function Definition: VertexShaderFunction(mf44;mf44;mf44; (temp 4X4 matrix of float) +0:191 Function Parameters: +0:191 'inF0' (temp 4X4 matrix of float) +0:191 'inF1' (temp 4X4 matrix of float) +0:191 'inF2' (temp 4X4 matrix of float) +0:? Sequence +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:195 Branch: Return with expression +0:? Constant: +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? Linker Objects + + +Linked vertex stage: + + +Shader version: 450 +ERROR: node is still EOpNull! +0:49 Function Definition: VertexShaderFunction(f1;f1;f1;i1; (temp float) +0:2 Function Parameters: +0:2 'inF0' (temp float) +0:2 'inF1' (temp float) +0:2 'inF2' (temp float) +0:2 'inI0' (temp int) +0:? Sequence +0:5 Constant: +0:5 0.000000 +0:6 Constant: +0:6 0.000000 +0:7 Constant: +0:7 0.000000 +0:8 Constant: +0:8 0.000000 +0:9 Constant: +0:9 0.000000 +0:10 Constant: +0:10 0.000000 +0:11 Constant: +0:11 0.000000 +0:14 Constant: +0:14 0.000000 +0:15 Constant: +0:15 0.000000 +0:16 Constant: +0:16 0.000000 +0:17 Constant: +0:17 0.000000 +0:18 Constant: +0:18 0.000000 +0:19 Constant: +0:19 0.000000 +0:20 Constant: +0:20 0.000000 +0:21 Constant: +0:21 0.000000 +0:22 Constant: +0:22 0.000000 +0:23 Constant: +0:23 0.000000 +0:24 Constant: +0:24 0.000000 +0:25 Constant: +0:25 0.000000 +0:26 Constant: +0:26 0.000000 +0:27 Constant: +0:27 0.000000 +0:35 Constant: +0:35 0.000000 +0:36 Constant: +0:36 0.000000 +0:37 Constant: +0:37 0.000000 +0:38 Constant: +0:38 0.000000 +0:39 Constant: +0:39 0.000000 +0:40 Constant: +0:40 0.000000 +0:41 Constant: +0:41 0.000000 +0:42 Constant: +0:42 0.000000 +0:46 Branch: Return with expression +0:46 Constant: +0:46 0.000000 +0:58 Function Definition: VertexShaderFunction(vf1;vf1;vf1;i1; (temp 1-component vector of float) +0:50 Function Parameters: +0:50 'inF0' (temp 1-component vector of float) +0:50 'inF1' (temp 1-component vector of float) +0:50 'inF2' (temp 1-component vector of float) +0:50 'inI0' (temp int) +0:? Sequence +0:53 Constant: +0:53 0.000000 +0:55 Branch: Return with expression +0:55 Constant: +0:55 0.000000 +0:88 Function Definition: VertexShaderFunction(vf2;vf2;vf2;vi2; (temp 2-component vector of float) +0:59 Function Parameters: +0:59 'inF0' (temp 2-component vector of float) +0:59 'inF1' (temp 2-component vector of float) +0:59 'inF2' (temp 2-component vector of float) +0:59 'inI0' (temp 2-component vector of int) +0:? Sequence +0:60 Constant: +0:60 0.000000 +0:61 Constant: +0:61 0.000000 +0:62 Constant: +0:62 0.000000 +0:63 Constant: +0:63 0.000000 +0:64 Constant: +0:64 0.000000 +0:65 Constant: +0:65 0.000000 +0:66 Constant: +0:66 0.000000 +0:67 Constant: +0:67 0.000000 +0:68 Constant: +0:68 0.000000 +0:69 Constant: +0:69 0.000000 +0:70 Constant: +0:70 0.000000 +0:71 Constant: +0:71 0.000000 +0:72 Constant: +0:72 0.000000 +0:73 Constant: +0:73 0.000000 +0:74 Constant: +0:74 0.000000 +0:75 Constant: +0:75 0.000000 +0:76 Constant: +0:76 0.000000 +0:77 Constant: +0:77 0.000000 +0:78 Constant: +0:78 0.000000 +0:79 Constant: +0:79 0.000000 +0:80 Constant: +0:80 0.000000 +0:81 Constant: +0:81 0.000000 +0:85 Branch: Return with expression +0:? Constant: +0:? 1.000000 +0:? 2.000000 +0:116 Function Definition: VertexShaderFunction(vf3;vf3;vf3;vi3; (temp 3-component vector of float) +0:89 Function Parameters: +0:89 'inF0' (temp 3-component vector of float) +0:89 'inF1' (temp 3-component vector of float) +0:89 'inF2' (temp 3-component vector of float) +0:89 'inI0' (temp 3-component vector of int) +0:? Sequence +0:90 Constant: +0:90 0.000000 +0:91 Constant: +0:91 0.000000 +0:92 Constant: +0:92 0.000000 +0:93 Constant: +0:93 0.000000 +0:94 Constant: +0:94 0.000000 +0:95 Constant: +0:95 0.000000 +0:96 Constant: +0:96 0.000000 +0:97 Constant: +0:97 0.000000 +0:98 Constant: +0:98 0.000000 +0:99 Constant: +0:99 0.000000 +0:100 Constant: +0:100 0.000000 +0:101 Constant: +0:101 0.000000 +0:102 Constant: +0:102 0.000000 +0:103 Constant: +0:103 0.000000 +0:104 Constant: +0:104 0.000000 +0:105 Constant: +0:105 0.000000 +0:106 Constant: +0:106 0.000000 +0:107 Constant: +0:107 0.000000 +0:108 Constant: +0:108 0.000000 +0:109 Constant: +0:109 0.000000 +0:113 Branch: Return with expression +0:? Constant: +0:? 1.000000 +0:? 2.000000 +0:? 3.000000 +0:174 Function Definition: VertexShaderFunction(vf4;vf4;vf4;vi4; (temp 4-component vector of float) +0:117 Function Parameters: +0:117 'inF0' (temp 4-component vector of float) +0:117 'inF1' (temp 4-component vector of float) +0:117 'inF2' (temp 4-component vector of float) +0:117 'inI0' (temp 4-component vector of int) +0:? Sequence +0:118 Constant: +0:118 0.000000 +0:119 Constant: +0:119 0.000000 +0:120 Constant: +0:120 0.000000 +0:121 Constant: +0:121 0.000000 +0:122 Constant: +0:122 0.000000 +0:123 Constant: +0:123 0.000000 +0:124 Constant: +0:124 0.000000 +0:125 Constant: +0:125 0.000000 +0:126 Constant: +0:126 0.000000 +0:127 Constant: +0:127 0.000000 +0:128 Constant: +0:128 0.000000 +0:129 Constant: +0:129 0.000000 +0:130 Constant: +0:130 0.000000 +0:131 Constant: +0:131 0.000000 +0:132 Constant: +0:132 0.000000 +0:133 Constant: +0:133 0.000000 +0:134 Constant: +0:134 0.000000 +0:135 Constant: +0:135 0.000000 +0:136 Constant: +0:136 0.000000 +0:137 Constant: +0:137 0.000000 +0:141 Branch: Return with expression +0:? Constant: +0:? 1.000000 +0:? 2.000000 +0:? 3.000000 +0:? 4.000000 +0:182 Function Definition: VertexShaderFunction(mf22;mf22;mf22; (temp 2X2 matrix of float) +0:175 Function Parameters: +0:175 'inF0' (temp 2X2 matrix of float) +0:175 'inF1' (temp 2X2 matrix of float) +0:175 'inF2' (temp 2X2 matrix of float) +0:? Sequence +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:177 Constant: +0:177 0.000000 +0:179 Branch: Return with expression +0:? Constant: +0:? 2.000000 +0:? 2.000000 +0:? 2.000000 +0:? 2.000000 +0:190 Function Definition: VertexShaderFunction(mf33;mf33;mf33; (temp 3X3 matrix of float) +0:183 Function Parameters: +0:183 'inF0' (temp 3X3 matrix of float) +0:183 'inF1' (temp 3X3 matrix of float) +0:183 'inF2' (temp 3X3 matrix of float) +0:? Sequence +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:185 Constant: +0:185 0.000000 +0:187 Branch: Return with expression +0:? Constant: +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:? 3.000000 +0:197 Function Definition: VertexShaderFunction(mf44;mf44;mf44; (temp 4X4 matrix of float) +0:191 Function Parameters: +0:191 'inF0' (temp 4X4 matrix of float) +0:191 'inF1' (temp 4X4 matrix of float) +0:191 'inF2' (temp 4X4 matrix of float) +0:? Sequence +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:193 Constant: +0:193 0.000000 +0:195 Branch: Return with expression +0:? Constant: +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? 4.000000 +0:? Linker Objects + +SPIR-V is not generated for failed compile or link diff --git a/Test/hlsl.intrinsics.negative.frag b/Test/hlsl.intrinsics.negative.frag new file mode 100644 index 00000000..b93f104d --- /dev/null +++ b/Test/hlsl.intrinsics.negative.frag @@ -0,0 +1,137 @@ +float PixelShaderFunction(float inF0, float inF1, float inF2, int inI0) +{ + // AllMemoryBarrier(); // TODO: expected error: invalid in fragment stage + // AllMemoryBarrierWithGroupSync(); // TODO: expected error: invalid in fragment stage + asdouble(inF0, inF1); // expected error: only integer inputs + CheckAccessFullyMapped(3.0); // expected error: only valid on integers + countbits(inF0); // expected error: only integer inputs + cross(inF0, inF1); // expected error: only on float3 inputs + D3DCOLORtoUBYTE4(inF0); // expected error: only on float4 inputs + determinant(inF0); // expected error: only valid on mats + // DeviceMemoryBarrierWithGroupSync(); // TODO: expected error: only valid in compute stage + f16tof32(inF0); // expected error: only integer inputs + firstbithigh(inF0); // expected error: only integer inputs + firstbitlow(inF0); // expected error: only integer inputs + fma(inF0, inF1, inF2); // expected error: only double inputs + // InterlockedAdd(inI0, inI0, 3); // expected error: last parameter is out TODO: accepted even though marked as out in proto generator + // InterlockedAnd(inI0, inI0, 3); // expected error: last parameter is out TODO: accepted even though marked as out i // InterlockedMax(inI0, inI0, 3); // expected error: last parameter is out TODO: accepted even though marked as out in proto generator + // InterlockedMin(inI0, inI0, 3); // expected error: last parameter is out TODO: accepted even though marked as out in proto generator + // InterlockedOor(inI0, inI0, 3); // expected error: last parameter is out TODO: accepted even though marked as out in proto generator + // InterlockedXor(inI0, inI0, 3); // expected error: last parameter is out TODO: accepted even though marked as out in proto generator + // GroupMemoryBarrier(); // TODO: expected error: invalid in fragment stage + // GroupMemoryBarrierWithGroupSync(); // TODO: expected error: invalid in fragment stage + length(inF0); // expected error: invalid on scalars + msad4(inF0, float2(0), float4(0)); // expected error: only integer inputs + normalize(inF0); // expected error: invalid on scalars + reflect(inF0, inF1); // expected error: invalid on scalars + refract(inF0, inF1, inF2); // expected error: invalid on scalars + refract(float2(0), float2(0), float2(0)); // expected error: last parameter only scalar + reversebits(inF0); // expected error: only integer inputs + transpose(inF0); // expected error: only valid on mats + + return 0.0; +} + +float1 PixelShaderFunction(float1 inF0, float1 inF1, float1 inF2, int1 inI0) +{ + // TODO: ... add when float1 prototypes are generated + + GetRenderTargetSamplePosition(inF0); // expected error: only integer inputs + + return 0.0; +} + +float2 PixelShaderFunction(float2 inF0, float2 inF1, float2 inF2, int2 inI0) +{ + asdouble(inF0, inF1); // expected error: only integer inputs + CheckAccessFullyMapped(inF0); // expected error: only valid on scalars + countbits(inF0); // expected error: only integer inputs + cross(inF0, inF1); // expected error: only on float3 inputs + D3DCOLORtoUBYTE4(inF0); // expected error: only on float4 inputs + determinant(inF0); // expected error: only valid on mats + f16tof32(inF0); // expected error: only integer inputs + firstbithigh(inF0); // expected error: only integer inputs + firstbitlow(inF0); // expected error: only integer inputs + fma(inF0, inF1, inF2); // expected error: only double inputs + reversebits(inF0); // expected error: only integer inputs + transpose(inF0); // expected error: only valid on mats + + return float2(1,2); +} + +float3 PixelShaderFunction(float3 inF0, float3 inF1, float3 inF2, int3 inI0) +{ + CheckAccessFullyMapped(inF0); // expected error: only valid on scalars + countbits(inF0); // expected error: only integer inputs + D3DCOLORtoUBYTE4(inF0); // expected error: only on float4 inputs + determinant(inF0); // expected error: only valid on mats + f16tof32(inF0); // expected error: only integer inputs + firstbithigh(inF0); // expected error: only integer inputs + firstbitlow(inF0); // expected error: only integer inputs + fma(inF0, inF1, inF2); // expected error: only double inputs + reversebits(inF0); // expected error: only integer inputs + transpose(inF0); // expected error: only valid on mats + + + return float3(1,2,3); +} + +float4 PixelShaderFunction(float4 inF0, float4 inF1, float4 inF2, int4 inI0) +{ + CheckAccessFullyMapped(inF0); // expected error: only valid on scalars + countbits(inF0); // expected error: only integer inputs + cross(inF0, inF1); // expected error: only on float3 inputs + determinant(inF0); // expected error: only valid on mats + f16tof32(inF0); // expected error: only integer inputs + firstbithigh(inF0); // expected error: only integer inputs + firstbitlow(inF0); // expected error: only integer inputs + fma(inF0, inF1, inF2); // expected error: only double inputs + reversebits(inF0); // expected error: only integer inputs + transpose(inF0); // expected error: only valid on mats + + return float4(1,2,3,4); +} + +// TODO: FXC doesn't accept this with (), but glslang doesn't accept it without. +#define MATFNS() \ + countbits(inF0); \ + D3DCOLORtoUBYTE4(inF0); \ + cross(inF0, inF1); \ + f16tof32(inF0); \ + firstbithigh(inF0); \ + firstbitlow(inF0); \ + fma(inF0, inF1, inF2); \ + reversebits(inF0); \ + length(inF0); \ + noise(inF0); \ + normalize(inF0); \ + reflect(inF0, inF1); \ + refract(inF0, inF1, 1.0); \ + reversebits(inF0); \ + + +// TODO: turn on non-square matrix tests when protos are available. + +float2x2 PixelShaderFunction(float2x2 inF0, float2x2 inF1, float2x2 inF2) +{ + // TODO: FXC doesn't accept this with (), but glslang doesn't accept it without. + MATFNS() + + return float2x2(2,2,2,2); +} + +float3x3 PixelShaderFunction(float3x3 inF0, float3x3 inF1, float3x3 inF2) +{ + // TODO: FXC doesn't accept this with (), but glslang doesn't accept it without. + MATFNS() + + return float3x3(3,3,3,3,3,3,3,3,3); +} + +float4x4 PixelShaderFunction(float4x4 inF0, float4x4 inF1, float4x4 inF2) +{ + // TODO: FXC doesn't accept this with (), but glslang doesn't accept it without. + MATFNS() + + return float4x4(4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4); +} diff --git a/Test/hlsl.intrinsics.negative.vert b/Test/hlsl.intrinsics.negative.vert new file mode 100644 index 00000000..ee2a29d5 --- /dev/null +++ b/Test/hlsl.intrinsics.negative.vert @@ -0,0 +1,196 @@ +float VertexShaderFunction(float inF0, float inF1, float inF2, int inI0) +{ + // AllMemoryBarrier(); // invalid in fragment stage TODO: parser currently crashes on empty arg list + // AllMemoryBarrierWithGroupSync(); // invalid in fragment stage TODO: parser currently crashes on empty arg list + asdouble(inF0, inF1); // expected error: only integer inputs + CheckAccessFullyMapped(3.0); // expected error: only valid on integers + CheckAccessFullyMapped(3); // expected error: only valid in pixel & compute stages + clip(inF0); // expected error: only valid in pixel & compute stages + countbits(inF0); // expected error: only integer inputs + cross(inF0, inF1); // expected error: only on float3 inputs + D3DCOLORtoUBYTE4(inF0); // expected error: only on float4 inputs + // DeviceMemoryBarrier(); // TODO: expected error: only valid in pixel & compute stages + // DeviceMemoryBarrierWithGroupSync(); // TODO: expected error: only valid in compute stage + ddx(inF0); // expected error: only valid in pixel & compute stages + ddx_coarse(inF0); // expected error: only valid in pixel & compute stages + ddx_fine(inF0); // expected error: only valid in pixel & compute stages + ddy(inF0); // expected error: only valid in pixel & compute stages + ddy_coarse(inF0); // expected error: only valid in pixel & compute stages + ddy_fine(inF0); // expected error: only valid in pixel & compute stages + determinant(inF0); // expected error: only valid on mats + EvaluateAttributeAtCentroid(inF0); // expected error: only valid in pixel stage + EvaluateAttributeAtSample(inF0, 2); // expected error: only valid in pixel stage + EvaluateAttributeSnapped(inF0, int2(2)); // expected error: only valid in pixel stage + f16tof32(inF0); // expected error: only integer inputs + firstbithigh(inF0); // expected error: only integer inputs + firstbitlow(inF0); // expected error: only integer inputs + fma(inF0, inF1, inF2); // expected error: only double inputs + // InterlockedAdd(inI0, inI0, 3); // expected error: last parameter is out TODO: accepted even though marked as out in proto generator + // InterlockedAnd(inI0, inI0, 3); // expected error: last parameter is out TODO: accepted even though marked as out i // InterlockedMax(inI0, inI0, 3); // expected error: last parameter is out TODO: accepted even though marked as out in proto generator + // InterlockedMin(inI0, inI0, 3); // expected error: last parameter is out TODO: accepted even though marked as out in proto generator + // InterlockedOor(inI0, inI0, 3); // expected error: last parameter is out TODO: accepted even though marked as out in proto generator + // InterlockedXor(inI0, inI0, 3); // expected error: last parameter is out TODO: accepted even though marked as out in proto generator + // GroupMemoryBarrier(); // TODO: expected error: only valid in compute stage + // GroupMemoryBarrierWithGroupSync(); // TODO: expected error: only valid in compute stage + length(inF0); // expect error: invalid on scalars + msad4(inF0, float2(0), float4(0)); // expected error: only integer inputs + normalize(inF0); // expect error: invalid on scalars + reflect(inF0, inF1); // expect error: invalid on scalars + refract(inF0, inF1, inF2); // expect error: invalid on scalars + refract(float2(0), float2(0), float2(0)); // expected error: last parameter only scalar + reversebits(inF0); // expected error: only integer inputs + transpose(inF0); // expect error: only valid on mats + + // TODO: texture intrinsics, when we can declare samplers. + + return 0.0; +} + +float1 VertexShaderFunction(float1 inF0, float1 inF1, float1 inF2, int1 inI0) +{ + // TODO: ... add when float1 prototypes are generated + + GetRenderTargetSamplePosition(inF0); // expected error: only integer inputs + + return 0.0; +} + +float2 VertexShaderFunction(float2 inF0, float2 inF1, float2 inF2, int2 inI0) +{ + asdouble(inF0, inF1); // expected error: only integer inputs + CheckAccessFullyMapped(inF0); // expect error: only valid on scalars + countbits(inF0); // expected error: only integer inputs + cross(inF0, inF1); // expected error: only on float3 inputs + D3DCOLORtoUBYTE4(inF0); // expected error: only on float4 inputs + ddx(inF0); // only valid in pixel & compute stages + ddx_coarse(inF0); // only valid in pixel & compute stages + ddx_fine(inF0); // only valid in pixel & compute stages + ddy(inF0); // only valid in pixel & compute stages + ddy_coarse(inF0); // only valid in pixel & compute stages + ddy_fine(inF0); // only valid in pixel & compute stages + determinant(inF0); // expect error: only valid on mats + EvaluateAttributeAtCentroid(inF0); // expected error: only valid in pixel stage + EvaluateAttributeAtSample(inF0, 2); // expected error: only valid in pixel stage + EvaluateAttributeSnapped(inF0, int2(2)); // expected error: only valid in pixel stage + f16tof32(inF0); // expected error: only integer inputs + firstbithigh(inF0); // expected error: only integer inputs + firstbitlow(inF0); // expected error: only integer inputs + fma(inF0, inF1, inF2); // expected error: only double inputs + noise(inF0); // expected error: only valid in pixel stage + reversebits(inF0); // expected error: only integer inputs + transpose(inF0); // expect error: only valid on mats + + // TODO: texture intrinsics, when we can declare samplers. + + return float2(1,2); +} + +float3 VertexShaderFunction(float3 inF0, float3 inF1, float3 inF2, int3 inI0) +{ + CheckAccessFullyMapped(inF0); // expect error: only valid on scalars + countbits(inF0); // expected error: only integer inputs + ddx(inF0); // only valid in pixel & compute stages + ddx_coarse(inF0); // only valid in pixel & compute stages + ddx_fine(inF0); // only valid in pixel & compute stages + ddy(inF0); // only valid in pixel & compute stages + ddy_coarse(inF0); // only valid in pixel & compute stages + ddy_fine(inF0); // only valid in pixel & compute stages + D3DCOLORtoUBYTE4(inF0); // expected error: only on float4 inputs + determinant(inF0); // expect error: only valid on mats + EvaluateAttributeAtCentroid(inF0); // expected error: only valid in pixel stage + EvaluateAttributeAtSample(inF0, 2); // expected error: only valid in pixel stage + EvaluateAttributeSnapped(inF0, int2(2)); // expected error: only valid in pixel stage + f16tof32(inF0); // expected error: only integer inputs + firstbithigh(inF0); // expected error: only integer inputs + firstbitlow(inF0); // expected error: only integer inputs + fma(inF0, inF1, inF2); // expected error: only double inputs + noise(inF0); // expected error: only valid in pixel stage + reversebits(inF0); // expected error: only integer inputs + transpose(inF0); // expect error: only valid on mats + + // TODO: texture intrinsics, when we can declare samplers. + + return float3(1,2,3); +} + +float4 VertexShaderFunction(float4 inF0, float4 inF1, float4 inF2, int4 inI0) +{ + CheckAccessFullyMapped(inF0); // expect error: only valid on scalars + countbits(inF0); // expected error: only integer inputs + cross(inF0, inF1); // expected error: only on float3 inputs + determinant(inF0); // expect error: only valid on mats + ddx(inF0); // only valid in pixel & compute stages + ddx_coarse(inF0); // only valid in pixel & compute stages + ddx_fine(inF0); // only valid in pixel & compute stages + ddy(inF0); // only valid in pixel & compute stages + ddy_coarse(inF0); // only valid in pixel & compute stages + ddy_fine(inF0); // only valid in pixel & compute stages + EvaluateAttributeAtCentroid(inF0); // expected error: only valid in pixel stage + EvaluateAttributeAtSample(inF0, 2); // expected error: only valid in pixel stage + EvaluateAttributeSnapped(inF0, int2(2)); // expected error: only valid in pixel stage + f16tof32(inF0); // expected error: only integer inputs + firstbithigh(inF0); // expected error: only integer inputs + firstbitlow(inF0); // expected error: only integer inputs + fma(inF0, inF1, inF2); // expected error: only double inputs + noise(inF0); // expected error: only valid in pixel stage + reversebits(inF0); // expected error: only integer inputs + transpose(inF0); // expect error: only valid on mats + + // TODO: texture intrinsics, when we can declare samplers. + + return float4(1,2,3,4); +} + +// TODO: FXC doesn't accept this with (), but glslang doesn't accept it without. +#define MATFNS() \ + countbits(inF0); \ + cross(inF0, inF1); \ + D3DCOLORtoUBYTE4(inF0); \ + ddx(inF0); \ + ddx_coarse(inF0); \ + ddx_fine(inF0); \ + ddy(inF0); \ + ddy_coarse(inF0); \ + ddy_fine(inF0); \ + EvaluateAttributeAtCentroid(inF0); \ + EvaluateAttributeAtSample(inF0, 2); \ + EvaluateAttributeSnapped(inF0, int2(2)); \ + f16tof32(inF0); \ + firstbithigh(inF0); \ + firstbitlow(inF0); \ + fma(inF0, inF1, inF2); \ + noise(inF0); \ + reversebits(inF0); \ + length(inF0); \ + noise(inF0); \ + normalize(inF0); \ + reflect(inF0, inF1); \ + refract(inF0, inF1, 1.0); \ + reversebits(inF0); \ + + +// TODO: turn on non-square matrix tests when protos are available. + +float2x2 VertexShaderFunction(float2x2 inF0, float2x2 inF1, float2x2 inF2) +{ + // TODO: FXC doesn't accept this with (), but glslang doesn't accept it without. + MATFNS() + + return float2x2(2,2,2,2); +} + +float3x3 VertexShaderFunction(float3x3 inF0, float3x3 inF1, float3x3 inF2) +{ + // TODO: FXC doesn't accept this with (), but glslang doesn't accept it without. + MATFNS() + + return float3x3(3,3,3,3,3,3,3,3,3); +} + +float4x4 VertexShaderFunction(float4x4 inF0, float4x4 inF1, float4x4 inF2) +{ + // TODO: FXC doesn't accept this with (), but glslang doesn't accept it without. + MATFNS() + + return float4x4(4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4); +} diff --git a/gtests/Hlsl.FromFile.cpp b/gtests/Hlsl.FromFile.cpp index b5a38866..8f02c6a9 100644 --- a/gtests/Hlsl.FromFile.cpp +++ b/gtests/Hlsl.FromFile.cpp @@ -75,13 +75,15 @@ INSTANTIATE_TEST_CASE_P( {"hlsl.assoc.frag", "PixelShaderFunction"}, {"hlsl.float1.frag", "PixelShaderFunction"}, {"hlsl.float4.frag", "PixelShaderFunction"}, + {"hlsl.intrinsics.frag", "PixelShaderFunction"}, + {"hlsl.intrinsics.negative.frag", "PixelShaderFunction"}, + {"hlsl.intrinsics.negative.vert", "VertexShaderFunction"}, + {"hlsl.intrinsics.vert", "VertexShaderFunction"}, {"hlsl.matType.frag", "PixelShaderFunction"}, {"hlsl.max.frag", "PixelShaderFunction"}, {"hlsl.precedence.frag", "PixelShaderFunction"}, {"hlsl.precedence2.frag", "PixelShaderFunction"}, {"hlsl.sin.frag", "PixelShaderFunction"}, - {"hlsl.intrinsics.frag", "PixelShaderFunction"}, - {"hlsl.intrinsics.vert", "VertexShaderFunction"}, }), FileNameAsCustomTestSuffix ); From 1cc1a2813eec42e60c5b4fce41da09bc740c9141 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Fri, 3 Jun 2016 16:55:49 -0600 Subject: [PATCH 136/140] HLSL: 1) Implement lookahead buffers/stacks for token advance/recede, 2) use it for cast operation. The grammar now accepts type casts, like "(int)x", but that has to be disambiguated from "(a + b)", needed deeper lookahead and backing up than what existed so far. --- Test/baseResults/hlsl.cast.frag.out | 86 +++++++++++++++++++++++++++++ Test/hlsl.cast.frag | 4 ++ gtests/Hlsl.FromFile.cpp | 1 + hlsl/hlslGrammar.cpp | 42 +++++++++++++- hlsl/hlslScanContext.h | 2 +- hlsl/hlslTokenStream.cpp | 37 ++++++++++++- hlsl/hlslTokenStream.h | 26 +++++++-- 7 files changed, 190 insertions(+), 8 deletions(-) create mode 100755 Test/baseResults/hlsl.cast.frag.out create mode 100644 Test/hlsl.cast.frag diff --git a/Test/baseResults/hlsl.cast.frag.out b/Test/baseResults/hlsl.cast.frag.out new file mode 100755 index 00000000..1e689788 --- /dev/null +++ b/Test/baseResults/hlsl.cast.frag.out @@ -0,0 +1,86 @@ +hlsl.cast.frag +Shader version: 450 +gl_FragCoord origin is upper left +0:? Sequence +0:5 Function Definition: PixelShaderFunction(vf4; (temp 4-component vector of float) +0:2 Function Parameters: +0:2 'input' (temp 4-component vector of float) +0:? Sequence +0:3 Branch: Return with expression +0:3 add (temp 4-component vector of float) +0:3 add (temp 4-component vector of float) +0:3 Construct vec4 (temp 4-component vector of float) +0:3 'input' (temp 4-component vector of float) +0:3 Convert int to float (temp 4-component vector of float) +0:3 Convert float to int (temp 4-component vector of int) +0:3 'input' (temp 4-component vector of float) +0:3 Constant: +0:3 1.198000 +0:3 1.198000 +0:3 1.198000 +0:3 1.198000 +0:? Linker Objects + + +Linked fragment stage: + + +Shader version: 450 +gl_FragCoord origin is upper left +0:? Sequence +0:5 Function Definition: PixelShaderFunction(vf4; (temp 4-component vector of float) +0:2 Function Parameters: +0:2 'input' (temp 4-component vector of float) +0:? Sequence +0:3 Branch: Return with expression +0:3 add (temp 4-component vector of float) +0:3 add (temp 4-component vector of float) +0:3 Construct vec4 (temp 4-component vector of float) +0:3 'input' (temp 4-component vector of float) +0:3 Convert int to float (temp 4-component vector of float) +0:3 Convert float to int (temp 4-component vector of int) +0:3 'input' (temp 4-component vector of float) +0:3 Constant: +0:3 1.198000 +0:3 1.198000 +0:3 1.198000 +0:3 1.198000 +0:? Linker Objects + +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 26 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "PixelShaderFunction" + ExecutionMode 4 OriginUpperLeft + Source HLSL 450 + Name 4 "PixelShaderFunction" + Name 9 "input" + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypePointer Function 7(fvec4) + 17: TypeInt 32 1 + 18: TypeVector 17(int) 4 + 22: 6(float) Constant 1067014160 + 23: 7(fvec4) ConstantComposite 22 22 22 22 +4(PixelShaderFunction): 2 Function None 3 + 5: Label + 9(input): 8(ptr) Variable Function + 10: 7(fvec4) Load 9(input) + 11: 6(float) CompositeExtract 10 0 + 12: 6(float) CompositeExtract 10 1 + 13: 6(float) CompositeExtract 10 2 + 14: 6(float) CompositeExtract 10 3 + 15: 7(fvec4) CompositeConstruct 11 12 13 14 + 16: 7(fvec4) Load 9(input) + 19: 18(ivec4) ConvertFToS 16 + 20: 7(fvec4) ConvertSToF 19 + 21: 7(fvec4) FAdd 15 20 + 24: 7(fvec4) FAdd 21 23 + ReturnValue 24 + FunctionEnd diff --git a/Test/hlsl.cast.frag b/Test/hlsl.cast.frag new file mode 100644 index 00000000..c8dc8212 --- /dev/null +++ b/Test/hlsl.cast.frag @@ -0,0 +1,4 @@ +float4 PixelShaderFunction(float4 input) : COLOR0 +{ + return (float4)input + (int4)input + (float4)1.198; +} diff --git a/gtests/Hlsl.FromFile.cpp b/gtests/Hlsl.FromFile.cpp index 8f02c6a9..9c0061ed 100644 --- a/gtests/Hlsl.FromFile.cpp +++ b/gtests/Hlsl.FromFile.cpp @@ -73,6 +73,7 @@ INSTANTIATE_TEST_CASE_P( ToSpirv, HlslCompileTest, ::testing::ValuesIn(std::vector{ {"hlsl.assoc.frag", "PixelShaderFunction"}, + {"hlsl.cast.frag", "PixelShaderFunction"}, {"hlsl.float1.frag", "PixelShaderFunction"}, {"hlsl.float4.frag", "PixelShaderFunction"}, {"hlsl.intrinsics.frag", "PixelShaderFunction"}, diff --git a/hlsl/hlslGrammar.cpp b/hlsl/hlslGrammar.cpp index a6387b74..ddb70788 100755 --- a/hlsl/hlslGrammar.cpp +++ b/hlsl/hlslGrammar.cpp @@ -602,7 +602,8 @@ bool HlslGrammar::acceptBinaryExpression(TIntermTyped*& node, PrecedenceLevel pr } // unary_expression -// : + unary_expression +// : (type) unary_expression +// | + unary_expression // | - unary_expression // | ! unary_expression // | ~ unary_expression @@ -612,9 +613,46 @@ bool HlslGrammar::acceptBinaryExpression(TIntermTyped*& node, PrecedenceLevel pr // bool HlslGrammar::acceptUnaryExpression(TIntermTyped*& node) { + // (type) unary_expression + // Have to look two steps ahead, because this could be, e.g., a + // postfix_expression instead, since that also starts with at "(". + if (acceptTokenClass(EHTokLeftParen)) { + TType castType; + if (acceptType(castType)) { + if (! acceptTokenClass(EHTokRightParen)) { + expected("right parenthesis"); + return false; + } + + // We've matched "(type)" now, get the expression to cast + TSourceLoc loc = token.loc; + if (! acceptUnaryExpression(node)) + return false; + + // Hook it up like a constructor + TFunction* constructorFunction = parseContext.handleConstructorCall(loc, castType); + if (constructorFunction == nullptr) { + expected("type that can be constructed"); + return false; + } + TIntermTyped* arguments = nullptr; + parseContext.handleFunctionArgument(constructorFunction, arguments, node); + node = parseContext.handleFunctionCall(loc, constructorFunction, arguments); + + return true; + } else { + // This isn't a type cast, but it still started "(", so if it is a + // unary expression, it can only be a postfix_expression, so try that. + // Back it up first. + recedeToken(); + return acceptPostfixExpression(node); + } + } + + // peek for "op unary_expression" TOperator unaryOp = HlslOpMap::preUnary(peek()); - // postfix_expression + // postfix_expression (if no unary operator) if (unaryOp == EOpNull) return acceptPostfixExpression(node); diff --git a/hlsl/hlslScanContext.h b/hlsl/hlslScanContext.h index 04f24383..d761e3a8 100755 --- a/hlsl/hlslScanContext.h +++ b/hlsl/hlslScanContext.h @@ -57,7 +57,7 @@ struct HlslToken { HlslToken() : isType(false), string(nullptr), symbol(nullptr) { loc.init(); } TSourceLoc loc; // location of token in the source EHlslTokenClass tokenClass; // what kind of token it is - bool isType; // true if the token represents a user type + bool isType; // true if the token represents a type union { // what data the token holds glslang::TString *string; // for identifiers int i; // for literals diff --git a/hlsl/hlslTokenStream.cpp b/hlsl/hlslTokenStream.cpp index cfc1101b..47f779a8 100755 --- a/hlsl/hlslTokenStream.cpp +++ b/hlsl/hlslTokenStream.cpp @@ -37,10 +37,45 @@ namespace glslang { +void HlslTokenStream::pushPreToken(const HlslToken& tok) +{ + assert(preTokenStackSize == 0); + preTokenStack = tok; + ++preTokenStackSize; +} + +HlslToken HlslTokenStream::popPreToken() +{ + assert(preTokenStackSize == 1); + --preTokenStackSize; + + return preTokenStack; +} + +void HlslTokenStream::pushTokenBuffer(const HlslToken& tok) +{ + tokenBuffer = tok; +} + +HlslToken HlslTokenStream::popTokenBuffer() +{ + return tokenBuffer; +} + // Load 'token' with the next token in the stream of tokens. void HlslTokenStream::advanceToken() { - scanner.tokenize(token); + pushTokenBuffer(token); + if (preTokenStackSize > 0) + token = popPreToken(); + else + scanner.tokenize(token); +} + +void HlslTokenStream::recedeToken() +{ + pushPreToken(token); + token = popTokenBuffer(); } // Return the current token class. diff --git a/hlsl/hlslTokenStream.h b/hlsl/hlslTokenStream.h index 9139df07..83365c4c 100755 --- a/hlsl/hlslTokenStream.h +++ b/hlsl/hlslTokenStream.h @@ -43,20 +43,38 @@ namespace glslang { class HlslTokenStream { public: explicit HlslTokenStream(HlslScanContext& scanner) - : scanner(scanner) { } + : scanner(scanner), preTokenStackSize(0) { } virtual ~HlslTokenStream() { } public: void advanceToken(); + void recedeToken(); bool acceptTokenClass(EHlslTokenClass); EHlslTokenClass peek() const; bool peekTokenClass(EHlslTokenClass) const; protected: - HlslToken token; // the current token we are processing - + HlslToken token; // the token we are currently looking at, but have not yet accepted + private: - HlslScanContext& scanner; // lexical scanner, to get next token + HlslScanContext& scanner; // lexical scanner, to get next token + + // Previously scanned tokens, returned for future advances, + // so logically in front of the token stream. + // Is logically a stack; needs last in last out semantics. + // Currently implemented as a stack of size 1. + HlslToken preTokenStack; + int preTokenStackSize; + void pushPreToken(const HlslToken&); + HlslToken popPreToken(); + + // Previously scanned tokens, not yet return for future advances, + // but available for that. + // Is logically a fifo for normal advances, and a stack for recession. + // Currently implemented with an intrinsic size of 1. + HlslToken tokenBuffer; + void pushTokenBuffer(const HlslToken&); + HlslToken popTokenBuffer(); }; } // end namespace glslang From 21472aee755d4a6d234488ecc606ffe2ace4673b Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Sat, 4 Jun 2016 11:46:33 -0600 Subject: [PATCH 137/140] HLSL: Finish skeletan of the "statement" grammar. --- hlsl/hlslGrammar.cpp | 186 +++++++++++++++++++++++++++++++++++-------- hlsl/hlslGrammar.h | 9 ++- 2 files changed, 163 insertions(+), 32 deletions(-) diff --git a/hlsl/hlslGrammar.cpp b/hlsl/hlslGrammar.cpp index ddb70788..31e67d36 100755 --- a/hlsl/hlslGrammar.cpp +++ b/hlsl/hlslGrammar.cpp @@ -472,7 +472,7 @@ bool HlslGrammar::acceptFunctionDefinition(TFunction& function, TIntermNode*& no node = parseContext.handleFunctionDefinition(token.loc, *functionDeclarator); // compound_statement - TIntermAggregate* functionBody = nullptr; + TIntermNode* functionBody = nullptr; if (acceptCompoundStatement(functionBody)) { node = intermediate.growAggregate(node, functionBody); intermediate.setAggregateOperator(node, EOpFunction, functionDeclarator->getType(), token.loc); @@ -690,8 +690,10 @@ bool HlslGrammar::acceptPostfixExpression(TIntermTyped*& node) // idToken will pick up either a variable or a function name in a function call HlslToken idToken; - // LEFT_PAREN expression RIGHT_PAREN + // Find something before the postfix operations, as they can't operate + // on nothing. So, no "return true", they fall through, only "return false". if (acceptTokenClass(EHTokLeftParen)) { + // LEFT_PAREN expression RIGHT_PAREN if (! acceptExpression(node)) { expected("expression"); return false; @@ -714,8 +716,12 @@ bool HlslGrammar::acceptPostfixExpression(TIntermTyped*& node) expected("function call arguments"); return false; } + } else { + // nothing found, can't post operate + return false; } + // Something was found, chain as many postfix operations as exist. do { TSourceLoc loc = token.loc; TOperator postOp = HlslOpMap::postUnary(peek()); @@ -867,8 +873,10 @@ bool HlslGrammar::acceptLiteral(TIntermTyped*& node) // compound_statement // : LEFT_CURLY statement statement ... RIGHT_CURLY // -bool HlslGrammar::acceptCompoundStatement(TIntermAggregate*& compoundStatement) +bool HlslGrammar::acceptCompoundStatement(TIntermNode*& retStatement) { + TIntermAggregate* compoundStatement = nullptr; + // LEFT_CURLY if (! acceptTokenClass(EHTokLeftBrace)) return false; @@ -882,54 +890,170 @@ bool HlslGrammar::acceptCompoundStatement(TIntermAggregate*& compoundStatement) if (compoundStatement) compoundStatement->setOperator(EOpSequence); + retStatement = compoundStatement; + // RIGHT_CURLY return acceptTokenClass(EHTokRightBrace); } // statement +// : attributes attributed_statement +// +// attributed_statement // : compound_statement -// | return SEMICOLON -// | return expression SEMICOLON +// | SEMICOLON // | expression SEMICOLON +// | declaration_statement +// | selection_statement +// | switch_statement +// | case_label +// | iteration_statement +// | jump_statement // bool HlslGrammar::acceptStatement(TIntermNode*& statement) { - // compound_statement - TIntermAggregate* compoundStatement = nullptr; - if (acceptCompoundStatement(compoundStatement)) { - statement = compoundStatement; - return true; - } + statement = nullptr; - // RETURN - if (acceptTokenClass(EHTokReturn)) { - // expression - TIntermTyped* node; - if (acceptExpression(node)) { - // hook it up - statement = intermediate.addBranch(EOpReturn, node, token.loc); - } else - statement = intermediate.addBranch(EOpReturn, token.loc); + // attributes + acceptAttributes(); - // SEMICOLON - if (! acceptTokenClass(EHTokSemicolon)) - return false; + // attributed_statement + switch (peek()) { + case EHTokLeftBrace: + return acceptCompoundStatement(statement); - return true; - } + case EHTokIf: + return acceptSelectionStatement(statement); - // expression - TIntermTyped* node; - if (acceptExpression(node)) - statement = node; + case EHTokSwitch: + return acceptSwitchStatement(statement); - // SEMICOLON - if (! acceptTokenClass(EHTokSemicolon)) + case EHTokFor: + case EHTokDo: + case EHTokWhile: + return acceptIterationStatement(statement); + + case EHTokContinue: + case EHTokBreak: + case EHTokDiscard: + case EHTokReturn: + return acceptJumpStatement(statement); + + case EHTokCase: + return acceptCaseLabel(statement); + + case EHTokSemicolon: + return acceptTokenClass(EHTokSemicolon); + + case EHTokRightBrace: + // Performance: not strictly necessary, but stops a bunch of hunting early, + // and is how sequences of statements end. return false; + default: + { + // declaration + if (acceptDeclaration(statement)) + return true; + + // expression + TIntermTyped* node; + if (acceptExpression(node)) + statement = node; + else + return false; + + // SEMICOLON (following an expression) + if (! acceptTokenClass(EHTokSemicolon)) { + expected("semicolon"); + return false; + } + } + } + return true; } +// attributes +// : list of zero or more of: LEFT_BRACKET attribute RIGHT_BRACKET +// +// attribute: +// : UNROLL +// | UNROLL LEFT_PAREN literal RIGHT_PAREN +// | FASTOPT +// | ALLOW_UAV_CONDITION +// | BRANCH +// | FLATTEN +// | FORCECASE +// | CALL +// +void HlslGrammar::acceptAttributes() +{ + // TODO +} + +bool HlslGrammar::acceptSelectionStatement(TIntermNode*& statement) +{ + return false; +} + +bool HlslGrammar::acceptSwitchStatement(TIntermNode*& statement) +{ + return false; +} + +bool HlslGrammar::acceptIterationStatement(TIntermNode*& statement) +{ + return false; +} + +// jump_statement +// : CONTINUE SEMICOLON +// | BREAK SEMICOLON +// | DISCARD SEMICOLON +// | RETURN SEMICOLON +// | RETURN expression SEMICOLON +// +bool HlslGrammar::acceptJumpStatement(TIntermNode*& statement) +{ + switch (peek()) { + case EHTokContinue: + case EHTokBreak: + case EHTokDiscard: + // TODO + return false; + + case EHTokReturn: + // return + if (acceptTokenClass(EHTokReturn)) { + // expression + TIntermTyped* node; + if (acceptExpression(node)) { + // hook it up + statement = intermediate.addBranch(EOpReturn, node, token.loc); + } else + statement = intermediate.addBranch(EOpReturn, token.loc); + + // SEMICOLON + if (! acceptTokenClass(EHTokSemicolon)) { + expected("semicolon"); + return false; + } + + return true; + } + + default: + return false; + } +} + + +bool HlslGrammar::acceptCaseLabel(TIntermNode*& statement) +{ + return false; +} + // COLON semantic bool HlslGrammar::acceptSemantic() { diff --git a/hlsl/hlslGrammar.h b/hlsl/hlslGrammar.h index d834aa93..7d337fde 100755 --- a/hlsl/hlslGrammar.h +++ b/hlsl/hlslGrammar.h @@ -73,8 +73,15 @@ namespace glslang { bool acceptFunctionCall(HlslToken, TIntermTyped*&); bool acceptArguments(TFunction*, TIntermTyped*&); bool acceptLiteral(TIntermTyped*&); - bool acceptCompoundStatement(TIntermAggregate*&); + bool acceptCompoundStatement(TIntermNode*&); bool acceptStatement(TIntermNode*&); + void acceptAttributes(); + bool acceptSelectionStatement(TIntermNode*&); + bool acceptSwitchStatement(TIntermNode*&); + bool acceptIterationStatement(TIntermNode*&); + bool acceptJumpStatement(TIntermNode*&); + bool acceptCaseLabel(TIntermNode*&); + bool acceptSemantic(); HlslParseContext& parseContext; // state of parsing and helper functions for building the intermediate From 0d2b6de45b858524dbd09aac631ac94db120c4a7 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Sun, 5 Jun 2016 11:23:11 -0600 Subject: [PATCH 138/140] HLSL: Attribute grammar and if-else grammar/productions. --- Test/baseResults/hlsl.attribute.frag.out | 57 ++++++ Test/baseResults/hlsl.if.frag.out | 223 +++++++++++++++++++++++ Test/hlsl.attribute.frag | 13 ++ Test/hlsl.if.frag | 28 +++ gtests/Hlsl.FromFile.cpp | 2 + hlsl/hlslGrammar.cpp | 133 +++++++++++++- hlsl/hlslGrammar.h | 3 + hlsl/hlslParseHelper.h | 5 + 8 files changed, 456 insertions(+), 8 deletions(-) create mode 100755 Test/baseResults/hlsl.attribute.frag.out create mode 100755 Test/baseResults/hlsl.if.frag.out create mode 100644 Test/hlsl.attribute.frag create mode 100644 Test/hlsl.if.frag diff --git a/Test/baseResults/hlsl.attribute.frag.out b/Test/baseResults/hlsl.attribute.frag.out new file mode 100755 index 00000000..6ee4a246 --- /dev/null +++ b/Test/baseResults/hlsl.attribute.frag.out @@ -0,0 +1,57 @@ +hlsl.attribute.frag +Shader version: 450 +gl_FragCoord origin is upper left +0:? Sequence +0:14 Function Definition: PixelShaderFunction(vf4; (temp 4-component vector of float) +0:2 Function Parameters: +0:2 'input' (temp 4-component vector of float) +0:? Sequence +0:11 Test condition and select (temp void) +0:11 Condition +0:11 Constant: +0:11 0 (const int) +0:11 true case is null +0:? Linker Objects + + +Linked fragment stage: + + +Shader version: 450 +gl_FragCoord origin is upper left +0:? Sequence +0:14 Function Definition: PixelShaderFunction(vf4; (temp 4-component vector of float) +0:2 Function Parameters: +0:2 'input' (temp 4-component vector of float) +0:? Sequence +0:11 Test condition and select (temp void) +0:11 Condition +0:11 Constant: +0:11 0 (const int) +0:11 true case is null +0:? Linker Objects + +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 10 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "PixelShaderFunction" + ExecutionMode 4 OriginUpperLeft + Source HLSL 450 + Name 4 "PixelShaderFunction" + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 1 + 7: 6(int) Constant 0 +4(PixelShaderFunction): 2 Function None 3 + 5: Label + SelectionMerge 9 None + BranchConditional 7 8 9 + 8: Label + Branch 9 + 9: Label + Return + FunctionEnd diff --git a/Test/baseResults/hlsl.if.frag.out b/Test/baseResults/hlsl.if.frag.out new file mode 100755 index 00000000..8908279b --- /dev/null +++ b/Test/baseResults/hlsl.if.frag.out @@ -0,0 +1,223 @@ +hlsl.if.frag +Shader version: 450 +gl_FragCoord origin is upper left +0:? Sequence +0:29 Function Definition: PixelShaderFunction(vf4; (temp 4-component vector of float) +0:2 Function Parameters: +0:2 'input' (temp 4-component vector of float) +0:? Sequence +0:3 Test condition and select (temp void) +0:3 Condition +0:3 Compare Equal (temp bool) +0:3 'input' (temp 4-component vector of float) +0:3 'input' (temp 4-component vector of float) +0:3 true case +0:4 Branch: Return with expression +0:4 'input' (temp 4-component vector of float) +0:6 Test condition and select (temp void) +0:6 Condition +0:6 Compare Equal (temp bool) +0:6 'input' (temp 4-component vector of float) +0:6 'input' (temp 4-component vector of float) +0:6 true case +0:7 Branch: Return with expression +0:7 'input' (temp 4-component vector of float) +0:6 false case +0:9 Branch: Return with expression +0:9 Negate value (temp 4-component vector of float) +0:9 'input' (temp 4-component vector of float) +0:11 Test condition and select (temp void) +0:11 Condition +0:11 Compare Equal (temp bool) +0:11 'input' (temp 4-component vector of float) +0:11 'input' (temp 4-component vector of float) +0:11 true case is null +0:14 Test condition and select (temp void) +0:14 Condition +0:14 Compare Equal (temp bool) +0:14 'input' (temp 4-component vector of float) +0:14 'input' (temp 4-component vector of float) +0:14 true case is null +0:19 Test condition and select (temp void) +0:19 Condition +0:19 Compare Equal (temp bool) +0:19 'input' (temp 4-component vector of float) +0:19 'input' (temp 4-component vector of float) +0:19 true case +0:? Sequence +0:20 Branch: Return with expression +0:20 'input' (temp 4-component vector of float) +0:23 Test condition and select (temp void) +0:23 Condition +0:23 Compare Equal (temp bool) +0:23 'input' (temp 4-component vector of float) +0:23 'input' (temp 4-component vector of float) +0:23 true case +0:? Sequence +0:24 Branch: Return with expression +0:24 'input' (temp 4-component vector of float) +0:23 false case +0:? Sequence +0:26 Branch: Return with expression +0:26 Negate value (temp 4-component vector of float) +0:26 'input' (temp 4-component vector of float) +0:? Linker Objects + + +Linked fragment stage: + + +Shader version: 450 +gl_FragCoord origin is upper left +0:? Sequence +0:29 Function Definition: PixelShaderFunction(vf4; (temp 4-component vector of float) +0:2 Function Parameters: +0:2 'input' (temp 4-component vector of float) +0:? Sequence +0:3 Test condition and select (temp void) +0:3 Condition +0:3 Compare Equal (temp bool) +0:3 'input' (temp 4-component vector of float) +0:3 'input' (temp 4-component vector of float) +0:3 true case +0:4 Branch: Return with expression +0:4 'input' (temp 4-component vector of float) +0:6 Test condition and select (temp void) +0:6 Condition +0:6 Compare Equal (temp bool) +0:6 'input' (temp 4-component vector of float) +0:6 'input' (temp 4-component vector of float) +0:6 true case +0:7 Branch: Return with expression +0:7 'input' (temp 4-component vector of float) +0:6 false case +0:9 Branch: Return with expression +0:9 Negate value (temp 4-component vector of float) +0:9 'input' (temp 4-component vector of float) +0:11 Test condition and select (temp void) +0:11 Condition +0:11 Compare Equal (temp bool) +0:11 'input' (temp 4-component vector of float) +0:11 'input' (temp 4-component vector of float) +0:11 true case is null +0:14 Test condition and select (temp void) +0:14 Condition +0:14 Compare Equal (temp bool) +0:14 'input' (temp 4-component vector of float) +0:14 'input' (temp 4-component vector of float) +0:14 true case is null +0:19 Test condition and select (temp void) +0:19 Condition +0:19 Compare Equal (temp bool) +0:19 'input' (temp 4-component vector of float) +0:19 'input' (temp 4-component vector of float) +0:19 true case +0:? Sequence +0:20 Branch: Return with expression +0:20 'input' (temp 4-component vector of float) +0:23 Test condition and select (temp void) +0:23 Condition +0:23 Compare Equal (temp bool) +0:23 'input' (temp 4-component vector of float) +0:23 'input' (temp 4-component vector of float) +0:23 true case +0:? Sequence +0:24 Branch: Return with expression +0:24 'input' (temp 4-component vector of float) +0:23 false case +0:? Sequence +0:26 Branch: Return with expression +0:26 Negate value (temp 4-component vector of float) +0:26 'input' (temp 4-component vector of float) +0:? Linker Objects + +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 64 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "PixelShaderFunction" + ExecutionMode 4 OriginUpperLeft + Source HLSL 450 + Name 4 "PixelShaderFunction" + Name 9 "input" + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypePointer Function 7(fvec4) + 12: TypeBool + 13: TypeVector 12(bool) 4 +4(PixelShaderFunction): 2 Function None 3 + 5: Label + 9(input): 8(ptr) Variable Function + 10: 7(fvec4) Load 9(input) + 11: 7(fvec4) Load 9(input) + 14: 13(bvec4) FOrdEqual 10 11 + 15: 12(bool) All 14 + SelectionMerge 17 None + BranchConditional 15 16 17 + 16: Label + 18: 7(fvec4) Load 9(input) + ReturnValue 18 + 17: Label + 20: 7(fvec4) Load 9(input) + 21: 7(fvec4) Load 9(input) + 22: 13(bvec4) FOrdEqual 20 21 + 23: 12(bool) All 22 + SelectionMerge 25 None + BranchConditional 23 24 28 + 24: Label + 26: 7(fvec4) Load 9(input) + ReturnValue 26 + 28: Label + 29: 7(fvec4) Load 9(input) + 30: 7(fvec4) FNegate 29 + ReturnValue 30 + 25: Label + 32: 7(fvec4) Load 9(input) + 33: 7(fvec4) Load 9(input) + 34: 13(bvec4) FOrdEqual 32 33 + 35: 12(bool) All 34 + SelectionMerge 37 None + BranchConditional 35 36 37 + 36: Label + Branch 37 + 37: Label + 38: 7(fvec4) Load 9(input) + 39: 7(fvec4) Load 9(input) + 40: 13(bvec4) FOrdEqual 38 39 + 41: 12(bool) All 40 + SelectionMerge 43 None + BranchConditional 41 42 43 + 42: Label + Branch 43 + 43: Label + 44: 7(fvec4) Load 9(input) + 45: 7(fvec4) Load 9(input) + 46: 13(bvec4) FOrdEqual 44 45 + 47: 12(bool) All 46 + SelectionMerge 49 None + BranchConditional 47 48 49 + 48: Label + 50: 7(fvec4) Load 9(input) + ReturnValue 50 + 49: Label + 52: 7(fvec4) Load 9(input) + 53: 7(fvec4) Load 9(input) + 54: 13(bvec4) FOrdEqual 52 53 + 55: 12(bool) All 54 + SelectionMerge 57 None + BranchConditional 55 56 60 + 56: Label + 58: 7(fvec4) Load 9(input) + ReturnValue 58 + 60: Label + 61: 7(fvec4) Load 9(input) + 62: 7(fvec4) FNegate 61 + ReturnValue 62 + 57: Label + Return + FunctionEnd diff --git a/Test/hlsl.attribute.frag b/Test/hlsl.attribute.frag new file mode 100644 index 00000000..25c72d46 --- /dev/null +++ b/Test/hlsl.attribute.frag @@ -0,0 +1,13 @@ +float4 PixelShaderFunction(float4 input) : COLOR0 +{ + [unroll]; + []; + [][][]; + [unroll(4)]; + [allow_uav_condition]; + [unroll(4)] [allow_uav_condition]; + [ loop ]; + [fastopt]; + [branch] if (0); + [flatten]; +} diff --git a/Test/hlsl.if.frag b/Test/hlsl.if.frag new file mode 100644 index 00000000..1f0dde71 --- /dev/null +++ b/Test/hlsl.if.frag @@ -0,0 +1,28 @@ +float4 PixelShaderFunction(float4 input) : COLOR0 +{ + if (input == input) + return input; + + if (input == input) + return input; + else + return -input; + + if (input == input) + ; + + if (input == input) + ; + else + ; + + [flatten] if (input == input) { + return input; + } + + if (input == input) { + return input; + } else { + return -input; + } +} diff --git a/gtests/Hlsl.FromFile.cpp b/gtests/Hlsl.FromFile.cpp index 9c0061ed..123dd608 100644 --- a/gtests/Hlsl.FromFile.cpp +++ b/gtests/Hlsl.FromFile.cpp @@ -73,9 +73,11 @@ INSTANTIATE_TEST_CASE_P( ToSpirv, HlslCompileTest, ::testing::ValuesIn(std::vector{ {"hlsl.assoc.frag", "PixelShaderFunction"}, + {"hlsl.attribute.frag", "PixelShaderFunction"}, {"hlsl.cast.frag", "PixelShaderFunction"}, {"hlsl.float1.frag", "PixelShaderFunction"}, {"hlsl.float4.frag", "PixelShaderFunction"}, + {"hlsl.if.frag", "PixelShaderFunction"}, {"hlsl.intrinsics.frag", "PixelShaderFunction"}, {"hlsl.intrinsics.negative.frag", "PixelShaderFunction"}, {"hlsl.intrinsics.negative.vert", "VertexShaderFunction"}, diff --git a/hlsl/hlslGrammar.cpp b/hlsl/hlslGrammar.cpp index 31e67d36..a75fee6d 100755 --- a/hlsl/hlslGrammar.cpp +++ b/hlsl/hlslGrammar.cpp @@ -434,7 +434,7 @@ bool HlslGrammar::acceptFunctionParameters(TFunction& function) // RIGHT_PAREN if (! acceptTokenClass(EHTokRightParen)) { - expected("right parenthesis"); + expected(")"); return false; } @@ -485,6 +485,31 @@ bool HlslGrammar::acceptFunctionDefinition(TFunction& function, TIntermNode*& no return false; } +// Accept an expression with parenthesis around it, where +// the parenthesis ARE NOT expression parenthesis, but the +// syntactically required ones like in "if ( expression )" +// +// Note this one is not set up to be speculative; as it gives +// errors if not found. +// +bool HlslGrammar::acceptParenExpression(TIntermTyped*& expression) +{ + // LEFT_PAREN + if (! acceptTokenClass(EHTokLeftParen)) + expected("("); + + if (! acceptExpression(expression)) { + expected("expression"); + return false; + } + + // RIGHT_PAREN + if (! acceptTokenClass(EHTokRightParen)) + expected(")"); + + return true; +} + // The top-level full expression recognizer. // // expression @@ -620,7 +645,7 @@ bool HlslGrammar::acceptUnaryExpression(TIntermTyped*& node) TType castType; if (acceptType(castType)) { if (! acceptTokenClass(EHTokRightParen)) { - expected("right parenthesis"); + expected(")"); return false; } @@ -699,7 +724,7 @@ bool HlslGrammar::acceptPostfixExpression(TIntermTyped*& node) return false; } if (! acceptTokenClass(EHTokRightParen)) { - expected("right parenthesis"); + expected(")"); return false; } } else if (acceptLiteral(node)) { @@ -838,7 +863,7 @@ bool HlslGrammar::acceptArguments(TFunction* function, TIntermTyped*& arguments) // RIGHT_PAREN if (! acceptTokenClass(EHTokRightParen)) { - expected("right parenthesis"); + expected(")"); return false; } @@ -896,6 +921,24 @@ bool HlslGrammar::acceptCompoundStatement(TIntermNode*& retStatement) return acceptTokenClass(EHTokRightBrace); } +bool HlslGrammar::acceptScopedStatement(TIntermNode*& statement) +{ + parseContext.pushScope(); + bool result = acceptNestedStatement(statement); + parseContext.popScope(); + + return result; +} + +bool HlslGrammar::acceptNestedStatement(TIntermNode*& statement) +{ + parseContext.nestStatement(); + bool result = acceptStatement(statement); + parseContext.unnestStatement(); + + return result; +} + // statement // : attributes attributed_statement // @@ -965,7 +1008,7 @@ bool HlslGrammar::acceptStatement(TIntermNode*& statement) // SEMICOLON (following an expression) if (! acceptTokenClass(EHTokSemicolon)) { - expected("semicolon"); + expected(";"); return false; } } @@ -989,12 +1032,86 @@ bool HlslGrammar::acceptStatement(TIntermNode*& statement) // void HlslGrammar::acceptAttributes() { - // TODO + // For now, accept the [ XXX(X) ] syntax, but drop. + // TODO: subset to correct set? Pass on? + do { + // LEFT_BRACKET? + if (! acceptTokenClass(EHTokLeftBracket)) + return; + + // attribute + if (peekTokenClass(EHTokIdentifier)) { + // 'token.string' is the attribute + advanceToken(); + } else if (! peekTokenClass(EHTokRightBracket)) { + expected("identifier"); + advanceToken(); + } + + // (x) + if (acceptTokenClass(EHTokLeftParen)) { + TIntermTyped* node; + if (! acceptLiteral(node)) + expected("literal"); + // 'node' has the literal in it + if (! acceptTokenClass(EHTokRightParen)) + expected(")"); + } + + // RIGHT_BRACKET + if (acceptTokenClass(EHTokRightBracket)) + continue; + + expected("]"); + return; + + } while (true); } +// selection_statement +// : IF LEFT_PAREN expression RIGHT_PAREN statement +// : IF LEFT_PAREN expression RIGHT_PAREN statement ELSE statement +// bool HlslGrammar::acceptSelectionStatement(TIntermNode*& statement) { - return false; + TSourceLoc loc = token.loc; + + // IF + if (! acceptTokenClass(EHTokIf)) + return false; + + // so that something declared in the condition is scoped to the lifetimes + // of the then-else statements + parseContext.pushScope(); + + // LEFT_PAREN expression RIGHT_PAREN + TIntermTyped* condition; + if (! acceptParenExpression(condition)) + return false; + + // create the child statements + TIntermNodePair thenElse = { nullptr, nullptr }; + + // then statement + if (! acceptScopedStatement(thenElse.node1)) { + expected("then statement"); + return false; + } + + // ELSE + if (acceptTokenClass(EHTokElse)) { + // else statement + if (! acceptScopedStatement(thenElse.node2)) { + expected("else statement"); + return false; + } + } + + // Put the pieces together + statement = intermediate.addSelection(condition, thenElse, loc); + parseContext.popScope(); + + return true; } bool HlslGrammar::acceptSwitchStatement(TIntermNode*& statement) @@ -1036,7 +1153,7 @@ bool HlslGrammar::acceptJumpStatement(TIntermNode*& statement) // SEMICOLON if (! acceptTokenClass(EHTokSemicolon)) { - expected("semicolon"); + expected(";"); return false; } diff --git a/hlsl/hlslGrammar.h b/hlsl/hlslGrammar.h index 7d337fde..69535f30 100755 --- a/hlsl/hlslGrammar.h +++ b/hlsl/hlslGrammar.h @@ -64,6 +64,7 @@ namespace glslang { bool acceptFunctionParameters(TFunction&); bool acceptParameterDeclaration(TFunction&); bool acceptFunctionDefinition(TFunction&, TIntermNode*&); + bool acceptParenExpression(TIntermTyped*&); bool acceptExpression(TIntermTyped*&); bool acceptAssignmentExpression(TIntermTyped*&); bool acceptBinaryExpression(TIntermTyped*&, PrecedenceLevel); @@ -75,6 +76,8 @@ namespace glslang { bool acceptLiteral(TIntermTyped*&); bool acceptCompoundStatement(TIntermNode*&); bool acceptStatement(TIntermNode*&); + bool acceptScopedStatement(TIntermNode*&); + bool acceptNestedStatement(TIntermNode*&); void acceptAttributes(); bool acceptSelectionStatement(TIntermNode*&); bool acceptSwitchStatement(TIntermNode*&); diff --git a/hlsl/hlslParseHelper.h b/hlsl/hlslParseHelper.h index 7fa267ff..a6c59a32 100755 --- a/hlsl/hlslParseHelper.h +++ b/hlsl/hlslParseHelper.h @@ -139,6 +139,11 @@ public: void updateImplicitArraySize(const TSourceLoc&, TIntermNode*, int index); + void nestStatement() { ++statementNestingLevel; } + void unnestStatement() { --statementNestingLevel; } + void pushScope() { symbolTable.push(); } + void popScope() { symbolTable.pop(0); } + protected: void inheritGlobalDefaults(TQualifier& dst) const; TVariable* makeInternalVariable(const char* name, const TType&) const; From 119f8f690656b85843eb27d8a79be7b1bd5d0ec7 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Sun, 5 Jun 2016 15:44:07 -0600 Subject: [PATCH 139/140] HLSL: Flesh out the loop grammar and productions. --- Test/baseResults/hlsl.doLoop.frag.out | 116 +++++++++ Test/baseResults/hlsl.forLoop.frag.out | 220 ++++++++++++++++++ Test/baseResults/hlsl.whileLoop.frag.out | 145 ++++++++++++ Test/hlsl.doLoop.frag | 6 + Test/hlsl.forLoop.frag | 8 + Test/hlsl.whileLoop.frag | 7 + glslang/MachineIndependent/Intermediate.cpp | 18 +- .../MachineIndependent/localintermediate.h | 1 + gtests/Hlsl.FromFile.cpp | 3 + hlsl/hlslGrammar.cpp | 121 +++++++++- hlsl/hlslParseHelper.h | 2 + 11 files changed, 645 insertions(+), 2 deletions(-) create mode 100755 Test/baseResults/hlsl.doLoop.frag.out create mode 100755 Test/baseResults/hlsl.forLoop.frag.out create mode 100755 Test/baseResults/hlsl.whileLoop.frag.out create mode 100644 Test/hlsl.doLoop.frag create mode 100644 Test/hlsl.forLoop.frag create mode 100644 Test/hlsl.whileLoop.frag diff --git a/Test/baseResults/hlsl.doLoop.frag.out b/Test/baseResults/hlsl.doLoop.frag.out new file mode 100755 index 00000000..eed2d913 --- /dev/null +++ b/Test/baseResults/hlsl.doLoop.frag.out @@ -0,0 +1,116 @@ +hlsl.doLoop.frag +Shader version: 450 +gl_FragCoord origin is upper left +0:? Sequence +0:7 Function Definition: PixelShaderFunction(vf4; (temp 4-component vector of float) +0:2 Function Parameters: +0:2 'input' (temp 4-component vector of float) +0:? Sequence +0:3 Loop with condition not tested first +0:3 Loop Condition +0:3 Constant: +0:3 false (const bool) +0:3 No loop body +0:4 Loop with condition not tested first +0:4 Loop Condition +0:4 Constant: +0:4 false (const bool) +0:4 No loop body +0:5 Loop with condition not tested first +0:5 Loop Condition +0:5 Compare Equal (temp bool) +0:5 'input' (temp 4-component vector of float) +0:5 'input' (temp 4-component vector of float) +0:5 Loop Body +0:5 Branch: Return with expression +0:5 'input' (temp 4-component vector of float) +0:? Linker Objects + + +Linked fragment stage: + + +Shader version: 450 +gl_FragCoord origin is upper left +0:? Sequence +0:7 Function Definition: PixelShaderFunction(vf4; (temp 4-component vector of float) +0:2 Function Parameters: +0:2 'input' (temp 4-component vector of float) +0:? Sequence +0:3 Loop with condition not tested first +0:3 Loop Condition +0:3 Constant: +0:3 false (const bool) +0:3 No loop body +0:4 Loop with condition not tested first +0:4 Loop Condition +0:4 Constant: +0:4 false (const bool) +0:4 No loop body +0:5 Loop with condition not tested first +0:5 Loop Condition +0:5 Compare Equal (temp bool) +0:5 'input' (temp 4-component vector of float) +0:5 'input' (temp 4-component vector of float) +0:5 Loop Body +0:5 Branch: Return with expression +0:5 'input' (temp 4-component vector of float) +0:? Linker Objects + +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 31 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "PixelShaderFunction" + ExecutionMode 4 OriginUpperLeft + Source HLSL 450 + Name 4 "PixelShaderFunction" + Name 23 "input" + 2: TypeVoid + 3: TypeFunction 2 + 10: TypeBool + 11: 10(bool) ConstantFalse + 20: TypeFloat 32 + 21: TypeVector 20(float) 4 + 22: TypePointer Function 21(fvec4) + 28: TypeVector 10(bool) 4 +4(PixelShaderFunction): 2 Function None 3 + 5: Label + 23(input): 22(ptr) Variable Function + Branch 6 + 6: Label + LoopMerge 8 9 None + Branch 7 + 7: Label + Branch 9 + 9: Label + BranchConditional 11 6 8 + 8: Label + Branch 12 + 12: Label + LoopMerge 14 15 None + Branch 13 + 13: Label + Branch 15 + 15: Label + BranchConditional 11 12 14 + 14: Label + Branch 16 + 16: Label + LoopMerge 18 19 None + Branch 17 + 17: Label + 24: 21(fvec4) Load 23(input) + ReturnValue 24 + 19: Label + 26: 21(fvec4) Load 23(input) + 27: 21(fvec4) Load 23(input) + 29: 28(bvec4) FOrdEqual 26 27 + 30: 10(bool) All 29 + BranchConditional 30 16 18 + 18: Label + Return + FunctionEnd diff --git a/Test/baseResults/hlsl.forLoop.frag.out b/Test/baseResults/hlsl.forLoop.frag.out new file mode 100755 index 00000000..2e654e19 --- /dev/null +++ b/Test/baseResults/hlsl.forLoop.frag.out @@ -0,0 +1,220 @@ +hlsl.forLoop.frag +Shader version: 450 +gl_FragCoord origin is upper left +0:? Sequence +0:9 Function Definition: PixelShaderFunction(vf4; (temp 4-component vector of float) +0:2 Function Parameters: +0:2 'input' (temp 4-component vector of float) +0:? Sequence +0:? Sequence +0:3 Loop with condition tested first +0:3 No loop condition +0:3 No loop body +0:4 Sequence +0:4 Pre-Increment (temp 4-component vector of float) +0:4 'input' (temp 4-component vector of float) +0:4 Loop with condition tested first +0:4 No loop condition +0:4 No loop body +0:? Sequence +0:5 Loop with condition tested first +0:5 Loop Condition +0:5 Compare Not Equal (temp bool) +0:5 'input' (temp 4-component vector of float) +0:5 'input' (temp 4-component vector of float) +0:5 No loop body +0:? Sequence +0:6 Loop with condition tested first +0:6 Loop Condition +0:6 Compare Not Equal (temp bool) +0:6 'input' (temp 4-component vector of float) +0:6 'input' (temp 4-component vector of float) +0:6 Loop Body +0:? Sequence +0:6 Branch: Return with expression +0:6 Negate value (temp 4-component vector of float) +0:6 'input' (temp 4-component vector of float) +0:7 Sequence +0:7 Pre-Decrement (temp 4-component vector of float) +0:7 'input' (temp 4-component vector of float) +0:7 Loop with condition tested first +0:7 Loop Condition +0:7 Compare Not Equal (temp bool) +0:7 'input' (temp 4-component vector of float) +0:7 'input' (temp 4-component vector of float) +0:7 Loop Body +0:? Sequence +0:7 Branch: Return with expression +0:7 Negate value (temp 4-component vector of float) +0:7 'input' (temp 4-component vector of float) +0:7 Loop Terminal Expression +0:7 add second child into first child (temp 4-component vector of float) +0:7 'input' (temp 4-component vector of float) +0:7 Constant: +0:7 2.000000 +0:? Linker Objects + + +Linked fragment stage: + + +Shader version: 450 +gl_FragCoord origin is upper left +0:? Sequence +0:9 Function Definition: PixelShaderFunction(vf4; (temp 4-component vector of float) +0:2 Function Parameters: +0:2 'input' (temp 4-component vector of float) +0:? Sequence +0:? Sequence +0:3 Loop with condition tested first +0:3 No loop condition +0:3 No loop body +0:4 Sequence +0:4 Pre-Increment (temp 4-component vector of float) +0:4 'input' (temp 4-component vector of float) +0:4 Loop with condition tested first +0:4 No loop condition +0:4 No loop body +0:? Sequence +0:5 Loop with condition tested first +0:5 Loop Condition +0:5 Compare Not Equal (temp bool) +0:5 'input' (temp 4-component vector of float) +0:5 'input' (temp 4-component vector of float) +0:5 No loop body +0:? Sequence +0:6 Loop with condition tested first +0:6 Loop Condition +0:6 Compare Not Equal (temp bool) +0:6 'input' (temp 4-component vector of float) +0:6 'input' (temp 4-component vector of float) +0:6 Loop Body +0:? Sequence +0:6 Branch: Return with expression +0:6 Negate value (temp 4-component vector of float) +0:6 'input' (temp 4-component vector of float) +0:7 Sequence +0:7 Pre-Decrement (temp 4-component vector of float) +0:7 'input' (temp 4-component vector of float) +0:7 Loop with condition tested first +0:7 Loop Condition +0:7 Compare Not Equal (temp bool) +0:7 'input' (temp 4-component vector of float) +0:7 'input' (temp 4-component vector of float) +0:7 Loop Body +0:? Sequence +0:7 Branch: Return with expression +0:7 Negate value (temp 4-component vector of float) +0:7 'input' (temp 4-component vector of float) +0:7 Loop Terminal Expression +0:7 add second child into first child (temp 4-component vector of float) +0:7 'input' (temp 4-component vector of float) +0:7 Constant: +0:7 2.000000 +0:? Linker Objects + +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 64 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "PixelShaderFunction" + ExecutionMode 4 OriginUpperLeft + Source HLSL 450 + Name 4 "PixelShaderFunction" + Name 13 "input" + 2: TypeVoid + 3: TypeFunction 2 + 10: TypeFloat 32 + 11: TypeVector 10(float) 4 + 12: TypePointer Function 11(fvec4) + 15: 10(float) Constant 1065353216 + 29: TypeBool + 30: TypeVector 29(bool) 4 + 60: 10(float) Constant 1073741824 +4(PixelShaderFunction): 2 Function None 3 + 5: Label + 13(input): 12(ptr) Variable Function + Branch 6 + 6: Label + LoopMerge 8 9 None + Branch 7 + 7: Label + Branch 9 + 9: Label + Branch 6 + 8: Label + 14: 11(fvec4) Load 13(input) + 16: 11(fvec4) CompositeConstruct 15 15 15 15 + 17: 11(fvec4) FAdd 14 16 + Store 13(input) 17 + Branch 18 + 18: Label + LoopMerge 20 21 None + Branch 19 + 19: Label + Branch 21 + 21: Label + Branch 18 + 20: Label + Branch 22 + 22: Label + LoopMerge 24 25 None + Branch 26 + 26: Label + 27: 11(fvec4) Load 13(input) + 28: 11(fvec4) Load 13(input) + 31: 30(bvec4) FOrdNotEqual 27 28 + 32: 29(bool) Any 31 + BranchConditional 32 23 24 + 23: Label + Branch 25 + 25: Label + Branch 22 + 24: Label + Branch 33 + 33: Label + LoopMerge 35 36 None + Branch 37 + 37: Label + 38: 11(fvec4) Load 13(input) + 39: 11(fvec4) Load 13(input) + 40: 30(bvec4) FOrdNotEqual 38 39 + 41: 29(bool) Any 40 + BranchConditional 41 34 35 + 34: Label + 42: 11(fvec4) Load 13(input) + 43: 11(fvec4) FNegate 42 + ReturnValue 43 + 36: Label + Branch 33 + 35: Label + 45: 11(fvec4) Load 13(input) + 46: 11(fvec4) CompositeConstruct 15 15 15 15 + 47: 11(fvec4) FSub 45 46 + Store 13(input) 47 + Branch 48 + 48: Label + LoopMerge 50 51 None + Branch 52 + 52: Label + 53: 11(fvec4) Load 13(input) + 54: 11(fvec4) Load 13(input) + 55: 30(bvec4) FOrdNotEqual 53 54 + 56: 29(bool) Any 55 + BranchConditional 56 49 50 + 49: Label + 57: 11(fvec4) Load 13(input) + 58: 11(fvec4) FNegate 57 + ReturnValue 58 + 51: Label + 61: 11(fvec4) Load 13(input) + 62: 11(fvec4) CompositeConstruct 60 60 60 60 + 63: 11(fvec4) FAdd 61 62 + Store 13(input) 63 + Branch 48 + 50: Label + Return + FunctionEnd diff --git a/Test/baseResults/hlsl.whileLoop.frag.out b/Test/baseResults/hlsl.whileLoop.frag.out new file mode 100755 index 00000000..686407bd --- /dev/null +++ b/Test/baseResults/hlsl.whileLoop.frag.out @@ -0,0 +1,145 @@ +hlsl.whileLoop.frag +Shader version: 450 +gl_FragCoord origin is upper left +0:? Sequence +0:8 Function Definition: PixelShaderFunction(vf4; (temp 4-component vector of float) +0:2 Function Parameters: +0:2 'input' (temp 4-component vector of float) +0:? Sequence +0:3 Loop with condition tested first +0:3 Loop Condition +0:3 Compare Not Equal (temp bool) +0:3 'input' (temp 4-component vector of float) +0:3 'input' (temp 4-component vector of float) +0:3 Loop Body +0:? Sequence +0:3 Branch: Return with expression +0:3 'input' (temp 4-component vector of float) +0:4 Loop with condition tested first +0:4 Loop Condition +0:4 Constant: +0:4 false (const bool) +0:4 No loop body +0:5 Loop with condition tested first +0:5 Loop Condition +0:5 Constant: +0:5 false (const bool) +0:5 No loop body +0:6 Loop with condition tested first +0:6 Loop Condition +0:6 Constant: +0:6 false (const bool) +0:6 No loop body +0:? Linker Objects + + +Linked fragment stage: + + +Shader version: 450 +gl_FragCoord origin is upper left +0:? Sequence +0:8 Function Definition: PixelShaderFunction(vf4; (temp 4-component vector of float) +0:2 Function Parameters: +0:2 'input' (temp 4-component vector of float) +0:? Sequence +0:3 Loop with condition tested first +0:3 Loop Condition +0:3 Compare Not Equal (temp bool) +0:3 'input' (temp 4-component vector of float) +0:3 'input' (temp 4-component vector of float) +0:3 Loop Body +0:? Sequence +0:3 Branch: Return with expression +0:3 'input' (temp 4-component vector of float) +0:4 Loop with condition tested first +0:4 Loop Condition +0:4 Constant: +0:4 false (const bool) +0:4 No loop body +0:5 Loop with condition tested first +0:5 Loop Condition +0:5 Constant: +0:5 false (const bool) +0:5 No loop body +0:6 Loop with condition tested first +0:6 Loop Condition +0:6 Constant: +0:6 false (const bool) +0:6 No loop body +0:? Linker Objects + +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 39 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "PixelShaderFunction" + ExecutionMode 4 OriginUpperLeft + Source HLSL 450 + Name 4 "PixelShaderFunction" + Name 14 "input" + 2: TypeVoid + 3: TypeFunction 2 + 11: TypeFloat 32 + 12: TypeVector 11(float) 4 + 13: TypePointer Function 12(fvec4) + 17: TypeBool + 18: TypeVector 17(bool) 4 + 28: 17(bool) ConstantFalse +4(PixelShaderFunction): 2 Function None 3 + 5: Label + 14(input): 13(ptr) Variable Function + Branch 6 + 6: Label + LoopMerge 8 9 None + Branch 10 + 10: Label + 15: 12(fvec4) Load 14(input) + 16: 12(fvec4) Load 14(input) + 19: 18(bvec4) FOrdNotEqual 15 16 + 20: 17(bool) Any 19 + BranchConditional 20 7 8 + 7: Label + 21: 12(fvec4) Load 14(input) + ReturnValue 21 + 9: Label + Branch 6 + 8: Label + Branch 23 + 23: Label + LoopMerge 25 26 None + Branch 27 + 27: Label + BranchConditional 28 24 25 + 24: Label + Branch 26 + 26: Label + Branch 23 + 25: Label + Branch 29 + 29: Label + LoopMerge 31 32 None + Branch 33 + 33: Label + BranchConditional 28 30 31 + 30: Label + Branch 32 + 32: Label + Branch 29 + 31: Label + Branch 34 + 34: Label + LoopMerge 36 37 None + Branch 38 + 38: Label + BranchConditional 28 35 36 + 35: Label + Branch 37 + 37: Label + Branch 34 + 36: Label + Return + FunctionEnd diff --git a/Test/hlsl.doLoop.frag b/Test/hlsl.doLoop.frag new file mode 100644 index 00000000..546b2c2c --- /dev/null +++ b/Test/hlsl.doLoop.frag @@ -0,0 +1,6 @@ +float4 PixelShaderFunction(float4 input) : COLOR0 +{ + [unroll] do {} while (false); + [unroll] do {;} while (false); + do { return input; } while (input == input); +} diff --git a/Test/hlsl.forLoop.frag b/Test/hlsl.forLoop.frag new file mode 100644 index 00000000..9109de79 --- /dev/null +++ b/Test/hlsl.forLoop.frag @@ -0,0 +1,8 @@ +float4 PixelShaderFunction(float4 input) : COLOR0 +{ + for (;;) ; + for (++input; ; ) ; + [unroll] for (; input != input; ) {} + for (; input != input; ) { return -input; } + for (--input; input != input; input += 2) { return -input; } +} diff --git a/Test/hlsl.whileLoop.frag b/Test/hlsl.whileLoop.frag new file mode 100644 index 00000000..f282375d --- /dev/null +++ b/Test/hlsl.whileLoop.frag @@ -0,0 +1,7 @@ +float4 PixelShaderFunction(float4 input) : COLOR0 +{ + while (input != input) { return input; } + while (false) ; + [unroll] while (false) { } + while ((false)) { } +} diff --git a/glslang/MachineIndependent/Intermediate.cpp b/glslang/MachineIndependent/Intermediate.cpp index 416dc34a..02681ac5 100644 --- a/glslang/MachineIndependent/Intermediate.cpp +++ b/glslang/MachineIndependent/Intermediate.cpp @@ -1028,7 +1028,7 @@ const TIntermTyped* TIntermediate::findLValueBase(const TIntermTyped* node, bool } // -// Create loop nodes. +// Create while and do-while loop nodes. // TIntermLoop* TIntermediate::addLoop(TIntermNode* body, TIntermTyped* test, TIntermTyped* terminal, bool testFirst, const TSourceLoc& loc) { @@ -1038,6 +1038,22 @@ TIntermLoop* TIntermediate::addLoop(TIntermNode* body, TIntermTyped* test, TInte return node; } +// +// Create a for-loop sequence. +// +TIntermAggregate* TIntermediate::addForLoop(TIntermNode* body, TIntermNode* initializer, TIntermTyped* test, TIntermTyped* terminal, bool testFirst, const TSourceLoc& loc) +{ + TIntermLoop* node = new TIntermLoop(body, test, terminal, testFirst); + node->setLoc(loc); + + // make a sequence of the initializer and statement + TIntermAggregate* loopSequence = makeAggregate(initializer, loc); + loopSequence = growAggregate(loopSequence, node); + loopSequence->setOperator(EOpSequence); + + return loopSequence; +} + // // Add branches. // diff --git a/glslang/MachineIndependent/localintermediate.h b/glslang/MachineIndependent/localintermediate.h index d60c59ed..7445dee0 100644 --- a/glslang/MachineIndependent/localintermediate.h +++ b/glslang/MachineIndependent/localintermediate.h @@ -198,6 +198,7 @@ public: TIntermTyped* promoteConstantUnion(TBasicType, TIntermConstantUnion*) const; bool parseConstTree(TIntermNode*, TConstUnionArray, TOperator, const TType&, bool singleConstantParam = false); TIntermLoop* addLoop(TIntermNode*, TIntermTyped*, TIntermTyped*, bool testFirst, const TSourceLoc&); + TIntermAggregate* addForLoop(TIntermNode*, TIntermNode*, TIntermTyped*, TIntermTyped*, bool testFirst, const TSourceLoc&); TIntermBranch* addBranch(TOperator, const TSourceLoc&); TIntermBranch* addBranch(TOperator, TIntermTyped*, const TSourceLoc&); TIntermTyped* addSwizzle(TVectorFields&, const TSourceLoc&); diff --git a/gtests/Hlsl.FromFile.cpp b/gtests/Hlsl.FromFile.cpp index 123dd608..3b61dc00 100644 --- a/gtests/Hlsl.FromFile.cpp +++ b/gtests/Hlsl.FromFile.cpp @@ -75,8 +75,10 @@ INSTANTIATE_TEST_CASE_P( {"hlsl.assoc.frag", "PixelShaderFunction"}, {"hlsl.attribute.frag", "PixelShaderFunction"}, {"hlsl.cast.frag", "PixelShaderFunction"}, + {"hlsl.doLoop.frag", "PixelShaderFunction"}, {"hlsl.float1.frag", "PixelShaderFunction"}, {"hlsl.float4.frag", "PixelShaderFunction"}, + {"hlsl.forLoop.frag", "PixelShaderFunction"}, {"hlsl.if.frag", "PixelShaderFunction"}, {"hlsl.intrinsics.frag", "PixelShaderFunction"}, {"hlsl.intrinsics.negative.frag", "PixelShaderFunction"}, @@ -87,6 +89,7 @@ INSTANTIATE_TEST_CASE_P( {"hlsl.precedence.frag", "PixelShaderFunction"}, {"hlsl.precedence2.frag", "PixelShaderFunction"}, {"hlsl.sin.frag", "PixelShaderFunction"}, + {"hlsl.whileLoop.frag", "PixelShaderFunction"}, }), FileNameAsCustomTestSuffix ); diff --git a/hlsl/hlslGrammar.cpp b/hlsl/hlslGrammar.cpp index a75fee6d..c1600e4d 100755 --- a/hlsl/hlslGrammar.cpp +++ b/hlsl/hlslGrammar.cpp @@ -1119,9 +1119,128 @@ bool HlslGrammar::acceptSwitchStatement(TIntermNode*& statement) return false; } +// iteration_statement +// : WHILE LEFT_PAREN condition RIGHT_PAREN statement +// | DO LEFT_BRACE statement RIGHT_BRACE WHILE LEFT_PAREN expression RIGHT_PAREN SEMICOLON +// | FOR LEFT_PAREN for_init_statement for_rest_statement RIGHT_PAREN statement +// +// Non-speculative, only call if it needs to be found; WHILE or DO or FOR already seen. bool HlslGrammar::acceptIterationStatement(TIntermNode*& statement) { - return false; + TSourceLoc loc = token.loc; + TIntermTyped* condition = nullptr; + + EHlslTokenClass loop = peek(); + assert(loop == EHTokDo || loop == EHTokFor || loop == EHTokWhile); + + // WHILE or DO or FOR + advanceToken(); + + switch (loop) { + case EHTokWhile: + // so that something declared in the condition is scoped to the lifetime + // of the while sub-statement + parseContext.pushScope(); + parseContext.nestLooping(); + + // LEFT_PAREN condition RIGHT_PAREN + if (! acceptParenExpression(condition)) + return false; + + // statement + if (! acceptScopedStatement(statement)) { + expected("while sub-statement"); + return false; + } + + parseContext.unnestLooping(); + parseContext.popScope(); + + statement = intermediate.addLoop(statement, condition, nullptr, true, loc); + + return true; + + case EHTokDo: + parseContext.nestLooping(); + + if (! acceptTokenClass(EHTokLeftBrace)) + expected("{"); + + // statement + if (! peekTokenClass(EHTokRightBrace) && ! acceptScopedStatement(statement)) { + expected("do sub-statement"); + return false; + } + + if (! acceptTokenClass(EHTokRightBrace)) + expected("}"); + + // WHILE + if (! acceptTokenClass(EHTokWhile)) { + expected("while"); + return false; + } + + // LEFT_PAREN condition RIGHT_PAREN + TIntermTyped* condition; + if (! acceptParenExpression(condition)) + return false; + + if (! acceptTokenClass(EHTokSemicolon)) + expected(";"); + + parseContext.unnestLooping(); + + statement = intermediate.addLoop(statement, condition, 0, false, loc); + + return true; + + case EHTokFor: + { + // LEFT_PAREN + if (! acceptTokenClass(EHTokLeftParen)) + expected("("); + + // so that something declared in the condition is scoped to the lifetime + // of the for sub-statement + parseContext.pushScope(); + + // initializer SEMI_COLON + TIntermTyped* initializer = nullptr; // TODO, "for (initializer" needs to support decl. statement + acceptExpression(initializer); + if (! acceptTokenClass(EHTokSemicolon)) + expected(";"); + + parseContext.nestLooping(); + + // condition SEMI_COLON + acceptExpression(condition); + if (! acceptTokenClass(EHTokSemicolon)) + expected(";"); + + // iterator SEMI_COLON + TIntermTyped* iterator = nullptr; + acceptExpression(iterator); + if (! acceptTokenClass(EHTokRightParen)) + expected(")"); + + // statement + if (! acceptScopedStatement(statement)) { + expected("for sub-statement"); + return false; + } + + statement = intermediate.addForLoop(statement, initializer, condition, iterator, true, loc); + + parseContext.popScope(); + parseContext.unnestLooping(); + + return true; + } + + default: + return false; + } } // jump_statement diff --git a/hlsl/hlslParseHelper.h b/hlsl/hlslParseHelper.h index a6c59a32..6f920d8c 100755 --- a/hlsl/hlslParseHelper.h +++ b/hlsl/hlslParseHelper.h @@ -141,6 +141,8 @@ public: void nestStatement() { ++statementNestingLevel; } void unnestStatement() { --statementNestingLevel; } + void nestLooping() { ++loopNestingLevel; } + void unnestLooping() { --loopNestingLevel; } void pushScope() { symbolTable.push(); } void popScope() { symbolTable.pop(0); } From 133253b6eede33625061ab83a2d72942a293c3db Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Sun, 5 Jun 2016 17:25:34 -0600 Subject: [PATCH 140/140] Front-end: Fix issue #147: ensure layout(index=N) has N in [0,1]. --- Test/330.frag | 2 ++ Test/baseResults/330.frag.out | 5 ++++- glslang/MachineIndependent/ParseHelper.cpp | 7 +++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Test/330.frag b/Test/330.frag index 57736b0c..9afa8f82 100644 --- a/Test/330.frag +++ b/Test/330.frag @@ -148,3 +148,5 @@ void fooKeyMem() { KeyMem.precise; } + +layout(location=28, index=2) out vec4 outIndex2; // ERROR index out of range \ No newline at end of file diff --git a/Test/baseResults/330.frag.out b/Test/baseResults/330.frag.out index 5d145efd..904ad3ed 100644 --- a/Test/baseResults/330.frag.out +++ b/Test/baseResults/330.frag.out @@ -37,7 +37,8 @@ ERROR: 0:140: 'textureQueryLod' : no matching overloaded function found ERROR: 0:140: 'assign' : cannot convert from 'const float' to 'temp 2-component vector of float' ERROR: 0:141: 'textureQueryLod' : no matching overloaded function found ERROR: 0:141: 'assign' : cannot convert from 'const float' to 'temp 2-component vector of float' -ERROR: 38 compilation errors. No code generated. +ERROR: 0:152: 'index' : value must be 0 or 1 +ERROR: 39 compilation errors. No code generated. Shader version: 330 @@ -122,6 +123,7 @@ ERROR: node is still EOpNull! 0:? 'samp2Ds' (uniform sampler2DShadow) 0:? 'precise' (global int) 0:? 'KeyMem' (global structure{global int precise}) +0:? 'outIndex2' (layout(location=28 index=0 ) out 4-component vector of float) Linked fragment stage: @@ -211,4 +213,5 @@ ERROR: node is still EOpNull! 0:? 'samp2Ds' (uniform sampler2DShadow) 0:? 'precise' (global int) 0:? 'KeyMem' (global structure{global int precise}) +0:? 'outIndex2' (layout(location=28 index=0 ) out 4-component vector of float) diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 31a94d26..959d6900 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -4225,6 +4225,13 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi requireProfile(loc, ECompatibilityProfile | ECoreProfile, "index layout qualifier on fragment output"); const char* exts[2] = { E_GL_ARB_separate_shader_objects, E_GL_ARB_explicit_attrib_location }; profileRequires(loc, ECompatibilityProfile | ECoreProfile, 330, 2, exts, "index layout qualifier on fragment output"); + + // "It is also a compile-time error if a fragment shader sets a layout index to less than 0 or greater than 1." + if (value < 0 || value > 1) { + value = 0; + error(loc, "value must be 0 or 1", "index", ""); + } + publicType.qualifier.layoutIndex = value; return; }