diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/HLSL/hlslAttributes.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/HLSL/hlslAttributes.h deleted file mode 100644 index 62faa5b..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/HLSL/hlslAttributes.h +++ /dev/null @@ -1,59 +0,0 @@ -// -// 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 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 HLSLATTRIBUTES_H_ -#define HLSLATTRIBUTES_H_ - -#include -#include - -#include "../MachineIndependent/attribute.h" -#include "../MachineIndependent/SymbolTable.h" -#include "hlslScanContext.h" - -namespace glslang { - - class TFunctionDeclarator { - public: - TFunctionDeclarator() : function(nullptr), body(nullptr) { } - TSourceLoc loc; - TFunction* function; - TAttributes attributes; - TVector* body; - }; - -} // end namespace glslang - -#endif // HLSLATTRIBUTES_H_ diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/HLSL/hlslGrammar.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/HLSL/hlslGrammar.h deleted file mode 100644 index 6c12008..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/HLSL/hlslGrammar.h +++ /dev/null @@ -1,142 +0,0 @@ -// -// Copyright (C) 2016-2018 Google, Inc. -// 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 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 "hlslParseHelper.h" -#include "hlslOpMap.h" -#include "hlslTokenStream.h" - -namespace glslang { - - class TFunctionDeclarator; - - // Should just be the grammar aspect of HLSL. - // Described in more detail in hlslGrammar.cpp. - - class HlslGrammar : public HlslTokenStream { - public: - HlslGrammar(HlslScanContext& scanner, HlslParseContext& parseContext) - : HlslTokenStream(scanner), parseContext(parseContext), intermediate(parseContext.intermediate), - typeIdentifiers(false), unitNode(nullptr) { } - virtual ~HlslGrammar() { } - - bool parse(); - - protected: - HlslGrammar(); - HlslGrammar& operator=(const HlslGrammar&); - - void expected(const char*); - void unimplemented(const char*); - bool acceptIdentifier(HlslToken&); - bool acceptCompilationUnit(); - bool acceptDeclarationList(TIntermNode*&); - bool acceptDeclaration(TIntermNode*&); - bool acceptControlDeclaration(TIntermNode*& node); - bool acceptSamplerDeclarationDX9(TType&); - bool acceptSamplerState(); - bool acceptFullySpecifiedType(TType&, const TAttributes&); - bool acceptFullySpecifiedType(TType&, TIntermNode*& nodeList, const TAttributes&, bool forbidDeclarators = false); - bool acceptQualifier(TQualifier&); - bool acceptLayoutQualifierList(TQualifier&); - bool acceptType(TType&); - bool acceptType(TType&, TIntermNode*& nodeList); - bool acceptTemplateVecMatBasicType(TBasicType&, TPrecisionQualifier&); - bool acceptVectorTemplateType(TType&); - bool acceptMatrixTemplateType(TType&); - bool acceptTessellationDeclType(TBuiltInVariable&); - bool acceptTessellationPatchTemplateType(TType&); - bool acceptStreamOutTemplateType(TType&, TLayoutGeometry&); - bool acceptOutputPrimitiveGeometry(TLayoutGeometry&); - bool acceptAnnotations(TQualifier&); - bool acceptSamplerTypeDX9(TType &); - bool acceptSamplerType(TType&); - bool acceptTextureType(TType&); - bool acceptSubpassInputType(TType&); - bool acceptStructBufferType(TType&); - bool acceptTextureBufferType(TType&); - bool acceptConstantBufferType(TType&); - bool acceptStruct(TType&, TIntermNode*& nodeList); - bool acceptStructDeclarationList(TTypeList*&, TIntermNode*& nodeList, TVector&); - bool acceptMemberFunctionDefinition(TIntermNode*& nodeList, const TType&, TString& memberName, - TFunctionDeclarator&); - bool acceptFunctionParameters(TFunction&); - bool acceptParameterDeclaration(TFunction&); - bool acceptFunctionDefinition(TFunctionDeclarator&, TIntermNode*& nodeList, TVector* deferredTokens); - bool acceptFunctionBody(TFunctionDeclarator& declarator, TIntermNode*& nodeList); - bool acceptParenExpression(TIntermTyped*&); - bool acceptExpression(TIntermTyped*&); - bool acceptInitializer(TIntermTyped*&); - bool acceptAssignmentExpression(TIntermTyped*&); - bool acceptConditionalExpression(TIntermTyped*&); - bool acceptBinaryExpression(TIntermTyped*&, PrecedenceLevel); - bool acceptUnaryExpression(TIntermTyped*&); - bool acceptPostfixExpression(TIntermTyped*&); - bool acceptConstructor(TIntermTyped*&); - bool acceptFunctionCall(const TSourceLoc&, TString& name, TIntermTyped*&, TIntermTyped* objectBase); - bool acceptArguments(TFunction*, TIntermTyped*&); - bool acceptLiteral(TIntermTyped*&); - bool acceptSimpleStatement(TIntermNode*&); - bool acceptCompoundStatement(TIntermNode*&); - bool acceptScopedStatement(TIntermNode*&); - bool acceptScopedCompoundStatement(TIntermNode*&); - bool acceptStatement(TIntermNode*&); - bool acceptNestedStatement(TIntermNode*&); - void acceptAttributes(TAttributes&); - bool acceptSelectionStatement(TIntermNode*&, const TAttributes&); - bool acceptSwitchStatement(TIntermNode*&, const TAttributes&); - bool acceptIterationStatement(TIntermNode*&, const TAttributes&); - bool acceptJumpStatement(TIntermNode*&); - bool acceptCaseLabel(TIntermNode*&); - bool acceptDefaultLabel(TIntermNode*&); - void acceptArraySpecifier(TArraySizes*&); - bool acceptPostDecls(TQualifier&); - bool acceptDefaultParameterDeclaration(const TType&, TIntermTyped*&); - - bool captureBlockTokens(TVector& tokens); - const char* getTypeString(EHlslTokenClass tokenClass) const; - - HlslParseContext& parseContext; // state of parsing and helper functions for building the intermediate - TIntermediate& intermediate; // the final product, the intermediate representation, includes the AST - bool typeIdentifiers; // shader uses some types as identifiers - TIntermNode* unitNode; - }; - -} // end namespace glslang - -#endif // HLSLGRAMMAR_H_ diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/HLSL/hlslOpMap.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/HLSL/hlslOpMap.h deleted file mode 100644 index 4e783f3..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/HLSL/hlslOpMap.h +++ /dev/null @@ -1,69 +0,0 @@ -// -// 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/prebuilt/x86_64-unknown-linux-gnu/include/glslang/HLSL/hlslParseHelper.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/HLSL/hlslParseHelper.h deleted file mode 100644 index 97c52d4..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/HLSL/hlslParseHelper.h +++ /dev/null @@ -1,517 +0,0 @@ -// -// Copyright (C) 2016-2018 Google, Inc. -// 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 HLSL_PARSE_INCLUDED_ -#define HLSL_PARSE_INCLUDED_ - -#include "../MachineIndependent/parseVersions.h" -#include "../MachineIndependent/ParseHelper.h" -#include "../MachineIndependent/attribute.h" - -#include - -namespace glslang { - -class TFunctionDeclarator; - -class HlslParseContext : public TParseContextBase { -public: - HlslParseContext(TSymbolTable&, TIntermediate&, bool parsingBuiltins, - int version, EProfile, const SpvVersion& spvVersion, EShLanguage, TInfoSink&, - const TString sourceEntryPointName, - bool forwardCompatible = false, EShMessages messages = EShMsgDefault); - virtual ~HlslParseContext(); - void initializeExtensionBehavior() override; - - void setLimits(const TBuiltInResource&) override; - bool parseShaderStrings(TPpContext&, TInputScanner& input, bool versionWillBeError = false) override; - virtual const char* getGlobalUniformBlockName() const override { return "$Global"; } - virtual void setUniformBlockDefaults(TType& block) const override - { - block.getQualifier().layoutPacking = globalUniformDefaults.layoutPacking; - block.getQualifier().layoutMatrix = globalUniformDefaults.layoutMatrix; - } - - void reservedPpErrorCheck(const TSourceLoc&, const char* /*name*/, const char* /*op*/) override { } - bool lineContinuationCheck(const TSourceLoc&, bool /*endOfComment*/) override { return true; } - bool lineDirectiveShouldSetNextLine() const override { return true; } - bool builtInName(const TString&); - - void handlePragma(const TSourceLoc&, const TVector&) override; - TIntermTyped* handleVariable(const TSourceLoc&, const TString* string); - TIntermTyped* handleBracketDereference(const TSourceLoc&, TIntermTyped* base, TIntermTyped* index); - TIntermTyped* handleBracketOperator(const TSourceLoc&, TIntermTyped* base, TIntermTyped* index); - - 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); - bool isBuiltInMethod(const TSourceLoc&, TIntermTyped* base, const TString& field); - void assignToInterface(TVariable& variable); - void handleFunctionDeclarator(const TSourceLoc&, TFunction& function, bool prototype); - TIntermAggregate* handleFunctionDefinition(const TSourceLoc&, TFunction&, const TAttributes&, TIntermNode*& entryPointTree); - TIntermNode* transformEntryPoint(const TSourceLoc&, TFunction&, const TAttributes&); - void handleEntryPointAttributes(const TSourceLoc&, const TAttributes&); - void transferTypeAttributes(const TSourceLoc&, const TAttributes&, TType&, bool allowEntry = false); - void handleFunctionBody(const TSourceLoc&, TFunction&, TIntermNode* functionBody, TIntermNode*& node); - void remapEntryPointIO(TFunction& function, TVariable*& returnValue, TVector& inputs, TVector& outputs); - void remapNonEntryPointIO(TFunction& function); - TIntermNode* handleDeclare(const TSourceLoc&, TIntermTyped*); - TIntermNode* handleReturnValue(const TSourceLoc&, TIntermTyped*); - void handleFunctionArgument(TFunction*, TIntermTyped*& arguments, TIntermTyped* newArg); - TIntermTyped* handleAssign(const TSourceLoc&, TOperator, TIntermTyped* left, TIntermTyped* right); - TIntermTyped* handleAssignToMatrixSwizzle(const TSourceLoc&, TOperator, TIntermTyped* left, TIntermTyped* right); - TIntermTyped* handleFunctionCall(const TSourceLoc&, TFunction*, TIntermTyped*); - TIntermAggregate* assignClipCullDistance(const TSourceLoc&, TOperator, int semanticId, TIntermTyped* left, TIntermTyped* right); - TIntermTyped* assignPosition(const TSourceLoc&, TOperator, TIntermTyped* left, TIntermTyped* right); - TIntermTyped* assignFromFragCoord(const TSourceLoc&, TOperator, TIntermTyped* left, TIntermTyped* right); - void decomposeIntrinsic(const TSourceLoc&, TIntermTyped*& node, TIntermNode* arguments); - void decomposeSampleMethods(const TSourceLoc&, TIntermTyped*& node, TIntermNode* arguments); - void decomposeStructBufferMethods(const TSourceLoc&, TIntermTyped*& node, TIntermNode* arguments); - void decomposeGeometryMethods(const TSourceLoc&, TIntermTyped*& node, TIntermNode* arguments); - void pushFrontArguments(TIntermTyped* front, TIntermTyped*& arguments); - void addInputArgumentConversions(const TFunction&, TIntermTyped*&); - void expandArguments(const TSourceLoc&, const TFunction&, TIntermTyped*&); - TIntermTyped* addOutputArgumentConversions(const TFunction&, TIntermOperator&); - void builtInOpCheck(const TSourceLoc&, const TFunction&, TIntermOperator&); - TFunction* makeConstructorCall(const TSourceLoc&, const TType&); - void handleSemantic(TSourceLoc, TQualifier&, TBuiltInVariable, const TString& upperCase); - void handlePackOffset(const TSourceLoc&, TQualifier&, const glslang::TString& location, - const glslang::TString* component); - void handleRegister(const TSourceLoc&, TQualifier&, const glslang::TString* profile, const glslang::TString& desc, - int subComponent, const glslang::TString*); - TIntermTyped* convertConditionalExpression(const TSourceLoc&, TIntermTyped*, bool mustBeScalar = true); - TIntermAggregate* handleSamplerTextureCombine(const TSourceLoc& loc, TIntermTyped* argTex, TIntermTyped* argSampler); - - bool parseMatrixSwizzleSelector(const TSourceLoc&, const TString&, int cols, int rows, TSwizzleSelectors&); - int getMatrixComponentsColumn(int rows, const TSwizzleSelectors&); - 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&); - void arraySizeCheck(const TSourceLoc&, TIntermTyped* expr, TArraySize&); - void arraySizeRequiredCheck(const TSourceLoc&, const TArraySizes&); - void structArrayCheck(const TSourceLoc&, const TType& structure); - bool voidErrorCheck(const TSourceLoc&, const TString&, TBasicType); - void globalQualifierFix(const TSourceLoc&, TQualifier&); - bool structQualifierErrorCheck(const TSourceLoc&, const TPublicType& pType); - void mergeQualifiers(TQualifier& dst, const TQualifier& src); - int computeSamplerTypeIndex(TSampler&); - TSymbol* redeclareBuiltinVariable(const TSourceLoc&, const TString&, const TQualifier&, const TShaderQualifiers&); - void paramFix(TType& type); - void specializationCheck(const TSourceLoc&, const TType&, const char* op); - - void setLayoutQualifier(const TSourceLoc&, TQualifier&, TString&); - void setLayoutQualifier(const TSourceLoc&, TQualifier&, TString&, const TIntermTyped*); - void setSpecConstantId(const TSourceLoc&, TQualifier&, int value); - void mergeObjectLayoutQualifiers(TQualifier& dest, const TQualifier& src, bool inheritOnly); - void checkNoShaderLayouts(const TSourceLoc&, const TShaderQualifiers&); - - const TFunction* findFunction(const TSourceLoc& loc, TFunction& call, bool& builtIn, int& thisDepth, TIntermTyped*& args); - void addGenMulArgumentConversion(const TSourceLoc& loc, TFunction& call, TIntermTyped*& args); - void declareTypedef(const TSourceLoc&, const TString& identifier, const TType&); - void declareStruct(const TSourceLoc&, TString& structName, TType&); - TSymbol* lookupUserType(const TString&, TType&); - TIntermNode* declareVariable(const TSourceLoc&, const TString& identifier, TType&, TIntermTyped* initializer = nullptr); - void lengthenList(const TSourceLoc&, TIntermSequence& list, int size, TIntermTyped* scalarInit); - TIntermTyped* handleConstructor(const TSourceLoc&, TIntermTyped*, const TType&); - TIntermTyped* addConstructor(const TSourceLoc&, TIntermTyped*, const TType&); - TIntermTyped* convertArray(TIntermTyped*, const TType&); - TIntermTyped* constructAggregate(TIntermNode*, const TType&, int, const TSourceLoc&); - TIntermTyped* constructBuiltIn(const TType&, TOperator, TIntermTyped*, const TSourceLoc&, bool subset); - void declareBlock(const TSourceLoc&, TType&, const TString* instanceName = nullptr); - void declareStructBufferCounter(const TSourceLoc& loc, const TType& bufferType, const TString& name); - void fixBlockLocations(const TSourceLoc&, TQualifier&, TTypeList&, bool memberWithLocation, bool memberWithoutLocation); - void fixXfbOffsets(TQualifier&, TTypeList&); - void fixBlockUniformOffsets(const 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, const TAttributes&); - - void nestLooping() { ++loopNestingLevel; } - void unnestLooping() { --loopNestingLevel; } - void nestAnnotations() { ++annotationNestingLevel; } - void unnestAnnotations() { --annotationNestingLevel; } - int getAnnotationNestingLevel() { return annotationNestingLevel; } - void pushScope() { symbolTable.push(); } - void popScope() { symbolTable.pop(nullptr); } - - void pushThisScope(const TType&, const TVector&); - void popThisScope() { symbolTable.pop(nullptr); } - - void pushImplicitThis(TVariable* thisParameter) { implicitThisStack.push_back(thisParameter); } - void popImplicitThis() { implicitThisStack.pop_back(); } - TVariable* getImplicitThis(int thisDepth) const { return implicitThisStack[implicitThisStack.size() - thisDepth]; } - - void pushNamespace(const TString& name); - void popNamespace(); - void getFullNamespaceName(TString*&) const; - void addScopeMangler(TString&); - - void beginParameterParsing(TFunction& function) - { - parsingEntrypointParameters = isEntrypointName(function.getName()); - } - - void pushSwitchSequence(TIntermSequence* sequence) { switchSequenceStack.push_back(sequence); } - void popSwitchSequence() { switchSequenceStack.pop_back(); } - - virtual void growGlobalUniformBlock(const TSourceLoc&, TType&, const TString& memberName, - TTypeList* typeList = nullptr) override; - - // Apply L-value conversions. E.g, turning a write to a RWTexture into an ImageStore. - TIntermTyped* handleLvalue(const TSourceLoc&, const char* op, TIntermTyped*& node); - bool lValueErrorCheck(const TSourceLoc&, const char* op, TIntermTyped*) override; - - TLayoutFormat getLayoutFromTxType(const TSourceLoc&, const TType&); - - bool handleOutputGeometry(const TSourceLoc&, const TLayoutGeometry& geometry); - bool handleInputGeometry(const TSourceLoc&, const TLayoutGeometry& geometry); - - // Determine selection control from attributes - void handleSelectionAttributes(const TSourceLoc& loc, TIntermSelection*, const TAttributes& attributes); - void handleSwitchAttributes(const TSourceLoc& loc, TIntermSwitch*, const TAttributes& attributes); - - // Determine loop control from attributes - void handleLoopAttributes(const TSourceLoc& loc, TIntermLoop*, const TAttributes& attributes); - - // Share struct buffer deep types - void shareStructBufferType(TType&); - - // Set texture return type of the given sampler. Returns success (not all types are valid). - bool setTextureReturnType(TSampler& sampler, const TType& retType, const TSourceLoc& loc); - - // Obtain the sampler return type of the given sampler in retType. - void getTextureReturnType(const TSampler& sampler, TType& retType) const; - - TAttributeType attributeFromName(const TString& nameSpace, const TString& name) const; - -protected: - struct TFlattenData { - TFlattenData() : nextBinding(TQualifier::layoutBindingEnd), - nextLocation(TQualifier::layoutLocationEnd) { } - TFlattenData(int nb, int nl) : nextBinding(nb), nextLocation(nl) { } - - TVector members; // individual flattened variables - TVector offsets; // offset to next tree level - unsigned int nextBinding; // next binding to use. - unsigned int nextLocation; // next location to use - }; - - void fixConstInit(const TSourceLoc&, const TString& identifier, TType& type, TIntermTyped*& initializer); - void inheritGlobalDefaults(TQualifier& dst) const; - TVariable* makeInternalVariable(const char* name, const TType&) const; - TVariable* makeInternalVariable(const TString& name, const TType& type) const { - return makeInternalVariable(name.c_str(), type); - } - TIntermSymbol* makeInternalVariableNode(const TSourceLoc&, const char* name, const TType&) const; - TVariable* declareNonArray(const TSourceLoc&, const TString& identifier, const TType&, bool track); - void declareArray(const TSourceLoc&, const TString& identifier, const TType&, TSymbol*&, bool track); - TIntermNode* executeDeclaration(const TSourceLoc&, TVariable* variable); - TIntermNode* executeInitializer(const TSourceLoc&, TIntermTyped* initializer, TVariable* variable); - TIntermTyped* convertInitializerList(const TSourceLoc&, const TType&, TIntermTyped* initializer, TIntermTyped* scalarInit); - bool isScalarConstructor(const TIntermNode*); - TOperator mapAtomicOp(const TSourceLoc& loc, TOperator op, bool isImage); - bool isEntrypointName(const TString& name) { return name.compare(intermediate.getEntryPointName().c_str()) == 0; } - - // Return true if this node requires L-value conversion (e.g, to an imageStore). - bool shouldConvertLValue(const TIntermNode*) const; - - // Array and struct flattening - TIntermTyped* flattenAccess(TIntermTyped* base, int member); - TIntermTyped* flattenAccess(long long uniqueId, int member, TStorageQualifier outerStorage, const TType&, int subset = -1); - int findSubtreeOffset(const TIntermNode&) const; - int findSubtreeOffset(const TType&, int subset, const TVector& offsets) const; - bool shouldFlatten(const TType&, TStorageQualifier, bool topLevel) const; - bool wasFlattened(const TIntermTyped* node) const; - bool wasFlattened(long long id) const { return flattenMap.find(id) != flattenMap.end(); } - int addFlattenedMember(const TVariable&, const TType&, TFlattenData&, const TString& name, bool linkage, - const TQualifier& outerQualifier, const TArraySizes* builtInArraySizes); - - // Structure splitting (splits interstage built-in types into its own struct) - void split(const TVariable&); - void splitBuiltIn(const TString& baseName, const TType& memberType, const TArraySizes*, const TQualifier&); - const TType& split(const TType& type, const TString& name, const TQualifier&); - bool wasSplit(const TIntermTyped* node) const; - bool wasSplit(long long id) const { return splitNonIoVars.find(id) != splitNonIoVars.end(); } - TVariable* getSplitNonIoVar(long long id) const; - void addPatchConstantInvocation(); - void fixTextureShadowModes(); - void finalizeAppendMethods(); - TIntermTyped* makeIntegerIndex(TIntermTyped*); - - void fixBuiltInIoType(TType&); - - void flatten(const TVariable& variable, bool linkage, bool arrayed = false); - int flatten(const TVariable& variable, const TType&, TFlattenData&, TString name, bool linkage, - const TQualifier& outerQualifier, const TArraySizes* builtInArraySizes); - int flattenStruct(const TVariable& variable, const TType&, TFlattenData&, TString name, bool linkage, - const TQualifier& outerQualifier, const TArraySizes* builtInArraySizes); - int flattenArray(const TVariable& variable, const TType&, TFlattenData&, TString name, bool linkage, - const TQualifier& outerQualifier); - - bool hasUniform(const TQualifier& qualifier) const; - void clearUniform(TQualifier& qualifier); - bool isInputBuiltIn(const TQualifier& qualifier) const; - bool hasInput(const TQualifier& qualifier) const; - void correctOutput(TQualifier& qualifier); - bool isOutputBuiltIn(const TQualifier& qualifier) const; - bool hasOutput(const TQualifier& qualifier) const; - void correctInput(TQualifier& qualifier); - void correctUniform(TQualifier& qualifier); - void clearUniformInputOutput(TQualifier& qualifier); - - // Test method names - bool isStructBufferMethod(const TString& name) const; - void counterBufferType(const TSourceLoc& loc, TType& type); - - // Return standard sample position array - TIntermConstantUnion* getSamplePosArray(int count); - - TType* getStructBufferContentType(const TType& type) const; - bool isStructBufferType(const TType& type) const { return getStructBufferContentType(type) != nullptr; } - TIntermTyped* indexStructBufferContent(const TSourceLoc& loc, TIntermTyped* buffer) const; - TIntermTyped* getStructBufferCounter(const TSourceLoc& loc, TIntermTyped* buffer); - TString getStructBuffCounterName(const TString&) const; - void addStructBuffArguments(const TSourceLoc& loc, TIntermAggregate*&); - void addStructBufferHiddenCounterParam(const TSourceLoc& loc, TParameter&, TIntermAggregate*&); - - // Return true if this type is a reference. This is not currently a type method in case that's - // a language specific answer. - bool isReference(const TType& type) const { return isStructBufferType(type); } - - // Return true if this a buffer type that has an associated counter buffer. - bool hasStructBuffCounter(const TType&) const; - - // Finalization step: remove unused buffer blocks from linkage (we don't know until the - // shader is entirely compiled) - void removeUnusedStructBufferCounters(); - - static bool isClipOrCullDistance(TBuiltInVariable); - static bool isClipOrCullDistance(const TQualifier& qual) { return isClipOrCullDistance(qual.builtIn); } - static bool isClipOrCullDistance(const TType& type) { return isClipOrCullDistance(type.getQualifier()); } - - // Find the patch constant function (issues error, returns nullptr if not found) - const TFunction* findPatchConstantFunction(const TSourceLoc& loc); - - // Pass through to base class after remembering built-in mappings. - using TParseContextBase::trackLinkage; - void trackLinkage(TSymbol& variable) override; - - void finish() override; // post-processing - - // Linkage symbol helpers - TIntermSymbol* findTessLinkageSymbol(TBuiltInVariable biType) const; - - // Current state of parsing - int annotationNestingLevel; // 0 if outside all annotations - - HlslParseContext(HlslParseContext&); - HlslParseContext& operator=(HlslParseContext&); - - static const int maxSamplerIndex = EsdNumDims * (EbtNumTypes * (2 * 2 * 2)); // see computeSamplerTypeIndex() - 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; - - TMap flattenMap; - - // IO-type map. Maps a pure symbol-table form of a structure-member list into - // each of the (up to) three kinds of IO, as each as different allowed decorations, - // but HLSL allows mixing all in the same structure. - struct tIoKinds { - TTypeList* input; - TTypeList* output; - TTypeList* uniform; - }; - TMap ioTypeMap; - - // Structure splitting data: - TMap splitNonIoVars; // variables with the built-in interstage IO removed, indexed by unique ID. - - // Structuredbuffer shared types. Typically there are only a few. - TVector structBufferTypes; - - // This tracks texture sample user structure return types. Only a limited number are supported, as - // may fit in TSampler::structReturnIndex. - TVector textureReturnStruct; - - TMap structBufferCounter; // true if counter buffer is in use - - // The built-in interstage IO map considers e.g, EvqPosition on input and output separately, so that we - // can build the linkage correctly if position appears on both sides. Otherwise, multiple positions - // are considered identical. - struct tInterstageIoData { - tInterstageIoData(TBuiltInVariable bi, TStorageQualifier q) : - builtIn(bi), storage(q) { } - - TBuiltInVariable builtIn; - TStorageQualifier storage; - - // ordering for maps - bool operator<(const tInterstageIoData d) const { - return (builtIn != d.builtIn) ? (builtIn < d.builtIn) : (storage < d.storage); - } - }; - - TMap splitBuiltIns; // split built-ins, indexed by built-in type. - TVariable* inputPatch; // input patch is special for PCF: it's the only non-builtin PCF input, - // and is handled as a pseudo-builtin. - - unsigned int nextInLocation; - unsigned int nextOutLocation; - - TFunction* entryPointFunction; - TIntermNode* entryPointFunctionBody; - - TString patchConstantFunctionName; // hull shader patch constant function name, from function level attribute. - TMap builtInTessLinkageSymbols; // used for tessellation, finding declared built-ins - - TVector currentTypePrefix; // current scoping prefix for nested structures - TVector implicitThisStack; // currently active 'this' variables for nested structures - - TVariable* gsStreamOutput; // geometry shader stream outputs, for emit (Append method) - - TVariable* clipDistanceOutput; // synthesized clip distance out variable (shader might have >1) - TVariable* cullDistanceOutput; // synthesized cull distance out variable (shader might have >1) - TVariable* clipDistanceInput; // synthesized clip distance in variable (shader might have >1) - TVariable* cullDistanceInput; // synthesized cull distance in variable (shader might have >1) - - static const int maxClipCullRegs = 2; - std::array clipSemanticNSizeIn; // vector, indexed by clip semantic ID - std::array cullSemanticNSizeIn; // vector, indexed by cull semantic ID - std::array clipSemanticNSizeOut; // vector, indexed by clip semantic ID - std::array cullSemanticNSizeOut; // vector, indexed by cull semantic ID - - // This tracks the first (mip level) argument to the .mips[][] operator. Since this can be nested as - // in tx.mips[tx.mips[0][1].x][2], we need a stack. We also track the TSourceLoc for error reporting - // purposes. - struct tMipsOperatorData { - tMipsOperatorData(TSourceLoc l, TIntermTyped* m) : loc(l), mipLevel(m) { } - TSourceLoc loc; - TIntermTyped* mipLevel; - }; - - TVector mipsOperatorMipArg; - - // The geometry output stream is not copied out from the entry point as a typical output variable - // is. It's written via EmitVertex (hlsl=Append), which may happen in arbitrary control flow. - // For this we need the real output symbol. Since it may not be known at the time and Append() - // method is parsed, the sequence will be patched during finalization. - struct tGsAppendData { - TIntermAggregate* node; - TSourceLoc loc; - }; - - TVector gsAppends; - - // A texture object may be used with shadow and non-shadow samplers, but both may not be - // alive post-DCE in the same shader. We do not know at compilation time which are alive: that's - // only known post-DCE. If a texture is used both ways, we create two textures, and - // leave the elimiation of one to the optimizer. This maps the shader variant to - // the shadow variant. - // - // This can be removed if and when the texture shadow code in - // HlslParseContext::handleSamplerTextureCombine is removed. - struct tShadowTextureSymbols { - tShadowTextureSymbols() { symId.fill(-1); } - - void set(bool shadow, long long id) { symId[int(shadow)] = id; } - long long get(bool shadow) const { return symId[int(shadow)]; } - - // True if this texture has been seen with both shadow and non-shadow modes - bool overloaded() const { return symId[0] != -1 && symId[1] != -1; } - bool isShadowId(long long id) const { return symId[1] == id; } - - private: - std::array symId; - }; - - TMap textureShadowVariant; - bool parsingEntrypointParameters; -}; - -// This is the prefix we use for built-in methods to avoid namespace collisions with -// global scope user functions. -// TODO: this would be better as a nonparseable character, but that would -// require changing the scanner. -#define BUILTIN_PREFIX "__BI_" - -} // end namespace glslang - -#endif // HLSL_PARSE_INCLUDED_ diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/HLSL/hlslParseables.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/HLSL/hlslParseables.h deleted file mode 100644 index a4aef6c..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/HLSL/hlslParseables.h +++ /dev/null @@ -1,64 +0,0 @@ -// -// 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 "../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, const SpvVersion& spvVersion); - void initialize(const TBuiltInResource& resources, int version, EProfile, const SpvVersion& spvVersion, EShLanguage); - - void identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable); - - void identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources); - -private: - void createMatTimesMat(); -}; - -} // end namespace glslang - -#endif // _HLSLPARSEABLES_INCLUDED_ diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/HLSL/hlslScanContext.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/HLSL/hlslScanContext.h deleted file mode 100644 index 3b191e4..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/HLSL/hlslScanContext.h +++ /dev/null @@ -1,109 +0,0 @@ -// -// 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 HLSL scanner, which -// sits between the preprocessor scanner and HLSL parser. -// - -#ifndef HLSLSCANCONTEXT_H_ -#define HLSLSCANCONTEXT_H_ - -#include "../MachineIndependent/ParseHelper.h" -#include "hlslTokens.h" - -namespace glslang { - -class TPpContext; -class TPpToken; - - -// -// Everything needed to fully describe a token. -// -struct HlslToken { - HlslToken() : string(nullptr) { loc.init(); } - TSourceLoc loc; // location of token in the source - EHlslTokenClass tokenClass; // what kind of token it is - union { // what data the token holds - glslang::TString *string; // for identifiers - int i; // for literals - unsigned int u; - bool b; - double d; - }; -}; - -// -// 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) - : parseContext(parseContext), ppContext(ppContext) { } - virtual ~HlslScanContext() { } - - static void fillInKeywordMap(); - static void deleteKeywordMap(); - - void tokenize(HlslToken&); - glslang::TBuiltInVariable mapSemantic(const char*); - -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; - TSourceLoc loc; - TPpToken* ppToken; - HlslToken* parserToken; - - const char* tokenText; - EHlslTokenClass keyword; -}; - -} // end namespace glslang - -#endif // HLSLSCANCONTEXT_H_ diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/HLSL/hlslTokenStream.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/HLSL/hlslTokenStream.h deleted file mode 100644 index cb6c9e7..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/HLSL/hlslTokenStream.h +++ /dev/null @@ -1,96 +0,0 @@ -// -// 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: - explicit HlslTokenStream(HlslScanContext& scanner) - : scanner(scanner), preTokenStackSize(0), tokenBufferPos(0) { } - virtual ~HlslTokenStream() { } - - public: - void advanceToken(); - void recedeToken(); - bool acceptTokenClass(EHlslTokenClass); - EHlslTokenClass peek() const; - bool peekTokenClass(EHlslTokenClass) const; - glslang::TBuiltInVariable mapSemantic(const char* upperCase) { return scanner.mapSemantic(upperCase); } - - void pushTokenStream(const TVector* tokens); - void popTokenStream(); - - protected: - HlslToken token; // the token we are currently looking at, but have not yet accepted - - private: - HlslTokenStream(); - HlslTokenStream& operator=(const HlslTokenStream&); - - HlslScanContext& scanner; // lexical scanner, to get next token from source file - TVector*> tokenStreamStack; // for getting the next token from an existing vector of tokens - TVector tokenPosition; - TVector currentTokenStack; - - // This is the number of tokens we can recedeToken() over. - static const int tokenBufferSize = 2; - - // 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 2. - HlslToken preTokenStack[tokenBufferSize]; - int preTokenStackSize; - void pushPreToken(const HlslToken&); - HlslToken popPreToken(); - - // Previously scanned tokens, not yet returned 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 2. - HlslToken tokenBuffer[tokenBufferSize]; - int tokenBufferPos; - void pushTokenBuffer(const HlslToken&); - HlslToken popTokenBuffer(); - }; - -} // end namespace glslang - -#endif // HLSLTOKENSTREAM_H_ diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/HLSL/hlslTokens.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/HLSL/hlslTokens.h deleted file mode 100644 index a7c1299..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/HLSL/hlslTokens.h +++ /dev/null @@ -1,454 +0,0 @@ -// -// Copyright (C) 2016 Google, Inc. -// 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 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, - EHTokPrecise, - EHTokShared, - EHTokGroupShared, - EHTokLinear, - EHTokCentroid, - EHTokNointerpolation, - EHTokNoperspective, - EHTokSample, - EHTokRowMajor, - EHTokColumnMajor, - EHTokPackOffset, - EHTokIn, - EHTokOut, - EHTokInOut, - EHTokLayout, - EHTokGloballyCoherent, - EHTokInline, - - // primitive types - EHTokPoint, - EHTokLine, - EHTokTriangle, - EHTokLineAdj, - EHTokTriangleAdj, - - // stream out types - EHTokPointStream, - EHTokLineStream, - EHTokTriangleStream, - - // Tessellation patches - EHTokInputPatch, - EHTokOutputPatch, - - // template types - EHTokBuffer, - EHTokVector, - EHTokMatrix, - - // scalar types - EHTokVoid, - EHTokString, - EHTokBool, - EHTokInt, - EHTokUint, - EHTokUint64, - 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, - EHTokHalf1, - EHTokHalf2, - EHTokHalf3, - EHTokHalf4, - EHTokMin16float1, - EHTokMin16float2, - EHTokMin16float3, - EHTokMin16float4, - EHTokMin10float1, - EHTokMin10float2, - EHTokMin10float3, - EHTokMin10float4, - EHTokMin16int1, - EHTokMin16int2, - EHTokMin16int3, - EHTokMin16int4, - EHTokMin12int1, - EHTokMin12int2, - EHTokMin12int3, - EHTokMin12int4, - EHTokMin16uint1, - EHTokMin16uint2, - EHTokMin16uint3, - EHTokMin16uint4, - - // matrix types - EHTokInt1x1, - EHTokInt1x2, - EHTokInt1x3, - EHTokInt1x4, - EHTokInt2x1, - EHTokInt2x2, - EHTokInt2x3, - EHTokInt2x4, - EHTokInt3x1, - EHTokInt3x2, - EHTokInt3x3, - EHTokInt3x4, - EHTokInt4x1, - EHTokInt4x2, - EHTokInt4x3, - EHTokInt4x4, - EHTokUint1x1, - EHTokUint1x2, - EHTokUint1x3, - EHTokUint1x4, - EHTokUint2x1, - EHTokUint2x2, - EHTokUint2x3, - EHTokUint2x4, - EHTokUint3x1, - EHTokUint3x2, - EHTokUint3x3, - EHTokUint3x4, - EHTokUint4x1, - EHTokUint4x2, - EHTokUint4x3, - EHTokUint4x4, - EHTokBool1x1, - EHTokBool1x2, - EHTokBool1x3, - EHTokBool1x4, - EHTokBool2x1, - EHTokBool2x2, - EHTokBool2x3, - EHTokBool2x4, - EHTokBool3x1, - EHTokBool3x2, - EHTokBool3x3, - EHTokBool3x4, - EHTokBool4x1, - EHTokBool4x2, - EHTokBool4x3, - EHTokBool4x4, - EHTokFloat1x1, - EHTokFloat1x2, - EHTokFloat1x3, - EHTokFloat1x4, - EHTokFloat2x1, - EHTokFloat2x2, - EHTokFloat2x3, - EHTokFloat2x4, - EHTokFloat3x1, - EHTokFloat3x2, - EHTokFloat3x3, - EHTokFloat3x4, - EHTokFloat4x1, - EHTokFloat4x2, - EHTokFloat4x3, - EHTokFloat4x4, - EHTokHalf1x1, - EHTokHalf1x2, - EHTokHalf1x3, - EHTokHalf1x4, - EHTokHalf2x1, - EHTokHalf2x2, - EHTokHalf2x3, - EHTokHalf2x4, - EHTokHalf3x1, - EHTokHalf3x2, - EHTokHalf3x3, - EHTokHalf3x4, - EHTokHalf4x1, - EHTokHalf4x2, - EHTokHalf4x3, - EHTokHalf4x4, - EHTokDouble1x1, - EHTokDouble1x2, - EHTokDouble1x3, - EHTokDouble1x4, - EHTokDouble2x1, - EHTokDouble2x2, - EHTokDouble2x3, - EHTokDouble2x4, - EHTokDouble3x1, - EHTokDouble3x2, - EHTokDouble3x3, - EHTokDouble3x4, - EHTokDouble4x1, - EHTokDouble4x2, - EHTokDouble4x3, - EHTokDouble4x4, - EHTokMin16float1x1, - EHTokMin16float1x2, - EHTokMin16float1x3, - EHTokMin16float1x4, - EHTokMin16float2x1, - EHTokMin16float2x2, - EHTokMin16float2x3, - EHTokMin16float2x4, - EHTokMin16float3x1, - EHTokMin16float3x2, - EHTokMin16float3x3, - EHTokMin16float3x4, - EHTokMin16float4x1, - EHTokMin16float4x2, - EHTokMin16float4x3, - EHTokMin16float4x4, - EHTokMin10float1x1, - EHTokMin10float1x2, - EHTokMin10float1x3, - EHTokMin10float1x4, - EHTokMin10float2x1, - EHTokMin10float2x2, - EHTokMin10float2x3, - EHTokMin10float2x4, - EHTokMin10float3x1, - EHTokMin10float3x2, - EHTokMin10float3x3, - EHTokMin10float3x4, - EHTokMin10float4x1, - EHTokMin10float4x2, - EHTokMin10float4x3, - EHTokMin10float4x4, - EHTokMin16int1x1, - EHTokMin16int1x2, - EHTokMin16int1x3, - EHTokMin16int1x4, - EHTokMin16int2x1, - EHTokMin16int2x2, - EHTokMin16int2x3, - EHTokMin16int2x4, - EHTokMin16int3x1, - EHTokMin16int3x2, - EHTokMin16int3x3, - EHTokMin16int3x4, - EHTokMin16int4x1, - EHTokMin16int4x2, - EHTokMin16int4x3, - EHTokMin16int4x4, - EHTokMin12int1x1, - EHTokMin12int1x2, - EHTokMin12int1x3, - EHTokMin12int1x4, - EHTokMin12int2x1, - EHTokMin12int2x2, - EHTokMin12int2x3, - EHTokMin12int2x4, - EHTokMin12int3x1, - EHTokMin12int3x2, - EHTokMin12int3x3, - EHTokMin12int3x4, - EHTokMin12int4x1, - EHTokMin12int4x2, - EHTokMin12int4x3, - EHTokMin12int4x4, - EHTokMin16uint1x1, - EHTokMin16uint1x2, - EHTokMin16uint1x3, - EHTokMin16uint1x4, - EHTokMin16uint2x1, - EHTokMin16uint2x2, - EHTokMin16uint2x3, - EHTokMin16uint2x4, - EHTokMin16uint3x1, - EHTokMin16uint3x2, - EHTokMin16uint3x3, - EHTokMin16uint3x4, - EHTokMin16uint4x1, - EHTokMin16uint4x2, - EHTokMin16uint4x3, - EHTokMin16uint4x4, - - // texturing types - EHTokSampler, - EHTokSampler1d, - EHTokSampler2d, - EHTokSampler3d, - EHTokSamplerCube, - EHTokSamplerState, - EHTokSamplerComparisonState, - EHTokTexture, - EHTokTexture1d, - EHTokTexture1darray, - EHTokTexture2d, - EHTokTexture2darray, - EHTokTexture3d, - EHTokTextureCube, - EHTokTextureCubearray, - EHTokTexture2DMS, - EHTokTexture2DMSarray, - EHTokRWTexture1d, - EHTokRWTexture1darray, - EHTokRWTexture2d, - EHTokRWTexture2darray, - EHTokRWTexture3d, - EHTokRWBuffer, - EHTokSubpassInput, - EHTokSubpassInputMS, - - // Structure buffer variants - EHTokAppendStructuredBuffer, - EHTokByteAddressBuffer, - EHTokConsumeStructuredBuffer, - EHTokRWByteAddressBuffer, - EHTokRWStructuredBuffer, - EHTokStructuredBuffer, - EHTokTextureBuffer, - - // variable, user type, ... - EHTokIdentifier, - EHTokClass, - EHTokStruct, - EHTokCBuffer, - EHTokTBuffer, - EHTokTypedef, - EHTokThis, - EHTokNamespace, - EHTokConstantBuffer, - - // constant - EHTokFloat16Constant, - EHTokFloatConstant, - EHTokDoubleConstant, - EHTokIntConstant, - EHTokUintConstant, - EHTokBoolConstant, - EHTokStringConstant, - - // 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, - EHTokAssign, - EHTokMulAssign, - EHTokDivAssign, - EHTokAddAssign, - EHTokModAssign, - EHTokLeftAssign, - EHTokRightAssign, - EHTokAndAssign, - EHTokXorAssign, - EHTokOrAssign, - EHTokSubAssign, - EHTokLeftParen, - EHTokRightParen, - EHTokLeftBracket, - EHTokRightBracket, - EHTokLeftBrace, - EHTokRightBrace, - EHTokDot, - EHTokComma, - EHTokColon, - EHTokColonColon, - EHTokSemicolon, - EHTokBang, - EHTokDash, - EHTokTilde, - EHTokPlus, - EHTokStar, - EHTokSlash, - EHTokPercent, - EHTokLeftAngle, - EHTokRightAngle, - EHTokVerticalBar, - EHTokCaret, - EHTokAmpersand, - EHTokQuestion, -}; - -} // end namespace glslang - -#endif // EHLSLTOKENS_H_ diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/BaseTypes.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/BaseTypes.h deleted file mode 100644 index cf93193..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/BaseTypes.h +++ /dev/null @@ -1,619 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2012-2013 LunarG, Inc. -// Copyright (C) 2017 ARM Limited. -// Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved. -// -// 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 _BASICTYPES_INCLUDED_ -#define _BASICTYPES_INCLUDED_ - -namespace glslang { - -// -// Basic type. Arrays, vectors, sampler details, etc., are orthogonal to this. -// -enum TBasicType { - EbtVoid, - EbtFloat, - EbtDouble, - EbtFloat16, - EbtInt8, - EbtUint8, - EbtInt16, - EbtUint16, - EbtInt, - EbtUint, - EbtInt64, - EbtUint64, - EbtBool, - EbtAtomicUint, - EbtSampler, - EbtStruct, - EbtBlock, - EbtAccStruct, - EbtReference, - EbtRayQuery, - EbtHitObjectNV, -#ifndef GLSLANG_WEB - // SPIR-V type defined by spirv_type - EbtSpirvType, -#endif - - // HLSL types that live only temporarily. - EbtString, - - EbtNumTypes -}; - -// -// Storage qualifiers. Should align with different kinds of storage or -// resource or GLSL storage qualifier. Expansion is deprecated. -// -// N.B.: You probably DON'T want to add anything here, but rather just add it -// to the built-in variables. See the comment above TBuiltInVariable. -// -// A new built-in variable will normally be an existing qualifier, like 'in', 'out', etc. -// DO NOT follow the design pattern of, say EvqInstanceId, etc. -// -enum TStorageQualifier { - EvqTemporary, // For temporaries (within a function), read/write - EvqGlobal, // For globals read/write - EvqConst, // User-defined constant values, will be semantically constant and constant folded - EvqVaryingIn, // pipeline input, read only, also supercategory for all built-ins not included in this enum (see TBuiltInVariable) - EvqVaryingOut, // pipeline output, read/write, also supercategory for all built-ins not included in this enum (see TBuiltInVariable) - EvqUniform, // read only, shared with app - EvqBuffer, // read/write, shared with app - EvqShared, // compute shader's read/write 'shared' qualifier -#ifndef GLSLANG_WEB - EvqSpirvStorageClass, // spirv_storage_class -#endif - - EvqPayload, - EvqPayloadIn, - EvqHitAttr, - EvqCallableData, - EvqCallableDataIn, - EvqHitObjectAttrNV, - - EvqtaskPayloadSharedEXT, - - // parameters - EvqIn, // also, for 'in' in the grammar before we know if it's a pipeline input or an 'in' parameter - EvqOut, // also, for 'out' in the grammar before we know if it's a pipeline output or an 'out' parameter - EvqInOut, - EvqConstReadOnly, // input; also other read-only types having neither a constant value nor constant-value semantics - - // built-ins read by vertex shader - EvqVertexId, - EvqInstanceId, - - // built-ins written by vertex shader - EvqPosition, - EvqPointSize, - EvqClipVertex, - - // built-ins read by fragment shader - EvqFace, - EvqFragCoord, - EvqPointCoord, - - // built-ins written by fragment shader - EvqFragColor, - EvqFragDepth, - EvqFragStencil, - - // end of list - EvqLast -}; - -// -// Subcategories of the TStorageQualifier, simply to give a direct mapping -// between built-in variable names and an numerical value (the enum). -// -// For backward compatibility, there is some redundancy between the -// TStorageQualifier and these. Existing members should both be maintained accurately. -// However, any new built-in variable (and any existing non-redundant one) -// must follow the pattern that the specific built-in is here, and only its -// general qualifier is in TStorageQualifier. -// -// Something like gl_Position, which is sometimes 'in' and sometimes 'out' -// shows up as two different built-in variables in a single stage, but -// only has a single enum in TBuiltInVariable, so both the -// TStorageQualifier and the TBuitinVariable are needed to distinguish -// between them. -// -enum TBuiltInVariable { - EbvNone, - EbvNumWorkGroups, - EbvWorkGroupSize, - EbvWorkGroupId, - EbvLocalInvocationId, - EbvGlobalInvocationId, - EbvLocalInvocationIndex, - EbvNumSubgroups, - EbvSubgroupID, - EbvSubGroupSize, - EbvSubGroupInvocation, - EbvSubGroupEqMask, - EbvSubGroupGeMask, - EbvSubGroupGtMask, - EbvSubGroupLeMask, - EbvSubGroupLtMask, - EbvSubgroupSize2, - EbvSubgroupInvocation2, - EbvSubgroupEqMask2, - EbvSubgroupGeMask2, - EbvSubgroupGtMask2, - EbvSubgroupLeMask2, - EbvSubgroupLtMask2, - EbvVertexId, - EbvInstanceId, - EbvVertexIndex, - EbvInstanceIndex, - EbvBaseVertex, - EbvBaseInstance, - EbvDrawId, - EbvPosition, - EbvPointSize, - EbvClipVertex, - EbvClipDistance, - EbvCullDistance, - EbvNormal, - EbvVertex, - EbvMultiTexCoord0, - EbvMultiTexCoord1, - EbvMultiTexCoord2, - EbvMultiTexCoord3, - EbvMultiTexCoord4, - EbvMultiTexCoord5, - EbvMultiTexCoord6, - EbvMultiTexCoord7, - EbvFrontColor, - EbvBackColor, - EbvFrontSecondaryColor, - EbvBackSecondaryColor, - EbvTexCoord, - EbvFogFragCoord, - EbvInvocationId, - EbvPrimitiveId, - EbvLayer, - EbvViewportIndex, - EbvPatchVertices, - EbvTessLevelOuter, - EbvTessLevelInner, - EbvBoundingBox, - EbvTessCoord, - EbvColor, - EbvSecondaryColor, - EbvFace, - EbvFragCoord, - EbvPointCoord, - EbvFragColor, - EbvFragData, - EbvFragDepth, - EbvFragStencilRef, - EbvSampleId, - EbvSamplePosition, - EbvSampleMask, - EbvHelperInvocation, - - EbvBaryCoordNoPersp, - EbvBaryCoordNoPerspCentroid, - EbvBaryCoordNoPerspSample, - EbvBaryCoordSmooth, - EbvBaryCoordSmoothCentroid, - EbvBaryCoordSmoothSample, - EbvBaryCoordPullModel, - - EbvViewIndex, - EbvDeviceIndex, - - EbvShadingRateKHR, - EbvPrimitiveShadingRateKHR, - - EbvFragSizeEXT, - EbvFragInvocationCountEXT, - - EbvSecondaryFragDataEXT, - EbvSecondaryFragColorEXT, - - EbvViewportMaskNV, - EbvSecondaryPositionNV, - EbvSecondaryViewportMaskNV, - EbvPositionPerViewNV, - EbvViewportMaskPerViewNV, - EbvFragFullyCoveredNV, - EbvFragmentSizeNV, - EbvInvocationsPerPixelNV, - // ray tracing - EbvLaunchId, - EbvLaunchSize, - EbvInstanceCustomIndex, - EbvGeometryIndex, - EbvWorldRayOrigin, - EbvWorldRayDirection, - EbvObjectRayOrigin, - EbvObjectRayDirection, - EbvRayTmin, - EbvRayTmax, - EbvCullMask, - EbvHitT, - EbvHitKind, - EbvObjectToWorld, - EbvObjectToWorld3x4, - EbvWorldToObject, - EbvWorldToObject3x4, - EbvIncomingRayFlags, - EbvCurrentRayTimeNV, - // barycentrics - EbvBaryCoordNV, - EbvBaryCoordNoPerspNV, - EbvBaryCoordEXT, - EbvBaryCoordNoPerspEXT, - // mesh shaders - EbvTaskCountNV, - EbvPrimitiveCountNV, - EbvPrimitiveIndicesNV, - EbvClipDistancePerViewNV, - EbvCullDistancePerViewNV, - EbvLayerPerViewNV, - EbvMeshViewCountNV, - EbvMeshViewIndicesNV, - //GL_EXT_mesh_shader - EbvPrimitivePointIndicesEXT, - EbvPrimitiveLineIndicesEXT, - EbvPrimitiveTriangleIndicesEXT, - EbvCullPrimitiveEXT, - - // sm builtins - EbvWarpsPerSM, - EbvSMCount, - EbvWarpID, - EbvSMID, - - // HLSL built-ins that live only temporarily, until they get remapped - // to one of the above. - EbvFragDepthGreater, - EbvFragDepthLesser, - EbvGsOutputStream, - EbvOutputPatch, - EbvInputPatch, - - // structbuffer types - EbvAppendConsume, // no need to differentiate append and consume - EbvRWStructuredBuffer, - EbvStructuredBuffer, - EbvByteAddressBuffer, - EbvRWByteAddressBuffer, - - // ARM specific core builtins - EbvCoreCountARM, - EbvCoreIDARM, - EbvCoreMaxIDARM, - EbvWarpIDARM, - EbvWarpMaxIDARM, - - EbvLast -}; - -// In this enum, order matters; users can assume higher precision is a bigger value -// and EpqNone is 0. -enum TPrecisionQualifier { - EpqNone = 0, - EpqLow, - EpqMedium, - EpqHigh -}; - -#ifdef GLSLANG_WEB -__inline const char* GetStorageQualifierString(TStorageQualifier q) { return ""; } -__inline const char* GetPrecisionQualifierString(TPrecisionQualifier p) { return ""; } -#else -// These will show up in error messages -__inline const char* GetStorageQualifierString(TStorageQualifier q) -{ - switch (q) { - case EvqTemporary: return "temp"; break; - case EvqGlobal: return "global"; break; - case EvqConst: return "const"; break; - case EvqConstReadOnly: return "const (read only)"; break; -#ifndef GLSLANG_WEB - case EvqSpirvStorageClass: return "spirv_storage_class"; break; -#endif - case EvqVaryingIn: return "in"; break; - case EvqVaryingOut: return "out"; break; - case EvqUniform: return "uniform"; break; - case EvqBuffer: return "buffer"; break; - case EvqShared: return "shared"; break; - case EvqIn: return "in"; break; - case EvqOut: return "out"; break; - case EvqInOut: return "inout"; break; - case EvqVertexId: return "gl_VertexId"; break; - case EvqInstanceId: return "gl_InstanceId"; break; - case EvqPosition: return "gl_Position"; break; - case EvqPointSize: return "gl_PointSize"; break; - case EvqClipVertex: return "gl_ClipVertex"; break; - case EvqFace: return "gl_FrontFacing"; break; - case EvqFragCoord: return "gl_FragCoord"; break; - case EvqPointCoord: return "gl_PointCoord"; break; - case EvqFragColor: return "fragColor"; break; - case EvqFragDepth: return "gl_FragDepth"; break; - case EvqFragStencil: return "gl_FragStencilRefARB"; break; - case EvqPayload: return "rayPayloadNV"; break; - case EvqPayloadIn: return "rayPayloadInNV"; break; - case EvqHitAttr: return "hitAttributeNV"; break; - case EvqCallableData: return "callableDataNV"; break; - case EvqCallableDataIn: return "callableDataInNV"; break; - case EvqtaskPayloadSharedEXT: return "taskPayloadSharedEXT"; break; - case EvqHitObjectAttrNV:return "hitObjectAttributeNV"; break; - default: return "unknown qualifier"; - } -} - -__inline const char* GetBuiltInVariableString(TBuiltInVariable v) -{ - switch (v) { - case EbvNone: return ""; - case EbvNumWorkGroups: return "NumWorkGroups"; - case EbvWorkGroupSize: return "WorkGroupSize"; - case EbvWorkGroupId: return "WorkGroupID"; - case EbvLocalInvocationId: return "LocalInvocationID"; - case EbvGlobalInvocationId: return "GlobalInvocationID"; - case EbvLocalInvocationIndex: return "LocalInvocationIndex"; - case EbvNumSubgroups: return "NumSubgroups"; - case EbvSubgroupID: return "SubgroupID"; - case EbvSubGroupSize: return "SubGroupSize"; - case EbvSubGroupInvocation: return "SubGroupInvocation"; - case EbvSubGroupEqMask: return "SubGroupEqMask"; - case EbvSubGroupGeMask: return "SubGroupGeMask"; - case EbvSubGroupGtMask: return "SubGroupGtMask"; - case EbvSubGroupLeMask: return "SubGroupLeMask"; - case EbvSubGroupLtMask: return "SubGroupLtMask"; - case EbvSubgroupSize2: return "SubgroupSize"; - case EbvSubgroupInvocation2: return "SubgroupInvocationID"; - case EbvSubgroupEqMask2: return "SubgroupEqMask"; - case EbvSubgroupGeMask2: return "SubgroupGeMask"; - case EbvSubgroupGtMask2: return "SubgroupGtMask"; - case EbvSubgroupLeMask2: return "SubgroupLeMask"; - case EbvSubgroupLtMask2: return "SubgroupLtMask"; - case EbvVertexId: return "VertexId"; - case EbvInstanceId: return "InstanceId"; - case EbvVertexIndex: return "VertexIndex"; - case EbvInstanceIndex: return "InstanceIndex"; - case EbvBaseVertex: return "BaseVertex"; - case EbvBaseInstance: return "BaseInstance"; - case EbvDrawId: return "DrawId"; - case EbvPosition: return "Position"; - case EbvPointSize: return "PointSize"; - case EbvClipVertex: return "ClipVertex"; - case EbvClipDistance: return "ClipDistance"; - case EbvCullDistance: return "CullDistance"; - case EbvNormal: return "Normal"; - case EbvVertex: return "Vertex"; - case EbvMultiTexCoord0: return "MultiTexCoord0"; - case EbvMultiTexCoord1: return "MultiTexCoord1"; - case EbvMultiTexCoord2: return "MultiTexCoord2"; - case EbvMultiTexCoord3: return "MultiTexCoord3"; - case EbvMultiTexCoord4: return "MultiTexCoord4"; - case EbvMultiTexCoord5: return "MultiTexCoord5"; - case EbvMultiTexCoord6: return "MultiTexCoord6"; - case EbvMultiTexCoord7: return "MultiTexCoord7"; - case EbvFrontColor: return "FrontColor"; - case EbvBackColor: return "BackColor"; - case EbvFrontSecondaryColor: return "FrontSecondaryColor"; - case EbvBackSecondaryColor: return "BackSecondaryColor"; - case EbvTexCoord: return "TexCoord"; - case EbvFogFragCoord: return "FogFragCoord"; - case EbvInvocationId: return "InvocationID"; - case EbvPrimitiveId: return "PrimitiveID"; - case EbvLayer: return "Layer"; - case EbvViewportIndex: return "ViewportIndex"; - case EbvPatchVertices: return "PatchVertices"; - case EbvTessLevelOuter: return "TessLevelOuter"; - case EbvTessLevelInner: return "TessLevelInner"; - case EbvBoundingBox: return "BoundingBox"; - case EbvTessCoord: return "TessCoord"; - case EbvColor: return "Color"; - case EbvSecondaryColor: return "SecondaryColor"; - case EbvFace: return "Face"; - case EbvFragCoord: return "FragCoord"; - case EbvPointCoord: return "PointCoord"; - case EbvFragColor: return "FragColor"; - case EbvFragData: return "FragData"; - case EbvFragDepth: return "FragDepth"; - case EbvFragStencilRef: return "FragStencilRef"; - case EbvSampleId: return "SampleId"; - case EbvSamplePosition: return "SamplePosition"; - case EbvSampleMask: return "SampleMaskIn"; - case EbvHelperInvocation: return "HelperInvocation"; - - case EbvBaryCoordNoPersp: return "BaryCoordNoPersp"; - case EbvBaryCoordNoPerspCentroid: return "BaryCoordNoPerspCentroid"; - case EbvBaryCoordNoPerspSample: return "BaryCoordNoPerspSample"; - case EbvBaryCoordSmooth: return "BaryCoordSmooth"; - case EbvBaryCoordSmoothCentroid: return "BaryCoordSmoothCentroid"; - case EbvBaryCoordSmoothSample: return "BaryCoordSmoothSample"; - case EbvBaryCoordPullModel: return "BaryCoordPullModel"; - - case EbvViewIndex: return "ViewIndex"; - case EbvDeviceIndex: return "DeviceIndex"; - - case EbvFragSizeEXT: return "FragSizeEXT"; - case EbvFragInvocationCountEXT: return "FragInvocationCountEXT"; - - case EbvSecondaryFragDataEXT: return "SecondaryFragDataEXT"; - case EbvSecondaryFragColorEXT: return "SecondaryFragColorEXT"; - - case EbvViewportMaskNV: return "ViewportMaskNV"; - case EbvSecondaryPositionNV: return "SecondaryPositionNV"; - case EbvSecondaryViewportMaskNV: return "SecondaryViewportMaskNV"; - case EbvPositionPerViewNV: return "PositionPerViewNV"; - case EbvViewportMaskPerViewNV: return "ViewportMaskPerViewNV"; - case EbvFragFullyCoveredNV: return "FragFullyCoveredNV"; - case EbvFragmentSizeNV: return "FragmentSizeNV"; - case EbvInvocationsPerPixelNV: return "InvocationsPerPixelNV"; - case EbvLaunchId: return "LaunchIdNV"; - case EbvLaunchSize: return "LaunchSizeNV"; - case EbvInstanceCustomIndex: return "InstanceCustomIndexNV"; - case EbvGeometryIndex: return "GeometryIndexEXT"; - case EbvWorldRayOrigin: return "WorldRayOriginNV"; - case EbvWorldRayDirection: return "WorldRayDirectionNV"; - case EbvObjectRayOrigin: return "ObjectRayOriginNV"; - case EbvObjectRayDirection: return "ObjectRayDirectionNV"; - case EbvRayTmin: return "ObjectRayTminNV"; - case EbvRayTmax: return "ObjectRayTmaxNV"; - case EbvHitT: return "HitTNV"; - case EbvHitKind: return "HitKindNV"; - case EbvIncomingRayFlags: return "IncomingRayFlagsNV"; - case EbvObjectToWorld: return "ObjectToWorldNV"; - case EbvWorldToObject: return "WorldToObjectNV"; - case EbvCurrentRayTimeNV: return "CurrentRayTimeNV"; - - case EbvBaryCoordEXT: - case EbvBaryCoordNV: return "BaryCoordKHR"; - case EbvBaryCoordNoPerspEXT: - case EbvBaryCoordNoPerspNV: return "BaryCoordNoPerspKHR"; - - case EbvTaskCountNV: return "TaskCountNV"; - case EbvPrimitiveCountNV: return "PrimitiveCountNV"; - case EbvPrimitiveIndicesNV: return "PrimitiveIndicesNV"; - case EbvClipDistancePerViewNV: return "ClipDistancePerViewNV"; - case EbvCullDistancePerViewNV: return "CullDistancePerViewNV"; - case EbvLayerPerViewNV: return "LayerPerViewNV"; - case EbvMeshViewCountNV: return "MeshViewCountNV"; - case EbvMeshViewIndicesNV: return "MeshViewIndicesNV"; - // GL_EXT_mesh_shader - case EbvPrimitivePointIndicesEXT: return "PrimitivePointIndicesEXT"; - case EbvPrimitiveLineIndicesEXT: return "PrimitiveLineIndicesEXT"; - case EbvPrimitiveTriangleIndicesEXT: return "PrimitiveTriangleIndicesEXT"; - case EbvCullPrimitiveEXT: return "CullPrimitiveEXT"; - - case EbvWarpsPerSM: return "WarpsPerSMNV"; - case EbvSMCount: return "SMCountNV"; - case EbvWarpID: return "WarpIDNV"; - case EbvSMID: return "SMIDNV"; - - case EbvShadingRateKHR: return "ShadingRateKHR"; - case EbvPrimitiveShadingRateKHR: return "PrimitiveShadingRateKHR"; - - default: return "unknown built-in variable"; - } -} - -__inline const char* GetPrecisionQualifierString(TPrecisionQualifier p) -{ - switch (p) { - case EpqNone: return ""; break; - case EpqLow: return "lowp"; break; - case EpqMedium: return "mediump"; break; - case EpqHigh: return "highp"; break; - default: return "unknown precision qualifier"; - } -} -#endif - -__inline bool isTypeSignedInt(TBasicType type) -{ - switch (type) { - case EbtInt8: - case EbtInt16: - case EbtInt: - case EbtInt64: - return true; - default: - return false; - } -} - -__inline bool isTypeUnsignedInt(TBasicType type) -{ - switch (type) { - case EbtUint8: - case EbtUint16: - case EbtUint: - case EbtUint64: - return true; - default: - return false; - } -} - -__inline bool isTypeInt(TBasicType type) -{ - return isTypeSignedInt(type) || isTypeUnsignedInt(type); -} - -__inline bool isTypeFloat(TBasicType type) -{ - switch (type) { - case EbtFloat: - case EbtDouble: - case EbtFloat16: - return true; - default: - return false; - } -} - -__inline int getTypeRank(TBasicType type) -{ - int res = -1; - switch(type) { - case EbtInt8: - case EbtUint8: - res = 0; - break; - case EbtInt16: - case EbtUint16: - res = 1; - break; - case EbtInt: - case EbtUint: - res = 2; - break; - case EbtInt64: - case EbtUint64: - res = 3; - break; - default: - assert(false); - break; - } - return res; -} - -} // end namespace glslang - -#endif // _BASICTYPES_INCLUDED_ diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/Common.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/Common.h deleted file mode 100644 index a5b41cb..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/Common.h +++ /dev/null @@ -1,340 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2012-2013 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 _COMMON_INCLUDED_ -#define _COMMON_INCLUDED_ - -#include -#include -#ifdef _MSC_VER -#include -#else -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if defined(__ANDROID__) || (defined(_MSC_VER) && _MSC_VER < 1700) -#include -namespace std { -template -std::string to_string(const T& val) { - std::ostringstream os; - os << val; - return os.str(); -} -} -#endif - -#if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/) || (defined(MINGW_HAS_SECURE_API) && MINGW_HAS_SECURE_API) - #include - #ifndef snprintf - #define snprintf sprintf_s - #endif - #define safe_vsprintf(buf,max,format,args) vsnprintf_s((buf), (max), (max), (format), (args)) -#elif defined (solaris) - #define safe_vsprintf(buf,max,format,args) vsnprintf((buf), (max), (format), (args)) - #include - #define UINT_PTR uintptr_t -#else - #define safe_vsprintf(buf,max,format,args) vsnprintf((buf), (max), (format), (args)) - #include - #define UINT_PTR uintptr_t -#endif - -#if defined(_MSC_VER) && _MSC_VER < 1800 - #include - inline long long int strtoll (const char* str, char** endptr, int base) - { - return _strtoi64(str, endptr, base); - } - inline unsigned long long int strtoull (const char* str, char** endptr, int base) - { - return _strtoui64(str, endptr, base); - } - inline long long int atoll (const char* str) - { - return strtoll(str, NULL, 10); - } -#endif - -#if defined(_MSC_VER) -#define strdup _strdup -#endif - -/* windows only pragma */ -#ifdef _MSC_VER - #pragma warning(disable : 4786) // Don't warn about too long identifiers - #pragma warning(disable : 4514) // unused inline method - #pragma warning(disable : 4201) // nameless union -#endif - -#include "PoolAlloc.h" - -// -// Put POOL_ALLOCATOR_NEW_DELETE in base classes to make them use this scheme. -// -#define POOL_ALLOCATOR_NEW_DELETE(A) \ - void* operator new(size_t s) { return (A).allocate(s); } \ - void* operator new(size_t, void *_Where) { return (_Where); } \ - void operator delete(void*) { } \ - void operator delete(void *, void *) { } \ - void* operator new[](size_t s) { return (A).allocate(s); } \ - void* operator new[](size_t, void *_Where) { return (_Where); } \ - void operator delete[](void*) { } \ - void operator delete[](void *, void *) { } - -namespace glslang { - - // - // Pool version of string. - // - typedef pool_allocator TStringAllocator; - typedef std::basic_string , TStringAllocator> TString; - -} // end namespace glslang - -// Repackage the std::hash for use by unordered map/set with a TString key. -namespace std { - - template<> struct hash { - std::size_t operator()(const glslang::TString& s) const - { - const unsigned _FNV_offset_basis = 2166136261U; - const unsigned _FNV_prime = 16777619U; - unsigned _Val = _FNV_offset_basis; - size_t _Count = s.size(); - const char* _First = s.c_str(); - for (size_t _Next = 0; _Next < _Count; ++_Next) - { - _Val ^= (unsigned)_First[_Next]; - _Val *= _FNV_prime; - } - - return _Val; - } - }; -} - -namespace glslang { - -inline TString* NewPoolTString(const char* s) -{ - void* memory = GetThreadPoolAllocator().allocate(sizeof(TString)); - return new(memory) TString(s); -} - -template inline T* NewPoolObject(T*) -{ - return new(GetThreadPoolAllocator().allocate(sizeof(T))) T; -} - -template inline T* NewPoolObject(T, int instances) -{ - return new(GetThreadPoolAllocator().allocate(instances * sizeof(T))) T[instances]; -} - -// -// Pool allocator versions of vectors, lists, and maps -// -template class TVector : public std::vector > { -public: - POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) - - typedef typename std::vector >::size_type size_type; - TVector() : std::vector >() {} - TVector(const pool_allocator& a) : std::vector >(a) {} - TVector(size_type i) : std::vector >(i) {} - TVector(size_type i, const T& val) : std::vector >(i, val) {} -}; - -template class TList : public std::list > { -}; - -template > -class TMap : public std::map > > { -}; - -template , class PRED = std::equal_to > -class TUnorderedMap : public std::unordered_map > > { -}; - -template > -class TSet : public std::set > { -}; - -// -// Persistent string memory. Should only be used for strings that survive -// across compiles/links. -// -typedef std::basic_string TPersistString; - -// -// templatized min and max functions. -// -template T Min(const T a, const T b) { return a < b ? a : b; } -template T Max(const T a, const T b) { return a > b ? a : b; } - -// -// Create a TString object from an integer. -// -#if defined(_MSC_VER) || (defined(MINGW_HAS_SECURE_API) && MINGW_HAS_SECURE_API) -inline const TString String(const int i, const int base = 10) -{ - char text[16]; // 32 bit ints are at most 10 digits in base 10 - _itoa_s(i, text, sizeof(text), base); - return text; -} -#else -inline const TString String(const int i, const int /*base*/ = 10) -{ - char text[16]; // 32 bit ints are at most 10 digits in base 10 - - // we assume base 10 for all cases - snprintf(text, sizeof(text), "%d", i); - - return text; -} -#endif - -struct TSourceLoc { - void init() - { - name = nullptr; string = 0; line = 0; column = 0; - } - void init(int stringNum) { init(); string = stringNum; } - // Returns the name if it exists. Otherwise, returns the string number. - std::string getStringNameOrNum(bool quoteStringName = true) const - { - if (name != nullptr) { - TString qstr = quoteStringName ? ("\"" + *name + "\"") : *name; - std::string ret_str(qstr.c_str()); - return ret_str; - } - return std::to_string((long long)string); - } - const char* getFilename() const - { - if (name == nullptr) - return nullptr; - return name->c_str(); - } - const char* getFilenameStr() const { return name == nullptr ? "" : name->c_str(); } - TString* name; // descriptive name for this string, when a textual name is available, otherwise nullptr - int string; - int line; - int column; -}; - -class TPragmaTable : public TMap { -public: - POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) -}; - -const int MaxTokenLength = 1024; - -template bool IsPow2(T powerOf2) -{ - if (powerOf2 <= 0) - return false; - - return (powerOf2 & (powerOf2 - 1)) == 0; -} - -// Round number up to a multiple of the given powerOf2, which is not -// a power, just a number that must be a power of 2. -template void RoundToPow2(T& number, int powerOf2) -{ - assert(IsPow2(powerOf2)); - number = (number + powerOf2 - 1) & ~(powerOf2 - 1); -} - -template bool IsMultipleOfPow2(T number, int powerOf2) -{ - assert(IsPow2(powerOf2)); - return ! (number & (powerOf2 - 1)); -} - -// Returns log2 of an integer power of 2. -// T should be integral. -template int IntLog2(T n) -{ - assert(IsPow2(n)); - int result = 0; - while ((T(1) << result) != n) { - result++; - } - return result; -} - -inline bool IsInfinity(double x) { -#ifdef _MSC_VER - switch (_fpclass(x)) { - case _FPCLASS_NINF: - case _FPCLASS_PINF: - return true; - default: - return false; - } -#else - return std::isinf(x); -#endif -} - -inline bool IsNan(double x) { -#ifdef _MSC_VER - switch (_fpclass(x)) { - case _FPCLASS_SNAN: - case _FPCLASS_QNAN: - return true; - default: - return false; - } -#else - return std::isnan(x); -#endif -} - -} // end namespace glslang - -#endif // _COMMON_INCLUDED_ diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/ConstantUnion.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/ConstantUnion.h deleted file mode 100644 index c4ffb85..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/ConstantUnion.h +++ /dev/null @@ -1,974 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2013 LunarG, Inc. -// Copyright (C) 2017 ARM Limited. -// -// 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 _CONSTANT_UNION_INCLUDED_ -#define _CONSTANT_UNION_INCLUDED_ - -#include "../Include/Common.h" -#include "../Include/BaseTypes.h" - -namespace glslang { - -class TConstUnion { -public: - POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) - - TConstUnion() : iConst(0), type(EbtInt) { } - - void setI8Const(signed char i) - { - i8Const = i; - type = EbtInt8; - } - - void setU8Const(unsigned char u) - { - u8Const = u; - type = EbtUint8; - } - - void setI16Const(signed short i) - { - i16Const = i; - type = EbtInt16; - } - - void setU16Const(unsigned short u) - { - u16Const = u; - type = EbtUint16; - } - - void setIConst(int i) - { - iConst = i; - type = EbtInt; - } - - void setUConst(unsigned int u) - { - uConst = u; - 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; - type = EbtDouble; - } - - void setBConst(bool b) - { - bConst = b; - type = EbtBool; - } - - void setSConst(const TString* s) - { - sConst = s; - type = EbtString; - } - - signed char getI8Const() const { return i8Const; } - unsigned char getU8Const() const { return u8Const; } - signed short getI16Const() const { return i16Const; } - unsigned short getU16Const() const { return u16Const; } - 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; } - const TString* getSConst() const { return sConst; } - - bool operator==(const signed char i) const - { - if (i == i8Const) - return true; - - return false; - } - - bool operator==(const unsigned char u) const - { - if (u == u8Const) - return true; - - return false; - } - - bool operator==(const signed short i) const - { - if (i == i16Const) - return true; - - return false; - } - - bool operator==(const unsigned short u) const - { - if (u == u16Const) - return true; - - return false; - } - - bool operator==(const int i) const - { - if (i == iConst) - return true; - - return false; - } - - bool operator==(const unsigned int u) const - { - if (u == uConst) - return true; - - 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) - return true; - - return false; - } - - bool operator==(const bool b) const - { - if (b == bConst) - return true; - - return false; - } - - bool operator==(const TConstUnion& constant) const - { - if (constant.type != type) - return false; - - switch (type) { - case EbtInt: - if (constant.iConst == iConst) - return true; - - break; - case EbtUint: - if (constant.uConst == uConst) - return true; - - break; - case EbtBool: - if (constant.bConst == bConst) - return true; - - break; - case EbtDouble: - if (constant.dConst == dConst) - return true; - - break; - -#ifndef GLSLANG_WEB - case EbtInt16: - if (constant.i16Const == i16Const) - return true; - - break; - case EbtUint16: - if (constant.u16Const == u16Const) - return true; - - break; - case EbtInt8: - if (constant.i8Const == i8Const) - return true; - - break; - case EbtUint8: - if (constant.u8Const == u8Const) - return true; - - break; - case EbtInt64: - if (constant.i64Const == i64Const) - return true; - - break; - case EbtUint64: - if (constant.u64Const == u64Const) - return true; - - break; -#endif - default: - assert(false && "Default missing"); - } - - return false; - } - - bool operator!=(const signed char i) const - { - return !operator==(i); - } - - bool operator!=(const unsigned char u) const - { - return !operator==(u); - } - - bool operator!=(const signed short i) const - { - return !operator==(i); - } - - bool operator!=(const unsigned short u) const - { - return !operator==(u); - } - - bool operator!=(const int i) const - { - return !operator==(i); - } - - bool operator!=(const unsigned int u) const - { - 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); - } - - bool operator!=(const bool b) const - { - return !operator==(b); - } - - bool operator!=(const TConstUnion& constant) const - { - return !operator==(constant); - } - - bool operator>(const TConstUnion& constant) const - { - assert(type == constant.type); - switch (type) { - case EbtInt: - if (iConst > constant.iConst) - return true; - - return false; - case EbtUint: - if (uConst > constant.uConst) - return true; - - return false; - case EbtDouble: - if (dConst > constant.dConst) - return true; - - return false; -#ifndef GLSLANG_WEB - case EbtInt8: - if (i8Const > constant.i8Const) - return true; - - return false; - case EbtUint8: - if (u8Const > constant.u8Const) - return true; - - return false; - case EbtInt16: - if (i16Const > constant.i16Const) - return true; - - return false; - case EbtUint16: - if (u16Const > constant.u16Const) - return true; - - return false; - case EbtInt64: - if (i64Const > constant.i64Const) - return true; - - return false; - case EbtUint64: - if (u64Const > constant.u64Const) - return true; - - return false; -#endif - default: - assert(false && "Default missing"); - return false; - } - } - - bool operator<(const TConstUnion& constant) const - { - assert(type == constant.type); - switch (type) { -#ifndef GLSLANG_WEB - case EbtInt8: - if (i8Const < constant.i8Const) - return true; - - return false; - case EbtUint8: - if (u8Const < constant.u8Const) - return true; - - return false; - case EbtInt16: - if (i16Const < constant.i16Const) - return true; - - return false; - case EbtUint16: - if (u16Const < constant.u16Const) - return true; - return false; - case EbtInt64: - if (i64Const < constant.i64Const) - return true; - - return false; - case EbtUint64: - if (u64Const < constant.u64Const) - return true; - - return false; -#endif - case EbtDouble: - if (dConst < constant.dConst) - return true; - - return false; - case EbtInt: - if (iConst < constant.iConst) - return true; - - return false; - case EbtUint: - if (uConst < constant.uConst) - return true; - - return false; - default: - assert(false && "Default missing"); - return false; - } - } - - TConstUnion operator+(const TConstUnion& constant) const - { - TConstUnion returnValue; - assert(type == constant.type); - switch (type) { - case EbtInt: returnValue.setIConst(iConst + constant.iConst); break; - case EbtUint: returnValue.setUConst(uConst + constant.uConst); break; - case EbtDouble: returnValue.setDConst(dConst + constant.dConst); break; -#ifndef GLSLANG_WEB - case EbtInt8: returnValue.setI8Const(i8Const + constant.i8Const); break; - case EbtInt16: returnValue.setI16Const(i16Const + constant.i16Const); break; - case EbtInt64: returnValue.setI64Const(i64Const + constant.i64Const); break; - case EbtUint8: returnValue.setU8Const(u8Const + constant.u8Const); break; - case EbtUint16: returnValue.setU16Const(u16Const + constant.u16Const); break; - case EbtUint64: returnValue.setU64Const(u64Const + constant.u64Const); break; -#endif - default: assert(false && "Default missing"); - } - - return returnValue; - } - - TConstUnion operator-(const TConstUnion& constant) const - { - TConstUnion returnValue; - assert(type == constant.type); - switch (type) { - case EbtInt: returnValue.setIConst(iConst - constant.iConst); break; - case EbtUint: returnValue.setUConst(uConst - constant.uConst); break; - case EbtDouble: returnValue.setDConst(dConst - constant.dConst); break; -#ifndef GLSLANG_WEB - case EbtInt8: returnValue.setI8Const(i8Const - constant.i8Const); break; - case EbtInt16: returnValue.setI16Const(i16Const - constant.i16Const); break; - case EbtInt64: returnValue.setI64Const(i64Const - constant.i64Const); break; - case EbtUint8: returnValue.setU8Const(u8Const - constant.u8Const); break; - case EbtUint16: returnValue.setU16Const(u16Const - constant.u16Const); break; - case EbtUint64: returnValue.setU64Const(u64Const - constant.u64Const); break; -#endif - default: assert(false && "Default missing"); - } - - return returnValue; - } - - TConstUnion operator*(const TConstUnion& constant) const - { - TConstUnion returnValue; - assert(type == constant.type); - switch (type) { - case EbtInt: returnValue.setIConst(iConst * constant.iConst); break; - case EbtUint: returnValue.setUConst(uConst * constant.uConst); break; - case EbtDouble: returnValue.setDConst(dConst * constant.dConst); break; -#ifndef GLSLANG_WEB - case EbtInt8: returnValue.setI8Const(i8Const * constant.i8Const); break; - case EbtInt16: returnValue.setI16Const(i16Const * constant.i16Const); break; - case EbtInt64: returnValue.setI64Const(i64Const * constant.i64Const); break; - case EbtUint8: returnValue.setU8Const(u8Const * constant.u8Const); break; - case EbtUint16: returnValue.setU16Const(u16Const * constant.u16Const); break; - case EbtUint64: returnValue.setU64Const(u64Const * constant.u64Const); break; -#endif - default: assert(false && "Default missing"); - } - - return returnValue; - } - - TConstUnion operator%(const TConstUnion& constant) const - { - TConstUnion returnValue; - assert(type == constant.type); - switch (type) { - case EbtInt: returnValue.setIConst(iConst % constant.iConst); break; - case EbtUint: returnValue.setUConst(uConst % constant.uConst); break; -#ifndef GLSLANG_WEB - case EbtInt8: returnValue.setI8Const(i8Const % constant.i8Const); break; - case EbtInt16: returnValue.setI8Const(i8Const % constant.i16Const); break; - case EbtInt64: returnValue.setI64Const(i64Const % constant.i64Const); break; - case EbtUint8: returnValue.setU8Const(u8Const % constant.u8Const); break; - case EbtUint16: returnValue.setU16Const(u16Const % constant.u16Const); break; - case EbtUint64: returnValue.setU64Const(u64Const % constant.u64Const); break; -#endif - default: assert(false && "Default missing"); - } - - return returnValue; - } - - TConstUnion operator>>(const TConstUnion& constant) const - { - TConstUnion returnValue; - switch (type) { -#ifndef GLSLANG_WEB - case EbtInt8: - switch (constant.type) { - case EbtInt8: returnValue.setI8Const(i8Const >> constant.i8Const); break; - case EbtUint8: returnValue.setI8Const(i8Const >> constant.u8Const); break; - case EbtInt16: returnValue.setI8Const(i8Const >> constant.i16Const); break; - case EbtUint16: returnValue.setI8Const(i8Const >> constant.u16Const); break; - case EbtInt: returnValue.setI8Const(i8Const >> constant.iConst); break; - case EbtUint: returnValue.setI8Const(i8Const >> constant.uConst); break; - case EbtInt64: returnValue.setI8Const(i8Const >> constant.i64Const); break; - case EbtUint64: returnValue.setI8Const(i8Const >> constant.u64Const); break; - default: assert(false && "Default missing"); - } - break; - case EbtUint8: - switch (constant.type) { - case EbtInt8: returnValue.setU8Const(u8Const >> constant.i8Const); break; - case EbtUint8: returnValue.setU8Const(u8Const >> constant.u8Const); break; - case EbtInt16: returnValue.setU8Const(u8Const >> constant.i16Const); break; - case EbtUint16: returnValue.setU8Const(u8Const >> constant.u16Const); break; - case EbtInt: returnValue.setU8Const(u8Const >> constant.iConst); break; - case EbtUint: returnValue.setU8Const(u8Const >> constant.uConst); break; - case EbtInt64: returnValue.setU8Const(u8Const >> constant.i64Const); break; - case EbtUint64: returnValue.setU8Const(u8Const >> constant.u64Const); break; - default: assert(false && "Default missing"); - } - break; - case EbtInt16: - switch (constant.type) { - case EbtInt8: returnValue.setI16Const(i16Const >> constant.i8Const); break; - case EbtUint8: returnValue.setI16Const(i16Const >> constant.u8Const); break; - case EbtInt16: returnValue.setI16Const(i16Const >> constant.i16Const); break; - case EbtUint16: returnValue.setI16Const(i16Const >> constant.u16Const); break; - case EbtInt: returnValue.setI16Const(i16Const >> constant.iConst); break; - case EbtUint: returnValue.setI16Const(i16Const >> constant.uConst); break; - case EbtInt64: returnValue.setI16Const(i16Const >> constant.i64Const); break; - case EbtUint64: returnValue.setI16Const(i16Const >> constant.u64Const); break; - default: assert(false && "Default missing"); - } - break; - case EbtUint16: - switch (constant.type) { - case EbtInt8: returnValue.setU16Const(u16Const >> constant.i8Const); break; - case EbtUint8: returnValue.setU16Const(u16Const >> constant.u8Const); break; - case EbtInt16: returnValue.setU16Const(u16Const >> constant.i16Const); break; - case EbtUint16: returnValue.setU16Const(u16Const >> constant.u16Const); break; - case EbtInt: returnValue.setU16Const(u16Const >> constant.iConst); break; - case EbtUint: returnValue.setU16Const(u16Const >> constant.uConst); break; - case EbtInt64: returnValue.setU16Const(u16Const >> constant.i64Const); break; - case EbtUint64: returnValue.setU16Const(u16Const >> constant.u64Const); break; - default: assert(false && "Default missing"); - } - break; -#endif - case EbtInt: - switch (constant.type) { - case EbtInt: returnValue.setIConst(iConst >> constant.iConst); break; - case EbtUint: returnValue.setIConst(iConst >> constant.uConst); break; -#ifndef GLSLANG_WEB - case EbtInt8: returnValue.setIConst(iConst >> constant.i8Const); break; - case EbtUint8: returnValue.setIConst(iConst >> constant.u8Const); break; - case EbtInt16: returnValue.setIConst(iConst >> constant.i16Const); break; - case EbtUint16: returnValue.setIConst(iConst >> constant.u16Const); break; - case EbtInt64: returnValue.setIConst(iConst >> constant.i64Const); break; - case EbtUint64: returnValue.setIConst(iConst >> constant.u64Const); break; -#endif - default: assert(false && "Default missing"); - } - break; - case EbtUint: - switch (constant.type) { - case EbtInt: returnValue.setUConst(uConst >> constant.iConst); break; - case EbtUint: returnValue.setUConst(uConst >> constant.uConst); break; -#ifndef GLSLANG_WEB - case EbtInt8: returnValue.setUConst(uConst >> constant.i8Const); break; - case EbtUint8: returnValue.setUConst(uConst >> constant.u8Const); break; - case EbtInt16: returnValue.setUConst(uConst >> constant.i16Const); break; - case EbtUint16: returnValue.setUConst(uConst >> constant.u16Const); break; - case EbtInt64: returnValue.setUConst(uConst >> constant.i64Const); break; - case EbtUint64: returnValue.setUConst(uConst >> constant.u64Const); break; -#endif - default: assert(false && "Default missing"); - } - break; -#ifndef GLSLANG_WEB - case EbtInt64: - switch (constant.type) { - case EbtInt8: returnValue.setI64Const(i64Const >> constant.i8Const); break; - case EbtUint8: returnValue.setI64Const(i64Const >> constant.u8Const); break; - case EbtInt16: returnValue.setI64Const(i64Const >> constant.i16Const); break; - case EbtUint16: returnValue.setI64Const(i64Const >> constant.u16Const); break; - 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 EbtInt8: returnValue.setU64Const(u64Const >> constant.i8Const); break; - case EbtUint8: returnValue.setU64Const(u64Const >> constant.u8Const); break; - case EbtInt16: returnValue.setU64Const(u64Const >> constant.i16Const); break; - case EbtUint16: returnValue.setU64Const(u64Const >> constant.u16Const); break; - 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; -#endif - default: assert(false && "Default missing"); - } - - return returnValue; - } - - TConstUnion operator<<(const TConstUnion& constant) const - { - TConstUnion returnValue; - switch (type) { -#ifndef GLSLANG_WEB - case EbtInt8: - switch (constant.type) { - case EbtInt8: returnValue.setI8Const(i8Const << constant.i8Const); break; - case EbtUint8: returnValue.setI8Const(i8Const << constant.u8Const); break; - case EbtInt16: returnValue.setI8Const(i8Const << constant.i16Const); break; - case EbtUint16: returnValue.setI8Const(i8Const << constant.u16Const); break; - case EbtInt: returnValue.setI8Const(i8Const << constant.iConst); break; - case EbtUint: returnValue.setI8Const(i8Const << constant.uConst); break; - case EbtInt64: returnValue.setI8Const(i8Const << constant.i64Const); break; - case EbtUint64: returnValue.setI8Const(i8Const << constant.u64Const); break; - default: assert(false && "Default missing"); - } - break; - case EbtUint8: - switch (constant.type) { - case EbtInt8: returnValue.setU8Const(u8Const << constant.i8Const); break; - case EbtUint8: returnValue.setU8Const(u8Const << constant.u8Const); break; - case EbtInt16: returnValue.setU8Const(u8Const << constant.i16Const); break; - case EbtUint16: returnValue.setU8Const(u8Const << constant.u16Const); break; - case EbtInt: returnValue.setU8Const(u8Const << constant.iConst); break; - case EbtUint: returnValue.setU8Const(u8Const << constant.uConst); break; - case EbtInt64: returnValue.setU8Const(u8Const << constant.i64Const); break; - case EbtUint64: returnValue.setU8Const(u8Const << constant.u64Const); break; - default: assert(false && "Default missing"); - } - break; - case EbtInt16: - switch (constant.type) { - case EbtInt8: returnValue.setI16Const(i16Const << constant.i8Const); break; - case EbtUint8: returnValue.setI16Const(i16Const << constant.u8Const); break; - case EbtInt16: returnValue.setI16Const(i16Const << constant.i16Const); break; - case EbtUint16: returnValue.setI16Const(i16Const << constant.u16Const); break; - case EbtInt: returnValue.setI16Const(i16Const << constant.iConst); break; - case EbtUint: returnValue.setI16Const(i16Const << constant.uConst); break; - case EbtInt64: returnValue.setI16Const(i16Const << constant.i64Const); break; - case EbtUint64: returnValue.setI16Const(i16Const << constant.u64Const); break; - default: assert(false && "Default missing"); - } - break; - case EbtUint16: - switch (constant.type) { - case EbtInt8: returnValue.setU16Const(u16Const << constant.i8Const); break; - case EbtUint8: returnValue.setU16Const(u16Const << constant.u8Const); break; - case EbtInt16: returnValue.setU16Const(u16Const << constant.i16Const); break; - case EbtUint16: returnValue.setU16Const(u16Const << constant.u16Const); break; - case EbtInt: returnValue.setU16Const(u16Const << constant.iConst); break; - case EbtUint: returnValue.setU16Const(u16Const << constant.uConst); break; - case EbtInt64: returnValue.setU16Const(u16Const << constant.i64Const); break; - case EbtUint64: returnValue.setU16Const(u16Const << constant.u64Const); break; - default: assert(false && "Default missing"); - } - break; - case EbtInt64: - switch (constant.type) { - case EbtInt8: returnValue.setI64Const(i64Const << constant.i8Const); break; - case EbtUint8: returnValue.setI64Const(i64Const << constant.u8Const); break; - case EbtInt16: returnValue.setI64Const(i64Const << constant.i16Const); break; - case EbtUint16: returnValue.setI64Const(i64Const << constant.u16Const); break; - 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 EbtInt8: returnValue.setU64Const(u64Const << constant.i8Const); break; - case EbtUint8: returnValue.setU64Const(u64Const << constant.u8Const); break; - case EbtInt16: returnValue.setU64Const(u64Const << constant.i16Const); break; - case EbtUint16: returnValue.setU64Const(u64Const << constant.u16Const); break; - 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; -#endif - case EbtInt: - switch (constant.type) { - case EbtInt: returnValue.setIConst(iConst << constant.iConst); break; - case EbtUint: returnValue.setIConst(iConst << constant.uConst); break; -#ifndef GLSLANG_WEB - case EbtInt8: returnValue.setIConst(iConst << constant.i8Const); break; - case EbtUint8: returnValue.setIConst(iConst << constant.u8Const); break; - case EbtInt16: returnValue.setIConst(iConst << constant.i16Const); break; - case EbtUint16: returnValue.setIConst(iConst << constant.u16Const); break; - case EbtInt64: returnValue.setIConst(iConst << constant.i64Const); break; - case EbtUint64: returnValue.setIConst(iConst << constant.u64Const); break; -#endif - default: assert(false && "Default missing"); - } - break; - case EbtUint: - switch (constant.type) { - case EbtInt: returnValue.setUConst(uConst << constant.iConst); break; - case EbtUint: returnValue.setUConst(uConst << constant.uConst); break; -#ifndef GLSLANG_WEB - case EbtInt8: returnValue.setUConst(uConst << constant.i8Const); break; - case EbtUint8: returnValue.setUConst(uConst << constant.u8Const); break; - case EbtInt16: returnValue.setUConst(uConst << constant.i16Const); break; - case EbtUint16: returnValue.setUConst(uConst << constant.u16Const); break; - case EbtInt64: returnValue.setUConst(uConst << constant.i64Const); break; - case EbtUint64: returnValue.setUConst(uConst << constant.u64Const); break; -#endif - default: assert(false && "Default missing"); - } - break; - default: assert(false && "Default missing"); - } - - return returnValue; - } - - TConstUnion operator&(const TConstUnion& constant) const - { - TConstUnion returnValue; - assert(type == constant.type); - switch (type) { - case EbtInt: returnValue.setIConst(iConst & constant.iConst); break; - case EbtUint: returnValue.setUConst(uConst & constant.uConst); break; -#ifndef GLSLANG_WEB - case EbtInt8: returnValue.setI8Const(i8Const & constant.i8Const); break; - case EbtUint8: returnValue.setU8Const(u8Const & constant.u8Const); break; - case EbtInt16: returnValue.setI16Const(i16Const & constant.i16Const); break; - case EbtUint16: returnValue.setU16Const(u16Const & constant.u16Const); break; - case EbtInt64: returnValue.setI64Const(i64Const & constant.i64Const); break; - case EbtUint64: returnValue.setU64Const(u64Const & constant.u64Const); break; -#endif - default: assert(false && "Default missing"); - } - - return returnValue; - } - - TConstUnion operator|(const TConstUnion& constant) const - { - TConstUnion returnValue; - assert(type == constant.type); - switch (type) { - case EbtInt: returnValue.setIConst(iConst | constant.iConst); break; - case EbtUint: returnValue.setUConst(uConst | constant.uConst); break; -#ifndef GLSLANG_WEB - case EbtInt8: returnValue.setI8Const(i8Const | constant.i8Const); break; - case EbtUint8: returnValue.setU8Const(u8Const | constant.u8Const); break; - case EbtInt16: returnValue.setI16Const(i16Const | constant.i16Const); break; - case EbtUint16: returnValue.setU16Const(u16Const | constant.u16Const); break; - case EbtInt64: returnValue.setI64Const(i64Const | constant.i64Const); break; - case EbtUint64: returnValue.setU64Const(u64Const | constant.u64Const); break; -#endif - default: assert(false && "Default missing"); - } - - return returnValue; - } - - TConstUnion operator^(const TConstUnion& constant) const - { - TConstUnion returnValue; - assert(type == constant.type); - switch (type) { - case EbtInt: returnValue.setIConst(iConst ^ constant.iConst); break; - case EbtUint: returnValue.setUConst(uConst ^ constant.uConst); break; -#ifndef GLSLANG_WEB - case EbtInt8: returnValue.setI8Const(i8Const ^ constant.i8Const); break; - case EbtUint8: returnValue.setU8Const(u8Const ^ constant.u8Const); break; - case EbtInt16: returnValue.setI16Const(i16Const ^ constant.i16Const); break; - case EbtUint16: returnValue.setU16Const(u16Const ^ constant.u16Const); break; - case EbtInt64: returnValue.setI64Const(i64Const ^ constant.i64Const); break; - case EbtUint64: returnValue.setU64Const(u64Const ^ constant.u64Const); break; -#endif - default: assert(false && "Default missing"); - } - - return returnValue; - } - - TConstUnion operator~() const - { - TConstUnion returnValue; - switch (type) { - case EbtInt: returnValue.setIConst(~iConst); break; - case EbtUint: returnValue.setUConst(~uConst); break; -#ifndef GLSLANG_WEB - case EbtInt8: returnValue.setI8Const(~i8Const); break; - case EbtUint8: returnValue.setU8Const(~u8Const); break; - case EbtInt16: returnValue.setI16Const(~i16Const); break; - case EbtUint16: returnValue.setU16Const(~u16Const); break; - case EbtInt64: returnValue.setI64Const(~i64Const); break; - case EbtUint64: returnValue.setU64Const(~u64Const); break; -#endif - default: assert(false && "Default missing"); - } - - return returnValue; - } - - TConstUnion operator&&(const TConstUnion& constant) const - { - TConstUnion returnValue; - assert(type == constant.type); - switch (type) { - case EbtBool: returnValue.setBConst(bConst && constant.bConst); break; - default: assert(false && "Default missing"); - } - - return returnValue; - } - - TConstUnion operator||(const TConstUnion& constant) const - { - TConstUnion returnValue; - assert(type == constant.type); - switch (type) { - case EbtBool: returnValue.setBConst(bConst || constant.bConst); break; - default: assert(false && "Default missing"); - } - - return returnValue; - } - - TBasicType getType() const { return type; } - -private: - union { - signed char i8Const; // used for i8vec, scalar int8s - unsigned char u8Const; // used for u8vec, scalar uint8s - signed short i16Const; // used for i16vec, scalar int16s - unsigned short u16Const; // used for u16vec, scalar uint16s - 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 - const TString* sConst; // string constant - }; - - TBasicType type; -}; - -// Encapsulate having a pointer to an array of TConstUnion, -// which only needs to be allocated if its size is going to be -// bigger than 0. -// -// One convenience is being able to use [] to go inside the array, instead -// of C++ assuming it as an array of pointers to vectors. -// -// General usage is that the size is known up front, and it is -// created once with the proper size. -// -class TConstUnionArray { -public: - POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) - - TConstUnionArray() : unionArray(nullptr) { } - virtual ~TConstUnionArray() { } - - explicit TConstUnionArray(int size) - { - if (size == 0) - unionArray = nullptr; - else - unionArray = new TConstUnionVector(size); - } - TConstUnionArray(const TConstUnionArray& a) = default; - TConstUnionArray(const TConstUnionArray& a, int start, int size) - { - unionArray = new TConstUnionVector(size); - for (int i = 0; i < size; ++i) - (*unionArray)[i] = a[start + i]; - } - - // Use this constructor for a smear operation - TConstUnionArray(int size, const TConstUnion& val) - { - unionArray = new TConstUnionVector(size, val); - } - - int size() const { return unionArray ? (int)unionArray->size() : 0; } - TConstUnion& operator[](size_t index) { return (*unionArray)[index]; } - const TConstUnion& operator[](size_t index) const { return (*unionArray)[index]; } - bool operator==(const TConstUnionArray& rhs) const - { - // this includes the case that both are unallocated - if (unionArray == rhs.unionArray) - return true; - - if (! unionArray || ! rhs.unionArray) - return false; - - return *unionArray == *rhs.unionArray; - } - bool operator!=(const TConstUnionArray& rhs) const { return ! operator==(rhs); } - - double dot(const TConstUnionArray& rhs) - { - assert(rhs.unionArray->size() == unionArray->size()); - double sum = 0.0; - - for (size_t comp = 0; comp < unionArray->size(); ++comp) - sum += (*this)[comp].getDConst() * rhs[comp].getDConst(); - - return sum; - } - - bool empty() const { return unionArray == nullptr; } - -protected: - typedef TVector TConstUnionVector; - TConstUnionVector* unionArray; -}; - -} // end namespace glslang - -#endif // _CONSTANT_UNION_INCLUDED_ diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/InfoSink.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/InfoSink.h deleted file mode 100644 index dceb603..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/InfoSink.h +++ /dev/null @@ -1,144 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// 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 _INFOSINK_INCLUDED_ -#define _INFOSINK_INCLUDED_ - -#include "../Include/Common.h" -#include - -namespace glslang { - -// -// TPrefixType is used to centralize how info log messages start. -// See below. -// -enum TPrefixType { - EPrefixNone, - EPrefixWarning, - EPrefixError, - EPrefixInternalError, - EPrefixUnimplemented, - EPrefixNote -}; - -enum TOutputStream { - ENull = 0, - EDebugger = 0x01, - EStdOut = 0x02, - EString = 0x04, -}; -// -// Encapsulate info logs for all objects that have them. -// -// The methods are a general set of tools for getting a variety of -// messages and types inserted into the log. -// -class TInfoSinkBase { -public: - TInfoSinkBase() : outputStream(4) {} - void erase() { sink.erase(); } - TInfoSinkBase& operator<<(const TPersistString& t) { append(t); return *this; } - TInfoSinkBase& operator<<(char c) { append(1, c); return *this; } - TInfoSinkBase& operator<<(const char* s) { append(s); return *this; } - TInfoSinkBase& operator<<(int n) { append(String(n)); return *this; } - TInfoSinkBase& operator<<(unsigned int n) { append(String(n)); return *this; } - TInfoSinkBase& operator<<(float n) { const int size = 40; char buf[size]; - snprintf(buf, size, (fabs(n) > 1e-8 && fabs(n) < 1e8) || n == 0.0f ? "%f" : "%g", n); - append(buf); - return *this; } - TInfoSinkBase& operator+(const TPersistString& t) { append(t); return *this; } - TInfoSinkBase& operator+(const TString& t) { append(t); return *this; } - TInfoSinkBase& operator<<(const TString& t) { append(t); return *this; } - TInfoSinkBase& operator+(const char* s) { append(s); return *this; } - const char* c_str() const { return sink.c_str(); } - void prefix(TPrefixType message) { - switch(message) { - case EPrefixNone: break; - case EPrefixWarning: append("WARNING: "); break; - case EPrefixError: append("ERROR: "); break; - case EPrefixInternalError: append("INTERNAL ERROR: "); break; - case EPrefixUnimplemented: append("UNIMPLEMENTED: "); break; - case EPrefixNote: append("NOTE: "); break; - default: append("UNKNOWN ERROR: "); break; - } - } - void location(const TSourceLoc& loc) { - const int maxSize = 24; - char locText[maxSize]; - snprintf(locText, maxSize, ":%d", loc.line); - append(loc.getStringNameOrNum(false).c_str()); - append(locText); - append(": "); - } - void message(TPrefixType message, const char* s) { - prefix(message); - append(s); - append("\n"); - } - void message(TPrefixType message, const char* s, const TSourceLoc& loc) { - prefix(message); - location(loc); - append(s); - append("\n"); - } - - void setOutputStream(int output = 4) - { - outputStream = output; - } - -protected: - void append(const char* s); - - void append(int count, char c); - void append(const TPersistString& t); - void append(const TString& t); - - void checkMem(size_t growth) { if (sink.capacity() < sink.size() + growth + 2) - sink.reserve(sink.capacity() + sink.capacity() / 2); } - void appendToStream(const char* s); - TPersistString sink; - int outputStream; -}; - -} // end namespace glslang - -class TInfoSink { -public: - glslang::TInfoSinkBase info; - glslang::TInfoSinkBase debug; -}; - -#endif // _INFOSINK_INCLUDED_ diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/InitializeGlobals.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/InitializeGlobals.h deleted file mode 100644 index 95d0a40..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/InitializeGlobals.h +++ /dev/null @@ -1,44 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// 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 __INITIALIZE_GLOBALS_INCLUDED_ -#define __INITIALIZE_GLOBALS_INCLUDED_ - -namespace glslang { - -bool InitializePoolIndex(); - -} // end namespace glslang - -#endif // __INITIALIZE_GLOBALS_INCLUDED_ diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/PoolAlloc.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/PoolAlloc.h deleted file mode 100644 index 3e67d6e..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/PoolAlloc.h +++ /dev/null @@ -1,318 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2012-2013 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 _POOLALLOC_INCLUDED_ -#define _POOLALLOC_INCLUDED_ - -#ifndef NDEBUG -# define GUARD_BLOCKS // define to enable guard block sanity checking -#endif - -// -// This header defines an allocator that can be used to efficiently -// allocate a large number of small requests for heap memory, with the -// intention that they are not individually deallocated, but rather -// collectively deallocated at one time. -// -// This simultaneously -// -// * Makes each individual allocation much more efficient; the -// typical allocation is trivial. -// * Completely avoids the cost of doing individual deallocation. -// * Saves the trouble of tracking down and plugging a large class of leaks. -// -// Individual classes can use this allocator by supplying their own -// new and delete methods. -// -// STL containers can use this allocator by using the pool_allocator -// class as the allocator (second) template argument. -// - -#include -#include -#include - -namespace glslang { - -// If we are using guard blocks, we must track each individual -// allocation. If we aren't using guard blocks, these -// never get instantiated, so won't have any impact. -// - -class TAllocation { -public: - TAllocation(size_t size, unsigned char* mem, TAllocation* prev = nullptr) : - size(size), mem(mem), prevAlloc(prev) { - // Allocations are bracketed: - // [allocationHeader][initialGuardBlock][userData][finalGuardBlock] - // This would be cleaner with if (guardBlockSize)..., but that - // makes the compiler print warnings about 0 length memsets, - // even with the if() protecting them. -# ifdef GUARD_BLOCKS - memset(preGuard(), guardBlockBeginVal, guardBlockSize); - memset(data(), userDataFill, size); - memset(postGuard(), guardBlockEndVal, guardBlockSize); -# endif - } - - void check() const { - checkGuardBlock(preGuard(), guardBlockBeginVal, "before"); - checkGuardBlock(postGuard(), guardBlockEndVal, "after"); - } - - void checkAllocList() const; - - // 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(); - } - - // Offset from surrounding buffer to get to user data buffer. - inline static unsigned char* offsetAllocation(unsigned char* m) { - return m + guardBlockSize + headerSize(); - } - -private: - void checkGuardBlock(unsigned char* blockMem, unsigned char val, const char* locText) const; - - // Find offsets to pre and post guard blocks, and user data buffer - unsigned char* preGuard() const { return mem + headerSize(); } - unsigned char* data() const { return preGuard() + guardBlockSize; } - unsigned char* postGuard() const { return data() + size; } - - size_t size; // size of the user data area - unsigned char* mem; // beginning of our allocation (pts to header) - TAllocation* prevAlloc; // prior allocation in the chain - - const static unsigned char guardBlockBeginVal; - const static unsigned char guardBlockEndVal; - const static unsigned char userDataFill; - - const static size_t guardBlockSize; -# ifdef GUARD_BLOCKS - inline static size_t headerSize() { return sizeof(TAllocation); } -# else - inline static size_t headerSize() { return 0; } -# endif -}; - -// -// There are several stacks. One is to track the pushing and popping -// of the user, and not yet implemented. The others are simply a -// repositories of free pages or used pages. -// -// Page stacks are linked together with a simple header at the beginning -// of each allocation obtained from the underlying OS. Multi-page allocations -// are returned to the OS. Individual page allocations are kept for future -// re-use. -// -// The "page size" used is not, nor must it match, the underlying OS -// page size. But, having it be about that size or equal to a set of -// pages is likely most optimal. -// -class TPoolAllocator { -public: - TPoolAllocator(int growthIncrement = 8*1024, int allocationAlignment = 16); - - // - // Don't call the destructor just to free up the memory, call pop() - // - ~TPoolAllocator(); - - // - // Call push() to establish a new place to pop memory too. Does not - // have to be called to get things started. - // - void push(); - - // - // Call pop() to free all memory allocated since the last call to push(), - // or if no last call to push, frees all memory since first allocation. - // - void pop(); - - // - // Call popAll() to free all memory allocated. - // - void popAll(); - - // - // Call allocate() to actually acquire memory. Returns nullptr if no memory - // available, otherwise a properly aligned pointer to 'numBytes' of memory. - // - void* allocate(size_t numBytes); - - // - // There is no deallocate. The point of this class is that - // deallocation can be skipped by the user of it, as the model - // of use is to simultaneously deallocate everything at once - // by calling pop(), and to not have to solve memory leak problems. - // - -protected: - friend struct tHeader; - - struct tHeader { - tHeader(tHeader* nextPage, size_t pageCount) : -#ifdef GUARD_BLOCKS - lastAllocation(nullptr), -#endif - nextPage(nextPage), pageCount(pageCount) { } - - ~tHeader() { -#ifdef GUARD_BLOCKS - if (lastAllocation) - lastAllocation->checkAllocList(); -#endif - } - -#ifdef GUARD_BLOCKS - TAllocation* lastAllocation; -#endif - tHeader* nextPage; - size_t pageCount; - }; - - struct tAllocState { - size_t offset; - tHeader* page; - }; - typedef std::vector tAllocStack; - - // Track allocations if and only if we're using guard blocks -#ifndef GUARD_BLOCKS - void* initializeAllocation(tHeader*, unsigned char* memory, size_t) { -#else - void* initializeAllocation(tHeader* block, unsigned char* memory, size_t numBytes) { - new(memory) TAllocation(numBytes, memory, block->lastAllocation); - block->lastAllocation = reinterpret_cast(memory); -#endif - - // This is optimized entirely away if GUARD_BLOCKS is not defined. - return TAllocation::offsetAllocation(memory); - } - - size_t pageSize; // granularity of allocation from the OS - size_t alignment; // all returned allocations will be aligned at - // this granularity, which will be a power of 2 - size_t alignmentMask; - size_t headerSkip; // amount of memory to skip to make room for the - // header (basically, size of header, rounded - // up to make it aligned - size_t currentPageOffset; // next offset in top of inUseList to allocate from - tHeader* freeList; // list of popped memory - tHeader* inUseList; // list of all memory currently being used - tAllocStack stack; // stack of where to allocate from, to partition pool - - int numCalls; // just an interesting statistic - size_t totalBytes; // just an interesting statistic -private: - TPoolAllocator& operator=(const TPoolAllocator&); // don't allow assignment operator - TPoolAllocator(const TPoolAllocator&); // don't allow default copy constructor -}; - -// -// There could potentially be many pools with pops happening at -// different times. But a simple use is to have a global pop -// with everyone using the same global allocator. -// -extern TPoolAllocator& GetThreadPoolAllocator(); -void SetThreadPoolAllocator(TPoolAllocator* poolAllocator); - -// -// This STL compatible allocator is intended to be used as the allocator -// parameter to templatized STL containers, like vector and map. -// -// It will use the pools for allocation, and not -// do any deallocation, but will still do destruction. -// -template -class pool_allocator { -public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef T *pointer; - typedef const T *const_pointer; - typedef T& reference; - typedef const T& const_reference; - typedef T value_type; - template - struct rebind { - typedef pool_allocator other; - }; - pointer address(reference x) const { return &x; } - const_pointer address(const_reference x) const { return &x; } - - pool_allocator() : allocator(GetThreadPoolAllocator()) { } - pool_allocator(TPoolAllocator& a) : allocator(a) { } - pool_allocator(const pool_allocator& p) : allocator(p.allocator) { } - - template - pool_allocator(const pool_allocator& p) : allocator(p.getAllocator()) { } - - pointer allocate(size_type n) { - return reinterpret_cast(getAllocator().allocate(n * sizeof(T))); } - pointer allocate(size_type n, const void*) { - return reinterpret_cast(getAllocator().allocate(n * sizeof(T))); } - - void deallocate(void*, size_type) { } - void deallocate(pointer, size_type) { } - - pointer _Charalloc(size_t n) { - return reinterpret_cast(getAllocator().allocate(n)); } - - void construct(pointer p, const T& val) { new ((void *)p) T(val); } - void destroy(pointer p) { p->T::~T(); } - - bool operator==(const pool_allocator& rhs) const { return &getAllocator() == &rhs.getAllocator(); } - bool operator!=(const pool_allocator& rhs) const { return &getAllocator() != &rhs.getAllocator(); } - - size_type max_size() const { return static_cast(-1) / sizeof(T); } - size_type max_size(int size) const { return static_cast(-1) / size; } - - TPoolAllocator& getAllocator() const { return allocator; } - - pool_allocator select_on_container_copy_construction() const { return pool_allocator{}; } - -protected: - pool_allocator& operator=(const pool_allocator&) { return *this; } - TPoolAllocator& allocator; -}; - -} // end namespace glslang - -#endif // _POOLALLOC_INCLUDED_ diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/ShHandle.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/ShHandle.h deleted file mode 100644 index dee47c0..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/ShHandle.h +++ /dev/null @@ -1,176 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// 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 _SHHANDLE_INCLUDED_ -#define _SHHANDLE_INCLUDED_ - -// -// Machine independent part of the compiler private objects -// sent as ShHandle to the driver. -// -// This should not be included by driver code. -// - -#define SH_EXPORTING -#include "../Public/ShaderLang.h" -#include "../MachineIndependent/Versions.h" -#include "InfoSink.h" - -class TCompiler; -class TLinker; -class TUniformMap; - -// -// The base class used to back handles returned to the driver. -// -class TShHandleBase { -public: - TShHandleBase() { pool = new glslang::TPoolAllocator; } - virtual ~TShHandleBase() { delete pool; } - virtual TCompiler* getAsCompiler() { return nullptr; } - virtual TLinker* getAsLinker() { return nullptr; } - virtual TUniformMap* getAsUniformMap() { return nullptr; } - virtual glslang::TPoolAllocator* getPool() const { return pool; } -private: - glslang::TPoolAllocator* pool; -}; - -// -// The base class for the machine dependent linker to derive from -// for managing where uniforms live. -// -class TUniformMap : public TShHandleBase { -public: - TUniformMap() { } - virtual ~TUniformMap() { } - virtual TUniformMap* getAsUniformMap() { return this; } - virtual int getLocation(const char* name) = 0; - virtual TInfoSink& getInfoSink() { return infoSink; } - TInfoSink infoSink; -}; - -class TIntermNode; - -// -// The base class for the machine dependent compiler to derive from -// for managing object code from the compile. -// -class TCompiler : public TShHandleBase { -public: - TCompiler(EShLanguage l, TInfoSink& sink) : infoSink(sink) , language(l), haveValidObjectCode(false) { } - virtual ~TCompiler() { } - EShLanguage getLanguage() { return language; } - virtual TInfoSink& getInfoSink() { return infoSink; } - - virtual bool compile(TIntermNode* root, int version = 0, EProfile profile = ENoProfile) = 0; - - virtual TCompiler* getAsCompiler() { return this; } - virtual bool linkable() { return haveValidObjectCode; } - - TInfoSink& infoSink; -protected: - TCompiler& operator=(TCompiler&); - - EShLanguage language; - bool haveValidObjectCode; -}; - -// -// Link operations are based on a list of compile results... -// -typedef glslang::TVector TCompilerList; -typedef glslang::TVector THandleList; - -// -// The base class for the machine dependent linker to derive from -// to manage the resulting executable. -// - -class TLinker : public TShHandleBase { -public: - TLinker(EShExecutable e, TInfoSink& iSink) : - infoSink(iSink), - executable(e), - haveReturnableObjectCode(false), - appAttributeBindings(nullptr), - fixedAttributeBindings(nullptr), - excludedAttributes(nullptr), - excludedCount(0), - uniformBindings(nullptr) { } - virtual TLinker* getAsLinker() { return this; } - virtual ~TLinker() { } - virtual bool link(TCompilerList&, TUniformMap*) = 0; - virtual bool link(THandleList&) { return false; } - virtual void setAppAttributeBindings(const ShBindingTable* t) { appAttributeBindings = t; } - virtual void setFixedAttributeBindings(const ShBindingTable* t) { fixedAttributeBindings = t; } - virtual void getAttributeBindings(ShBindingTable const **t) const = 0; - virtual void setExcludedAttributes(const int* attributes, int count) { excludedAttributes = attributes; excludedCount = count; } - virtual ShBindingTable* getUniformBindings() const { return uniformBindings; } - virtual const void* getObjectCode() const { return nullptr; } // a real compiler would be returning object code here - virtual TInfoSink& getInfoSink() { return infoSink; } - TInfoSink& infoSink; -protected: - TLinker& operator=(TLinker&); - EShExecutable executable; - bool haveReturnableObjectCode; // true when objectCode is acceptable to send to driver - - const ShBindingTable* appAttributeBindings; - const ShBindingTable* fixedAttributeBindings; - const int* excludedAttributes; - int excludedCount; - ShBindingTable* uniformBindings; // created by the linker -}; - -// -// This is the interface between the machine independent code -// and the machine dependent code. -// -// The machine dependent code should derive from the classes -// above. Then Construct*() and Delete*() will create and -// destroy the machine dependent objects, which contain the -// above machine independent information. -// -TCompiler* ConstructCompiler(EShLanguage, int); - -TShHandleBase* ConstructLinker(EShExecutable, int); -TShHandleBase* ConstructBindings(); -void DeleteLinker(TShHandleBase*); -void DeleteBindingList(TShHandleBase* bindingList); - -TUniformMap* ConstructUniformMap(); -void DeleteCompiler(TCompiler*); - -void DeleteUniformMap(TUniformMap*); - -#endif // _SHHANDLE_INCLUDED_ diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/SpirvIntrinsics.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/SpirvIntrinsics.h deleted file mode 100644 index 3c7d72c..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/SpirvIntrinsics.h +++ /dev/null @@ -1,128 +0,0 @@ -// -// Copyright(C) 2021 Advanced Micro Devices, 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. -// - -#pragma once - -#ifndef GLSLANG_WEB - -// -// GL_EXT_spirv_intrinsics -// -#include "Common.h" - -namespace glslang { - -class TIntermTyped; -class TIntermConstantUnion; -class TType; - -// SPIR-V requirements -struct TSpirvRequirement { - POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) - - // capability = [..] - TSet extensions; - // extension = [..] - TSet capabilities; -}; - -// SPIR-V execution modes -struct TSpirvExecutionMode { - POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) - - // spirv_execution_mode - TMap> modes; - // spirv_execution_mode_id - TMap > modeIds; -}; - -// SPIR-V decorations -struct TSpirvDecorate { - POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) - - // spirv_decorate - TMap > decorates; - // spirv_decorate_id - TMap> decorateIds; - // spirv_decorate_string - TMap > decorateStrings; -}; - -// SPIR-V instruction -struct TSpirvInstruction { - POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) - - TSpirvInstruction() { set = ""; id = -1; } - - bool operator==(const TSpirvInstruction& rhs) const { return set == rhs.set && id == rhs.id; } - bool operator!=(const TSpirvInstruction& rhs) const { return !operator==(rhs); } - - // spirv_instruction - TString set; - int id; -}; - -// SPIR-V type parameter -struct TSpirvTypeParameter { - POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) - - TSpirvTypeParameter(const TIntermConstantUnion* arg) { constant = arg; } - - bool operator==(const TSpirvTypeParameter& rhs) const { return constant == rhs.constant; } - bool operator!=(const TSpirvTypeParameter& rhs) const { return !operator==(rhs); } - - const TIntermConstantUnion* constant; -}; - -typedef TVector TSpirvTypeParameters; - -// SPIR-V type -struct TSpirvType { - POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) - - bool operator==(const TSpirvType& rhs) const - { - return spirvInst == rhs.spirvInst && typeParams == rhs.typeParams; - } - bool operator!=(const TSpirvType& rhs) const { return !operator==(rhs); } - - // spirv_type - TSpirvInstruction spirvInst; - TSpirvTypeParameters typeParams; -}; - -} // end namespace glslang - -#endif // GLSLANG_WEB diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/Types.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/Types.h deleted file mode 100644 index 59a447c..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/Types.h +++ /dev/null @@ -1,2957 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2012-2016 LunarG, Inc. -// Copyright (C) 2015-2016 Google, Inc. -// Copyright (C) 2017 ARM Limited. -// Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved. -// -// 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 _TYPES_INCLUDED -#define _TYPES_INCLUDED - -#include "../Include/Common.h" -#include "../Include/BaseTypes.h" -#include "../Public/ShaderLang.h" -#include "arrays.h" -#include "SpirvIntrinsics.h" - -#include - -namespace glslang { - -class TIntermAggregate; - -const int GlslangMaxTypeLength = 200; // TODO: need to print block/struct one member per line, so this can stay bounded - -const char* const AnonymousPrefix = "anon@"; // for something like a block whose members can be directly accessed -inline bool IsAnonymous(const TString& name) -{ - return name.compare(0, 5, AnonymousPrefix) == 0; -} - -// -// Details within a sampler type -// -enum TSamplerDim { - EsdNone, - Esd1D, - Esd2D, - Esd3D, - EsdCube, - EsdRect, - EsdBuffer, - EsdSubpass, // goes only with non-sampled image (image is true) - EsdNumDims -}; - -struct TSampler { // misnomer now; includes images, textures without sampler, and textures with sampler - TBasicType type : 8; // type returned by sampler - TSamplerDim dim : 8; - bool arrayed : 1; - bool shadow : 1; - bool ms : 1; - bool image : 1; // image, combined should be false - bool combined : 1; // true means texture is combined with a sampler, false means texture with no sampler - bool sampler : 1; // true means a pure sampler, other fields should be clear() - -#ifdef GLSLANG_WEB - bool is1D() const { return false; } - bool isBuffer() const { return false; } - bool isRect() const { return false; } - bool isSubpass() const { return false; } - bool isCombined() const { return true; } - bool isImage() const { return false; } - bool isImageClass() const { return false; } - bool isMultiSample() const { return false; } - bool isExternal() const { return false; } - void setExternal(bool e) { } - bool isYuv() const { return false; } -#else - unsigned int vectorSize : 3; // vector return type size. - // Some languages support structures as sample results. Storing the whole structure in the - // TSampler is too large, so there is an index to a separate table. - static const unsigned structReturnIndexBits = 4; // number of index bits to use. - static const unsigned structReturnSlots = (1< TTypeList; - -typedef TVector TIdentifierList; - -// -// Following are a series of helper enums for managing layouts and qualifiers, -// used for TPublicType, TType, others. -// - -enum TLayoutPacking { - ElpNone, - ElpShared, // default, but different than saying nothing - ElpStd140, - ElpStd430, - ElpPacked, - ElpScalar, - ElpCount // If expanding, see bitfield width below -}; - -enum TLayoutMatrix { - ElmNone, - ElmRowMajor, - ElmColumnMajor, // default, but different than saying nothing - ElmCount // If expanding, see bitfield width below -}; - -// Union of geometry shader and tessellation shader geometry types. -// They don't go into TType, but rather have current state per shader or -// active parser type (TPublicType). -enum TLayoutGeometry { - ElgNone, - ElgPoints, - ElgLines, - ElgLinesAdjacency, - ElgLineStrip, - ElgTriangles, - ElgTrianglesAdjacency, - ElgTriangleStrip, - ElgQuads, - ElgIsolines, -}; - -enum TVertexSpacing { - EvsNone, - EvsEqual, - EvsFractionalEven, - EvsFractionalOdd -}; - -enum TVertexOrder { - EvoNone, - EvoCw, - EvoCcw -}; - -// Note: order matters, as type of format is done by comparison. -enum TLayoutFormat { - ElfNone, - - // Float image - ElfRgba32f, - ElfRgba16f, - ElfR32f, - ElfRgba8, - ElfRgba8Snorm, - - ElfEsFloatGuard, // to help with comparisons - - ElfRg32f, - ElfRg16f, - ElfR11fG11fB10f, - ElfR16f, - ElfRgba16, - ElfRgb10A2, - ElfRg16, - ElfRg8, - ElfR16, - ElfR8, - ElfRgba16Snorm, - ElfRg16Snorm, - ElfRg8Snorm, - ElfR16Snorm, - ElfR8Snorm, - - ElfFloatGuard, // to help with comparisons - - // Int image - ElfRgba32i, - ElfRgba16i, - ElfRgba8i, - ElfR32i, - - ElfEsIntGuard, // to help with comparisons - - ElfRg32i, - ElfRg16i, - ElfRg8i, - ElfR16i, - ElfR8i, - ElfR64i, - - ElfIntGuard, // to help with comparisons - - // Uint image - ElfRgba32ui, - ElfRgba16ui, - ElfRgba8ui, - ElfR32ui, - - ElfEsUintGuard, // to help with comparisons - - ElfRg32ui, - ElfRg16ui, - ElfRgb10a2ui, - ElfRg8ui, - ElfR16ui, - ElfR8ui, - ElfR64ui, - ElfExtSizeGuard, // to help with comparisons - ElfSize1x8, - ElfSize1x16, - ElfSize1x32, - ElfSize2x32, - ElfSize4x32, - - ElfCount -}; - -enum TLayoutDepth { - EldNone, - EldAny, - EldGreater, - EldLess, - EldUnchanged, - - EldCount -}; - -enum TLayoutStencil { - ElsNone, - ElsRefUnchangedFrontAMD, - ElsRefGreaterFrontAMD, - ElsRefLessFrontAMD, - ElsRefUnchangedBackAMD, - ElsRefGreaterBackAMD, - ElsRefLessBackAMD, - - ElsCount -}; - -enum TBlendEquationShift { - // No 'EBlendNone': - // These are used as bit-shift amounts. A mask of such shifts will have type 'int', - // and in that space, 0 means no bits set, or none. In this enum, 0 means (1 << 0), a bit is set. - EBlendMultiply, - EBlendScreen, - EBlendOverlay, - EBlendDarken, - EBlendLighten, - EBlendColordodge, - EBlendColorburn, - EBlendHardlight, - EBlendSoftlight, - EBlendDifference, - EBlendExclusion, - EBlendHslHue, - EBlendHslSaturation, - EBlendHslColor, - EBlendHslLuminosity, - EBlendAllEquations, - - EBlendCount -}; - -enum TInterlockOrdering { - EioNone, - EioPixelInterlockOrdered, - EioPixelInterlockUnordered, - EioSampleInterlockOrdered, - EioSampleInterlockUnordered, - EioShadingRateInterlockOrdered, - EioShadingRateInterlockUnordered, - - EioCount, -}; - -enum TShaderInterface -{ - // Includes both uniform blocks and buffer blocks - EsiUniform = 0, - EsiInput, - EsiOutput, - EsiNone, - - EsiCount -}; - -class TQualifier { -public: - static const int layoutNotSet = -1; - - void clear() - { - precision = EpqNone; - invariant = false; - makeTemporary(); - declaredBuiltIn = EbvNone; -#ifndef GLSLANG_WEB - noContraction = false; - nullInit = false; - spirvByReference = false; - spirvLiteral = false; -#endif - defaultBlock = false; - } - - // drop qualifiers that don't belong in a temporary variable - void makeTemporary() - { - semanticName = nullptr; - storage = EvqTemporary; - builtIn = EbvNone; - clearInterstage(); - clearMemory(); - specConstant = false; - nonUniform = false; - nullInit = false; - defaultBlock = false; - clearLayout(); -#ifndef GLSLANG_WEB - spirvStorageClass = -1; - spirvDecorate = nullptr; - spirvByReference = false; - spirvLiteral = false; -#endif - } - - void clearInterstage() - { - clearInterpolation(); -#ifndef GLSLANG_WEB - patch = false; - sample = false; -#endif - } - - void clearInterpolation() - { - centroid = false; - smooth = false; - flat = false; -#ifndef GLSLANG_WEB - nopersp = false; - explicitInterp = false; - pervertexNV = false; - perPrimitiveNV = false; - perViewNV = false; - perTaskNV = false; -#endif - pervertexEXT = false; - } - - void clearMemory() - { -#ifndef GLSLANG_WEB - coherent = false; - devicecoherent = false; - queuefamilycoherent = false; - workgroupcoherent = false; - subgroupcoherent = false; - shadercallcoherent = false; - nonprivate = false; - volatil = false; - restrict = false; - readonly = false; - writeonly = false; -#endif - } - - const char* semanticName; - TStorageQualifier storage : 6; - TBuiltInVariable builtIn : 9; - TBuiltInVariable declaredBuiltIn : 9; - static_assert(EbvLast < 256, "need to increase size of TBuiltInVariable bitfields!"); - TPrecisionQualifier precision : 3; - bool invariant : 1; // require canonical treatment for cross-shader invariance - bool centroid : 1; - bool smooth : 1; - bool flat : 1; - // having a constant_id is not sufficient: expressions have no id, but are still specConstant - bool specConstant : 1; - bool nonUniform : 1; - bool explicitOffset : 1; - bool defaultBlock : 1; // default blocks with matching names have structures merged when linking - -#ifdef GLSLANG_WEB - bool isWriteOnly() const { return false; } - bool isReadOnly() const { return false; } - bool isRestrict() const { return false; } - bool isCoherent() const { return false; } - bool isVolatile() const { return false; } - bool isSample() const { return false; } - bool isMemory() const { return false; } - bool isMemoryQualifierImageAndSSBOOnly() const { return false; } - bool bufferReferenceNeedsVulkanMemoryModel() const { return false; } - bool isInterpolation() const { return flat || smooth; } - bool isExplicitInterpolation() const { return false; } - bool isAuxiliary() const { return centroid; } - bool isPatch() const { return false; } - bool isNoContraction() const { return false; } - void setNoContraction() { } - bool isPervertexNV() const { return false; } - bool isPervertexEXT() const { return pervertexEXT; } - void setNullInit() {} - bool isNullInit() const { return false; } - void setSpirvByReference() { } - bool isSpirvByReference() { return false; } - void setSpirvLiteral() { } - bool isSpirvLiteral() { return false; } -#else - bool noContraction: 1; // prevent contraction and reassociation, e.g., for 'precise' keyword, and expressions it affects - bool nopersp : 1; - bool explicitInterp : 1; - bool pervertexNV : 1; - bool pervertexEXT : 1; - bool perPrimitiveNV : 1; - bool perViewNV : 1; - bool perTaskNV : 1; - bool patch : 1; - bool sample : 1; - bool restrict : 1; - bool readonly : 1; - bool writeonly : 1; - bool coherent : 1; - bool volatil : 1; - bool devicecoherent : 1; - bool queuefamilycoherent : 1; - bool workgroupcoherent : 1; - bool subgroupcoherent : 1; - bool shadercallcoherent : 1; - bool nonprivate : 1; - bool nullInit : 1; - bool spirvByReference : 1; - bool spirvLiteral : 1; - bool isWriteOnly() const { return writeonly; } - bool isReadOnly() const { return readonly; } - bool isRestrict() const { return restrict; } - bool isCoherent() const { return coherent; } - bool isVolatile() const { return volatil; } - bool isSample() const { return sample; } - bool isMemory() const - { - return shadercallcoherent || subgroupcoherent || workgroupcoherent || queuefamilycoherent || devicecoherent || coherent || volatil || restrict || readonly || writeonly || nonprivate; - } - bool isMemoryQualifierImageAndSSBOOnly() const - { - return shadercallcoherent || subgroupcoherent || workgroupcoherent || queuefamilycoherent || devicecoherent || coherent || volatil || restrict || readonly || writeonly; - } - bool bufferReferenceNeedsVulkanMemoryModel() const - { - // include qualifiers that map to load/store availability/visibility/nonprivate memory access operands - return subgroupcoherent || workgroupcoherent || queuefamilycoherent || devicecoherent || coherent || nonprivate; - } - bool isInterpolation() const - { - return flat || smooth || nopersp || explicitInterp; - } - bool isExplicitInterpolation() const - { - return explicitInterp; - } - bool isAuxiliary() const - { - return centroid || patch || sample || pervertexNV || pervertexEXT; - } - bool isPatch() const { return patch; } - bool isNoContraction() const { return noContraction; } - void setNoContraction() { noContraction = true; } - bool isPervertexNV() const { return pervertexNV; } - bool isPervertexEXT() const { return pervertexEXT; } - void setNullInit() { nullInit = true; } - bool isNullInit() const { return nullInit; } - void setSpirvByReference() { spirvByReference = true; } - bool isSpirvByReference() const { return spirvByReference; } - void setSpirvLiteral() { spirvLiteral = true; } - bool isSpirvLiteral() const { return spirvLiteral; } -#endif - - bool isPipeInput() const - { - switch (storage) { - case EvqVaryingIn: - case EvqFragCoord: - case EvqPointCoord: - case EvqFace: - case EvqVertexId: - case EvqInstanceId: - return true; - default: - return false; - } - } - - bool isPipeOutput() const - { - switch (storage) { - case EvqPosition: - case EvqPointSize: - case EvqClipVertex: - case EvqVaryingOut: - case EvqFragColor: - case EvqFragDepth: - case EvqFragStencil: - return true; - default: - return false; - } - } - - bool isParamInput() const - { - switch (storage) { - case EvqIn: - case EvqInOut: - case EvqConstReadOnly: - return true; - default: - return false; - } - } - - bool isParamOutput() const - { - switch (storage) { - case EvqOut: - case EvqInOut: - return true; - default: - return false; - } - } - - bool isUniformOrBuffer() const - { - switch (storage) { - case EvqUniform: - case EvqBuffer: - return true; - default: - return false; - } - } - - bool isUniform() const - { - switch (storage) { - case EvqUniform: - return true; - default: - return false; - } - } - - bool isIo() const - { - switch (storage) { - case EvqUniform: - case EvqBuffer: - case EvqVaryingIn: - case EvqFragCoord: - case EvqPointCoord: - case EvqFace: - case EvqVertexId: - case EvqInstanceId: - case EvqPosition: - case EvqPointSize: - case EvqClipVertex: - case EvqVaryingOut: - case EvqFragColor: - case EvqFragDepth: - case EvqFragStencil: - return true; - default: - return false; - } - } - - // non-built-in symbols that might link between compilation units - bool isLinkable() const - { - switch (storage) { - case EvqGlobal: - case EvqVaryingIn: - case EvqVaryingOut: - case EvqUniform: - case EvqBuffer: - case EvqShared: - return true; - default: - return false; - } - } - - TBlockStorageClass getBlockStorage() const { - if (storage == EvqUniform && !isPushConstant()) { - return EbsUniform; - } - else if (storage == EvqUniform) { - return EbsPushConstant; - } - else if (storage == EvqBuffer) { - return EbsStorageBuffer; - } - return EbsNone; - } - - void setBlockStorage(TBlockStorageClass newBacking) { -#ifndef GLSLANG_WEB - layoutPushConstant = (newBacking == EbsPushConstant); -#endif - switch (newBacking) { - case EbsUniform : - if (layoutPacking == ElpStd430) { - // std430 would not be valid - layoutPacking = ElpStd140; - } - storage = EvqUniform; - break; - case EbsStorageBuffer : - storage = EvqBuffer; - break; -#ifndef GLSLANG_WEB - case EbsPushConstant : - storage = EvqUniform; - layoutSet = TQualifier::layoutSetEnd; - layoutBinding = TQualifier::layoutBindingEnd; - break; -#endif - default: - break; - } - } - -#ifdef GLSLANG_WEB - bool isPerView() const { return false; } - bool isTaskMemory() const { return false; } - bool isArrayedIo(EShLanguage language) const { return false; } -#else - bool isPerPrimitive() const { return perPrimitiveNV; } - bool isPerView() const { return perViewNV; } - bool isTaskMemory() const { return perTaskNV; } - bool isTaskPayload() const { return storage == EvqtaskPayloadSharedEXT; } - bool isAnyPayload() const { - return storage == EvqPayload || storage == EvqPayloadIn; - } - bool isAnyCallable() const { - return storage == EvqCallableData || storage == EvqCallableDataIn; - } - bool isHitObjectAttrNV() const { - return storage == EvqHitObjectAttrNV; - } - - // True if this type of IO is supposed to be arrayed with extra level for per-vertex data - bool isArrayedIo(EShLanguage language) const - { - switch (language) { - case EShLangGeometry: - return isPipeInput(); - case EShLangTessControl: - return ! patch && (isPipeInput() || isPipeOutput()); - case EShLangTessEvaluation: - return ! patch && isPipeInput(); - case EShLangFragment: - return (pervertexNV || pervertexEXT) && isPipeInput(); - case EShLangMesh: - return ! perTaskNV && isPipeOutput(); - - default: - return false; - } - } -#endif - - // Implementing an embedded layout-qualifier class here, since C++ can't have a real class bitfield - void clearLayout() // all layout - { - clearUniformLayout(); - -#ifndef GLSLANG_WEB - layoutPushConstant = false; - layoutBufferReference = false; - layoutPassthrough = false; - layoutViewportRelative = false; - // -2048 as the default value indicating layoutSecondaryViewportRelative is not set - layoutSecondaryViewportRelativeOffset = -2048; - layoutShaderRecord = false; - layoutHitObjectShaderRecordNV = false; - layoutBindlessSampler = false; - layoutBindlessImage = false; - layoutBufferReferenceAlign = layoutBufferReferenceAlignEnd; - layoutFormat = ElfNone; -#endif - - clearInterstageLayout(); - - layoutSpecConstantId = layoutSpecConstantIdEnd; - } - void clearInterstageLayout() - { - layoutLocation = layoutLocationEnd; - layoutComponent = layoutComponentEnd; -#ifndef GLSLANG_WEB - layoutIndex = layoutIndexEnd; - clearStreamLayout(); - clearXfbLayout(); -#endif - } - -#ifndef GLSLANG_WEB - void clearStreamLayout() - { - layoutStream = layoutStreamEnd; - } - void clearXfbLayout() - { - layoutXfbBuffer = layoutXfbBufferEnd; - layoutXfbStride = layoutXfbStrideEnd; - layoutXfbOffset = layoutXfbOffsetEnd; - } -#endif - - bool hasNonXfbLayout() const - { - return hasUniformLayout() || - hasAnyLocation() || - hasStream() || - hasFormat() || - isShaderRecord() || - isPushConstant() || - hasBufferReference(); - } - bool hasLayout() const - { - return hasNonXfbLayout() || - hasXfb(); - } - - TLayoutMatrix layoutMatrix : 3; - TLayoutPacking layoutPacking : 4; - int layoutOffset; - int layoutAlign; - - unsigned int layoutLocation : 12; - static const unsigned int layoutLocationEnd = 0xFFF; - - unsigned int layoutComponent : 3; - static const unsigned int layoutComponentEnd = 4; - - unsigned int layoutSet : 7; - static const unsigned int layoutSetEnd = 0x3F; - - unsigned int layoutBinding : 16; - static const unsigned int layoutBindingEnd = 0xFFFF; - - unsigned int layoutIndex : 8; - static const unsigned int layoutIndexEnd = 0xFF; - - unsigned int layoutStream : 8; - static const unsigned int layoutStreamEnd = 0xFF; - - unsigned int layoutXfbBuffer : 4; - static const unsigned int layoutXfbBufferEnd = 0xF; - - unsigned int layoutXfbStride : 14; - static const unsigned int layoutXfbStrideEnd = 0x3FFF; - - unsigned int layoutXfbOffset : 13; - static const unsigned int layoutXfbOffsetEnd = 0x1FFF; - - unsigned int layoutAttachment : 8; // for input_attachment_index - static const unsigned int layoutAttachmentEnd = 0XFF; - - unsigned int layoutSpecConstantId : 11; - static const unsigned int layoutSpecConstantIdEnd = 0x7FF; - -#ifndef GLSLANG_WEB - // stored as log2 of the actual alignment value - unsigned int layoutBufferReferenceAlign : 6; - static const unsigned int layoutBufferReferenceAlignEnd = 0x3F; - - TLayoutFormat layoutFormat : 8; - - bool layoutPushConstant; - bool layoutBufferReference; - bool layoutPassthrough; - bool layoutViewportRelative; - int layoutSecondaryViewportRelativeOffset; - bool layoutShaderRecord; - bool layoutHitObjectShaderRecordNV; - - // GL_EXT_spirv_intrinsics - int spirvStorageClass; - TSpirvDecorate* spirvDecorate; - - bool layoutBindlessSampler; - bool layoutBindlessImage; -#endif - - bool hasUniformLayout() const - { - return hasMatrix() || - hasPacking() || - hasOffset() || - hasBinding() || - hasSet() || - hasAlign(); - } - void clearUniformLayout() // only uniform specific - { - layoutMatrix = ElmNone; - layoutPacking = ElpNone; - layoutOffset = layoutNotSet; - layoutAlign = layoutNotSet; - - layoutSet = layoutSetEnd; - layoutBinding = layoutBindingEnd; -#ifndef GLSLANG_WEB - layoutAttachment = layoutAttachmentEnd; -#endif - } - - bool hasMatrix() const - { - return layoutMatrix != ElmNone; - } - bool hasPacking() const - { - return layoutPacking != ElpNone; - } - bool hasAlign() const - { - return layoutAlign != layoutNotSet; - } - bool hasAnyLocation() const - { - return hasLocation() || - hasComponent() || - hasIndex(); - } - bool hasLocation() const - { - return layoutLocation != layoutLocationEnd; - } - bool hasSet() const - { - return layoutSet != layoutSetEnd; - } - bool hasBinding() const - { - return layoutBinding != layoutBindingEnd; - } -#ifdef GLSLANG_WEB - bool hasOffset() const { return false; } - bool isNonPerspective() const { return false; } - bool hasIndex() const { return false; } - unsigned getIndex() const { return 0; } - bool hasComponent() const { return false; } - bool hasStream() const { return false; } - bool hasFormat() const { return false; } - bool hasXfb() const { return false; } - bool hasXfbBuffer() const { return false; } - bool hasXfbStride() const { return false; } - bool hasXfbOffset() const { return false; } - bool hasAttachment() const { return false; } - TLayoutFormat getFormat() const { return ElfNone; } - bool isPushConstant() const { return false; } - bool isShaderRecord() const { return false; } - bool hasBufferReference() const { return false; } - bool hasBufferReferenceAlign() const { return false; } - bool isNonUniform() const { return false; } -#else - bool hasOffset() const - { - return layoutOffset != layoutNotSet; - } - bool isNonPerspective() const { return nopersp; } - bool hasIndex() const - { - return layoutIndex != layoutIndexEnd; - } - unsigned getIndex() const { return layoutIndex; } - bool hasComponent() const - { - return layoutComponent != layoutComponentEnd; - } - bool hasStream() const - { - return layoutStream != layoutStreamEnd; - } - bool hasFormat() const - { - return layoutFormat != ElfNone; - } - bool hasXfb() const - { - return hasXfbBuffer() || - hasXfbStride() || - hasXfbOffset(); - } - bool hasXfbBuffer() const - { - return layoutXfbBuffer != layoutXfbBufferEnd; - } - bool hasXfbStride() const - { - return layoutXfbStride != layoutXfbStrideEnd; - } - bool hasXfbOffset() const - { - return layoutXfbOffset != layoutXfbOffsetEnd; - } - bool hasAttachment() const - { - return layoutAttachment != layoutAttachmentEnd; - } - TLayoutFormat getFormat() const { return layoutFormat; } - bool isPushConstant() const { return layoutPushConstant; } - bool isShaderRecord() const { return layoutShaderRecord; } - bool hasHitObjectShaderRecordNV() const { return layoutHitObjectShaderRecordNV; } - bool hasBufferReference() const { return layoutBufferReference; } - bool hasBufferReferenceAlign() const - { - return layoutBufferReferenceAlign != layoutBufferReferenceAlignEnd; - } - bool isNonUniform() const - { - return nonUniform; - } - bool isBindlessSampler() const - { - return layoutBindlessSampler; - } - bool isBindlessImage() const - { - return layoutBindlessImage; - } - - // GL_EXT_spirv_intrinsics - bool hasSprivDecorate() const { return spirvDecorate != nullptr; } - void setSpirvDecorate(int decoration, const TIntermAggregate* args = nullptr); - void setSpirvDecorateId(int decoration, const TIntermAggregate* args); - void setSpirvDecorateString(int decoration, const TIntermAggregate* args); - const TSpirvDecorate& getSpirvDecorate() const { assert(spirvDecorate); return *spirvDecorate; } - TSpirvDecorate& getSpirvDecorate() { assert(spirvDecorate); return *spirvDecorate; } - TString getSpirvDecorateQualifierString() const; -#endif - bool hasSpecConstantId() const - { - // Not the same thing as being a specialization constant, this - // is just whether or not it was declared with an ID. - return layoutSpecConstantId != layoutSpecConstantIdEnd; - } - bool isSpecConstant() const - { - // True if type is a specialization constant, whether or not it - // had a specialization-constant ID, and false if it is not a - // true front-end constant. - return specConstant; - } - bool isFrontEndConstant() const - { - // True if the front-end knows the final constant value. - // This allows front-end constant folding. - return storage == EvqConst && ! specConstant; - } - bool isConstant() const - { - // True if is either kind of constant; specialization or regular. - return isFrontEndConstant() || isSpecConstant(); - } - void makeSpecConstant() - { - storage = EvqConst; - specConstant = true; - } - static const char* getLayoutPackingString(TLayoutPacking packing) - { - switch (packing) { - case ElpStd140: return "std140"; -#ifndef GLSLANG_WEB - case ElpPacked: return "packed"; - case ElpShared: return "shared"; - case ElpStd430: return "std430"; - case ElpScalar: return "scalar"; -#endif - default: return "none"; - } - } - static const char* getLayoutMatrixString(TLayoutMatrix m) - { - switch (m) { - case ElmColumnMajor: return "column_major"; - case ElmRowMajor: return "row_major"; - default: return "none"; - } - } -#ifdef GLSLANG_WEB - static const char* getLayoutFormatString(TLayoutFormat f) { return "none"; } -#else - static const char* getLayoutFormatString(TLayoutFormat f) - { - switch (f) { - case ElfRgba32f: return "rgba32f"; - case ElfRgba16f: return "rgba16f"; - case ElfRg32f: return "rg32f"; - case ElfRg16f: return "rg16f"; - case ElfR11fG11fB10f: return "r11f_g11f_b10f"; - case ElfR32f: return "r32f"; - case ElfR16f: return "r16f"; - case ElfRgba16: return "rgba16"; - case ElfRgb10A2: return "rgb10_a2"; - case ElfRgba8: return "rgba8"; - case ElfRg16: return "rg16"; - case ElfRg8: return "rg8"; - case ElfR16: return "r16"; - case ElfR8: return "r8"; - case ElfRgba16Snorm: return "rgba16_snorm"; - case ElfRgba8Snorm: return "rgba8_snorm"; - case ElfRg16Snorm: return "rg16_snorm"; - case ElfRg8Snorm: return "rg8_snorm"; - case ElfR16Snorm: return "r16_snorm"; - case ElfR8Snorm: return "r8_snorm"; - - case ElfRgba32i: return "rgba32i"; - case ElfRgba16i: return "rgba16i"; - case ElfRgba8i: return "rgba8i"; - case ElfRg32i: return "rg32i"; - case ElfRg16i: return "rg16i"; - case ElfRg8i: return "rg8i"; - case ElfR32i: return "r32i"; - case ElfR16i: return "r16i"; - case ElfR8i: return "r8i"; - - case ElfRgba32ui: return "rgba32ui"; - case ElfRgba16ui: return "rgba16ui"; - case ElfRgba8ui: return "rgba8ui"; - case ElfRg32ui: return "rg32ui"; - case ElfRg16ui: return "rg16ui"; - case ElfRgb10a2ui: return "rgb10_a2ui"; - case ElfRg8ui: return "rg8ui"; - case ElfR32ui: return "r32ui"; - case ElfR16ui: return "r16ui"; - case ElfR8ui: return "r8ui"; - case ElfR64ui: return "r64ui"; - case ElfR64i: return "r64i"; - case ElfSize1x8: return "size1x8"; - case ElfSize1x16: return "size1x16"; - case ElfSize1x32: return "size1x32"; - case ElfSize2x32: return "size2x32"; - case ElfSize4x32: return "size4x32"; - default: return "none"; - } - } - static const char* getLayoutDepthString(TLayoutDepth d) - { - switch (d) { - case EldAny: return "depth_any"; - case EldGreater: return "depth_greater"; - case EldLess: return "depth_less"; - case EldUnchanged: return "depth_unchanged"; - default: return "none"; - } - } - static const char* getLayoutStencilString(TLayoutStencil s) - { - switch (s) { - case ElsRefUnchangedFrontAMD: return "stencil_ref_unchanged_front_amd"; - case ElsRefGreaterFrontAMD: return "stencil_ref_greater_front_amd"; - case ElsRefLessFrontAMD: return "stencil_ref_less_front_amd"; - case ElsRefUnchangedBackAMD: return "stencil_ref_unchanged_back_amd"; - case ElsRefGreaterBackAMD: return "stencil_ref_greater_back_amd"; - case ElsRefLessBackAMD: return "stencil_ref_less_back_amd"; - default: return "none"; - } - } - static const char* getBlendEquationString(TBlendEquationShift e) - { - switch (e) { - case EBlendMultiply: return "blend_support_multiply"; - case EBlendScreen: return "blend_support_screen"; - case EBlendOverlay: return "blend_support_overlay"; - case EBlendDarken: return "blend_support_darken"; - case EBlendLighten: return "blend_support_lighten"; - case EBlendColordodge: return "blend_support_colordodge"; - case EBlendColorburn: return "blend_support_colorburn"; - case EBlendHardlight: return "blend_support_hardlight"; - case EBlendSoftlight: return "blend_support_softlight"; - case EBlendDifference: return "blend_support_difference"; - case EBlendExclusion: return "blend_support_exclusion"; - case EBlendHslHue: return "blend_support_hsl_hue"; - case EBlendHslSaturation: return "blend_support_hsl_saturation"; - case EBlendHslColor: return "blend_support_hsl_color"; - case EBlendHslLuminosity: return "blend_support_hsl_luminosity"; - case EBlendAllEquations: return "blend_support_all_equations"; - default: return "unknown"; - } - } - static const char* getGeometryString(TLayoutGeometry geometry) - { - switch (geometry) { - case ElgPoints: return "points"; - case ElgLines: return "lines"; - case ElgLinesAdjacency: return "lines_adjacency"; - case ElgLineStrip: return "line_strip"; - case ElgTriangles: return "triangles"; - case ElgTrianglesAdjacency: return "triangles_adjacency"; - case ElgTriangleStrip: return "triangle_strip"; - case ElgQuads: return "quads"; - case ElgIsolines: return "isolines"; - default: return "none"; - } - } - static const char* getVertexSpacingString(TVertexSpacing spacing) - { - switch (spacing) { - case EvsEqual: return "equal_spacing"; - case EvsFractionalEven: return "fractional_even_spacing"; - case EvsFractionalOdd: return "fractional_odd_spacing"; - default: return "none"; - } - } - static const char* getVertexOrderString(TVertexOrder order) - { - switch (order) { - case EvoCw: return "cw"; - case EvoCcw: return "ccw"; - default: return "none"; - } - } - static int mapGeometryToSize(TLayoutGeometry geometry) - { - switch (geometry) { - case ElgPoints: return 1; - case ElgLines: return 2; - case ElgLinesAdjacency: return 4; - case ElgTriangles: return 3; - case ElgTrianglesAdjacency: return 6; - default: return 0; - } - } - static const char* getInterlockOrderingString(TInterlockOrdering order) - { - switch (order) { - case EioPixelInterlockOrdered: return "pixel_interlock_ordered"; - case EioPixelInterlockUnordered: return "pixel_interlock_unordered"; - case EioSampleInterlockOrdered: return "sample_interlock_ordered"; - case EioSampleInterlockUnordered: return "sample_interlock_unordered"; - case EioShadingRateInterlockOrdered: return "shading_rate_interlock_ordered"; - case EioShadingRateInterlockUnordered: return "shading_rate_interlock_unordered"; - default: return "none"; - } - } -#endif -}; - -// Qualifiers that don't need to be keep per object. They have shader scope, not object scope. -// So, they will not be part of TType, TQualifier, etc. -struct TShaderQualifiers { - TLayoutGeometry geometry; // geometry/tessellation shader in/out primitives - bool pixelCenterInteger; // fragment shader - bool originUpperLeft; // fragment shader - int invocations; - int vertices; // for tessellation "vertices", geometry & mesh "max_vertices" - TVertexSpacing spacing; - TVertexOrder order; - bool pointMode; - int localSize[3]; // compute shader - bool localSizeNotDefault[3]; // compute shader - int localSizeSpecId[3]; // compute shader specialization id for gl_WorkGroupSize -#ifndef GLSLANG_WEB - bool earlyFragmentTests; // fragment input - bool postDepthCoverage; // fragment input - bool earlyAndLateFragmentTestsAMD; //fragment input - TLayoutDepth layoutDepth; - TLayoutStencil layoutStencil; - bool blendEquation; // true if any blend equation was specified - int numViews; // multiview extenstions - TInterlockOrdering interlockOrdering; - bool layoutOverrideCoverage; // true if layout override_coverage set - bool layoutDerivativeGroupQuads; // true if layout derivative_group_quadsNV set - bool layoutDerivativeGroupLinear; // true if layout derivative_group_linearNV set - int primitives; // mesh shader "max_primitives"DerivativeGroupLinear; // true if layout derivative_group_linearNV set - bool layoutPrimitiveCulling; // true if layout primitive_culling set - TLayoutDepth getDepth() const { return layoutDepth; } - TLayoutStencil getStencil() const { return layoutStencil; } -#else - TLayoutDepth getDepth() const { return EldNone; } -#endif - - void init() - { - geometry = ElgNone; - originUpperLeft = false; - pixelCenterInteger = false; - invocations = TQualifier::layoutNotSet; - vertices = TQualifier::layoutNotSet; - spacing = EvsNone; - order = EvoNone; - pointMode = false; - localSize[0] = 1; - localSize[1] = 1; - localSize[2] = 1; - localSizeNotDefault[0] = false; - localSizeNotDefault[1] = false; - localSizeNotDefault[2] = false; - localSizeSpecId[0] = TQualifier::layoutNotSet; - localSizeSpecId[1] = TQualifier::layoutNotSet; - localSizeSpecId[2] = TQualifier::layoutNotSet; -#ifndef GLSLANG_WEB - earlyFragmentTests = false; - earlyAndLateFragmentTestsAMD = false; - postDepthCoverage = false; - layoutDepth = EldNone; - layoutStencil = ElsNone; - blendEquation = false; - numViews = TQualifier::layoutNotSet; - layoutOverrideCoverage = false; - layoutDerivativeGroupQuads = false; - layoutDerivativeGroupLinear = false; - layoutPrimitiveCulling = false; - primitives = TQualifier::layoutNotSet; - interlockOrdering = EioNone; -#endif - } - -#ifdef GLSLANG_WEB - bool hasBlendEquation() const { return false; } -#else - bool hasBlendEquation() const { return blendEquation; } -#endif - - // Merge in characteristics from the 'src' qualifier. They can override when - // set, but never erase when not set. - void merge(const TShaderQualifiers& src) - { - if (src.geometry != ElgNone) - geometry = src.geometry; - if (src.pixelCenterInteger) - pixelCenterInteger = src.pixelCenterInteger; - if (src.originUpperLeft) - originUpperLeft = src.originUpperLeft; - if (src.invocations != TQualifier::layoutNotSet) - invocations = src.invocations; - if (src.vertices != TQualifier::layoutNotSet) - vertices = src.vertices; - if (src.spacing != EvsNone) - spacing = src.spacing; - if (src.order != EvoNone) - order = src.order; - if (src.pointMode) - pointMode = true; - for (int i = 0; i < 3; ++i) { - if (src.localSize[i] > 1) - localSize[i] = src.localSize[i]; - } - for (int i = 0; i < 3; ++i) { - localSizeNotDefault[i] = src.localSizeNotDefault[i] || localSizeNotDefault[i]; - } - for (int i = 0; i < 3; ++i) { - if (src.localSizeSpecId[i] != TQualifier::layoutNotSet) - localSizeSpecId[i] = src.localSizeSpecId[i]; - } -#ifndef GLSLANG_WEB - if (src.earlyFragmentTests) - earlyFragmentTests = true; - if (src.earlyAndLateFragmentTestsAMD) - earlyAndLateFragmentTestsAMD = true; - if (src.postDepthCoverage) - postDepthCoverage = true; - if (src.layoutDepth) - layoutDepth = src.layoutDepth; - if (src.layoutStencil) - layoutStencil = src.layoutStencil; - if (src.blendEquation) - blendEquation = src.blendEquation; - if (src.numViews != TQualifier::layoutNotSet) - numViews = src.numViews; - if (src.layoutOverrideCoverage) - layoutOverrideCoverage = src.layoutOverrideCoverage; - if (src.layoutDerivativeGroupQuads) - layoutDerivativeGroupQuads = src.layoutDerivativeGroupQuads; - if (src.layoutDerivativeGroupLinear) - layoutDerivativeGroupLinear = src.layoutDerivativeGroupLinear; - if (src.primitives != TQualifier::layoutNotSet) - primitives = src.primitives; - if (src.interlockOrdering != EioNone) - interlockOrdering = src.interlockOrdering; - if (src.layoutPrimitiveCulling) - layoutPrimitiveCulling = src.layoutPrimitiveCulling; -#endif - } -}; - -// -// TPublicType is just temporarily used while parsing and not quite the same -// information kept per node in TType. Due to the bison stack, it can't have -// types that it thinks have non-trivial constructors. It should -// just be used while recognizing the grammar, not anything else. -// Once enough is known about the situation, the proper information -// moved into a TType, or the parse context, etc. -// -class TPublicType { -public: - TBasicType basicType; - TSampler sampler; - TQualifier qualifier; - TShaderQualifiers shaderQualifiers; - int vectorSize : 4; - int matrixCols : 4; - int matrixRows : 4; - bool coopmat : 1; - TArraySizes* arraySizes; - const TType* userDef; - TSourceLoc loc; - TArraySizes* typeParameters; -#ifndef GLSLANG_WEB - // SPIR-V type defined by spirv_type directive - TSpirvType* spirvType; -#endif - -#ifdef GLSLANG_WEB - bool isCoopmat() const { return false; } -#else - bool isCoopmat() const { return coopmat; } -#endif - - void initType(const TSourceLoc& l) - { - basicType = EbtVoid; - vectorSize = 1; - matrixRows = 0; - matrixCols = 0; - arraySizes = nullptr; - userDef = nullptr; - loc = l; - typeParameters = nullptr; - coopmat = false; -#ifndef GLSLANG_WEB - spirvType = nullptr; -#endif - } - - void initQualifiers(bool global = false) - { - qualifier.clear(); - if (global) - qualifier.storage = EvqGlobal; - } - - void init(const TSourceLoc& l, bool global = false) - { - initType(l); - sampler.clear(); - initQualifiers(global); - shaderQualifiers.init(); - } - - void setVector(int s) - { - matrixRows = 0; - matrixCols = 0; - vectorSize = s; - } - - void setMatrix(int c, int r) - { - matrixRows = r; - matrixCols = c; - vectorSize = 0; - } - - bool isScalar() const - { - return matrixCols == 0 && vectorSize == 1 && arraySizes == nullptr && userDef == nullptr; - } - -#ifndef GLSLANG_WEB - // GL_EXT_spirv_intrinsics - void setSpirvType(const TSpirvInstruction& spirvInst, const TSpirvTypeParameters* typeParams = nullptr); -#endif - - // "Image" is a superset of "Subpass" - bool isImage() const { return basicType == EbtSampler && sampler.isImage(); } - bool isSubpass() const { return basicType == EbtSampler && sampler.isSubpass(); } -}; - -// -// Base class for things that have a type. -// -class TType { -public: - POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) - - // 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, - bool isVector = false) : - basicType(t), vectorSize(vs), matrixCols(mc), matrixRows(mr), vector1(isVector && vs == 1), coopmat(false), - arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(nullptr) -#ifndef GLSLANG_WEB - , spirvType(nullptr) -#endif - { - sampler.clear(); - qualifier.clear(); - qualifier.storage = q; - assert(!(isMatrix() && vectorSize != 0)); // prevent vectorSize != 0 on matrices - } - // for explicit precision qualifier - TType(TBasicType t, TStorageQualifier q, TPrecisionQualifier p, int vs = 1, int mc = 0, int mr = 0, - bool isVector = false) : - basicType(t), vectorSize(vs), matrixCols(mc), matrixRows(mr), vector1(isVector && vs == 1), coopmat(false), - arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(nullptr) -#ifndef GLSLANG_WEB - , spirvType(nullptr) -#endif - { - sampler.clear(); - qualifier.clear(); - qualifier.storage = q; - qualifier.precision = p; - assert(p >= EpqNone && p <= EpqHigh); - assert(!(isMatrix() && vectorSize != 0)); // prevent vectorSize != 0 on matrices - } - // 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), vector1(false), coopmat(p.coopmat), - arraySizes(p.arraySizes), structure(nullptr), fieldName(nullptr), typeName(nullptr), typeParameters(p.typeParameters) -#ifndef GLSLANG_WEB - , spirvType(p.spirvType) -#endif - { - if (basicType == EbtSampler) - sampler = p.sampler; - else - sampler.clear(); - qualifier = p.qualifier; - if (p.userDef) { - if (p.userDef->basicType == EbtReference) { - basicType = EbtReference; - referentType = p.userDef->referentType; - } else { - structure = p.userDef->getWritableStruct(); // public type is short-lived; there are no sharing issues - } - typeName = NewPoolTString(p.userDef->getTypeName().c_str()); - } - if (p.isCoopmat() && p.typeParameters && p.typeParameters->getNumDims() > 0) { - int numBits = p.typeParameters->getDimSize(0); - if (p.basicType == EbtFloat && numBits == 16) { - basicType = EbtFloat16; - qualifier.precision = EpqNone; - } else if (p.basicType == EbtUint && numBits == 8) { - basicType = EbtUint8; - qualifier.precision = EpqNone; - } else if (p.basicType == EbtInt && numBits == 8) { - basicType = EbtInt8; - qualifier.precision = EpqNone; - } - } - } - // for construction of sampler types - TType(const TSampler& sampler, TStorageQualifier q = EvqUniform, TArraySizes* as = nullptr) : - basicType(EbtSampler), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), coopmat(false), - arraySizes(as), structure(nullptr), fieldName(nullptr), typeName(nullptr), - sampler(sampler), typeParameters(nullptr) -#ifndef GLSLANG_WEB - , spirvType(nullptr) -#endif - { - qualifier.clear(); - qualifier.storage = q; - } - // to efficiently make a dereferenced type - // without ever duplicating the outer structure that will be thrown away - // and using only shallow copy - TType(const TType& type, int derefIndex, bool rowMajor = false) - { - if (type.isArray()) { - shallowCopy(type); - if (type.getArraySizes()->getNumDims() == 1) { - arraySizes = nullptr; - } else { - // want our own copy of the array, so we can edit it - arraySizes = new TArraySizes; - arraySizes->copyDereferenced(*type.arraySizes); - } - } else if (type.basicType == EbtStruct || type.basicType == EbtBlock) { - // do a structure dereference - const TTypeList& memberList = *type.getStruct(); - shallowCopy(*memberList[derefIndex].type); - return; - } else { - // 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; - if (vectorSize == 1) - vector1 = true; - } else if (isVector()) { - // dereference from vector to scalar - vectorSize = 1; - vector1 = false; - } else if (isCoopMat()) { - coopmat = false; - typeParameters = nullptr; - } - } - } - // for making structures, ... - TType(TTypeList* userDef, const TString& n) : - basicType(EbtStruct), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), coopmat(false), - arraySizes(nullptr), structure(userDef), fieldName(nullptr), typeParameters(nullptr) -#ifndef GLSLANG_WEB - , spirvType(nullptr) -#endif - { - sampler.clear(); - qualifier.clear(); - typeName = NewPoolTString(n.c_str()); - } - // For interface blocks - TType(TTypeList* userDef, const TString& n, const TQualifier& q) : - basicType(EbtBlock), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), coopmat(false), - qualifier(q), arraySizes(nullptr), structure(userDef), fieldName(nullptr), typeParameters(nullptr) -#ifndef GLSLANG_WEB - , spirvType(nullptr) -#endif - { - sampler.clear(); - typeName = NewPoolTString(n.c_str()); - } - // for block reference (first parameter must be EbtReference) - explicit TType(TBasicType t, const TType &p, const TString& n) : - basicType(t), vectorSize(1), matrixCols(0), matrixRows(0), vector1(false), - arraySizes(nullptr), structure(nullptr), fieldName(nullptr), typeName(nullptr) -#ifndef GLSLANG_WEB - , spirvType(nullptr) -#endif - { - assert(t == EbtReference); - typeName = NewPoolTString(n.c_str()); - qualifier.clear(); - qualifier.storage = p.qualifier.storage; - referentType = p.clone(); - } - virtual ~TType() {} - - // Not for use across pool pops; it will cause multiple instances of TType to point to the same information. - // This only works if that information (like a structure's list of types) does not change and - // the instances are sharing the same pool. - void shallowCopy(const TType& copyOf) - { - basicType = copyOf.basicType; - sampler = copyOf.sampler; - qualifier = copyOf.qualifier; - vectorSize = copyOf.vectorSize; - matrixCols = copyOf.matrixCols; - matrixRows = copyOf.matrixRows; - vector1 = copyOf.vector1; - arraySizes = copyOf.arraySizes; // copying the pointer only, not the contents - fieldName = copyOf.fieldName; - typeName = copyOf.typeName; - if (isStruct()) { - structure = copyOf.structure; - } else { - referentType = copyOf.referentType; - } - typeParameters = copyOf.typeParameters; -#ifndef GLSLANG_WEB - spirvType = copyOf.spirvType; -#endif - coopmat = copyOf.isCoopMat(); - } - - // Make complete copy of the whole type graph rooted at 'copyOf'. - void deepCopy(const TType& copyOf) - { - TMap copied; // to enable copying a type graph as a graph, not a tree - deepCopy(copyOf, copied); - } - - // Recursively make temporary - void makeTemporary() - { - getQualifier().makeTemporary(); - - if (isStruct()) - for (unsigned int i = 0; i < structure->size(); ++i) - (*structure)[i].type->makeTemporary(); - } - - TType* clone() const - { - TType *newType = new TType(); - newType->deepCopy(*this); - - return newType; - } - - void makeVector() { vector1 = true; } - - virtual void hideMember() { basicType = EbtVoid; vectorSize = 1; } - virtual bool hiddenMember() const { return basicType == EbtVoid; } - - virtual void setFieldName(const TString& n) { fieldName = NewPoolTString(n.c_str()); } - virtual const TString& getTypeName() const - { - assert(typeName); - return *typeName; - } - - virtual const TString& getFieldName() const - { - assert(fieldName); - return *fieldName; - } - TShaderInterface getShaderInterface() const - { - if (basicType != EbtBlock) - return EsiNone; - - switch (qualifier.storage) { - default: - return EsiNone; - case EvqVaryingIn: - return EsiInput; - case EvqVaryingOut: - return EsiOutput; - case EvqUniform: - case EvqBuffer: - return EsiUniform; - } - } - - virtual TBasicType getBasicType() const { return basicType; } - virtual const TSampler& getSampler() const { return sampler; } - virtual TSampler& getSampler() { return sampler; } - - virtual TQualifier& getQualifier() { return qualifier; } - virtual const TQualifier& getQualifier() const { return qualifier; } - - 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(); } - virtual TIntermTyped* getOuterArrayNode() const { return arraySizes->getOuterNode(); } - virtual int getCumulativeArraySize() const { return arraySizes->getCumulativeSize(); } -#ifdef GLSLANG_WEB - bool isArrayOfArrays() const { return false; } -#else - bool isArrayOfArrays() const { return arraySizes != nullptr && arraySizes->getNumDims() > 1; } -#endif - virtual int getImplicitArraySize() const { return arraySizes->getImplicitSize(); } - virtual const TArraySizes* getArraySizes() const { return arraySizes; } - virtual TArraySizes* getArraySizes() { return arraySizes; } - virtual TType* getReferentType() const { return referentType; } - virtual const TArraySizes* getTypeParameters() const { return typeParameters; } - virtual TArraySizes* getTypeParameters() { return typeParameters; } - - virtual bool isScalar() const { return ! isVector() && ! isMatrix() && ! isStruct() && ! isArray(); } - virtual bool isScalarOrVec1() const { return isScalar() || vector1; } - virtual bool isScalarOrVector() const { return !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 isSizedArray() const { return isArray() && arraySizes->isSized(); } - virtual bool isUnsizedArray() const { return isArray() && !arraySizes->isSized(); } - virtual bool isImplicitlySizedArray() const { return isArray() && arraySizes->isImplicitlySized(); } - virtual bool isArrayVariablyIndexed() const { assert(isArray()); return arraySizes->isVariablyIndexed(); } - virtual void setArrayVariablyIndexed() { assert(isArray()); arraySizes->setVariablyIndexed(); } - virtual void updateImplicitArraySize(int size) { assert(isArray()); arraySizes->updateImplicitSize(size); } - virtual void setImplicitlySized(bool isImplicitSized) { arraySizes->setImplicitlySized(isImplicitSized); } - virtual bool isStruct() const { return basicType == EbtStruct || basicType == EbtBlock; } - virtual bool isFloatingDomain() const { return basicType == EbtFloat || basicType == EbtDouble || basicType == EbtFloat16; } - virtual bool isIntegerDomain() const - { - switch (basicType) { - case EbtInt8: - case EbtUint8: - case EbtInt16: - case EbtUint16: - case EbtInt: - case EbtUint: - case EbtInt64: - case EbtUint64: - case EbtAtomicUint: - return true; - default: - break; - } - return false; - } - virtual bool isOpaque() const { return basicType == EbtSampler -#ifndef GLSLANG_WEB - || basicType == EbtAtomicUint || basicType == EbtAccStruct || basicType == EbtRayQuery - || basicType == EbtHitObjectNV -#endif - ; } - virtual bool isBuiltIn() const { return getQualifier().builtIn != EbvNone; } - - // "Image" is a superset of "Subpass" - virtual bool isImage() const { return basicType == EbtSampler && getSampler().isImage(); } - virtual bool isSubpass() const { return basicType == EbtSampler && getSampler().isSubpass(); } - virtual bool isTexture() const { return basicType == EbtSampler && getSampler().isTexture(); } - virtual bool isBindlessImage() const { return isImage() && qualifier.layoutBindlessImage; } - virtual bool isBindlessTexture() const { return isTexture() && qualifier.layoutBindlessSampler; } - // Check the block-name convention of creating a block without populating it's members: - virtual bool isUnusableName() const { return isStruct() && structure == nullptr; } - virtual bool isParameterized() const { return typeParameters != nullptr; } -#ifdef GLSLANG_WEB - bool isAtomic() const { return false; } - bool isCoopMat() const { return false; } - bool isReference() const { return false; } - bool isSpirvType() const { return false; } -#else - bool isAtomic() const { return basicType == EbtAtomicUint; } - bool isCoopMat() const { return coopmat; } - bool isReference() const { return getBasicType() == EbtReference; } - bool isSpirvType() const { return getBasicType() == EbtSpirvType; } -#endif - - // return true if this type contains any subtype which satisfies the given predicate. - template - bool contains(P predicate) const - { - if (predicate(this)) - return true; - - const auto hasa = [predicate](const TTypeLoc& tl) { return tl.type->contains(predicate); }; - - return isStruct() && std::any_of(structure->begin(), structure->end(), hasa); - } - - // Recursively checks if the type contains the given basic type - virtual bool containsBasicType(TBasicType checkType) const - { - return contains([checkType](const TType* t) { return t->basicType == checkType; } ); - } - - // Recursively check the structure for any arrays, needed for some error checks - virtual bool containsArray() const - { - return contains([](const TType* t) { return t->isArray(); } ); - } - - // Check the structure for any structures, needed for some error checks - virtual bool containsStructure() const - { - return contains([this](const TType* t) { return t != this && t->isStruct(); } ); - } - - // Recursively check the structure for any unsized arrays, needed for triggering a copyUp(). - virtual bool containsUnsizedArray() const - { - return contains([](const TType* t) { return t->isUnsizedArray(); } ); - } - - virtual bool containsOpaque() const - { - return contains([](const TType* t) { return t->isOpaque(); } ); - } - - virtual bool containsSampler() const - { - return contains([](const TType* t) { return t->isTexture() || t->isImage(); }); - } - - // Recursively checks if the type contains a built-in variable - virtual bool containsBuiltIn() const - { - return contains([](const TType* t) { return t->isBuiltIn(); } ); - } - - virtual bool containsNonOpaque() const - { - const auto nonOpaque = [](const TType* t) { - switch (t->basicType) { - case EbtVoid: - case EbtFloat: - case EbtDouble: - case EbtFloat16: - case EbtInt8: - case EbtUint8: - case EbtInt16: - case EbtUint16: - case EbtInt: - case EbtUint: - case EbtInt64: - case EbtUint64: - case EbtBool: - case EbtReference: - return true; - default: - return false; - } - }; - - return contains(nonOpaque); - } - - virtual bool containsSpecializationSize() const - { - return contains([](const TType* t) { return t->isArray() && t->arraySizes->isOuterSpecialization(); } ); - } - -#ifdef GLSLANG_WEB - bool containsDouble() const { return false; } - bool contains16BitFloat() const { return false; } - bool contains64BitInt() const { return false; } - bool contains16BitInt() const { return false; } - bool contains8BitInt() const { return false; } - bool containsCoopMat() const { return false; } - bool containsReference() const { return false; } -#else - bool containsDouble() const - { - return containsBasicType(EbtDouble); - } - bool contains16BitFloat() const - { - return containsBasicType(EbtFloat16); - } - bool contains64BitInt() const - { - return containsBasicType(EbtInt64) || containsBasicType(EbtUint64); - } - bool contains16BitInt() const - { - return containsBasicType(EbtInt16) || containsBasicType(EbtUint16); - } - bool contains8BitInt() const - { - return containsBasicType(EbtInt8) || containsBasicType(EbtUint8); - } - bool containsCoopMat() const - { - return contains([](const TType* t) { return t->coopmat; } ); - } - bool containsReference() const - { - return containsBasicType(EbtReference); - } -#endif - - // Array editing methods. Array descriptors can be shared across - // type instances. This allows all uses of the same array - // to be updated at once. E.g., all nodes can be explicitly sized - // by tracking and correcting one implicit size. Or, all nodes - // can get the explicit size on a redeclaration that gives size. - // - // N.B.: Don't share with the shared symbol tables (symbols are - // marked as isReadOnly(). Such symbols with arrays that will be - // edited need to copyUp() on first use, so that - // A) the edits don't effect the shared symbol table, and - // B) the edits are shared across all users. - void updateArraySizes(const TType& type) - { - // For when we may already be sharing existing array descriptors, - // keeping the pointers the same, just updating the contents. - assert(arraySizes != nullptr); - assert(type.arraySizes != nullptr); - *arraySizes = *type.arraySizes; - } - void copyArraySizes(const TArraySizes& s) - { - // For setting a fresh new set of array sizes, not yet worrying about sharing. - arraySizes = new TArraySizes; - *arraySizes = s; - } - void transferArraySizes(TArraySizes* s) - { - // For setting an already allocated set of sizes that this type can use - // (no copy made). - arraySizes = s; - } - void clearArraySizes() - { - arraySizes = nullptr; - } - - // Add inner array sizes, to any existing sizes, via copy; the - // sizes passed in can still be reused for other purposes. - void copyArrayInnerSizes(const TArraySizes* s) - { - if (s != nullptr) { - if (arraySizes == nullptr) - copyArraySizes(*s); - else - arraySizes->addInnerSizes(*s); - } - } - void changeOuterArraySize(int s) { arraySizes->changeOuterSize(s); } - - // Recursively make the implicit array size the explicit array size. - // Expicit arrays are compile-time or link-time sized, never run-time sized. - // Sometimes, policy calls for an array to be run-time sized even if it was - // never variably indexed: Don't turn a 'skipNonvariablyIndexed' array into - // an explicit array. - void adoptImplicitArraySizes(bool skipNonvariablyIndexed) - { - if (isUnsizedArray() && - (qualifier.builtIn == EbvSampleMask || - !(skipNonvariablyIndexed || isArrayVariablyIndexed()))) { - changeOuterArraySize(getImplicitArraySize()); - setImplicitlySized(true); - } - // For multi-dim per-view arrays, set unsized inner dimension size to 1 - if (qualifier.isPerView() && arraySizes && arraySizes->isInnerUnsized()) - arraySizes->clearInnerUnsized(); - if (isStruct() && structure->size() > 0) { - int lastMember = (int)structure->size() - 1; - for (int i = 0; i < lastMember; ++i) - (*structure)[i].type->adoptImplicitArraySizes(false); - // implement the "last member of an SSBO" policy - (*structure)[lastMember].type->adoptImplicitArraySizes(getQualifier().storage == EvqBuffer); - } - } - - - void updateTypeParameters(const TType& type) - { - // For when we may already be sharing existing array descriptors, - // keeping the pointers the same, just updating the contents. - assert(typeParameters != nullptr); - assert(type.typeParameters != nullptr); - *typeParameters = *type.typeParameters; - } - void copyTypeParameters(const TArraySizes& s) - { - // For setting a fresh new set of type parameters, not yet worrying about sharing. - typeParameters = new TArraySizes; - *typeParameters = s; - } - void transferTypeParameters(TArraySizes* s) - { - // For setting an already allocated set of sizes that this type can use - // (no copy made). - typeParameters = s; - } - void clearTypeParameters() - { - typeParameters = nullptr; - } - - // Add inner array sizes, to any existing sizes, via copy; the - // sizes passed in can still be reused for other purposes. - void copyTypeParametersInnerSizes(const TArraySizes* s) - { - if (s != nullptr) { - if (typeParameters == nullptr) - copyTypeParameters(*s); - else - typeParameters->addInnerSizes(*s); - } - } - - const char* getBasicString() const - { - return TType::getBasicString(basicType); - } - - static const char* getBasicString(TBasicType t) - { - switch (t) { - case EbtFloat: return "float"; - case EbtInt: return "int"; - case EbtUint: return "uint"; - case EbtSampler: return "sampler/image"; -#ifndef GLSLANG_WEB - case EbtVoid: return "void"; - case EbtDouble: return "double"; - case EbtFloat16: return "float16_t"; - case EbtInt8: return "int8_t"; - case EbtUint8: return "uint8_t"; - case EbtInt16: return "int16_t"; - case EbtUint16: return "uint16_t"; - case EbtInt64: return "int64_t"; - case EbtUint64: return "uint64_t"; - case EbtBool: return "bool"; - case EbtAtomicUint: return "atomic_uint"; - case EbtStruct: return "structure"; - case EbtBlock: return "block"; - case EbtAccStruct: return "accelerationStructureNV"; - case EbtRayQuery: return "rayQueryEXT"; - case EbtReference: return "reference"; - case EbtString: return "string"; - case EbtSpirvType: return "spirv_type"; -#endif - default: return "unknown type"; - } - } - -#ifdef GLSLANG_WEB - TString getCompleteString() const { return ""; } - const char* getStorageQualifierString() const { return ""; } - const char* getBuiltInVariableString() const { return ""; } - const char* getPrecisionQualifierString() const { return ""; } - TString getBasicTypeString() const { return ""; } -#else - TString getCompleteString(bool syntactic = false, bool getQualifiers = true, bool getPrecision = true, - bool getType = true, TString name = "", TString structName = "") const - { - TString typeString; - - const auto appendStr = [&](const char* s) { typeString.append(s); }; - const auto appendUint = [&](unsigned int u) { typeString.append(std::to_string(u).c_str()); }; - const auto appendInt = [&](int i) { typeString.append(std::to_string(i).c_str()); }; - - if (getQualifiers) { - if (qualifier.hasSprivDecorate()) - appendStr(qualifier.getSpirvDecorateQualifierString().c_str()); - - if (qualifier.hasLayout()) { - // To reduce noise, skip this if the only layout is an xfb_buffer - // with no triggering xfb_offset. - TQualifier noXfbBuffer = qualifier; - noXfbBuffer.layoutXfbBuffer = TQualifier::layoutXfbBufferEnd; - if (noXfbBuffer.hasLayout()) { - appendStr("layout("); - if (qualifier.hasAnyLocation()) { - appendStr(" location="); - appendUint(qualifier.layoutLocation); - if (qualifier.hasComponent()) { - appendStr(" component="); - appendUint(qualifier.layoutComponent); - } - if (qualifier.hasIndex()) { - appendStr(" index="); - appendUint(qualifier.layoutIndex); - } - } - if (qualifier.hasSet()) { - appendStr(" set="); - appendUint(qualifier.layoutSet); - } - if (qualifier.hasBinding()) { - appendStr(" binding="); - appendUint(qualifier.layoutBinding); - } - if (qualifier.hasStream()) { - appendStr(" stream="); - appendUint(qualifier.layoutStream); - } - if (qualifier.hasMatrix()) { - appendStr(" "); - appendStr(TQualifier::getLayoutMatrixString(qualifier.layoutMatrix)); - } - if (qualifier.hasPacking()) { - appendStr(" "); - appendStr(TQualifier::getLayoutPackingString(qualifier.layoutPacking)); - } - if (qualifier.hasOffset()) { - appendStr(" offset="); - appendInt(qualifier.layoutOffset); - } - if (qualifier.hasAlign()) { - appendStr(" align="); - appendInt(qualifier.layoutAlign); - } - if (qualifier.hasFormat()) { - appendStr(" "); - appendStr(TQualifier::getLayoutFormatString(qualifier.layoutFormat)); - } - if (qualifier.hasXfbBuffer() && qualifier.hasXfbOffset()) { - appendStr(" xfb_buffer="); - appendUint(qualifier.layoutXfbBuffer); - } - if (qualifier.hasXfbOffset()) { - appendStr(" xfb_offset="); - appendUint(qualifier.layoutXfbOffset); - } - if (qualifier.hasXfbStride()) { - appendStr(" xfb_stride="); - appendUint(qualifier.layoutXfbStride); - } - if (qualifier.hasAttachment()) { - appendStr(" input_attachment_index="); - appendUint(qualifier.layoutAttachment); - } - if (qualifier.hasSpecConstantId()) { - appendStr(" constant_id="); - appendUint(qualifier.layoutSpecConstantId); - } - if (qualifier.layoutPushConstant) - appendStr(" push_constant"); - if (qualifier.layoutBufferReference) - appendStr(" buffer_reference"); - if (qualifier.hasBufferReferenceAlign()) { - appendStr(" buffer_reference_align="); - appendUint(1u << qualifier.layoutBufferReferenceAlign); - } - - if (qualifier.layoutPassthrough) - appendStr(" passthrough"); - if (qualifier.layoutViewportRelative) - appendStr(" layoutViewportRelative"); - if (qualifier.layoutSecondaryViewportRelativeOffset != -2048) { - appendStr(" layoutSecondaryViewportRelativeOffset="); - appendInt(qualifier.layoutSecondaryViewportRelativeOffset); - } - - if (qualifier.layoutShaderRecord) - appendStr(" shaderRecordNV"); - if (qualifier.layoutHitObjectShaderRecordNV) - appendStr(" hitobjectshaderrecordnv"); - - if (qualifier.layoutBindlessSampler) - appendStr(" layoutBindlessSampler"); - if (qualifier.layoutBindlessImage) - appendStr(" layoutBindlessImage"); - - appendStr(")"); - } - } - - if (qualifier.invariant) - appendStr(" invariant"); - if (qualifier.noContraction) - appendStr(" noContraction"); - if (qualifier.centroid) - appendStr(" centroid"); - if (qualifier.smooth) - appendStr(" smooth"); - if (qualifier.flat) - appendStr(" flat"); - if (qualifier.nopersp) - appendStr(" noperspective"); - if (qualifier.explicitInterp) - appendStr(" __explicitInterpAMD"); - if (qualifier.pervertexNV) - appendStr(" pervertexNV"); - if (qualifier.pervertexEXT) - appendStr(" pervertexEXT"); - if (qualifier.perPrimitiveNV) - appendStr(" perprimitiveNV"); - if (qualifier.perViewNV) - appendStr(" perviewNV"); - if (qualifier.perTaskNV) - appendStr(" taskNV"); - if (qualifier.patch) - appendStr(" patch"); - if (qualifier.sample) - appendStr(" sample"); - if (qualifier.coherent) - appendStr(" coherent"); - if (qualifier.devicecoherent) - appendStr(" devicecoherent"); - if (qualifier.queuefamilycoherent) - appendStr(" queuefamilycoherent"); - if (qualifier.workgroupcoherent) - appendStr(" workgroupcoherent"); - if (qualifier.subgroupcoherent) - appendStr(" subgroupcoherent"); - if (qualifier.shadercallcoherent) - appendStr(" shadercallcoherent"); - if (qualifier.nonprivate) - appendStr(" nonprivate"); - if (qualifier.volatil) - appendStr(" volatile"); - if (qualifier.restrict) - appendStr(" restrict"); - if (qualifier.readonly) - appendStr(" readonly"); - if (qualifier.writeonly) - appendStr(" writeonly"); - if (qualifier.specConstant) - appendStr(" specialization-constant"); - if (qualifier.nonUniform) - appendStr(" nonuniform"); - if (qualifier.isNullInit()) - appendStr(" null-init"); - if (qualifier.isSpirvByReference()) - appendStr(" spirv_by_reference"); - if (qualifier.isSpirvLiteral()) - appendStr(" spirv_literal"); - appendStr(" "); - appendStr(getStorageQualifierString()); - } - if (getType) { - if (syntactic) { - if (getPrecision && qualifier.precision != EpqNone) { - appendStr(" "); - appendStr(getPrecisionQualifierString()); - } - if (isVector() || isMatrix()) { - appendStr(" "); - switch (basicType) { - case EbtDouble: - appendStr("d"); - break; - case EbtInt: - appendStr("i"); - break; - case EbtUint: - appendStr("u"); - break; - case EbtBool: - appendStr("b"); - break; - case EbtFloat: - default: - break; - } - if (isVector()) { - appendStr("vec"); - appendInt(vectorSize); - } else { - appendStr("mat"); - appendInt(matrixCols); - appendStr("x"); - appendInt(matrixRows); - } - } else if (isStruct() && structure) { - appendStr(" "); - appendStr(structName.c_str()); - appendStr("{"); - bool hasHiddenMember = true; - for (size_t i = 0; i < structure->size(); ++i) { - if (!(*structure)[i].type->hiddenMember()) { - if (!hasHiddenMember) - appendStr(", "); - typeString.append((*structure)[i].type->getCompleteString(syntactic, getQualifiers, getPrecision, getType, (*structure)[i].type->getFieldName())); - hasHiddenMember = false; - } - } - appendStr("}"); - } else { - appendStr(" "); - switch (basicType) { - case EbtDouble: - appendStr("double"); - break; - case EbtInt: - appendStr("int"); - break; - case EbtUint: - appendStr("uint"); - break; - case EbtBool: - appendStr("bool"); - break; - case EbtFloat: - appendStr("float"); - break; - default: - appendStr("unexpected"); - break; - } - } - if (name.length() > 0) { - appendStr(" "); - appendStr(name.c_str()); - } - if (isArray()) { - for (int i = 0; i < (int)arraySizes->getNumDims(); ++i) { - int size = arraySizes->getDimSize(i); - if (size == UnsizedArraySize && i == 0 && arraySizes->isVariablyIndexed()) - appendStr("[]"); - else { - if (size == UnsizedArraySize) { - appendStr("["); - if (i == 0) - appendInt(arraySizes->getImplicitSize()); - appendStr("]"); - } - else { - appendStr("["); - appendInt(arraySizes->getDimSize(i)); - appendStr("]"); - } - } - } - } - } - else { - if (isArray()) { - for (int i = 0; i < (int)arraySizes->getNumDims(); ++i) { - int size = arraySizes->getDimSize(i); - if (size == UnsizedArraySize && i == 0 && arraySizes->isVariablyIndexed()) - appendStr(" runtime-sized array of"); - else { - if (size == UnsizedArraySize) { - appendStr(" unsized"); - if (i == 0) { - appendStr(" "); - appendInt(arraySizes->getImplicitSize()); - } - } - else { - appendStr(" "); - appendInt(arraySizes->getDimSize(i)); - } - appendStr("-element array of"); - } - } - } - if (isParameterized()) { - appendStr("<"); - for (int i = 0; i < (int)typeParameters->getNumDims(); ++i) { - appendInt(typeParameters->getDimSize(i)); - if (i != (int)typeParameters->getNumDims() - 1) - appendStr(", "); - } - appendStr(">"); - } - if (getPrecision && qualifier.precision != EpqNone) { - appendStr(" "); - appendStr(getPrecisionQualifierString()); - } - if (isMatrix()) { - appendStr(" "); - appendInt(matrixCols); - appendStr("X"); - appendInt(matrixRows); - appendStr(" matrix of"); - } - else if (isVector()) { - appendStr(" "); - appendInt(vectorSize); - appendStr("-component vector of"); - } - - appendStr(" "); - typeString.append(getBasicTypeString()); - - if (qualifier.builtIn != EbvNone) { - appendStr(" "); - appendStr(getBuiltInVariableString()); - } - - // Add struct/block members - if (isStruct() && structure) { - appendStr("{"); - bool hasHiddenMember = true; - for (size_t i = 0; i < structure->size(); ++i) { - if (!(*structure)[i].type->hiddenMember()) { - if (!hasHiddenMember) - appendStr(", "); - typeString.append((*structure)[i].type->getCompleteString()); - typeString.append(" "); - typeString.append((*structure)[i].type->getFieldName()); - hasHiddenMember = false; - } - } - appendStr("}"); - } - } - } - - return typeString; - } - - TString getBasicTypeString() const - { - if (basicType == EbtSampler) - return sampler.getString(); - else - return getBasicString(); - } - - const char* getStorageQualifierString() const { return GetStorageQualifierString(qualifier.storage); } - const char* getBuiltInVariableString() const { return GetBuiltInVariableString(qualifier.builtIn); } - const char* getPrecisionQualifierString() const { return GetPrecisionQualifierString(qualifier.precision); } -#endif - - const TTypeList* getStruct() const { assert(isStruct()); return structure; } - void setStruct(TTypeList* s) { assert(isStruct()); structure = s; } - TTypeList* getWritableStruct() const { assert(isStruct()); return structure; } // This should only be used when known to not be sharing with other threads - void setBasicType(const TBasicType& t) { basicType = t; } - void setVectorSize(int s) { vectorSize = s; } - - int computeNumComponents() const - { - int components = 0; - - if (getBasicType() == EbtStruct || getBasicType() == EbtBlock) { - for (TTypeList::const_iterator tl = getStruct()->begin(); tl != getStruct()->end(); tl++) - components += ((*tl).type)->computeNumComponents(); - } else if (matrixCols) - components = matrixCols * matrixRows; - else - components = vectorSize; - - if (arraySizes != nullptr) { - components *= arraySizes->getCumulativeSize(); - } - - return components; - } - - // append this type's mangled name to the passed in 'name' - void appendMangledName(TString& name) const - { - buildMangledName(name); - name += ';' ; - } - - // These variables are inconsistently declared inside and outside of gl_PerVertex in glslang right now. - // They are declared inside of 'in gl_PerVertex', but sitting as standalone when they are 'out'puts. - bool isInconsistentGLPerVertexMember(const TString& name) const - { - if (name == "gl_SecondaryPositionNV" || - name == "gl_PositionPerViewNV") - return true; - return false; - } - - - // Do two structure types match? They could be declared independently, - // in different places, but still might satisfy the definition of matching. - // From the spec: - // - // "Structures must have the same name, sequence of type names, and - // type definitions, and member names to be considered the same type. - // This rule applies recursively for nested or embedded types." - // - // If type mismatch in structure, return member indices through lpidx and rpidx. - // If matching members for either block are exhausted, return -1 for exhausted - // block and the index of the unmatched member. Otherwise return {-1,-1}. - // - bool sameStructType(const TType& right, int* lpidx = nullptr, int* rpidx = nullptr) const - { - // Initialize error to general type mismatch. - if (lpidx != nullptr) { - *lpidx = -1; - *rpidx = -1; - } - - // Most commonly, they are both nullptr, or the same pointer to the same actual structure - // TODO: Why return true when neither types are structures? - if ((!isStruct() && !right.isStruct()) || - (isStruct() && right.isStruct() && structure == right.structure)) - return true; - - if (!isStruct() || !right.isStruct()) - return false; - - // Structure names have to match - if (*typeName != *right.typeName) - return false; - - // There are inconsistencies with how gl_PerVertex is setup. For now ignore those as errors if they - // are known inconsistencies. - bool isGLPerVertex = *typeName == "gl_PerVertex"; - - // Both being nullptr was caught above, now they both have to be structures of the same number of elements - if (lpidx == nullptr && - (structure->size() != right.structure->size() && !isGLPerVertex)) { - return false; - } - - // Compare the names and types of all the members, which have to match - for (size_t li = 0, ri = 0; li < structure->size() || ri < right.structure->size(); ++li, ++ri) { - if (lpidx != nullptr) { - *lpidx = static_cast(li); - *rpidx = static_cast(ri); - } - if (li < structure->size() && ri < right.structure->size()) { - if ((*structure)[li].type->getFieldName() == (*right.structure)[ri].type->getFieldName()) { - if (*(*structure)[li].type != *(*right.structure)[ri].type) - return false; - } else { - // Skip hidden members - if ((*structure)[li].type->hiddenMember()) { - ri--; - continue; - } else if ((*right.structure)[ri].type->hiddenMember()) { - li--; - continue; - } - // If one of the members is something that's inconsistently declared, skip over it - // for now. - if (isGLPerVertex) { - if (isInconsistentGLPerVertexMember((*structure)[li].type->getFieldName())) { - ri--; - continue; - } else if (isInconsistentGLPerVertexMember((*right.structure)[ri].type->getFieldName())) { - li--; - continue; - } - } else { - return false; - } - } - // If we get here, then there should only be inconsistently declared members left - } else if (li < structure->size()) { - if (!(*structure)[li].type->hiddenMember() && !isInconsistentGLPerVertexMember((*structure)[li].type->getFieldName())) { - if (lpidx != nullptr) { - *rpidx = -1; - } - return false; - } - } else { - if (!(*right.structure)[ri].type->hiddenMember() && !isInconsistentGLPerVertexMember((*right.structure)[ri].type->getFieldName())) { - if (lpidx != nullptr) { - *lpidx = -1; - } - return false; - } - } - } - - return true; - } - - bool sameReferenceType(const TType& right) const - { - if (isReference() != right.isReference()) - return false; - - if (!isReference() && !right.isReference()) - return true; - - assert(referentType != nullptr); - assert(right.referentType != nullptr); - - if (referentType == right.referentType) - return true; - - return *referentType == *right.referentType; - } - - // See if two types match, in all aspects except arrayness - // If mismatch in structure members, return member indices in lpidx and rpidx. - bool sameElementType(const TType& right, int* lpidx = nullptr, int* rpidx = nullptr) const - { - if (lpidx != nullptr) { - *lpidx = -1; - *rpidx = -1; - } - return basicType == right.basicType && sameElementShape(right, lpidx, rpidx); - } - - // See if two type's arrayness match - bool sameArrayness(const TType& right) const - { - return ((arraySizes == nullptr && right.arraySizes == nullptr) || - (arraySizes != nullptr && right.arraySizes != nullptr && - (*arraySizes == *right.arraySizes || - (arraySizes->isImplicitlySized() && right.arraySizes->isDefaultImplicitlySized()) || - (right.arraySizes->isImplicitlySized() && arraySizes->isDefaultImplicitlySized())))); - } - - // See if two type's arrayness match in everything except their outer dimension - bool sameInnerArrayness(const TType& right) const - { - assert(arraySizes != nullptr && right.arraySizes != nullptr); - return arraySizes->sameInnerArrayness(*right.arraySizes); - } - - // See if two type's parameters match - bool sameTypeParameters(const TType& right) const - { - return ((typeParameters == nullptr && right.typeParameters == nullptr) || - (typeParameters != nullptr && right.typeParameters != nullptr && *typeParameters == *right.typeParameters)); - } - -#ifndef GLSLANG_WEB - // See if two type's SPIR-V type contents match - bool sameSpirvType(const TType& right) const - { - return ((spirvType == nullptr && right.spirvType == nullptr) || - (spirvType != nullptr && right.spirvType != nullptr && *spirvType == *right.spirvType)); - } -#endif - - // See if two type's elements match in all ways except basic type - // If mismatch in structure members, return member indices in lpidx and rpidx. - bool sameElementShape(const TType& right, int* lpidx = nullptr, int* rpidx = nullptr) const - { - if (lpidx != nullptr) { - *lpidx = -1; - *rpidx = -1; - } - return ((basicType != EbtSampler && right.basicType != EbtSampler) || sampler == right.sampler) && - vectorSize == right.vectorSize && - matrixCols == right.matrixCols && - matrixRows == right.matrixRows && - vector1 == right.vector1 && - isCoopMat() == right.isCoopMat() && - sameStructType(right, lpidx, rpidx) && - sameReferenceType(right); - } - - // See if a cooperative matrix type parameter with unspecified parameters is - // an OK function parameter - bool coopMatParameterOK(const TType& right) const - { - return isCoopMat() && right.isCoopMat() && (getBasicType() == right.getBasicType()) && - typeParameters == nullptr && right.typeParameters != nullptr; - } - - bool sameCoopMatBaseType(const TType &right) const { - bool rv = coopmat && right.coopmat; - if (getBasicType() == EbtFloat || getBasicType() == EbtFloat16) - rv = right.getBasicType() == EbtFloat || right.getBasicType() == EbtFloat16; - else if (getBasicType() == EbtUint || getBasicType() == EbtUint8) - rv = right.getBasicType() == EbtUint || right.getBasicType() == EbtUint8; - else if (getBasicType() == EbtInt || getBasicType() == EbtInt8) - rv = right.getBasicType() == EbtInt || right.getBasicType() == EbtInt8; - else - rv = false; - return rv; - } - - - // See if two types match in all ways (just the actual type, not qualification) - bool operator==(const TType& right) const - { -#ifndef GLSLANG_WEB - return sameElementType(right) && sameArrayness(right) && sameTypeParameters(right) && sameSpirvType(right); -#else - return sameElementType(right) && sameArrayness(right) && sameTypeParameters(right); -#endif - } - - bool operator!=(const TType& right) const - { - return ! operator==(right); - } - - unsigned int getBufferReferenceAlignment() const - { -#ifndef GLSLANG_WEB - if (getBasicType() == glslang::EbtReference) { - return getReferentType()->getQualifier().hasBufferReferenceAlign() ? - (1u << getReferentType()->getQualifier().layoutBufferReferenceAlign) : 16u; - } -#endif - return 0; - } - -#ifndef GLSLANG_WEB - const TSpirvType& getSpirvType() const { assert(spirvType); return *spirvType; } -#endif - -protected: - // Require consumer to pick between deep copy and shallow copy. - TType(const TType& type); - TType& operator=(const TType& type); - - // Recursively copy a type graph, while preserving the graph-like - // quality. That is, don't make more than one copy of a structure that - // gets reused multiple times in the type graph. - void deepCopy(const TType& copyOf, TMap& copiedMap) - { - shallowCopy(copyOf); - -#ifndef GLSLANG_WEB - // GL_EXT_spirv_intrinsics - if (copyOf.qualifier.spirvDecorate) { - qualifier.spirvDecorate = new TSpirvDecorate; - *qualifier.spirvDecorate = *copyOf.qualifier.spirvDecorate; - } - - if (copyOf.spirvType) { - spirvType = new TSpirvType; - *spirvType = *copyOf.spirvType; - } -#endif - - if (copyOf.arraySizes) { - arraySizes = new TArraySizes; - *arraySizes = *copyOf.arraySizes; - } - - if (copyOf.typeParameters) { - typeParameters = new TArraySizes; - *typeParameters = *copyOf.typeParameters; - } - - if (copyOf.isStruct() && copyOf.structure) { - auto prevCopy = copiedMap.find(copyOf.structure); - if (prevCopy != copiedMap.end()) - structure = prevCopy->second; - else { - structure = new TTypeList; - copiedMap[copyOf.structure] = structure; - for (unsigned int i = 0; i < copyOf.structure->size(); ++i) { - TTypeLoc typeLoc; - typeLoc.loc = (*copyOf.structure)[i].loc; - typeLoc.type = new TType(); - typeLoc.type->deepCopy(*(*copyOf.structure)[i].type, copiedMap); - structure->push_back(typeLoc); - } - } - } - - if (copyOf.fieldName) - fieldName = NewPoolTString(copyOf.fieldName->c_str()); - if (copyOf.typeName) - typeName = NewPoolTString(copyOf.typeName->c_str()); - } - - - void buildMangledName(TString&) const; - - TBasicType basicType : 8; - 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. - bool coopmat : 1; - TQualifier qualifier; - - TArraySizes* arraySizes; // nullptr unless an array; can be shared across types - // A type can't be both a structure (EbtStruct/EbtBlock) and a reference (EbtReference), so - // conserve space by making these a union - union { - TTypeList* structure; // invalid unless this is a struct; can be shared across types - TType *referentType; // invalid unless this is an EbtReference - }; - TString *fieldName; // for structure field names - TString *typeName; // for structure type name - TSampler sampler; - TArraySizes* typeParameters;// nullptr unless a parameterized type; can be shared across types -#ifndef GLSLANG_WEB - TSpirvType* spirvType; // SPIR-V type defined by spirv_type directive -#endif -}; - -} // end namespace glslang - -#endif // _TYPES_INCLUDED_ diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/arrays.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/arrays.h deleted file mode 100644 index 1da14d0..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/arrays.h +++ /dev/null @@ -1,352 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2012-2013 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. -// - -// -// Implement types for tracking GLSL arrays, arrays of arrays, etc. -// - -#ifndef _ARRAYS_INCLUDED -#define _ARRAYS_INCLUDED - -#include - -namespace glslang { - -// This is used to mean there is no size yet (unsized), it is waiting to get a size from somewhere else. -const int UnsizedArraySize = 0; - -class TIntermTyped; -extern bool SameSpecializationConstants(TIntermTyped*, TIntermTyped*); - -// Specialization constants need both a nominal size and a node that defines -// the specialization constant being used. Array types are the same when their -// size and specialization constant nodes are the same. -struct TArraySize { - unsigned int size; - TIntermTyped* node; // nullptr means no specialization constant node - bool operator==(const TArraySize& rhs) const - { - if (size != rhs.size) - return false; - if (node == nullptr || rhs.node == nullptr) - return node == rhs.node; - - return SameSpecializationConstants(node, rhs.node); - } -}; - -// -// TSmallArrayVector is used as the container for the set of sizes in TArraySizes. -// It has generic-container semantics, while TArraySizes has array-of-array semantics. -// That is, TSmallArrayVector should be more focused on mechanism and TArraySizes on policy. -// -struct TSmallArrayVector { - // - // TODO: memory: TSmallArrayVector is intended to be smaller. - // Almost all arrays could be handled by two sizes each fitting - // in 16 bits, needing a real vector only in the cases where there - // are more than 3 sizes or a size needing more than 16 bits. - // - POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) - - TSmallArrayVector() : sizes(nullptr) { } - virtual ~TSmallArrayVector() { dealloc(); } - - // For breaking into two non-shared copies, independently modifiable. - TSmallArrayVector& operator=(const TSmallArrayVector& from) - { - if (from.sizes == nullptr) - sizes = nullptr; - else { - alloc(); - *sizes = *from.sizes; - } - - return *this; - } - - int size() const - { - if (sizes == nullptr) - return 0; - return (int)sizes->size(); - } - - unsigned int frontSize() const - { - assert(sizes != nullptr && sizes->size() > 0); - return sizes->front().size; - } - - TIntermTyped* frontNode() const - { - assert(sizes != nullptr && sizes->size() > 0); - return sizes->front().node; - } - - void changeFront(unsigned int s) - { - assert(sizes != nullptr); - // this should only happen for implicitly sized arrays, not specialization constants - assert(sizes->front().node == nullptr); - sizes->front().size = s; - } - - void push_back(unsigned int e, TIntermTyped* n) - { - alloc(); - TArraySize pair = { e, n }; - sizes->push_back(pair); - } - - void push_back(const TSmallArrayVector& newDims) - { - alloc(); - sizes->insert(sizes->end(), newDims.sizes->begin(), newDims.sizes->end()); - } - - void pop_front() - { - assert(sizes != nullptr && sizes->size() > 0); - if (sizes->size() == 1) - dealloc(); - else - sizes->erase(sizes->begin()); - } - - // 'this' should currently not be holding anything, and copyNonFront - // will make it hold a copy of all but the first element of rhs. - // (This would be useful for making a type that is dereferenced by - // one dimension.) - void copyNonFront(const TSmallArrayVector& rhs) - { - assert(sizes == nullptr); - if (rhs.size() > 1) { - alloc(); - sizes->insert(sizes->begin(), rhs.sizes->begin() + 1, rhs.sizes->end()); - } - } - - unsigned int getDimSize(int i) const - { - assert(sizes != nullptr && (int)sizes->size() > i); - return (*sizes)[i].size; - } - - void setDimSize(int i, unsigned int size) const - { - assert(sizes != nullptr && (int)sizes->size() > i); - assert((*sizes)[i].node == nullptr); - (*sizes)[i].size = size; - } - - TIntermTyped* getDimNode(int i) const - { - assert(sizes != nullptr && (int)sizes->size() > i); - return (*sizes)[i].node; - } - - bool operator==(const TSmallArrayVector& rhs) const - { - if (sizes == nullptr && rhs.sizes == nullptr) - return true; - if (sizes == nullptr || rhs.sizes == nullptr) - return false; - return *sizes == *rhs.sizes; - } - bool operator!=(const TSmallArrayVector& rhs) const { return ! operator==(rhs); } - -protected: - TSmallArrayVector(const TSmallArrayVector&); - - void alloc() - { - if (sizes == nullptr) - sizes = new TVector; - } - void dealloc() - { - delete sizes; - sizes = nullptr; - } - - TVector* sizes; // will either hold such a pointer, or in the future, hold the two array sizes -}; - -// -// Represent an array, or array of arrays, to arbitrary depth. This is not -// done through a hierarchy of types in a type tree, rather all contiguous arrayness -// in the type hierarchy is localized into this single cumulative object. -// -// The arrayness in TTtype is a pointer, so that it can be non-allocated and zero -// for the vast majority of types that are non-array types. -// -// Order Policy: these are all identical: -// - left to right order within a contiguous set of ...[..][..][..]... in the source language -// - index order 0, 1, 2, ... within the 'sizes' member below -// - outer-most to inner-most -// -struct TArraySizes { - POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) - - TArraySizes() : implicitArraySize(0), implicitlySized(true), variablyIndexed(false){ } - - // For breaking into two non-shared copies, independently modifiable. - TArraySizes& operator=(const TArraySizes& from) - { - implicitArraySize = from.implicitArraySize; - variablyIndexed = from.variablyIndexed; - sizes = from.sizes; - implicitlySized = from.implicitlySized; - - return *this; - } - - // translate from array-of-array semantics to container semantics - int getNumDims() const { return sizes.size(); } - int getDimSize(int dim) const { return sizes.getDimSize(dim); } - TIntermTyped* getDimNode(int dim) const { return sizes.getDimNode(dim); } - void setDimSize(int dim, int size) { sizes.setDimSize(dim, size); } - int getOuterSize() const { return sizes.frontSize(); } - TIntermTyped* getOuterNode() const { return sizes.frontNode(); } - int getCumulativeSize() const - { - int size = 1; - for (int d = 0; d < sizes.size(); ++d) { - // this only makes sense in paths that have a known array size - assert(sizes.getDimSize(d) != UnsizedArraySize); - size *= sizes.getDimSize(d); - } - return size; - } - void addInnerSize() { addInnerSize((unsigned)UnsizedArraySize); } - void addInnerSize(int s) { addInnerSize((unsigned)s, nullptr); } - void addInnerSize(int s, TIntermTyped* n) { sizes.push_back((unsigned)s, n); } - void addInnerSize(TArraySize pair) { - sizes.push_back(pair.size, pair.node); - implicitlySized = false; - } - void addInnerSizes(const TArraySizes& s) { sizes.push_back(s.sizes); } - void changeOuterSize(int s) { - sizes.changeFront((unsigned)s); - implicitlySized = false; - } - int getImplicitSize() const { return implicitArraySize > 0 ? implicitArraySize : 1; } - void updateImplicitSize(int s) { - implicitArraySize = (std::max)(implicitArraySize, s); - } - bool isInnerUnsized() const - { - for (int d = 1; d < sizes.size(); ++d) { - if (sizes.getDimSize(d) == (unsigned)UnsizedArraySize) - return true; - } - - return false; - } - bool clearInnerUnsized() - { - for (int d = 1; d < sizes.size(); ++d) { - if (sizes.getDimSize(d) == (unsigned)UnsizedArraySize) - setDimSize(d, 1); - } - - return false; - } - bool isInnerSpecialization() const - { - for (int d = 1; d < sizes.size(); ++d) { - if (sizes.getDimNode(d) != nullptr) - return true; - } - - return false; - } - bool isOuterSpecialization() - { - return sizes.getDimNode(0) != nullptr; - } - - bool hasUnsized() const { return getOuterSize() == UnsizedArraySize || isInnerUnsized(); } - bool isSized() const { return getOuterSize() != UnsizedArraySize; } - bool isImplicitlySized() const { return implicitlySized; } - bool isDefaultImplicitlySized() const { return implicitlySized && implicitArraySize == 0; } - void setImplicitlySized(bool isImplicitSizing) { implicitlySized = isImplicitSizing; } - void dereference() { sizes.pop_front(); } - void copyDereferenced(const TArraySizes& rhs) - { - assert(sizes.size() == 0); - if (rhs.sizes.size() > 1) - sizes.copyNonFront(rhs.sizes); - } - - bool sameInnerArrayness(const TArraySizes& rhs) const - { - if (sizes.size() != rhs.sizes.size()) - return false; - - for (int d = 1; d < sizes.size(); ++d) { - if (sizes.getDimSize(d) != rhs.sizes.getDimSize(d) || - sizes.getDimNode(d) != rhs.sizes.getDimNode(d)) - return false; - } - - return true; - } - - void setVariablyIndexed() { variablyIndexed = true; } - bool isVariablyIndexed() const { return variablyIndexed; } - - bool operator==(const TArraySizes& rhs) const { return sizes == rhs.sizes; } - bool operator!=(const TArraySizes& rhs) const { return sizes != rhs.sizes; } - -protected: - TSmallArrayVector sizes; - - TArraySizes(const TArraySizes&); - - // For tracking maximum referenced compile-time constant index. - // Applies only to the outer-most dimension. Potentially becomes - // the implicit size of the array, if not variably indexed and - // otherwise legal. - int implicitArraySize; - bool implicitlySized; - bool variablyIndexed; // true if array is indexed with a non compile-time constant -}; - -} // end namespace glslang - -#endif // _ARRAYS_INCLUDED_ diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/glslang_c_interface.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/glslang_c_interface.h index 28d5233..7fa1a05 100644 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/glslang_c_interface.h +++ b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/glslang_c_interface.h @@ -168,23 +168,6 @@ typedef struct glslang_resource_s { glslang_limits_t limits; } glslang_resource_t; -typedef struct glslang_input_s { - glslang_source_t language; - glslang_stage_t stage; - glslang_client_t client; - glslang_target_client_version_t client_version; - glslang_target_language_t target_language; - glslang_target_language_version_t target_language_version; - /** Shader source code */ - const char* code; - int default_version; - glslang_profile_t default_profile; - int force_default_version_and_profile; - int forward_compatible; - glslang_messages_t messages; - const glslang_resource_t* resource; -} glslang_input_t; - /* Inclusion result structure allocated by C include_local/include_system callbacks */ typedef struct glsl_include_result_s { /* Header file name or NULL if inclusion failed */ @@ -214,6 +197,25 @@ typedef struct glsl_include_callbacks_s { glsl_free_include_result_func free_include_result; } glsl_include_callbacks_t; +typedef struct glslang_input_s { + glslang_source_t language; + glslang_stage_t stage; + glslang_client_t client; + glslang_target_client_version_t client_version; + glslang_target_language_t target_language; + glslang_target_language_version_t target_language_version; + /** Shader source code */ + const char* code; + int default_version; + glslang_profile_t default_profile; + int force_default_version_and_profile; + int forward_compatible; + glslang_messages_t messages; + const glslang_resource_t* resource; + glsl_include_callbacks_t callbacks; + void* callbacks_ctx; +} glslang_input_t; + /* SpvOptions counterpart */ typedef struct glslang_spv_options_s { bool generate_debug_info; @@ -224,6 +226,7 @@ typedef struct glslang_spv_options_s { bool validate; bool emit_nonsemantic_shader_debug_info; bool emit_nonsemantic_shader_debug_source; + bool compile_only; } glslang_spv_options_t; #ifdef __cplusplus @@ -246,8 +249,8 @@ extern "C" { #define GLSLANG_EXPORT #endif -GLSLANG_EXPORT int glslang_initialize_process(); -GLSLANG_EXPORT void glslang_finalize_process(); +GLSLANG_EXPORT int glslang_initialize_process(void); +GLSLANG_EXPORT void glslang_finalize_process(void); GLSLANG_EXPORT glslang_shader_t* glslang_shader_create(const glslang_input_t* input); GLSLANG_EXPORT void glslang_shader_delete(glslang_shader_t* shader); @@ -262,7 +265,7 @@ GLSLANG_EXPORT const char* glslang_shader_get_preprocessed_code(glslang_shader_t GLSLANG_EXPORT const char* glslang_shader_get_info_log(glslang_shader_t* shader); GLSLANG_EXPORT const char* glslang_shader_get_info_debug_log(glslang_shader_t* shader); -GLSLANG_EXPORT glslang_program_t* glslang_program_create(); +GLSLANG_EXPORT glslang_program_t* glslang_program_create(void); GLSLANG_EXPORT void glslang_program_delete(glslang_program_t* program); GLSLANG_EXPORT void glslang_program_add_shader(glslang_program_t* program, glslang_shader_t* shader); GLSLANG_EXPORT int glslang_program_link(glslang_program_t* program, int messages); // glslang_messages_t diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/intermediate.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/intermediate.h deleted file mode 100644 index ec2b28a..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Include/intermediate.h +++ /dev/null @@ -1,1885 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2012-2016 LunarG, Inc. -// Copyright (C) 2017 ARM Limited. -// Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved. -// -// 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. -// - -// -// Definition of the in-memory high-level intermediate representation -// of shaders. This is a tree that parser creates. -// -// Nodes in the tree are defined as a hierarchy of classes derived from -// TIntermNode. Each is a node in a tree. There is no preset branching factor; -// each node can have it's own type of list of children. -// - -#ifndef __INTERMEDIATE_H -#define __INTERMEDIATE_H - -#if defined(_MSC_VER) && _MSC_VER >= 1900 - #pragma warning(disable : 4464) // relative include path contains '..' - #pragma warning(disable : 5026) // 'glslang::TIntermUnary': move constructor was implicitly defined as deleted -#endif - -#include "../Include/Common.h" -#include "../Include/Types.h" -#include "../Include/ConstantUnion.h" - -namespace glslang { - -class TIntermediate; - -// -// Operators used by the high-level (parse tree) representation. -// -enum TOperator { - EOpNull, // if in a node, should only mean a node is still being built - EOpSequence, // denotes a list of statements, or parameters, etc. - EOpScope, // Used by debugging to denote a scoped list of statements - EOpLinkerObjects, // for aggregate node of objects the linker may need, if not reference by the rest of the AST - EOpFunctionCall, - EOpFunction, // For function definition - EOpParameters, // an aggregate listing the parameters to a function -#ifndef GLSLANG_WEB - EOpSpirvInst, -#endif - - // - // Unary operators - // - - EOpNegative, - EOpLogicalNot, - EOpVectorLogicalNot, - EOpBitwiseNot, - - EOpPostIncrement, - EOpPostDecrement, - EOpPreIncrement, - EOpPreDecrement, - - EOpCopyObject, - - EOpDeclare, // Used by debugging to force declaration of variable in correct scope - - // (u)int* -> bool - EOpConvInt8ToBool, - EOpConvUint8ToBool, - EOpConvInt16ToBool, - EOpConvUint16ToBool, - EOpConvIntToBool, - EOpConvUintToBool, - EOpConvInt64ToBool, - EOpConvUint64ToBool, - - // float* -> bool - EOpConvFloat16ToBool, - EOpConvFloatToBool, - EOpConvDoubleToBool, - - // bool -> (u)int* - EOpConvBoolToInt8, - EOpConvBoolToUint8, - EOpConvBoolToInt16, - EOpConvBoolToUint16, - EOpConvBoolToInt, - EOpConvBoolToUint, - EOpConvBoolToInt64, - EOpConvBoolToUint64, - - // bool -> float* - EOpConvBoolToFloat16, - EOpConvBoolToFloat, - EOpConvBoolToDouble, - - // int8_t -> (u)int* - EOpConvInt8ToInt16, - EOpConvInt8ToInt, - EOpConvInt8ToInt64, - EOpConvInt8ToUint8, - EOpConvInt8ToUint16, - EOpConvInt8ToUint, - EOpConvInt8ToUint64, - - // uint8_t -> (u)int* - EOpConvUint8ToInt8, - EOpConvUint8ToInt16, - EOpConvUint8ToInt, - EOpConvUint8ToInt64, - EOpConvUint8ToUint16, - EOpConvUint8ToUint, - EOpConvUint8ToUint64, - - // int8_t -> float* - EOpConvInt8ToFloat16, - EOpConvInt8ToFloat, - EOpConvInt8ToDouble, - - // uint8_t -> float* - EOpConvUint8ToFloat16, - EOpConvUint8ToFloat, - EOpConvUint8ToDouble, - - // int16_t -> (u)int* - EOpConvInt16ToInt8, - EOpConvInt16ToInt, - EOpConvInt16ToInt64, - EOpConvInt16ToUint8, - EOpConvInt16ToUint16, - EOpConvInt16ToUint, - EOpConvInt16ToUint64, - - // uint16_t -> (u)int* - EOpConvUint16ToInt8, - EOpConvUint16ToInt16, - EOpConvUint16ToInt, - EOpConvUint16ToInt64, - EOpConvUint16ToUint8, - EOpConvUint16ToUint, - EOpConvUint16ToUint64, - - // int16_t -> float* - EOpConvInt16ToFloat16, - EOpConvInt16ToFloat, - EOpConvInt16ToDouble, - - // uint16_t -> float* - EOpConvUint16ToFloat16, - EOpConvUint16ToFloat, - EOpConvUint16ToDouble, - - // int32_t -> (u)int* - EOpConvIntToInt8, - EOpConvIntToInt16, - EOpConvIntToInt64, - EOpConvIntToUint8, - EOpConvIntToUint16, - EOpConvIntToUint, - EOpConvIntToUint64, - - // uint32_t -> (u)int* - EOpConvUintToInt8, - EOpConvUintToInt16, - EOpConvUintToInt, - EOpConvUintToInt64, - EOpConvUintToUint8, - EOpConvUintToUint16, - EOpConvUintToUint64, - - // int32_t -> float* - EOpConvIntToFloat16, - EOpConvIntToFloat, - EOpConvIntToDouble, - - // uint32_t -> float* - EOpConvUintToFloat16, - EOpConvUintToFloat, - EOpConvUintToDouble, - - // int64_t -> (u)int* - EOpConvInt64ToInt8, - EOpConvInt64ToInt16, - EOpConvInt64ToInt, - EOpConvInt64ToUint8, - EOpConvInt64ToUint16, - EOpConvInt64ToUint, - EOpConvInt64ToUint64, - - // uint64_t -> (u)int* - EOpConvUint64ToInt8, - EOpConvUint64ToInt16, - EOpConvUint64ToInt, - EOpConvUint64ToInt64, - EOpConvUint64ToUint8, - EOpConvUint64ToUint16, - EOpConvUint64ToUint, - - // int64_t -> float* - EOpConvInt64ToFloat16, - EOpConvInt64ToFloat, - EOpConvInt64ToDouble, - - // uint64_t -> float* - EOpConvUint64ToFloat16, - EOpConvUint64ToFloat, - EOpConvUint64ToDouble, - - // float16_t -> (u)int* - EOpConvFloat16ToInt8, - EOpConvFloat16ToInt16, - EOpConvFloat16ToInt, - EOpConvFloat16ToInt64, - EOpConvFloat16ToUint8, - EOpConvFloat16ToUint16, - EOpConvFloat16ToUint, - EOpConvFloat16ToUint64, - - // float16_t -> float* - EOpConvFloat16ToFloat, - EOpConvFloat16ToDouble, - - // float -> (u)int* - EOpConvFloatToInt8, - EOpConvFloatToInt16, - EOpConvFloatToInt, - EOpConvFloatToInt64, - EOpConvFloatToUint8, - EOpConvFloatToUint16, - EOpConvFloatToUint, - EOpConvFloatToUint64, - - // float -> float* - EOpConvFloatToFloat16, - EOpConvFloatToDouble, - - // float64 _t-> (u)int* - EOpConvDoubleToInt8, - EOpConvDoubleToInt16, - EOpConvDoubleToInt, - EOpConvDoubleToInt64, - EOpConvDoubleToUint8, - EOpConvDoubleToUint16, - EOpConvDoubleToUint, - EOpConvDoubleToUint64, - - // float64_t -> float* - EOpConvDoubleToFloat16, - EOpConvDoubleToFloat, - - // uint64_t <-> pointer - EOpConvUint64ToPtr, - EOpConvPtrToUint64, - - // uvec2 <-> pointer - EOpConvUvec2ToPtr, - EOpConvPtrToUvec2, - - // uint64_t -> accelerationStructureEXT - EOpConvUint64ToAccStruct, - - // uvec2 -> accelerationStructureEXT - EOpConvUvec2ToAccStruct, - - // - // binary operations - // - - EOpAdd, - EOpSub, - EOpMul, - EOpDiv, - EOpMod, - EOpRightShift, - EOpLeftShift, - EOpAnd, - EOpInclusiveOr, - EOpExclusiveOr, - EOpEqual, - EOpNotEqual, - EOpVectorEqual, - EOpVectorNotEqual, - EOpLessThan, - EOpGreaterThan, - EOpLessThanEqual, - EOpGreaterThanEqual, - EOpComma, - - EOpVectorTimesScalar, - EOpVectorTimesMatrix, - EOpMatrixTimesVector, - EOpMatrixTimesScalar, - - EOpLogicalOr, - EOpLogicalXor, - EOpLogicalAnd, - - EOpIndexDirect, - EOpIndexIndirect, - EOpIndexDirectStruct, - - EOpVectorSwizzle, - - EOpMethod, - EOpScoping, - - // - // Built-in functions mapped to operators - // - - EOpRadians, - EOpDegrees, - EOpSin, - EOpCos, - EOpTan, - EOpAsin, - EOpAcos, - EOpAtan, - EOpSinh, - EOpCosh, - EOpTanh, - EOpAsinh, - EOpAcosh, - EOpAtanh, - - EOpPow, - EOpExp, - EOpLog, - EOpExp2, - EOpLog2, - EOpSqrt, - EOpInverseSqrt, - - EOpAbs, - EOpSign, - EOpFloor, - EOpTrunc, - EOpRound, - EOpRoundEven, - EOpCeil, - EOpFract, - EOpModf, - EOpMin, - EOpMax, - EOpClamp, - EOpMix, - EOpStep, - EOpSmoothStep, - - EOpIsNan, - EOpIsInf, - - EOpFma, - - EOpFrexp, - EOpLdexp, - - EOpFloatBitsToInt, - EOpFloatBitsToUint, - EOpIntBitsToFloat, - EOpUintBitsToFloat, - EOpDoubleBitsToInt64, - EOpDoubleBitsToUint64, - EOpInt64BitsToDouble, - EOpUint64BitsToDouble, - EOpFloat16BitsToInt16, - EOpFloat16BitsToUint16, - EOpInt16BitsToFloat16, - EOpUint16BitsToFloat16, - EOpPackSnorm2x16, - EOpUnpackSnorm2x16, - EOpPackUnorm2x16, - EOpUnpackUnorm2x16, - EOpPackSnorm4x8, - EOpUnpackSnorm4x8, - EOpPackUnorm4x8, - EOpUnpackUnorm4x8, - EOpPackHalf2x16, - EOpUnpackHalf2x16, - EOpPackDouble2x32, - EOpUnpackDouble2x32, - EOpPackInt2x32, - EOpUnpackInt2x32, - EOpPackUint2x32, - EOpUnpackUint2x32, - EOpPackFloat2x16, - EOpUnpackFloat2x16, - EOpPackInt2x16, - EOpUnpackInt2x16, - EOpPackUint2x16, - EOpUnpackUint2x16, - EOpPackInt4x16, - EOpUnpackInt4x16, - EOpPackUint4x16, - EOpUnpackUint4x16, - EOpPack16, - EOpPack32, - EOpPack64, - EOpUnpack32, - EOpUnpack16, - EOpUnpack8, - - EOpLength, - EOpDistance, - EOpDot, - EOpCross, - EOpNormalize, - EOpFaceForward, - EOpReflect, - EOpRefract, - - EOpMin3, - EOpMax3, - EOpMid3, - - EOpDPdx, // Fragment only - EOpDPdy, // Fragment only - EOpFwidth, // Fragment only - EOpDPdxFine, // Fragment only - EOpDPdyFine, // Fragment only - EOpFwidthFine, // Fragment only - EOpDPdxCoarse, // Fragment only - EOpDPdyCoarse, // Fragment only - EOpFwidthCoarse, // Fragment only - - EOpInterpolateAtCentroid, // Fragment only - EOpInterpolateAtSample, // Fragment only - EOpInterpolateAtOffset, // Fragment only - EOpInterpolateAtVertex, - - EOpMatrixTimesMatrix, - EOpOuterProduct, - EOpDeterminant, - EOpMatrixInverse, - EOpTranspose, - - EOpFtransform, - - EOpNoise, - - EOpEmitVertex, // geometry only - EOpEndPrimitive, // geometry only - EOpEmitStreamVertex, // geometry only - EOpEndStreamPrimitive, // geometry only - - EOpBarrier, - EOpMemoryBarrier, - EOpMemoryBarrierAtomicCounter, - EOpMemoryBarrierBuffer, - EOpMemoryBarrierImage, - EOpMemoryBarrierShared, // compute only - EOpGroupMemoryBarrier, // compute only - - EOpBallot, - EOpReadInvocation, - EOpReadFirstInvocation, - - EOpAnyInvocation, - EOpAllInvocations, - EOpAllInvocationsEqual, - - EOpSubgroupGuardStart, - EOpSubgroupBarrier, - EOpSubgroupMemoryBarrier, - EOpSubgroupMemoryBarrierBuffer, - EOpSubgroupMemoryBarrierImage, - EOpSubgroupMemoryBarrierShared, // compute only - EOpSubgroupElect, - EOpSubgroupAll, - EOpSubgroupAny, - EOpSubgroupAllEqual, - EOpSubgroupBroadcast, - EOpSubgroupBroadcastFirst, - EOpSubgroupBallot, - EOpSubgroupInverseBallot, - EOpSubgroupBallotBitExtract, - EOpSubgroupBallotBitCount, - EOpSubgroupBallotInclusiveBitCount, - EOpSubgroupBallotExclusiveBitCount, - EOpSubgroupBallotFindLSB, - EOpSubgroupBallotFindMSB, - EOpSubgroupShuffle, - EOpSubgroupShuffleXor, - EOpSubgroupShuffleUp, - EOpSubgroupShuffleDown, - EOpSubgroupAdd, - EOpSubgroupMul, - EOpSubgroupMin, - EOpSubgroupMax, - EOpSubgroupAnd, - EOpSubgroupOr, - EOpSubgroupXor, - EOpSubgroupInclusiveAdd, - EOpSubgroupInclusiveMul, - EOpSubgroupInclusiveMin, - EOpSubgroupInclusiveMax, - EOpSubgroupInclusiveAnd, - EOpSubgroupInclusiveOr, - EOpSubgroupInclusiveXor, - EOpSubgroupExclusiveAdd, - EOpSubgroupExclusiveMul, - EOpSubgroupExclusiveMin, - EOpSubgroupExclusiveMax, - EOpSubgroupExclusiveAnd, - EOpSubgroupExclusiveOr, - EOpSubgroupExclusiveXor, - EOpSubgroupClusteredAdd, - EOpSubgroupClusteredMul, - EOpSubgroupClusteredMin, - EOpSubgroupClusteredMax, - EOpSubgroupClusteredAnd, - EOpSubgroupClusteredOr, - EOpSubgroupClusteredXor, - EOpSubgroupQuadBroadcast, - EOpSubgroupQuadSwapHorizontal, - EOpSubgroupQuadSwapVertical, - EOpSubgroupQuadSwapDiagonal, - - EOpSubgroupPartition, - EOpSubgroupPartitionedAdd, - EOpSubgroupPartitionedMul, - EOpSubgroupPartitionedMin, - EOpSubgroupPartitionedMax, - EOpSubgroupPartitionedAnd, - EOpSubgroupPartitionedOr, - EOpSubgroupPartitionedXor, - EOpSubgroupPartitionedInclusiveAdd, - EOpSubgroupPartitionedInclusiveMul, - EOpSubgroupPartitionedInclusiveMin, - EOpSubgroupPartitionedInclusiveMax, - EOpSubgroupPartitionedInclusiveAnd, - EOpSubgroupPartitionedInclusiveOr, - EOpSubgroupPartitionedInclusiveXor, - EOpSubgroupPartitionedExclusiveAdd, - EOpSubgroupPartitionedExclusiveMul, - EOpSubgroupPartitionedExclusiveMin, - EOpSubgroupPartitionedExclusiveMax, - EOpSubgroupPartitionedExclusiveAnd, - EOpSubgroupPartitionedExclusiveOr, - EOpSubgroupPartitionedExclusiveXor, - - EOpSubgroupGuardStop, - - EOpMinInvocations, - EOpMaxInvocations, - EOpAddInvocations, - EOpMinInvocationsNonUniform, - EOpMaxInvocationsNonUniform, - EOpAddInvocationsNonUniform, - EOpMinInvocationsInclusiveScan, - EOpMaxInvocationsInclusiveScan, - EOpAddInvocationsInclusiveScan, - EOpMinInvocationsInclusiveScanNonUniform, - EOpMaxInvocationsInclusiveScanNonUniform, - EOpAddInvocationsInclusiveScanNonUniform, - EOpMinInvocationsExclusiveScan, - EOpMaxInvocationsExclusiveScan, - EOpAddInvocationsExclusiveScan, - EOpMinInvocationsExclusiveScanNonUniform, - EOpMaxInvocationsExclusiveScanNonUniform, - EOpAddInvocationsExclusiveScanNonUniform, - EOpSwizzleInvocations, - EOpSwizzleInvocationsMasked, - EOpWriteInvocation, - EOpMbcnt, - - EOpCubeFaceIndex, - EOpCubeFaceCoord, - EOpTime, - - EOpAtomicAdd, - EOpAtomicSubtract, - EOpAtomicMin, - EOpAtomicMax, - EOpAtomicAnd, - EOpAtomicOr, - EOpAtomicXor, - EOpAtomicExchange, - EOpAtomicCompSwap, - EOpAtomicLoad, - EOpAtomicStore, - - EOpAtomicCounterIncrement, // results in pre-increment value - EOpAtomicCounterDecrement, // results in post-decrement value - EOpAtomicCounter, - EOpAtomicCounterAdd, - EOpAtomicCounterSubtract, - EOpAtomicCounterMin, - EOpAtomicCounterMax, - EOpAtomicCounterAnd, - EOpAtomicCounterOr, - EOpAtomicCounterXor, - EOpAtomicCounterExchange, - EOpAtomicCounterCompSwap, - - EOpAny, - EOpAll, - - EOpCooperativeMatrixLoad, - EOpCooperativeMatrixStore, - EOpCooperativeMatrixMulAdd, - - EOpBeginInvocationInterlock, // Fragment only - EOpEndInvocationInterlock, // Fragment only - - EOpIsHelperInvocation, - - EOpDebugPrintf, - - // - // Branch - // - - EOpKill, // Fragment only - EOpTerminateInvocation, // Fragment only - EOpDemote, // Fragment only - EOpTerminateRayKHR, // Any-hit only - EOpIgnoreIntersectionKHR, // Any-hit only - EOpReturn, - EOpBreak, - EOpContinue, - EOpCase, - EOpDefault, - - // - // Constructors - // - - EOpConstructGuardStart, - EOpConstructInt, // these first scalar forms also identify what implicit conversion is needed - EOpConstructUint, - EOpConstructInt8, - EOpConstructUint8, - EOpConstructInt16, - EOpConstructUint16, - EOpConstructInt64, - EOpConstructUint64, - EOpConstructBool, - EOpConstructFloat, - EOpConstructDouble, - // Keep vector and matrix constructors in a consistent relative order for - // TParseContext::constructBuiltIn, which converts between 8/16/32 bit - // vector constructors - EOpConstructVec2, - EOpConstructVec3, - EOpConstructVec4, - EOpConstructMat2x2, - EOpConstructMat2x3, - EOpConstructMat2x4, - EOpConstructMat3x2, - EOpConstructMat3x3, - EOpConstructMat3x4, - EOpConstructMat4x2, - EOpConstructMat4x3, - EOpConstructMat4x4, - EOpConstructDVec2, - EOpConstructDVec3, - EOpConstructDVec4, - EOpConstructBVec2, - EOpConstructBVec3, - EOpConstructBVec4, - EOpConstructI8Vec2, - EOpConstructI8Vec3, - EOpConstructI8Vec4, - EOpConstructU8Vec2, - EOpConstructU8Vec3, - EOpConstructU8Vec4, - EOpConstructI16Vec2, - EOpConstructI16Vec3, - EOpConstructI16Vec4, - EOpConstructU16Vec2, - EOpConstructU16Vec3, - EOpConstructU16Vec4, - EOpConstructIVec2, - EOpConstructIVec3, - EOpConstructIVec4, - EOpConstructUVec2, - EOpConstructUVec3, - EOpConstructUVec4, - EOpConstructI64Vec2, - EOpConstructI64Vec3, - EOpConstructI64Vec4, - EOpConstructU64Vec2, - EOpConstructU64Vec3, - EOpConstructU64Vec4, - EOpConstructDMat2x2, - EOpConstructDMat2x3, - EOpConstructDMat2x4, - EOpConstructDMat3x2, - EOpConstructDMat3x3, - EOpConstructDMat3x4, - EOpConstructDMat4x2, - EOpConstructDMat4x3, - EOpConstructDMat4x4, - EOpConstructIMat2x2, - EOpConstructIMat2x3, - EOpConstructIMat2x4, - EOpConstructIMat3x2, - EOpConstructIMat3x3, - EOpConstructIMat3x4, - EOpConstructIMat4x2, - EOpConstructIMat4x3, - EOpConstructIMat4x4, - EOpConstructUMat2x2, - EOpConstructUMat2x3, - EOpConstructUMat2x4, - EOpConstructUMat3x2, - EOpConstructUMat3x3, - EOpConstructUMat3x4, - EOpConstructUMat4x2, - EOpConstructUMat4x3, - EOpConstructUMat4x4, - EOpConstructBMat2x2, - EOpConstructBMat2x3, - EOpConstructBMat2x4, - EOpConstructBMat3x2, - EOpConstructBMat3x3, - EOpConstructBMat3x4, - EOpConstructBMat4x2, - EOpConstructBMat4x3, - EOpConstructBMat4x4, - EOpConstructFloat16, - EOpConstructF16Vec2, - EOpConstructF16Vec3, - EOpConstructF16Vec4, - EOpConstructF16Mat2x2, - EOpConstructF16Mat2x3, - EOpConstructF16Mat2x4, - EOpConstructF16Mat3x2, - EOpConstructF16Mat3x3, - EOpConstructF16Mat3x4, - EOpConstructF16Mat4x2, - EOpConstructF16Mat4x3, - EOpConstructF16Mat4x4, - EOpConstructStruct, - EOpConstructTextureSampler, - EOpConstructNonuniform, // expected to be transformed away, not present in final AST - EOpConstructReference, - EOpConstructCooperativeMatrix, - EOpConstructAccStruct, - EOpConstructGuardEnd, - - // - // moves - // - - EOpAssign, - EOpAddAssign, - EOpSubAssign, - EOpMulAssign, - EOpVectorTimesMatrixAssign, - EOpVectorTimesScalarAssign, - EOpMatrixTimesScalarAssign, - EOpMatrixTimesMatrixAssign, - EOpDivAssign, - EOpModAssign, - EOpAndAssign, - EOpInclusiveOrAssign, - EOpExclusiveOrAssign, - EOpLeftShiftAssign, - EOpRightShiftAssign, - - // - // Array operators - // - - // Can apply to arrays, vectors, or matrices. - // Can be decomposed to a constant at compile time, but this does not always happen, - // due to link-time effects. So, consumer can expect either a link-time sized or - // run-time sized array. - EOpArrayLength, - - // - // Image operations - // - - EOpImageGuardBegin, - - EOpImageQuerySize, - EOpImageQuerySamples, - EOpImageLoad, - EOpImageStore, - EOpImageLoadLod, - EOpImageStoreLod, - EOpImageAtomicAdd, - EOpImageAtomicMin, - EOpImageAtomicMax, - EOpImageAtomicAnd, - EOpImageAtomicOr, - EOpImageAtomicXor, - EOpImageAtomicExchange, - EOpImageAtomicCompSwap, - EOpImageAtomicLoad, - EOpImageAtomicStore, - - EOpSubpassLoad, - EOpSubpassLoadMS, - EOpSparseImageLoad, - EOpSparseImageLoadLod, - - EOpImageGuardEnd, - - // - // Texture operations - // - - EOpTextureGuardBegin, - - EOpTextureQuerySize, - EOpTextureQueryLod, - EOpTextureQueryLevels, - EOpTextureQuerySamples, - - EOpSamplingGuardBegin, - - EOpTexture, - EOpTextureProj, - EOpTextureLod, - EOpTextureOffset, - EOpTextureFetch, - EOpTextureFetchOffset, - EOpTextureProjOffset, - EOpTextureLodOffset, - EOpTextureProjLod, - EOpTextureProjLodOffset, - EOpTextureGrad, - EOpTextureGradOffset, - EOpTextureProjGrad, - EOpTextureProjGradOffset, - EOpTextureGather, - EOpTextureGatherOffset, - EOpTextureGatherOffsets, - EOpTextureClamp, - EOpTextureOffsetClamp, - EOpTextureGradClamp, - EOpTextureGradOffsetClamp, - EOpTextureGatherLod, - EOpTextureGatherLodOffset, - EOpTextureGatherLodOffsets, - EOpFragmentMaskFetch, - EOpFragmentFetch, - - EOpSparseTextureGuardBegin, - - EOpSparseTexture, - EOpSparseTextureLod, - EOpSparseTextureOffset, - EOpSparseTextureFetch, - EOpSparseTextureFetchOffset, - EOpSparseTextureLodOffset, - EOpSparseTextureGrad, - EOpSparseTextureGradOffset, - EOpSparseTextureGather, - EOpSparseTextureGatherOffset, - EOpSparseTextureGatherOffsets, - EOpSparseTexelsResident, - EOpSparseTextureClamp, - EOpSparseTextureOffsetClamp, - EOpSparseTextureGradClamp, - EOpSparseTextureGradOffsetClamp, - EOpSparseTextureGatherLod, - EOpSparseTextureGatherLodOffset, - EOpSparseTextureGatherLodOffsets, - - EOpSparseTextureGuardEnd, - - EOpImageFootprintGuardBegin, - EOpImageSampleFootprintNV, - EOpImageSampleFootprintClampNV, - EOpImageSampleFootprintLodNV, - EOpImageSampleFootprintGradNV, - EOpImageSampleFootprintGradClampNV, - EOpImageFootprintGuardEnd, - EOpSamplingGuardEnd, - EOpTextureGuardEnd, - - // - // Integer operations - // - - EOpAddCarry, - EOpSubBorrow, - EOpUMulExtended, - EOpIMulExtended, - EOpBitfieldExtract, - EOpBitfieldInsert, - EOpBitFieldReverse, - EOpBitCount, - EOpFindLSB, - EOpFindMSB, - - EOpCountLeadingZeros, - EOpCountTrailingZeros, - EOpAbsDifference, - EOpAddSaturate, - EOpSubSaturate, - EOpAverage, - EOpAverageRounded, - EOpMul32x16, - - EOpTraceNV, - EOpTraceRayMotionNV, - EOpTraceKHR, - EOpReportIntersection, - EOpIgnoreIntersectionNV, - EOpTerminateRayNV, - EOpExecuteCallableNV, - EOpExecuteCallableKHR, - EOpWritePackedPrimitiveIndices4x8NV, - EOpEmitMeshTasksEXT, - EOpSetMeshOutputsEXT, - - // - // GL_EXT_ray_query operations - // - - EOpRayQueryInitialize, - EOpRayQueryTerminate, - EOpRayQueryGenerateIntersection, - EOpRayQueryConfirmIntersection, - EOpRayQueryProceed, - EOpRayQueryGetIntersectionType, - EOpRayQueryGetRayTMin, - EOpRayQueryGetRayFlags, - EOpRayQueryGetIntersectionT, - EOpRayQueryGetIntersectionInstanceCustomIndex, - EOpRayQueryGetIntersectionInstanceId, - EOpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffset, - EOpRayQueryGetIntersectionGeometryIndex, - EOpRayQueryGetIntersectionPrimitiveIndex, - EOpRayQueryGetIntersectionBarycentrics, - EOpRayQueryGetIntersectionFrontFace, - EOpRayQueryGetIntersectionCandidateAABBOpaque, - EOpRayQueryGetIntersectionObjectRayDirection, - EOpRayQueryGetIntersectionObjectRayOrigin, - EOpRayQueryGetWorldRayDirection, - EOpRayQueryGetWorldRayOrigin, - EOpRayQueryGetIntersectionObjectToWorld, - EOpRayQueryGetIntersectionWorldToObject, - - // - // GL_NV_shader_invocation_reorder - // - - EOpHitObjectTraceRayNV, - EOpHitObjectTraceRayMotionNV, - EOpHitObjectRecordHitNV, - EOpHitObjectRecordHitMotionNV, - EOpHitObjectRecordHitWithIndexNV, - EOpHitObjectRecordHitWithIndexMotionNV, - EOpHitObjectRecordMissNV, - EOpHitObjectRecordMissMotionNV, - EOpHitObjectRecordEmptyNV, - EOpHitObjectExecuteShaderNV, - EOpHitObjectIsEmptyNV, - EOpHitObjectIsMissNV, - EOpHitObjectIsHitNV, - EOpHitObjectGetRayTMinNV, - EOpHitObjectGetRayTMaxNV, - EOpHitObjectGetObjectRayOriginNV, - EOpHitObjectGetObjectRayDirectionNV, - EOpHitObjectGetWorldRayOriginNV, - EOpHitObjectGetWorldRayDirectionNV, - EOpHitObjectGetWorldToObjectNV, - EOpHitObjectGetObjectToWorldNV, - EOpHitObjectGetInstanceCustomIndexNV, - EOpHitObjectGetInstanceIdNV, - EOpHitObjectGetGeometryIndexNV, - EOpHitObjectGetPrimitiveIndexNV, - EOpHitObjectGetHitKindNV, - EOpHitObjectGetShaderBindingTableRecordIndexNV, - EOpHitObjectGetShaderRecordBufferHandleNV, - EOpHitObjectGetAttributesNV, - EOpHitObjectGetCurrentTimeNV, - EOpReorderThreadNV, - - // HLSL operations - // - - EOpClip, // discard if input value < 0 - EOpIsFinite, - EOpLog10, // base 10 log - EOpRcp, // 1/x - EOpSaturate, // clamp from 0 to 1 - EOpSinCos, // sin and cos in out parameters - EOpGenMul, // mul(x,y) on any of mat/vec/scalars - EOpDst, // x = 1, y=src0.y * src1.y, z=src0.z, w=src1.w - EOpInterlockedAdd, // atomic ops, but uses [optional] out arg instead of return - EOpInterlockedAnd, // ... - EOpInterlockedCompareExchange, // ... - EOpInterlockedCompareStore, // ... - EOpInterlockedExchange, // ... - EOpInterlockedMax, // ... - EOpInterlockedMin, // ... - EOpInterlockedOr, // ... - EOpInterlockedXor, // ... - EOpAllMemoryBarrierWithGroupSync, // memory barriers without non-hlsl AST equivalents - EOpDeviceMemoryBarrier, // ... - EOpDeviceMemoryBarrierWithGroupSync, // ... - EOpWorkgroupMemoryBarrier, // ... - EOpWorkgroupMemoryBarrierWithGroupSync, // ... - EOpEvaluateAttributeSnapped, // InterpolateAtOffset with int position on 16x16 grid - EOpF32tof16, // HLSL conversion: half of a PackHalf2x16 - EOpF16tof32, // HLSL conversion: half of an UnpackHalf2x16 - EOpLit, // HLSL lighting coefficient vector - EOpTextureBias, // HLSL texture bias: will be lowered to EOpTexture - EOpAsDouble, // slightly different from EOpUint64BitsToDouble - EOpD3DCOLORtoUBYTE4, // convert and swizzle 4-component color to UBYTE4 range - - EOpMethodSample, // Texture object methods. These are translated to existing - EOpMethodSampleBias, // AST methods, and exist to represent HLSL semantics until that - EOpMethodSampleCmp, // translation is performed. See HlslParseContext::decomposeSampleMethods(). - EOpMethodSampleCmpLevelZero, // ... - EOpMethodSampleGrad, // ... - EOpMethodSampleLevel, // ... - EOpMethodLoad, // ... - EOpMethodGetDimensions, // ... - EOpMethodGetSamplePosition, // ... - EOpMethodGather, // ... - EOpMethodCalculateLevelOfDetail, // ... - EOpMethodCalculateLevelOfDetailUnclamped, // ... - - // Load already defined above for textures - EOpMethodLoad2, // Structure buffer object methods. These are translated to existing - EOpMethodLoad3, // AST methods, and exist to represent HLSL semantics until that - EOpMethodLoad4, // translation is performed. See HlslParseContext::decomposeSampleMethods(). - EOpMethodStore, // ... - EOpMethodStore2, // ... - EOpMethodStore3, // ... - EOpMethodStore4, // ... - EOpMethodIncrementCounter, // ... - EOpMethodDecrementCounter, // ... - // EOpMethodAppend is defined for geo shaders below - EOpMethodConsume, - - // SM5 texture methods - EOpMethodGatherRed, // These are covered under the above EOpMethodSample comment about - EOpMethodGatherGreen, // translation to existing AST opcodes. They exist temporarily - EOpMethodGatherBlue, // because HLSL arguments are slightly different. - EOpMethodGatherAlpha, // ... - EOpMethodGatherCmp, // ... - EOpMethodGatherCmpRed, // ... - EOpMethodGatherCmpGreen, // ... - EOpMethodGatherCmpBlue, // ... - EOpMethodGatherCmpAlpha, // ... - - // geometry methods - EOpMethodAppend, // Geometry shader methods - EOpMethodRestartStrip, // ... - - // matrix - EOpMatrixSwizzle, // select multiple matrix components (non-column) - - // SM6 wave ops - EOpWaveGetLaneCount, // Will decompose to gl_SubgroupSize. - EOpWaveGetLaneIndex, // Will decompose to gl_SubgroupInvocationID. - EOpWaveActiveCountBits, // Will decompose to subgroupBallotBitCount(subgroupBallot()). - EOpWavePrefixCountBits, // Will decompose to subgroupBallotInclusiveBitCount(subgroupBallot()). - - // Shader Clock Ops - EOpReadClockSubgroupKHR, - EOpReadClockDeviceKHR, -}; - -class TIntermTraverser; -class TIntermOperator; -class TIntermAggregate; -class TIntermUnary; -class TIntermBinary; -class TIntermConstantUnion; -class TIntermSelection; -class TIntermSwitch; -class TIntermBranch; -class TIntermTyped; -class TIntermMethod; -class TIntermSymbol; -class TIntermLoop; - -} // end namespace glslang - -// -// Base class for the tree nodes -// -// (Put outside the glslang namespace, as it's used as part of the external interface.) -// -class TIntermNode { -public: - POOL_ALLOCATOR_NEW_DELETE(glslang::GetThreadPoolAllocator()) - - TIntermNode() { loc.init(); } - virtual const glslang::TSourceLoc& getLoc() const { return loc; } - virtual void setLoc(const glslang::TSourceLoc& l) { loc = l; } - virtual void traverse(glslang::TIntermTraverser*) = 0; - virtual glslang::TIntermTyped* getAsTyped() { return nullptr; } - virtual glslang::TIntermOperator* getAsOperator() { return nullptr; } - virtual glslang::TIntermConstantUnion* getAsConstantUnion() { return nullptr; } - virtual glslang::TIntermAggregate* getAsAggregate() { return nullptr; } - virtual glslang::TIntermUnary* getAsUnaryNode() { return nullptr; } - virtual glslang::TIntermBinary* getAsBinaryNode() { return nullptr; } - virtual glslang::TIntermSelection* getAsSelectionNode() { return nullptr; } - virtual glslang::TIntermSwitch* getAsSwitchNode() { return nullptr; } - virtual glslang::TIntermMethod* getAsMethodNode() { return nullptr; } - virtual glslang::TIntermSymbol* getAsSymbolNode() { return nullptr; } - virtual glslang::TIntermBranch* getAsBranchNode() { return nullptr; } - virtual glslang::TIntermLoop* getAsLoopNode() { return nullptr; } - - virtual const glslang::TIntermTyped* getAsTyped() const { return nullptr; } - virtual const glslang::TIntermOperator* getAsOperator() const { return nullptr; } - virtual const glslang::TIntermConstantUnion* getAsConstantUnion() const { return nullptr; } - virtual const glslang::TIntermAggregate* getAsAggregate() const { return nullptr; } - virtual const glslang::TIntermUnary* getAsUnaryNode() const { return nullptr; } - virtual const glslang::TIntermBinary* getAsBinaryNode() const { return nullptr; } - virtual const glslang::TIntermSelection* getAsSelectionNode() const { return nullptr; } - virtual const glslang::TIntermSwitch* getAsSwitchNode() const { return nullptr; } - virtual const glslang::TIntermMethod* getAsMethodNode() const { return nullptr; } - virtual const glslang::TIntermSymbol* getAsSymbolNode() const { return nullptr; } - virtual const glslang::TIntermBranch* getAsBranchNode() const { return nullptr; } - virtual const glslang::TIntermLoop* getAsLoopNode() const { return nullptr; } - virtual ~TIntermNode() { } - -protected: - TIntermNode(const TIntermNode&); - TIntermNode& operator=(const TIntermNode&); - glslang::TSourceLoc loc; -}; - -namespace glslang { - -// -// This is just to help yacc. -// -struct TIntermNodePair { - TIntermNode* node1; - TIntermNode* node2; -}; - -// -// Intermediate class for nodes that have a type. -// -class TIntermTyped : public TIntermNode { -public: - TIntermTyped(const TType& t) { type.shallowCopy(t); } - TIntermTyped(TBasicType basicType) { TType bt(basicType); type.shallowCopy(bt); } - virtual TIntermTyped* getAsTyped() { return this; } - virtual const TIntermTyped* getAsTyped() const { return this; } - virtual void setType(const TType& t) { type.shallowCopy(t); } - virtual const TType& getType() const { return type; } - virtual TType& getWritableType() { return type; } - - virtual TBasicType getBasicType() const { return type.getBasicType(); } - virtual TQualifier& getQualifier() { return type.getQualifier(); } - virtual const TQualifier& getQualifier() const { return type.getQualifier(); } - virtual TArraySizes* getArraySizes() { return type.getArraySizes(); } - virtual const TArraySizes* getArraySizes() const { return type.getArraySizes(); } - virtual void propagatePrecision(TPrecisionQualifier); - virtual int getVectorSize() const { return type.getVectorSize(); } - virtual int getMatrixCols() const { return type.getMatrixCols(); } - virtual int getMatrixRows() const { return type.getMatrixRows(); } - virtual bool isMatrix() const { return type.isMatrix(); } - virtual bool isArray() const { return type.isArray(); } - virtual bool isVector() const { return type.isVector(); } - virtual bool isScalar() const { return type.isScalar(); } - virtual bool isStruct() const { return type.isStruct(); } - virtual bool isFloatingDomain() const { return type.isFloatingDomain(); } - virtual bool isIntegerDomain() const { return type.isIntegerDomain(); } - bool isAtomic() const { return type.isAtomic(); } - bool isReference() const { return type.isReference(); } - TString getCompleteString(bool enhanced = false) const { return type.getCompleteString(enhanced); } - -protected: - TIntermTyped& operator=(const TIntermTyped&); - TType type; -}; - -// -// Handle for, do-while, and while loops. -// -class TIntermLoop : public TIntermNode { -public: - TIntermLoop(TIntermNode* aBody, TIntermTyped* aTest, TIntermTyped* aTerminal, bool testFirst) : - body(aBody), - test(aTest), - terminal(aTerminal), - first(testFirst), - unroll(false), - dontUnroll(false), - dependency(0), - minIterations(0), - maxIterations(iterationsInfinite), - iterationMultiple(1), - peelCount(0), - partialCount(0) - { } - - virtual TIntermLoop* getAsLoopNode() { return this; } - virtual const TIntermLoop* getAsLoopNode() const { return this; } - virtual void traverse(TIntermTraverser*); - TIntermNode* getBody() const { return body; } - TIntermTyped* getTest() const { return test; } - TIntermTyped* getTerminal() const { return terminal; } - bool testFirst() const { return first; } - - void setUnroll() { unroll = true; } - void setDontUnroll() { - dontUnroll = true; - peelCount = 0; - partialCount = 0; - } - bool getUnroll() const { return unroll; } - bool getDontUnroll() const { return dontUnroll; } - - static const unsigned int dependencyInfinite = 0xFFFFFFFF; - static const unsigned int iterationsInfinite = 0xFFFFFFFF; - void setLoopDependency(int d) { dependency = d; } - int getLoopDependency() const { return dependency; } - - void setMinIterations(unsigned int v) { minIterations = v; } - unsigned int getMinIterations() const { return minIterations; } - void setMaxIterations(unsigned int v) { maxIterations = v; } - unsigned int getMaxIterations() const { return maxIterations; } - void setIterationMultiple(unsigned int v) { iterationMultiple = v; } - unsigned int getIterationMultiple() const { return iterationMultiple; } - void setPeelCount(unsigned int v) { - peelCount = v; - dontUnroll = false; - } - unsigned int getPeelCount() const { return peelCount; } - void setPartialCount(unsigned int v) { - partialCount = v; - dontUnroll = false; - } - unsigned int getPartialCount() const { return partialCount; } - -protected: - TIntermNode* body; // code to loop over - TIntermTyped* test; // exit condition associated with loop, could be 0 for 'for' loops - TIntermTyped* terminal; // exists for for-loops - bool first; // true for while and for, not for do-while - bool unroll; // true if unroll requested - bool dontUnroll; // true if request to not unroll - unsigned int dependency; // loop dependency hint; 0 means not set or unknown - unsigned int minIterations; // as per the SPIR-V specification - unsigned int maxIterations; // as per the SPIR-V specification - unsigned int iterationMultiple; // as per the SPIR-V specification - unsigned int peelCount; // as per the SPIR-V specification - unsigned int partialCount; // as per the SPIR-V specification -}; - -// -// Handle case, break, continue, return, and kill. -// -class TIntermBranch : public TIntermNode { -public: - TIntermBranch(TOperator op, TIntermTyped* e) : - flowOp(op), - expression(e) { } - virtual TIntermBranch* getAsBranchNode() { return this; } - virtual const TIntermBranch* getAsBranchNode() const { return this; } - virtual void traverse(TIntermTraverser*); - TOperator getFlowOp() const { return flowOp; } - TIntermTyped* getExpression() const { return expression; } - void setExpression(TIntermTyped* pExpression) { expression = pExpression; } - void updatePrecision(TPrecisionQualifier parentPrecision); -protected: - TOperator flowOp; - TIntermTyped* expression; -}; - -// -// Represent method names before seeing their calling signature -// or resolving them to operations. Just an expression as the base object -// and a textural name. -// -class TIntermMethod : public TIntermTyped { -public: - TIntermMethod(TIntermTyped* o, const TType& t, const TString& m) : TIntermTyped(t), object(o), method(m) { } - virtual TIntermMethod* getAsMethodNode() { return this; } - virtual const TIntermMethod* getAsMethodNode() const { return this; } - virtual const TString& getMethodName() const { return method; } - virtual TIntermTyped* getObject() const { return object; } - virtual void traverse(TIntermTraverser*); -protected: - TIntermTyped* object; - TString method; -}; - -// -// Nodes that correspond to symbols or constants in the source code. -// -class TIntermSymbol : public TIntermTyped { -public: - // if symbol is initialized as symbol(sym), the memory comes from the pool allocator of sym. If sym comes from - // per process threadPoolAllocator, then it causes increased memory usage per compile - // it is essential to use "symbol = sym" to assign to symbol - TIntermSymbol(long long i, const TString& n, const TType& t) - : TIntermTyped(t), id(i), -#ifndef GLSLANG_WEB - flattenSubset(-1), -#endif - constSubtree(nullptr) - { name = n; } - virtual long long getId() const { return id; } - virtual void changeId(long long i) { id = i; } - virtual const TString& getName() const { return name; } - virtual void traverse(TIntermTraverser*); - virtual TIntermSymbol* getAsSymbolNode() { return this; } - virtual const TIntermSymbol* getAsSymbolNode() const { return this; } - void setConstArray(const TConstUnionArray& c) { constArray = c; } - const TConstUnionArray& getConstArray() const { return constArray; } - void setConstSubtree(TIntermTyped* subtree) { constSubtree = subtree; } - TIntermTyped* getConstSubtree() const { return constSubtree; } -#ifndef GLSLANG_WEB - void setFlattenSubset(int subset) { flattenSubset = subset; } - virtual const TString& getAccessName() const; - - int getFlattenSubset() const { return flattenSubset; } // -1 means full object -#endif - - // This is meant for cases where a node has already been constructed, and - // later on, it becomes necessary to switch to a different symbol. - virtual void switchId(long long newId) { id = newId; } - -protected: - long long id; // the unique id of the symbol this node represents -#ifndef GLSLANG_WEB - int flattenSubset; // how deeply the flattened object rooted at id has been dereferenced -#endif - TString name; // the name of the symbol this node represents - TConstUnionArray constArray; // if the symbol is a front-end compile-time constant, this is its value - TIntermTyped* constSubtree; -}; - -class TIntermConstantUnion : public TIntermTyped { -public: - TIntermConstantUnion(const TConstUnionArray& ua, const TType& t) : TIntermTyped(t), constArray(ua), literal(false) { } - const TConstUnionArray& getConstArray() const { return constArray; } - virtual TIntermConstantUnion* getAsConstantUnion() { return this; } - virtual const TIntermConstantUnion* getAsConstantUnion() const { return this; } - virtual void traverse(TIntermTraverser*); - virtual TIntermTyped* fold(TOperator, const TIntermTyped*) const; - virtual TIntermTyped* fold(TOperator, const TType&) const; - void setLiteral() { literal = true; } - void setExpression() { literal = false; } - bool isLiteral() const { return literal; } - -protected: - TIntermConstantUnion& operator=(const TIntermConstantUnion&); - - const TConstUnionArray constArray; - bool literal; // true if node represents a literal in the source code -}; - -// Represent the independent aspects of a texturing TOperator -struct TCrackedTextureOp { - bool query; - bool proj; - bool lod; - bool fetch; - bool offset; - bool offsets; - bool gather; - bool grad; - bool subpass; - bool lodClamp; - bool fragMask; -}; - -// -// Intermediate class for node types that hold operators. -// -class TIntermOperator : public TIntermTyped { -public: - virtual TIntermOperator* getAsOperator() { return this; } - virtual const TIntermOperator* getAsOperator() const { return this; } - TOperator getOp() const { return op; } - void setOp(TOperator newOp) { op = newOp; } - bool modifiesState() const; - bool isConstructor() const; - bool isTexture() const { return op > EOpTextureGuardBegin && op < EOpTextureGuardEnd; } - bool isSampling() const { return op > EOpSamplingGuardBegin && op < EOpSamplingGuardEnd; } -#ifdef GLSLANG_WEB - bool isImage() const { return false; } - bool isSparseTexture() const { return false; } - bool isImageFootprint() const { return false; } - bool isSparseImage() const { return false; } - bool isSubgroup() const { return false; } -#else - bool isImage() const { return op > EOpImageGuardBegin && op < EOpImageGuardEnd; } - bool isSparseTexture() const { return op > EOpSparseTextureGuardBegin && op < EOpSparseTextureGuardEnd; } - bool isImageFootprint() const { return op > EOpImageFootprintGuardBegin && op < EOpImageFootprintGuardEnd; } - bool isSparseImage() const { return op == EOpSparseImageLoad; } - bool isSubgroup() const { return op > EOpSubgroupGuardStart && op < EOpSubgroupGuardStop; } -#endif - - void setOperationPrecision(TPrecisionQualifier p) { operationPrecision = p; } - TPrecisionQualifier getOperationPrecision() const { return operationPrecision != EpqNone ? - operationPrecision : - type.getQualifier().precision; } - TString getCompleteString() const - { - TString cs = type.getCompleteString(); - if (getOperationPrecision() != type.getQualifier().precision) { - cs += ", operation at "; - cs += GetPrecisionQualifierString(getOperationPrecision()); - } - - return cs; - } - - // Crack the op into the individual dimensions of texturing operation. - void crackTexture(TSampler sampler, TCrackedTextureOp& cracked) const - { - cracked.query = false; - cracked.proj = false; - cracked.lod = false; - cracked.fetch = false; - cracked.offset = false; - cracked.offsets = false; - cracked.gather = false; - cracked.grad = false; - cracked.subpass = false; - cracked.lodClamp = false; - cracked.fragMask = false; - - switch (op) { - case EOpImageQuerySize: - case EOpImageQuerySamples: - case EOpTextureQuerySize: - case EOpTextureQueryLod: - case EOpTextureQueryLevels: - case EOpTextureQuerySamples: - case EOpSparseTexelsResident: - cracked.query = true; - break; - case EOpTexture: - case EOpSparseTexture: - break; - case EOpTextureProj: - cracked.proj = true; - break; - case EOpTextureLod: - case EOpSparseTextureLod: - cracked.lod = true; - break; - case EOpTextureOffset: - case EOpSparseTextureOffset: - cracked.offset = true; - break; - case EOpTextureFetch: - case EOpSparseTextureFetch: - cracked.fetch = true; - if (sampler.is1D() || (sampler.dim == Esd2D && ! sampler.isMultiSample()) || sampler.dim == Esd3D) - cracked.lod = true; - break; - case EOpTextureFetchOffset: - case EOpSparseTextureFetchOffset: - cracked.fetch = true; - cracked.offset = true; - if (sampler.is1D() || (sampler.dim == Esd2D && ! sampler.isMultiSample()) || sampler.dim == Esd3D) - cracked.lod = true; - break; - case EOpTextureProjOffset: - cracked.offset = true; - cracked.proj = true; - break; - case EOpTextureLodOffset: - case EOpSparseTextureLodOffset: - cracked.offset = true; - cracked.lod = true; - break; - case EOpTextureProjLod: - cracked.lod = true; - cracked.proj = true; - break; - case EOpTextureProjLodOffset: - cracked.offset = true; - cracked.lod = true; - cracked.proj = true; - break; - case EOpTextureGrad: - case EOpSparseTextureGrad: - cracked.grad = true; - break; - case EOpTextureGradOffset: - case EOpSparseTextureGradOffset: - cracked.grad = true; - cracked.offset = true; - break; - case EOpTextureProjGrad: - cracked.grad = true; - cracked.proj = true; - break; - case EOpTextureProjGradOffset: - cracked.grad = true; - cracked.offset = true; - cracked.proj = true; - break; -#ifndef GLSLANG_WEB - case EOpTextureClamp: - case EOpSparseTextureClamp: - cracked.lodClamp = true; - break; - case EOpTextureOffsetClamp: - case EOpSparseTextureOffsetClamp: - cracked.offset = true; - cracked.lodClamp = true; - break; - case EOpTextureGradClamp: - case EOpSparseTextureGradClamp: - cracked.grad = true; - cracked.lodClamp = true; - break; - case EOpTextureGradOffsetClamp: - case EOpSparseTextureGradOffsetClamp: - cracked.grad = true; - cracked.offset = true; - cracked.lodClamp = true; - break; - case EOpTextureGather: - case EOpSparseTextureGather: - cracked.gather = true; - break; - case EOpTextureGatherOffset: - case EOpSparseTextureGatherOffset: - cracked.gather = true; - cracked.offset = true; - break; - case EOpTextureGatherOffsets: - case EOpSparseTextureGatherOffsets: - cracked.gather = true; - cracked.offsets = true; - break; - case EOpTextureGatherLod: - case EOpSparseTextureGatherLod: - cracked.gather = true; - cracked.lod = true; - break; - case EOpTextureGatherLodOffset: - case EOpSparseTextureGatherLodOffset: - cracked.gather = true; - cracked.offset = true; - cracked.lod = true; - break; - case EOpTextureGatherLodOffsets: - case EOpSparseTextureGatherLodOffsets: - cracked.gather = true; - cracked.offsets = true; - cracked.lod = true; - break; - case EOpImageLoadLod: - case EOpImageStoreLod: - case EOpSparseImageLoadLod: - cracked.lod = true; - break; - case EOpFragmentMaskFetch: - cracked.subpass = sampler.dim == EsdSubpass; - cracked.fragMask = true; - break; - case EOpFragmentFetch: - cracked.subpass = sampler.dim == EsdSubpass; - cracked.fragMask = true; - break; - case EOpImageSampleFootprintNV: - break; - case EOpImageSampleFootprintClampNV: - cracked.lodClamp = true; - break; - case EOpImageSampleFootprintLodNV: - cracked.lod = true; - break; - case EOpImageSampleFootprintGradNV: - cracked.grad = true; - break; - case EOpImageSampleFootprintGradClampNV: - cracked.lodClamp = true; - cracked.grad = true; - break; - case EOpSubpassLoad: - case EOpSubpassLoadMS: - cracked.subpass = true; - break; -#endif - default: - break; - } - } - -protected: - TIntermOperator(TOperator o) : TIntermTyped(EbtFloat), op(o), operationPrecision(EpqNone) {} - TIntermOperator(TOperator o, TType& t) : TIntermTyped(t), op(o), operationPrecision(EpqNone) {} - TOperator op; - // The result precision is in the inherited TType, and is usually meant to be both - // the operation precision and the result precision. However, some more complex things, - // like built-in function calls, distinguish between the two, in which case non-EqpNone - // 'operationPrecision' overrides the result precision as far as operation precision - // is concerned. - TPrecisionQualifier operationPrecision; -}; - -// -// Nodes for all the basic binary math operators. -// -class TIntermBinary : public TIntermOperator { -public: - TIntermBinary(TOperator o) : TIntermOperator(o) {} - virtual void traverse(TIntermTraverser*); - virtual void setLeft(TIntermTyped* n) { left = n; } - virtual void setRight(TIntermTyped* n) { right = n; } - virtual TIntermTyped* getLeft() const { return left; } - virtual TIntermTyped* getRight() const { return right; } - virtual TIntermBinary* getAsBinaryNode() { return this; } - virtual const TIntermBinary* getAsBinaryNode() const { return this; } - virtual void updatePrecision(); -protected: - TIntermTyped* left; - TIntermTyped* right; -}; - -// -// Nodes for unary math operators. -// -class TIntermUnary : public TIntermOperator { -public: - TIntermUnary(TOperator o, TType& t) : TIntermOperator(o, t), operand(nullptr) {} - TIntermUnary(TOperator o) : TIntermOperator(o), operand(nullptr) {} - virtual void traverse(TIntermTraverser*); - virtual void setOperand(TIntermTyped* o) { operand = o; } - virtual TIntermTyped* getOperand() { return operand; } - virtual const TIntermTyped* getOperand() const { return operand; } - virtual TIntermUnary* getAsUnaryNode() { return this; } - virtual const TIntermUnary* getAsUnaryNode() const { return this; } - virtual void updatePrecision(); -#ifndef GLSLANG_WEB - void setSpirvInstruction(const TSpirvInstruction& inst) { spirvInst = inst; } - const TSpirvInstruction& getSpirvInstruction() const { return spirvInst; } -#endif -protected: - TIntermTyped* operand; -#ifndef GLSLANG_WEB - TSpirvInstruction spirvInst; -#endif -}; - -typedef TVector TIntermSequence; -typedef TVector TQualifierList; -// -// Nodes that operate on an arbitrary sized set of children. -// -class TIntermAggregate : public TIntermOperator { -public: - TIntermAggregate() : TIntermOperator(EOpNull), userDefined(false), pragmaTable(nullptr) { } - TIntermAggregate(TOperator o) : TIntermOperator(o), pragmaTable(nullptr) { } - ~TIntermAggregate() { delete pragmaTable; } - virtual TIntermAggregate* getAsAggregate() { return this; } - virtual const TIntermAggregate* getAsAggregate() const { return this; } - virtual void updatePrecision(); - virtual void setOperator(TOperator o) { op = o; } - virtual TIntermSequence& getSequence() { return sequence; } - virtual const TIntermSequence& getSequence() const { return sequence; } - virtual void setName(const TString& n) { name = n; } - virtual const TString& getName() const { return name; } - virtual void traverse(TIntermTraverser*); - virtual void setUserDefined() { userDefined = true; } - virtual bool isUserDefined() { return userDefined; } - virtual TQualifierList& getQualifierList() { return qualifier; } - virtual const TQualifierList& getQualifierList() const { return qualifier; } - void setOptimize(bool o) { optimize = o; } - void setDebug(bool d) { debug = d; } - bool getOptimize() const { return optimize; } - bool getDebug() const { return debug; } - void setPragmaTable(const TPragmaTable& pTable); - const TPragmaTable& getPragmaTable() const { return *pragmaTable; } -#ifndef GLSLANG_WEB - void setSpirvInstruction(const TSpirvInstruction& inst) { spirvInst = inst; } - const TSpirvInstruction& getSpirvInstruction() const { return spirvInst; } -#endif -protected: - TIntermAggregate(const TIntermAggregate&); // disallow copy constructor - TIntermAggregate& operator=(const TIntermAggregate&); // disallow assignment operator - TIntermSequence sequence; - TQualifierList qualifier; - TString name; - bool userDefined; // used for user defined function names - bool optimize; - bool debug; - TPragmaTable* pragmaTable; -#ifndef GLSLANG_WEB - TSpirvInstruction spirvInst; -#endif -}; - -// -// For if tests. -// -class TIntermSelection : public TIntermTyped { -public: - TIntermSelection(TIntermTyped* cond, TIntermNode* trueB, TIntermNode* falseB) : - TIntermTyped(EbtVoid), condition(cond), trueBlock(trueB), falseBlock(falseB), - shortCircuit(true), - flatten(false), dontFlatten(false) {} - TIntermSelection(TIntermTyped* cond, TIntermNode* trueB, TIntermNode* falseB, const TType& type) : - TIntermTyped(type), condition(cond), trueBlock(trueB), falseBlock(falseB), - shortCircuit(true), - flatten(false), dontFlatten(false) {} - virtual void traverse(TIntermTraverser*); - virtual TIntermTyped* getCondition() const { return condition; } - virtual void setCondition(TIntermTyped* c) { condition = c; } - virtual TIntermNode* getTrueBlock() const { return trueBlock; } - virtual void setTrueBlock(TIntermTyped* tb) { trueBlock = tb; } - virtual TIntermNode* getFalseBlock() const { return falseBlock; } - virtual void setFalseBlock(TIntermTyped* fb) { falseBlock = fb; } - virtual TIntermSelection* getAsSelectionNode() { return this; } - virtual const TIntermSelection* getAsSelectionNode() const { return this; } - - void setNoShortCircuit() { shortCircuit = false; } - bool getShortCircuit() const { return shortCircuit; } - - void setFlatten() { flatten = true; } - void setDontFlatten() { dontFlatten = true; } - bool getFlatten() const { return flatten; } - bool getDontFlatten() const { return dontFlatten; } - -protected: - TIntermTyped* condition; - TIntermNode* trueBlock; - TIntermNode* falseBlock; - bool shortCircuit; // normally all if-then-else and all GLSL ?: short-circuit, but HLSL ?: does not - bool flatten; // true if flatten requested - bool dontFlatten; // true if requested to not flatten -}; - -// -// For switch statements. Designed use is that a switch will have sequence of nodes -// that are either case/default nodes or a *single* node that represents all the code -// in between (if any) consecutive case/defaults. So, a traversal need only deal with -// 0 or 1 nodes per case/default statement. -// -class TIntermSwitch : public TIntermNode { -public: - TIntermSwitch(TIntermTyped* cond, TIntermAggregate* b) : condition(cond), body(b), - flatten(false), dontFlatten(false) {} - virtual void traverse(TIntermTraverser*); - virtual TIntermNode* getCondition() const { return condition; } - virtual TIntermAggregate* getBody() const { return body; } - virtual TIntermSwitch* getAsSwitchNode() { return this; } - virtual const TIntermSwitch* getAsSwitchNode() const { return this; } - - void setFlatten() { flatten = true; } - void setDontFlatten() { dontFlatten = true; } - bool getFlatten() const { return flatten; } - bool getDontFlatten() const { return dontFlatten; } - -protected: - TIntermTyped* condition; - TIntermAggregate* body; - bool flatten; // true if flatten requested - bool dontFlatten; // true if requested to not flatten -}; - -enum TVisit -{ - EvPreVisit, - EvInVisit, - EvPostVisit -}; - -// -// For traversing the tree. User should derive from this, -// put their traversal specific data in it, and then pass -// it to a Traverse method. -// -// When using this, just fill in the methods for nodes you want visited. -// Return false from a pre-visit to skip visiting that node's subtree. -// -// Explicitly set postVisit to true if you want post visiting, otherwise, -// filled in methods will only be called at pre-visit time (before processing -// the subtree). Similarly for inVisit for in-order visiting of nodes with -// multiple children. -// -// 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()) - TIntermTraverser(bool preVisit = true, bool inVisit = false, bool postVisit = false, bool rightToLeft = false) : - preVisit(preVisit), - inVisit(inVisit), - postVisit(postVisit), - rightToLeft(rightToLeft), - depth(0), - maxDepth(0) { } - virtual ~TIntermTraverser() { } - - virtual void visitSymbol(TIntermSymbol*) { } - virtual void visitConstantUnion(TIntermConstantUnion*) { } - virtual bool visitBinary(TVisit, TIntermBinary*) { return true; } - virtual bool visitUnary(TVisit, TIntermUnary*) { return true; } - virtual bool visitSelection(TVisit, TIntermSelection*) { return true; } - virtual bool visitAggregate(TVisit, TIntermAggregate*) { return true; } - virtual bool visitLoop(TVisit, TIntermLoop*) { return true; } - virtual bool visitBranch(TVisit, TIntermBranch*) { return true; } - virtual bool visitSwitch(TVisit, TIntermSwitch*) { return true; } - - int getMaxDepth() const { return maxDepth; } - - void incrementDepth(TIntermNode *current) - { - depth++; - maxDepth = (std::max)(maxDepth, depth); - path.push_back(current); - } - - void decrementDepth() - { - depth--; - path.pop_back(); - } - - TIntermNode *getParentNode() - { - return path.size() == 0 ? nullptr : path.back(); - } - - const bool preVisit; - const bool inVisit; - const bool postVisit; - const bool rightToLeft; - -protected: - TIntermTraverser& operator=(TIntermTraverser&); - - int depth; - int maxDepth; - - // All the nodes from root to the current node's parent during traversing. - TVector path; -}; - -// KHR_vulkan_glsl says "Two arrays sized with specialization constants are the same type only if -// sized with the same symbol, involving no operations" -inline bool SameSpecializationConstants(TIntermTyped* node1, TIntermTyped* node2) -{ - return node1->getAsSymbolNode() && node2->getAsSymbolNode() && - node1->getAsSymbolNode()->getId() == node2->getAsSymbolNode()->getId(); -} - -} // end namespace glslang - -#endif // __INTERMEDIATE_H diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/Initialize.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/Initialize.h deleted file mode 100644 index ac8ec33..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/Initialize.h +++ /dev/null @@ -1,112 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2013-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 _INITIALIZE_INCLUDED_ -#define _INITIALIZE_INCLUDED_ - -#include "../Include/ResourceLimits.h" -#include "../Include/Common.h" -#include "../Include/ShHandle.h" -#include "SymbolTable.h" -#include "Versions.h" - -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 TBuiltInParseables { -public: - POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) - TBuiltInParseables(); - virtual ~TBuiltInParseables(); - virtual void initialize(int version, EProfile, const SpvVersion& spvVersion) = 0; - virtual void initialize(const TBuiltInResource& resources, int version, EProfile, const SpvVersion& spvVersion, 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, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable) = 0; - virtual void identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, 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, const SpvVersion& spvVersion); - void initialize(const TBuiltInResource& resources, int version, EProfile, const SpvVersion& spvVersion, EShLanguage); - - void identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable); - void identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources); - -protected: - void addTabledBuiltins(int version, EProfile profile, const SpvVersion& spvVersion); - void relateTabledBuiltins(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage, TSymbolTable&); - void add2ndGenerationSamplingImaging(int version, EProfile profile, const SpvVersion& spvVersion); - void addSubpassSampling(TSampler, const TString& typeName, int version, EProfile profile); - void addQueryFunctions(TSampler, const TString& typeName, int version, EProfile profile); - void addImageFunctions(TSampler, const TString& typeName, int version, EProfile profile); - void addSamplingFunctions(TSampler, const TString& typeName, int version, EProfile profile); - void addGatherFunctions(TSampler, const TString& typeName, int version, EProfile profile); - - // Helpers for making textual representations of the permutations - // of texturing/imaging functions. - const char* postfixes[5]; - const char* prefixes[EbtNumTypes]; - int dimMap[EsdNumDims]; -}; - -} // end namespace glslang - -#endif // _INITIALIZE_INCLUDED_ diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/LiveTraverser.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/LiveTraverser.h deleted file mode 100644 index 9b39b59..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/LiveTraverser.h +++ /dev/null @@ -1,168 +0,0 @@ -// -// 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. -// - -#pragma once - -#include "../Include/Common.h" -#include "reflection.h" -#include "localintermediate.h" - -#include "gl_types.h" - -#include -#include - -namespace glslang { - -// -// The traverser: mostly pass through, except -// - processing function-call nodes to push live functions onto the stack of functions to process -// - processing selection nodes to trim semantically dead code -// -// This is in the glslang namespace directly so it can be a friend of TReflection. -// This can be derived from to implement reflection database traversers or -// binding mappers: anything that wants to traverse the live subset of the tree. -// - -class TLiveTraverser : public TIntermTraverser { -public: - TLiveTraverser(const TIntermediate& i, bool traverseAll = false, - bool preVisit = true, bool inVisit = false, bool postVisit = false) : - TIntermTraverser(preVisit, inVisit, postVisit), - intermediate(i), traverseAll(traverseAll) - { } - - // - // Given a function name, find its subroot in the tree, and push it onto the stack of - // functions left to process. - // - void pushFunction(const TString& name) - { - TIntermSequence& globals = intermediate.getTreeRoot()->getAsAggregate()->getSequence(); - for (unsigned int f = 0; f < globals.size(); ++f) { - TIntermAggregate* candidate = globals[f]->getAsAggregate(); - if (candidate && candidate->getOp() == EOpFunction && candidate->getName() == name) { - destinations.push_back(candidate); - break; - } - } - } - - void pushGlobalReference(const TString& name) - { - TIntermSequence& globals = intermediate.getTreeRoot()->getAsAggregate()->getSequence(); - for (unsigned int f = 0; f < globals.size(); ++f) { - TIntermAggregate* candidate = globals[f]->getAsAggregate(); - if (candidate && candidate->getOp() == EOpSequence && - candidate->getSequence().size() == 1 && - candidate->getSequence()[0]->getAsBinaryNode()) { - TIntermBinary* binary = candidate->getSequence()[0]->getAsBinaryNode(); - TIntermSymbol* symbol = binary->getLeft()->getAsSymbolNode(); - if (symbol && symbol->getQualifier().storage == EvqGlobal && - symbol->getName() == name) { - destinations.push_back(candidate); - break; - } - } - } - } - - typedef std::list TDestinationStack; - TDestinationStack destinations; - -protected: - // To catch which function calls are not dead, and hence which functions must be visited. - virtual bool visitAggregate(TVisit, TIntermAggregate* node) - { - if (!traverseAll) - if (node->getOp() == EOpFunctionCall) - addFunctionCall(node); - - return true; // traverse this subtree - } - - // To prune semantically dead paths. - virtual bool visitSelection(TVisit /* visit */, TIntermSelection* node) - { - if (traverseAll) - return true; // traverse all code - - TIntermConstantUnion* constant = node->getCondition()->getAsConstantUnion(); - if (constant) { - // cull the path that is dead - if (constant->getConstArray()[0].getBConst() == true && node->getTrueBlock()) - node->getTrueBlock()->traverse(this); - if (constant->getConstArray()[0].getBConst() == false && node->getFalseBlock()) - node->getFalseBlock()->traverse(this); - - return false; // don't traverse any more, we did it all above - } else - return true; // traverse the whole subtree - } - - // Track live functions as well as uniforms, so that we don't visit dead functions - // and only visit each function once. - void addFunctionCall(TIntermAggregate* call) - { - // just use the map to ensure we process each function at most once - if (liveFunctions.find(call->getName()) == liveFunctions.end()) { - liveFunctions.insert(call->getName()); - pushFunction(call->getName()); - } - } - - void addGlobalReference(const TString& name) - { - // just use the map to ensure we process each global at most once - if (liveGlobals.find(name) == liveGlobals.end()) { - liveGlobals.insert(name); - pushGlobalReference(name); - } - } - - const TIntermediate& intermediate; - typedef std::unordered_set TLiveFunctions; - TLiveFunctions liveFunctions; - typedef std::unordered_set TLiveGlobals; - TLiveGlobals liveGlobals; - bool traverseAll; - -private: - // prevent copy & copy construct - TLiveTraverser(TLiveTraverser&); - TLiveTraverser& operator=(TLiveTraverser&); -}; - -} // namespace glslang diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/ParseHelper.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/ParseHelper.h deleted file mode 100644 index 509b300..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/ParseHelper.h +++ /dev/null @@ -1,594 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2012-2013 LunarG, Inc. -// Copyright (C) 2015-2018 Google, Inc. -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// -// Neither the name of 3Dlabs Inc. Ltd. nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// - -// -// 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 -#include - -#include "parseVersions.h" -#include "../Include/ShHandle.h" -#include "SymbolTable.h" -#include "localintermediate.h" -#include "Scan.h" -#include "attribute.h" - -namespace glslang { - -struct TPragma { - TPragma(bool o, bool d) : optimize(o), debug(d) { } - bool optimize; - bool debug; - TPragmaTable pragmaTable; -}; - -class TScanContext; -class TPpContext; - -typedef std::set TIdSetType; -typedef std::map> TStructRecord; - -// -// Sharable code (as well as what's in TParseVersions) across -// parse helpers. -// -class TParseContextBase : public TParseVersions { -public: - TParseContextBase(TSymbolTable& symbolTable, TIntermediate& interm, bool parsingBuiltins, int version, - EProfile profile, const SpvVersion& spvVersion, EShLanguage language, - TInfoSink& infoSink, bool forwardCompatible, EShMessages messages, - const TString* entryPoint = nullptr) - : TParseVersions(interm, version, profile, spvVersion, language, infoSink, forwardCompatible, messages), - scopeMangler("::"), - symbolTable(symbolTable), - statementNestingLevel(0), loopNestingLevel(0), structNestingLevel(0), blockNestingLevel(0), controlFlowNestingLevel(0), - currentFunctionType(nullptr), - postEntryPointReturn(false), - contextPragma(true, false), - beginInvocationInterlockCount(0), endInvocationInterlockCount(0), - parsingBuiltins(parsingBuiltins), scanContext(nullptr), ppContext(nullptr), - limits(resources.limits), - globalUniformBlock(nullptr), - globalUniformBinding(TQualifier::layoutBindingEnd), - globalUniformSet(TQualifier::layoutSetEnd), - atomicCounterBlockSet(TQualifier::layoutSetEnd) - { - // use storage buffer on SPIR-V 1.3 and up - if (spvVersion.spv >= EShTargetSpv_1_3) - intermediate.setUseStorageBuffer(); - - if (entryPoint != nullptr) - sourceEntryPointName = *entryPoint; - } - virtual ~TParseContextBase() { } - -#if !defined(GLSLANG_WEB) || defined(GLSLANG_WEB_DEVEL) - virtual void C_DECL error(const TSourceLoc&, const char* szReason, const char* szToken, - const char* szExtraInfoFormat, ...); - virtual void C_DECL warn(const TSourceLoc&, const char* szReason, const char* szToken, - const char* szExtraInfoFormat, ...); - virtual void C_DECL ppError(const TSourceLoc&, const char* szReason, const char* szToken, - const char* szExtraInfoFormat, ...); - virtual void C_DECL ppWarn(const TSourceLoc&, const char* szReason, const char* szToken, - const char* szExtraInfoFormat, ...); -#endif - - virtual void setLimits(const TBuiltInResource&) = 0; - - void checkIndex(const TSourceLoc&, const TType&, int& index); - - EShLanguage getLanguage() const { return language; } - 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); - } - - // Manage the global uniform block (default uniforms in GLSL, $Global in HLSL) - virtual void growGlobalUniformBlock(const TSourceLoc&, TType&, const TString& memberName, TTypeList* typeList = nullptr); - - // Manage global buffer (used for backing atomic counters in GLSL when using relaxed Vulkan semantics) - virtual void growAtomicCounterBlock(int binding, const TSourceLoc&, TType&, const TString& memberName, TTypeList* typeList = nullptr); - - // Potentially rename shader entry point function - void renameShaderFunction(TString*& name) const - { - // Replace the entry point name given in the shader with the real entry point name, - // if there is a substitution. - if (name != nullptr && *name == sourceEntryPointName && intermediate.getEntryPointName().size() > 0) - name = NewPoolTString(intermediate.getEntryPointName().c_str()); - } - - virtual bool lValueErrorCheck(const TSourceLoc&, const char* op, TIntermTyped*); - virtual void rValueErrorCheck(const TSourceLoc&, const char* op, TIntermTyped*); - - const char* const scopeMangler; - - // Basic parsing state, easily accessible to the grammar - - TSymbolTable& symbolTable; // symbol table that goes with the current language, version, and profile - int statementNestingLevel; // 0 if outside all flow control or compound statements - int loopNestingLevel; // 0 if outside all loops - int structNestingLevel; // 0 if outside structures - int blockNestingLevel; // 0 if outside blocks - int controlFlowNestingLevel; // 0 if outside all flow control - 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 - // if inside a function, true if the function is the entry point and this is after a return statement - bool postEntryPointReturn; - // case, node, case, case, node, ...; ensure only one node between cases; stack of them for nesting - TList switchSequenceStack; - // the statementNestingLevel the current switch statement is at, which must match the level of its case statements - TList switchLevel; - struct TPragma contextPragma; - int beginInvocationInterlockCount; - int endInvocationInterlockCount; - -protected: - TParseContextBase(TParseContextBase&); - TParseContextBase& operator=(TParseContextBase&); - - const bool parsingBuiltins; // true if parsing built-in symbols/functions - TVector linkageSymbols; // will be transferred to 'linkage', after all editing is done, order preserving - TScanContext* scanContext; - TPpContext* ppContext; - TBuiltInResource resources; - TLimits& limits; - TString sourceEntryPointName; - - // 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; - - // see implementation for detail - const TFunction* selectFunction(const TVector, const TFunction&, - std::function, - std::function, - /* output */ bool& tie); - - virtual void parseSwizzleSelector(const TSourceLoc&, const TString&, int size, - TSwizzleSelectors&); - - // Manage the global uniform block (default uniforms in GLSL, $Global in HLSL) - TVariable* globalUniformBlock; // the actual block, inserted into the symbol table - unsigned int globalUniformBinding; // the block's binding number - unsigned int globalUniformSet; // the block's set number - int firstNewMember; // the index of the first member not yet inserted into the symbol table - // override this to set the language-specific name - virtual const char* getGlobalUniformBlockName() const { return ""; } - virtual void setUniformBlockDefaults(TType&) const { } - virtual void finalizeGlobalUniformBlockLayout(TVariable&) {} - - // Manage the atomic counter block (used for atomic_uints with Vulkan-Relaxed) - TMap atomicCounterBuffers; - unsigned int atomicCounterBlockSet; - TMap atomicCounterBlockFirstNewMember; - // override this to set the language-specific name - virtual const char* getAtomicCounterBlockName() const { return ""; } - virtual void setAtomicCounterBlockDefaults(TType&) const {} - virtual void setInvariant(const TSourceLoc&, const char*) {} - virtual void finalizeAtomicCounterBlockLayout(TVariable&) {} - bool isAtomicCounterBlock(const TSymbol& symbol) { - const TVariable* var = symbol.getAsVariable(); - if (!var) - return false; - const auto& at = atomicCounterBuffers.find(var->getType().getQualifier().layoutBinding); - return (at != atomicCounterBuffers.end() && (*at).second->getType() == var->getType()); - } - - virtual void outputMessage(const TSourceLoc&, const char* szReason, const char* szToken, - const char* szExtraInfoFormat, TPrefixType prefix, - va_list args); - virtual void trackLinkage(TSymbol& symbol); - virtual void makeEditable(TSymbol*&); - virtual TVariable* getEditableVariable(const char* name); - virtual void finish(); -}; - -// -// Manage the state for when to respect precision qualifiers and when to warn about -// the defaults being different than might be expected. -// -class TPrecisionManager { -public: - TPrecisionManager() : obey(false), warn(false), explicitIntDefault(false), explicitFloatDefault(false){ } - virtual ~TPrecisionManager() {} - - void respectPrecisionQualifiers() { obey = true; } - bool respectingPrecisionQualifiers() const { return obey; } - bool shouldWarnAboutDefaults() const { return warn; } - void defaultWarningGiven() { warn = false; } - void warnAboutDefaults() { warn = true; } - void explicitIntDefaultSeen() - { - explicitIntDefault = true; - if (explicitFloatDefault) - warn = false; - } - void explicitFloatDefaultSeen() - { - explicitFloatDefault = true; - if (explicitIntDefault) - warn = false; - } - -protected: - bool obey; // respect precision qualifiers - bool warn; // need to give a warning about the defaults - bool explicitIntDefault; // user set the default for int/uint - bool explicitFloatDefault; // user set the default for float -}; - -// -// 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, const SpvVersion& spvVersion, EShLanguage, TInfoSink&, - bool forwardCompatible = false, EShMessages messages = EShMsgDefault, - const TString* entryPoint = nullptr); - virtual ~TParseContext(); - - bool obeyPrecisionQualifiers() const { return precisionManager.respectingPrecisionQualifiers(); } - void setPrecisionDefaults(); - - void setLimits(const TBuiltInResource&) override; - bool parseShaderStrings(TPpContext&, TInputScanner& input, bool versionWillBeError = false) override; - void parserError(const char* s); // for bison's yyerror - - virtual void growGlobalUniformBlock(const TSourceLoc&, TType&, const TString& memberName, TTypeList* typeList = nullptr) override; - virtual void growAtomicCounterBlock(int binding, const TSourceLoc&, TType&, const TString& memberName, TTypeList* typeList = nullptr) override; - - void reservedErrorCheck(const TSourceLoc&, const TString&); - void reservedPpErrorCheck(const TSourceLoc&, const char* name, const char* op) override; - bool lineContinuationCheck(const TSourceLoc&, bool endOfComment) override; - bool lineDirectiveShouldSetNextLine() const override; - bool builtInName(const TString&); - - void handlePragma(const TSourceLoc&, const TVector&) override; - TIntermTyped* handleVariable(const TSourceLoc&, TSymbol* symbol, const TString* string); - TIntermTyped* handleBracketDereference(const TSourceLoc&, TIntermTyped* base, TIntermTyped* index); - void handleIndexLimits(const TSourceLoc&, TIntermTyped* base, TIntermTyped* index); - -#ifndef GLSLANG_WEB - void makeEditable(TSymbol*&) override; - void ioArrayCheck(const TSourceLoc&, const TType&, const TString& identifier); -#endif - bool isIoResizeArray(const TType&) const; - void fixIoArraySize(const TSourceLoc&, TType&); - void handleIoResizeArrayAccess(const TSourceLoc&, TIntermTyped* base); - void checkIoArraysConsistency(const TSourceLoc&, bool tailOnly = false); - int getIoArrayImplicitSize(const TQualifier&, TString* featureString = nullptr) 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); - TIntermTyped* handleDotSwizzle(const TSourceLoc&, TIntermTyped* base, const TString& field); - void blockMemberExtensionCheck(const TSourceLoc&, const TIntermTyped* base, int member, const TString& memberName); - TFunction* handleFunctionDeclarator(const TSourceLoc&, TFunction& function, bool prototype); - TIntermAggregate* handleFunctionDefinition(const TSourceLoc&, TFunction&); - TIntermTyped* handleFunctionCall(const TSourceLoc&, TFunction*, TIntermNode*); - TIntermTyped* handleBuiltInFunctionCall(TSourceLoc, TIntermNode* arguments, const TFunction& function); - void computeBuiltinPrecisions(TIntermTyped&, const TFunction&); - TIntermNode* handleReturnValue(const TSourceLoc&, TIntermTyped*); - void checkLocation(const TSourceLoc&, TOperator); - TIntermTyped* handleLengthMethod(const TSourceLoc&, TFunction*, TIntermNode*); - void addInputArgumentConversions(const TFunction&, TIntermNode*&) const; - TIntermTyped* addOutputArgumentConversions(const TFunction&, TIntermAggregate&) const; - TIntermTyped* addAssign(const TSourceLoc&, TOperator op, TIntermTyped* left, TIntermTyped* right); - void builtInOpCheck(const TSourceLoc&, const TFunction&, TIntermOperator&); - void nonOpBuiltInCheck(const TSourceLoc&, const TFunction&, TIntermAggregate&); - void userFunctionCallCheck(const TSourceLoc&, TIntermAggregate&); - void samplerConstructorLocationCheck(const TSourceLoc&, const char* token, TIntermNode*); - TFunction* handleConstructorCall(const TSourceLoc&, const TPublicType&); - void handlePrecisionQualifier(const TSourceLoc&, TQualifier&, TPrecisionQualifier); - void checkPrecisionQualifier(const TSourceLoc&, TPrecisionQualifier); - void memorySemanticsCheck(const TSourceLoc&, const TFunction&, const TIntermOperator& callNode); - - TIntermTyped* vkRelaxedRemapFunctionCall(const TSourceLoc&, TFunction*, TIntermNode*); - // returns true if the variable was remapped to something else - bool vkRelaxedRemapUniformVariable(const TSourceLoc&, TString&, const TPublicType&, TArraySizes*, TIntermTyped*, TType&); - - 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); - bool lValueErrorCheck(const TSourceLoc&, const char* op, TIntermTyped*) override; - void rValueErrorCheck(const TSourceLoc&, const char* op, TIntermTyped*) override; - 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&, const char *sizeType); - bool arrayQualifierError(const TSourceLoc&, const TQualifier&); - bool arrayError(const TSourceLoc&, const TType&); - void arraySizeRequiredCheck(const TSourceLoc&, const TArraySizes&); - void structArrayCheck(const TSourceLoc&, const TType& structure); - void arraySizesCheck(const TSourceLoc&, const TQualifier&, TArraySizes*, const TIntermTyped* initializer, bool lastMember); - void arrayOfArrayVersionCheck(const TSourceLoc&, const TArraySizes*); - bool voidErrorCheck(const TSourceLoc&, const TString&, TBasicType); - void boolCheck(const TSourceLoc&, const TIntermTyped*); - void boolCheck(const TSourceLoc&, const TPublicType&); - void samplerCheck(const TSourceLoc&, const TType&, const TString& identifier, TIntermTyped* initializer); - void atomicUintCheck(const TSourceLoc&, const TType&, const TString& identifier); - void accStructCheck(const TSourceLoc & loc, const TType & type, const TString & identifier); - void transparentOpaqueCheck(const TSourceLoc&, const TType&, const TString& identifier); - void memberQualifierCheck(glslang::TPublicType&); - void globalQualifierFixCheck(const TSourceLoc&, TQualifier&, bool isMemberCheck = false, const TPublicType* publicType = nullptr); - void globalQualifierTypeCheck(const TSourceLoc&, const TQualifier&, const TPublicType&); - bool structQualifierErrorCheck(const TSourceLoc&, const TPublicType& pType); - void mergeQualifiers(const TSourceLoc&, TQualifier& dst, const TQualifier& src, bool force); - void setDefaultPrecision(const TSourceLoc&, TPublicType&, TPrecisionQualifier); - int computeSamplerTypeIndex(TSampler&); - TPrecisionQualifier getDefaultPrecision(TPublicType&); - void precisionQualifierCheck(const TSourceLoc&, TBasicType, TQualifier&); - void parameterTypeCheck(const TSourceLoc&, TStorageQualifier qualifier, const TType& type); - bool containsFieldWithBasicType(const TType& type ,TBasicType basicType); - TSymbol* redeclareBuiltinVariable(const TSourceLoc&, const TString&, const TQualifier&, const TShaderQualifiers&); - void redeclareBuiltinBlock(const TSourceLoc&, TTypeList& typeList, const TString& blockName, const TString* instanceName, TArraySizes* arraySizes); - void paramCheckFixStorage(const TSourceLoc&, const TStorageQualifier&, TType& type); - void paramCheckFix(const TSourceLoc&, const TQualifier&, TType& type); - void nestedBlockCheck(const TSourceLoc&); - void nestedStructCheck(const TSourceLoc&); - void arrayObjectCheck(const TSourceLoc&, const TType&, const char* op); - void opaqueCheck(const TSourceLoc&, const TType&, const char* op); - void referenceCheck(const TSourceLoc&, const TType&, const char* op); - void storage16BitAssignmentCheck(const TSourceLoc&, const TType&, const char* op); - void specializationCheck(const TSourceLoc&, const TType&, const char* op); - void structTypeCheck(const TSourceLoc&, TPublicType&); - void inductiveLoopCheck(const TSourceLoc&, TIntermNode* init, TIntermLoop* loop); - void arrayLimitCheck(const TSourceLoc&, const TString&, int size); - void limitCheck(const TSourceLoc&, int value, const char* limit, const char* feature); - - void inductiveLoopBodyCheck(TIntermNode*, long long loopIndexId, TSymbolTable&); - void constantIndexExpressionCheck(TIntermNode*); - - void setLayoutQualifier(const TSourceLoc&, TPublicType&, TString&); - void setLayoutQualifier(const TSourceLoc&, TPublicType&, TString&, const TIntermTyped*); - void mergeObjectLayoutQualifiers(TQualifier& dest, const TQualifier& src, bool inheritOnly); - void layoutObjectCheck(const TSourceLoc&, const TSymbol&); - void layoutMemberLocationArrayCheck(const TSourceLoc&, bool memberWithLocation, TArraySizes* arraySizes); - void layoutTypeCheck(const TSourceLoc&, const TType&); - void layoutQualifierCheck(const TSourceLoc&, const TQualifier&); - void checkNoShaderLayouts(const TSourceLoc&, const TShaderQualifiers&); - void fixOffset(const TSourceLoc&, TSymbol&); - - const TFunction* findFunction(const TSourceLoc& loc, const TFunction& call, bool& builtIn); - const TFunction* findFunctionExact(const TSourceLoc& loc, const TFunction& call, bool& builtIn); - const TFunction* findFunction120(const TSourceLoc& loc, const TFunction& call, bool& builtIn); - const TFunction* findFunction400(const TSourceLoc& loc, const TFunction& call, bool& builtIn); - const TFunction* findFunctionExplicitTypes(const TSourceLoc& loc, const TFunction& call, bool& builtIn); - void declareTypeDefaults(const TSourceLoc&, const TPublicType&); - TIntermNode* declareVariable(const TSourceLoc&, TString& identifier, const TPublicType&, TArraySizes* typeArray = nullptr, TIntermTyped* initializer = nullptr); - TIntermTyped* addConstructor(const TSourceLoc&, TIntermNode*, const TType&); - TIntermTyped* constructAggregate(TIntermNode*, const TType&, int, const TSourceLoc&); - TIntermTyped* constructBuiltIn(const TType&, TOperator, TIntermTyped*, const TSourceLoc&, bool subset); - void inheritMemoryQualifiers(const TQualifier& from, TQualifier& to); - void declareBlock(const TSourceLoc&, TTypeList& typeList, const TString* instanceName = nullptr, TArraySizes* arraySizes = nullptr); - void blockStorageRemap(const TSourceLoc&, const TString*, TQualifier&); - void blockStageIoCheck(const TSourceLoc&, const TQualifier&); - void blockQualifierCheck(const TSourceLoc&, const TQualifier&, bool instanceName); - void fixBlockLocations(const TSourceLoc&, TQualifier&, TTypeList&, bool memberWithLocation, bool memberWithoutLocation); - void fixXfbOffsets(TQualifier&, TTypeList&); - void fixBlockUniformOffsets(TQualifier&, TTypeList&); - void fixBlockUniformLayoutMatrix(TQualifier&, TTypeList*, TTypeList*); - void fixBlockUniformLayoutPacking(TQualifier&, TTypeList*, TTypeList*); - void addQualifierToExisting(const TSourceLoc&, TQualifier, const TString& identifier); - void addQualifierToExisting(const TSourceLoc&, TQualifier, TIdentifierList&); - void invariantCheck(const TSourceLoc&, const TQualifier&); - void updateStandaloneQualifierDefaults(const TSourceLoc&, const TPublicType&); - void updateBindlessQualifier(TType& memberType); - void wrapupSwitchSubsequence(TIntermAggregate* statements, TIntermNode* branchNode); - TIntermNode* addSwitch(const TSourceLoc&, TIntermTyped* expression, TIntermAggregate* body); - const TTypeList* recordStructCopy(TStructRecord&, const TType*, const TType*); - TLayoutFormat mapLegacyLayoutFormat(TLayoutFormat legacyLayoutFormat, TBasicType imageType); - -#ifndef GLSLANG_WEB - TAttributeType attributeFromName(const TString& name) const; - TAttributes* makeAttributes(const TString& identifier) const; - TAttributes* makeAttributes(const TString& identifier, TIntermNode* node) const; - TAttributes* mergeAttributes(TAttributes*, TAttributes*) const; - - // Determine selection control from attributes - void handleSelectionAttributes(const TAttributes& attributes, TIntermNode*); - void handleSwitchAttributes(const TAttributes& attributes, TIntermNode*); - // Determine loop control from attributes - void handleLoopAttributes(const TAttributes& attributes, TIntermNode*); - // Function attributes - void handleFunctionAttributes(const TSourceLoc&, const TAttributes&); - - // GL_EXT_spirv_intrinsics - TSpirvRequirement* makeSpirvRequirement(const TSourceLoc& loc, const TString& name, - const TIntermAggregate* extensions, const TIntermAggregate* capabilities); - TSpirvRequirement* mergeSpirvRequirements(const TSourceLoc& loc, TSpirvRequirement* spirvReq1, - TSpirvRequirement* spirvReq2); - TSpirvTypeParameters* makeSpirvTypeParameters(const TSourceLoc& loc, const TIntermConstantUnion* constant); - TSpirvTypeParameters* mergeSpirvTypeParameters(TSpirvTypeParameters* spirvTypeParams1, - TSpirvTypeParameters* spirvTypeParams2); - TSpirvInstruction* makeSpirvInstruction(const TSourceLoc& loc, const TString& name, const TString& value); - TSpirvInstruction* makeSpirvInstruction(const TSourceLoc& loc, const TString& name, int value); - TSpirvInstruction* mergeSpirvInstruction(const TSourceLoc& loc, TSpirvInstruction* spirvInst1, - TSpirvInstruction* spirvInst2); -#endif - - void checkAndResizeMeshViewDim(const TSourceLoc&, TType&, bool isBlockMember); - -protected: - void nonInitConstCheck(const TSourceLoc&, TString& identifier, TType& type); - void inheritGlobalDefaults(TQualifier& dst) const; - TVariable* makeInternalVariable(const char* name, const TType&) const; - TVariable* declareNonArray(const TSourceLoc&, const TString& identifier, const TType&); - void declareArray(const TSourceLoc&, const TString& identifier, const TType&, TSymbol*&); - void checkRuntimeSizable(const TSourceLoc&, const TIntermTyped&); - bool isRuntimeLength(const TIntermTyped&) const; - TIntermNode* executeInitializer(const TSourceLoc&, TIntermTyped* initializer, TVariable* variable); - TIntermTyped* convertInitializerList(const TSourceLoc&, const TType&, TIntermTyped* initializer); -#ifndef GLSLANG_WEB - void finish() override; -#endif - - virtual const char* getGlobalUniformBlockName() const override; - virtual void finalizeGlobalUniformBlockLayout(TVariable&) override; - virtual void setUniformBlockDefaults(TType& block) const override; - - virtual const char* getAtomicCounterBlockName() const override; - virtual void finalizeAtomicCounterBlockLayout(TVariable&) override; - virtual void setAtomicCounterBlockDefaults(TType& block) const override; - virtual void setInvariant(const TSourceLoc& loc, const char* builtin) override; - -public: - // - // Generally, bison productions, the scanner, and the PP need read/write access to these; just give them direct access - // - - // Current state of parsing - bool inMain; // if inside a function, true if the function is main - const TString* blockName; - TQualifier currentBlockQualifier; - TPrecisionQualifier defaultPrecision[EbtNumTypes]; - TBuiltInResource resources; - TLimits& limits; - -protected: - TParseContext(TParseContext&); - TParseContext& operator=(TParseContext&); - - static const int maxSamplerIndex = EsdNumDims * (EbtNumTypes * (2 * 2 * 2 * 2 * 2)); // see computeSamplerTypeIndex() - TPrecisionQualifier defaultSamplerPrecision[maxSamplerIndex]; - TPrecisionManager precisionManager; - TQualifier globalBufferDefaults; - TQualifier globalUniformDefaults; - TQualifier globalInputDefaults; - TQualifier globalOutputDefaults; - TQualifier globalSharedDefaults; - TString currentCaller; // name of last function body entered (not valid when at global scope) -#ifndef GLSLANG_WEB - int* atomicUintOffsets; // to become an array of the right size to hold an offset per binding point - bool anyIndexLimits; - TIdSetType inductiveLoopIds; - TVector needsIndexLimitationChecking; - TStructRecord matrixFixRecord; - TStructRecord packingFixRecord; - - // - // 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; -#endif -}; - -} // end namespace glslang - -#endif // _PARSER_HELPER_INCLUDED_ diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/RemoveTree.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/RemoveTree.h deleted file mode 100644 index 1ed0156..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/RemoveTree.h +++ /dev/null @@ -1,41 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// 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. -// - -#pragma once - -namespace glslang { - -void RemoveAllTreeNodes(TIntermNode*); - -} // end namespace glslang diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/Scan.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/Scan.h deleted file mode 100644 index 24b75cf..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/Scan.h +++ /dev/null @@ -1,276 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2013 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 _GLSLANG_SCAN_INCLUDED_ -#define _GLSLANG_SCAN_INCLUDED_ - -#include "Versions.h" - -namespace glslang { - -// Use a global end-of-input character, so no translation is needed across -// layers of encapsulation. Characters are all 8 bit, and positive, so there is -// no aliasing of character 255 onto -1, for example. -const int EndOfInput = -1; - -// -// A character scanner that seamlessly, on read-only strings, reads across an -// array of strings without assuming null termination. -// -class TInputScanner { -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), - // up to this point, common usage is "char*", but now we need positive 8-bit characters - sources(reinterpret_cast(s)), - 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) { - loc[i].init(i - stringBias); - } - if (names != nullptr) { - for (int i = 0; i < numSources; ++i) - loc[i].name = names[i] != nullptr ? NewPoolTString(names[i]) : nullptr; - } - loc[currentSource].line = 1; - logicalSourceLoc.init(1); - logicalSourceLoc.name = loc[0].name; - } - - virtual ~TInputScanner() - { - delete [] loc; - } - - // retrieve the next character and advance one character - int get() - { - int ret = peek(); - if (ret == EndOfInput) - return ret; - ++loc[currentSource].column; - ++logicalSourceLoc.column; - if (ret == '\n') { - ++loc[currentSource].line; - ++logicalSourceLoc.line; - logicalSourceLoc.column = 0; - loc[currentSource].column = 0; - } - advance(); - - return ret; - } - - // retrieve the next character, no advance - int peek() - { - 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; - size_t charToRead = currentChar; - while(charToRead >= lengths[sourceToRead]) { - charToRead = 0; - sourceToRead += 1; - if (sourceToRead >= numSources) { - return EndOfInput; - } - } - - // Here, we care about making negative valued characters positive - return sources[sourceToRead][charToRead]; - } - - // go back one character - void unget() - { - // Do not roll back once we've reached the end of the file. - if (endOfFileReached) - return; - - if (currentChar > 0) { - --currentChar; - --loc[currentSource].column; - --logicalSourceLoc.column; - if (loc[currentSource].column < 0) { - // We've moved back past a new line. Find the - // previous newline (or start of the file) to compute - // the column count on the now current line. - size_t chIndex = currentChar; - while (chIndex > 0) { - if (sources[currentSource][chIndex] == '\n') { - break; - } - --chIndex; - } - logicalSourceLoc.column = (int)(currentChar - chIndex); - loc[currentSource].column = (int)(currentChar - chIndex); - } - } else { - do { - --currentSource; - } while (currentSource > 0 && lengths[currentSource] == 0); - if (lengths[currentSource] == 0) { - // set to 0 if we've backed up to the start of an empty string - currentChar = 0; - } else - currentChar = lengths[currentSource] - 1; - } - if (peek() == '\n') { - --loc[currentSource].line; - --logicalSourceLoc.line; - } - } - - // for #line override - void setLine(int newLine) - { - logicalSourceLoc.line = newLine; - loc[getLastValidSourceIndex()].line = newLine; - } - - // for #line override in filename based parsing - void setFile(const char* filename) - { - TString* fn_tstr = NewPoolTString(filename); - logicalSourceLoc.name = fn_tstr; - loc[getLastValidSourceIndex()].name = fn_tstr; - } - - void setFile(const char* filename, int i) - { - TString* fn_tstr = NewPoolTString(filename); - if (i == getLastValidSourceIndex()) { - logicalSourceLoc.name = fn_tstr; - } - loc[i].name = fn_tstr; - } - - void setString(int newString) - { - logicalSourceLoc.string = newString; - loc[getLastValidSourceIndex()].string = newString; - logicalSourceLoc.name = nullptr; - loc[getLastValidSourceIndex()].name = nullptr; - } - - // for #include content indentation - void setColumn(int col) - { - logicalSourceLoc.column = col; - loc[getLastValidSourceIndex()].column = col; - } - - void setEndOfInput() - { - endOfFileReached = true; - currentSource = numSources; - } - - bool atEndOfInput() const { return endOfFileReached; } - - const TSourceLoc& getSourceLoc() const - { - if (singleLogical) { - return logicalSourceLoc; - } else { - return loc[std::max(0, std::min(currentSource, numSources - finale - 1))]; - } - } - // Returns the index (starting from 0) of the most recent valid source string we are reading from. - int getLastValidSourceIndex() const { return std::min(currentSource, numSources - 1); } - - void consumeWhiteSpace(bool& foundNonSpaceTab); - bool consumeComment(); - void consumeWhitespaceComment(bool& foundNonSpaceTab); - bool scanVersion(int& version, EProfile& profile, bool& notFirstToken); - -protected: - - // advance one character - void advance() - { - ++currentChar; - if (currentChar >= lengths[currentSource]) { - ++currentSource; - if (currentSource < numSources) { - loc[currentSource].string = loc[currentSource - 1].string + 1; - loc[currentSource].line = 1; - loc[currentSource].column = 0; - } - while (currentSource < numSources && lengths[currentSource] == 0) { - ++currentSource; - if (currentSource < numSources) { - loc[currentSource].string = loc[currentSource - 1].string + 1; - loc[currentSource].line = 1; - loc[currentSource].column = 0; - } - } - currentChar = 0; - } - } - - int numSources; // number of strings in source - const unsigned char* const *sources; // array of strings; must be converted to positive values on use, to avoid aliasing with -1 as EndOfInput - const size_t *lengths; // length of each string - int currentSource; - size_t currentChar; - - // This is for reporting what string/line an error occurred on, and can be overridden by #line. - // It remembers the last state of each source string as it is left for the next one, so unget() - // can restore that state. - TSourceLoc* loc; // an array - - int stringBias; // the first string that is the user's string number 0 - int finale; // number of internal strings after user's last string - - TSourceLoc logicalSourceLoc; - bool singleLogical; // treats the strings as a single logical string. - // locations will be reported from the first string. - - // Set to true once peek() returns EndOfFile, so that we won't roll back - // once we've reached EndOfFile. - bool endOfFileReached; -}; - -} // end namespace glslang - -#endif // _GLSLANG_SCAN_INCLUDED_ diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/ScanContext.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/ScanContext.h deleted file mode 100644 index 74b2b3c..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/ScanContext.h +++ /dev/null @@ -1,93 +0,0 @@ -// -// Copyright (C) 2013 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. -// - -// -// This holds context specific to the GLSL scanner, which -// sits between the preprocessor scanner and parser. -// - -#pragma once - -#include "ParseHelper.h" - -namespace glslang { - -class TPpContext; -class TPpToken; -class TParserToken; - -class TScanContext { -public: - explicit TScanContext(TParseContextBase& pc) : - parseContext(pc), - afterType(false), afterStruct(false), - field(false), afterBuffer(false) { } - virtual ~TScanContext() { } - - static void fillInKeywordMap(); - static void deleteKeywordMap(); - - int tokenize(TPpContext*, TParserToken&); - -protected: - TScanContext(TScanContext&); - TScanContext& operator=(TScanContext&); - - int tokenizeIdentifier(); - int identifierOrType(); - int reservedWord(); - int identifierOrReserved(bool reserved); - int es30ReservedFromGLSL(int version); - int nonreservedKeyword(int esVersion, int nonEsVersion); - int precisionKeyword(); - int matNxM(); - int dMat(); - int firstGenerationImage(bool inEs310); - int secondGenerationImage(); - - TParseContextBase& parseContext; - bool afterType; // true if we've recognized a type, so can only be looking for an identifier - bool afterStruct; // true if we've recognized the STRUCT keyword, so can only be looking for an identifier - bool field; // true if we're on a field, right after a '.' - bool afterBuffer; // true if we've recognized the BUFFER keyword - TSourceLoc loc; - TParserToken* parserToken; - TPpToken* ppToken; - - const char* tokenText; - int keyword; -}; - -} // end namespace glslang diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/SymbolTable.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/SymbolTable.h deleted file mode 100644 index c2b386e..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/SymbolTable.h +++ /dev/null @@ -1,957 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2013 LunarG, Inc. -// Copyright (C) 2015-2018 Google, Inc. -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// -// Neither the name of 3Dlabs Inc. Ltd. nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// - -#ifndef _SYMBOL_TABLE_INCLUDED_ -#define _SYMBOL_TABLE_INCLUDED_ - -// -// Symbol table for parsing. Has these design characteristics: -// -// * Same symbol table can be used to compile many shaders, to preserve -// effort of creating and loading with the large numbers of built-in -// symbols. -// -// --> This requires a copy mechanism, so initial pools used to create -// the shared information can be popped. Done through "clone" -// methods. -// -// * Name mangling will be used to give each function a unique name -// so that symbol table lookups are never ambiguous. This allows -// a simpler symbol table structure. -// -// * Pushing and popping of scope, so symbol table will really be a stack -// of symbol tables. Searched from the top, with new inserts going into -// the top. -// -// * Constants: Compile time constant symbols will keep their values -// in the symbol table. The parser can substitute constants at parse -// time, including doing constant folding and constant propagation. -// -// * No temporaries: Temporaries made from operations (+, --, .xy, etc.) -// are tracked in the intermediate representation, not the symbol table. -// - -#include "../Include/Common.h" -#include "../Include/intermediate.h" -#include "../Include/InfoSink.h" - -namespace glslang { - -// -// Symbol base class. (Can build functions or variables out of these...) -// - -class TVariable; -class TFunction; -class TAnonMember; - -typedef TVector TExtensionList; - -class TSymbol { -public: - POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) - explicit TSymbol(const TString *n) : name(n), uniqueId(0), extensions(nullptr), writable(true) { } - virtual TSymbol* clone() const = 0; - virtual ~TSymbol() { } // rely on all symbol owned memory coming from the pool - - virtual const TString& getName() const { return *name; } - virtual void changeName(const TString* newName) { name = newName; } - virtual void addPrefix(const char* prefix) - { - TString newName(prefix); - newName.append(*name); - changeName(NewPoolTString(newName.c_str())); - } - virtual const TString& getMangledName() const { return getName(); } - virtual TFunction* getAsFunction() { return nullptr; } - virtual const TFunction* getAsFunction() const { return nullptr; } - virtual TVariable* getAsVariable() { return nullptr; } - virtual const TVariable* getAsVariable() const { return nullptr; } - virtual const TAnonMember* getAsAnonMember() const { return nullptr; } - virtual const TType& getType() const = 0; - virtual TType& getWritableType() = 0; - virtual void setUniqueId(long long id) { uniqueId = id; } - virtual long long getUniqueId() const { return uniqueId; } - virtual void setExtensions(int numExts, const char* const exts[]) - { - assert(extensions == nullptr); - assert(numExts > 0); - extensions = NewPoolObject(extensions); - for (int e = 0; e < numExts; ++e) - extensions->push_back(exts[e]); - } - virtual int getNumExtensions() const { return extensions == nullptr ? 0 : (int)extensions->size(); } - virtual const char** getExtensions() const { return extensions->data(); } - -#if !defined(GLSLANG_WEB) - virtual void dump(TInfoSink& infoSink, bool complete = false) const = 0; - void dumpExtensions(TInfoSink& infoSink) const; -#endif - - virtual bool isReadOnly() const { return ! writable; } - virtual void makeReadOnly() { writable = false; } - -protected: - explicit TSymbol(const TSymbol&); - TSymbol& operator=(const TSymbol&); - - const TString *name; - unsigned long long uniqueId; // For cross-scope comparing during code generation - - // For tracking what extensions must be present - // (don't use if correct version/profile is present). - TExtensionList* extensions; // an array of pointers to existing constant char strings - - // - // N.B.: Non-const functions that will be generally used should assert on this, - // to avoid overwriting shared symbol-table information. - // - bool writable; -}; - -// -// Variable class, meaning a symbol that's not a function. -// -// There could be a separate class hierarchy for Constant variables; -// Only one of int, bool, or float, (or none) is correct for -// any particular use, but it's easy to do this way, and doesn't -// seem worth having separate classes, and "getConst" can't simply return -// different values for different types polymorphically, so this is -// just simple and pragmatic. -// -class TVariable : public TSymbol { -public: - TVariable(const TString *name, const TType& t, bool uT = false ) - : TSymbol(name), - userType(uT), - constSubtree(nullptr), - memberExtensions(nullptr), - anonId(-1) - { type.shallowCopy(t); } - virtual TVariable* clone() const; - virtual ~TVariable() { } - - virtual TVariable* getAsVariable() { return this; } - virtual const TVariable* getAsVariable() const { return this; } - virtual const TType& getType() const { return type; } - virtual TType& getWritableType() { assert(writable); return type; } - virtual bool isUserType() const { return userType; } - virtual const TConstUnionArray& getConstArray() const { return constArray; } - virtual TConstUnionArray& getWritableConstArray() { assert(writable); return constArray; } - virtual void setConstArray(const TConstUnionArray& array) { constArray = array; } - virtual void setConstSubtree(TIntermTyped* subtree) { constSubtree = subtree; } - virtual TIntermTyped* getConstSubtree() const { return constSubtree; } - virtual void setAnonId(int i) { anonId = i; } - virtual int getAnonId() const { return anonId; } - - virtual void setMemberExtensions(int member, int numExts, const char* const exts[]) - { - assert(type.isStruct()); - assert(numExts > 0); - if (memberExtensions == nullptr) { - memberExtensions = NewPoolObject(memberExtensions); - memberExtensions->resize(type.getStruct()->size()); - } - for (int e = 0; e < numExts; ++e) - (*memberExtensions)[member].push_back(exts[e]); - } - virtual bool hasMemberExtensions() const { return memberExtensions != nullptr; } - virtual int getNumMemberExtensions(int member) const - { - return memberExtensions == nullptr ? 0 : (int)(*memberExtensions)[member].size(); - } - virtual const char** getMemberExtensions(int member) const { return (*memberExtensions)[member].data(); } - -#if !defined(GLSLANG_WEB) - virtual void dump(TInfoSink& infoSink, bool complete = false) const; -#endif - -protected: - explicit TVariable(const TVariable&); - TVariable& operator=(const TVariable&); - - TType type; - bool userType; - - // we are assuming that Pool Allocator will free the memory allocated to unionArray - // when this object is destroyed - - TConstUnionArray constArray; // for compile-time constant value - TIntermTyped* constSubtree; // for specialization constant computation - TVector* memberExtensions; // per-member extension list, allocated only when needed - int anonId; // the ID used for anonymous blocks: TODO: see if uniqueId could serve a dual purpose -}; - -// -// The function sub-class of symbols and the parser will need to -// share this definition of a function parameter. -// -struct TParameter { - TString *name; - TType* type; - TIntermTyped* defaultValue; - TParameter& copyParam(const TParameter& param) - { - if (param.name) - name = NewPoolTString(param.name->c_str()); - else - name = nullptr; - type = param.type->clone(); - defaultValue = param.defaultValue; - return *this; - } - TBuiltInVariable getDeclaredBuiltIn() const { return type->getQualifier().declaredBuiltIn; } -}; - -// -// The function sub-class of a symbol. -// -class TFunction : public TSymbol { -public: - explicit TFunction(TOperator o) : - TSymbol(nullptr), - op(o), - defined(false), prototyped(false), implicitThis(false), illegalImplicitThis(false), defaultParamCount(0) { } - TFunction(const TString *name, const TType& retType, TOperator tOp = EOpNull) : - TSymbol(name), - mangledName(*name + '('), - op(tOp), - defined(false), prototyped(false), implicitThis(false), illegalImplicitThis(false), defaultParamCount(0) - { - returnType.shallowCopy(retType); - declaredBuiltIn = retType.getQualifier().builtIn; - } - virtual TFunction* clone() const override; - virtual ~TFunction(); - - virtual TFunction* getAsFunction() override { return this; } - virtual const TFunction* getAsFunction() const override { return this; } - - // Install 'p' as the (non-'this') last parameter. - // Non-'this' parameters are reflected in both the list of parameters and the - // mangled name. - virtual void addParameter(TParameter& p) - { - assert(writable); - parameters.push_back(p); - p.type->appendMangledName(mangledName); - - if (p.defaultValue != nullptr) - defaultParamCount++; - } - - // Install 'this' as the first parameter. - // 'this' is reflected in the list of parameters, but not the mangled name. - virtual void addThisParameter(TType& type, const char* name) - { - TParameter p = { NewPoolTString(name), new TType, nullptr }; - p.type->shallowCopy(type); - parameters.insert(parameters.begin(), p); - } - - virtual void addPrefix(const char* prefix) override - { - TSymbol::addPrefix(prefix); - mangledName.insert(0, prefix); - } - - virtual void removePrefix(const TString& prefix) - { - assert(mangledName.compare(0, prefix.size(), prefix) == 0); - mangledName.erase(0, prefix.size()); - } - - virtual const TString& getMangledName() const override { return mangledName; } - virtual const TType& getType() const override { return returnType; } - virtual TBuiltInVariable getDeclaredBuiltInType() const { return declaredBuiltIn; } - virtual TType& getWritableType() override { return returnType; } - virtual void relateToOperator(TOperator o) { assert(writable); op = o; } - virtual TOperator getBuiltInOp() const { return op; } - virtual void setDefined() { assert(writable); defined = true; } - virtual bool isDefined() const { return defined; } - virtual void setPrototyped() { assert(writable); prototyped = true; } - virtual bool isPrototyped() const { return prototyped; } - virtual void setImplicitThis() { assert(writable); implicitThis = true; } - virtual bool hasImplicitThis() const { return implicitThis; } - virtual void setIllegalImplicitThis() { assert(writable); illegalImplicitThis = true; } - virtual bool hasIllegalImplicitThis() const { return illegalImplicitThis; } - - // Return total number of parameters - virtual int getParamCount() const { return static_cast(parameters.size()); } - // Return number of parameters with default values. - virtual int getDefaultParamCount() const { return defaultParamCount; } - // Return number of fixed parameters (without default values) - virtual int getFixedParamCount() const { return getParamCount() - getDefaultParamCount(); } - - virtual TParameter& operator[](int i) { assert(writable); return parameters[i]; } - virtual const TParameter& operator[](int i) const { return parameters[i]; } - const TQualifier& getQualifier() const { return returnType.getQualifier(); } - -#ifndef GLSLANG_WEB - virtual void setSpirvInstruction(const TSpirvInstruction& inst) - { - relateToOperator(EOpSpirvInst); - spirvInst = inst; - } - virtual const TSpirvInstruction& getSpirvInstruction() const { return spirvInst; } -#endif - -#if !defined(GLSLANG_WEB) - virtual void dump(TInfoSink& infoSink, bool complete = false) const override; -#endif - -protected: - explicit TFunction(const TFunction&); - TFunction& operator=(const TFunction&); - - typedef TVector TParamList; - TParamList parameters; - TType returnType; - TBuiltInVariable declaredBuiltIn; - - TString mangledName; - TOperator op; - bool defined; - bool prototyped; - bool implicitThis; // True if this function is allowed to see all members of 'this' - bool illegalImplicitThis; // True if this function is not supposed to have access to dynamic members of 'this', - // even if it finds member variables in the symbol table. - // This is important for a static member function that has member variables in scope, - // but is not allowed to use them, or see hidden symbols instead. - int defaultParamCount; - -#ifndef GLSLANG_WEB - TSpirvInstruction spirvInst; // SPIR-V instruction qualifiers -#endif -}; - -// -// Members of anonymous blocks are a kind of TSymbol. They are not hidden in -// the symbol table behind a container; rather they are visible and point to -// their anonymous container. (The anonymous container is found through the -// member, not the other way around.) -// -class TAnonMember : public TSymbol { -public: - TAnonMember(const TString* n, unsigned int m, TVariable& a, int an) : TSymbol(n), anonContainer(a), memberNumber(m), anonId(an) { } - virtual TAnonMember* clone() const override; - virtual ~TAnonMember() { } - - virtual const TAnonMember* getAsAnonMember() const override { return this; } - virtual const TVariable& getAnonContainer() const { return anonContainer; } - virtual unsigned int getMemberNumber() const { return memberNumber; } - - virtual const TType& getType() const override - { - const TTypeList& types = *anonContainer.getType().getStruct(); - return *types[memberNumber].type; - } - - virtual TType& getWritableType() override - { - assert(writable); - const TTypeList& types = *anonContainer.getType().getStruct(); - return *types[memberNumber].type; - } - - virtual void setExtensions(int numExts, const char* const exts[]) override - { - anonContainer.setMemberExtensions(memberNumber, numExts, exts); - } - virtual int getNumExtensions() const override { return anonContainer.getNumMemberExtensions(memberNumber); } - virtual const char** getExtensions() const override { return anonContainer.getMemberExtensions(memberNumber); } - - virtual int getAnonId() const { return anonId; } -#if !defined(GLSLANG_WEB) - virtual void dump(TInfoSink& infoSink, bool complete = false) const override; -#endif - -protected: - explicit TAnonMember(const TAnonMember&); - TAnonMember& operator=(const TAnonMember&); - - TVariable& anonContainer; - unsigned int memberNumber; - int anonId; -}; - -class TSymbolTableLevel { -public: - POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) - TSymbolTableLevel() : defaultPrecision(nullptr), anonId(0), thisLevel(false) { } - ~TSymbolTableLevel(); - - bool insert(const TString& name, TSymbol* symbol) { - return level.insert(tLevelPair(name, symbol)).second; - } - - bool insert(TSymbol& symbol, bool separateNameSpaces, const TString& forcedKeyName = TString()) - { - // - // returning true means symbol was added to the table with no semantic errors - // - const TString& name = symbol.getName(); - if (forcedKeyName.length()) { - return level.insert(tLevelPair(forcedKeyName, &symbol)).second; - } - else if (name == "") { - symbol.getAsVariable()->setAnonId(anonId++); - // An empty name means an anonymous container, exposing its members to the external scope. - // Give it a name and insert its members in the symbol table, pointing to the container. - char buf[20]; - snprintf(buf, 20, "%s%d", AnonymousPrefix, symbol.getAsVariable()->getAnonId()); - symbol.changeName(NewPoolTString(buf)); - - return insertAnonymousMembers(symbol, 0); - } else { - // Check for redefinition errors: - // - STL itself will tell us if there is a direct name collision, with name mangling, at this level - // - additionally, check for function-redefining-variable name collisions - const TString& insertName = symbol.getMangledName(); - if (symbol.getAsFunction()) { - // make sure there isn't a variable of this name - if (! separateNameSpaces && level.find(name) != level.end()) - return false; - - // insert, and whatever happens is okay - level.insert(tLevelPair(insertName, &symbol)); - - return true; - } else - return level.insert(tLevelPair(insertName, &symbol)).second; - } - } - - // Add more members to an already inserted aggregate object - bool amend(TSymbol& symbol, int firstNewMember) - { - // See insert() for comments on basic explanation of insert. - // This operates similarly, but more simply. - // Only supporting amend of anonymous blocks so far. - if (IsAnonymous(symbol.getName())) - return insertAnonymousMembers(symbol, firstNewMember); - else - return false; - } - - bool insertAnonymousMembers(TSymbol& symbol, int firstMember) - { - const TTypeList& types = *symbol.getAsVariable()->getType().getStruct(); - for (unsigned int m = firstMember; m < types.size(); ++m) { - TAnonMember* member = new TAnonMember(&types[m].type->getFieldName(), m, *symbol.getAsVariable(), symbol.getAsVariable()->getAnonId()); - if (! level.insert(tLevelPair(member->getMangledName(), member)).second) - return false; - } - - return true; - } - - void retargetSymbol(const TString& from, const TString& to) { - tLevel::const_iterator fromIt = level.find(from); - tLevel::const_iterator toIt = level.find(to); - if (fromIt == level.end() || toIt == level.end()) - return; - delete fromIt->second; - level[from] = toIt->second; - retargetedSymbols.push_back({from, to}); - } - - TSymbol* find(const TString& name) const - { - tLevel::const_iterator it = level.find(name); - if (it == level.end()) - return nullptr; - else - return (*it).second; - } - - void findFunctionNameList(const TString& name, TVector& list) - { - size_t parenAt = name.find_first_of('('); - TString base(name, 0, parenAt + 1); - - tLevel::const_iterator begin = level.lower_bound(base); - base[parenAt] = ')'; // assume ')' is lexically after '(' - tLevel::const_iterator end = level.upper_bound(base); - for (tLevel::const_iterator it = begin; it != end; ++it) - list.push_back(it->second->getAsFunction()); - } - - // See if there is already a function in the table having the given non-function-style name. - bool hasFunctionName(const TString& name) const - { - tLevel::const_iterator candidate = level.lower_bound(name); - if (candidate != level.end()) { - const TString& candidateName = (*candidate).first; - TString::size_type parenAt = candidateName.find_first_of('('); - if (parenAt != candidateName.npos && candidateName.compare(0, parenAt, name) == 0) - - return true; - } - - return false; - } - - // See if there is a variable at this level having the given non-function-style name. - // Return true if name is found, and set variable to true if the name was a variable. - bool findFunctionVariableName(const TString& name, bool& variable) const - { - tLevel::const_iterator candidate = level.lower_bound(name); - if (candidate != level.end()) { - const TString& candidateName = (*candidate).first; - TString::size_type parenAt = candidateName.find_first_of('('); - if (parenAt == candidateName.npos) { - // not a mangled name - if (candidateName == name) { - // found a variable name match - variable = true; - return true; - } - } else { - // a mangled name - if (candidateName.compare(0, parenAt, name) == 0) { - // found a function name match - variable = false; - return true; - } - } - } - - return false; - } - - // Use this to do a lazy 'push' of precision defaults the first time - // a precision statement is seen in a new scope. Leave it at 0 for - // when no push was needed. Thus, it is not the current defaults, - // it is what to restore the defaults to when popping a level. - void setPreviousDefaultPrecisions(const TPrecisionQualifier *p) - { - // can call multiple times at one scope, will only latch on first call, - // as we're tracking the previous scope's values, not the current values - if (defaultPrecision != nullptr) - return; - - defaultPrecision = new TPrecisionQualifier[EbtNumTypes]; - for (int t = 0; t < EbtNumTypes; ++t) - defaultPrecision[t] = p[t]; - } - - void getPreviousDefaultPrecisions(TPrecisionQualifier *p) - { - // can be called for table level pops that didn't set the - // defaults - if (defaultPrecision == nullptr || p == nullptr) - return; - - for (int t = 0; t < EbtNumTypes; ++t) - p[t] = defaultPrecision[t]; - } - - void relateToOperator(const char* name, TOperator op); - void setFunctionExtensions(const char* name, int num, const char* const extensions[]); -#if !defined(GLSLANG_WEB) - void dump(TInfoSink& infoSink, bool complete = false) const; -#endif - TSymbolTableLevel* clone() const; - void readOnly(); - - void setThisLevel() { thisLevel = true; } - bool isThisLevel() const { return thisLevel; } - -protected: - explicit TSymbolTableLevel(TSymbolTableLevel&); - TSymbolTableLevel& operator=(TSymbolTableLevel&); - - typedef std::map, pool_allocator > > tLevel; - typedef const tLevel::value_type tLevelPair; - typedef std::pair tInsertResult; - - tLevel level; // named mappings - TPrecisionQualifier *defaultPrecision; - // pair - TVector> retargetedSymbols; - int anonId; - bool thisLevel; // True if this level of the symbol table is a structure scope containing member function - // that are supposed to see anonymous access to member variables. -}; - -class TSymbolTable { -public: - TSymbolTable() : uniqueId(0), noBuiltInRedeclarations(false), separateNameSpaces(false), adoptedLevels(0) - { - // - // This symbol table cannot be used until push() is called. - // - } - ~TSymbolTable() - { - // this can be called explicitly; safest to code it so it can be called multiple times - - // don't deallocate levels passed in from elsewhere - while (table.size() > adoptedLevels) - pop(nullptr); - } - - void adoptLevels(TSymbolTable& symTable) - { - for (unsigned int level = 0; level < symTable.table.size(); ++level) { - table.push_back(symTable.table[level]); - ++adoptedLevels; - } - uniqueId = symTable.uniqueId; - noBuiltInRedeclarations = symTable.noBuiltInRedeclarations; - separateNameSpaces = symTable.separateNameSpaces; - } - - // - // While level adopting is generic, the methods below enact a the following - // convention for levels: - // 0: common built-ins shared across all stages, all compiles, only one copy for all symbol tables - // 1: per-stage built-ins, shared across all compiles, but a different copy per stage - // 2: built-ins specific to a compile, like resources that are context-dependent, or redeclared built-ins - // 3: user-shader globals - // -protected: - static const uint32_t LevelFlagBitOffset = 56; - static const int globalLevel = 3; - static bool isSharedLevel(int level) { return level <= 1; } // exclude all per-compile levels - static bool isBuiltInLevel(int level) { return level <= 2; } // exclude user globals - static bool isGlobalLevel(int level) { return level <= globalLevel; } // include user globals -public: - bool isEmpty() { return table.size() == 0; } - bool atBuiltInLevel() { return isBuiltInLevel(currentLevel()); } - bool atGlobalLevel() { return isGlobalLevel(currentLevel()); } - static bool isBuiltInSymbol(long long uniqueId) { - int level = static_cast(uniqueId >> LevelFlagBitOffset); - return isBuiltInLevel(level); - } - static constexpr uint64_t uniqueIdMask = (1LL << LevelFlagBitOffset) - 1; - static const uint32_t MaxLevelInUniqueID = 127; - void setNoBuiltInRedeclarations() { noBuiltInRedeclarations = true; } - void setSeparateNameSpaces() { separateNameSpaces = true; } - - void push() - { - table.push_back(new TSymbolTableLevel); - updateUniqueIdLevelFlag(); - } - - // Make a new symbol-table level to represent the scope introduced by a structure - // containing member functions, such that the member functions can find anonymous - // references to member variables. - // - // 'thisSymbol' should have a name of "" to trigger anonymous structure-member - // symbol finds. - void pushThis(TSymbol& thisSymbol) - { - assert(thisSymbol.getName().size() == 0); - table.push_back(new TSymbolTableLevel); - updateUniqueIdLevelFlag(); - table.back()->setThisLevel(); - insert(thisSymbol); - } - - void pop(TPrecisionQualifier *p) - { - table[currentLevel()]->getPreviousDefaultPrecisions(p); - delete table.back(); - table.pop_back(); - updateUniqueIdLevelFlag(); - } - - // - // Insert a visible symbol into the symbol table so it can - // be found later by name. - // - // Returns false if the was a name collision. - // - bool insert(TSymbol& symbol) - { - symbol.setUniqueId(++uniqueId); - - // make sure there isn't a function of this variable name - if (! separateNameSpaces && ! symbol.getAsFunction() && table[currentLevel()]->hasFunctionName(symbol.getName())) - return false; - - // check for not overloading or redefining a built-in function - if (noBuiltInRedeclarations) { - if (atGlobalLevel() && currentLevel() > 0) { - if (table[0]->hasFunctionName(symbol.getName())) - return false; - if (currentLevel() > 1 && table[1]->hasFunctionName(symbol.getName())) - return false; - } - } - - return table[currentLevel()]->insert(symbol, separateNameSpaces); - } - - // Add more members to an already inserted aggregate object - bool amend(TSymbol& symbol, int firstNewMember) - { - // See insert() for comments on basic explanation of insert. - // This operates similarly, but more simply. - return table[currentLevel()]->amend(symbol, firstNewMember); - } - - // Update the level info in symbol's unique ID to current level - void amendSymbolIdLevel(TSymbol& symbol) - { - // clamp level to avoid overflow - uint64_t level = (uint32_t)currentLevel() > MaxLevelInUniqueID ? MaxLevelInUniqueID : currentLevel(); - uint64_t symbolId = symbol.getUniqueId(); - symbolId &= uniqueIdMask; - symbolId |= (level << LevelFlagBitOffset); - symbol.setUniqueId(symbolId); - } - // - // To allocate an internal temporary, which will need to be uniquely - // identified by the consumer of the AST, but never need to - // found by doing a symbol table search by name, hence allowed an - // arbitrary name in the symbol with no worry of collision. - // - void makeInternalVariable(TSymbol& symbol) - { - symbol.setUniqueId(++uniqueId); - } - - // - // Copy a variable or anonymous member's structure from a shared level so that - // it can be added (soon after return) to the symbol table where it can be - // modified without impacting other users of the shared table. - // - TSymbol* copyUpDeferredInsert(TSymbol* shared) - { - if (shared->getAsVariable()) { - TSymbol* copy = shared->clone(); - copy->setUniqueId(shared->getUniqueId()); - return copy; - } else { - const TAnonMember* anon = shared->getAsAnonMember(); - assert(anon); - TVariable* container = anon->getAnonContainer().clone(); - container->changeName(NewPoolTString("")); - container->setUniqueId(anon->getAnonContainer().getUniqueId()); - return container; - } - } - - TSymbol* copyUp(TSymbol* shared) - { - TSymbol* copy = copyUpDeferredInsert(shared); - table[globalLevel]->insert(*copy, separateNameSpaces); - if (shared->getAsVariable()) - return copy; - else { - // return the copy of the anonymous member - return table[globalLevel]->find(shared->getName()); - } - } - - // Normal find of a symbol, that can optionally say whether the symbol was found - // at a built-in level or the current top-scope level. - TSymbol* find(const TString& name, bool* builtIn = nullptr, bool* currentScope = nullptr, int* thisDepthP = nullptr) - { - int level = currentLevel(); - TSymbol* symbol; - int thisDepth = 0; - do { - if (table[level]->isThisLevel()) - ++thisDepth; - symbol = table[level]->find(name); - --level; - } while (symbol == nullptr && level >= 0); - level++; - if (builtIn) - *builtIn = isBuiltInLevel(level); - if (currentScope) - *currentScope = isGlobalLevel(currentLevel()) || level == currentLevel(); // consider shared levels as "current scope" WRT user globals - if (thisDepthP != nullptr) { - if (! table[level]->isThisLevel()) - thisDepth = 0; - *thisDepthP = thisDepth; - } - - return symbol; - } - - void retargetSymbol(const TString& from, const TString& to) { - int level = currentLevel(); - table[level]->retargetSymbol(from, to); - } - - - // Find of a symbol that returns how many layers deep of nested - // structures-with-member-functions ('this' scopes) deep the symbol was - // found in. - TSymbol* find(const TString& name, int& thisDepth) - { - int level = currentLevel(); - TSymbol* symbol; - thisDepth = 0; - do { - if (table[level]->isThisLevel()) - ++thisDepth; - symbol = table[level]->find(name); - --level; - } while (symbol == nullptr && level >= 0); - - if (! table[level + 1]->isThisLevel()) - thisDepth = 0; - - return symbol; - } - - bool isFunctionNameVariable(const TString& name) const - { - if (separateNameSpaces) - return false; - - int level = currentLevel(); - do { - bool variable; - bool found = table[level]->findFunctionVariableName(name, variable); - if (found) - return variable; - --level; - } while (level >= 0); - - return false; - } - - void findFunctionNameList(const TString& name, TVector& list, bool& builtIn) - { - // For user levels, return the set found in the first scope with a match - builtIn = false; - int level = currentLevel(); - do { - table[level]->findFunctionNameList(name, list); - --level; - } while (list.empty() && level >= globalLevel); - - if (! list.empty()) - return; - - // Gather across all built-in levels; they don't hide each other - builtIn = true; - do { - table[level]->findFunctionNameList(name, list); - --level; - } while (level >= 0); - } - - void relateToOperator(const char* name, TOperator op) - { - for (unsigned int level = 0; level < table.size(); ++level) - table[level]->relateToOperator(name, op); - } - - void setFunctionExtensions(const char* name, int num, const char* const extensions[]) - { - for (unsigned int level = 0; level < table.size(); ++level) - table[level]->setFunctionExtensions(name, num, extensions); - } - - void setVariableExtensions(const char* name, int numExts, const char* const extensions[]) - { - TSymbol* symbol = find(TString(name)); - if (symbol == nullptr) - return; - - symbol->setExtensions(numExts, extensions); - } - - void setVariableExtensions(const char* blockName, const char* name, int numExts, const char* const extensions[]) - { - TSymbol* symbol = find(TString(blockName)); - if (symbol == nullptr) - return; - TVariable* variable = symbol->getAsVariable(); - assert(variable != nullptr); - - const TTypeList& structure = *variable->getAsVariable()->getType().getStruct(); - for (int member = 0; member < (int)structure.size(); ++member) { - if (structure[member].type->getFieldName().compare(name) == 0) { - variable->setMemberExtensions(member, numExts, extensions); - return; - } - } - } - - long long getMaxSymbolId() { return uniqueId; } -#if !defined(GLSLANG_WEB) - void dump(TInfoSink& infoSink, bool complete = false) const; -#endif - void copyTable(const TSymbolTable& copyOf); - - void setPreviousDefaultPrecisions(TPrecisionQualifier *p) { table[currentLevel()]->setPreviousDefaultPrecisions(p); } - - void readOnly() - { - for (unsigned int level = 0; level < table.size(); ++level) - table[level]->readOnly(); - } - - // Add current level in the high-bits of unique id - void updateUniqueIdLevelFlag() { - // clamp level to avoid overflow - uint64_t level = (uint32_t)currentLevel() > MaxLevelInUniqueID ? MaxLevelInUniqueID : currentLevel(); - uniqueId &= uniqueIdMask; - uniqueId |= (level << LevelFlagBitOffset); - } - - void overwriteUniqueId(long long id) - { - uniqueId = id; - updateUniqueIdLevelFlag(); - } - -protected: - TSymbolTable(TSymbolTable&); - TSymbolTable& operator=(TSymbolTableLevel&); - - int currentLevel() const { return static_cast(table.size()) - 1; } - std::vector table; - long long uniqueId; // for unique identification in code generation - bool noBuiltInRedeclarations; - bool separateNameSpaces; - unsigned int adoptedLevels; -}; - -} // end namespace glslang - -#endif // _SYMBOL_TABLE_INCLUDED_ diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/Versions.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/Versions.h index 9e4c9fe..475cb89 100644 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/Versions.h +++ b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/Versions.h @@ -174,6 +174,7 @@ const char* const E_GL_KHR_shader_subgroup_shuffle_relative = "GL_KHR_shader_sub const char* const E_GL_KHR_shader_subgroup_clustered = "GL_KHR_shader_subgroup_clustered"; const char* const E_GL_KHR_shader_subgroup_quad = "GL_KHR_shader_subgroup_quad"; const char* const E_GL_KHR_memory_scope_semantics = "GL_KHR_memory_scope_semantics"; +const char* const E_GL_KHR_cooperative_matrix = "GL_KHR_cooperative_matrix"; const char* const E_GL_EXT_shader_atomic_int64 = "GL_EXT_shader_atomic_int64"; @@ -214,6 +215,8 @@ const char* const E_GL_EXT_spirv_intrinsics = "GL_EXT_spirv_intr const char* const E_GL_EXT_fragment_shader_barycentric = "GL_EXT_fragment_shader_barycentric"; const char* const E_GL_EXT_mesh_shader = "GL_EXT_mesh_shader"; const char* const E_GL_EXT_opacity_micromap = "GL_EXT_opacity_micromap"; +const char* const E_GL_EXT_draw_instanced = "GL_EXT_draw_instanced"; +const char* const E_GL_EXT_texture_array = "GL_EXT_texture_array"; // Arrays of extensions for the above viewportEXTs duplications @@ -265,6 +268,12 @@ const char* const E_GL_NV_fragment_shader_barycentric = "GL_NV_fragmen const char* const E_GL_NV_compute_shader_derivatives = "GL_NV_compute_shader_derivatives"; const char* const E_GL_NV_shader_texture_footprint = "GL_NV_shader_texture_footprint"; const char* const E_GL_NV_mesh_shader = "GL_NV_mesh_shader"; +const char* const E_GL_NV_cooperative_matrix = "GL_NV_cooperative_matrix"; +const char* const E_GL_NV_shader_sm_builtins = "GL_NV_shader_sm_builtins"; +const char* const E_GL_NV_integer_cooperative_matrix = "GL_NV_integer_cooperative_matrix"; +const char* const E_GL_NV_shader_invocation_reorder = "GL_NV_shader_invocation_reorder"; +const char* const E_GL_EXT_ray_tracing_position_fetch = "GL_EXT_ray_tracing_position_fetch"; +const char* const E_GL_NV_displacement_micromap = "GL_NV_displacement_micromap"; // ARM const char* const E_GL_ARM_shader_core_builtins = "GL_ARM_shader_core_builtins"; @@ -274,10 +283,8 @@ const char* const E_GL_ARM_shader_core_builtins = "GL_ARM_shader const char* const viewportEXTs[] = { E_GL_ARB_shader_viewport_layer_array, E_GL_NV_viewport_array2 }; const int Num_viewportEXTs = sizeof(viewportEXTs) / sizeof(viewportEXTs[0]); -const char* const E_GL_NV_cooperative_matrix = "GL_NV_cooperative_matrix"; -const char* const E_GL_NV_shader_sm_builtins = "GL_NV_shader_sm_builtins"; -const char* const E_GL_NV_integer_cooperative_matrix = "GL_NV_integer_cooperative_matrix"; -const char* const E_GL_NV_shader_invocation_reorder = "GL_NV_shader_invocation_reorder"; + +const char* const E_GL_QCOM_image_processing = "GL_QCOM_image_processing"; // AEP const char* const E_GL_ANDROID_extension_pack_es31a = "GL_ANDROID_extension_pack_es31a"; @@ -327,6 +334,10 @@ const char* const E_GL_EXT_terminate_invocation = "GL_EXT_terminate_invocation"; const char* const E_GL_EXT_shader_atomic_float = "GL_EXT_shader_atomic_float"; const char* const E_GL_EXT_shader_atomic_float2 = "GL_EXT_shader_atomic_float2"; +const char* const E_GL_EXT_shader_tile_image = "GL_EXT_shader_tile_image"; + +const char* const E_GL_EXT_texture_shadow_lod = "GL_EXT_texture_shadow_lod"; + // Arrays of extensions for the above AEP duplications const char* const AEP_geometry_shader[] = { E_GL_EXT_geometry_shader, E_GL_OES_geometry_shader }; diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/attribute.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/attribute.h deleted file mode 100644 index c5b2917..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/attribute.h +++ /dev/null @@ -1,150 +0,0 @@ -// -// Copyright (C) 2017 LunarG, Inc. -// Copyright (C) 2018 Google, Inc. -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// -// Neither the name of 3Dlabs Inc. Ltd. nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// - -#ifndef _ATTRIBUTE_INCLUDED_ -#define _ATTRIBUTE_INCLUDED_ - -#include "../Include/Common.h" -#include "../Include/ConstantUnion.h" - -namespace glslang { - - enum TAttributeType { - EatNone, - EatAllow_uav_condition, - EatBranch, - EatCall, - EatDomain, - EatEarlyDepthStencil, - EatFastOpt, - EatFlatten, - EatForceCase, - EatInstance, - EatMaxTessFactor, - EatNumThreads, - EatMaxVertexCount, - EatOutputControlPoints, - EatOutputTopology, - EatPartitioning, - EatPatchConstantFunc, - EatPatchSize, - EatUnroll, - EatLoop, - EatBinding, - EatGlobalBinding, - EatLocation, - EatInputAttachment, - EatBuiltIn, - EatPushConstant, - EatConstantId, - EatDependencyInfinite, - EatDependencyLength, - EatMinIterations, - EatMaxIterations, - EatIterationMultiple, - EatPeelCount, - EatPartialCount, - EatFormatRgba32f, - EatFormatRgba16f, - EatFormatR32f, - EatFormatRgba8, - EatFormatRgba8Snorm, - EatFormatRg32f, - EatFormatRg16f, - EatFormatR11fG11fB10f, - EatFormatR16f, - EatFormatRgba16, - EatFormatRgb10A2, - EatFormatRg16, - EatFormatRg8, - EatFormatR16, - EatFormatR8, - EatFormatRgba16Snorm, - EatFormatRg16Snorm, - EatFormatRg8Snorm, - EatFormatR16Snorm, - EatFormatR8Snorm, - EatFormatRgba32i, - EatFormatRgba16i, - EatFormatRgba8i, - EatFormatR32i, - EatFormatRg32i, - EatFormatRg16i, - EatFormatRg8i, - EatFormatR16i, - EatFormatR8i, - EatFormatRgba32ui, - EatFormatRgba16ui, - EatFormatRgba8ui, - EatFormatR32ui, - EatFormatRgb10a2ui, - EatFormatRg32ui, - EatFormatRg16ui, - EatFormatRg8ui, - EatFormatR16ui, - EatFormatR8ui, - EatFormatUnknown, - EatNonWritable, - EatNonReadable, - EatSubgroupUniformControlFlow, - }; - - class TIntermAggregate; - - struct TAttributeArgs { - TAttributeType name; - const TIntermAggregate* args; - - // Obtain attribute as integer - // Return false if it cannot be obtained - bool getInt(int& value, int argNum = 0) const; - - // Obtain attribute as string, with optional to-lower transform - // Return false if it cannot be obtained - bool getString(TString& value, int argNum = 0, bool convertToLower = true) const; - - // How many arguments were provided to the attribute? - int size() const; - - protected: - const TConstUnion* getConstUnion(TBasicType basicType, int argNum) const; - }; - - typedef TList TAttributes; - -} // end namespace glslang - -#endif // _ATTRIBUTE_INCLUDED_ diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/gl_types.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/gl_types.h deleted file mode 100644 index d6c9393..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/gl_types.h +++ /dev/null @@ -1,218 +0,0 @@ -/* -** Copyright (c) 2013 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Materials. -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. -*/ - -#pragma once - -#define GL_FLOAT 0x1406 -#define GL_FLOAT_VEC2 0x8B50 -#define GL_FLOAT_VEC3 0x8B51 -#define GL_FLOAT_VEC4 0x8B52 - -#define GL_DOUBLE 0x140A -#define GL_DOUBLE_VEC2 0x8FFC -#define GL_DOUBLE_VEC3 0x8FFD -#define GL_DOUBLE_VEC4 0x8FFE - -#define GL_INT 0x1404 -#define GL_INT_VEC2 0x8B53 -#define GL_INT_VEC3 0x8B54 -#define GL_INT_VEC4 0x8B55 - -#define GL_UNSIGNED_INT 0x1405 -#define GL_UNSIGNED_INT_VEC2 0x8DC6 -#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 0x8FF5 -#define GL_UNSIGNED_INT64_VEC3_ARB 0x8FF6 -#define GL_UNSIGNED_INT64_VEC4_ARB 0x8FF7 -#define GL_UNSIGNED_INT16_VEC2_NV 0x8FF1 -#define GL_UNSIGNED_INT16_VEC3_NV 0x8FF2 -#define GL_UNSIGNED_INT16_VEC4_NV 0x8FF3 - -#define GL_INT16_NV 0x8FE4 -#define GL_INT16_VEC2_NV 0x8FE5 -#define GL_INT16_VEC3_NV 0x8FE6 -#define GL_INT16_VEC4_NV 0x8FE7 - -#define GL_BOOL 0x8B56 -#define GL_BOOL_VEC2 0x8B57 -#define GL_BOOL_VEC3 0x8B58 -#define GL_BOOL_VEC4 0x8B59 - -#define GL_FLOAT_MAT2 0x8B5A -#define GL_FLOAT_MAT3 0x8B5B -#define GL_FLOAT_MAT4 0x8B5C -#define GL_FLOAT_MAT2x3 0x8B65 -#define GL_FLOAT_MAT2x4 0x8B66 -#define GL_FLOAT_MAT3x2 0x8B67 -#define GL_FLOAT_MAT3x4 0x8B68 -#define GL_FLOAT_MAT4x2 0x8B69 -#define GL_FLOAT_MAT4x3 0x8B6A - -#define GL_DOUBLE_MAT2 0x8F46 -#define GL_DOUBLE_MAT3 0x8F47 -#define GL_DOUBLE_MAT4 0x8F48 -#define GL_DOUBLE_MAT2x3 0x8F49 -#define GL_DOUBLE_MAT2x4 0x8F4A -#define GL_DOUBLE_MAT3x2 0x8F4B -#define GL_DOUBLE_MAT3x4 0x8F4C -#define GL_DOUBLE_MAT4x2 0x8F4D -#define GL_DOUBLE_MAT4x3 0x8F4E - -// Those constants are borrowed from extension NV_gpu_shader5 -#define GL_FLOAT16_NV 0x8FF8 -#define GL_FLOAT16_VEC2_NV 0x8FF9 -#define GL_FLOAT16_VEC3_NV 0x8FFA -#define GL_FLOAT16_VEC4_NV 0x8FFB - -#define GL_FLOAT16_MAT2_AMD 0x91C5 -#define GL_FLOAT16_MAT3_AMD 0x91C6 -#define GL_FLOAT16_MAT4_AMD 0x91C7 -#define GL_FLOAT16_MAT2x3_AMD 0x91C8 -#define GL_FLOAT16_MAT2x4_AMD 0x91C9 -#define GL_FLOAT16_MAT3x2_AMD 0x91CA -#define GL_FLOAT16_MAT3x4_AMD 0x91CB -#define GL_FLOAT16_MAT4x2_AMD 0x91CC -#define GL_FLOAT16_MAT4x3_AMD 0x91CD - -#define GL_SAMPLER_1D 0x8B5D -#define GL_SAMPLER_2D 0x8B5E -#define GL_SAMPLER_3D 0x8B5F -#define GL_SAMPLER_CUBE 0x8B60 -#define GL_SAMPLER_BUFFER 0x8DC2 -#define GL_SAMPLER_1D_ARRAY 0x8DC0 -#define GL_SAMPLER_2D_ARRAY 0x8DC1 -#define GL_SAMPLER_1D_ARRAY_SHADOW 0x8DC3 -#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4 -#define GL_SAMPLER_CUBE_SHADOW 0x8DC5 -#define GL_SAMPLER_1D_SHADOW 0x8B61 -#define GL_SAMPLER_2D_SHADOW 0x8B62 -#define GL_SAMPLER_2D_RECT 0x8B63 -#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64 -#define GL_SAMPLER_2D_MULTISAMPLE 0x9108 -#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B -#define GL_SAMPLER_CUBE_MAP_ARRAY 0x900C -#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D -#define GL_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900C -#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB 0x900D - -#define GL_FLOAT16_SAMPLER_1D_AMD 0x91CE -#define GL_FLOAT16_SAMPLER_2D_AMD 0x91CF -#define GL_FLOAT16_SAMPLER_3D_AMD 0x91D0 -#define GL_FLOAT16_SAMPLER_CUBE_AMD 0x91D1 -#define GL_FLOAT16_SAMPLER_2D_RECT_AMD 0x91D2 -#define GL_FLOAT16_SAMPLER_1D_ARRAY_AMD 0x91D3 -#define GL_FLOAT16_SAMPLER_2D_ARRAY_AMD 0x91D4 -#define GL_FLOAT16_SAMPLER_CUBE_MAP_ARRAY_AMD 0x91D5 -#define GL_FLOAT16_SAMPLER_BUFFER_AMD 0x91D6 -#define GL_FLOAT16_SAMPLER_2D_MULTISAMPLE_AMD 0x91D7 -#define GL_FLOAT16_SAMPLER_2D_MULTISAMPLE_ARRAY_AMD 0x91D8 - -#define GL_FLOAT16_SAMPLER_1D_SHADOW_AMD 0x91D9 -#define GL_FLOAT16_SAMPLER_2D_SHADOW_AMD 0x91DA -#define GL_FLOAT16_SAMPLER_2D_RECT_SHADOW_AMD 0x91DB -#define GL_FLOAT16_SAMPLER_1D_ARRAY_SHADOW_AMD 0x91DC -#define GL_FLOAT16_SAMPLER_2D_ARRAY_SHADOW_AMD 0x91DD -#define GL_FLOAT16_SAMPLER_CUBE_SHADOW_AMD 0x91DE -#define GL_FLOAT16_SAMPLER_CUBE_MAP_ARRAY_SHADOW_AMD 0x91DF - -#define GL_FLOAT16_IMAGE_1D_AMD 0x91E0 -#define GL_FLOAT16_IMAGE_2D_AMD 0x91E1 -#define GL_FLOAT16_IMAGE_3D_AMD 0x91E2 -#define GL_FLOAT16_IMAGE_2D_RECT_AMD 0x91E3 -#define GL_FLOAT16_IMAGE_CUBE_AMD 0x91E4 -#define GL_FLOAT16_IMAGE_1D_ARRAY_AMD 0x91E5 -#define GL_FLOAT16_IMAGE_2D_ARRAY_AMD 0x91E6 -#define GL_FLOAT16_IMAGE_CUBE_MAP_ARRAY_AMD 0x91E7 -#define GL_FLOAT16_IMAGE_BUFFER_AMD 0x91E8 -#define GL_FLOAT16_IMAGE_2D_MULTISAMPLE_AMD 0x91E9 -#define GL_FLOAT16_IMAGE_2D_MULTISAMPLE_ARRAY_AMD 0x91EA - -#define GL_INT_SAMPLER_1D 0x8DC9 -#define GL_INT_SAMPLER_2D 0x8DCA -#define GL_INT_SAMPLER_3D 0x8DCB -#define GL_INT_SAMPLER_CUBE 0x8DCC -#define GL_INT_SAMPLER_1D_ARRAY 0x8DCE -#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF -#define GL_INT_SAMPLER_2D_RECT 0x8DCD -#define GL_INT_SAMPLER_BUFFER 0x8DD0 -#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109 -#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C -#define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E -#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900E - -#define GL_UNSIGNED_INT_SAMPLER_1D 0x8DD1 -#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2 -#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3 -#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4 -#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY 0x8DD6 -#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7 -#define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5 -#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8 -#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D -#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F -#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900F -#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A - -#define GL_IMAGE_1D 0x904C -#define GL_IMAGE_2D 0x904D -#define GL_IMAGE_3D 0x904E -#define GL_IMAGE_2D_RECT 0x904F -#define GL_IMAGE_CUBE 0x9050 -#define GL_IMAGE_BUFFER 0x9051 -#define GL_IMAGE_1D_ARRAY 0x9052 -#define GL_IMAGE_2D_ARRAY 0x9053 -#define GL_IMAGE_CUBE_MAP_ARRAY 0x9054 -#define GL_IMAGE_2D_MULTISAMPLE 0x9055 -#define GL_IMAGE_2D_MULTISAMPLE_ARRAY 0x9056 -#define GL_INT_IMAGE_1D 0x9057 -#define GL_INT_IMAGE_2D 0x9058 -#define GL_INT_IMAGE_3D 0x9059 -#define GL_INT_IMAGE_2D_RECT 0x905A -#define GL_INT_IMAGE_CUBE 0x905B -#define GL_INT_IMAGE_BUFFER 0x905C -#define GL_INT_IMAGE_1D_ARRAY 0x905D -#define GL_INT_IMAGE_2D_ARRAY 0x905E -#define GL_INT_IMAGE_CUBE_MAP_ARRAY 0x905F -#define GL_INT_IMAGE_2D_MULTISAMPLE 0x9060 -#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x9061 -#define GL_UNSIGNED_INT_IMAGE_1D 0x9062 -#define GL_UNSIGNED_INT_IMAGE_2D 0x9063 -#define GL_UNSIGNED_INT_IMAGE_3D 0x9064 -#define GL_UNSIGNED_INT_IMAGE_2D_RECT 0x9065 -#define GL_UNSIGNED_INT_IMAGE_CUBE 0x9066 -#define GL_UNSIGNED_INT_IMAGE_BUFFER 0x9067 -#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY 0x9068 -#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY 0x9069 -#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY 0x906A -#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE 0x906B -#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x906C - -#define GL_UNSIGNED_INT_ATOMIC_COUNTER 0x92DB diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/glslang_tab.cpp.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/glslang_tab.cpp.h deleted file mode 100644 index 6d168d0..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/glslang_tab.cpp.h +++ /dev/null @@ -1,573 +0,0 @@ -/* A Bison parser, made by GNU Bison 3.7.4. */ - -/* Bison interface for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 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 . */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - 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. */ - -/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, - especially those whose name start with YY_ or yy_. They are - private implementation details that can be changed or removed. */ - -#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 -#if YYDEBUG -extern int yydebug; -#endif - -/* Token kinds. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - enum yytokentype - { - YYEMPTY = -2, - YYEOF = 0, /* "end of file" */ - YYerror = 256, /* error */ - YYUNDEF = 257, /* "invalid token" */ - CONST = 258, /* CONST */ - BOOL = 259, /* BOOL */ - INT = 260, /* INT */ - UINT = 261, /* UINT */ - FLOAT = 262, /* FLOAT */ - BVEC2 = 263, /* BVEC2 */ - BVEC3 = 264, /* BVEC3 */ - BVEC4 = 265, /* BVEC4 */ - IVEC2 = 266, /* IVEC2 */ - IVEC3 = 267, /* IVEC3 */ - IVEC4 = 268, /* IVEC4 */ - UVEC2 = 269, /* UVEC2 */ - UVEC3 = 270, /* UVEC3 */ - UVEC4 = 271, /* UVEC4 */ - VEC2 = 272, /* VEC2 */ - VEC3 = 273, /* VEC3 */ - VEC4 = 274, /* VEC4 */ - MAT2 = 275, /* MAT2 */ - MAT3 = 276, /* MAT3 */ - MAT4 = 277, /* MAT4 */ - MAT2X2 = 278, /* MAT2X2 */ - MAT2X3 = 279, /* MAT2X3 */ - MAT2X4 = 280, /* MAT2X4 */ - MAT3X2 = 281, /* MAT3X2 */ - MAT3X3 = 282, /* MAT3X3 */ - MAT3X4 = 283, /* MAT3X4 */ - MAT4X2 = 284, /* MAT4X2 */ - MAT4X3 = 285, /* MAT4X3 */ - MAT4X4 = 286, /* MAT4X4 */ - SAMPLER2D = 287, /* SAMPLER2D */ - SAMPLER3D = 288, /* SAMPLER3D */ - SAMPLERCUBE = 289, /* SAMPLERCUBE */ - SAMPLER2DSHADOW = 290, /* SAMPLER2DSHADOW */ - SAMPLERCUBESHADOW = 291, /* SAMPLERCUBESHADOW */ - SAMPLER2DARRAY = 292, /* SAMPLER2DARRAY */ - SAMPLER2DARRAYSHADOW = 293, /* SAMPLER2DARRAYSHADOW */ - ISAMPLER2D = 294, /* ISAMPLER2D */ - ISAMPLER3D = 295, /* ISAMPLER3D */ - ISAMPLERCUBE = 296, /* ISAMPLERCUBE */ - ISAMPLER2DARRAY = 297, /* ISAMPLER2DARRAY */ - USAMPLER2D = 298, /* USAMPLER2D */ - USAMPLER3D = 299, /* USAMPLER3D */ - USAMPLERCUBE = 300, /* USAMPLERCUBE */ - USAMPLER2DARRAY = 301, /* USAMPLER2DARRAY */ - SAMPLER = 302, /* SAMPLER */ - SAMPLERSHADOW = 303, /* SAMPLERSHADOW */ - TEXTURE2D = 304, /* TEXTURE2D */ - TEXTURE3D = 305, /* TEXTURE3D */ - TEXTURECUBE = 306, /* TEXTURECUBE */ - TEXTURE2DARRAY = 307, /* TEXTURE2DARRAY */ - ITEXTURE2D = 308, /* ITEXTURE2D */ - ITEXTURE3D = 309, /* ITEXTURE3D */ - ITEXTURECUBE = 310, /* ITEXTURECUBE */ - ITEXTURE2DARRAY = 311, /* ITEXTURE2DARRAY */ - UTEXTURE2D = 312, /* UTEXTURE2D */ - UTEXTURE3D = 313, /* UTEXTURE3D */ - UTEXTURECUBE = 314, /* UTEXTURECUBE */ - UTEXTURE2DARRAY = 315, /* UTEXTURE2DARRAY */ - ATTRIBUTE = 316, /* ATTRIBUTE */ - VARYING = 317, /* VARYING */ - FLOAT16_T = 318, /* FLOAT16_T */ - FLOAT32_T = 319, /* FLOAT32_T */ - DOUBLE = 320, /* DOUBLE */ - FLOAT64_T = 321, /* FLOAT64_T */ - INT64_T = 322, /* INT64_T */ - UINT64_T = 323, /* UINT64_T */ - INT32_T = 324, /* INT32_T */ - UINT32_T = 325, /* UINT32_T */ - INT16_T = 326, /* INT16_T */ - UINT16_T = 327, /* UINT16_T */ - INT8_T = 328, /* INT8_T */ - UINT8_T = 329, /* UINT8_T */ - I64VEC2 = 330, /* I64VEC2 */ - I64VEC3 = 331, /* I64VEC3 */ - I64VEC4 = 332, /* I64VEC4 */ - U64VEC2 = 333, /* U64VEC2 */ - U64VEC3 = 334, /* U64VEC3 */ - U64VEC4 = 335, /* U64VEC4 */ - I32VEC2 = 336, /* I32VEC2 */ - I32VEC3 = 337, /* I32VEC3 */ - I32VEC4 = 338, /* I32VEC4 */ - U32VEC2 = 339, /* U32VEC2 */ - U32VEC3 = 340, /* U32VEC3 */ - U32VEC4 = 341, /* U32VEC4 */ - I16VEC2 = 342, /* I16VEC2 */ - I16VEC3 = 343, /* I16VEC3 */ - I16VEC4 = 344, /* I16VEC4 */ - U16VEC2 = 345, /* U16VEC2 */ - U16VEC3 = 346, /* U16VEC3 */ - U16VEC4 = 347, /* U16VEC4 */ - I8VEC2 = 348, /* I8VEC2 */ - I8VEC3 = 349, /* I8VEC3 */ - I8VEC4 = 350, /* I8VEC4 */ - U8VEC2 = 351, /* U8VEC2 */ - U8VEC3 = 352, /* U8VEC3 */ - U8VEC4 = 353, /* U8VEC4 */ - DVEC2 = 354, /* DVEC2 */ - DVEC3 = 355, /* DVEC3 */ - DVEC4 = 356, /* DVEC4 */ - DMAT2 = 357, /* DMAT2 */ - DMAT3 = 358, /* DMAT3 */ - DMAT4 = 359, /* DMAT4 */ - F16VEC2 = 360, /* F16VEC2 */ - F16VEC3 = 361, /* F16VEC3 */ - F16VEC4 = 362, /* F16VEC4 */ - F16MAT2 = 363, /* F16MAT2 */ - F16MAT3 = 364, /* F16MAT3 */ - F16MAT4 = 365, /* F16MAT4 */ - F32VEC2 = 366, /* F32VEC2 */ - F32VEC3 = 367, /* F32VEC3 */ - F32VEC4 = 368, /* F32VEC4 */ - F32MAT2 = 369, /* F32MAT2 */ - F32MAT3 = 370, /* F32MAT3 */ - F32MAT4 = 371, /* F32MAT4 */ - F64VEC2 = 372, /* F64VEC2 */ - F64VEC3 = 373, /* F64VEC3 */ - F64VEC4 = 374, /* F64VEC4 */ - F64MAT2 = 375, /* F64MAT2 */ - F64MAT3 = 376, /* F64MAT3 */ - F64MAT4 = 377, /* F64MAT4 */ - DMAT2X2 = 378, /* DMAT2X2 */ - DMAT2X3 = 379, /* DMAT2X3 */ - DMAT2X4 = 380, /* DMAT2X4 */ - DMAT3X2 = 381, /* DMAT3X2 */ - DMAT3X3 = 382, /* DMAT3X3 */ - DMAT3X4 = 383, /* DMAT3X4 */ - DMAT4X2 = 384, /* DMAT4X2 */ - DMAT4X3 = 385, /* DMAT4X3 */ - DMAT4X4 = 386, /* DMAT4X4 */ - F16MAT2X2 = 387, /* F16MAT2X2 */ - F16MAT2X3 = 388, /* F16MAT2X3 */ - F16MAT2X4 = 389, /* F16MAT2X4 */ - F16MAT3X2 = 390, /* F16MAT3X2 */ - F16MAT3X3 = 391, /* F16MAT3X3 */ - F16MAT3X4 = 392, /* F16MAT3X4 */ - F16MAT4X2 = 393, /* F16MAT4X2 */ - F16MAT4X3 = 394, /* F16MAT4X3 */ - F16MAT4X4 = 395, /* F16MAT4X4 */ - F32MAT2X2 = 396, /* F32MAT2X2 */ - F32MAT2X3 = 397, /* F32MAT2X3 */ - F32MAT2X4 = 398, /* F32MAT2X4 */ - F32MAT3X2 = 399, /* F32MAT3X2 */ - F32MAT3X3 = 400, /* F32MAT3X3 */ - F32MAT3X4 = 401, /* F32MAT3X4 */ - F32MAT4X2 = 402, /* F32MAT4X2 */ - F32MAT4X3 = 403, /* F32MAT4X3 */ - F32MAT4X4 = 404, /* F32MAT4X4 */ - F64MAT2X2 = 405, /* F64MAT2X2 */ - F64MAT2X3 = 406, /* F64MAT2X3 */ - F64MAT2X4 = 407, /* F64MAT2X4 */ - F64MAT3X2 = 408, /* F64MAT3X2 */ - F64MAT3X3 = 409, /* F64MAT3X3 */ - F64MAT3X4 = 410, /* F64MAT3X4 */ - F64MAT4X2 = 411, /* F64MAT4X2 */ - F64MAT4X3 = 412, /* F64MAT4X3 */ - F64MAT4X4 = 413, /* F64MAT4X4 */ - ATOMIC_UINT = 414, /* ATOMIC_UINT */ - ACCSTRUCTNV = 415, /* ACCSTRUCTNV */ - ACCSTRUCTEXT = 416, /* ACCSTRUCTEXT */ - RAYQUERYEXT = 417, /* RAYQUERYEXT */ - FCOOPMATNV = 418, /* FCOOPMATNV */ - ICOOPMATNV = 419, /* ICOOPMATNV */ - UCOOPMATNV = 420, /* UCOOPMATNV */ - HITOBJECTNV = 421, /* HITOBJECTNV */ - HITOBJECTATTRNV = 422, /* HITOBJECTATTRNV */ - SAMPLERCUBEARRAY = 423, /* SAMPLERCUBEARRAY */ - SAMPLERCUBEARRAYSHADOW = 424, /* SAMPLERCUBEARRAYSHADOW */ - ISAMPLERCUBEARRAY = 425, /* ISAMPLERCUBEARRAY */ - USAMPLERCUBEARRAY = 426, /* USAMPLERCUBEARRAY */ - SAMPLER1D = 427, /* SAMPLER1D */ - SAMPLER1DARRAY = 428, /* SAMPLER1DARRAY */ - SAMPLER1DARRAYSHADOW = 429, /* SAMPLER1DARRAYSHADOW */ - ISAMPLER1D = 430, /* ISAMPLER1D */ - SAMPLER1DSHADOW = 431, /* SAMPLER1DSHADOW */ - SAMPLER2DRECT = 432, /* SAMPLER2DRECT */ - SAMPLER2DRECTSHADOW = 433, /* SAMPLER2DRECTSHADOW */ - ISAMPLER2DRECT = 434, /* ISAMPLER2DRECT */ - USAMPLER2DRECT = 435, /* USAMPLER2DRECT */ - SAMPLERBUFFER = 436, /* SAMPLERBUFFER */ - ISAMPLERBUFFER = 437, /* ISAMPLERBUFFER */ - USAMPLERBUFFER = 438, /* USAMPLERBUFFER */ - SAMPLER2DMS = 439, /* SAMPLER2DMS */ - ISAMPLER2DMS = 440, /* ISAMPLER2DMS */ - USAMPLER2DMS = 441, /* USAMPLER2DMS */ - SAMPLER2DMSARRAY = 442, /* SAMPLER2DMSARRAY */ - ISAMPLER2DMSARRAY = 443, /* ISAMPLER2DMSARRAY */ - USAMPLER2DMSARRAY = 444, /* USAMPLER2DMSARRAY */ - SAMPLEREXTERNALOES = 445, /* SAMPLEREXTERNALOES */ - SAMPLEREXTERNAL2DY2YEXT = 446, /* SAMPLEREXTERNAL2DY2YEXT */ - ISAMPLER1DARRAY = 447, /* ISAMPLER1DARRAY */ - USAMPLER1D = 448, /* USAMPLER1D */ - USAMPLER1DARRAY = 449, /* USAMPLER1DARRAY */ - F16SAMPLER1D = 450, /* F16SAMPLER1D */ - F16SAMPLER2D = 451, /* F16SAMPLER2D */ - F16SAMPLER3D = 452, /* F16SAMPLER3D */ - F16SAMPLER2DRECT = 453, /* F16SAMPLER2DRECT */ - F16SAMPLERCUBE = 454, /* F16SAMPLERCUBE */ - F16SAMPLER1DARRAY = 455, /* F16SAMPLER1DARRAY */ - F16SAMPLER2DARRAY = 456, /* F16SAMPLER2DARRAY */ - F16SAMPLERCUBEARRAY = 457, /* F16SAMPLERCUBEARRAY */ - F16SAMPLERBUFFER = 458, /* F16SAMPLERBUFFER */ - F16SAMPLER2DMS = 459, /* F16SAMPLER2DMS */ - F16SAMPLER2DMSARRAY = 460, /* F16SAMPLER2DMSARRAY */ - F16SAMPLER1DSHADOW = 461, /* F16SAMPLER1DSHADOW */ - F16SAMPLER2DSHADOW = 462, /* F16SAMPLER2DSHADOW */ - F16SAMPLER1DARRAYSHADOW = 463, /* F16SAMPLER1DARRAYSHADOW */ - F16SAMPLER2DARRAYSHADOW = 464, /* F16SAMPLER2DARRAYSHADOW */ - F16SAMPLER2DRECTSHADOW = 465, /* F16SAMPLER2DRECTSHADOW */ - F16SAMPLERCUBESHADOW = 466, /* F16SAMPLERCUBESHADOW */ - F16SAMPLERCUBEARRAYSHADOW = 467, /* F16SAMPLERCUBEARRAYSHADOW */ - IMAGE1D = 468, /* IMAGE1D */ - IIMAGE1D = 469, /* IIMAGE1D */ - UIMAGE1D = 470, /* UIMAGE1D */ - IMAGE2D = 471, /* IMAGE2D */ - IIMAGE2D = 472, /* IIMAGE2D */ - UIMAGE2D = 473, /* UIMAGE2D */ - IMAGE3D = 474, /* IMAGE3D */ - IIMAGE3D = 475, /* IIMAGE3D */ - UIMAGE3D = 476, /* UIMAGE3D */ - IMAGE2DRECT = 477, /* IMAGE2DRECT */ - IIMAGE2DRECT = 478, /* IIMAGE2DRECT */ - UIMAGE2DRECT = 479, /* UIMAGE2DRECT */ - IMAGECUBE = 480, /* IMAGECUBE */ - IIMAGECUBE = 481, /* IIMAGECUBE */ - UIMAGECUBE = 482, /* UIMAGECUBE */ - IMAGEBUFFER = 483, /* IMAGEBUFFER */ - IIMAGEBUFFER = 484, /* IIMAGEBUFFER */ - UIMAGEBUFFER = 485, /* UIMAGEBUFFER */ - IMAGE1DARRAY = 486, /* IMAGE1DARRAY */ - IIMAGE1DARRAY = 487, /* IIMAGE1DARRAY */ - UIMAGE1DARRAY = 488, /* UIMAGE1DARRAY */ - IMAGE2DARRAY = 489, /* IMAGE2DARRAY */ - IIMAGE2DARRAY = 490, /* IIMAGE2DARRAY */ - UIMAGE2DARRAY = 491, /* UIMAGE2DARRAY */ - IMAGECUBEARRAY = 492, /* IMAGECUBEARRAY */ - IIMAGECUBEARRAY = 493, /* IIMAGECUBEARRAY */ - UIMAGECUBEARRAY = 494, /* UIMAGECUBEARRAY */ - IMAGE2DMS = 495, /* IMAGE2DMS */ - IIMAGE2DMS = 496, /* IIMAGE2DMS */ - UIMAGE2DMS = 497, /* UIMAGE2DMS */ - IMAGE2DMSARRAY = 498, /* IMAGE2DMSARRAY */ - IIMAGE2DMSARRAY = 499, /* IIMAGE2DMSARRAY */ - UIMAGE2DMSARRAY = 500, /* UIMAGE2DMSARRAY */ - F16IMAGE1D = 501, /* F16IMAGE1D */ - F16IMAGE2D = 502, /* F16IMAGE2D */ - F16IMAGE3D = 503, /* F16IMAGE3D */ - F16IMAGE2DRECT = 504, /* F16IMAGE2DRECT */ - F16IMAGECUBE = 505, /* F16IMAGECUBE */ - F16IMAGE1DARRAY = 506, /* F16IMAGE1DARRAY */ - F16IMAGE2DARRAY = 507, /* F16IMAGE2DARRAY */ - F16IMAGECUBEARRAY = 508, /* F16IMAGECUBEARRAY */ - F16IMAGEBUFFER = 509, /* F16IMAGEBUFFER */ - F16IMAGE2DMS = 510, /* F16IMAGE2DMS */ - F16IMAGE2DMSARRAY = 511, /* F16IMAGE2DMSARRAY */ - I64IMAGE1D = 512, /* I64IMAGE1D */ - U64IMAGE1D = 513, /* U64IMAGE1D */ - I64IMAGE2D = 514, /* I64IMAGE2D */ - U64IMAGE2D = 515, /* U64IMAGE2D */ - I64IMAGE3D = 516, /* I64IMAGE3D */ - U64IMAGE3D = 517, /* U64IMAGE3D */ - I64IMAGE2DRECT = 518, /* I64IMAGE2DRECT */ - U64IMAGE2DRECT = 519, /* U64IMAGE2DRECT */ - I64IMAGECUBE = 520, /* I64IMAGECUBE */ - U64IMAGECUBE = 521, /* U64IMAGECUBE */ - I64IMAGEBUFFER = 522, /* I64IMAGEBUFFER */ - U64IMAGEBUFFER = 523, /* U64IMAGEBUFFER */ - I64IMAGE1DARRAY = 524, /* I64IMAGE1DARRAY */ - U64IMAGE1DARRAY = 525, /* U64IMAGE1DARRAY */ - I64IMAGE2DARRAY = 526, /* I64IMAGE2DARRAY */ - U64IMAGE2DARRAY = 527, /* U64IMAGE2DARRAY */ - I64IMAGECUBEARRAY = 528, /* I64IMAGECUBEARRAY */ - U64IMAGECUBEARRAY = 529, /* U64IMAGECUBEARRAY */ - I64IMAGE2DMS = 530, /* I64IMAGE2DMS */ - U64IMAGE2DMS = 531, /* U64IMAGE2DMS */ - I64IMAGE2DMSARRAY = 532, /* I64IMAGE2DMSARRAY */ - U64IMAGE2DMSARRAY = 533, /* U64IMAGE2DMSARRAY */ - TEXTURECUBEARRAY = 534, /* TEXTURECUBEARRAY */ - ITEXTURECUBEARRAY = 535, /* ITEXTURECUBEARRAY */ - UTEXTURECUBEARRAY = 536, /* UTEXTURECUBEARRAY */ - TEXTURE1D = 537, /* TEXTURE1D */ - ITEXTURE1D = 538, /* ITEXTURE1D */ - UTEXTURE1D = 539, /* UTEXTURE1D */ - TEXTURE1DARRAY = 540, /* TEXTURE1DARRAY */ - ITEXTURE1DARRAY = 541, /* ITEXTURE1DARRAY */ - UTEXTURE1DARRAY = 542, /* UTEXTURE1DARRAY */ - TEXTURE2DRECT = 543, /* TEXTURE2DRECT */ - ITEXTURE2DRECT = 544, /* ITEXTURE2DRECT */ - UTEXTURE2DRECT = 545, /* UTEXTURE2DRECT */ - TEXTUREBUFFER = 546, /* TEXTUREBUFFER */ - ITEXTUREBUFFER = 547, /* ITEXTUREBUFFER */ - UTEXTUREBUFFER = 548, /* UTEXTUREBUFFER */ - TEXTURE2DMS = 549, /* TEXTURE2DMS */ - ITEXTURE2DMS = 550, /* ITEXTURE2DMS */ - UTEXTURE2DMS = 551, /* UTEXTURE2DMS */ - TEXTURE2DMSARRAY = 552, /* TEXTURE2DMSARRAY */ - ITEXTURE2DMSARRAY = 553, /* ITEXTURE2DMSARRAY */ - UTEXTURE2DMSARRAY = 554, /* UTEXTURE2DMSARRAY */ - F16TEXTURE1D = 555, /* F16TEXTURE1D */ - F16TEXTURE2D = 556, /* F16TEXTURE2D */ - F16TEXTURE3D = 557, /* F16TEXTURE3D */ - F16TEXTURE2DRECT = 558, /* F16TEXTURE2DRECT */ - F16TEXTURECUBE = 559, /* F16TEXTURECUBE */ - F16TEXTURE1DARRAY = 560, /* F16TEXTURE1DARRAY */ - F16TEXTURE2DARRAY = 561, /* F16TEXTURE2DARRAY */ - F16TEXTURECUBEARRAY = 562, /* F16TEXTURECUBEARRAY */ - F16TEXTUREBUFFER = 563, /* F16TEXTUREBUFFER */ - F16TEXTURE2DMS = 564, /* F16TEXTURE2DMS */ - F16TEXTURE2DMSARRAY = 565, /* F16TEXTURE2DMSARRAY */ - SUBPASSINPUT = 566, /* SUBPASSINPUT */ - SUBPASSINPUTMS = 567, /* SUBPASSINPUTMS */ - ISUBPASSINPUT = 568, /* ISUBPASSINPUT */ - ISUBPASSINPUTMS = 569, /* ISUBPASSINPUTMS */ - USUBPASSINPUT = 570, /* USUBPASSINPUT */ - USUBPASSINPUTMS = 571, /* USUBPASSINPUTMS */ - F16SUBPASSINPUT = 572, /* F16SUBPASSINPUT */ - F16SUBPASSINPUTMS = 573, /* F16SUBPASSINPUTMS */ - SPIRV_INSTRUCTION = 574, /* SPIRV_INSTRUCTION */ - SPIRV_EXECUTION_MODE = 575, /* SPIRV_EXECUTION_MODE */ - SPIRV_EXECUTION_MODE_ID = 576, /* SPIRV_EXECUTION_MODE_ID */ - SPIRV_DECORATE = 577, /* SPIRV_DECORATE */ - SPIRV_DECORATE_ID = 578, /* SPIRV_DECORATE_ID */ - SPIRV_DECORATE_STRING = 579, /* SPIRV_DECORATE_STRING */ - SPIRV_TYPE = 580, /* SPIRV_TYPE */ - SPIRV_STORAGE_CLASS = 581, /* SPIRV_STORAGE_CLASS */ - SPIRV_BY_REFERENCE = 582, /* SPIRV_BY_REFERENCE */ - SPIRV_LITERAL = 583, /* SPIRV_LITERAL */ - LEFT_OP = 584, /* LEFT_OP */ - RIGHT_OP = 585, /* RIGHT_OP */ - INC_OP = 586, /* INC_OP */ - DEC_OP = 587, /* DEC_OP */ - LE_OP = 588, /* LE_OP */ - GE_OP = 589, /* GE_OP */ - EQ_OP = 590, /* EQ_OP */ - NE_OP = 591, /* NE_OP */ - AND_OP = 592, /* AND_OP */ - OR_OP = 593, /* OR_OP */ - XOR_OP = 594, /* XOR_OP */ - MUL_ASSIGN = 595, /* MUL_ASSIGN */ - DIV_ASSIGN = 596, /* DIV_ASSIGN */ - ADD_ASSIGN = 597, /* ADD_ASSIGN */ - MOD_ASSIGN = 598, /* MOD_ASSIGN */ - LEFT_ASSIGN = 599, /* LEFT_ASSIGN */ - RIGHT_ASSIGN = 600, /* RIGHT_ASSIGN */ - AND_ASSIGN = 601, /* AND_ASSIGN */ - XOR_ASSIGN = 602, /* XOR_ASSIGN */ - OR_ASSIGN = 603, /* OR_ASSIGN */ - SUB_ASSIGN = 604, /* SUB_ASSIGN */ - STRING_LITERAL = 605, /* STRING_LITERAL */ - LEFT_PAREN = 606, /* LEFT_PAREN */ - RIGHT_PAREN = 607, /* RIGHT_PAREN */ - LEFT_BRACKET = 608, /* LEFT_BRACKET */ - RIGHT_BRACKET = 609, /* RIGHT_BRACKET */ - LEFT_BRACE = 610, /* LEFT_BRACE */ - RIGHT_BRACE = 611, /* RIGHT_BRACE */ - DOT = 612, /* DOT */ - COMMA = 613, /* COMMA */ - COLON = 614, /* COLON */ - EQUAL = 615, /* EQUAL */ - SEMICOLON = 616, /* SEMICOLON */ - BANG = 617, /* BANG */ - DASH = 618, /* DASH */ - TILDE = 619, /* TILDE */ - PLUS = 620, /* PLUS */ - STAR = 621, /* STAR */ - SLASH = 622, /* SLASH */ - PERCENT = 623, /* PERCENT */ - LEFT_ANGLE = 624, /* LEFT_ANGLE */ - RIGHT_ANGLE = 625, /* RIGHT_ANGLE */ - VERTICAL_BAR = 626, /* VERTICAL_BAR */ - CARET = 627, /* CARET */ - AMPERSAND = 628, /* AMPERSAND */ - QUESTION = 629, /* QUESTION */ - INVARIANT = 630, /* INVARIANT */ - HIGH_PRECISION = 631, /* HIGH_PRECISION */ - MEDIUM_PRECISION = 632, /* MEDIUM_PRECISION */ - LOW_PRECISION = 633, /* LOW_PRECISION */ - PRECISION = 634, /* PRECISION */ - PACKED = 635, /* PACKED */ - RESOURCE = 636, /* RESOURCE */ - SUPERP = 637, /* SUPERP */ - FLOATCONSTANT = 638, /* FLOATCONSTANT */ - INTCONSTANT = 639, /* INTCONSTANT */ - UINTCONSTANT = 640, /* UINTCONSTANT */ - BOOLCONSTANT = 641, /* BOOLCONSTANT */ - IDENTIFIER = 642, /* IDENTIFIER */ - TYPE_NAME = 643, /* TYPE_NAME */ - CENTROID = 644, /* CENTROID */ - IN = 645, /* IN */ - OUT = 646, /* OUT */ - INOUT = 647, /* INOUT */ - STRUCT = 648, /* STRUCT */ - VOID = 649, /* VOID */ - WHILE = 650, /* WHILE */ - BREAK = 651, /* BREAK */ - CONTINUE = 652, /* CONTINUE */ - DO = 653, /* DO */ - ELSE = 654, /* ELSE */ - FOR = 655, /* FOR */ - IF = 656, /* IF */ - DISCARD = 657, /* DISCARD */ - RETURN = 658, /* RETURN */ - SWITCH = 659, /* SWITCH */ - CASE = 660, /* CASE */ - DEFAULT = 661, /* DEFAULT */ - TERMINATE_INVOCATION = 662, /* TERMINATE_INVOCATION */ - TERMINATE_RAY = 663, /* TERMINATE_RAY */ - IGNORE_INTERSECTION = 664, /* IGNORE_INTERSECTION */ - UNIFORM = 665, /* UNIFORM */ - SHARED = 666, /* SHARED */ - BUFFER = 667, /* BUFFER */ - FLAT = 668, /* FLAT */ - SMOOTH = 669, /* SMOOTH */ - LAYOUT = 670, /* LAYOUT */ - DOUBLECONSTANT = 671, /* DOUBLECONSTANT */ - INT16CONSTANT = 672, /* INT16CONSTANT */ - UINT16CONSTANT = 673, /* UINT16CONSTANT */ - FLOAT16CONSTANT = 674, /* FLOAT16CONSTANT */ - INT32CONSTANT = 675, /* INT32CONSTANT */ - UINT32CONSTANT = 676, /* UINT32CONSTANT */ - INT64CONSTANT = 677, /* INT64CONSTANT */ - UINT64CONSTANT = 678, /* UINT64CONSTANT */ - SUBROUTINE = 679, /* SUBROUTINE */ - DEMOTE = 680, /* DEMOTE */ - PAYLOADNV = 681, /* PAYLOADNV */ - PAYLOADINNV = 682, /* PAYLOADINNV */ - HITATTRNV = 683, /* HITATTRNV */ - CALLDATANV = 684, /* CALLDATANV */ - CALLDATAINNV = 685, /* CALLDATAINNV */ - PAYLOADEXT = 686, /* PAYLOADEXT */ - PAYLOADINEXT = 687, /* PAYLOADINEXT */ - HITATTREXT = 688, /* HITATTREXT */ - CALLDATAEXT = 689, /* CALLDATAEXT */ - CALLDATAINEXT = 690, /* CALLDATAINEXT */ - PATCH = 691, /* PATCH */ - SAMPLE = 692, /* SAMPLE */ - NONUNIFORM = 693, /* NONUNIFORM */ - COHERENT = 694, /* COHERENT */ - VOLATILE = 695, /* VOLATILE */ - RESTRICT = 696, /* RESTRICT */ - READONLY = 697, /* READONLY */ - WRITEONLY = 698, /* WRITEONLY */ - DEVICECOHERENT = 699, /* DEVICECOHERENT */ - QUEUEFAMILYCOHERENT = 700, /* QUEUEFAMILYCOHERENT */ - WORKGROUPCOHERENT = 701, /* WORKGROUPCOHERENT */ - SUBGROUPCOHERENT = 702, /* SUBGROUPCOHERENT */ - NONPRIVATE = 703, /* NONPRIVATE */ - SHADERCALLCOHERENT = 704, /* SHADERCALLCOHERENT */ - NOPERSPECTIVE = 705, /* NOPERSPECTIVE */ - EXPLICITINTERPAMD = 706, /* EXPLICITINTERPAMD */ - PERVERTEXEXT = 707, /* PERVERTEXEXT */ - PERVERTEXNV = 708, /* PERVERTEXNV */ - PERPRIMITIVENV = 709, /* PERPRIMITIVENV */ - PERVIEWNV = 710, /* PERVIEWNV */ - PERTASKNV = 711, /* PERTASKNV */ - PERPRIMITIVEEXT = 712, /* PERPRIMITIVEEXT */ - TASKPAYLOADWORKGROUPEXT = 713, /* TASKPAYLOADWORKGROUPEXT */ - PRECISE = 714 /* PRECISE */ - }; - typedef enum yytokentype yytoken_kind_t; -#endif - -/* Value type. */ -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -union YYSTYPE -{ -#line 97 "MachineIndependent/glslang.y" - - struct { - glslang::TSourceLoc loc; - union { - glslang::TString *string; - int i; - unsigned int u; - long long i64; - unsigned long long u64; - bool b; - double d; - }; - glslang::TSymbol* symbol; - } lex; - struct { - glslang::TSourceLoc loc; - glslang::TOperator op; - union { - TIntermNode* intermNode; - glslang::TIntermNodePair nodePair; - glslang::TIntermTyped* intermTypedNode; - glslang::TAttributes* attributes; - glslang::TSpirvRequirement* spirvReq; - glslang::TSpirvInstruction* spirvInst; - glslang::TSpirvTypeParameters* spirvTypeParams; - }; - union { - glslang::TPublicType type; - glslang::TFunction* function; - glslang::TParameter param; - glslang::TTypeLoc typeLine; - glslang::TTypeList* typeList; - glslang::TArraySizes* arraySizes; - glslang::TIdentifierList* identifierList; - }; - glslang::TArraySizes* typeParameters; - } interm; - -#line 562 "MachineIndependent/glslang_tab.cpp.h" - -}; -typedef union YYSTYPE YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define YYSTYPE_IS_DECLARED 1 -#endif - - - -int yyparse (glslang::TParseContext* pParseContext); - -#endif /* !YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED */ diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/iomapper.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/iomapper.h deleted file mode 100644 index 0003a74..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/iomapper.h +++ /dev/null @@ -1,361 +0,0 @@ -// -// 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. -// - -#if !defined(GLSLANG_WEB) - -#ifndef _IOMAPPER_INCLUDED -#define _IOMAPPER_INCLUDED - -#include -#include "LiveTraverser.h" -#include -#include -// -// A reflection database and its interface, consistent with the OpenGL API reflection queries. -// - -class TInfoSink; - -namespace glslang { - -class TIntermediate; -struct TVarEntryInfo { - long long id; - TIntermSymbol* symbol; - bool live; - int newBinding; - int newSet; - int newLocation; - int newComponent; - int newIndex; - EShLanguage stage; - - void clearNewAssignments() { - newBinding = -1; - newSet = -1; - newLocation = -1; - newComponent = -1; - newIndex = -1; - } - - struct TOrderById { - inline bool operator()(const TVarEntryInfo& l, const TVarEntryInfo& r) { return l.id < r.id; } - }; - - struct TOrderByPriority { - // ordering: - // 1) has both binding and set - // 2) has binding but no set - // 3) has no binding but set - // 4) has no binding and no set - inline bool operator()(const TVarEntryInfo& l, const TVarEntryInfo& r) { - const TQualifier& lq = l.symbol->getQualifier(); - const TQualifier& rq = r.symbol->getQualifier(); - - // simple rules: - // has binding gives 2 points - // has set gives 1 point - // who has the most points is more important. - int lPoints = (lq.hasBinding() ? 2 : 0) + (lq.hasSet() ? 1 : 0); - int rPoints = (rq.hasBinding() ? 2 : 0) + (rq.hasSet() ? 1 : 0); - - if (lPoints == rPoints) - return l.id < r.id; - return lPoints > rPoints; - } - }; - - struct TOrderByPriorityAndLive { - // ordering: - // 1) do live variables first - // 2) has both binding and set - // 3) has binding but no set - // 4) has no binding but set - // 5) has no binding and no set - inline bool operator()(const TVarEntryInfo& l, const TVarEntryInfo& r) { - - const TQualifier& lq = l.symbol->getQualifier(); - const TQualifier& rq = r.symbol->getQualifier(); - - // simple rules: - // has binding gives 2 points - // has set gives 1 point - // who has the most points is more important. - int lPoints = (lq.hasBinding() ? 2 : 0) + (lq.hasSet() ? 1 : 0); - int rPoints = (rq.hasBinding() ? 2 : 0) + (rq.hasSet() ? 1 : 0); - - if (l.live != r.live) - return l.live > r.live; - - if (lPoints != rPoints) - return lPoints > rPoints; - - return l.id < r.id; - } - }; -}; - -// Base class for shared TIoMapResolver services, used by several derivations. -struct TDefaultIoResolverBase : public glslang::TIoMapResolver { -public: - TDefaultIoResolverBase(const TIntermediate& intermediate); - typedef std::vector TSlotSet; - typedef std::unordered_map TSlotSetMap; - - // grow the reflection stage by stage - void notifyBinding(EShLanguage, TVarEntryInfo& /*ent*/) override {} - void notifyInOut(EShLanguage, TVarEntryInfo& /*ent*/) override {} - void beginNotifications(EShLanguage) override {} - void endNotifications(EShLanguage) override {} - void beginResolve(EShLanguage) override {} - void endResolve(EShLanguage) override {} - void beginCollect(EShLanguage) override {} - void endCollect(EShLanguage) override {} - void reserverResourceSlot(TVarEntryInfo& /*ent*/, TInfoSink& /*infoSink*/) override {} - void reserverStorageSlot(TVarEntryInfo& /*ent*/, TInfoSink& /*infoSink*/) override {} - int getBaseBinding(EShLanguage stage, TResourceType res, unsigned int set) const; - const std::vector& getResourceSetBinding(EShLanguage stage) const; - virtual TResourceType getResourceType(const glslang::TType& type) = 0; - bool doAutoBindingMapping() const; - bool doAutoLocationMapping() const; - TSlotSet::iterator findSlot(int set, int slot); - bool checkEmpty(int set, int slot); - bool validateInOut(EShLanguage /*stage*/, TVarEntryInfo& /*ent*/) override { return true; } - int reserveSlot(int set, int slot, int size = 1); - int getFreeSlot(int set, int base, int size = 1); - int resolveSet(EShLanguage /*stage*/, TVarEntryInfo& ent) override; - int resolveUniformLocation(EShLanguage /*stage*/, TVarEntryInfo& ent) override; - int resolveInOutLocation(EShLanguage stage, TVarEntryInfo& ent) override; - int resolveInOutComponent(EShLanguage /*stage*/, TVarEntryInfo& ent) override; - int resolveInOutIndex(EShLanguage /*stage*/, TVarEntryInfo& ent) override; - void addStage(EShLanguage stage, TIntermediate& stageIntermediate) override { - if (stage < EShLangCount) { - stageMask[stage] = true; - stageIntermediates[stage] = &stageIntermediate; - } - } - uint32_t computeTypeLocationSize(const TType& type, EShLanguage stage); - - TSlotSetMap slots; - bool hasError = false; - -protected: - TDefaultIoResolverBase(TDefaultIoResolverBase&); - TDefaultIoResolverBase& operator=(TDefaultIoResolverBase&); - const TIntermediate& referenceIntermediate; - int nextUniformLocation; - int nextInputLocation; - int nextOutputLocation; - bool stageMask[EShLangCount + 1]; - const TIntermediate* stageIntermediates[EShLangCount]; - - // Return descriptor set specific base if there is one, and the generic base otherwise. - int selectBaseBinding(int base, int descriptorSetBase) const { - return descriptorSetBase != -1 ? descriptorSetBase : base; - } - - static int getLayoutSet(const glslang::TType& type) { - if (type.getQualifier().hasSet()) - return type.getQualifier().layoutSet; - else - return 0; - } - - static bool isSamplerType(const glslang::TType& type) { - return type.getBasicType() == glslang::EbtSampler && type.getSampler().isPureSampler(); - } - - static bool isTextureType(const glslang::TType& type) { - return (type.getBasicType() == glslang::EbtSampler && - (type.getSampler().isTexture() || type.getSampler().isSubpass())); - } - - static bool isUboType(const glslang::TType& type) { - return type.getQualifier().storage == EvqUniform; - } - - static bool isImageType(const glslang::TType& type) { - return type.getBasicType() == glslang::EbtSampler && type.getSampler().isImage(); - } - - static bool isSsboType(const glslang::TType& type) { - return type.getQualifier().storage == EvqBuffer; - } - - // Return true if this is a SRV (shader resource view) type: - static bool isSrvType(const glslang::TType& type) { - return isTextureType(type) || type.getQualifier().storage == EvqBuffer; - } - - // Return true if this is a UAV (unordered access view) type: - static bool isUavType(const glslang::TType& type) { - if (type.getQualifier().isReadOnly()) - return false; - return (type.getBasicType() == glslang::EbtSampler && type.getSampler().isImage()) || - (type.getQualifier().storage == EvqBuffer); - } -}; - -// Default I/O resolver for OpenGL -struct TDefaultGlslIoResolver : public TDefaultIoResolverBase { -public: - typedef std::map TVarSlotMap; // - typedef std::map TSlotMap; // - TDefaultGlslIoResolver(const TIntermediate& intermediate); - bool validateBinding(EShLanguage /*stage*/, TVarEntryInfo& /*ent*/) override { return true; } - TResourceType getResourceType(const glslang::TType& type) override; - int resolveInOutLocation(EShLanguage stage, TVarEntryInfo& ent) override; - int resolveUniformLocation(EShLanguage /*stage*/, TVarEntryInfo& ent) override; - int resolveBinding(EShLanguage /*stage*/, TVarEntryInfo& ent) override; - void beginResolve(EShLanguage /*stage*/) override; - void endResolve(EShLanguage stage) override; - void beginCollect(EShLanguage) override; - void endCollect(EShLanguage) override; - void reserverStorageSlot(TVarEntryInfo& ent, TInfoSink& infoSink) override; - void reserverResourceSlot(TVarEntryInfo& ent, TInfoSink& infoSink) override; - // in/out symbol and uniform symbol are stored in the same resourceSlotMap, the storage key is used to identify each type of symbol. - // We use stage and storage qualifier to construct a storage key. it can help us identify the same storage resource used in different stage. - // if a resource is a program resource and we don't need know it usage stage, we can use same stage to build storage key. - // Note: both stage and type must less then 0xffff. - int buildStorageKey(EShLanguage stage, TStorageQualifier type) { - assert(static_cast(stage) <= 0x0000ffff && static_cast(type) <= 0x0000ffff); - return (stage << 16) | type; - } - -protected: - // Use for mark pre stage, to get more interface symbol information. - EShLanguage preStage; - // Use for mark current shader stage for resolver - EShLanguage currentStage; - // Slot map for storage resource(location of uniform and interface symbol) It's a program share slot - TSlotMap resourceSlotMap; - // Slot map for other resource(image, ubo, ssbo), It's a program share slot. - TSlotMap storageSlotMap; -}; - -typedef std::map TVarLiveMap; - -// override function "operator=", if a vector being sort, -// when use vc++, the sort function will call : -// pair& operator=(const pair<_Other1, _Other2>& _Right) -// { -// first = _Right.first; -// second = _Right.second; -// return (*this); -// } -// that will make a const type handing on left. -// override this function can avoid a compiler error. -// In the future, if the vc++ compiler can handle such a situation, -// this part of the code will be removed. -struct TVarLivePair : std::pair { - TVarLivePair(const std::pair& _Right) : pair(_Right.first, _Right.second) {} - TVarLivePair& operator=(const TVarLivePair& _Right) { - const_cast(first) = _Right.first; - second = _Right.second; - return (*this); - } - TVarLivePair(const TVarLivePair& src) : pair(src) { } -}; -typedef std::vector TVarLiveVector; - -// I/O mapper -class TIoMapper { -public: - TIoMapper() {} - virtual ~TIoMapper() {} - // grow the reflection stage by stage - bool virtual addStage(EShLanguage, TIntermediate&, TInfoSink&, TIoMapResolver*); - bool virtual doMap(TIoMapResolver*, TInfoSink&) { return true; } -}; - -// I/O mapper for GLSL -class TGlslIoMapper : public TIoMapper { -public: - TGlslIoMapper() { - memset(inVarMaps, 0, sizeof(TVarLiveMap*) * (EShLangCount + 1)); - memset(outVarMaps, 0, sizeof(TVarLiveMap*) * (EShLangCount + 1)); - memset(uniformVarMap, 0, sizeof(TVarLiveMap*) * (EShLangCount + 1)); - memset(intermediates, 0, sizeof(TIntermediate*) * (EShLangCount + 1)); - profile = ENoProfile; - version = 0; - autoPushConstantMaxSize = 128; - autoPushConstantBlockPacking = ElpStd430; - } - virtual ~TGlslIoMapper() { - for (size_t stage = 0; stage < EShLangCount; stage++) { - if (inVarMaps[stage] != nullptr) { - delete inVarMaps[stage]; - inVarMaps[stage] = nullptr; - } - if (outVarMaps[stage] != nullptr) { - delete outVarMaps[stage]; - outVarMaps[stage] = nullptr; - } - if (uniformVarMap[stage] != nullptr) { - delete uniformVarMap[stage]; - uniformVarMap[stage] = nullptr; - } - if (intermediates[stage] != nullptr) - intermediates[stage] = nullptr; - } - } - // If set, the uniform block with the given name will be changed to be backed by - // push_constant if it's size is <= maxSize - void setAutoPushConstantBlock(const char* name, unsigned int maxSize, TLayoutPacking packing) { - autoPushConstantBlockName = name; - autoPushConstantMaxSize = maxSize; - autoPushConstantBlockPacking = packing; - } - // grow the reflection stage by stage - bool addStage(EShLanguage, TIntermediate&, TInfoSink&, TIoMapResolver*) override; - bool doMap(TIoMapResolver*, TInfoSink&) override; - TVarLiveMap *inVarMaps[EShLangCount], *outVarMaps[EShLangCount], - *uniformVarMap[EShLangCount]; - TIntermediate* intermediates[EShLangCount]; - bool hadError = false; - EProfile profile; - int version; - -private: - TString autoPushConstantBlockName; - unsigned int autoPushConstantMaxSize; - TLayoutPacking autoPushConstantBlockPacking; -}; - -} // end namespace glslang - -#endif // _IOMAPPER_INCLUDED - -#endif // !GLSLANG_WEB diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/localintermediate.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/localintermediate.h deleted file mode 100644 index 0c56997..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/localintermediate.h +++ /dev/null @@ -1,1293 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// Copyright (C) 2016 LunarG, Inc. -// Copyright (C) 2017 ARM Limited. -// Copyright (C) 2015-2018 Google, Inc. -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// -// Neither the name of 3Dlabs Inc. Ltd. nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// - -#ifndef _LOCAL_INTERMEDIATE_INCLUDED_ -#define _LOCAL_INTERMEDIATE_INCLUDED_ - -#include "../Include/intermediate.h" -#include "../Public/ShaderLang.h" -#include "Versions.h" - -#include -#include -#include -#include -#include - -class TInfoSink; - -namespace glslang { - -struct TMatrixSelector { - int coord1; // stay agnostic about column/row; this is parse order - int coord2; -}; - -typedef int TVectorSelector; - -const int MaxSwizzleSelectors = 4; - -template -class TSwizzleSelectors { -public: - TSwizzleSelectors() : size_(0) { } - - void push_back(selectorType comp) - { - if (size_ < MaxSwizzleSelectors) - components[size_++] = comp; - } - void resize(int s) - { - assert(s <= size_); - size_ = s; - } - int size() const { return size_; } - selectorType operator[](int i) const - { - assert(i < MaxSwizzleSelectors); - return components[i]; - } - -private: - int size_; - selectorType components[MaxSwizzleSelectors]; -}; - -// -// Some helper structures for TIntermediate. Their contents are encapsulated -// by TIntermediate. -// - -// Used for call-graph algorithms for detecting recursion, missing bodies, and dead bodies. -// A "call" is a pair: . -// There can be duplicates. General assumption is the list is small. -struct TCall { - TCall(const TString& pCaller, const TString& pCallee) : caller(pCaller), callee(pCallee) { } - TString caller; - TString callee; - bool visited; - bool currentPath; - bool errorGiven; - int calleeBodyPosition; -}; - -// A generic 1-D range. -struct TRange { - TRange(int start, int last) : start(start), last(last) { } - bool overlap(const TRange& rhs) const - { - return last >= rhs.start && start <= rhs.last; - } - int start; - int last; -}; - -// An IO range is a 3-D rectangle; the set of (location, component, index) triples all lying -// within the same location range, component range, and index value. Locations don't alias unless -// all other dimensions of their range overlap. -struct TIoRange { - TIoRange(TRange location, TRange component, TBasicType basicType, int index) - : location(location), component(component), basicType(basicType), index(index) { } - bool overlap(const TIoRange& rhs) const - { - return location.overlap(rhs.location) && component.overlap(rhs.component) && index == rhs.index; - } - TRange location; - TRange component; - TBasicType basicType; - int index; -}; - -// An offset range is a 2-D rectangle; the set of (binding, offset) pairs all lying -// within the same binding and offset range. -struct TOffsetRange { - TOffsetRange(TRange binding, TRange offset) - : binding(binding), offset(offset) { } - bool overlap(const TOffsetRange& rhs) const - { - return binding.overlap(rhs.binding) && offset.overlap(rhs.offset); - } - TRange binding; - TRange offset; -}; - -#ifndef GLSLANG_WEB -// Things that need to be tracked per xfb buffer. -struct TXfbBuffer { - TXfbBuffer() : stride(TQualifier::layoutXfbStrideEnd), implicitStride(0), contains64BitType(false), - contains32BitType(false), contains16BitType(false) { } - std::vector ranges; // byte offsets that have already been assigned - unsigned int stride; - unsigned int implicitStride; - bool contains64BitType; - bool contains32BitType; - bool contains16BitType; -}; -#endif - -// Track a set of strings describing how the module was processed. -// This includes command line options, transforms, etc., ideally inclusive enough -// to reproduce the steps used to transform the input source to the output. -// E.g., see SPIR-V OpModuleProcessed. -// Each "process" or "transform" uses is expressed in the form: -// process arg0 arg1 arg2 ... -// process arg0 arg1 arg2 ... -// where everything is textual, and there can be zero or more arguments -class TProcesses { -public: - TProcesses() {} - ~TProcesses() {} - - void addProcess(const char* process) - { - processes.push_back(process); - } - void addProcess(const std::string& process) - { - processes.push_back(process); - } - void addArgument(int arg) - { - processes.back().append(" "); - std::string argString = std::to_string(arg); - processes.back().append(argString); - } - void addArgument(const char* arg) - { - processes.back().append(" "); - processes.back().append(arg); - } - void addArgument(const std::string& arg) - { - processes.back().append(" "); - processes.back().append(arg); - } - void addIfNonZero(const char* process, int value) - { - if (value != 0) { - addProcess(process); - addArgument(value); - } - } - - const std::vector& getProcesses() const { return processes; } - -private: - std::vector processes; -}; - -class TSymbolTable; -class TSymbol; -class TVariable; - -// -// Texture and Sampler transformation mode. -// -enum ComputeDerivativeMode { - LayoutDerivativeNone, // default layout as SPV_NV_compute_shader_derivatives not enabled - LayoutDerivativeGroupQuads, // derivative_group_quadsNV - LayoutDerivativeGroupLinear, // derivative_group_linearNV -}; - -// -// Status type on AST level. Some uncalled status or functions would be reset in call graph. -// Currently we will keep status set by explicitly declared layout or variable decl. -// -enum AstRefType { - AstRefTypeVar, // Status set by variable decl - AstRefTypeFunc, // Status set by function decl - AstRefTypeLayout, // Status set by layout decl -}; - -class TIdMaps { -public: - TMap& operator[](long long i) { return maps[i]; } - const TMap& operator[](long long i) const { return maps[i]; } -private: - TMap maps[EsiCount]; -}; - -class TNumericFeatures { -public: - TNumericFeatures() : features(0) { } - TNumericFeatures(const TNumericFeatures&) = delete; - TNumericFeatures& operator=(const TNumericFeatures&) = delete; - typedef enum : unsigned int { - shader_explicit_arithmetic_types = 1 << 0, - shader_explicit_arithmetic_types_int8 = 1 << 1, - shader_explicit_arithmetic_types_int16 = 1 << 2, - shader_explicit_arithmetic_types_int32 = 1 << 3, - shader_explicit_arithmetic_types_int64 = 1 << 4, - shader_explicit_arithmetic_types_float16 = 1 << 5, - shader_explicit_arithmetic_types_float32 = 1 << 6, - shader_explicit_arithmetic_types_float64 = 1 << 7, - shader_implicit_conversions = 1 << 8, - gpu_shader_fp64 = 1 << 9, - gpu_shader_int16 = 1 << 10, - gpu_shader_half_float = 1 << 11, - } feature; - void insert(feature f) { features |= f; } - void erase(feature f) { features &= ~f; } - bool contains(feature f) const { return (features & f) != 0; } -private: - unsigned int features; -}; - -// MustBeAssigned wraps a T, asserting that it has been assigned with -// operator =() before attempting to read with operator T() or operator ->(). -// Used to catch cases where fields are read before they have been assigned. -template -class MustBeAssigned -{ -public: - MustBeAssigned() = default; - MustBeAssigned(const T& v) : value(v) {} - operator const T&() const { assert(isSet); return value; } - const T* operator ->() const { assert(isSet); return &value; } - MustBeAssigned& operator = (const T& v) { value = v; isSet = true; return *this; } -private: - T value; - bool isSet = false; -}; - -// -// Set of helper functions to help parse and build the tree. -// -class TIntermediate { -public: - explicit TIntermediate(EShLanguage l, int v = 0, EProfile p = ENoProfile) : - language(l), - profile(p), version(v), - treeRoot(nullptr), - resources(TBuiltInResource{}), - numEntryPoints(0), numErrors(0), numPushConstants(0), recursive(false), - invertY(false), - dxPositionW(false), - enhancedMsgs(false), - debugInfo(false), - useStorageBuffer(false), - invariantAll(false), - nanMinMaxClamp(false), - depthReplacing(false), - stencilReplacing(false), - uniqueId(0), - globalUniformBlockName(""), - atomicCounterBlockName(""), - globalUniformBlockSet(TQualifier::layoutSetEnd), - globalUniformBlockBinding(TQualifier::layoutBindingEnd), - atomicCounterBlockSet(TQualifier::layoutSetEnd) -#ifndef GLSLANG_WEB - , - implicitThisName("@this"), implicitCounterName("@count"), - source(EShSourceNone), - useVulkanMemoryModel(false), - invocations(TQualifier::layoutNotSet), vertices(TQualifier::layoutNotSet), - inputPrimitive(ElgNone), outputPrimitive(ElgNone), - pixelCenterInteger(false), originUpperLeft(false),texCoordBuiltinRedeclared(false), - vertexSpacing(EvsNone), vertexOrder(EvoNone), interlockOrdering(EioNone), pointMode(false), earlyFragmentTests(false), - postDepthCoverage(false), earlyAndLateFragmentTestsAMD(false), depthLayout(EldNone), stencilLayout(ElsNone), - hlslFunctionality1(false), - blendEquations(0), xfbMode(false), multiStream(false), - layoutOverrideCoverage(false), - geoPassthroughEXT(false), - numShaderRecordBlocks(0), - computeDerivativeMode(LayoutDerivativeNone), - primitives(TQualifier::layoutNotSet), - numTaskNVBlocks(0), - layoutPrimitiveCulling(false), - numTaskEXTPayloads(0), - autoMapBindings(false), - autoMapLocations(false), - flattenUniformArrays(false), - useUnknownFormat(false), - hlslOffsets(false), - hlslIoMapping(false), - useVariablePointers(false), - textureSamplerTransformMode(EShTexSampTransKeep), - needToLegalize(false), - binaryDoubleOutput(false), - subgroupUniformControlFlow(false), - usePhysicalStorageBuffer(false), - spirvRequirement(nullptr), - spirvExecutionMode(nullptr), - uniformLocationBase(0) -#endif - { - localSize[0] = 1; - localSize[1] = 1; - localSize[2] = 1; - localSizeNotDefault[0] = false; - localSizeNotDefault[1] = false; - localSizeNotDefault[2] = false; - localSizeSpecId[0] = TQualifier::layoutNotSet; - localSizeSpecId[1] = TQualifier::layoutNotSet; - localSizeSpecId[2] = TQualifier::layoutNotSet; -#ifndef GLSLANG_WEB - xfbBuffers.resize(TQualifier::layoutXfbBufferEnd); - shiftBinding.fill(0); -#endif - } - - void setVersion(int v) - { - version = v; - } - void setProfile(EProfile p) - { - profile = p; - } - - int getVersion() const { return version; } - EProfile getProfile() const { return profile; } - void setSpv(const SpvVersion& s) - { - spvVersion = s; - - // client processes - if (spvVersion.vulkan > 0) - processes.addProcess("client vulkan100"); - if (spvVersion.openGl > 0) - processes.addProcess("client opengl100"); - - // target SPV - switch (spvVersion.spv) { - case 0: - break; - case EShTargetSpv_1_0: - break; - case EShTargetSpv_1_1: - processes.addProcess("target-env spirv1.1"); - break; - case EShTargetSpv_1_2: - processes.addProcess("target-env spirv1.2"); - break; - case EShTargetSpv_1_3: - processes.addProcess("target-env spirv1.3"); - break; - case EShTargetSpv_1_4: - processes.addProcess("target-env spirv1.4"); - break; - case EShTargetSpv_1_5: - processes.addProcess("target-env spirv1.5"); - break; - case EShTargetSpv_1_6: - processes.addProcess("target-env spirv1.6"); - break; - default: - processes.addProcess("target-env spirvUnknown"); - break; - } - - // target-environment processes - switch (spvVersion.vulkan) { - case 0: - break; - case EShTargetVulkan_1_0: - processes.addProcess("target-env vulkan1.0"); - break; - case EShTargetVulkan_1_1: - processes.addProcess("target-env vulkan1.1"); - break; - case EShTargetVulkan_1_2: - processes.addProcess("target-env vulkan1.2"); - break; - case EShTargetVulkan_1_3: - processes.addProcess("target-env vulkan1.3"); - break; - default: - processes.addProcess("target-env vulkanUnknown"); - break; - } - if (spvVersion.openGl > 0) - processes.addProcess("target-env opengl"); - } - const SpvVersion& getSpv() const { return spvVersion; } - EShLanguage getStage() const { return language; } - void addRequestedExtension(const char* extension) { requestedExtensions.insert(extension); } - const std::set& getRequestedExtensions() const { return requestedExtensions; } - bool isRayTracingStage() const { - return language >= EShLangRayGen && language <= EShLangCallableNV; - } - - void setTreeRoot(TIntermNode* r) { treeRoot = r; } - TIntermNode* getTreeRoot() const { return treeRoot; } - void incrementEntryPointCount() { ++numEntryPoints; } - int getNumEntryPoints() const { return numEntryPoints; } - int getNumErrors() const { return numErrors; } - void addPushConstantCount() { ++numPushConstants; } - void setLimits(const TBuiltInResource& r) { resources = r; } - const TBuiltInResource& getLimits() const { return resources; } - - bool postProcess(TIntermNode*, EShLanguage); - void removeTree(); - - void setEntryPointName(const char* ep) - { - entryPointName = ep; - processes.addProcess("entry-point"); - processes.addArgument(entryPointName); - } - void setEntryPointMangledName(const char* ep) { entryPointMangledName = ep; } - const std::string& getEntryPointName() const { return entryPointName; } - const std::string& getEntryPointMangledName() const { return entryPointMangledName; } - - void setDebugInfo(bool debuginfo) - { - debugInfo = debuginfo; - } - bool getDebugInfo() const { return debugInfo; } - - void setInvertY(bool invert) - { - invertY = invert; - if (invertY) - processes.addProcess("invert-y"); - } - bool getInvertY() const { return invertY; } - - void setDxPositionW(bool dxPosW) - { - dxPositionW = dxPosW; - if (dxPositionW) - processes.addProcess("dx-position-w"); - } - bool getDxPositionW() const { return dxPositionW; } - - void setEnhancedMsgs() - { - enhancedMsgs = true; - } - bool getEnhancedMsgs() const { return enhancedMsgs && getSource() == EShSourceGlsl; } - -#ifdef ENABLE_HLSL - void setSource(EShSource s) { source = s; } - EShSource getSource() const { return source; } -#else - void setSource(EShSource s) { assert(s == EShSourceGlsl); (void)s; } - EShSource getSource() const { return EShSourceGlsl; } -#endif - - bool isRecursive() const { return recursive; } - - TIntermSymbol* addSymbol(const TVariable&); - TIntermSymbol* addSymbol(const TVariable&, const TSourceLoc&); - TIntermSymbol* addSymbol(const TType&, const TSourceLoc&); - TIntermSymbol* addSymbol(const TIntermSymbol&); - TIntermTyped* addConversion(TOperator, const TType&, TIntermTyped*); - std::tuple addPairConversion(TOperator op, TIntermTyped* node0, TIntermTyped* node1); - TIntermTyped* addUniShapeConversion(TOperator, const TType&, TIntermTyped*); - TIntermTyped* addConversion(TBasicType convertTo, TIntermTyped* node) const; - void addBiShapeConversion(TOperator, TIntermTyped*& lhsNode, TIntermTyped*& rhsNode); - TIntermTyped* addShapeConversion(const TType&, TIntermTyped*); - TIntermTyped* addBinaryMath(TOperator, TIntermTyped* left, TIntermTyped* right, const TSourceLoc&); - TIntermTyped* addAssign(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc&); - TIntermTyped* addIndex(TOperator op, TIntermTyped* base, TIntermTyped* index, const TSourceLoc&); - TIntermTyped* addUnaryMath(TOperator, TIntermTyped* child, const TSourceLoc&); - TIntermTyped* addBuiltInFunctionCall(const TSourceLoc& line, TOperator, bool unary, TIntermNode*, const TType& returnType); - bool canImplicitlyPromote(TBasicType from, TBasicType to, TOperator op = EOpNull) const; - bool isIntegralPromotion(TBasicType from, TBasicType to) const; - bool isFPPromotion(TBasicType from, TBasicType to) const; - bool isIntegralConversion(TBasicType from, TBasicType to) const; - bool isFPConversion(TBasicType from, TBasicType to) const; - bool isFPIntegralConversion(TBasicType from, TBasicType to) const; - TOperator mapTypeToConstructorOp(const TType&) const; - TIntermAggregate* growAggregate(TIntermNode* left, TIntermNode* right); - TIntermAggregate* growAggregate(TIntermNode* left, TIntermNode* right, const TSourceLoc&); - TIntermAggregate* makeAggregate(TIntermNode* node); - TIntermAggregate* makeAggregate(TIntermNode* node, const TSourceLoc&); - TIntermAggregate* makeAggregate(const TSourceLoc&); - TIntermTyped* setAggregateOperator(TIntermNode*, TOperator, const TType& type, const TSourceLoc&); - bool areAllChildConst(TIntermAggregate* aggrNode); - TIntermSelection* addSelection(TIntermTyped* cond, TIntermNodePair code, const TSourceLoc&); - TIntermTyped* addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock, const TSourceLoc&); - TIntermTyped* addComma(TIntermTyped* left, TIntermTyped* right, const TSourceLoc&); - TIntermTyped* addMethod(TIntermTyped*, const TType&, const TString*, const TSourceLoc&); - TIntermConstantUnion* addConstantUnion(const TConstUnionArray&, const TType&, const TSourceLoc&, bool literal = false) const; - TIntermConstantUnion* addConstantUnion(signed char, const TSourceLoc&, bool literal = false) const; - TIntermConstantUnion* addConstantUnion(unsigned char, const TSourceLoc&, bool literal = false) const; - TIntermConstantUnion* addConstantUnion(signed short, const TSourceLoc&, bool literal = false) const; - TIntermConstantUnion* addConstantUnion(unsigned short, 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; - TIntermConstantUnion* addConstantUnion(const TString*, const TSourceLoc&, bool literal = false) const; - 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&, TIntermLoop*&); - TIntermBranch* addBranch(TOperator, const TSourceLoc&); - TIntermBranch* addBranch(TOperator, TIntermTyped*, const TSourceLoc&); - template TIntermTyped* addSwizzle(TSwizzleSelectors&, const TSourceLoc&); - - // Low level functions to add nodes (no conversions or other higher level transformations) - // If a type is provided, the node's type will be set to it. - TIntermBinary* addBinaryNode(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc&) const; - TIntermBinary* addBinaryNode(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc&, - const TType&) const; - TIntermUnary* addUnaryNode(TOperator op, TIntermTyped* child, const TSourceLoc&) const; - TIntermUnary* addUnaryNode(TOperator op, TIntermTyped* child, const TSourceLoc&, const TType&) const; - - // Constant folding (in Constant.cpp) - TIntermTyped* fold(TIntermAggregate* aggrNode); - TIntermTyped* foldConstructor(TIntermAggregate* aggrNode); - TIntermTyped* foldDereference(TIntermTyped* node, int index, const TSourceLoc&); - TIntermTyped* foldSwizzle(TIntermTyped* node, TSwizzleSelectors& fields, const TSourceLoc&); - - // Tree ops - static const TIntermTyped* findLValueBase(const TIntermTyped*, bool swizzleOkay , bool BufferReferenceOk = false); - - // Linkage related - void addSymbolLinkageNodes(TIntermAggregate*& linkage, EShLanguage, TSymbolTable&); - void addSymbolLinkageNode(TIntermAggregate*& linkage, const TSymbol&); - TIntermAggregate* findLinkerObjects() const; - - void setGlobalUniformBlockName(const char* name) { globalUniformBlockName = std::string(name); } - const char* getGlobalUniformBlockName() const { return globalUniformBlockName.c_str(); } - void setGlobalUniformSet(unsigned int set) { globalUniformBlockSet = set; } - unsigned int getGlobalUniformSet() const { return globalUniformBlockSet; } - void setGlobalUniformBinding(unsigned int binding) { globalUniformBlockBinding = binding; } - unsigned int getGlobalUniformBinding() const { return globalUniformBlockBinding; } - - void setAtomicCounterBlockName(const char* name) { atomicCounterBlockName = std::string(name); } - const char* getAtomicCounterBlockName() const { return atomicCounterBlockName.c_str(); } - void setAtomicCounterBlockSet(unsigned int set) { atomicCounterBlockSet = set; } - unsigned int getAtomicCounterBlockSet() const { return atomicCounterBlockSet; } - - - void setUseStorageBuffer() { useStorageBuffer = true; } - bool usingStorageBuffer() const { return useStorageBuffer; } - void setInvariantAll() { invariantAll = true; } - bool isInvariantAll() const { return invariantAll; } - void setDepthReplacing() { depthReplacing = true; } - bool isDepthReplacing() const { return depthReplacing; } - void setStencilReplacing() { stencilReplacing = true; } - bool isStencilReplacing() const { return stencilReplacing; } - bool setLocalSize(int dim, int size) - { - if (localSizeNotDefault[dim]) - return size == localSize[dim]; - localSizeNotDefault[dim] = true; - localSize[dim] = size; - return true; - } - unsigned int getLocalSize(int dim) const { return localSize[dim]; } - bool isLocalSizeSet() const - { - // Return true if any component has been set (i.e. any component is not default). - return localSizeNotDefault[0] || localSizeNotDefault[1] || localSizeNotDefault[2]; - } - bool setLocalSizeSpecId(int dim, int id) - { - if (localSizeSpecId[dim] != TQualifier::layoutNotSet) - return id == localSizeSpecId[dim]; - localSizeSpecId[dim] = id; - return true; - } - int getLocalSizeSpecId(int dim) const { return localSizeSpecId[dim]; } - bool isLocalSizeSpecialized() const - { - // Return true if any component has been specialized. - return localSizeSpecId[0] != TQualifier::layoutNotSet || - localSizeSpecId[1] != TQualifier::layoutNotSet || - localSizeSpecId[2] != TQualifier::layoutNotSet; - } -#ifdef GLSLANG_WEB - void output(TInfoSink&, bool tree) { } - - bool isEsProfile() const { return false; } - bool getXfbMode() const { return false; } - bool isMultiStream() const { return false; } - TLayoutGeometry getOutputPrimitive() const { return ElgNone; } - bool getPostDepthCoverage() const { return false; } - bool getEarlyFragmentTests() const { return false; } - TLayoutDepth getDepth() const { return EldNone; } - bool getPixelCenterInteger() const { return false; } - void setOriginUpperLeft() { } - bool getOriginUpperLeft() const { return true; } - TInterlockOrdering getInterlockOrdering() const { return EioNone; } - - bool getAutoMapBindings() const { return false; } - bool getAutoMapLocations() const { return false; } - int getNumPushConstants() const { return 0; } - void addShaderRecordCount() { } - void addTaskNVCount() { } - void addTaskPayloadEXTCount() { } - void setUseVulkanMemoryModel() { } - bool usingVulkanMemoryModel() const { return false; } - bool usingPhysicalStorageBuffer() const { return false; } - bool usingVariablePointers() const { return false; } - unsigned getXfbStride(int buffer) const { return 0; } - bool hasLayoutDerivativeModeNone() const { return false; } - ComputeDerivativeMode getLayoutDerivativeModeNone() const { return LayoutDerivativeNone; } -#else - void output(TInfoSink&, bool tree); - - bool isEsProfile() const { return profile == EEsProfile; } - - void setShiftBinding(TResourceType res, unsigned int shift) - { - shiftBinding[res] = shift; - - const char* name = getResourceName(res); - if (name != nullptr) - processes.addIfNonZero(name, shift); - } - - unsigned int getShiftBinding(TResourceType res) const { return shiftBinding[res]; } - - void setShiftBindingForSet(TResourceType res, unsigned int shift, unsigned int set) - { - if (shift == 0) // ignore if there's no shift: it's a no-op. - return; - - shiftBindingForSet[res][set] = shift; - - const char* name = getResourceName(res); - if (name != nullptr) { - processes.addProcess(name); - processes.addArgument(shift); - processes.addArgument(set); - } - } - - int getShiftBindingForSet(TResourceType res, unsigned int set) const - { - const auto shift = shiftBindingForSet[res].find(set); - return shift == shiftBindingForSet[res].end() ? -1 : shift->second; - } - bool hasShiftBindingForSet(TResourceType res) const { return !shiftBindingForSet[res].empty(); } - - void setResourceSetBinding(const std::vector& shift) - { - resourceSetBinding = shift; - if (shift.size() > 0) { - processes.addProcess("resource-set-binding"); - for (int s = 0; s < (int)shift.size(); ++s) - processes.addArgument(shift[s]); - } - } - const std::vector& getResourceSetBinding() const { return resourceSetBinding; } - void setAutoMapBindings(bool map) - { - autoMapBindings = map; - if (autoMapBindings) - processes.addProcess("auto-map-bindings"); - } - bool getAutoMapBindings() const { return autoMapBindings; } - void setAutoMapLocations(bool map) - { - autoMapLocations = map; - if (autoMapLocations) - processes.addProcess("auto-map-locations"); - } - bool getAutoMapLocations() const { return autoMapLocations; } - -#ifdef ENABLE_HLSL - void setFlattenUniformArrays(bool flatten) - { - flattenUniformArrays = flatten; - if (flattenUniformArrays) - processes.addProcess("flatten-uniform-arrays"); - } - bool getFlattenUniformArrays() const { return flattenUniformArrays; } -#endif - void setNoStorageFormat(bool b) - { - useUnknownFormat = b; - if (useUnknownFormat) - processes.addProcess("no-storage-format"); - } - bool getNoStorageFormat() const { return useUnknownFormat; } - void setUseVulkanMemoryModel() - { - useVulkanMemoryModel = true; - processes.addProcess("use-vulkan-memory-model"); - } - bool usingVulkanMemoryModel() const { return useVulkanMemoryModel; } - void setUsePhysicalStorageBuffer() - { - usePhysicalStorageBuffer = true; - } - bool usingPhysicalStorageBuffer() const { return usePhysicalStorageBuffer; } - void setUseVariablePointers() - { - useVariablePointers = true; - processes.addProcess("use-variable-pointers"); - } - // Set the global flag for bindless texture - void setBindlessTextureMode(const TString& currentCaller, AstRefType type) - { - // When type is not func, currentCaller should be "" (empty string) - bindlessTextureModeCaller[currentCaller] = type; - } - - // Get the global flag for bindless texture - bool getBindlessTextureMode() const - { - return (bindlessTextureModeCaller.size() > 0); - } - - // Set the global flag for bindless image - void setBindlessImageMode(const TString& currentCaller, AstRefType type) - { - // When type is not func, currentCaller should be "" (empty string) - bindlessImageModeCaller[currentCaller] = type; - } - - // Get the global flag for bindless image - bool getBindlessImageMode() const - { - return (bindlessImageModeCaller.size() > 0); - } - - // Get the global flag for bindless texture - bool resetTopLevelUncalledStatus(const TString& deadCaller) - { - // For reflection collection purpose, currently uniform layout setting and some - // flags introduced by variables (IO, global, etc,.) won't be reset here. - // Remove each global status (AST top level) introduced by uncalled functions. - // If a status is set by several functions, keep those which in call graph. - bool result = false; - - // For two types of bindless mode flag, we would only reset which is set by an uncalled function. - // If one status flag's key in caller vec is empty, it should be come from a non-function setting. - if (!bindlessTextureModeCaller.empty()) { - auto caller = bindlessTextureModeCaller.find(deadCaller); - if (caller != bindlessTextureModeCaller.end() && bindlessTextureModeCaller[deadCaller] == AstRefTypeFunc) { - bindlessTextureModeCaller.erase(caller); - result = true; - } - } - if (!bindlessImageModeCaller.empty()) { - auto caller = bindlessImageModeCaller.find(deadCaller); - if (caller != bindlessImageModeCaller.end() && bindlessImageModeCaller[deadCaller] == AstRefTypeFunc) { - bindlessImageModeCaller.erase(caller); - result = true; - } - } - return result; - } - - bool getBindlessMode() const - { - return getBindlessTextureMode() || getBindlessImageMode(); - } - - bool usingVariablePointers() const { return useVariablePointers; } - -#ifdef ENABLE_HLSL - template T addCounterBufferName(const T& name) const { return name + implicitCounterName; } - bool hasCounterBufferName(const TString& name) const { - size_t len = strlen(implicitCounterName); - return name.size() > len && - name.compare(name.size() - len, len, implicitCounterName) == 0; - } -#endif - - void setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode) { textureSamplerTransformMode = mode; } - int getNumPushConstants() const { return numPushConstants; } - void addShaderRecordCount() { ++numShaderRecordBlocks; } - void addTaskNVCount() { ++numTaskNVBlocks; } - void addTaskPayloadEXTCount() { ++numTaskEXTPayloads; } - - bool setInvocations(int i) - { - if (invocations != TQualifier::layoutNotSet) - return invocations == i; - invocations = i; - return true; - } - int getInvocations() const { return invocations; } - bool setVertices(int m) - { - if (vertices != TQualifier::layoutNotSet) - return vertices == m; - vertices = m; - return true; - } - int getVertices() const { return vertices; } - bool setInputPrimitive(TLayoutGeometry p) - { - if (inputPrimitive != ElgNone) - return inputPrimitive == p; - inputPrimitive = p; - return true; - } - TLayoutGeometry getInputPrimitive() const { return inputPrimitive; } - bool setVertexSpacing(TVertexSpacing s) - { - if (vertexSpacing != EvsNone) - return vertexSpacing == s; - vertexSpacing = s; - return true; - } - TVertexSpacing getVertexSpacing() const { return vertexSpacing; } - bool setVertexOrder(TVertexOrder o) - { - if (vertexOrder != EvoNone) - return vertexOrder == o; - vertexOrder = o; - return true; - } - TVertexOrder getVertexOrder() const { return vertexOrder; } - void setPointMode() { pointMode = true; } - bool getPointMode() const { return pointMode; } - - bool setInterlockOrdering(TInterlockOrdering o) - { - if (interlockOrdering != EioNone) - return interlockOrdering == o; - interlockOrdering = o; - return true; - } - TInterlockOrdering getInterlockOrdering() const { return interlockOrdering; } - - void setXfbMode() { xfbMode = true; } - bool getXfbMode() const { return xfbMode; } - void setMultiStream() { multiStream = true; } - bool isMultiStream() const { return multiStream; } - bool setOutputPrimitive(TLayoutGeometry p) - { - if (outputPrimitive != ElgNone) - return outputPrimitive == p; - outputPrimitive = p; - return true; - } - TLayoutGeometry getOutputPrimitive() const { return outputPrimitive; } - void setPostDepthCoverage() { postDepthCoverage = true; } - bool getPostDepthCoverage() const { return postDepthCoverage; } - void setEarlyFragmentTests() { earlyFragmentTests = true; } - void setEarlyAndLateFragmentTestsAMD() { earlyAndLateFragmentTestsAMD = true; } - bool getEarlyFragmentTests() const { return earlyFragmentTests; } - bool getEarlyAndLateFragmentTestsAMD() const { return earlyAndLateFragmentTestsAMD; } - bool setDepth(TLayoutDepth d) - { - if (depthLayout != EldNone) - return depthLayout == d; - depthLayout = d; - return true; - } - bool setStencil(TLayoutStencil s) - { - if (stencilLayout != ElsNone) - return stencilLayout == s; - stencilLayout = s; - return true; - } - TLayoutDepth getDepth() const { return depthLayout; } - TLayoutStencil getStencil() const { return stencilLayout; } - void setOriginUpperLeft() { originUpperLeft = true; } - bool getOriginUpperLeft() const { return originUpperLeft; } - void setPixelCenterInteger() { pixelCenterInteger = true; } - bool getPixelCenterInteger() const { return pixelCenterInteger; } - void setTexCoordRedeclared() { texCoordBuiltinRedeclared = true; } - bool getTexCoordRedeclared() const { return texCoordBuiltinRedeclared; } - void addBlendEquation(TBlendEquationShift b) { blendEquations |= (1 << b); } - unsigned int getBlendEquations() const { return blendEquations; } - bool setXfbBufferStride(int buffer, unsigned stride) - { - if (xfbBuffers[buffer].stride != TQualifier::layoutXfbStrideEnd) - return xfbBuffers[buffer].stride == stride; - xfbBuffers[buffer].stride = stride; - return true; - } - unsigned getXfbStride(int buffer) const { return xfbBuffers[buffer].stride; } - int addXfbBufferOffset(const TType&); - unsigned int computeTypeXfbSize(const TType&, bool& contains64BitType, bool& contains32BitType, bool& contains16BitType) const; - unsigned int computeTypeXfbSize(const TType&, bool& contains64BitType) const; - void setLayoutOverrideCoverage() { layoutOverrideCoverage = true; } - bool getLayoutOverrideCoverage() const { return layoutOverrideCoverage; } - void setGeoPassthroughEXT() { geoPassthroughEXT = true; } - bool getGeoPassthroughEXT() const { return geoPassthroughEXT; } - void setLayoutDerivativeMode(ComputeDerivativeMode mode) { computeDerivativeMode = mode; } - bool hasLayoutDerivativeModeNone() const { return computeDerivativeMode != LayoutDerivativeNone; } - ComputeDerivativeMode getLayoutDerivativeModeNone() const { return computeDerivativeMode; } - void setLayoutPrimitiveCulling() { layoutPrimitiveCulling = true; } - bool getLayoutPrimitiveCulling() const { return layoutPrimitiveCulling; } - bool setPrimitives(int m) - { - if (primitives != TQualifier::layoutNotSet) - return primitives == m; - primitives = m; - return true; - } - int getPrimitives() const { return primitives; } - const char* addSemanticName(const TString& name) - { - return semanticNameSet.insert(name).first->c_str(); - } - void addUniformLocationOverride(const char* nameStr, int location) - { - std::string name = nameStr; - uniformLocationOverrides[name] = location; - } - - int getUniformLocationOverride(const char* nameStr) const - { - std::string name = nameStr; - auto pos = uniformLocationOverrides.find(name); - if (pos == uniformLocationOverrides.end()) - return -1; - else - return pos->second; - } - - void setUniformLocationBase(int base) { uniformLocationBase = base; } - int getUniformLocationBase() const { return uniformLocationBase; } - - void setNeedsLegalization() { needToLegalize = true; } - bool needsLegalization() const { return needToLegalize; } - - void setBinaryDoubleOutput() { binaryDoubleOutput = true; } - bool getBinaryDoubleOutput() { return binaryDoubleOutput; } - - void setSubgroupUniformControlFlow() { subgroupUniformControlFlow = true; } - bool getSubgroupUniformControlFlow() const { return subgroupUniformControlFlow; } - - // GL_EXT_spirv_intrinsics - void insertSpirvRequirement(const TSpirvRequirement* spirvReq); - bool hasSpirvRequirement() const { return spirvRequirement != nullptr; } - const TSpirvRequirement& getSpirvRequirement() const { return *spirvRequirement; } - void insertSpirvExecutionMode(int executionMode, const TIntermAggregate* args = nullptr); - void insertSpirvExecutionModeId(int executionMode, const TIntermAggregate* args); - bool hasSpirvExecutionMode() const { return spirvExecutionMode != nullptr; } - const TSpirvExecutionMode& getSpirvExecutionMode() const { return *spirvExecutionMode; } -#endif // GLSLANG_WEB - - void addBlockStorageOverride(const char* nameStr, TBlockStorageClass backing) - { - std::string name(nameStr); - blockBackingOverrides[name] = backing; - } - TBlockStorageClass getBlockStorageOverride(const char* nameStr) const - { - std::string name = nameStr; - auto pos = blockBackingOverrides.find(name); - if (pos == blockBackingOverrides.end()) - return EbsNone; - else - return pos->second; - } -#ifdef ENABLE_HLSL - void setHlslFunctionality1() { hlslFunctionality1 = true; } - bool getHlslFunctionality1() const { return hlslFunctionality1; } - void setHlslOffsets() - { - hlslOffsets = true; - if (hlslOffsets) - processes.addProcess("hlsl-offsets"); - } - bool usingHlslOffsets() const { return hlslOffsets; } - void setHlslIoMapping(bool b) - { - hlslIoMapping = b; - if (hlslIoMapping) - processes.addProcess("hlsl-iomap"); - } - bool usingHlslIoMapping() { return hlslIoMapping; } -#else - bool getHlslFunctionality1() const { return false; } - bool usingHlslOffsets() const { return false; } - bool usingHlslIoMapping() { return false; } -#endif - - bool usingScalarBlockLayout() const { - for (auto extIt = requestedExtensions.begin(); extIt != requestedExtensions.end(); ++extIt) { - if (*extIt == E_GL_EXT_scalar_block_layout) - return true; - } - return false; - } - - bool IsRequestedExtension(const char* extension) const - { - return (requestedExtensions.find(extension) != requestedExtensions.end()); - } - - void addToCallGraph(TInfoSink&, const TString& caller, const TString& callee); - void merge(TInfoSink&, TIntermediate&); - void finalCheck(TInfoSink&, bool keepUncalled); - - void mergeGlobalUniformBlocks(TInfoSink& infoSink, TIntermediate& unit, bool mergeExistingOnly); - void mergeUniformObjects(TInfoSink& infoSink, TIntermediate& unit); - void checkStageIO(TInfoSink&, TIntermediate&); - - bool buildConvertOp(TBasicType dst, TBasicType src, TOperator& convertOp) const; - TIntermTyped* createConversion(TBasicType convertTo, TIntermTyped* node) const; - - void addIoAccessed(const TString& name) { ioAccessed.insert(name); } - bool inIoAccessed(const TString& name) const { return ioAccessed.find(name) != ioAccessed.end(); } - - int addUsedLocation(const TQualifier&, const TType&, bool& typeCollision); - int checkLocationRange(int set, const TIoRange& range, const TType&, bool& typeCollision); - int checkLocationRT(int set, int location); - int addUsedOffsets(int binding, int offset, int numOffsets); - bool addUsedConstantId(int id); - static int computeTypeLocationSize(const TType&, EShLanguage); - static int computeTypeUniformLocationSize(const TType&); - - static int getBaseAlignmentScalar(const TType&, int& size); - static int getBaseAlignment(const TType&, int& size, int& stride, TLayoutPacking layoutPacking, bool rowMajor); - static int getScalarAlignment(const TType&, int& size, int& stride, bool rowMajor); - static int getMemberAlignment(const TType&, int& size, int& stride, TLayoutPacking layoutPacking, bool rowMajor); - static bool improperStraddle(const TType& type, int size, int offset); - static void updateOffset(const TType& parentType, const TType& memberType, int& offset, int& memberSize); - static int getOffset(const TType& type, int index); - static int getBlockSize(const TType& blockType); - static int computeBufferReferenceTypeSize(const TType&); - static bool isIoResizeArray(const TType& type, EShLanguage language); - - bool promote(TIntermOperator*); - void setNanMinMaxClamp(bool setting) { nanMinMaxClamp = setting; } - bool getNanMinMaxClamp() const { return nanMinMaxClamp; } - - void setSourceFile(const char* file) { if (file != nullptr) sourceFile = file; } - const std::string& getSourceFile() const { return sourceFile; } - void addSourceText(const char* text, size_t len) { sourceText.append(text, len); } - const std::string& getSourceText() const { return sourceText; } - const std::map& getIncludeText() const { return includeText; } - void addIncludeText(const char* name, const char* text, size_t len) { includeText[name].assign(text,len); } - void addProcesses(const std::vector& p) - { - for (int i = 0; i < (int)p.size(); ++i) - processes.addProcess(p[i]); - } - void addProcess(const std::string& process) { processes.addProcess(process); } - void addProcessArgument(const std::string& arg) { processes.addArgument(arg); } - const std::vector& getProcesses() const { return processes.getProcesses(); } - unsigned long long getUniqueId() const { return uniqueId; } - void setUniqueId(unsigned long long id) { uniqueId = id; } - - // Certain explicit conversions are allowed conditionally -#ifdef GLSLANG_WEB - bool getArithemeticInt8Enabled() const { return false; } - bool getArithemeticInt16Enabled() const { return false; } - bool getArithemeticFloat16Enabled() const { return false; } - void updateNumericFeature(TNumericFeatures::feature f, bool on) { } -#else - bool getArithemeticInt8Enabled() const { - return numericFeatures.contains(TNumericFeatures::shader_explicit_arithmetic_types) || - numericFeatures.contains(TNumericFeatures::shader_explicit_arithmetic_types_int8); - } - bool getArithemeticInt16Enabled() const { - return numericFeatures.contains(TNumericFeatures::shader_explicit_arithmetic_types) || - numericFeatures.contains(TNumericFeatures::gpu_shader_int16) || - numericFeatures.contains(TNumericFeatures::shader_explicit_arithmetic_types_int16); - } - - bool getArithemeticFloat16Enabled() const { - return numericFeatures.contains(TNumericFeatures::shader_explicit_arithmetic_types) || - numericFeatures.contains(TNumericFeatures::gpu_shader_half_float) || - numericFeatures.contains(TNumericFeatures::shader_explicit_arithmetic_types_float16); - } - void updateNumericFeature(TNumericFeatures::feature f, bool on) - { on ? numericFeatures.insert(f) : numericFeatures.erase(f); } -#endif - -protected: - TIntermSymbol* addSymbol(long long Id, const TString&, const TType&, const TConstUnionArray&, TIntermTyped* subtree, const TSourceLoc&); - void error(TInfoSink& infoSink, const char*, EShLanguage unitStage = EShLangCount); - void warn(TInfoSink& infoSink, const char*, EShLanguage unitStage = EShLangCount); - void mergeCallGraphs(TInfoSink&, TIntermediate&); - void mergeModes(TInfoSink&, TIntermediate&); - void mergeTrees(TInfoSink&, TIntermediate&); - void seedIdMap(TIdMaps& idMaps, long long& IdShift); - void remapIds(const TIdMaps& idMaps, long long idShift, TIntermediate&); - void mergeBodies(TInfoSink&, TIntermSequence& globals, const TIntermSequence& unitGlobals); - void mergeLinkerObjects(TInfoSink&, TIntermSequence& linkerObjects, const TIntermSequence& unitLinkerObjects, EShLanguage); - void mergeBlockDefinitions(TInfoSink&, TIntermSymbol* block, TIntermSymbol* unitBlock, TIntermediate* unitRoot); - void mergeImplicitArraySizes(TType&, const TType&); - void mergeErrorCheck(TInfoSink&, const TIntermSymbol&, const TIntermSymbol&, EShLanguage); - void checkCallGraphCycles(TInfoSink&); - void checkCallGraphBodies(TInfoSink&, bool keepUncalled); - void inOutLocationCheck(TInfoSink&); - void sharedBlockCheck(TInfoSink&); - bool userOutputUsed() const; - bool isSpecializationOperation(const TIntermOperator&) const; - bool isNonuniformPropagating(TOperator) const; - bool promoteUnary(TIntermUnary&); - bool promoteBinary(TIntermBinary&); - void addSymbolLinkageNode(TIntermAggregate*& linkage, TSymbolTable&, const TString&); - bool promoteAggregate(TIntermAggregate&); - void pushSelector(TIntermSequence&, const TVectorSelector&, const TSourceLoc&); - void pushSelector(TIntermSequence&, const TMatrixSelector&, const TSourceLoc&); - bool specConstantPropagates(const TIntermTyped&, const TIntermTyped&); - void performTextureUpgradeAndSamplerRemovalTransformation(TIntermNode* root); - bool isConversionAllowed(TOperator op, TIntermTyped* node) const; - std::tuple getConversionDestinationType(TBasicType type0, TBasicType type1, TOperator op) const; - - static const char* getResourceName(TResourceType); - - const EShLanguage language; // stage, known at construction time - std::string entryPointName; - std::string entryPointMangledName; - typedef std::list TGraph; - TGraph callGraph; - - EProfile profile; // source profile - int version; // source version - SpvVersion spvVersion; - TIntermNode* treeRoot; - std::set requestedExtensions; // cumulation of all enabled or required extensions; not connected to what subset of the shader used them - MustBeAssigned resources; - int numEntryPoints; - int numErrors; - int numPushConstants; - bool recursive; - bool invertY; - bool dxPositionW; - bool enhancedMsgs; - bool debugInfo; - bool useStorageBuffer; - bool invariantAll; - bool nanMinMaxClamp; // true if desiring min/max/clamp to favor non-NaN over NaN - bool depthReplacing; - bool stencilReplacing; - int localSize[3]; - bool localSizeNotDefault[3]; - int localSizeSpecId[3]; - unsigned long long uniqueId; - - std::string globalUniformBlockName; - std::string atomicCounterBlockName; - unsigned int globalUniformBlockSet; - unsigned int globalUniformBlockBinding; - unsigned int atomicCounterBlockSet; - -#ifndef GLSLANG_WEB -public: - const char* const implicitThisName; - const char* const implicitCounterName; -protected: - EShSource source; // source language, known a bit later - bool useVulkanMemoryModel; - int invocations; - int vertices; - TLayoutGeometry inputPrimitive; - TLayoutGeometry outputPrimitive; - bool pixelCenterInteger; - bool originUpperLeft; - bool texCoordBuiltinRedeclared; - TVertexSpacing vertexSpacing; - TVertexOrder vertexOrder; - TInterlockOrdering interlockOrdering; - bool pointMode; - bool earlyFragmentTests; - bool postDepthCoverage; - bool earlyAndLateFragmentTestsAMD; - TLayoutDepth depthLayout; - TLayoutStencil stencilLayout; - bool hlslFunctionality1; - int blendEquations; // an 'or'ing of masks of shifts of TBlendEquationShift - bool xfbMode; - std::vector xfbBuffers; // all the data we need to track per xfb buffer - bool multiStream; - bool layoutOverrideCoverage; - bool geoPassthroughEXT; - int numShaderRecordBlocks; - ComputeDerivativeMode computeDerivativeMode; - int primitives; - int numTaskNVBlocks; - bool layoutPrimitiveCulling; - int numTaskEXTPayloads; - - // Base shift values - std::array shiftBinding; - - // Per-descriptor-set shift values - std::array, EResCount> shiftBindingForSet; - - std::vector resourceSetBinding; - bool autoMapBindings; - bool autoMapLocations; - bool flattenUniformArrays; - bool useUnknownFormat; - bool hlslOffsets; - bool hlslIoMapping; - bool useVariablePointers; - - std::set semanticNameSet; - - EShTextureSamplerTransformMode textureSamplerTransformMode; - - bool needToLegalize; - bool binaryDoubleOutput; - bool subgroupUniformControlFlow; - bool usePhysicalStorageBuffer; - - TSpirvRequirement* spirvRequirement; - TSpirvExecutionMode* spirvExecutionMode; - std::map bindlessTextureModeCaller; - std::map bindlessImageModeCaller; - std::unordered_map uniformLocationOverrides; - int uniformLocationBase; - TNumericFeatures numericFeatures; -#endif - std::unordered_map blockBackingOverrides; - - std::unordered_set usedConstantId; // specialization constant ids used - std::vector usedAtomics; // sets of bindings used by atomic counters - std::vector usedIo[4]; // sets of used locations, one for each of in, out, uniform, and buffers - std::vector usedIoRT[4]; // sets of used location, one for rayPayload/rayPayloadIN, - // one for callableData/callableDataIn, one for hitObjectAttributeNV and - // one for shaderrecordhitobjectNV - // set of names of statically read/written I/O that might need extra checking - std::set ioAccessed; - - // source code of shader, useful as part of debug information - std::string sourceFile; - std::string sourceText; - - // Included text. First string is a name, second is the included text - std::map includeText; - - // for OpModuleProcessed, or equivalent - TProcesses processes; - -private: - void operator=(TIntermediate&); // prevent assignments -}; - -} // end namespace glslang - -#endif // _LOCAL_INTERMEDIATE_INCLUDED_ diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/parseVersions.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/parseVersions.h deleted file mode 100644 index c9f82d0..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/parseVersions.h +++ /dev/null @@ -1,241 +0,0 @@ -// -// Copyright (C) 2015-2018 Google, Inc. -// Copyright (C) 2017 ARM Limited. -// -// 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, - const SpvVersion& spvVersion, EShLanguage language, TInfoSink& infoSink, - bool forwardCompatible, EShMessages messages) - : -#if !defined(GLSLANG_WEB) - forwardCompatible(forwardCompatible), - profile(profile), -#endif - infoSink(infoSink), version(version), - language(language), - spvVersion(spvVersion), - intermediate(interm), messages(messages), numErrors(0), currentScanner(nullptr) { } - virtual ~TParseVersions() { } - void requireStage(const TSourceLoc&, EShLanguageMask, const char* featureDesc); - void requireStage(const TSourceLoc&, EShLanguage, const char* featureDesc); -#ifdef GLSLANG_WEB - const EProfile profile = EEsProfile; - bool isEsProfile() const { return true; } - void requireProfile(const TSourceLoc& loc, int profileMask, const char* featureDesc) - { - if (! (EEsProfile & profileMask)) - error(loc, "not supported with this profile:", featureDesc, ProfileName(profile)); - } - void profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, int numExtensions, - const char* const extensions[], const char* featureDesc) - { - if ((EEsProfile & profileMask) && (minVersion == 0 || version < minVersion)) - error(loc, "not supported for this version or the enabled extensions", featureDesc, ""); - } - void profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, const char* extension, - const char* featureDesc) - { - profileRequires(loc, profileMask, minVersion, extension ? 1 : 0, &extension, featureDesc); - } - void initializeExtensionBehavior() { } - void checkDeprecated(const TSourceLoc&, int queryProfiles, int depVersion, const char* featureDesc) { } - void requireNotRemoved(const TSourceLoc&, int queryProfiles, int removedVersion, const char* featureDesc) { } - void requireExtensions(const TSourceLoc&, int numExtensions, const char* const extensions[], - const char* featureDesc) { } - void ppRequireExtensions(const TSourceLoc&, int numExtensions, const char* const extensions[], - const char* featureDesc) { } - TExtensionBehavior getExtensionBehavior(const char*) { return EBhMissing; } - bool extensionTurnedOn(const char* const extension) { return false; } - bool extensionsTurnedOn(int numExtensions, const char* const extensions[]) { return false; } - void updateExtensionBehavior(int line, const char* const extension, const char* behavior) { } - void updateExtensionBehavior(const char* const extension, TExtensionBehavior) { } - void checkExtensionStage(const TSourceLoc&, const char* const extension) { } - void extensionRequires(const TSourceLoc&, const char* const extension, const char* behavior) { } - void fullIntegerCheck(const TSourceLoc&, const char* op) { } - void doubleCheck(const TSourceLoc&, const char* op) { } - bool float16Arithmetic() { return false; } - void requireFloat16Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc) { } - bool int16Arithmetic() { return false; } - void requireInt16Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc) { } - bool int8Arithmetic() { return false; } - void requireInt8Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc) { } - void int64Check(const TSourceLoc&, const char* op, bool builtIn = false) { } - void explicitFloat32Check(const TSourceLoc&, const char* op, bool builtIn = false) { } - void explicitFloat64Check(const TSourceLoc&, const char* op, bool builtIn = false) { } - bool relaxedErrors() const { return false; } - bool suppressWarnings() const { return true; } - bool isForwardCompatible() const { return false; } -#else - bool forwardCompatible; // true if errors are to be given for use of deprecated features - EProfile profile; // the declared profile in the shader (core by default) - bool isEsProfile() const { return profile == EEsProfile; } - void requireProfile(const TSourceLoc& loc, int profileMask, const char* featureDesc); - void profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, int numExtensions, - const char* const extensions[], const char* featureDesc); - void profileRequires(const TSourceLoc& loc, int profileMask, int minVersion, const char* extension, - const char* featureDesc); - virtual void initializeExtensionBehavior(); - virtual void 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 updateExtensionBehavior(const char* const extension, TExtensionBehavior); - virtual bool checkExtensionsRequested(const TSourceLoc&, int numExtensions, const char* const extensions[], - const char* featureDesc); - virtual void checkExtensionStage(const TSourceLoc&, const char* const extension); - virtual void extensionRequires(const TSourceLoc&, const char* const extension, const char* behavior); - virtual void fullIntegerCheck(const TSourceLoc&, const char* op); - - virtual void unimplemented(const TSourceLoc&, const char* featureDesc); - virtual void doubleCheck(const TSourceLoc&, const char* op); - virtual void float16Check(const TSourceLoc&, const char* op, bool builtIn = false); - virtual void float16ScalarVectorCheck(const TSourceLoc&, const char* op, bool builtIn = false); - virtual bool float16Arithmetic(); - virtual void requireFloat16Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc); - virtual void int16ScalarVectorCheck(const TSourceLoc&, const char* op, bool builtIn = false); - virtual bool int16Arithmetic(); - virtual void requireInt16Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc); - virtual void int8ScalarVectorCheck(const TSourceLoc&, const char* op, bool builtIn = false); - virtual bool int8Arithmetic(); - virtual void requireInt8Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc); - virtual void float16OpaqueCheck(const TSourceLoc&, const char* op, bool builtIn = false); - virtual void int64Check(const TSourceLoc&, const char* op, bool builtIn = false); - virtual void explicitInt8Check(const TSourceLoc&, const char* op, bool builtIn = false); - virtual void explicitInt16Check(const TSourceLoc&, const char* op, bool builtIn = false); - virtual void explicitInt32Check(const TSourceLoc&, const char* op, bool builtIn = false); - virtual void explicitFloat32Check(const TSourceLoc&, const char* op, bool builtIn = false); - virtual void explicitFloat64Check(const TSourceLoc&, const char* op, bool builtIn = false); - virtual void fcoopmatCheck(const TSourceLoc&, const char* op, bool builtIn = false); - virtual void intcoopmatCheck(const TSourceLoc&, const char *op, bool builtIn = false); - bool relaxedErrors() const { return (messages & EShMsgRelaxedErrors) != 0; } - bool suppressWarnings() const { return (messages & EShMsgSuppressWarnings) != 0; } - bool isForwardCompatible() const { return forwardCompatible; } -#endif // GLSLANG_WEB - virtual void spvRemoved(const TSourceLoc&, const char* op); - virtual void vulkanRemoved(const TSourceLoc&, const char* op); - virtual void requireVulkan(const TSourceLoc&, const char* op); - virtual void requireSpv(const TSourceLoc&, const char* op); - virtual void requireSpv(const TSourceLoc&, const char *op, unsigned int version); - - -#if defined(GLSLANG_WEB) && !defined(GLSLANG_WEB_DEVEL) - void C_DECL error(const TSourceLoc&, const char* szReason, const char* szToken, - const char* szExtraInfoFormat, ...) { addError(); } - void C_DECL warn(const TSourceLoc&, const char* szReason, const char* szToken, - const char* szExtraInfoFormat, ...) { } - void C_DECL ppError(const TSourceLoc&, const char* szReason, const char* szToken, - const char* szExtraInfoFormat, ...) { addError(); } - void C_DECL ppWarn(const TSourceLoc&, const char* szReason, const char* szToken, - const char* szExtraInfoFormat, ...) { } -#else - virtual void C_DECL error(const TSourceLoc&, const char* szReason, const char* szToken, - const char* szExtraInfoFormat, ...) = 0; - virtual void C_DECL warn(const TSourceLoc&, const char* szReason, const char* szToken, - 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; -#endif - - 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); } - - void getPreamble(std::string&); -#ifdef ENABLE_HLSL - bool isReadingHLSL() const { return (messages & EShMsgReadHlsl) == EShMsgReadHlsl; } - bool hlslEnable16BitTypes() const { return (messages & EShMsgHlslEnable16BitTypes) != 0; } - bool hlslDX9Compatible() const { return (messages & EShMsgHlslDX9Compatible) != 0; } -#else - bool isReadingHLSL() const { return false; } -#endif - - TInfoSink& infoSink; - - // compilation mode - int version; // version, updated by #version in the shader - EShLanguage language; // really the stage - SpvVersion spvVersion; - TIntermediate& intermediate; // helper for making and hooking up pieces of the parse tree - -protected: - TMap extensionBehavior; // for each extension string, what its current behavior is - TMap extensionMinSpv; // for each extension string, store minimum spirv required - TVector spvUnsupportedExt; // for extensions reserved for spv usage. - EShMessages messages; // errors/warnings/rule-sets - int numErrors; // number of compile-time errors encountered - TInputScanner* currentScanner; - -private: - explicit TParseVersions(const TParseVersions&); - TParseVersions& operator=(const TParseVersions&); -}; - -} // end namespace glslang - -#endif // _PARSE_VERSIONS_INCLUDED_ diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/preprocessor/PpContext.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/preprocessor/PpContext.h deleted file mode 100644 index 590eab6..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/preprocessor/PpContext.h +++ /dev/null @@ -1,718 +0,0 @@ -// -// Copyright (C) 2013 LunarG, Inc. -// Copyright (C) 2015-2018 Google, Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// -// Neither the name of 3Dlabs Inc. Ltd. nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -/****************************************************************************\ -Copyright (c) 2002, NVIDIA Corporation. - -NVIDIA Corporation("NVIDIA") supplies this software to you in -consideration of your agreement to the following terms, and your use, -installation, modification or redistribution of this NVIDIA software -constitutes acceptance of these terms. If you do not agree with these -terms, please do not use, install, modify or redistribute this NVIDIA -software. - -In consideration of your agreement to abide by the following terms, and -subject to these terms, NVIDIA grants you a personal, non-exclusive -license, under NVIDIA's copyrights in this original NVIDIA software (the -"NVIDIA Software"), to use, reproduce, modify and redistribute the -NVIDIA Software, with or without modifications, in source and/or binary -forms; provided that if you redistribute the NVIDIA Software, you must -retain the copyright notice of NVIDIA, this notice and the following -text and disclaimers in all such redistributions of the NVIDIA Software. -Neither the name, trademarks, service marks nor logos of NVIDIA -Corporation may be used to endorse or promote products derived from the -NVIDIA Software without specific prior written permission from NVIDIA. -Except as expressly stated in this notice, no other rights or licenses -express or implied, are granted by NVIDIA herein, including but not -limited to any patent rights that may be infringed by your derivative -works or by other works in which the NVIDIA Software may be -incorporated. No hardware is licensed hereunder. - -THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, -INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, -NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR -ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER -PRODUCTS. - -IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, -INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY -OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE -NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, -TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF -NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -\****************************************************************************/ - -#ifndef PPCONTEXT_H -#define PPCONTEXT_H - -#include -#include -#include - -#include "../ParseHelper.h" -#include "PpTokens.h" - -/* windows only pragma */ -#ifdef _MSC_VER - #pragma warning(disable : 4127) -#endif - -namespace glslang { - -class TPpToken { -public: - TPpToken() { clear(); } - void clear() - { - space = false; - i64val = 0; - loc.init(); - name[0] = 0; - fullyExpanded = false; - } - - // Used for comparing macro definitions, so checks what is relevant for that. - bool operator==(const TPpToken& right) const - { - return space == right.space && - ival == right.ival && dval == right.dval && i64val == right.i64val && - strncmp(name, right.name, MaxTokenLength) == 0; - } - bool operator!=(const TPpToken& right) const { return ! operator==(right); } - - TSourceLoc loc; - // True if a space (for white space or a removed comment) should also be - // recognized, in front of the token returned: - bool space; - - bool fullyExpanded; - // Numeric value of the token: - union { - int ival; - double dval; - long long i64val; - }; - // Text string of the token: - char name[MaxTokenLength + 1]; -}; - -class TStringAtomMap { -// -// Implementation is in PpAtom.cpp -// -// Maintain a bi-directional mapping between relevant preprocessor strings and -// "atoms" which a unique integers (small, contiguous, not hash-like) per string. -// -public: - TStringAtomMap(); - - // Map string -> atom. - // Return 0 if no existing string. - int getAtom(const char* s) const - { - auto it = atomMap.find(s); - return it == atomMap.end() ? 0 : it->second; - } - - // Map a new or existing string -> atom, inventing a new atom if necessary. - int getAddAtom(const char* s) - { - int atom = getAtom(s); - if (atom == 0) { - atom = nextAtom++; - addAtomFixed(s, atom); - } - return atom; - } - - // Map atom -> string. - const char* getString(int atom) const { return stringMap[atom]->c_str(); } - -protected: - TStringAtomMap(TStringAtomMap&); - TStringAtomMap& operator=(TStringAtomMap&); - - TUnorderedMap atomMap; - TVector stringMap; // these point into the TString in atomMap - int nextAtom; - - // Bad source characters can lead to bad atoms, so gracefully handle those by - // pre-filling the table with them (to avoid if tests later). - TString badToken; - - // Add bi-directional mappings: - // - string -> atom - // - atom -> string - void addAtomFixed(const char* s, int atom) - { - auto it = atomMap.insert(std::pair(s, atom)).first; - if (stringMap.size() < (size_t)atom + 1) - stringMap.resize(atom + 100, &badToken); - stringMap[atom] = &it->first; - } -}; - -class TInputScanner; - -enum MacroExpandResult { - MacroExpandNotStarted, // macro not expanded, which might not be an error - MacroExpandError, // a clear error occurred while expanding, no expansion - MacroExpandStarted, // macro expansion process has started - MacroExpandUndef // macro is undefined and will be expanded -}; - -// This class is the result of turning a huge pile of C code communicating through globals -// into a class. This was done to allowing instancing to attain thread safety. -// Don't expect too much in terms of OO design. -class TPpContext { -public: - TPpContext(TParseContextBase&, const std::string& rootFileName, TShader::Includer&); - virtual ~TPpContext(); - - void setPreamble(const char* preamble, size_t length); - - int tokenize(TPpToken& ppToken); - int tokenPaste(int token, TPpToken&); - - class tInput { - public: - tInput(TPpContext* p) : done(false), pp(p) { } - virtual ~tInput() { } - - virtual int scan(TPpToken*) = 0; - virtual int getch() = 0; - virtual void ungetch() = 0; - virtual bool peekPasting() { return false; } // true when about to see ## - virtual bool peekContinuedPasting(int) { return false; } // true when non-spaced tokens can paste - virtual bool endOfReplacementList() { return false; } // true when at the end of a macro replacement list (RHS of #define) - virtual bool isMacroInput() { return false; } - - // Will be called when we start reading tokens from this instance - virtual void notifyActivated() {} - // Will be called when we do not read tokens from this instance anymore - virtual void notifyDeleted() {} - protected: - bool done; - TPpContext* pp; - }; - - void setInput(TInputScanner& input, bool versionWillBeError); - - void pushInput(tInput* in) - { - inputStack.push_back(in); - in->notifyActivated(); - } - void popInput() - { - inputStack.back()->notifyDeleted(); - delete inputStack.back(); - inputStack.pop_back(); - } - - // - // From PpTokens.cpp - // - - // Capture the needed parts of a token stream for macro recording/playback. - class TokenStream { - public: - // Manage a stream of these 'Token', which capture the relevant parts - // of a TPpToken, plus its atom. - class Token { - public: - Token(int atom, const TPpToken& ppToken) : - atom(atom), - space(ppToken.space), - i64val(ppToken.i64val), - name(ppToken.name) { } - int get(TPpToken& ppToken) - { - ppToken.clear(); - ppToken.space = space; - ppToken.i64val = i64val; - snprintf(ppToken.name, sizeof(ppToken.name), "%s", name.c_str()); - return atom; - } - bool isAtom(int a) const { return atom == a; } - int getAtom() const { return atom; } - bool nonSpaced() const { return !space; } - protected: - Token() {} - int atom; - bool space; // did a space precede the token? - long long i64val; - TString name; - }; - - TokenStream() : currentPos(0) { } - - void putToken(int token, TPpToken* ppToken); - bool peekToken(int atom) { return !atEnd() && stream[currentPos].isAtom(atom); } - bool peekContinuedPasting(int atom) - { - // This is basically necessary because, for example, the PP - // tokenizer only accepts valid numeric-literals plus suffixes, so - // separates numeric-literals plus bad suffix into two tokens, which - // should get both pasted together as one token when token pasting. - // - // The following code is a bit more generalized than the above example. - if (!atEnd() && atom == PpAtomIdentifier && stream[currentPos].nonSpaced()) { - switch(stream[currentPos].getAtom()) { - case PpAtomConstInt: - case PpAtomConstUint: - case PpAtomConstInt64: - case PpAtomConstUint64: - case PpAtomConstInt16: - case PpAtomConstUint16: - case PpAtomConstFloat: - case PpAtomConstDouble: - case PpAtomConstFloat16: - case PpAtomConstString: - case PpAtomIdentifier: - return true; - default: - break; - } - } - - return false; - } - int getToken(TParseContextBase&, TPpToken*); - bool atEnd() { return currentPos >= stream.size(); } - bool peekTokenizedPasting(bool lastTokenPastes); - bool peekUntokenizedPasting(); - void reset() { currentPos = 0; } - - protected: - TVector stream; - size_t currentPos; - }; - - // - // From Pp.cpp - // - - struct MacroSymbol { - MacroSymbol() : functionLike(0), busy(0), undef(0) { } - TVector args; - TokenStream body; - unsigned functionLike : 1; // 0 means object-like, 1 means function-like - unsigned busy : 1; - unsigned undef : 1; - }; - - typedef TMap TSymbolMap; - TSymbolMap macroDefs; // map atoms to macro definitions - MacroSymbol* lookupMacroDef(int atom) - { - auto existingMacroIt = macroDefs.find(atom); - return (existingMacroIt == macroDefs.end()) ? nullptr : &(existingMacroIt->second); - } - void addMacroDef(int atom, MacroSymbol& macroDef) { macroDefs[atom] = macroDef; } - -protected: - TPpContext(TPpContext&); - TPpContext& operator=(TPpContext&); - - TStringAtomMap atomStrings; - char* preamble; // string to parse, all before line 1 of string 0, it is 0 if no preamble - int preambleLength; - char** strings; // official strings of shader, starting a string 0 line 1 - size_t* lengths; - int numStrings; // how many official strings there are - int currentString; // which string we're currently parsing (-1 for preamble) - - // Scanner data: - int previous_token; - TParseContextBase& parseContext; - - // Get the next token from *stack* of input sources, popping input sources - // that are out of tokens, down until an input source is found that has a token. - // Return EndOfInput when there are no more tokens to be found by doing this. - int scanToken(TPpToken* ppToken) - { - int token = EndOfInput; - - while (! inputStack.empty()) { - token = inputStack.back()->scan(ppToken); - if (token != EndOfInput || inputStack.empty()) - break; - popInput(); - } - - return token; - } - int getChar() { return inputStack.back()->getch(); } - void ungetChar() { inputStack.back()->ungetch(); } - bool peekPasting() { return !inputStack.empty() && inputStack.back()->peekPasting(); } - bool peekContinuedPasting(int a) - { - return !inputStack.empty() && inputStack.back()->peekContinuedPasting(a); - } - bool endOfReplacementList() { return inputStack.empty() || inputStack.back()->endOfReplacementList(); } - bool isMacroInput() { return inputStack.size() > 0 && inputStack.back()->isMacroInput(); } - - static const int maxIfNesting = 65; - - int ifdepth; // current #if-#else-#endif nesting in the cpp.c file (pre-processor) - bool elseSeen[maxIfNesting]; // Keep a track of whether an else has been seen at a particular depth - int elsetracker; // #if-#else and #endif constructs...Counter. - - class tMacroInput : public tInput { - public: - tMacroInput(TPpContext* pp) : tInput(pp), prepaste(false), postpaste(false) { } - virtual ~tMacroInput() - { - for (size_t i = 0; i < args.size(); ++i) - delete args[i]; - for (size_t i = 0; i < expandedArgs.size(); ++i) - delete expandedArgs[i]; - } - - virtual int scan(TPpToken*) override; - virtual int getch() override { assert(0); return EndOfInput; } - virtual void ungetch() override { assert(0); } - bool peekPasting() override { return prepaste; } - bool peekContinuedPasting(int a) override { return mac->body.peekContinuedPasting(a); } - bool endOfReplacementList() override { return mac->body.atEnd(); } - bool isMacroInput() override { return true; } - - MacroSymbol *mac; - TVector args; - TVector expandedArgs; - - protected: - bool prepaste; // true if we are just before ## - bool postpaste; // true if we are right after ## - }; - - class tMarkerInput : public tInput { - public: - tMarkerInput(TPpContext* pp) : tInput(pp) { } - virtual int scan(TPpToken*) override - { - if (done) - return EndOfInput; - done = true; - - return marker; - } - virtual int getch() override { assert(0); return EndOfInput; } - virtual void ungetch() override { assert(0); } - static const int marker = -3; - }; - - class tZeroInput : public tInput { - public: - tZeroInput(TPpContext* pp) : tInput(pp) { } - virtual int scan(TPpToken*) override; - virtual int getch() override { assert(0); return EndOfInput; } - virtual void ungetch() override { assert(0); } - }; - - std::vector inputStack; - bool errorOnVersion; - bool versionSeen; - - // - // from Pp.cpp - // - - // Used to obtain #include content. - TShader::Includer& includer; - - int CPPdefine(TPpToken * ppToken); - int CPPundef(TPpToken * ppToken); - int CPPelse(int matchelse, TPpToken * ppToken); - int extraTokenCheck(int atom, TPpToken* ppToken, int token); - int eval(int token, int precedence, bool shortCircuit, int& res, bool& err, TPpToken * ppToken); - int evalToToken(int token, bool shortCircuit, int& res, bool& err, TPpToken * ppToken); - int CPPif (TPpToken * ppToken); - int CPPifdef(int defined, TPpToken * ppToken); - int CPPinclude(TPpToken * ppToken); - int CPPline(TPpToken * ppToken); - int CPPerror(TPpToken * ppToken); - int CPPpragma(TPpToken * ppToken); - int CPPversion(TPpToken * ppToken); - int CPPextension(TPpToken * ppToken); - int readCPPline(TPpToken * ppToken); - int scanHeaderName(TPpToken* ppToken, char delimit); - TokenStream* PrescanMacroArg(TokenStream&, TPpToken*, bool newLineOkay); - MacroExpandResult MacroExpand(TPpToken* ppToken, bool expandUndef, bool newLineOkay); - - // - // From PpTokens.cpp - // - void pushTokenStreamInput(TokenStream&, bool pasting = false, bool expanded = false); - void UngetToken(int token, TPpToken*); - - class tTokenInput : public tInput { - public: - tTokenInput(TPpContext* pp, TokenStream* t, bool prepasting, bool expanded) : - tInput(pp), - tokens(t), - lastTokenPastes(prepasting), - preExpanded(expanded) { } - virtual int scan(TPpToken *ppToken) override { - int token = tokens->getToken(pp->parseContext, ppToken); - ppToken->fullyExpanded = preExpanded; - if (tokens->atEnd() && token == PpAtomIdentifier) { - int macroAtom = pp->atomStrings.getAtom(ppToken->name); - MacroSymbol* macro = macroAtom == 0 ? nullptr : pp->lookupMacroDef(macroAtom); - if (macro && macro->functionLike) - ppToken->fullyExpanded = false; - } - return token; - } - virtual int getch() override { assert(0); return EndOfInput; } - virtual void ungetch() override { assert(0); } - virtual bool peekPasting() override { return tokens->peekTokenizedPasting(lastTokenPastes); } - bool peekContinuedPasting(int a) override { return tokens->peekContinuedPasting(a); } - protected: - TokenStream* tokens; - bool lastTokenPastes; // true if the last token in the input is to be pasted, rather than consumed as a token - bool preExpanded; - }; - - class tUngotTokenInput : public tInput { - public: - tUngotTokenInput(TPpContext* pp, int t, TPpToken* p) : tInput(pp), token(t), lval(*p) { } - virtual int scan(TPpToken *) override; - virtual int getch() override { assert(0); return EndOfInput; } - virtual void ungetch() override { assert(0); } - protected: - int token; - TPpToken lval; - }; - - // - // From PpScanner.cpp - // - class tStringInput : public tInput { - public: - tStringInput(TPpContext* pp, TInputScanner& i) : tInput(pp), input(&i) { } - virtual int scan(TPpToken*) override; - - // Scanner used to get source stream characters. - // - Escaped newlines are handled here, invisibly to the caller. - // - All forms of newline are handled, and turned into just a '\n'. - int getch() override - { - int ch = input->get(); - - if (ch == '\\') { - // Move past escaped newlines, as many as sequentially exist - do { - if (input->peek() == '\r' || input->peek() == '\n') { - bool allowed = pp->parseContext.lineContinuationCheck(input->getSourceLoc(), pp->inComment); - if (! allowed && pp->inComment) - return '\\'; - - // escape one newline now - ch = input->get(); - int nextch = input->get(); - if (ch == '\r' && nextch == '\n') - ch = input->get(); - else - ch = nextch; - } else - return '\\'; - } while (ch == '\\'); - } - - // handle any non-escaped newline - if (ch == '\r' || ch == '\n') { - if (ch == '\r' && input->peek() == '\n') - input->get(); - return '\n'; - } - - return ch; - } - - // Scanner used to backup the source stream characters. Newlines are - // handled here, invisibly to the caller, meaning have to undo exactly - // what getch() above does (e.g., don't leave things in the middle of a - // sequence of escaped newlines). - void ungetch() override - { - input->unget(); - - do { - int ch = input->peek(); - if (ch == '\r' || ch == '\n') { - if (ch == '\n') { - // correct for two-character newline - input->unget(); - if (input->peek() != '\r') - input->get(); - } - // now in front of a complete newline, move past an escape character - input->unget(); - if (input->peek() == '\\') - input->unget(); - else { - input->get(); - break; - } - } else - break; - } while (true); - } - - protected: - TInputScanner* input; - }; - - // Holds a reference to included file data, as well as a - // prologue and an epilogue string. This can be scanned using the tInput - // interface and acts as a single source string. - class TokenizableIncludeFile : public tInput { - public: - // Copies prologue and epilogue. The includedFile must remain valid - // until this TokenizableIncludeFile is no longer used. - TokenizableIncludeFile(const TSourceLoc& startLoc, - const std::string& prologue, - TShader::Includer::IncludeResult* includedFile, - const std::string& epilogue, - TPpContext* pp) - : tInput(pp), - prologue_(prologue), - epilogue_(epilogue), - includedFile_(includedFile), - scanner(3, strings, lengths, nullptr, 0, 0, true), - prevScanner(nullptr), - stringInput(pp, scanner) - { - strings[0] = prologue_.data(); - strings[1] = includedFile_->headerData; - strings[2] = epilogue_.data(); - - lengths[0] = prologue_.size(); - lengths[1] = includedFile_->headerLength; - lengths[2] = epilogue_.size(); - - scanner.setLine(startLoc.line); - scanner.setString(startLoc.string); - - scanner.setFile(startLoc.getFilenameStr(), 0); - scanner.setFile(startLoc.getFilenameStr(), 1); - scanner.setFile(startLoc.getFilenameStr(), 2); - } - - // tInput methods: - int scan(TPpToken* t) override { return stringInput.scan(t); } - int getch() override { return stringInput.getch(); } - void ungetch() override { stringInput.ungetch(); } - - void notifyActivated() override - { - prevScanner = pp->parseContext.getScanner(); - pp->parseContext.setScanner(&scanner); - pp->push_include(includedFile_); - } - - void notifyDeleted() override - { - pp->parseContext.setScanner(prevScanner); - pp->pop_include(); - } - - private: - TokenizableIncludeFile& operator=(const TokenizableIncludeFile&); - - // Stores the prologue for this string. - const std::string prologue_; - - // Stores the epilogue for this string. - const std::string epilogue_; - - // Points to the IncludeResult that this TokenizableIncludeFile represents. - TShader::Includer::IncludeResult* includedFile_; - - // Will point to prologue_, includedFile_->headerData and epilogue_ - // This is passed to scanner constructor. - // These do not own the storage and it must remain valid until this - // object has been destroyed. - const char* strings[3]; - // Length of str_, passed to scanner constructor. - size_t lengths[3]; - // Scans over str_. - TInputScanner scanner; - // The previous effective scanner before the scanner in this instance - // has been activated. - TInputScanner* prevScanner; - // Delegate object implementing the tInput interface. - tStringInput stringInput; - }; - - int ScanFromString(char* s); - void missingEndifCheck(); - int lFloatConst(int len, int ch, TPpToken* ppToken); - int characterLiteral(TPpToken* ppToken); - - void push_include(TShader::Includer::IncludeResult* result) - { - currentSourceFile = result->headerName; - includeStack.push(result); - } - - void pop_include() - { - TShader::Includer::IncludeResult* include = includeStack.top(); - includeStack.pop(); - includer.releaseInclude(include); - if (includeStack.empty()) { - currentSourceFile = rootFileName; - } else { - currentSourceFile = includeStack.top()->headerName; - } - } - - bool inComment; - std::string rootFileName; - std::stack includeStack; - std::string currentSourceFile; - - std::istringstream strtodStream; - bool disableEscapeSequences; -}; - -} // end namespace glslang - -#endif // PPCONTEXT_H diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/preprocessor/PpTokens.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/preprocessor/PpTokens.h deleted file mode 100644 index 7b0f815..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/preprocessor/PpTokens.h +++ /dev/null @@ -1,179 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// 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. -// -/****************************************************************************\ -Copyright (c) 2002, NVIDIA Corporation. - -NVIDIA Corporation("NVIDIA") supplies this software to you in -consideration of your agreement to the following terms, and your use, -installation, modification or redistribution of this NVIDIA software -constitutes acceptance of these terms. If you do not agree with these -terms, please do not use, install, modify or redistribute this NVIDIA -software. - -In consideration of your agreement to abide by the following terms, and -subject to these terms, NVIDIA grants you a personal, non-exclusive -license, under NVIDIA's copyrights in this original NVIDIA software (the -"NVIDIA Software"), to use, reproduce, modify and redistribute the -NVIDIA Software, with or without modifications, in source and/or binary -forms; provided that if you redistribute the NVIDIA Software, you must -retain the copyright notice of NVIDIA, this notice and the following -text and disclaimers in all such redistributions of the NVIDIA Software. -Neither the name, trademarks, service marks nor logos of NVIDIA -Corporation may be used to endorse or promote products derived from the -NVIDIA Software without specific prior written permission from NVIDIA. -Except as expressly stated in this notice, no other rights or licenses -express or implied, are granted by NVIDIA herein, including but not -limited to any patent rights that may be infringed by your derivative -works or by other works in which the NVIDIA Software may be -incorporated. No hardware is licensed hereunder. - -THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, -INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, -NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR -ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER -PRODUCTS. - -IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, -INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY -OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE -NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, -TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF -NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -\****************************************************************************/ - -#ifndef PARSER_H -#define PARSER_H - -namespace glslang { - -// Multi-character tokens -enum EFixedAtoms { - // single character tokens get their own char value as their token; start here for multi-character tokens - PpAtomMaxSingle = 127, - - // replace bad character tokens with this, to avoid accidental aliasing with the below - PpAtomBadToken, - - // Operators - - PPAtomAddAssign, - PPAtomSubAssign, - PPAtomMulAssign, - PPAtomDivAssign, - PPAtomModAssign, - - PpAtomRight, - PpAtomLeft, - - PpAtomRightAssign, - PpAtomLeftAssign, - PpAtomAndAssign, - PpAtomOrAssign, - PpAtomXorAssign, - - PpAtomAnd, - PpAtomOr, - PpAtomXor, - - PpAtomEQ, - PpAtomNE, - PpAtomGE, - PpAtomLE, - - PpAtomDecrement, - PpAtomIncrement, - - PpAtomColonColon, - - PpAtomPaste, - - // Constants - - PpAtomConstInt, - PpAtomConstUint, - PpAtomConstInt64, - PpAtomConstUint64, - PpAtomConstInt16, - PpAtomConstUint16, - PpAtomConstFloat, - PpAtomConstDouble, - PpAtomConstFloat16, - PpAtomConstString, - - // Identifiers - PpAtomIdentifier, - - // preprocessor "keywords" - - PpAtomDefine, - PpAtomUndef, - - PpAtomIf, - PpAtomIfdef, - PpAtomIfndef, - PpAtomElse, - PpAtomElif, - PpAtomEndif, - - PpAtomLine, - PpAtomPragma, - PpAtomError, - - // #version ... - PpAtomVersion, - PpAtomCore, - PpAtomCompatibility, - PpAtomEs, - - // #extension - PpAtomExtension, - - // __LINE__, __FILE__, __VERSION__ - - PpAtomLineMacro, - PpAtomFileMacro, - PpAtomVersionMacro, - - // #include - PpAtomInclude, - - PpAtomLast, -}; - -} // end namespace glslang - -#endif /* not PARSER_H */ diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/propagateNoContraction.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/propagateNoContraction.h deleted file mode 100644 index 8521ad7..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/propagateNoContraction.h +++ /dev/null @@ -1,55 +0,0 @@ -// -// 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. -// - -#pragma once - -#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); -}; diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/reflection.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/reflection.h deleted file mode 100644 index bfd5452..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/MachineIndependent/reflection.h +++ /dev/null @@ -1,223 +0,0 @@ -// -// Copyright (C) 2013-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. -// - -#if !defined(GLSLANG_WEB) - -#ifndef _REFLECTION_INCLUDED -#define _REFLECTION_INCLUDED - -#include "../Public/ShaderLang.h" -#include "../Include/Types.h" - -#include -#include - -// -// A reflection database and its interface, consistent with the OpenGL API reflection queries. -// - -namespace glslang { - -class TIntermediate; -class TIntermAggregate; -class TReflectionTraverser; - -// The full reflection database -class TReflection { -public: - TReflection(EShReflectionOptions opts, EShLanguage first, EShLanguage last) - : options(opts), firstStage(first), lastStage(last), badReflection(TObjectReflection::badReflection()) - { - for (int dim=0; dim<3; ++dim) - localSize[dim] = 0; - } - - virtual ~TReflection() {} - - // grow the reflection stage by stage - bool addStage(EShLanguage, const TIntermediate&); - - // for mapping a uniform index to a uniform object's description - int getNumUniforms() { return (int)indexToUniform.size(); } - const TObjectReflection& getUniform(int i) const - { - if (i >= 0 && i < (int)indexToUniform.size()) - return indexToUniform[i]; - else - return badReflection; - } - - // for mapping a block index to the block's description - int getNumUniformBlocks() const { return (int)indexToUniformBlock.size(); } - const TObjectReflection& getUniformBlock(int i) const - { - if (i >= 0 && i < (int)indexToUniformBlock.size()) - return indexToUniformBlock[i]; - else - return badReflection; - } - - // for mapping an pipeline input index to the input's description - int getNumPipeInputs() { return (int)indexToPipeInput.size(); } - const TObjectReflection& getPipeInput(int i) const - { - if (i >= 0 && i < (int)indexToPipeInput.size()) - return indexToPipeInput[i]; - else - return badReflection; - } - - // for mapping an pipeline output index to the output's description - int getNumPipeOutputs() { return (int)indexToPipeOutput.size(); } - const TObjectReflection& getPipeOutput(int i) const - { - if (i >= 0 && i < (int)indexToPipeOutput.size()) - return indexToPipeOutput[i]; - else - return badReflection; - } - - // for mapping from an atomic counter to the uniform index - int getNumAtomicCounters() const { return (int)atomicCounterUniformIndices.size(); } - const TObjectReflection& getAtomicCounter(int i) const - { - if (i >= 0 && i < (int)atomicCounterUniformIndices.size()) - return getUniform(atomicCounterUniformIndices[i]); - else - return badReflection; - } - - // for mapping a buffer variable index to a buffer variable object's description - int getNumBufferVariables() { return (int)indexToBufferVariable.size(); } - const TObjectReflection& getBufferVariable(int i) const - { - if (i >= 0 && i < (int)indexToBufferVariable.size()) - return indexToBufferVariable[i]; - else - return badReflection; - } - - // for mapping a storage block index to the storage block's description - int getNumStorageBuffers() const { return (int)indexToBufferBlock.size(); } - const TObjectReflection& getStorageBufferBlock(int i) const - { - if (i >= 0 && i < (int)indexToBufferBlock.size()) - return indexToBufferBlock[i]; - else - return badReflection; - } - - // for mapping any name to its index (block names, uniform names and input/output names) - int getIndex(const char* name) const - { - TNameToIndex::const_iterator it = nameToIndex.find(name); - if (it == nameToIndex.end()) - return -1; - else - return it->second; - } - - // see getIndex(const char*) - int getIndex(const TString& name) const { return getIndex(name.c_str()); } - - - // for mapping any name to its index (only pipe input/output names) - int getPipeIOIndex(const char* name, const bool inOrOut) const - { - TNameToIndex::const_iterator it = inOrOut ? pipeInNameToIndex.find(name) : pipeOutNameToIndex.find(name); - if (it == (inOrOut ? pipeInNameToIndex.end() : pipeOutNameToIndex.end())) - return -1; - else - return it->second; - } - - // see gePipeIOIndex(const char*, const bool) - int getPipeIOIndex(const TString& name, const bool inOrOut) const { return getPipeIOIndex(name.c_str(), inOrOut); } - - // Thread local size - unsigned getLocalSize(int dim) const { return dim <= 2 ? localSize[dim] : 0; } - - void dump(); - -protected: - friend class glslang::TReflectionTraverser; - - void buildCounterIndices(const TIntermediate&); - void buildUniformStageMask(const TIntermediate& intermediate); - void buildAttributeReflection(EShLanguage, const TIntermediate&); - - // Need a TString hash: typedef std::unordered_map TNameToIndex; - typedef std::map TNameToIndex; - typedef std::vector TMapIndexToReflection; - typedef std::vector TIndices; - - TMapIndexToReflection& GetBlockMapForStorage(TStorageQualifier storage) - { - if ((options & EShReflectionSeparateBuffers) && storage == EvqBuffer) - return indexToBufferBlock; - return indexToUniformBlock; - } - TMapIndexToReflection& GetVariableMapForStorage(TStorageQualifier storage) - { - if ((options & EShReflectionSeparateBuffers) && storage == EvqBuffer) - return indexToBufferVariable; - return indexToUniform; - } - - EShReflectionOptions options; - - EShLanguage firstStage; - EShLanguage lastStage; - - TObjectReflection badReflection; // return for queries of -1 or generally out of range; has expected descriptions with in it for this - TNameToIndex nameToIndex; // maps names to indexes; can hold all types of data: uniform/buffer and which function names have been processed - TNameToIndex pipeInNameToIndex; // maps pipe in names to indexes, this is a fix to seperate pipe I/O from uniforms and buffers. - TNameToIndex pipeOutNameToIndex; // maps pipe out names to indexes, this is a fix to seperate pipe I/O from uniforms and buffers. - TMapIndexToReflection indexToUniform; - TMapIndexToReflection indexToUniformBlock; - TMapIndexToReflection indexToBufferVariable; - TMapIndexToReflection indexToBufferBlock; - TMapIndexToReflection indexToPipeInput; - TMapIndexToReflection indexToPipeOutput; - TIndices atomicCounterUniformIndices; - - unsigned int localSize[3]; -}; - -} // end namespace glslang - -#endif // _REFLECTION_INCLUDED - -#endif // !GLSLANG_WEB diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Public/ShaderLang.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Public/ShaderLang.h index 90a5302..e0ec47f 100644 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Public/ShaderLang.h +++ b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/Public/ShaderLang.h @@ -318,8 +318,8 @@ typedef void* ShHandle; // Driver calls these to create and destroy compiler/linker // objects. // -GLSLANG_EXPORT ShHandle ShConstructCompiler(const EShLanguage, int debugOptions); // one per shader -GLSLANG_EXPORT ShHandle ShConstructLinker(const EShExecutable, int debugOptions); // one per shader pair +GLSLANG_EXPORT ShHandle ShConstructCompiler(const EShLanguage, int /*debugOptions unused*/); // one per shader +GLSLANG_EXPORT ShHandle ShConstructLinker(const EShExecutable, int /*debugOptions unused*/); // one per shader pair GLSLANG_EXPORT ShHandle ShConstructUniformMap(); // one per uniform namespace (currently entire program object) GLSLANG_EXPORT void ShDestruct(ShHandle); @@ -330,18 +330,13 @@ GLSLANG_EXPORT void ShDestruct(ShHandle); // The info-log should be written by ShCompile into // ShHandle, so it can answer future queries. // -GLSLANG_EXPORT int ShCompile( - const ShHandle, - const char* const shaderStrings[], - const int numStrings, - const int* lengths, - const EShOptimizationLevel, - const TBuiltInResource *resources, - int debugOptions, - int defaultVersion = 110, // use 100 for ES environment, overridden by #version in shader - bool forwardCompatible = false, // give errors for use of deprecated features - EShMessages messages = EShMsgDefault // warnings and errors - ); +GLSLANG_EXPORT int ShCompile(const ShHandle, const char* const shaderStrings[], const int numStrings, + const int* lengths, const EShOptimizationLevel, const TBuiltInResource* resources, + int, // debugOptions unused + int defaultVersion = 110, // use 100 for ES environment, overridden by #version in shader + bool forwardCompatible = false, // give errors for use of deprecated features + EShMessages messages = EShMsgDefault // warnings and errors +); GLSLANG_EXPORT int ShLinkExt( const ShHandle, // linker object @@ -573,6 +568,9 @@ class TShader { void setEnvInputVulkanRulesRelaxed() { environment.input.vulkanRulesRelaxed = true; } bool getEnvInputVulkanRulesRelaxed() const { return environment.input.vulkanRulesRelaxed; } + void setCompileOnly() { compileOnly = true; } + bool getCompileOnly() const { return compileOnly; } + // Interface to #include handlers. // // To support #include, a client of Glslang does the following: @@ -722,14 +720,15 @@ class TShader { TEnvironment environment; + // Indicates this shader is meant to be used without linking + bool compileOnly = false; + friend class TProgram; private: TShader& operator=(TShader&); }; -#if !defined(GLSLANG_WEB) - // // A reflection database and its interface, consistent with the OpenGL API reflection queries. // @@ -846,8 +845,6 @@ class TIoMapResolver virtual void addStage(EShLanguage stage, TIntermediate& stageIntermediate) = 0; }; -#endif // !GLSLANG_WEB - // Make one TProgram per set of shaders that will get linked together. Add all // the shaders that are to be linked together. After calling shader.parse() // for all shaders, call link(). @@ -867,8 +864,6 @@ class TProgram { TIntermediate* getIntermediate(EShLanguage stage) const { return intermediate[stage]; } -#if !defined(GLSLANG_WEB) - // Reflection Interface // call first, to do liveness analysis, index mapping, etc.; returns false on failure @@ -961,7 +956,6 @@ class TProgram { // If resolver is not provided it uses the previous approach // and respects auto assignment and offsets. GLSLANG_EXPORT bool mapIO(TIoMapResolver* pResolver = nullptr, TIoMapper* pIoMapper = nullptr); -#endif // !GLSLANG_WEB protected: GLSLANG_EXPORT bool linkStage(EShLanguage, EShMessages); @@ -972,9 +966,7 @@ class TProgram { TIntermediate* intermediate[EShLangCount]; bool newedIntermediate[EShLangCount]; // track which intermediate were "new" versus reusing a singleton unit in a stage TInfoSink* infoSink; -#if !defined(GLSLANG_WEB) TReflection* reflection; -#endif bool linked; private: diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/GLSL.ext.AMD.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/GLSL.ext.AMD.h deleted file mode 100644 index 009d2f1..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/GLSL.ext.AMD.h +++ /dev/null @@ -1,108 +0,0 @@ -/* -** Copyright (c) 2014-2016 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a copy -** of this software and/or associated documentation files (the "Materials"), -** to deal in the Materials without restriction, including without limitation -** the rights to use, copy, modify, merge, publish, distribute, sublicense, -** and/or sell copies of the Materials, and to permit persons to whom the -** Materials are furnished to do so, subject to the following conditions: -** -** The above copyright notice and this permission notice shall be included in -** all copies or substantial portions of the Materials. -** -** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS -** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND -** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS -** IN THE MATERIALS. -*/ - -#ifndef GLSLextAMD_H -#define GLSLextAMD_H - -static const int GLSLextAMDVersion = 100; -static const int GLSLextAMDRevision = 7; - -// SPV_AMD_shader_ballot -static const char* const E_SPV_AMD_shader_ballot = "SPV_AMD_shader_ballot"; - -enum ShaderBallotAMD { - ShaderBallotBadAMD = 0, // Don't use - - SwizzleInvocationsAMD = 1, - SwizzleInvocationsMaskedAMD = 2, - WriteInvocationAMD = 3, - MbcntAMD = 4, - - ShaderBallotCountAMD -}; - -// SPV_AMD_shader_trinary_minmax -static const char* const E_SPV_AMD_shader_trinary_minmax = "SPV_AMD_shader_trinary_minmax"; - -enum ShaderTrinaryMinMaxAMD { - ShaderTrinaryMinMaxBadAMD = 0, // Don't use - - FMin3AMD = 1, - UMin3AMD = 2, - SMin3AMD = 3, - FMax3AMD = 4, - UMax3AMD = 5, - SMax3AMD = 6, - FMid3AMD = 7, - UMid3AMD = 8, - SMid3AMD = 9, - - ShaderTrinaryMinMaxCountAMD -}; - -// SPV_AMD_shader_explicit_vertex_parameter -static const char* const E_SPV_AMD_shader_explicit_vertex_parameter = "SPV_AMD_shader_explicit_vertex_parameter"; - -enum ShaderExplicitVertexParameterAMD { - ShaderExplicitVertexParameterBadAMD = 0, // Don't use - - InterpolateAtVertexAMD = 1, - - ShaderExplicitVertexParameterCountAMD -}; - -// SPV_AMD_gcn_shader -static const char* const E_SPV_AMD_gcn_shader = "SPV_AMD_gcn_shader"; - -enum GcnShaderAMD { - GcnShaderBadAMD = 0, // Don't use - - CubeFaceIndexAMD = 1, - CubeFaceCoordAMD = 2, - TimeAMD = 3, - - GcnShaderCountAMD -}; - -// SPV_AMD_gpu_shader_half_float -static const char* const E_SPV_AMD_gpu_shader_half_float = "SPV_AMD_gpu_shader_half_float"; - -// SPV_AMD_texture_gather_bias_lod -static const char* const E_SPV_AMD_texture_gather_bias_lod = "SPV_AMD_texture_gather_bias_lod"; - -// SPV_AMD_gpu_shader_int16 -static const char* const E_SPV_AMD_gpu_shader_int16 = "SPV_AMD_gpu_shader_int16"; - -// SPV_AMD_shader_image_load_store_lod -static const char* const E_SPV_AMD_shader_image_load_store_lod = "SPV_AMD_shader_image_load_store_lod"; - -// SPV_AMD_shader_fragment_mask -static const char* const E_SPV_AMD_shader_fragment_mask = "SPV_AMD_shader_fragment_mask"; - -// SPV_AMD_gpu_shader_half_float_fetch -static const char* const E_SPV_AMD_gpu_shader_half_float_fetch = "SPV_AMD_gpu_shader_half_float_fetch"; - -#endif // #ifndef GLSLextAMD_H diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/GLSL.ext.ARM.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/GLSL.ext.ARM.h deleted file mode 100644 index 14425be..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/GLSL.ext.ARM.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -** Copyright (c) 2022 ARM Limited -** -** Permission is hereby granted, free of charge, to any person obtaining a copy -** of this software and/or associated documentation files (the "Materials"), -** to deal in the Materials without restriction, including without limitation -** the rights to use, copy, modify, merge, publish, distribute, sublicense, -** and/or sell copies of the Materials, and to permit persons to whom the -** Materials are furnished to do so, subject to the following conditions: -** -** The above copyright notice and this permission notice shall be included in -** all copies or substantial portions of the Materials. -** -** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS -** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND -** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS -** IN THE MATERIALS. -*/ - -#ifndef GLSLextARM_H -#define GLSLextARM_H - -static const int GLSLextARMVersion = 100; -static const int GLSLextARMRevision = 1; - -static const char * const E_SPV_ARM_core_builtins = "SPV_ARM_core_builtins"; - -#endif // #ifndef GLSLextARM_H diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/GLSL.ext.EXT.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/GLSL.ext.EXT.h deleted file mode 100644 index a247b4c..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/GLSL.ext.EXT.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -** Copyright (c) 2014-2016 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a copy -** of this software and/or associated documentation files (the "Materials"), -** to deal in the Materials without restriction, including without limitation -** the rights to use, copy, modify, merge, publish, distribute, sublicense, -** and/or sell copies of the Materials, and to permit persons to whom the -** Materials are furnished to do so, subject to the following conditions: -** -** The above copyright notice and this permission notice shall be included in -** all copies or substantial portions of the Materials. -** -** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS -** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND -** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS -** IN THE MATERIALS. -*/ - -#ifndef GLSLextEXT_H -#define GLSLextEXT_H - -static const int GLSLextEXTVersion = 100; -static const int GLSLextEXTRevision = 2; - -static const char* const E_SPV_EXT_shader_stencil_export = "SPV_EXT_shader_stencil_export"; -static const char* const E_SPV_EXT_shader_viewport_index_layer = "SPV_EXT_shader_viewport_index_layer"; -static const char* const E_SPV_EXT_fragment_fully_covered = "SPV_EXT_fragment_fully_covered"; -static const char* const E_SPV_EXT_fragment_invocation_density = "SPV_EXT_fragment_invocation_density"; -static const char* const E_SPV_EXT_demote_to_helper_invocation = "SPV_EXT_demote_to_helper_invocation"; -static const char* const E_SPV_EXT_shader_atomic_float_add = "SPV_EXT_shader_atomic_float_add"; -static const char* const E_SPV_EXT_shader_atomic_float16_add = "SPV_EXT_shader_atomic_float16_add"; -static const char* const E_SPV_EXT_shader_atomic_float_min_max = "SPV_EXT_shader_atomic_float_min_max"; -static const char* const E_SPV_EXT_shader_image_int64 = "SPV_EXT_shader_image_int64"; -static const char* const E_SPV_EXT_mesh_shader = "SPV_EXT_mesh_shader"; - -#endif // #ifndef GLSLextEXT_H diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/GLSL.ext.KHR.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/GLSL.ext.KHR.h deleted file mode 100644 index d5c670f..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/GLSL.ext.KHR.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -** Copyright (c) 2014-2020 The Khronos Group Inc. -** Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved. -** -** Permission is hereby granted, free of charge, to any person obtaining a copy -** of this software and/or associated documentation files (the "Materials"), -** to deal in the Materials without restriction, including without limitation -** the rights to use, copy, modify, merge, publish, distribute, sublicense, -** and/or sell copies of the Materials, and to permit persons to whom the -** Materials are furnished to do so, subject to the following conditions: -** -** The above copyright notice and this permission notice shall be included in -** all copies or substantial portions of the Materials. -** -** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS -** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND -** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS -** IN THE MATERIALS. -*/ - -#ifndef GLSLextKHR_H -#define GLSLextKHR_H - -static const int GLSLextKHRVersion = 100; -static const int GLSLextKHRRevision = 3; - -static const char* const E_SPV_KHR_shader_ballot = "SPV_KHR_shader_ballot"; -static const char* const E_SPV_KHR_subgroup_vote = "SPV_KHR_subgroup_vote"; -static const char* const E_SPV_KHR_device_group = "SPV_KHR_device_group"; -static const char* const E_SPV_KHR_multiview = "SPV_KHR_multiview"; -static const char* const E_SPV_KHR_shader_draw_parameters = "SPV_KHR_shader_draw_parameters"; -static const char* const E_SPV_KHR_16bit_storage = "SPV_KHR_16bit_storage"; -static const char* const E_SPV_KHR_8bit_storage = "SPV_KHR_8bit_storage"; -static const char* const E_SPV_KHR_storage_buffer_storage_class = "SPV_KHR_storage_buffer_storage_class"; -static const char* const E_SPV_KHR_post_depth_coverage = "SPV_KHR_post_depth_coverage"; -static const char* const E_SPV_KHR_vulkan_memory_model = "SPV_KHR_vulkan_memory_model"; -static const char* const E_SPV_EXT_physical_storage_buffer = "SPV_EXT_physical_storage_buffer"; -static const char* const E_SPV_KHR_physical_storage_buffer = "SPV_KHR_physical_storage_buffer"; -static const char* const E_SPV_EXT_fragment_shader_interlock = "SPV_EXT_fragment_shader_interlock"; -static const char* const E_SPV_KHR_shader_clock = "SPV_KHR_shader_clock"; -static const char* const E_SPV_KHR_non_semantic_info = "SPV_KHR_non_semantic_info"; -static const char* const E_SPV_KHR_ray_tracing = "SPV_KHR_ray_tracing"; -static const char* const E_SPV_KHR_ray_query = "SPV_KHR_ray_query"; -static const char* const E_SPV_KHR_fragment_shading_rate = "SPV_KHR_fragment_shading_rate"; -static const char* const E_SPV_KHR_terminate_invocation = "SPV_KHR_terminate_invocation"; -static const char* const E_SPV_KHR_workgroup_memory_explicit_layout = "SPV_KHR_workgroup_memory_explicit_layout"; -static const char* const E_SPV_KHR_subgroup_uniform_control_flow = "SPV_KHR_subgroup_uniform_control_flow"; -static const char* const E_SPV_KHR_fragment_shader_barycentric = "SPV_KHR_fragment_shader_barycentric"; -static const char* const E_SPV_AMD_shader_early_and_late_fragment_tests = "SPV_AMD_shader_early_and_late_fragment_tests"; - -#endif // #ifndef GLSLextKHR_H diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/GLSL.ext.NV.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/GLSL.ext.NV.h deleted file mode 100644 index 5b0f7eb..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/GLSL.ext.NV.h +++ /dev/null @@ -1,87 +0,0 @@ -/* -** Copyright (c) 2014-2017 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a copy -** of this software and/or associated documentation files (the "Materials"), -** to deal in the Materials without restriction, including without limitation -** the rights to use, copy, modify, merge, publish, distribute, sublicense, -** and/or sell copies of the Materials, and to permit persons to whom the -** Materials are furnished to do so, subject to the following conditions: -** -** The above copyright notice and this permission notice shall be included in -** all copies or substantial portions of the Materials. -** -** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS -** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND -** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS -** IN THE MATERIALS. -*/ - -#ifndef GLSLextNV_H -#define GLSLextNV_H - -enum BuiltIn; -enum Decoration; -enum Op; -enum Capability; - -static const int GLSLextNVVersion = 100; -static const int GLSLextNVRevision = 11; - -//SPV_NV_sample_mask_override_coverage -const char* const E_SPV_NV_sample_mask_override_coverage = "SPV_NV_sample_mask_override_coverage"; - -//SPV_NV_geometry_shader_passthrough -const char* const E_SPV_NV_geometry_shader_passthrough = "SPV_NV_geometry_shader_passthrough"; - -//SPV_NV_viewport_array2 -const char* const E_SPV_NV_viewport_array2 = "SPV_NV_viewport_array2"; -const char* const E_ARB_shader_viewport_layer_array = "SPV_ARB_shader_viewport_layer_array"; - -//SPV_NV_stereo_view_rendering -const char* const E_SPV_NV_stereo_view_rendering = "SPV_NV_stereo_view_rendering"; - -//SPV_NVX_multiview_per_view_attributes -const char* const E_SPV_NVX_multiview_per_view_attributes = "SPV_NVX_multiview_per_view_attributes"; - -//SPV_NV_shader_subgroup_partitioned -const char* const E_SPV_NV_shader_subgroup_partitioned = "SPV_NV_shader_subgroup_partitioned"; - -//SPV_NV_fragment_shader_barycentric -const char* const E_SPV_NV_fragment_shader_barycentric = "SPV_NV_fragment_shader_barycentric"; - -//SPV_NV_compute_shader_derivatives -const char* const E_SPV_NV_compute_shader_derivatives = "SPV_NV_compute_shader_derivatives"; - -//SPV_NV_shader_image_footprint -const char* const E_SPV_NV_shader_image_footprint = "SPV_NV_shader_image_footprint"; - -//SPV_NV_mesh_shader -const char* const E_SPV_NV_mesh_shader = "SPV_NV_mesh_shader"; - -//SPV_NV_raytracing -const char* const E_SPV_NV_ray_tracing = "SPV_NV_ray_tracing"; - -//SPV_NV_ray_tracing_motion_blur -const char* const E_SPV_NV_ray_tracing_motion_blur = "SPV_NV_ray_tracing_motion_blur"; - -//SPV_NV_shading_rate -const char* const E_SPV_NV_shading_rate = "SPV_NV_shading_rate"; - -//SPV_NV_cooperative_matrix -const char* const E_SPV_NV_cooperative_matrix = "SPV_NV_cooperative_matrix"; - -//SPV_NV_shader_sm_builtins -const char* const E_SPV_NV_shader_sm_builtins = "SPV_NV_shader_sm_builtins"; - -//SPV_NV_shader_execution_reorder -const char* const E_SPV_NV_shader_invocation_reorder = "SPV_NV_shader_invocation_reorder"; - -#endif // #ifndef GLSLextNV_H diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/GLSL.std.450.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/GLSL.std.450.h deleted file mode 100644 index df31092..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/GLSL.std.450.h +++ /dev/null @@ -1,131 +0,0 @@ -/* -** Copyright (c) 2014-2016 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a copy -** of this software and/or associated documentation files (the "Materials"), -** to deal in the Materials without restriction, including without limitation -** the rights to use, copy, modify, merge, publish, distribute, sublicense, -** and/or sell copies of the Materials, and to permit persons to whom the -** Materials are furnished to do so, subject to the following conditions: -** -** The above copyright notice and this permission notice shall be included in -** all copies or substantial portions of the Materials. -** -** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS -** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND -** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS -** IN THE MATERIALS. -*/ - -#ifndef GLSLstd450_H -#define GLSLstd450_H - -static const int GLSLstd450Version = 100; -static const int GLSLstd450Revision = 1; - -enum GLSLstd450 { - GLSLstd450Bad = 0, // Don't use - - GLSLstd450Round = 1, - GLSLstd450RoundEven = 2, - GLSLstd450Trunc = 3, - GLSLstd450FAbs = 4, - GLSLstd450SAbs = 5, - GLSLstd450FSign = 6, - GLSLstd450SSign = 7, - GLSLstd450Floor = 8, - GLSLstd450Ceil = 9, - GLSLstd450Fract = 10, - - GLSLstd450Radians = 11, - GLSLstd450Degrees = 12, - GLSLstd450Sin = 13, - GLSLstd450Cos = 14, - GLSLstd450Tan = 15, - GLSLstd450Asin = 16, - GLSLstd450Acos = 17, - GLSLstd450Atan = 18, - GLSLstd450Sinh = 19, - GLSLstd450Cosh = 20, - GLSLstd450Tanh = 21, - GLSLstd450Asinh = 22, - GLSLstd450Acosh = 23, - GLSLstd450Atanh = 24, - GLSLstd450Atan2 = 25, - - GLSLstd450Pow = 26, - GLSLstd450Exp = 27, - GLSLstd450Log = 28, - GLSLstd450Exp2 = 29, - GLSLstd450Log2 = 30, - GLSLstd450Sqrt = 31, - GLSLstd450InverseSqrt = 32, - - GLSLstd450Determinant = 33, - GLSLstd450MatrixInverse = 34, - - GLSLstd450Modf = 35, // second operand needs an OpVariable to write to - GLSLstd450ModfStruct = 36, // no OpVariable operand - GLSLstd450FMin = 37, - GLSLstd450UMin = 38, - GLSLstd450SMin = 39, - GLSLstd450FMax = 40, - GLSLstd450UMax = 41, - GLSLstd450SMax = 42, - GLSLstd450FClamp = 43, - GLSLstd450UClamp = 44, - GLSLstd450SClamp = 45, - GLSLstd450FMix = 46, - GLSLstd450IMix = 47, // Reserved - GLSLstd450Step = 48, - GLSLstd450SmoothStep = 49, - - GLSLstd450Fma = 50, - GLSLstd450Frexp = 51, // second operand needs an OpVariable to write to - GLSLstd450FrexpStruct = 52, // no OpVariable operand - GLSLstd450Ldexp = 53, - - GLSLstd450PackSnorm4x8 = 54, - GLSLstd450PackUnorm4x8 = 55, - GLSLstd450PackSnorm2x16 = 56, - GLSLstd450PackUnorm2x16 = 57, - GLSLstd450PackHalf2x16 = 58, - GLSLstd450PackDouble2x32 = 59, - GLSLstd450UnpackSnorm2x16 = 60, - GLSLstd450UnpackUnorm2x16 = 61, - GLSLstd450UnpackHalf2x16 = 62, - GLSLstd450UnpackSnorm4x8 = 63, - GLSLstd450UnpackUnorm4x8 = 64, - GLSLstd450UnpackDouble2x32 = 65, - - GLSLstd450Length = 66, - GLSLstd450Distance = 67, - GLSLstd450Cross = 68, - GLSLstd450Normalize = 69, - GLSLstd450FaceForward = 70, - GLSLstd450Reflect = 71, - GLSLstd450Refract = 72, - - GLSLstd450FindILsb = 73, - GLSLstd450FindSMsb = 74, - GLSLstd450FindUMsb = 75, - - GLSLstd450InterpolateAtCentroid = 76, - GLSLstd450InterpolateAtSample = 77, - GLSLstd450InterpolateAtOffset = 78, - - GLSLstd450NMin = 79, - GLSLstd450NMax = 80, - GLSLstd450NClamp = 81, - - GLSLstd450Count -}; - -#endif // #ifndef GLSLstd450_H diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/GlslangToSpv.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/GlslangToSpv.h index 3907be4..1b9ef3c 100644 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/GlslangToSpv.h +++ b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/GlslangToSpv.h @@ -35,19 +35,25 @@ #pragma once -#if defined(_MSC_VER) && _MSC_VER >= 1900 - #pragma warning(disable : 4464) // relative include path contains '..' -#endif - -#include "SpvTools.h" -#include "glslang/Include/intermediate.h" - #include #include #include "Logger.h" namespace glslang { +class TIntermediate; + +struct SpvOptions { + bool generateDebugInfo {false}; + bool stripDebugInfo {false}; + bool disableOptimizer {true}; + bool optimizeSize {false}; + bool disassemble {false}; + bool validate {false}; + bool emitNonSemanticShaderDebugInfo {false}; + bool emitNonSemanticShaderDebugSource{ false }; + bool compileOnly{false}; +}; void GetSpirvVersion(std::string&); int GetSpirvGeneratorVersion(); @@ -55,7 +61,7 @@ void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector& spirv, spv::SpvBuildLogger* logger, SpvOptions* options = nullptr); -void OutputSpvBin(const std::vector& spirv, const char* baseName); -void OutputSpvHex(const std::vector& spirv, const char* baseName, const char* varName); +bool OutputSpvBin(const std::vector& spirv, const char* baseName); +bool OutputSpvHex(const std::vector& spirv, const char* baseName, const char* varName); } diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/Logger.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/Logger.h index 411367c..2e4ddaf 100644 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/Logger.h +++ b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/Logger.h @@ -46,14 +46,6 @@ class SpvBuildLogger { public: SpvBuildLogger() {} -#ifdef GLSLANG_WEB - void tbdFunctionality(const std::string& f) { } - void missingFunctionality(const std::string& f) { } - void warning(const std::string& w) { } - void error(const std::string& e) { errors.push_back(e); } - std::string getAllMessages() { return ""; } -#else - // Registers a TBD functionality. void tbdFunctionality(const std::string& f); // Registers a missing functionality. @@ -67,7 +59,6 @@ class SpvBuildLogger { // Returns all messages accumulated in the order of: // TBD functionalities, missing functionalities, warnings, errors. std::string getAllMessages() const; -#endif private: SpvBuildLogger(const SpvBuildLogger&); diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/NonSemanticDebugPrintf.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/NonSemanticDebugPrintf.h deleted file mode 100644 index 83796d7..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/NonSemanticDebugPrintf.h +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2020 The Khronos Group Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and/or associated documentation files (the -// "Materials"), to deal in the Materials without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Materials, and to -// permit persons to whom the Materials are furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Materials. -// -// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS -// KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS -// SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT -// https://www.khronos.org/registry/ -// -// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. -// - -#ifndef SPIRV_UNIFIED1_NonSemanticDebugPrintf_H_ -#define SPIRV_UNIFIED1_NonSemanticDebugPrintf_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -enum { - NonSemanticDebugPrintfRevision = 1, - NonSemanticDebugPrintfRevision_BitWidthPadding = 0x7fffffff -}; - -enum NonSemanticDebugPrintfInstructions { - NonSemanticDebugPrintfDebugPrintf = 1, - NonSemanticDebugPrintfInstructionsMax = 0x7fffffff -}; - - -#ifdef __cplusplus -} -#endif - -#endif // SPIRV_UNIFIED1_NonSemanticDebugPrintf_H_ diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/NonSemanticShaderDebugInfo100.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/NonSemanticShaderDebugInfo100.h deleted file mode 100644 index c52f32f..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/NonSemanticShaderDebugInfo100.h +++ /dev/null @@ -1,171 +0,0 @@ -// Copyright (c) 2018 The Khronos Group Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and/or associated documentation files (the "Materials"), -// to deal in the Materials without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Materials, and to permit persons to whom the -// Materials are furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Materials. -// -// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS -// STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND -// HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ -// -// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS -// IN THE MATERIALS. - -#ifndef SPIRV_UNIFIED1_NonSemanticShaderDebugInfo100_H_ -#define SPIRV_UNIFIED1_NonSemanticShaderDebugInfo100_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -enum { - NonSemanticShaderDebugInfo100Version = 100, - NonSemanticShaderDebugInfo100Version_BitWidthPadding = 0x7fffffff -}; -enum { - NonSemanticShaderDebugInfo100Revision = 6, - NonSemanticShaderDebugInfo100Revision_BitWidthPadding = 0x7fffffff -}; - -enum NonSemanticShaderDebugInfo100Instructions { - NonSemanticShaderDebugInfo100DebugInfoNone = 0, - NonSemanticShaderDebugInfo100DebugCompilationUnit = 1, - NonSemanticShaderDebugInfo100DebugTypeBasic = 2, - NonSemanticShaderDebugInfo100DebugTypePointer = 3, - NonSemanticShaderDebugInfo100DebugTypeQualifier = 4, - NonSemanticShaderDebugInfo100DebugTypeArray = 5, - NonSemanticShaderDebugInfo100DebugTypeVector = 6, - NonSemanticShaderDebugInfo100DebugTypedef = 7, - NonSemanticShaderDebugInfo100DebugTypeFunction = 8, - NonSemanticShaderDebugInfo100DebugTypeEnum = 9, - NonSemanticShaderDebugInfo100DebugTypeComposite = 10, - NonSemanticShaderDebugInfo100DebugTypeMember = 11, - NonSemanticShaderDebugInfo100DebugTypeInheritance = 12, - NonSemanticShaderDebugInfo100DebugTypePtrToMember = 13, - NonSemanticShaderDebugInfo100DebugTypeTemplate = 14, - NonSemanticShaderDebugInfo100DebugTypeTemplateParameter = 15, - NonSemanticShaderDebugInfo100DebugTypeTemplateTemplateParameter = 16, - NonSemanticShaderDebugInfo100DebugTypeTemplateParameterPack = 17, - NonSemanticShaderDebugInfo100DebugGlobalVariable = 18, - NonSemanticShaderDebugInfo100DebugFunctionDeclaration = 19, - NonSemanticShaderDebugInfo100DebugFunction = 20, - NonSemanticShaderDebugInfo100DebugLexicalBlock = 21, - NonSemanticShaderDebugInfo100DebugLexicalBlockDiscriminator = 22, - NonSemanticShaderDebugInfo100DebugScope = 23, - NonSemanticShaderDebugInfo100DebugNoScope = 24, - NonSemanticShaderDebugInfo100DebugInlinedAt = 25, - NonSemanticShaderDebugInfo100DebugLocalVariable = 26, - NonSemanticShaderDebugInfo100DebugInlinedVariable = 27, - NonSemanticShaderDebugInfo100DebugDeclare = 28, - NonSemanticShaderDebugInfo100DebugValue = 29, - NonSemanticShaderDebugInfo100DebugOperation = 30, - NonSemanticShaderDebugInfo100DebugExpression = 31, - NonSemanticShaderDebugInfo100DebugMacroDef = 32, - NonSemanticShaderDebugInfo100DebugMacroUndef = 33, - NonSemanticShaderDebugInfo100DebugImportedEntity = 34, - NonSemanticShaderDebugInfo100DebugSource = 35, - NonSemanticShaderDebugInfo100DebugFunctionDefinition = 101, - NonSemanticShaderDebugInfo100DebugSourceContinued = 102, - NonSemanticShaderDebugInfo100DebugLine = 103, - NonSemanticShaderDebugInfo100DebugNoLine = 104, - NonSemanticShaderDebugInfo100DebugBuildIdentifier = 105, - NonSemanticShaderDebugInfo100DebugStoragePath = 106, - NonSemanticShaderDebugInfo100DebugEntryPoint = 107, - NonSemanticShaderDebugInfo100DebugTypeMatrix = 108, - NonSemanticShaderDebugInfo100InstructionsMax = 0x7fffffff -}; - - -enum NonSemanticShaderDebugInfo100DebugInfoFlags { - NonSemanticShaderDebugInfo100None = 0x0000, - NonSemanticShaderDebugInfo100FlagIsProtected = 0x01, - NonSemanticShaderDebugInfo100FlagIsPrivate = 0x02, - NonSemanticShaderDebugInfo100FlagIsPublic = 0x03, - NonSemanticShaderDebugInfo100FlagIsLocal = 0x04, - NonSemanticShaderDebugInfo100FlagIsDefinition = 0x08, - NonSemanticShaderDebugInfo100FlagFwdDecl = 0x10, - NonSemanticShaderDebugInfo100FlagArtificial = 0x20, - NonSemanticShaderDebugInfo100FlagExplicit = 0x40, - NonSemanticShaderDebugInfo100FlagPrototyped = 0x80, - NonSemanticShaderDebugInfo100FlagObjectPointer = 0x100, - NonSemanticShaderDebugInfo100FlagStaticMember = 0x200, - NonSemanticShaderDebugInfo100FlagIndirectVariable = 0x400, - NonSemanticShaderDebugInfo100FlagLValueReference = 0x800, - NonSemanticShaderDebugInfo100FlagRValueReference = 0x1000, - NonSemanticShaderDebugInfo100FlagIsOptimized = 0x2000, - NonSemanticShaderDebugInfo100FlagIsEnumClass = 0x4000, - NonSemanticShaderDebugInfo100FlagTypePassByValue = 0x8000, - NonSemanticShaderDebugInfo100FlagTypePassByReference = 0x10000, - NonSemanticShaderDebugInfo100FlagUnknownPhysicalLayout = 0x20000, - NonSemanticShaderDebugInfo100DebugInfoFlagsMax = 0x7fffffff -}; - -enum NonSemanticShaderDebugInfo100BuildIdentifierFlags { - NonSemanticShaderDebugInfo100IdentifierPossibleDuplicates = 0x01, - NonSemanticShaderDebugInfo100BuildIdentifierFlagsMax = 0x7fffffff -}; - -enum NonSemanticShaderDebugInfo100DebugBaseTypeAttributeEncoding { - NonSemanticShaderDebugInfo100Unspecified = 0, - NonSemanticShaderDebugInfo100Address = 1, - NonSemanticShaderDebugInfo100Boolean = 2, - NonSemanticShaderDebugInfo100Float = 3, - NonSemanticShaderDebugInfo100Signed = 4, - NonSemanticShaderDebugInfo100SignedChar = 5, - NonSemanticShaderDebugInfo100Unsigned = 6, - NonSemanticShaderDebugInfo100UnsignedChar = 7, - NonSemanticShaderDebugInfo100DebugBaseTypeAttributeEncodingMax = 0x7fffffff -}; - -enum NonSemanticShaderDebugInfo100DebugCompositeType { - NonSemanticShaderDebugInfo100Class = 0, - NonSemanticShaderDebugInfo100Structure = 1, - NonSemanticShaderDebugInfo100Union = 2, - NonSemanticShaderDebugInfo100DebugCompositeTypeMax = 0x7fffffff -}; - -enum NonSemanticShaderDebugInfo100DebugTypeQualifier { - NonSemanticShaderDebugInfo100ConstType = 0, - NonSemanticShaderDebugInfo100VolatileType = 1, - NonSemanticShaderDebugInfo100RestrictType = 2, - NonSemanticShaderDebugInfo100AtomicType = 3, - NonSemanticShaderDebugInfo100DebugTypeQualifierMax = 0x7fffffff -}; - -enum NonSemanticShaderDebugInfo100DebugOperation { - NonSemanticShaderDebugInfo100Deref = 0, - NonSemanticShaderDebugInfo100Plus = 1, - NonSemanticShaderDebugInfo100Minus = 2, - NonSemanticShaderDebugInfo100PlusUconst = 3, - NonSemanticShaderDebugInfo100BitPiece = 4, - NonSemanticShaderDebugInfo100Swap = 5, - NonSemanticShaderDebugInfo100Xderef = 6, - NonSemanticShaderDebugInfo100StackValue = 7, - NonSemanticShaderDebugInfo100Constu = 8, - NonSemanticShaderDebugInfo100Fragment = 9, - NonSemanticShaderDebugInfo100DebugOperationMax = 0x7fffffff -}; - -enum NonSemanticShaderDebugInfo100DebugImportedEntity { - NonSemanticShaderDebugInfo100ImportedModule = 0, - NonSemanticShaderDebugInfo100ImportedDeclaration = 1, - NonSemanticShaderDebugInfo100DebugImportedEntityMax = 0x7fffffff -}; - - -#ifdef __cplusplus -} -#endif - -#endif // SPIRV_UNIFIED1_NonSemanticShaderDebugInfo100_H_ diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/SPVRemapper.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/SPVRemapper.h index d216946..33efe33 100644 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/SPVRemapper.h +++ b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/SPVRemapper.h @@ -43,12 +43,6 @@ namespace spv { -// MSVC defines __cplusplus as an older value, even when it supports almost all of 11. -// We handle that here by making our own symbol. -#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1700) -# define use_cpp11 1 -#endif - class spirvbin_base_t { public: @@ -74,27 +68,6 @@ class spirvbin_base_t } // namespace SPV -#if !defined (use_cpp11) -#include -#include - -namespace spv { -class spirvbin_t : public spirvbin_base_t -{ -public: - spirvbin_t(int /*verbose = 0*/) { } - - void remap(std::vector& /*spv*/, unsigned int /*opts = 0*/) - { - printf("Tool not compiled for C++11, which is required for SPIR-V remapping.\n"); - exit(5); - } -}; - -} // namespace SPV - -#else // defined (use_cpp11) - #include #include #include @@ -104,9 +77,9 @@ class spirvbin_t : public spirvbin_base_t #include #include "spirv.hpp" -#include "spvIR.h" namespace spv { +const Id NoResult = 0; // class to hold SPIR-V binary data for remapping, DCE, and debug stripping class spirvbin_t : public spirvbin_base_t @@ -308,5 +281,4 @@ class spirvbin_t : public spirvbin_base_t } // namespace SPV -#endif // defined (use_cpp11) #endif // SPIRVREMAPPER_H diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/SpvBuilder.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/SpvBuilder.h deleted file mode 100644 index 02e9cf4..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/SpvBuilder.h +++ /dev/null @@ -1,961 +0,0 @@ -// -// Copyright (C) 2014-2015 LunarG, Inc. -// Copyright (C) 2015-2020 Google, Inc. -// Copyright (C) 2017 ARM Limited. -// Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved. -// -// 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. - -// -// "Builder" is an interface to fully build SPIR-V IR. Allocate one of -// these to build (a thread safe) internal SPIR-V representation (IR), -// and then dump it as a binary stream according to the SPIR-V specification. -// -// A Builder has a 1:1 relationship with a SPIR-V module. -// - -#pragma once -#ifndef SpvBuilder_H -#define SpvBuilder_H - -#include "Logger.h" -#include "spirv.hpp" -#include "spvIR.h" -namespace spv { - #include "GLSL.ext.KHR.h" - #include "NonSemanticShaderDebugInfo100.h" -} - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace spv { - -typedef enum { - Spv_1_0 = (1 << 16), - Spv_1_1 = (1 << 16) | (1 << 8), - Spv_1_2 = (1 << 16) | (2 << 8), - Spv_1_3 = (1 << 16) | (3 << 8), - Spv_1_4 = (1 << 16) | (4 << 8), - Spv_1_5 = (1 << 16) | (5 << 8), -} SpvVersion; - -class Builder { -public: - Builder(unsigned int spvVersion, unsigned int userNumber, SpvBuildLogger* logger); - virtual ~Builder(); - - static const int maxMatrixSize = 4; - - unsigned int getSpvVersion() const { return spvVersion; } - - void setSource(spv::SourceLanguage lang, int version) - { - sourceLang = lang; - sourceVersion = version; - } - spv::Id getStringId(const std::string& str) - { - auto sItr = stringIds.find(str); - if (sItr != stringIds.end()) - return sItr->second; - spv::Id strId = getUniqueId(); - Instruction* fileString = new Instruction(strId, NoType, OpString); - const char* file_c_str = str.c_str(); - fileString->addStringOperand(file_c_str); - strings.push_back(std::unique_ptr(fileString)); - module.mapInstruction(fileString); - stringIds[file_c_str] = strId; - return strId; - } - spv::Id getSourceFile() const - { - return sourceFileStringId; - } - void setSourceFile(const std::string& file) - { - sourceFileStringId = getStringId(file); - currentFileId = sourceFileStringId; - } - void setSourceText(const std::string& text) { sourceText = text; } - void addSourceExtension(const char* ext) { sourceExtensions.push_back(ext); } - void addModuleProcessed(const std::string& p) { moduleProcesses.push_back(p.c_str()); } - void setEmitOpLines() { emitOpLines = true; } - void setEmitNonSemanticShaderDebugInfo(bool const emit) - { - emitNonSemanticShaderDebugInfo = emit; - - if(emit) - { - importNonSemanticShaderDebugInfoInstructions(); - } - } - void setEmitNonSemanticShaderDebugSource(bool const src) - { - emitNonSemanticShaderDebugSource = src; - } - void addExtension(const char* ext) { extensions.insert(ext); } - void removeExtension(const char* ext) - { - extensions.erase(ext); - } - void addIncorporatedExtension(const char* ext, SpvVersion incorporatedVersion) - { - if (getSpvVersion() < static_cast(incorporatedVersion)) - addExtension(ext); - } - void promoteIncorporatedExtension(const char* baseExt, const char* promoExt, SpvVersion incorporatedVersion) - { - removeExtension(baseExt); - addIncorporatedExtension(promoExt, incorporatedVersion); - } - void addInclude(const std::string& name, const std::string& text) - { - spv::Id incId = getStringId(name); - includeFiles[incId] = &text; - } - Id import(const char*); - void setMemoryModel(spv::AddressingModel addr, spv::MemoryModel mem) - { - addressModel = addr; - memoryModel = mem; - } - - void addCapability(spv::Capability cap) { capabilities.insert(cap); } - - // To get a new for anything needing a new one. - Id getUniqueId() { return ++uniqueId; } - - // To get a set of new s, e.g., for a set of function parameters - Id getUniqueIds(int numIds) - { - Id id = uniqueId + 1; - uniqueId += numIds; - return id; - } - - // Generate OpLine for non-filename-based #line directives (ie no filename - // seen yet): Log the current line, and if different than the last one, - // issue a new OpLine using the new line and current source file name. - void setLine(int line); - - // If filename null, generate OpLine for non-filename-based line directives, - // else do filename-based: Log the current line and file, and if different - // than the last one, issue a new OpLine using the new line and file - // name. - void setLine(int line, const char* filename); - // Low-level OpLine. See setLine() for a layered helper. - void addLine(Id fileName, int line, int column); - void addDebugScopeAndLine(Id fileName, int line, int column); - - // For creating new types (will return old type if the requested one was already made). - Id makeVoidType(); - Id makeBoolType(bool const compilerGenerated = true); - Id makePointer(StorageClass, Id pointee); - Id makeForwardPointer(StorageClass); - Id makePointerFromForwardPointer(StorageClass, Id forwardPointerType, Id pointee); - Id makeIntegerType(int width, bool hasSign); // generic - Id makeIntType(int width) { return makeIntegerType(width, true); } - Id makeUintType(int width) { return makeIntegerType(width, false); } - Id makeFloatType(int width); - Id makeStructType(const std::vector& members, const char* name, bool const compilerGenerated = true); - Id makeStructResultType(Id type0, Id type1); - Id makeVectorType(Id component, int size); - Id makeMatrixType(Id component, int cols, int rows); - Id makeArrayType(Id element, Id sizeId, int stride); // 0 stride means no stride decoration - Id makeRuntimeArray(Id element); - Id makeFunctionType(Id returnType, const std::vector& paramTypes); - Id makeImageType(Id sampledType, Dim, bool depth, bool arrayed, bool ms, unsigned sampled, ImageFormat format); - Id makeSamplerType(); - Id makeSampledImageType(Id imageType); - Id makeCooperativeMatrixType(Id component, Id scope, Id rows, Id cols); - Id makeGenericType(spv::Op opcode, std::vector& operands); - - // SPIR-V NonSemantic Shader DebugInfo Instructions - struct DebugTypeLoc { - std::string name {}; - int line {0}; - int column {0}; - }; - std::unordered_map debugTypeLocs; - Id makeDebugInfoNone(); - Id makeBoolDebugType(int const size); - Id makeIntegerDebugType(int const width, bool const hasSign); - Id makeFloatDebugType(int const width); - Id makeSequentialDebugType(Id const baseType, Id const componentCount, NonSemanticShaderDebugInfo100Instructions const sequenceType); - Id makeArrayDebugType(Id const baseType, Id const componentCount); - Id makeVectorDebugType(Id const baseType, int const componentCount); - Id makeMatrixDebugType(Id const vectorType, int const vectorCount, bool columnMajor = true); - Id makeMemberDebugType(Id const memberType, DebugTypeLoc const& debugTypeLoc); - Id makeCompositeDebugType(std::vector const& memberTypes, char const*const name, - NonSemanticShaderDebugInfo100DebugCompositeType const tag, bool const isOpaqueType = false); - Id makeDebugSource(const Id fileName); - Id makeDebugCompilationUnit(); - Id createDebugGlobalVariable(Id const type, char const*const name, Id const variable); - Id createDebugLocalVariable(Id type, char const*const name, size_t const argNumber = 0); - Id makeDebugExpression(); - Id makeDebugDeclare(Id const debugLocalVariable, Id const localVariable); - Id makeDebugValue(Id const debugLocalVariable, Id const value); - Id makeDebugFunctionType(Id returnType, const std::vector& paramTypes); - Id makeDebugFunction(Function* function, Id nameId, Id funcTypeId); - Id makeDebugLexicalBlock(uint32_t line); - std::string unmangleFunctionName(std::string const& name) const; - - // accelerationStructureNV type - Id makeAccelerationStructureType(); - // rayQueryEXT type - Id makeRayQueryType(); - // hitObjectNV type - Id makeHitObjectNVType(); - - // For querying about types. - Id getTypeId(Id resultId) const { return module.getTypeId(resultId); } - Id getDerefTypeId(Id resultId) const; - Op getOpCode(Id id) const { return module.getInstruction(id)->getOpCode(); } - Op getTypeClass(Id typeId) const { return getOpCode(typeId); } - Op getMostBasicTypeClass(Id typeId) const; - int getNumComponents(Id resultId) const { return getNumTypeComponents(getTypeId(resultId)); } - int getNumTypeConstituents(Id typeId) const; - int getNumTypeComponents(Id typeId) const { return getNumTypeConstituents(typeId); } - Id getScalarTypeId(Id typeId) const; - Id getContainedTypeId(Id typeId) const; - Id getContainedTypeId(Id typeId, int) const; - StorageClass getTypeStorageClass(Id typeId) const { return module.getStorageClass(typeId); } - ImageFormat getImageTypeFormat(Id typeId) const - { return (ImageFormat)module.getInstruction(typeId)->getImmediateOperand(6); } - Id getResultingAccessChainType() const; - - bool isPointer(Id resultId) const { return isPointerType(getTypeId(resultId)); } - bool isScalar(Id resultId) const { return isScalarType(getTypeId(resultId)); } - bool isVector(Id resultId) const { return isVectorType(getTypeId(resultId)); } - bool isMatrix(Id resultId) const { return isMatrixType(getTypeId(resultId)); } - bool isCooperativeMatrix(Id resultId)const { return isCooperativeMatrixType(getTypeId(resultId)); } - bool isAggregate(Id resultId) const { return isAggregateType(getTypeId(resultId)); } - bool isSampledImage(Id resultId) const { return isSampledImageType(getTypeId(resultId)); } - - bool isBoolType(Id typeId) - { return groupedTypes[OpTypeBool].size() > 0 && typeId == groupedTypes[OpTypeBool].back()->getResultId(); } - bool isIntType(Id typeId) const - { return getTypeClass(typeId) == OpTypeInt && module.getInstruction(typeId)->getImmediateOperand(1) != 0; } - bool isUintType(Id typeId) const - { return getTypeClass(typeId) == OpTypeInt && module.getInstruction(typeId)->getImmediateOperand(1) == 0; } - bool isFloatType(Id typeId) const { return getTypeClass(typeId) == OpTypeFloat; } - bool isPointerType(Id typeId) const { return getTypeClass(typeId) == OpTypePointer; } - bool isScalarType(Id typeId) const - { return getTypeClass(typeId) == OpTypeFloat || getTypeClass(typeId) == OpTypeInt || - getTypeClass(typeId) == OpTypeBool; } - bool isVectorType(Id typeId) const { return getTypeClass(typeId) == OpTypeVector; } - bool isMatrixType(Id typeId) const { return getTypeClass(typeId) == OpTypeMatrix; } - bool isStructType(Id typeId) const { return getTypeClass(typeId) == OpTypeStruct; } - bool isArrayType(Id typeId) const { return getTypeClass(typeId) == OpTypeArray; } -#ifdef GLSLANG_WEB - bool isCooperativeMatrixType(Id typeId)const { return false; } -#else - bool isCooperativeMatrixType(Id typeId)const { return getTypeClass(typeId) == OpTypeCooperativeMatrixNV; } -#endif - bool isAggregateType(Id typeId) const - { return isArrayType(typeId) || isStructType(typeId) || isCooperativeMatrixType(typeId); } - bool isImageType(Id typeId) const { return getTypeClass(typeId) == OpTypeImage; } - bool isSamplerType(Id typeId) const { return getTypeClass(typeId) == OpTypeSampler; } - bool isSampledImageType(Id typeId) const { return getTypeClass(typeId) == OpTypeSampledImage; } - bool containsType(Id typeId, Op typeOp, unsigned int width) const; - bool containsPhysicalStorageBufferOrArray(Id typeId) const; - - 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)); } - - bool isVariableOpCode(Op opcode) const { return opcode == OpVariable; } - bool isVariable(Id resultId) const { return isVariableOpCode(getOpCode(resultId)); } - bool isGlobalStorage(Id resultId) const { return getStorageClass(resultId) != StorageClassFunction; } - bool isGlobalVariable(Id resultId) const { return isVariable(resultId) && isGlobalStorage(resultId); } - // See if a resultId is valid for use as an initializer. - bool isValidInitializer(Id resultId) const { return isConstant(resultId) || isGlobalVariable(resultId); } - - bool isRayTracingOpCode(Op opcode) const; - - int getScalarTypeWidth(Id typeId) const - { - Id scalarTypeId = getScalarTypeId(typeId); - assert(getTypeClass(scalarTypeId) == OpTypeInt || getTypeClass(scalarTypeId) == OpTypeFloat); - return module.getInstruction(scalarTypeId)->getImmediateOperand(0); - } - - int getTypeNumColumns(Id typeId) const - { - assert(isMatrixType(typeId)); - return getNumTypeConstituents(typeId); - } - int getNumColumns(Id resultId) const { return getTypeNumColumns(getTypeId(resultId)); } - int getTypeNumRows(Id typeId) const - { - assert(isMatrixType(typeId)); - return getNumTypeComponents(getContainedTypeId(typeId)); - } - int getNumRows(Id resultId) const { return getTypeNumRows(getTypeId(resultId)); } - - Dim getTypeDimensionality(Id typeId) const - { - assert(isImageType(typeId)); - return (Dim)module.getInstruction(typeId)->getImmediateOperand(1); - } - Id getImageType(Id resultId) const - { - Id typeId = getTypeId(resultId); - assert(isImageType(typeId) || isSampledImageType(typeId)); - return isSampledImageType(typeId) ? module.getInstruction(typeId)->getIdOperand(0) : typeId; - } - bool isArrayedImageType(Id typeId) const - { - assert(isImageType(typeId)); - return module.getInstruction(typeId)->getImmediateOperand(3) != 0; - } - - // For making new constants (will return old constant if the requested one was already made). - Id makeNullConstant(Id typeId); - Id makeBoolConstant(bool b, bool specConstant = false); - Id makeInt8Constant(int i, bool specConstant = false) - { return makeIntConstant(makeIntType(8), (unsigned)i, specConstant); } - Id makeUint8Constant(unsigned u, bool specConstant = false) - { return makeIntConstant(makeUintType(8), u, specConstant); } - Id makeInt16Constant(int i, bool specConstant = false) - { return makeIntConstant(makeIntType(16), (unsigned)i, specConstant); } - Id makeUint16Constant(unsigned u, bool specConstant = false) - { return makeIntConstant(makeUintType(16), u, specConstant); } - 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); - Id makeFloat16Constant(float f16, bool specConstant = false); - Id makeFpConstant(Id type, double d, bool specConstant = false); - - Id importNonSemanticShaderDebugInfoInstructions(); - - // Turn the array of constants into a proper spv constant of the requested type. - Id makeCompositeConstant(Id type, const std::vector& comps, bool specConst = false); - - // Methods for adding information outside the CFG. - Instruction* addEntryPoint(ExecutionModel, Function*, const char* name); - void addExecutionMode(Function*, ExecutionMode mode, int value1 = -1, int value2 = -1, int value3 = -1); - void addExecutionMode(Function*, ExecutionMode mode, const std::vector& literals); - void addExecutionModeId(Function*, ExecutionMode mode, const std::vector& operandIds); - void addName(Id, const char* name); - void addMemberName(Id, int member, const char* name); - void addDecoration(Id, Decoration, int num = -1); - void addDecoration(Id, Decoration, const char*); - void addDecoration(Id, Decoration, const std::vector& literals); - void addDecoration(Id, Decoration, const std::vector& strings); - void addDecorationId(Id id, Decoration, Id idDecoration); - void addDecorationId(Id id, Decoration, const std::vector& operandIds); - void addMemberDecoration(Id, unsigned int member, Decoration, int num = -1); - void addMemberDecoration(Id, unsigned int member, Decoration, const char*); - void addMemberDecoration(Id, unsigned int member, Decoration, const std::vector& literals); - void addMemberDecoration(Id, unsigned int member, Decoration, const std::vector& strings); - - // At the end of what block do the next create*() instructions go? - // Also reset current last DebugScope and current source line to unknown - void setBuildPoint(Block* bp) { - buildPoint = bp; - lastDebugScopeId = NoResult; - currentLine = 0; - } - Block* getBuildPoint() const { return buildPoint; } - - // Make the entry-point function. The returned pointer is only valid - // for the lifetime of this builder. - 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. - // The returned pointer is only valid for the lifetime of this builder. - Function* makeFunctionEntry(Decoration precision, Id returnType, const char* name, - const std::vector& paramTypes, const std::vector& paramNames, - const std::vector>& precisions, Block **entry = nullptr); - - // Create a return. An 'implicit' return is one not appearing in the source - // code. In the case of an implicit return, no post-return block is inserted. - void makeReturn(bool implicit, Id retVal = 0); - - // Initialize state and generate instructions for new lexical scope - void enterScope(uint32_t line); - - // Set state and generate instructions to exit current lexical scope - void leaveScope(); - - // Prepare builder for generation of instructions for a function. - void enterFunction(Function const* function); - - // Generate all the code needed to finish up a function. - void leaveFunction(); - - // Create block terminator instruction for certain statements like - // discard, terminate-invocation, terminateRayEXT, or ignoreIntersectionEXT - void makeStatementTerminator(spv::Op opcode, const char *name); - - // Create block terminator instruction for statements that have input operands - // such as OpEmitMeshTasksEXT - void makeStatementTerminator(spv::Op opcode, const std::vector& operands, const char* name); - - // Create a global or function local or IO variable. - Id createVariable(Decoration precision, StorageClass storageClass, Id type, const char* name = nullptr, - Id initializer = NoResult, bool const compilerGenerated = true); - - // Create an intermediate with an undefined value. - Id createUndefined(Id type); - - // Store into an Id and return the l-value - void createStore(Id rValue, Id lValue, spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone, - spv::Scope scope = spv::ScopeMax, unsigned int alignment = 0); - - // Load from an Id and return it - Id createLoad(Id lValue, spv::Decoration precision, - spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone, - spv::Scope scope = spv::ScopeMax, unsigned int alignment = 0); - - // Create an OpAccessChain instruction - Id createAccessChain(StorageClass, Id base, const std::vector& offsets); - - // Create an OpArrayLength instruction - Id createArrayLength(Id base, unsigned int member); - - // Create an OpCooperativeMatrixLengthNV instruction - Id createCooperativeMatrixLength(Id type); - - // Create an OpCompositeExtract instruction - Id createCompositeExtract(Id composite, Id typeId, unsigned index); - Id createCompositeExtract(Id composite, Id typeId, const std::vector& indexes); - Id createCompositeInsert(Id object, Id composite, Id typeId, unsigned index); - Id createCompositeInsert(Id object, Id composite, Id typeId, const std::vector& indexes); - - Id createVectorExtractDynamic(Id vector, Id typeId, Id componentIndex); - Id createVectorInsertDynamic(Id vector, Id typeId, Id component, Id componentIndex); - - void createNoResultOp(Op); - void createNoResultOp(Op, Id operand); - void createNoResultOp(Op, const std::vector& operands); - void createNoResultOp(Op, const std::vector& operands); - void createControlBarrier(Scope execution, Scope memory, MemorySemanticsMask); - void createMemoryBarrier(unsigned executionScope, unsigned memorySemantics); - Id createUnaryOp(Op, Id typeId, Id operand); - Id createBinOp(Op, Id typeId, Id operand1, Id operand2); - Id createTriOp(Op, Id typeId, Id operand1, Id operand2, Id operand3); - Id createOp(Op, Id typeId, const std::vector& operands); - Id createOp(Op, Id typeId, const std::vector& operands); - Id createFunctionCall(spv::Function*, const 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. - Id createRvalueSwizzle(Decoration precision, Id typeId, Id source, const std::vector& channels); - - // Take a copy of an lvalue (target) and a source of components, and set the - // source components into the lvalue where the 'channels' say to put them. - // An updated version of the target is returned. - // (No true lvalue or stores are used.) - Id createLvalueSwizzle(Id typeId, Id target, Id source, const std::vector& channels); - - // If both the id and precision are valid, the id - // gets tagged with the requested precision. - // The passed in id is always the returned id, to simplify use patterns. - Id setPrecision(Id id, Decoration precision) - { - if (precision != NoPrecision && id != NoResult) - addDecoration(id, precision); - - return id; - } - - // Can smear a scalar to a vector for the following forms: - // - promoteScalar(scalar, vector) // smear scalar to width of vector - // - promoteScalar(vector, scalar) // smear scalar to width of vector - // - promoteScalar(pointer, scalar) // smear scalar to width of what pointer points to - // - promoteScalar(scalar, scalar) // do nothing - // Other forms are not allowed. - // - // Generally, the type of 'scalar' does not need to be the same type as the components in 'vector'. - // The type of the created vector is a vector of components of the same type as the scalar. - // - // Note: One of the arguments will change, with the result coming back that way rather than - // through the return value. - void promoteScalar(Decoration precision, Id& left, Id& right); - - // Make a value by smearing the scalar to fill the type. - // vectorType should be the correct type for making a vector of scalarVal. - // (No conversions are done.) - Id smearScalar(Decoration precision, Id scalarVal, Id vectorType); - - // Create a call to a built-in function. - Id createBuiltinCall(Id resultType, Id builtins, int entryPoint, const std::vector& args); - - // List of parameters used to create a texture operation - struct TextureParameters { - Id sampler; - Id coords; - Id bias; - Id lod; - Id Dref; - Id offset; - Id offsets; - Id gradX; - Id gradY; - Id sample; - Id component; - Id texelOut; - Id lodClamp; - Id granularity; - Id coarse; - bool nonprivate; - bool volatil; - }; - - // Select the correct texture operation based on all inputs, and emit the correct instruction - Id createTextureCall(Decoration precision, Id resultType, bool sparse, bool fetch, bool proj, bool gather, - bool noImplicit, const TextureParameters&, ImageOperandsMask); - - // Emit the OpTextureQuery* instruction that was passed in. - // Figure out the right return value and type, and return it. - Id createTextureQueryCall(Op, const TextureParameters&, bool isUnsignedResult); - - Id createSamplePositionCall(Decoration precision, Id, Id); - - Id createBitFieldExtractCall(Decoration precision, Id, Id, Id, bool isSigned); - Id createBitFieldInsertCall(Decoration precision, Id, Id, Id, Id); - - // Reduction comparison for composites: For equal and not-equal resulting in a scalar. - Id createCompositeCompare(Decoration precision, Id, Id, bool /* true if for equal, false if for not-equal */); - - // OpCompositeConstruct - Id createCompositeConstruct(Id typeId, const std::vector& constituents); - - // vector or scalar constructor - Id createConstructor(Decoration precision, const std::vector& sources, Id resultTypeId); - - // matrix constructor - Id createMatrixConstructor(Decoration precision, const std::vector& sources, Id constructee); - - // Helper to use for building nested control flow with if-then-else. - class If { - public: - If(Id condition, unsigned int ctrl, Builder& builder); - ~If() {} - - void makeBeginElse(); - void makeEndIf(); - - private: - If(const If&); - If& operator=(If&); - - Builder& builder; - Id condition; - unsigned int control; - Function* function; - Block* headerBlock; - Block* thenBlock; - Block* elseBlock; - Block* mergeBlock; - }; - - // Make a switch statement. A switch has 'numSegments' of pieces of code, not containing - // any case/default labels, all separated by one or more case/default labels. Each possible - // case value v is a jump to the caseValues[v] segment. The defaultSegment is also in this - // number space. How to compute the value is given by 'condition', as in switch(condition). - // - // The SPIR-V Builder will maintain the stack of post-switch merge blocks for nested switches. - // - // Use a defaultSegment < 0 if there is no default segment (to branch to post switch). - // - // Returns the right set of basic blocks to start each code segment with, so that the caller's - // recursion stack can hold the memory for it. - // - void makeSwitch(Id condition, unsigned int control, int numSegments, const std::vector& caseValues, - const std::vector& valueToSegment, int defaultSegment, std::vector& segmentBB); - - // Add a branch to the innermost switch's merge block. - void addSwitchBreak(); - - // Move to the next code segment, passing in the return argument in makeSwitch() - void nextSwitchSegment(std::vector& segmentBB, int segment); - - // Finish off the innermost switch. - void endSwitch(std::vector& segmentBB); - - struct LoopBlocks { - LoopBlocks(Block& head, Block& body, Block& merge, Block& continue_target) : - head(head), body(body), merge(merge), continue_target(continue_target) { } - Block &head, &body, &merge, &continue_target; - private: - LoopBlocks(); - LoopBlocks& operator=(const LoopBlocks&) = delete; - }; - - // Start a new loop and prepare the builder to generate code for it. Until - // closeLoop() is called for this loop, createLoopContinue() and - // createLoopExit() will target its corresponding blocks. - LoopBlocks& makeNewLoop(); - - // Create a new block in the function containing the build point. Memory is - // owned by the function object. - Block& makeNewBlock(); - - // Add a branch to the continue_target of the current (innermost) loop. - void createLoopContinue(); - - // Add an exit (e.g. "break") from the innermost loop that we're currently - // in. - void createLoopExit(); - - // Close the innermost loop that you're in - void closeLoop(); - - // - // Access chain design for an R-Value vs. L-Value: - // - // There is a single access chain the builder is building at - // any particular time. Such a chain can be used to either to a load or - // a store, when desired. - // - // Expressions can be r-values, l-values, or both, or only r-values: - // a[b.c].d = .... // l-value - // ... = a[b.c].d; // r-value, that also looks like an l-value - // ++a[b.c].d; // r-value and l-value - // (x + y)[2]; // r-value only, can't possibly be l-value - // - // Computing an r-value means generating code. Hence, - // r-values should only be computed when they are needed, not speculatively. - // - // Computing an l-value means saving away information for later use in the compiler, - // no code is generated until the l-value is later dereferenced. It is okay - // to speculatively generate an l-value, just not okay to speculatively dereference it. - // - // The base of the access chain (the left-most variable or expression - // from which everything is based) can be set either as an l-value - // or as an r-value. Most efficient would be to set an l-value if one - // is available. If an expression was evaluated, the resulting r-value - // can be set as the chain base. - // - // The users of this single access chain can save and restore if they - // want to nest or manage multiple chains. - // - - struct AccessChain { - Id base; // for l-values, pointer to the base object, for r-values, the base object - std::vector indexChain; - Id instr; // cache the instruction that generates this access chain - std::vector swizzle; // each std::vector element selects the next GLSL component number - Id component; // a dynamic component index, can coexist with a swizzle, - // done after the swizzle, NoResult if not present - Id preSwizzleBaseType; // dereferenced type, before swizzle or component is applied; - // NoType unless a swizzle or component is present - bool isRValue; // true if 'base' is an r-value, otherwise, base is an l-value - unsigned int alignment; // bitwise OR of alignment values passed in. Accumulates worst alignment. - // Only tracks base and (optional) component selection alignment. - - // Accumulate whether anything in the chain of structures has coherent decorations. - struct CoherentFlags { - CoherentFlags() { clear(); } -#ifdef GLSLANG_WEB - void clear() { } - bool isVolatile() const { return false; } - CoherentFlags operator |=(const CoherentFlags &other) { return *this; } -#else - bool isVolatile() const { return volatil; } - bool isNonUniform() const { return nonUniform; } - bool anyCoherent() const { - return coherent || devicecoherent || queuefamilycoherent || workgroupcoherent || - subgroupcoherent || shadercallcoherent; - } - - unsigned coherent : 1; - unsigned devicecoherent : 1; - unsigned queuefamilycoherent : 1; - unsigned workgroupcoherent : 1; - unsigned subgroupcoherent : 1; - unsigned shadercallcoherent : 1; - unsigned nonprivate : 1; - unsigned volatil : 1; - unsigned isImage : 1; - unsigned nonUniform : 1; - - void clear() { - coherent = 0; - devicecoherent = 0; - queuefamilycoherent = 0; - workgroupcoherent = 0; - subgroupcoherent = 0; - shadercallcoherent = 0; - nonprivate = 0; - volatil = 0; - isImage = 0; - nonUniform = 0; - } - - CoherentFlags operator |=(const CoherentFlags &other) { - coherent |= other.coherent; - devicecoherent |= other.devicecoherent; - queuefamilycoherent |= other.queuefamilycoherent; - workgroupcoherent |= other.workgroupcoherent; - subgroupcoherent |= other.subgroupcoherent; - shadercallcoherent |= other.shadercallcoherent; - nonprivate |= other.nonprivate; - volatil |= other.volatil; - isImage |= other.isImage; - nonUniform |= other.nonUniform; - return *this; - } -#endif - }; - CoherentFlags coherentFlags; - }; - - // - // the SPIR-V builder maintains a single active chain that - // the following methods operate on - // - - // for external save and restore - AccessChain getAccessChain() { return accessChain; } - void setAccessChain(AccessChain newChain) { accessChain = newChain; } - - // clear accessChain - void clearAccessChain(); - - // set new base as an l-value base - void setAccessChainLValue(Id lValue) - { - assert(isPointer(lValue)); - accessChain.base = lValue; - } - - // set new base value as an r-value - void setAccessChainRValue(Id rValue) - { - accessChain.isRValue = true; - accessChain.base = rValue; - } - - // push offset onto the end of the chain - void accessChainPush(Id offset, AccessChain::CoherentFlags coherentFlags, unsigned int alignment) - { - accessChain.indexChain.push_back(offset); - accessChain.coherentFlags |= coherentFlags; - accessChain.alignment |= alignment; - } - - // push new swizzle onto the end of any existing swizzle, merging into a single swizzle - void accessChainPushSwizzle(std::vector& swizzle, Id preSwizzleBaseType, - AccessChain::CoherentFlags coherentFlags, unsigned int alignment); - - // push a dynamic component selection onto the access chain, only applicable with a - // non-trivial swizzle or no swizzle - void accessChainPushComponent(Id component, Id preSwizzleBaseType, AccessChain::CoherentFlags coherentFlags, - unsigned int alignment) - { - if (accessChain.swizzle.size() != 1) { - accessChain.component = component; - if (accessChain.preSwizzleBaseType == NoType) - accessChain.preSwizzleBaseType = preSwizzleBaseType; - } - accessChain.coherentFlags |= coherentFlags; - accessChain.alignment |= alignment; - } - - // use accessChain and swizzle to store value - void accessChainStore(Id rvalue, Decoration nonUniform, - spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone, - spv::Scope scope = spv::ScopeMax, unsigned int alignment = 0); - - // use accessChain and swizzle to load an r-value - Id accessChainLoad(Decoration precision, Decoration l_nonUniform, Decoration r_nonUniform, Id ResultType, - spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone, spv::Scope scope = spv::ScopeMax, - unsigned int alignment = 0); - - // Return whether or not the access chain can be represented in SPIR-V - // as an l-value. - // E.g., a[3].yx cannot be, while a[3].y and a[3].y[x] can be. - bool isSpvLvalue() const { return accessChain.swizzle.size() <= 1; } - - // get the direct pointer for an l-value - Id accessChainGetLValue(); - - // Get the inferred SPIR-V type of the result of the current access chain, - // based on the type of the base and the chain of dereferences. - Id accessChainGetInferredType(); - - // Add capabilities, extensions, remove unneeded decorations, etc., - // based on the resulting SPIR-V. - void postProcess(); - - // Prune unreachable blocks in the CFG and remove unneeded decorations. - void postProcessCFG(); - -#ifndef GLSLANG_WEB - // Add capabilities, extensions based on instructions in the module. - void postProcessFeatures(); - // Hook to visit each instruction in a block in a function - void postProcess(Instruction&); - // Hook to visit each non-32-bit sized float/int operation in a block. - void postProcessType(const Instruction&, spv::Id typeId); -#endif - - void dump(std::vector&) const; - - void createBranch(Block* block); - void createConditionalBranch(Id condition, Block* thenBlock, Block* elseBlock); - void createLoopMerge(Block* mergeBlock, Block* continueBlock, unsigned int control, - const std::vector& operands); - - // 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 makeInt64Constant(Id typeId, unsigned long long value, bool specConstant); - Id findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned value); - Id findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned v1, unsigned v2); - Id findCompositeConstant(Op typeClass, Id typeId, const std::vector& comps); - Id findStructConstant(Id typeId, const std::vector& comps); - Id collapseAccessChain(); - void remapDynamicSwizzle(); - void transferAccessChainSwizzle(bool dynamic); - void simplifyAccessChainSwizzle(); - void createAndSetNoPredecessorBlock(const char*); - void createSelectionMerge(Block* mergeBlock, unsigned int control); - void dumpSourceInstructions(std::vector&) const; - void dumpSourceInstructions(const spv::Id fileId, const std::string& text, std::vector&) const; - void dumpInstructions(std::vector&, const std::vector >&) const; - void dumpModuleProcesses(std::vector&) const; - spv::MemoryAccessMask sanitizeMemoryAccessForStorageClass(spv::MemoryAccessMask memoryAccess, StorageClass sc) - const; - - unsigned int spvVersion; // the version of SPIR-V to emit in the header - SourceLanguage sourceLang; - int sourceVersion; - spv::Id sourceFileStringId; - spv::Id nonSemanticShaderCompilationUnitId {0}; - spv::Id nonSemanticShaderDebugInfo {0}; - spv::Id debugInfoNone {0}; - spv::Id debugExpression {0}; // Debug expression with zero operations. - std::string sourceText; - int currentLine; - const char* currentFile; - spv::Id currentFileId; - std::stack currentDebugScopeId; - spv::Id lastDebugScopeId; - bool emitOpLines; - bool emitNonSemanticShaderDebugInfo; - bool restoreNonSemanticShaderDebugInfo; - bool emitNonSemanticShaderDebugSource; - std::set extensions; - std::vector sourceExtensions; - std::vector moduleProcesses; - AddressingModel addressModel; - MemoryModel memoryModel; - std::set capabilities; - int builderNumber; - Module module; - Block* buildPoint; - Id uniqueId; - Function* entryPointFunction; - bool generatingOpCodeForSpecConst; - AccessChain accessChain; - - // special blocks of instructions for output - std::vector > strings; - std::vector > imports; - std::vector > entryPoints; - std::vector > executionModes; - std::vector > names; - std::vector > decorations; - std::vector > constantsTypesGlobals; - std::vector > externals; - std::vector > functions; - - // not output, internally used for quick & dirty canonical (unique) creation - - // map type opcodes to constant inst. - std::unordered_map> groupedConstants; - // map struct-id to constant instructions - std::unordered_map> groupedStructConstants; - // map type opcodes to type instructions - std::unordered_map> groupedTypes; - // map type opcodes to debug type instructions - std::unordered_map> groupedDebugTypes; - // list of OpConstantNull instructions - std::vector nullConstants; - - // stack of switches - std::stack switchMerges; - - // Our loop stack. - std::stack loops; - - // map from strings to their string ids - std::unordered_map stringIds; - - // map from include file name ids to their contents - std::map includeFiles; - - // map from core id to debug id - std::map debugId; - - // map from file name string id to DebugSource id - std::unordered_map debugSourceId; - - // The stream for outputting warnings and errors. - SpvBuildLogger* logger; -}; // end Builder class - -}; // end spv namespace - -#endif // SpvBuilder_H diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/SpvTools.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/SpvTools.h deleted file mode 100644 index 6fc4e40..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/SpvTools.h +++ /dev/null @@ -1,112 +0,0 @@ -// -// Copyright (C) 2014-2016 LunarG, Inc. -// Copyright (C) 2018 Google, Inc. -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// -// Neither the name of 3Dlabs Inc. Ltd. nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. - -// -// Call into SPIRV-Tools to disassemble, validate, and optimize. -// - -#pragma once -#ifndef GLSLANG_SPV_TOOLS_H -#define GLSLANG_SPV_TOOLS_H - -#if ENABLE_OPT -#include -#include -#include "spirv-tools/libspirv.h" -#endif - -#include "glslang/MachineIndependent/localintermediate.h" -#include "Logger.h" - -namespace glslang { - -struct SpvOptions { - bool generateDebugInfo {false}; - bool stripDebugInfo {false}; - bool disableOptimizer {true}; - bool optimizeSize {false}; - bool disassemble {false}; - bool validate {false}; - bool emitNonSemanticShaderDebugInfo {false}; - bool emitNonSemanticShaderDebugSource{ false }; -}; - -#if ENABLE_OPT - -// Translate glslang's view of target versioning to what SPIRV-Tools uses. -spv_target_env MapToSpirvToolsEnv(const SpvVersion& spvVersion, spv::SpvBuildLogger* logger); - -// Use the SPIRV-Tools disassembler to print SPIR-V using a SPV_ENV_UNIVERSAL_1_3 environment. -void SpirvToolsDisassemble(std::ostream& out, const std::vector& spirv); - -// Use the SPIRV-Tools disassembler to print SPIR-V with a provided SPIR-V environment. -void SpirvToolsDisassemble(std::ostream& out, const std::vector& spirv, - spv_target_env requested_context); - -// Apply the SPIRV-Tools validator to generated SPIR-V. -void SpirvToolsValidate(const glslang::TIntermediate& intermediate, std::vector& spirv, - spv::SpvBuildLogger*, bool prelegalization); - -// Apply the SPIRV-Tools optimizer to generated SPIR-V. HLSL SPIR-V is legalized in the process. -void SpirvToolsTransform(const glslang::TIntermediate& intermediate, std::vector& spirv, - spv::SpvBuildLogger*, const SpvOptions*); - -// Apply the SPIRV-Tools EliminateDeadInputComponents pass to generated SPIR-V. Put result in |spirv|. -void SpirvToolsEliminateDeadInputComponents(spv_target_env target_env, std::vector& spirv, - spv::SpvBuildLogger*); - -// Apply the SPIRV-Tools AnalyzeDeadOutputStores pass to generated SPIR-V. Put result in |live_locs|. -// Return true if the result is valid. -bool SpirvToolsAnalyzeDeadOutputStores(spv_target_env target_env, std::vector& spirv, - std::unordered_set* live_locs, - std::unordered_set* live_builtins, spv::SpvBuildLogger*); - -// Apply the SPIRV-Tools EliminateDeadOutputStores and AggressiveDeadCodeElimination passes to generated SPIR-V using -// |live_locs|. Put result in |spirv|. -void SpirvToolsEliminateDeadOutputStores(spv_target_env target_env, std::vector& spirv, - std::unordered_set* live_locs, - std::unordered_set* live_builtins, spv::SpvBuildLogger*); - -// Apply the SPIRV-Tools optimizer to strip debug info from SPIR-V. This is implicitly done by -// SpirvToolsTransform if spvOptions->stripDebugInfo is set, but can be called separately if -// optimization is disabled. -void SpirvToolsStripDebugInfo(const glslang::TIntermediate& intermediate, - std::vector& spirv, spv::SpvBuildLogger*); - -#endif - -} // end namespace glslang - -#endif // GLSLANG_SPV_TOOLS_H diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/bitutils.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/bitutils.h deleted file mode 100644 index 22e44ce..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/bitutils.h +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) 2015-2016 The Khronos Group Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef LIBSPIRV_UTIL_BITUTILS_H_ -#define LIBSPIRV_UTIL_BITUTILS_H_ - -#include -#include - -namespace spvutils { - -// Performs a bitwise copy of source to the destination type Dest. -template -Dest BitwiseCast(Src source) { - Dest dest; - static_assert(sizeof(source) == sizeof(dest), - "BitwiseCast: Source and destination must have the same size"); - std::memcpy(static_cast(&dest), &source, sizeof(dest)); - return dest; -} - -// SetBits returns an integer of type with bits set -// for position through , counting from the least -// significant bit. In particular when Num == 0, no positions are set to 1. -// A static assert will be triggered if First + Num > sizeof(T) * 8, that is, -// a bit that will not fit in the underlying type is set. -template -struct SetBits { - static_assert(First < sizeof(T) * 8, - "Tried to set a bit that is shifted too far."); - const static T get = (T(1) << First) | SetBits::get; -}; - -template -struct SetBits { - const static T get = T(0); -}; - -// This is all compile-time so we can put our tests right here. -static_assert(SetBits::get == uint32_t(0x00000000), - "SetBits failed"); -static_assert(SetBits::get == uint32_t(0x00000001), - "SetBits failed"); -static_assert(SetBits::get == uint32_t(0x80000000), - "SetBits failed"); -static_assert(SetBits::get == uint32_t(0x00000006), - "SetBits failed"); -static_assert(SetBits::get == uint32_t(0xc0000000), - "SetBits failed"); -static_assert(SetBits::get == uint32_t(0x7FFFFFFF), - "SetBits failed"); -static_assert(SetBits::get == uint32_t(0xFFFFFFFF), - "SetBits failed"); -static_assert(SetBits::get == uint32_t(0xFFFF0000), - "SetBits failed"); - -static_assert(SetBits::get == uint64_t(0x0000000000000001LL), - "SetBits failed"); -static_assert(SetBits::get == uint64_t(0x8000000000000000LL), - "SetBits failed"); -static_assert(SetBits::get == uint64_t(0xc000000000000000LL), - "SetBits failed"); -static_assert(SetBits::get == uint64_t(0x0000000080000000LL), - "SetBits failed"); -static_assert(SetBits::get == uint64_t(0x00000000FFFF0000LL), - "SetBits failed"); - -} // namespace spvutils - -#endif // LIBSPIRV_UTIL_BITUTILS_H_ diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/doc.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/doc.h deleted file mode 100644 index 7e15599..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/doc.h +++ /dev/null @@ -1,259 +0,0 @@ -// -// 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. - -// -// Parameterize the SPIR-V enumerants. -// - -#pragma once - -#include "spirv.hpp" - -#include - -namespace spv { - -// Fill in all the parameters -void Parameterize(); - -// Return the English names of all the enums. -const char* SourceString(int); -const char* AddressingString(int); -const char* MemoryString(int); -const char* ExecutionModelString(int); -const char* ExecutionModeString(int); -const char* StorageClassString(int); -const char* DecorationString(int); -const char* BuiltInString(int); -const char* DimensionString(int); -const char* SelectControlString(int); -const char* LoopControlString(int); -const char* FunctionControlString(int); -const char* SamplerAddressingModeString(int); -const char* SamplerFilterModeString(int); -const char* ImageFormatString(int); -const char* ImageChannelOrderString(int); -const char* ImageChannelTypeString(int); -const char* ImageChannelDataTypeString(int type); -const char* ImageOperandsString(int format); -const char* ImageOperands(int); -const char* FPFastMathString(int); -const char* FPRoundingModeString(int); -const char* LinkageTypeString(int); -const char* FuncParamAttrString(int); -const char* AccessQualifierString(int); -const char* MemorySemanticsString(int); -const char* MemoryAccessString(int); -const char* ExecutionScopeString(int); -const char* GroupOperationString(int); -const char* KernelEnqueueFlagsString(int); -const char* KernelProfilingInfoString(int); -const char* CapabilityString(int); -const char* OpcodeString(int); -const char* ScopeString(int mem); - -// For grouping opcodes into subsections -enum OpcodeClass { - OpClassMisc, - OpClassDebug, - OpClassAnnotate, - OpClassExtension, - OpClassMode, - OpClassType, - OpClassConstant, - OpClassMemory, - OpClassFunction, - OpClassImage, - OpClassConvert, - OpClassComposite, - OpClassArithmetic, - OpClassBit, - OpClassRelationalLogical, - OpClassDerivative, - OpClassFlowControl, - OpClassAtomic, - OpClassPrimitive, - OpClassBarrier, - OpClassGroup, - OpClassDeviceSideEnqueue, - OpClassPipe, - - OpClassCount, - OpClassMissing // all instructions start out as missing -}; - -// For parameterizing operands. -enum OperandClass { - OperandNone, - OperandId, - OperandVariableIds, - OperandOptionalLiteral, - OperandOptionalLiteralString, - OperandVariableLiterals, - OperandVariableIdLiteral, - OperandVariableLiteralId, - OperandLiteralNumber, - OperandLiteralString, - OperandVariableLiteralStrings, - OperandSource, - OperandExecutionModel, - OperandAddressing, - OperandMemory, - OperandExecutionMode, - OperandStorage, - OperandDimensionality, - OperandSamplerAddressingMode, - OperandSamplerFilterMode, - OperandSamplerImageFormat, - OperandImageChannelOrder, - OperandImageChannelDataType, - OperandImageOperands, - OperandFPFastMath, - OperandFPRoundingMode, - OperandLinkageType, - OperandAccessQualifier, - OperandFuncParamAttr, - OperandDecoration, - OperandBuiltIn, - OperandSelect, - OperandLoop, - OperandFunction, - OperandMemorySemantics, - OperandMemoryAccess, - OperandScope, - OperandGroupOperation, - OperandKernelEnqueueFlags, - OperandKernelProfilingInfo, - OperandCapability, - - OperandOpcode, - - OperandCount -}; - -// Any specific enum can have a set of capabilities that allow it: -typedef std::vector EnumCaps; - -// Parameterize a set of operands with their OperandClass(es) and descriptions. -class OperandParameters { -public: - OperandParameters() { } - void push(OperandClass oc, const char* d, bool opt = false) - { - opClass.push_back(oc); - desc.push_back(d); - optional.push_back(opt); - } - void setOptional(); - OperandClass getClass(int op) const { return opClass[op]; } - const char* getDesc(int op) const { return desc[op]; } - bool isOptional(int op) const { return optional[op]; } - int getNum() const { return (int)opClass.size(); } - -protected: - std::vector opClass; - std::vector desc; - std::vector optional; -}; - -// Parameterize an enumerant -class EnumParameters { -public: - EnumParameters() : desc(nullptr) { } - const char* desc; -}; - -// Parameterize a set of enumerants that form an enum -class EnumDefinition : public EnumParameters { -public: - EnumDefinition() : - ceiling(0), bitmask(false), getName(nullptr), enumParams(nullptr), operandParams(nullptr) { } - void set(int ceil, const char* (*name)(int), EnumParameters* ep, bool mask = false) - { - ceiling = ceil; - getName = name; - bitmask = mask; - enumParams = ep; - } - void setOperands(OperandParameters* op) { operandParams = op; } - int ceiling; // ceiling of enumerants - bool bitmask; // true if these enumerants combine into a bitmask - const char* (*getName)(int); // a function that returns the name for each enumerant value (or shift) - EnumParameters* enumParams; // parameters for each individual enumerant - OperandParameters* operandParams; // sets of operands -}; - -// Parameterize an instruction's logical format, including its known set of operands, -// per OperandParameters above. -class InstructionParameters { -public: - InstructionParameters() : - opDesc("TBD"), - opClass(OpClassMissing), - typePresent(true), // most normal, only exceptions have to be spelled out - resultPresent(true) // most normal, only exceptions have to be spelled out - { } - - void setResultAndType(bool r, bool t) - { - resultPresent = r; - typePresent = t; - } - - bool hasResult() const { return resultPresent != 0; } - bool hasType() const { return typePresent != 0; } - - const char* opDesc; - OpcodeClass opClass; - OperandParameters operands; - -protected: - int typePresent : 1; - int resultPresent : 1; -}; - -// The set of objects that hold all the instruction/operand -// parameterization information. -extern InstructionParameters InstructionDesc[]; - -// These hold definitions of the enumerants used for operands -extern EnumDefinition OperandClassParams[]; - -const char* GetOperandDesc(OperandClass operand); -void PrintImmediateRow(int imm, const char* name, const EnumParameters* enumParams, bool caps, bool hex = false); -const char* AccessQualifierString(int attr); - -void PrintOperands(const OperandParameters& operands, int reservedOperands); - -} // end namespace spv diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/hex_float.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/hex_float.h deleted file mode 100644 index 8be8e9f..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/hex_float.h +++ /dev/null @@ -1,1078 +0,0 @@ -// Copyright (c) 2015-2016 The Khronos Group Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef LIBSPIRV_UTIL_HEX_FLOAT_H_ -#define LIBSPIRV_UTIL_HEX_FLOAT_H_ - -#include -#include -#include -#include -#include -#include -#include - -#if defined(_MSC_VER) && _MSC_VER < 1800 -namespace std { -bool isnan(double f) -{ - return ::_isnan(f) != 0; -} -bool isinf(double f) -{ - return ::_finite(f) == 0; -} -} -#endif - -#include "bitutils.h" - -namespace spvutils { - -class Float16 { - public: - Float16(uint16_t v) : val(v) {} - Float16() {} - static bool isNan(const Float16& val) { - return ((val.val & 0x7C00) == 0x7C00) && ((val.val & 0x3FF) != 0); - } - // Returns true if the given value is any kind of infinity. - static bool isInfinity(const Float16& val) { - return ((val.val & 0x7C00) == 0x7C00) && ((val.val & 0x3FF) == 0); - } - Float16(const Float16& other) { val = other.val; } - uint16_t get_value() const { return val; } - - // Returns the maximum normal value. - static Float16 max() { return Float16(0x7bff); } - // Returns the lowest normal value. - static Float16 lowest() { return Float16(0xfbff); } - - private: - uint16_t val; -}; - -// To specialize this type, you must override uint_type to define -// an unsigned integer that can fit your floating point type. -// You must also add a isNan function that returns true if -// a value is Nan. -template -struct FloatProxyTraits { - typedef void uint_type; -}; - -template <> -struct FloatProxyTraits { - typedef uint32_t uint_type; - static bool isNan(float f) { return std::isnan(f); } - // Returns true if the given value is any kind of infinity. - static bool isInfinity(float f) { return std::isinf(f); } - // Returns the maximum normal value. - static float max() { return std::numeric_limits::max(); } - // Returns the lowest normal value. - static float lowest() { return std::numeric_limits::lowest(); } -}; - -template <> -struct FloatProxyTraits { - typedef uint64_t uint_type; - static bool isNan(double f) { return std::isnan(f); } - // Returns true if the given value is any kind of infinity. - static bool isInfinity(double f) { return std::isinf(f); } - // Returns the maximum normal value. - static double max() { return std::numeric_limits::max(); } - // Returns the lowest normal value. - static double lowest() { return std::numeric_limits::lowest(); } -}; - -template <> -struct FloatProxyTraits { - typedef uint16_t uint_type; - static bool isNan(Float16 f) { return Float16::isNan(f); } - // Returns true if the given value is any kind of infinity. - static bool isInfinity(Float16 f) { return Float16::isInfinity(f); } - // Returns the maximum normal value. - static Float16 max() { return Float16::max(); } - // Returns the lowest normal value. - static Float16 lowest() { return Float16::lowest(); } -}; - -// Since copying a floating point number (especially if it is NaN) -// does not guarantee that bits are preserved, this class lets us -// store the type and use it as a float when necessary. -template -class FloatProxy { - public: - typedef typename FloatProxyTraits::uint_type uint_type; - - // Since this is to act similar to the normal floats, - // do not initialize the data by default. - FloatProxy() {} - - // Intentionally non-explicit. This is a proxy type so - // implicit conversions allow us to use it more transparently. - FloatProxy(T val) { data_ = BitwiseCast(val); } - - // Intentionally non-explicit. This is a proxy type so - // implicit conversions allow us to use it more transparently. - FloatProxy(uint_type val) { data_ = val; } - - // This is helpful to have and is guaranteed not to stomp bits. - FloatProxy operator-() const { - return static_cast(data_ ^ - (uint_type(0x1) << (sizeof(T) * 8 - 1))); - } - - // Returns the data as a floating point value. - T getAsFloat() const { return BitwiseCast(data_); } - - // Returns the raw data. - uint_type data() const { return data_; } - - // Returns true if the value represents any type of NaN. - bool isNan() { return FloatProxyTraits::isNan(getAsFloat()); } - // Returns true if the value represents any type of infinity. - bool isInfinity() { return FloatProxyTraits::isInfinity(getAsFloat()); } - - // Returns the maximum normal value. - static FloatProxy max() { - return FloatProxy(FloatProxyTraits::max()); - } - // Returns the lowest normal value. - static FloatProxy lowest() { - return FloatProxy(FloatProxyTraits::lowest()); - } - - private: - uint_type data_; -}; - -template -bool operator==(const FloatProxy& first, const FloatProxy& second) { - return first.data() == second.data(); -} - -// Reads a FloatProxy value as a normal float from a stream. -template -std::istream& operator>>(std::istream& is, FloatProxy& value) { - T float_val; - is >> float_val; - value = FloatProxy(float_val); - return is; -} - -// This is an example traits. It is not meant to be used in practice, but will -// be the default for any non-specialized type. -template -struct HexFloatTraits { - // Integer type that can store this hex-float. - typedef void uint_type; - // Signed integer type that can store this hex-float. - typedef void int_type; - // The numerical type that this HexFloat represents. - typedef void underlying_type; - // The type needed to construct the underlying type. - typedef void native_type; - // The number of bits that are actually relevant in the uint_type. - // This allows us to deal with, for example, 24-bit values in a 32-bit - // integer. - static const uint32_t num_used_bits = 0; - // Number of bits that represent the exponent. - static const uint32_t num_exponent_bits = 0; - // Number of bits that represent the fractional part. - static const uint32_t num_fraction_bits = 0; - // The bias of the exponent. (How much we need to subtract from the stored - // value to get the correct value.) - static const uint32_t exponent_bias = 0; -}; - -// Traits for IEEE float. -// 1 sign bit, 8 exponent bits, 23 fractional bits. -template <> -struct HexFloatTraits> { - typedef uint32_t uint_type; - typedef int32_t int_type; - typedef FloatProxy underlying_type; - typedef float native_type; - static const uint_type num_used_bits = 32; - static const uint_type num_exponent_bits = 8; - static const uint_type num_fraction_bits = 23; - static const uint_type exponent_bias = 127; -}; - -// Traits for IEEE double. -// 1 sign bit, 11 exponent bits, 52 fractional bits. -template <> -struct HexFloatTraits> { - typedef uint64_t uint_type; - typedef int64_t int_type; - typedef FloatProxy underlying_type; - typedef double native_type; - static const uint_type num_used_bits = 64; - static const uint_type num_exponent_bits = 11; - static const uint_type num_fraction_bits = 52; - static const uint_type exponent_bias = 1023; -}; - -// Traits for IEEE half. -// 1 sign bit, 5 exponent bits, 10 fractional bits. -template <> -struct HexFloatTraits> { - typedef uint16_t uint_type; - typedef int16_t int_type; - typedef uint16_t underlying_type; - typedef uint16_t native_type; - static const uint_type num_used_bits = 16; - static const uint_type num_exponent_bits = 5; - static const uint_type num_fraction_bits = 10; - static const uint_type exponent_bias = 15; -}; - -enum round_direction { - kRoundToZero, - kRoundToNearestEven, - kRoundToPositiveInfinity, - kRoundToNegativeInfinity -}; - -// Template class that houses a floating pointer number. -// It exposes a number of constants based on the provided traits to -// assist in interpreting the bits of the value. -template > -class HexFloat { - public: - typedef typename Traits::uint_type uint_type; - typedef typename Traits::int_type int_type; - typedef typename Traits::underlying_type underlying_type; - typedef typename Traits::native_type native_type; - - explicit HexFloat(T f) : value_(f) {} - - T value() const { return value_; } - void set_value(T f) { value_ = f; } - - // These are all written like this because it is convenient to have - // compile-time constants for all of these values. - - // Pass-through values to save typing. - static const uint32_t num_used_bits = Traits::num_used_bits; - static const uint32_t exponent_bias = Traits::exponent_bias; - static const uint32_t num_exponent_bits = Traits::num_exponent_bits; - static const uint32_t num_fraction_bits = Traits::num_fraction_bits; - - // Number of bits to shift left to set the highest relevant bit. - static const uint32_t top_bit_left_shift = num_used_bits - 1; - // How many nibbles (hex characters) the fractional part takes up. - static const uint32_t fraction_nibbles = (num_fraction_bits + 3) / 4; - // If the fractional part does not fit evenly into a hex character (4-bits) - // then we have to left-shift to get rid of leading 0s. This is the amount - // we have to shift (might be 0). - static const uint32_t num_overflow_bits = - fraction_nibbles * 4 - num_fraction_bits; - - // The representation of the fraction, not the actual bits. This - // includes the leading bit that is usually implicit. - static const uint_type fraction_represent_mask = - spvutils::SetBits::get; - - // The topmost bit in the nibble-aligned fraction. - static const uint_type fraction_top_bit = - uint_type(1) << (num_fraction_bits + num_overflow_bits - 1); - - // The least significant bit in the exponent, which is also the bit - // immediately to the left of the significand. - static const uint_type first_exponent_bit = uint_type(1) - << (num_fraction_bits); - - // The mask for the encoded fraction. It does not include the - // implicit bit. - static const uint_type fraction_encode_mask = - spvutils::SetBits::get; - - // The bit that is used as a sign. - static const uint_type sign_mask = uint_type(1) << top_bit_left_shift; - - // The bits that represent the exponent. - static const uint_type exponent_mask = - spvutils::SetBits::get; - - // How far left the exponent is shifted. - static const uint32_t exponent_left_shift = num_fraction_bits; - - // How far from the right edge the fraction is shifted. - static const uint32_t fraction_right_shift = - static_cast(sizeof(uint_type) * 8) - num_fraction_bits; - - // The maximum representable unbiased exponent. - static const int_type max_exponent = - (exponent_mask >> num_fraction_bits) - exponent_bias; - // The minimum representable exponent for normalized numbers. - static const int_type min_exponent = -static_cast(exponent_bias); - - // Returns the bits associated with the value. - uint_type getBits() const { return spvutils::BitwiseCast(value_); } - - // Returns the bits associated with the value, without the leading sign bit. - uint_type getUnsignedBits() const { - return static_cast(spvutils::BitwiseCast(value_) & - ~sign_mask); - } - - // Returns the bits associated with the exponent, shifted to start at the - // lsb of the type. - const uint_type getExponentBits() const { - return static_cast((getBits() & exponent_mask) >> - num_fraction_bits); - } - - // Returns the exponent in unbiased form. This is the exponent in the - // human-friendly form. - const int_type getUnbiasedExponent() const { - return static_cast(getExponentBits() - exponent_bias); - } - - // Returns just the significand bits from the value. - const uint_type getSignificandBits() const { - return getBits() & fraction_encode_mask; - } - - // If the number was normalized, returns the unbiased exponent. - // If the number was denormal, normalize the exponent first. - const int_type getUnbiasedNormalizedExponent() const { - if ((getBits() & ~sign_mask) == 0) { // special case if everything is 0 - return 0; - } - int_type exp = getUnbiasedExponent(); - if (exp == min_exponent) { // We are in denorm land. - uint_type significand_bits = getSignificandBits(); - while ((significand_bits & (first_exponent_bit >> 1)) == 0) { - significand_bits = static_cast(significand_bits << 1); - exp = static_cast(exp - 1); - } - significand_bits &= fraction_encode_mask; - } - return exp; - } - - // Returns the signficand after it has been normalized. - const uint_type getNormalizedSignificand() const { - int_type unbiased_exponent = getUnbiasedNormalizedExponent(); - uint_type significand = getSignificandBits(); - for (int_type i = unbiased_exponent; i <= min_exponent; ++i) { - significand = static_cast(significand << 1); - } - significand &= fraction_encode_mask; - return significand; - } - - // Returns true if this number represents a negative value. - bool isNegative() const { return (getBits() & sign_mask) != 0; } - - // Sets this HexFloat from the individual components. - // Note this assumes EVERY significand is normalized, and has an implicit - // leading one. This means that the only way that this method will set 0, - // is if you set a number so denormalized that it underflows. - // Do not use this method with raw bits extracted from a subnormal number, - // since subnormals do not have an implicit leading 1 in the significand. - // The significand is also expected to be in the - // lowest-most num_fraction_bits of the uint_type. - // The exponent is expected to be unbiased, meaning an exponent of - // 0 actually means 0. - // If underflow_round_up is set, then on underflow, if a number is non-0 - // and would underflow, we round up to the smallest denorm. - void setFromSignUnbiasedExponentAndNormalizedSignificand( - bool negative, int_type exponent, uint_type significand, - bool round_denorm_up) { - bool significand_is_zero = significand == 0; - - if (exponent <= min_exponent) { - // If this was denormalized, then we have to shift the bit on, meaning - // the significand is not zero. - significand_is_zero = false; - significand |= first_exponent_bit; - significand = static_cast(significand >> 1); - } - - while (exponent < min_exponent) { - significand = static_cast(significand >> 1); - ++exponent; - } - - if (exponent == min_exponent) { - if (significand == 0 && !significand_is_zero && round_denorm_up) { - significand = static_cast(0x1); - } - } - - uint_type new_value = 0; - if (negative) { - new_value = static_cast(new_value | sign_mask); - } - exponent = static_cast(exponent + exponent_bias); - assert(exponent >= 0); - - // put it all together - exponent = static_cast((exponent << exponent_left_shift) & - exponent_mask); - significand = static_cast(significand & fraction_encode_mask); - new_value = static_cast(new_value | (exponent | significand)); - value_ = BitwiseCast(new_value); - } - - // Increments the significand of this number by the given amount. - // If this would spill the significand into the implicit bit, - // carry is set to true and the significand is shifted to fit into - // the correct location, otherwise carry is set to false. - // All significands and to_increment are assumed to be within the bounds - // for a valid significand. - static uint_type incrementSignificand(uint_type significand, - uint_type to_increment, bool* carry) { - significand = static_cast(significand + to_increment); - *carry = false; - if (significand & first_exponent_bit) { - *carry = true; - // The implicit 1-bit will have carried, so we should zero-out the - // top bit and shift back. - significand = static_cast(significand & ~first_exponent_bit); - significand = static_cast(significand >> 1); - } - return significand; - } - - // These exist because MSVC throws warnings on negative right-shifts - // even if they are not going to be executed. Eg: - // constant_number < 0? 0: constant_number - // These convert the negative left-shifts into right shifts. - - template - uint_type negatable_left_shift(int_type N, uint_type val) - { - if(N >= 0) - return val << N; - - return val >> -N; - } - - template - uint_type negatable_right_shift(int_type N, uint_type val) - { - if(N >= 0) - return val >> N; - - return val << -N; - } - - // Returns the significand, rounded to fit in a significand in - // other_T. This is shifted so that the most significant - // bit of the rounded number lines up with the most significant bit - // of the returned significand. - template - typename other_T::uint_type getRoundedNormalizedSignificand( - round_direction dir, bool* carry_bit) { - typedef typename other_T::uint_type other_uint_type; - static const int_type num_throwaway_bits = - static_cast(num_fraction_bits) - - static_cast(other_T::num_fraction_bits); - - static const uint_type last_significant_bit = - (num_throwaway_bits < 0) - ? 0 - : negatable_left_shift(num_throwaway_bits, 1u); - static const uint_type first_rounded_bit = - (num_throwaway_bits < 1) - ? 0 - : negatable_left_shift(num_throwaway_bits - 1, 1u); - - static const uint_type throwaway_mask_bits = - num_throwaway_bits > 0 ? num_throwaway_bits : 0; - static const uint_type throwaway_mask = - spvutils::SetBits::get; - - *carry_bit = false; - other_uint_type out_val = 0; - uint_type significand = getNormalizedSignificand(); - // If we are up-casting, then we just have to shift to the right location. - if (num_throwaway_bits <= 0) { - out_val = static_cast(significand); - uint_type shift_amount = static_cast(-num_throwaway_bits); - out_val = static_cast(out_val << shift_amount); - return out_val; - } - - // If every non-representable bit is 0, then we don't have any casting to - // do. - if ((significand & throwaway_mask) == 0) { - return static_cast( - negatable_right_shift(num_throwaway_bits, significand)); - } - - bool round_away_from_zero = false; - // We actually have to narrow the significand here, so we have to follow the - // rounding rules. - switch (dir) { - case kRoundToZero: - break; - case kRoundToPositiveInfinity: - round_away_from_zero = !isNegative(); - break; - case kRoundToNegativeInfinity: - round_away_from_zero = isNegative(); - break; - case kRoundToNearestEven: - // Have to round down, round bit is 0 - if ((first_rounded_bit & significand) == 0) { - break; - } - if (((significand & throwaway_mask) & ~first_rounded_bit) != 0) { - // If any subsequent bit of the rounded portion is non-0 then we round - // up. - round_away_from_zero = true; - break; - } - // We are exactly half-way between 2 numbers, pick even. - if ((significand & last_significant_bit) != 0) { - // 1 for our last bit, round up. - round_away_from_zero = true; - break; - } - break; - } - - if (round_away_from_zero) { - return static_cast( - negatable_right_shift(num_throwaway_bits, incrementSignificand( - significand, last_significant_bit, carry_bit))); - } else { - return static_cast( - negatable_right_shift(num_throwaway_bits, significand)); - } - } - - // Casts this value to another HexFloat. If the cast is widening, - // then round_dir is ignored. If the cast is narrowing, then - // the result is rounded in the direction specified. - // This number will retain Nan and Inf values. - // It will also saturate to Inf if the number overflows, and - // underflow to (0 or min depending on rounding) if the number underflows. - template - void castTo(other_T& other, round_direction round_dir) { - other = other_T(static_cast(0)); - bool negate = isNegative(); - if (getUnsignedBits() == 0) { - if (negate) { - other.set_value(-other.value()); - } - return; - } - uint_type significand = getSignificandBits(); - bool carried = false; - typename other_T::uint_type rounded_significand = - getRoundedNormalizedSignificand(round_dir, &carried); - - int_type exponent = getUnbiasedExponent(); - if (exponent == min_exponent) { - // If we are denormal, normalize the exponent, so that we can encode - // easily. - exponent = static_cast(exponent + 1); - for (uint_type check_bit = first_exponent_bit >> 1; check_bit != 0; - check_bit = static_cast(check_bit >> 1)) { - exponent = static_cast(exponent - 1); - if (check_bit & significand) break; - } - } - - bool is_nan = - (getBits() & exponent_mask) == exponent_mask && significand != 0; - bool is_inf = - !is_nan && - ((exponent + carried) > static_cast(other_T::exponent_bias) || - (significand == 0 && (getBits() & exponent_mask) == exponent_mask)); - - // If we are Nan or Inf we should pass that through. - if (is_inf) { - other.set_value(BitwiseCast( - static_cast( - (negate ? other_T::sign_mask : 0) | other_T::exponent_mask))); - return; - } - if (is_nan) { - typename other_T::uint_type shifted_significand; - shifted_significand = static_cast( - negatable_left_shift( - static_cast(other_T::num_fraction_bits) - - static_cast(num_fraction_bits), significand)); - - // We are some sort of Nan. We try to keep the bit-pattern of the Nan - // as close as possible. If we had to shift off bits so we are 0, then we - // just set the last bit. - other.set_value(BitwiseCast( - static_cast( - (negate ? other_T::sign_mask : 0) | other_T::exponent_mask | - (shifted_significand == 0 ? 0x1 : shifted_significand)))); - return; - } - - bool round_underflow_up = - isNegative() ? round_dir == kRoundToNegativeInfinity - : round_dir == kRoundToPositiveInfinity; - typedef typename other_T::int_type other_int_type; - // setFromSignUnbiasedExponentAndNormalizedSignificand will - // zero out any underflowing value (but retain the sign). - other.setFromSignUnbiasedExponentAndNormalizedSignificand( - negate, static_cast(exponent), rounded_significand, - round_underflow_up); - return; - } - - private: - T value_; - - static_assert(num_used_bits == - Traits::num_exponent_bits + Traits::num_fraction_bits + 1, - "The number of bits do not fit"); - static_assert(sizeof(T) == sizeof(uint_type), "The type sizes do not match"); -}; - -// Returns 4 bits represented by the hex character. -inline uint8_t get_nibble_from_character(int character) { - const char* dec = "0123456789"; - const char* lower = "abcdef"; - const char* upper = "ABCDEF"; - const char* p = nullptr; - if ((p = strchr(dec, character))) { - return static_cast(p - dec); - } else if ((p = strchr(lower, character))) { - return static_cast(p - lower + 0xa); - } else if ((p = strchr(upper, character))) { - return static_cast(p - upper + 0xa); - } - - assert(false && "This was called with a non-hex character"); - return 0; -} - -// Outputs the given HexFloat to the stream. -template -std::ostream& operator<<(std::ostream& os, const HexFloat& value) { - typedef HexFloat HF; - typedef typename HF::uint_type uint_type; - typedef typename HF::int_type int_type; - - static_assert(HF::num_used_bits != 0, - "num_used_bits must be non-zero for a valid float"); - static_assert(HF::num_exponent_bits != 0, - "num_exponent_bits must be non-zero for a valid float"); - static_assert(HF::num_fraction_bits != 0, - "num_fractin_bits must be non-zero for a valid float"); - - const uint_type bits = spvutils::BitwiseCast(value.value()); - const char* const sign = (bits & HF::sign_mask) ? "-" : ""; - const uint_type exponent = static_cast( - (bits & HF::exponent_mask) >> HF::num_fraction_bits); - - uint_type fraction = static_cast((bits & HF::fraction_encode_mask) - << HF::num_overflow_bits); - - const bool is_zero = exponent == 0 && fraction == 0; - const bool is_denorm = exponent == 0 && !is_zero; - - // exponent contains the biased exponent we have to convert it back into - // the normal range. - int_type int_exponent = static_cast(exponent - HF::exponent_bias); - // If the number is all zeros, then we actually have to NOT shift the - // exponent. - int_exponent = is_zero ? 0 : int_exponent; - - // If we are denorm, then start shifting, and decreasing the exponent until - // our leading bit is 1. - - if (is_denorm) { - while ((fraction & HF::fraction_top_bit) == 0) { - fraction = static_cast(fraction << 1); - int_exponent = static_cast(int_exponent - 1); - } - // Since this is denormalized, we have to consume the leading 1 since it - // will end up being implicit. - fraction = static_cast(fraction << 1); // eat the leading 1 - fraction &= HF::fraction_represent_mask; - } - - uint_type fraction_nibbles = HF::fraction_nibbles; - // We do not have to display any trailing 0s, since this represents the - // fractional part. - while (fraction_nibbles > 0 && (fraction & 0xF) == 0) { - // Shift off any trailing values; - fraction = static_cast(fraction >> 4); - --fraction_nibbles; - } - - const auto saved_flags = os.flags(); - const auto saved_fill = os.fill(); - - os << sign << "0x" << (is_zero ? '0' : '1'); - if (fraction_nibbles) { - // Make sure to keep the leading 0s in place, since this is the fractional - // part. - os << "." << std::setw(static_cast(fraction_nibbles)) - << std::setfill('0') << std::hex << fraction; - } - os << "p" << std::dec << (int_exponent >= 0 ? "+" : "") << int_exponent; - - os.flags(saved_flags); - os.fill(saved_fill); - - return os; -} - -// Returns true if negate_value is true and the next character on the -// input stream is a plus or minus sign. In that case we also set the fail bit -// on the stream and set the value to the zero value for its type. -template -inline bool RejectParseDueToLeadingSign(std::istream& is, bool negate_value, - HexFloat& value) { - if (negate_value) { - auto next_char = is.peek(); - if (next_char == '-' || next_char == '+') { - // Fail the parse. Emulate standard behaviour by setting the value to - // the zero value, and set the fail bit on the stream. - value = HexFloat(typename HexFloat::uint_type(0)); - is.setstate(std::ios_base::failbit); - return true; - } - } - return false; -} - -// Parses a floating point number from the given stream and stores it into the -// value parameter. -// If negate_value is true then the number may not have a leading minus or -// plus, and if it successfully parses, then the number is negated before -// being stored into the value parameter. -// If the value cannot be correctly parsed or overflows the target floating -// point type, then set the fail bit on the stream. -// TODO(dneto): Promise C++11 standard behavior in how the value is set in -// the error case, but only after all target platforms implement it correctly. -// In particular, the Microsoft C++ runtime appears to be out of spec. -template -inline std::istream& ParseNormalFloat(std::istream& is, bool negate_value, - HexFloat& value) { - if (RejectParseDueToLeadingSign(is, negate_value, value)) { - return is; - } - T val; - is >> val; - if (negate_value) { - val = -val; - } - value.set_value(val); - // In the failure case, map -0.0 to 0.0. - if (is.fail() && value.getUnsignedBits() == 0u) { - value = HexFloat(typename HexFloat::uint_type(0)); - } - if (val.isInfinity()) { - // Fail the parse. Emulate standard behaviour by setting the value to - // the closest normal value, and set the fail bit on the stream. - value.set_value((value.isNegative() || negate_value) ? T::lowest() - : T::max()); - is.setstate(std::ios_base::failbit); - } - return is; -} - -// Specialization of ParseNormalFloat for FloatProxy values. -// This will parse the float as it were a 32-bit floating point number, -// and then round it down to fit into a Float16 value. -// The number is rounded towards zero. -// If negate_value is true then the number may not have a leading minus or -// plus, and if it successfully parses, then the number is negated before -// being stored into the value parameter. -// If the value cannot be correctly parsed or overflows the target floating -// point type, then set the fail bit on the stream. -// TODO(dneto): Promise C++11 standard behavior in how the value is set in -// the error case, but only after all target platforms implement it correctly. -// In particular, the Microsoft C++ runtime appears to be out of spec. -template <> -inline std::istream& -ParseNormalFloat, HexFloatTraits>>( - std::istream& is, bool negate_value, - HexFloat, HexFloatTraits>>& value) { - // First parse as a 32-bit float. - HexFloat> float_val(0.0f); - ParseNormalFloat(is, negate_value, float_val); - - // Then convert to 16-bit float, saturating at infinities, and - // rounding toward zero. - float_val.castTo(value, kRoundToZero); - - // Overflow on 16-bit behaves the same as for 32- and 64-bit: set the - // fail bit and set the lowest or highest value. - if (Float16::isInfinity(value.value().getAsFloat())) { - value.set_value(value.isNegative() ? Float16::lowest() : Float16::max()); - is.setstate(std::ios_base::failbit); - } - return is; -} - -// Reads a HexFloat from the given stream. -// If the float is not encoded as a hex-float then it will be parsed -// as a regular float. -// This may fail if your stream does not support at least one unget. -// Nan values can be encoded with "0x1.p+exponent_bias". -// This would normally overflow a float and round to -// infinity but this special pattern is the exact representation for a NaN, -// and therefore is actually encoded as the correct NaN. To encode inf, -// either 0x0p+exponent_bias can be specified or any exponent greater than -// exponent_bias. -// Examples using IEEE 32-bit float encoding. -// 0x1.0p+128 (+inf) -// -0x1.0p-128 (-inf) -// -// 0x1.1p+128 (+Nan) -// -0x1.1p+128 (-Nan) -// -// 0x1p+129 (+inf) -// -0x1p+129 (-inf) -template -std::istream& operator>>(std::istream& is, HexFloat& value) { - using HF = HexFloat; - using uint_type = typename HF::uint_type; - using int_type = typename HF::int_type; - - value.set_value(static_cast(0.f)); - - if (is.flags() & std::ios::skipws) { - // If the user wants to skip whitespace , then we should obey that. - while (std::isspace(is.peek())) { - is.get(); - } - } - - auto next_char = is.peek(); - bool negate_value = false; - - if (next_char != '-' && next_char != '0') { - return ParseNormalFloat(is, negate_value, value); - } - - if (next_char == '-') { - negate_value = true; - is.get(); - next_char = is.peek(); - } - - if (next_char == '0') { - is.get(); // We may have to unget this. - auto maybe_hex_start = is.peek(); - if (maybe_hex_start != 'x' && maybe_hex_start != 'X') { - is.unget(); - return ParseNormalFloat(is, negate_value, value); - } else { - is.get(); // Throw away the 'x'; - } - } else { - return ParseNormalFloat(is, negate_value, value); - } - - // This "looks" like a hex-float so treat it as one. - bool seen_p = false; - bool seen_dot = false; - uint_type fraction_index = 0; - - uint_type fraction = 0; - int_type exponent = HF::exponent_bias; - - // Strip off leading zeros so we don't have to special-case them later. - while ((next_char = is.peek()) == '0') { - is.get(); - } - - bool is_denorm = - true; // Assume denorm "representation" until we hear otherwise. - // NB: This does not mean the value is actually denorm, - // it just means that it was written 0. - bool bits_written = false; // Stays false until we write a bit. - while (!seen_p && !seen_dot) { - // Handle characters that are left of the fractional part. - if (next_char == '.') { - seen_dot = true; - } else if (next_char == 'p') { - seen_p = true; - } else if (::isxdigit(next_char)) { - // We know this is not denormalized since we have stripped all leading - // zeroes and we are not a ".". - is_denorm = false; - int number = get_nibble_from_character(next_char); - for (int i = 0; i < 4; ++i, number <<= 1) { - uint_type write_bit = (number & 0x8) ? 0x1 : 0x0; - if (bits_written) { - // If we are here the bits represented belong in the fractional - // part of the float, and we have to adjust the exponent accordingly. - fraction = static_cast( - fraction | - static_cast( - write_bit << (HF::top_bit_left_shift - fraction_index++))); - exponent = static_cast(exponent + 1); - } - bits_written |= write_bit != 0; - } - } else { - // We have not found our exponent yet, so we have to fail. - is.setstate(std::ios::failbit); - return is; - } - is.get(); - next_char = is.peek(); - } - bits_written = false; - while (seen_dot && !seen_p) { - // Handle only fractional parts now. - if (next_char == 'p') { - seen_p = true; - } else if (::isxdigit(next_char)) { - int number = get_nibble_from_character(next_char); - for (int i = 0; i < 4; ++i, number <<= 1) { - uint_type write_bit = (number & 0x8) ? 0x01 : 0x00; - bits_written |= write_bit != 0; - if (is_denorm && !bits_written) { - // Handle modifying the exponent here this way we can handle - // an arbitrary number of hex values without overflowing our - // integer. - exponent = static_cast(exponent - 1); - } else { - fraction = static_cast( - fraction | - static_cast( - write_bit << (HF::top_bit_left_shift - fraction_index++))); - } - } - } else { - // We still have not found our 'p' exponent yet, so this is not a valid - // hex-float. - is.setstate(std::ios::failbit); - return is; - } - is.get(); - next_char = is.peek(); - } - - bool seen_sign = false; - int8_t exponent_sign = 1; - int_type written_exponent = 0; - while (true) { - if ((next_char == '-' || next_char == '+')) { - if (seen_sign) { - is.setstate(std::ios::failbit); - return is; - } - seen_sign = true; - exponent_sign = (next_char == '-') ? -1 : 1; - } else if (::isdigit(next_char)) { - // Hex-floats express their exponent as decimal. - written_exponent = static_cast(written_exponent * 10); - written_exponent = - static_cast(written_exponent + (next_char - '0')); - } else { - break; - } - is.get(); - next_char = is.peek(); - } - - written_exponent = static_cast(written_exponent * exponent_sign); - exponent = static_cast(exponent + written_exponent); - - bool is_zero = is_denorm && (fraction == 0); - if (is_denorm && !is_zero) { - fraction = static_cast(fraction << 1); - exponent = static_cast(exponent - 1); - } else if (is_zero) { - exponent = 0; - } - - if (exponent <= 0 && !is_zero) { - fraction = static_cast(fraction >> 1); - fraction |= static_cast(1) << HF::top_bit_left_shift; - } - - fraction = (fraction >> HF::fraction_right_shift) & HF::fraction_encode_mask; - - const int_type max_exponent = - SetBits::get; - - // Handle actual denorm numbers - while (exponent < 0 && !is_zero) { - fraction = static_cast(fraction >> 1); - exponent = static_cast(exponent + 1); - - fraction &= HF::fraction_encode_mask; - if (fraction == 0) { - // We have underflowed our fraction. We should clamp to zero. - is_zero = true; - exponent = 0; - } - } - - // We have overflowed so we should be inf/-inf. - if (exponent > max_exponent) { - exponent = max_exponent; - fraction = 0; - } - - uint_type output_bits = static_cast( - static_cast(negate_value ? 1 : 0) << HF::top_bit_left_shift); - output_bits |= fraction; - - uint_type shifted_exponent = static_cast( - static_cast(exponent << HF::exponent_left_shift) & - HF::exponent_mask); - output_bits |= shifted_exponent; - - T output_float = spvutils::BitwiseCast(output_bits); - value.set_value(output_float); - - return is; -} - -// Writes a FloatProxy value to a stream. -// Zero and normal numbers are printed in the usual notation, but with -// enough digits to fully reproduce the value. Other values (subnormal, -// NaN, and infinity) are printed as a hex float. -template -std::ostream& operator<<(std::ostream& os, const FloatProxy& value) { - auto float_val = value.getAsFloat(); - switch (std::fpclassify(float_val)) { - case FP_ZERO: - case FP_NORMAL: { - auto saved_precision = os.precision(); - os.precision(std::numeric_limits::digits10); - os << float_val; - os.precision(saved_precision); - } break; - default: - os << HexFloat>(value); - break; - } - return os; -} - -template <> -inline std::ostream& operator<<(std::ostream& os, - const FloatProxy& value) { - os << HexFloat>(value); - return os; -} -} - -#endif // LIBSPIRV_UTIL_HEX_FLOAT_H_ diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/spirv.hpp b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/spirv.hpp index 768a6f5..5999aba 100644 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/spirv.hpp +++ b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/spirv.hpp @@ -26,7 +26,7 @@ // the Binary Section of the SPIR-V specification. // Enumeration tokens for SPIR-V, in various styles: -// C, C++, C++11, JSON, Lua, Python, C#, D +// C, C++, C++11, JSON, Lua, Python, C#, D, Beef // // - C will have tokens with a "Spv" prefix, e.g.: SpvSourceLanguageGLSL // - C++ will have tokens in the "spv" name space, e.g.: spv::SourceLanguageGLSL @@ -36,6 +36,8 @@ // - C# will use enum classes in the Specification class located in the "Spv" namespace, // e.g.: Spv.Specification.SourceLanguage.GLSL // - D will have tokens under the "spv" module, e.g: spv.SourceLanguage.GLSL +// - Beef will use enum classes in the Specification class located in the "Spv" namespace, +// e.g.: Spv.Specification.SourceLanguage.GLSL // // Some tokens act like mask values, which can be OR'd together, // while others are mutually exclusive. The mask-like ones have @@ -66,6 +68,7 @@ enum SourceLanguage { SourceLanguageOpenCL_CPP = 4, SourceLanguageHLSL = 5, SourceLanguageCPP_for_OpenCL = 6, + SourceLanguageSYCL = 7, SourceLanguageMax = 0x7fffffff, }; @@ -153,6 +156,9 @@ enum ExecutionMode { ExecutionModeSubgroupsPerWorkgroupId = 37, ExecutionModeLocalSizeId = 38, ExecutionModeLocalSizeHintId = 39, + ExecutionModeNonCoherentColorAttachmentReadEXT = 4169, + ExecutionModeNonCoherentDepthAttachmentReadEXT = 4170, + ExecutionModeNonCoherentStencilAttachmentReadEXT = 4171, ExecutionModeSubgroupUniformControlFlowKHR = 4421, ExecutionModePostDepthCoverage = 4446, ExecutionModeDenormPreserve = 4459, @@ -192,6 +198,8 @@ enum ExecutionMode { ExecutionModeNoGlobalOffsetINTEL = 5895, ExecutionModeNumSIMDWorkitemsINTEL = 5896, ExecutionModeSchedulerTargetFmaxMhzINTEL = 5903, + ExecutionModeStreamingInterfaceINTEL = 6154, + ExecutionModeNamedBarrierCountINTEL = 6417, ExecutionModeMax = 0x7fffffff, }; @@ -209,6 +217,7 @@ enum StorageClass { StorageClassAtomicCounter = 10, StorageClassImage = 11, StorageClassStorageBuffer = 12, + StorageClassTileImageEXT = 4172, StorageClassCallableDataKHR = 5328, StorageClassCallableDataNV = 5328, StorageClassIncomingCallableDataKHR = 5329, @@ -239,6 +248,7 @@ enum Dim { DimRect = 4, DimBuffer = 5, DimSubpassData = 6, + DimTileImageDataEXT = 4173, DimMax = 0x7fffffff, }; @@ -449,6 +459,7 @@ enum FunctionParameterAttribute { FunctionParameterAttributeNoCapture = 5, FunctionParameterAttributeNoWrite = 6, FunctionParameterAttributeNoReadWrite = 7, + FunctionParameterAttributeRuntimeAlignedINTEL = 5940, FunctionParameterAttributeMax = 0x7fffffff, }; @@ -502,6 +513,8 @@ enum Decoration { DecorationMaxByteOffsetId = 47, DecorationNoSignedWrap = 4469, DecorationNoUnsignedWrap = 4470, + DecorationWeightTextureQCOM = 4487, + DecorationBlockMatchTextureQCOM = 4488, DecorationExplicitInterpAMD = 4999, DecorationOverrideCoverageNV = 5248, DecorationPassthroughNV = 5250, @@ -558,12 +571,27 @@ enum Decoration { DecorationPrefetchINTEL = 5902, DecorationStallEnableINTEL = 5905, DecorationFuseLoopsInFunctionINTEL = 5907, + DecorationMathOpDSPModeINTEL = 5909, + DecorationAliasScopeINTEL = 5914, + DecorationNoAliasINTEL = 5915, + DecorationInitiationIntervalINTEL = 5917, + DecorationMaxConcurrencyINTEL = 5918, + DecorationPipelineEnableINTEL = 5919, DecorationBufferLocationINTEL = 5921, DecorationIOPipeStorageINTEL = 5944, DecorationFunctionFloatingPointModeINTEL = 6080, DecorationSingleElementVectorINTEL = 6085, DecorationVectorComputeCallableFunctionINTEL = 6087, DecorationMediaBlockIOINTEL = 6140, + DecorationConduitKernelArgumentINTEL = 6175, + DecorationRegisterMapKernelArgumentINTEL = 6176, + DecorationMMHostInterfaceAddressWidthINTEL = 6177, + DecorationMMHostInterfaceDataWidthINTEL = 6178, + DecorationMMHostInterfaceLatencyINTEL = 6179, + DecorationMMHostInterfaceReadWriteModeINTEL = 6180, + DecorationMMHostInterfaceMaxBurstINTEL = 6181, + DecorationMMHostInterfaceWaitRequestINTEL = 6182, + DecorationStableKernelArgumentINTEL = 6183, DecorationMax = 0x7fffffff, }; @@ -609,8 +637,8 @@ enum BuiltIn { BuiltInSubgroupLocalInvocationId = 41, BuiltInVertexIndex = 42, BuiltInInstanceIndex = 43, - BuiltInCoreCountARM = 4161, BuiltInCoreIDARM = 4160, + BuiltInCoreCountARM = 4161, BuiltInCoreMaxIDARM = 4162, BuiltInWarpIDARM = 4163, BuiltInWarpMaxIDARM = 4164, @@ -691,6 +719,11 @@ enum BuiltIn { BuiltInHitKindKHR = 5333, BuiltInHitKindNV = 5333, BuiltInCurrentRayTimeNV = 5334, + BuiltInHitTriangleVertexPositionsKHR = 5335, + BuiltInHitMicroTriangleVertexPositionsNV = 5337, + BuiltInHitMicroTriangleVertexBarycentricsNV = 5344, + BuiltInHitKindFrontFacingMicroTriangleNV = 5405, + BuiltInHitKindBackFacingMicroTriangleNV = 5406, BuiltInIncomingRayFlagsKHR = 5351, BuiltInIncomingRayFlagsNV = 5351, BuiltInRayGeometryIndexKHR = 5352, @@ -732,6 +765,8 @@ enum LoopControlShift { LoopControlMaxInterleavingINTELShift = 21, LoopControlSpeculatedIterationsINTELShift = 22, LoopControlNoFusionINTELShift = 23, + LoopControlLoopCountINTELShift = 24, + LoopControlMaxReinvocationDelayINTELShift = 25, LoopControlMax = 0x7fffffff, }; @@ -754,6 +789,8 @@ enum LoopControlMask { LoopControlMaxInterleavingINTELMask = 0x00200000, LoopControlSpeculatedIterationsINTELMask = 0x00400000, LoopControlNoFusionINTELMask = 0x00800000, + LoopControlLoopCountINTELMask = 0x01000000, + LoopControlMaxReinvocationDelayINTELMask = 0x02000000, }; enum FunctionControlShift { @@ -826,6 +863,8 @@ enum MemoryAccessShift { MemoryAccessMakePointerVisibleKHRShift = 4, MemoryAccessNonPrivatePointerShift = 5, MemoryAccessNonPrivatePointerKHRShift = 5, + MemoryAccessAliasScopeINTELMaskShift = 16, + MemoryAccessNoAliasINTELMaskShift = 17, MemoryAccessMax = 0x7fffffff, }; @@ -840,6 +879,8 @@ enum MemoryAccessMask { MemoryAccessMakePointerVisibleKHRMask = 0x00000010, MemoryAccessNonPrivatePointerMask = 0x00000020, MemoryAccessNonPrivatePointerKHRMask = 0x00000020, + MemoryAccessAliasScopeINTELMaskMask = 0x00010000, + MemoryAccessNoAliasINTELMaskMask = 0x00020000, }; enum Scope { @@ -954,6 +995,9 @@ enum Capability { CapabilityShaderViewportIndex = 70, CapabilityUniformDecoration = 71, CapabilityCoreBuiltinsARM = 4165, + CapabilityTileImageColorReadAccessEXT = 4166, + CapabilityTileImageDepthReadAccessEXT = 4167, + CapabilityTileImageStencilReadAccessEXT = 4168, CapabilityFragmentShadingRateKHR = 4422, CapabilitySubgroupBallotKHR = 4423, CapabilityDrawParameters = 4427, @@ -985,6 +1029,9 @@ enum Capability { CapabilityRayQueryKHR = 4472, CapabilityRayTraversalPrimitiveCullingKHR = 4478, CapabilityRayTracingKHR = 4479, + CapabilityTextureSampleWeightedQCOM = 4484, + CapabilityTextureBoxFilterQCOM = 4485, + CapabilityTextureBlockMatchQCOM = 4486, CapabilityFloat16ImageAMD = 5008, CapabilityImageGatherBiasLodAMD = 5009, CapabilityFragmentMaskAMD = 5010, @@ -1003,7 +1050,7 @@ enum Capability { CapabilityMeshShadingNV = 5266, CapabilityImageFootprintNV = 5282, CapabilityMeshShadingEXT = 5283, - CapabilityFragmentBarycentricKHR = 5284, + CapabilityFragmentBarycentricKHR = 5284, CapabilityFragmentBarycentricNV = 5284, CapabilityComputeDerivativeGroupQuadsNV = 5288, CapabilityFragmentDensityEXT = 5291, @@ -1033,6 +1080,7 @@ enum Capability { CapabilityUniformTexelBufferArrayNonUniformIndexingEXT = 5311, CapabilityStorageTexelBufferArrayNonUniformIndexing = 5312, CapabilityStorageTexelBufferArrayNonUniformIndexingEXT = 5312, + CapabilityRayTracingPositionFetchKHR = 5336, CapabilityRayTracingNV = 5340, CapabilityRayTracingMotionBlurNV = 5341, CapabilityVulkanMemoryModel = 5345, @@ -1050,8 +1098,12 @@ enum Capability { CapabilityFragmentShaderPixelInterlockEXT = 5378, CapabilityDemoteToHelperInvocation = 5379, CapabilityDemoteToHelperInvocationEXT = 5379, + CapabilityDisplacementMicromapNV = 5380, + CapabilityRayTracingDisplacementMicromapNV = 5409, + CapabilityRayTracingOpacityMicromapEXT = 5381, CapabilityShaderInvocationReorderNV = 5383, CapabilityBindlessTextureNV = 5390, + CapabilityRayQueryPositionFetchKHR = 5391, CapabilitySubgroupShuffleINTEL = 5568, CapabilitySubgroupBufferBlockIOINTEL = 5569, CapabilitySubgroupImageBlockIOINTEL = 5570, @@ -1084,9 +1136,13 @@ enum Capability { CapabilityFPGAMemoryAccessesINTEL = 5898, CapabilityFPGAClusterAttributesINTEL = 5904, CapabilityLoopFuseINTEL = 5906, + CapabilityFPGADSPControlINTEL = 5908, + CapabilityMemoryAccessAliasingINTEL = 5910, + CapabilityFPGAInvocationPipeliningAttributesINTEL = 5916, CapabilityFPGABufferLocationINTEL = 5920, CapabilityArbitraryPrecisionFixedPointINTEL = 5922, CapabilityUSMStorageClassesINTEL = 5935, + CapabilityRuntimeAlignedAttributeINTEL = 5939, CapabilityIOPipesINTEL = 5943, CapabilityBlockingPipesINTEL = 5945, CapabilityFPGARegINTEL = 5948, @@ -1099,13 +1155,18 @@ enum Capability { CapabilityDotProduct = 6019, CapabilityDotProductKHR = 6019, CapabilityRayCullMaskKHR = 6020, + CapabilityCooperativeMatrixKHR = 6022, CapabilityBitInstructions = 6025, + CapabilityGroupNonUniformRotateKHR = 6026, CapabilityAtomicFloat32AddEXT = 6033, CapabilityAtomicFloat64AddEXT = 6034, CapabilityLongConstantCompositeINTEL = 6089, CapabilityOptNoneINTEL = 6094, CapabilityAtomicFloat16AddEXT = 6095, CapabilityDebugInfoModuleINTEL = 6114, + CapabilitySplitBarrierINTEL = 6141, + CapabilityFPGAArgumentInterfacesINTEL = 6174, + CapabilityGroupUniformArithmeticKHR = 6400, CapabilityMax = 0x7fffffff, }; @@ -1120,6 +1181,7 @@ enum RayFlagsShift { RayFlagsCullNoOpaqueKHRShift = 7, RayFlagsSkipTrianglesKHRShift = 8, RayFlagsSkipAABBsKHRShift = 9, + RayFlagsForceOpacityMicromap2StateEXTShift = 10, RayFlagsMax = 0x7fffffff, }; @@ -1135,6 +1197,7 @@ enum RayFlagsMask { RayFlagsCullNoOpaqueKHRMask = 0x00000080, RayFlagsSkipTrianglesKHRMask = 0x00000100, RayFlagsSkipAABBsKHRMask = 0x00000200, + RayFlagsForceOpacityMicromap2StateEXTMask = 0x00000400, }; enum RayQueryIntersection { @@ -1210,6 +1273,37 @@ enum PackedVectorFormat { PackedVectorFormatMax = 0x7fffffff, }; +enum CooperativeMatrixOperandsShift { + CooperativeMatrixOperandsMatrixASignedComponentsKHRShift = 0, + CooperativeMatrixOperandsMatrixBSignedComponentsKHRShift = 1, + CooperativeMatrixOperandsMatrixCSignedComponentsKHRShift = 2, + CooperativeMatrixOperandsMatrixResultSignedComponentsKHRShift = 3, + CooperativeMatrixOperandsSaturatingAccumulationKHRShift = 4, + CooperativeMatrixOperandsMax = 0x7fffffff, +}; + +enum CooperativeMatrixOperandsMask { + CooperativeMatrixOperandsMaskNone = 0, + CooperativeMatrixOperandsMatrixASignedComponentsKHRMask = 0x00000001, + CooperativeMatrixOperandsMatrixBSignedComponentsKHRMask = 0x00000002, + CooperativeMatrixOperandsMatrixCSignedComponentsKHRMask = 0x00000004, + CooperativeMatrixOperandsMatrixResultSignedComponentsKHRMask = 0x00000008, + CooperativeMatrixOperandsSaturatingAccumulationKHRMask = 0x00000010, +}; + +enum CooperativeMatrixLayout { + CooperativeMatrixLayoutRowMajorKHR = 0, + CooperativeMatrixLayoutColumnMajorKHR = 1, + CooperativeMatrixLayoutMax = 0x7fffffff, +}; + +enum CooperativeMatrixUse { + CooperativeMatrixUseMatrixAKHR = 0, + CooperativeMatrixUseMatrixBKHR = 1, + CooperativeMatrixUseMatrixAccumulatorKHR = 2, + CooperativeMatrixUseMax = 0x7fffffff, +}; + enum Op { OpNop = 0, OpUndef = 1, @@ -1555,12 +1649,16 @@ enum Op { OpPtrEqual = 401, OpPtrNotEqual = 402, OpPtrDiff = 403, + OpColorAttachmentReadEXT = 4160, + OpDepthAttachmentReadEXT = 4161, + OpStencilAttachmentReadEXT = 4162, OpTerminateInvocation = 4416, OpSubgroupBallotKHR = 4421, OpSubgroupFirstInvocationKHR = 4422, OpSubgroupAllKHR = 4428, OpSubgroupAnyKHR = 4429, OpSubgroupAllEqualKHR = 4430, + OpGroupNonUniformRotateKHR = 4431, OpSubgroupReadInvocationKHR = 4432, OpTraceRayKHR = 4445, OpExecuteCallableKHR = 4446, @@ -1579,6 +1677,11 @@ enum Op { OpUDotAccSatKHR = 4454, OpSUDotAccSat = 4455, OpSUDotAccSatKHR = 4455, + OpTypeCooperativeMatrixKHR = 4456, + OpCooperativeMatrixLoadKHR = 4457, + OpCooperativeMatrixStoreKHR = 4458, + OpCooperativeMatrixMulAddKHR = 4459, + OpCooperativeMatrixLengthKHR = 4460, OpTypeRayQueryKHR = 4472, OpRayQueryInitializeKHR = 4473, OpRayQueryTerminateKHR = 4474, @@ -1586,6 +1689,10 @@ enum Op { OpRayQueryConfirmIntersectionKHR = 4476, OpRayQueryProceedKHR = 4477, OpRayQueryGetIntersectionTypeKHR = 4479, + OpImageSampleWeightedQCOM = 4480, + OpImageBoxFilterQCOM = 4481, + OpImageBlockMatchSSDQCOM = 4482, + OpImageBlockMatchSADQCOM = 4483, OpGroupIAddNonUniformAMD = 5000, OpGroupFAddNonUniformAMD = 5001, OpGroupFMinNonUniformAMD = 5002, @@ -1635,6 +1742,8 @@ enum Op { OpSetMeshOutputsEXT = 5295, OpGroupNonUniformPartitionNV = 5296, OpWritePackedPrimitiveIndices4x8NV = 5299, + OpFetchMicroTriangleVertexPositionNV = 5300, + OpFetchMicroTriangleVertexBarycentricNV = 5301, OpReportIntersectionKHR = 5334, OpReportIntersectionNV = 5334, OpIgnoreIntersectionNV = 5335, @@ -1642,6 +1751,7 @@ enum Op { OpTraceNV = 5337, OpTraceMotionNV = 5338, OpTraceRayMotionNV = 5339, + OpRayQueryGetIntersectionTriangleVertexPositionsKHR = 5340, OpTypeAccelerationStructureKHR = 5341, OpTypeAccelerationStructureNV = 5341, OpExecuteCallableNV = 5344, @@ -1862,6 +1972,9 @@ enum Op { OpArbitraryFloatPowRINTEL = 5881, OpArbitraryFloatPowNINTEL = 5882, OpLoopControlINTEL = 5887, + OpAliasDomainDeclINTEL = 5911, + OpAliasScopeDeclINTEL = 5912, + OpAliasScopeListDeclINTEL = 5913, OpFixedSqrtINTEL = 5923, OpFixedRecipINTEL = 5924, OpFixedRsqrtINTEL = 5925, @@ -1900,10 +2013,23 @@ enum Op { OpTypeStructContinuedINTEL = 6090, OpConstantCompositeContinuedINTEL = 6091, OpSpecConstantCompositeContinuedINTEL = 6092, + OpControlBarrierArriveINTEL = 6142, + OpControlBarrierWaitINTEL = 6143, + OpGroupIMulKHR = 6401, + OpGroupFMulKHR = 6402, + OpGroupBitwiseAndKHR = 6403, + OpGroupBitwiseOrKHR = 6404, + OpGroupBitwiseXorKHR = 6405, + OpGroupLogicalAndKHR = 6406, + OpGroupLogicalOrKHR = 6407, + OpGroupLogicalXorKHR = 6408, OpMax = 0x7fffffff, }; #ifdef SPV_ENABLE_UTILITY_CODE +#ifndef __cplusplus +#include +#endif inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { *hasResult = *hasResultType = false; switch (opcode) { @@ -2252,12 +2378,16 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case OpPtrEqual: *hasResult = true; *hasResultType = true; break; case OpPtrNotEqual: *hasResult = true; *hasResultType = true; break; case OpPtrDiff: *hasResult = true; *hasResultType = true; break; + case OpColorAttachmentReadEXT: *hasResult = true; *hasResultType = true; break; + case OpDepthAttachmentReadEXT: *hasResult = true; *hasResultType = true; break; + case OpStencilAttachmentReadEXT: *hasResult = true; *hasResultType = true; break; case OpTerminateInvocation: *hasResult = false; *hasResultType = false; break; case OpSubgroupBallotKHR: *hasResult = true; *hasResultType = true; break; case OpSubgroupFirstInvocationKHR: *hasResult = true; *hasResultType = true; break; case OpSubgroupAllKHR: *hasResult = true; *hasResultType = true; break; case OpSubgroupAnyKHR: *hasResult = true; *hasResultType = true; break; case OpSubgroupAllEqualKHR: *hasResult = true; *hasResultType = true; break; + case OpGroupNonUniformRotateKHR: *hasResult = true; *hasResultType = true; break; case OpSubgroupReadInvocationKHR: *hasResult = true; *hasResultType = true; break; case OpTraceRayKHR: *hasResult = false; *hasResultType = false; break; case OpExecuteCallableKHR: *hasResult = false; *hasResultType = false; break; @@ -2270,6 +2400,11 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case OpSDotAccSat: *hasResult = true; *hasResultType = true; break; case OpUDotAccSat: *hasResult = true; *hasResultType = true; break; case OpSUDotAccSat: *hasResult = true; *hasResultType = true; break; + case OpTypeCooperativeMatrixKHR: *hasResult = true; *hasResultType = false; break; + case OpCooperativeMatrixLoadKHR: *hasResult = true; *hasResultType = true; break; + case OpCooperativeMatrixStoreKHR: *hasResult = false; *hasResultType = false; break; + case OpCooperativeMatrixMulAddKHR: *hasResult = true; *hasResultType = true; break; + case OpCooperativeMatrixLengthKHR: *hasResult = true; *hasResultType = true; break; case OpTypeRayQueryKHR: *hasResult = true; *hasResultType = false; break; case OpRayQueryInitializeKHR: *hasResult = false; *hasResultType = false; break; case OpRayQueryTerminateKHR: *hasResult = false; *hasResultType = false; break; @@ -2277,6 +2412,10 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case OpRayQueryConfirmIntersectionKHR: *hasResult = false; *hasResultType = false; break; case OpRayQueryProceedKHR: *hasResult = true; *hasResultType = true; break; case OpRayQueryGetIntersectionTypeKHR: *hasResult = true; *hasResultType = true; break; + case OpImageSampleWeightedQCOM: *hasResult = true; *hasResultType = true; break; + case OpImageBoxFilterQCOM: *hasResult = true; *hasResultType = true; break; + case OpImageBlockMatchSSDQCOM: *hasResult = true; *hasResultType = true; break; + case OpImageBlockMatchSADQCOM: *hasResult = true; *hasResultType = true; break; case OpGroupIAddNonUniformAMD: *hasResult = true; *hasResultType = true; break; case OpGroupFAddNonUniformAMD: *hasResult = true; *hasResultType = true; break; case OpGroupFMinNonUniformAMD: *hasResult = true; *hasResultType = true; break; @@ -2288,10 +2427,43 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case OpFragmentMaskFetchAMD: *hasResult = true; *hasResultType = true; break; case OpFragmentFetchAMD: *hasResult = true; *hasResultType = true; break; case OpReadClockKHR: *hasResult = true; *hasResultType = true; break; + case OpHitObjectRecordHitMotionNV: *hasResult = false; *hasResultType = false; break; + case OpHitObjectRecordHitWithIndexMotionNV: *hasResult = false; *hasResultType = false; break; + case OpHitObjectRecordMissMotionNV: *hasResult = false; *hasResultType = false; break; + case OpHitObjectGetWorldToObjectNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetObjectToWorldNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetObjectRayDirectionNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetObjectRayOriginNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectTraceRayMotionNV: *hasResult = false; *hasResultType = false; break; + case OpHitObjectGetShaderRecordBufferHandleNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetShaderBindingTableRecordIndexNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectRecordEmptyNV: *hasResult = false; *hasResultType = false; break; + case OpHitObjectTraceRayNV: *hasResult = false; *hasResultType = false; break; + case OpHitObjectRecordHitNV: *hasResult = false; *hasResultType = false; break; + case OpHitObjectRecordHitWithIndexNV: *hasResult = false; *hasResultType = false; break; + case OpHitObjectRecordMissNV: *hasResult = false; *hasResultType = false; break; + case OpHitObjectExecuteShaderNV: *hasResult = false; *hasResultType = false; break; + case OpHitObjectGetCurrentTimeNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetAttributesNV: *hasResult = false; *hasResultType = false; break; + case OpHitObjectGetHitKindNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetPrimitiveIndexNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetGeometryIndexNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetInstanceIdNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetInstanceCustomIndexNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetWorldRayDirectionNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetWorldRayOriginNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetRayTMaxNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectGetRayTMinNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectIsEmptyNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectIsHitNV: *hasResult = true; *hasResultType = true; break; + case OpHitObjectIsMissNV: *hasResult = true; *hasResultType = true; break; + case OpReorderThreadWithHitObjectNV: *hasResult = false; *hasResultType = false; break; + case OpReorderThreadWithHintNV: *hasResult = false; *hasResultType = false; break; + case OpTypeHitObjectNV: *hasResult = true; *hasResultType = false; break; case OpImageSampleFootprintNV: *hasResult = true; *hasResultType = true; break; - case OpGroupNonUniformPartitionNV: *hasResult = true; *hasResultType = true; break; case OpEmitMeshTasksEXT: *hasResult = false; *hasResultType = false; break; case OpSetMeshOutputsEXT: *hasResult = false; *hasResultType = false; break; + case OpGroupNonUniformPartitionNV: *hasResult = true; *hasResultType = true; break; case OpWritePackedPrimitiveIndices4x8NV: *hasResult = false; *hasResultType = false; break; case OpReportIntersectionNV: *hasResult = true; *hasResultType = true; break; case OpIgnoreIntersectionNV: *hasResult = false; *hasResultType = false; break; @@ -2299,6 +2471,7 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case OpTraceNV: *hasResult = false; *hasResultType = false; break; case OpTraceMotionNV: *hasResult = false; *hasResultType = false; break; case OpTraceRayMotionNV: *hasResult = false; *hasResultType = false; break; + case OpRayQueryGetIntersectionTriangleVertexPositionsKHR: *hasResult = true; *hasResultType = true; break; case OpTypeAccelerationStructureNV: *hasResult = true; *hasResultType = false; break; case OpExecuteCallableNV: *hasResult = false; *hasResultType = false; break; case OpTypeCooperativeMatrixNV: *hasResult = true; *hasResultType = false; break; @@ -2515,6 +2688,9 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case OpArbitraryFloatPowRINTEL: *hasResult = true; *hasResultType = true; break; case OpArbitraryFloatPowNINTEL: *hasResult = true; *hasResultType = true; break; case OpLoopControlINTEL: *hasResult = false; *hasResultType = false; break; + case OpAliasDomainDeclINTEL: *hasResult = true; *hasResultType = false; break; + case OpAliasScopeDeclINTEL: *hasResult = true; *hasResultType = false; break; + case OpAliasScopeListDeclINTEL: *hasResult = true; *hasResultType = false; break; case OpFixedSqrtINTEL: *hasResult = true; *hasResultType = true; break; case OpFixedRecipINTEL: *hasResult = true; *hasResultType = true; break; case OpFixedRsqrtINTEL: *hasResult = true; *hasResultType = true; break; @@ -2553,23 +2729,68 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { case OpTypeStructContinuedINTEL: *hasResult = false; *hasResultType = false; break; case OpConstantCompositeContinuedINTEL: *hasResult = false; *hasResultType = false; break; case OpSpecConstantCompositeContinuedINTEL: *hasResult = false; *hasResultType = false; break; + case OpControlBarrierArriveINTEL: *hasResult = false; *hasResultType = false; break; + case OpControlBarrierWaitINTEL: *hasResult = false; *hasResultType = false; break; + case OpGroupIMulKHR: *hasResult = true; *hasResultType = true; break; + case OpGroupFMulKHR: *hasResult = true; *hasResultType = true; break; + case OpGroupBitwiseAndKHR: *hasResult = true; *hasResultType = true; break; + case OpGroupBitwiseOrKHR: *hasResult = true; *hasResultType = true; break; + case OpGroupBitwiseXorKHR: *hasResult = true; *hasResultType = true; break; + case OpGroupLogicalAndKHR: *hasResult = true; *hasResultType = true; break; + case OpGroupLogicalOrKHR: *hasResult = true; *hasResultType = true; break; + case OpGroupLogicalXorKHR: *hasResult = true; *hasResultType = true; break; } } #endif /* SPV_ENABLE_UTILITY_CODE */ -// Overload operator| for mask bit combining +// Overload bitwise operators for mask bit combining inline ImageOperandsMask operator|(ImageOperandsMask a, ImageOperandsMask b) { return ImageOperandsMask(unsigned(a) | unsigned(b)); } +inline ImageOperandsMask operator&(ImageOperandsMask a, ImageOperandsMask b) { return ImageOperandsMask(unsigned(a) & unsigned(b)); } +inline ImageOperandsMask operator^(ImageOperandsMask a, ImageOperandsMask b) { return ImageOperandsMask(unsigned(a) ^ unsigned(b)); } +inline ImageOperandsMask operator~(ImageOperandsMask a) { return ImageOperandsMask(~unsigned(a)); } inline FPFastMathModeMask operator|(FPFastMathModeMask a, FPFastMathModeMask b) { return FPFastMathModeMask(unsigned(a) | unsigned(b)); } +inline FPFastMathModeMask operator&(FPFastMathModeMask a, FPFastMathModeMask b) { return FPFastMathModeMask(unsigned(a) & unsigned(b)); } +inline FPFastMathModeMask operator^(FPFastMathModeMask a, FPFastMathModeMask b) { return FPFastMathModeMask(unsigned(a) ^ unsigned(b)); } +inline FPFastMathModeMask operator~(FPFastMathModeMask a) { return FPFastMathModeMask(~unsigned(a)); } inline SelectionControlMask operator|(SelectionControlMask a, SelectionControlMask b) { return SelectionControlMask(unsigned(a) | unsigned(b)); } +inline SelectionControlMask operator&(SelectionControlMask a, SelectionControlMask b) { return SelectionControlMask(unsigned(a) & unsigned(b)); } +inline SelectionControlMask operator^(SelectionControlMask a, SelectionControlMask b) { return SelectionControlMask(unsigned(a) ^ unsigned(b)); } +inline SelectionControlMask operator~(SelectionControlMask a) { return SelectionControlMask(~unsigned(a)); } inline LoopControlMask operator|(LoopControlMask a, LoopControlMask b) { return LoopControlMask(unsigned(a) | unsigned(b)); } +inline LoopControlMask operator&(LoopControlMask a, LoopControlMask b) { return LoopControlMask(unsigned(a) & unsigned(b)); } +inline LoopControlMask operator^(LoopControlMask a, LoopControlMask b) { return LoopControlMask(unsigned(a) ^ unsigned(b)); } +inline LoopControlMask operator~(LoopControlMask a) { return LoopControlMask(~unsigned(a)); } inline FunctionControlMask operator|(FunctionControlMask a, FunctionControlMask b) { return FunctionControlMask(unsigned(a) | unsigned(b)); } +inline FunctionControlMask operator&(FunctionControlMask a, FunctionControlMask b) { return FunctionControlMask(unsigned(a) & unsigned(b)); } +inline FunctionControlMask operator^(FunctionControlMask a, FunctionControlMask b) { return FunctionControlMask(unsigned(a) ^ unsigned(b)); } +inline FunctionControlMask operator~(FunctionControlMask a) { return FunctionControlMask(~unsigned(a)); } inline MemorySemanticsMask operator|(MemorySemanticsMask a, MemorySemanticsMask b) { return MemorySemanticsMask(unsigned(a) | unsigned(b)); } +inline MemorySemanticsMask operator&(MemorySemanticsMask a, MemorySemanticsMask b) { return MemorySemanticsMask(unsigned(a) & unsigned(b)); } +inline MemorySemanticsMask operator^(MemorySemanticsMask a, MemorySemanticsMask b) { return MemorySemanticsMask(unsigned(a) ^ unsigned(b)); } +inline MemorySemanticsMask operator~(MemorySemanticsMask a) { return MemorySemanticsMask(~unsigned(a)); } inline MemoryAccessMask operator|(MemoryAccessMask a, MemoryAccessMask b) { return MemoryAccessMask(unsigned(a) | unsigned(b)); } +inline MemoryAccessMask operator&(MemoryAccessMask a, MemoryAccessMask b) { return MemoryAccessMask(unsigned(a) & unsigned(b)); } +inline MemoryAccessMask operator^(MemoryAccessMask a, MemoryAccessMask b) { return MemoryAccessMask(unsigned(a) ^ unsigned(b)); } +inline MemoryAccessMask operator~(MemoryAccessMask a) { return MemoryAccessMask(~unsigned(a)); } inline KernelProfilingInfoMask operator|(KernelProfilingInfoMask a, KernelProfilingInfoMask b) { return KernelProfilingInfoMask(unsigned(a) | unsigned(b)); } +inline KernelProfilingInfoMask operator&(KernelProfilingInfoMask a, KernelProfilingInfoMask b) { return KernelProfilingInfoMask(unsigned(a) & unsigned(b)); } +inline KernelProfilingInfoMask operator^(KernelProfilingInfoMask a, KernelProfilingInfoMask b) { return KernelProfilingInfoMask(unsigned(a) ^ unsigned(b)); } +inline KernelProfilingInfoMask operator~(KernelProfilingInfoMask a) { return KernelProfilingInfoMask(~unsigned(a)); } inline RayFlagsMask operator|(RayFlagsMask a, RayFlagsMask b) { return RayFlagsMask(unsigned(a) | unsigned(b)); } +inline RayFlagsMask operator&(RayFlagsMask a, RayFlagsMask b) { return RayFlagsMask(unsigned(a) & unsigned(b)); } +inline RayFlagsMask operator^(RayFlagsMask a, RayFlagsMask b) { return RayFlagsMask(unsigned(a) ^ unsigned(b)); } +inline RayFlagsMask operator~(RayFlagsMask a) { return RayFlagsMask(~unsigned(a)); } inline FragmentShadingRateMask operator|(FragmentShadingRateMask a, FragmentShadingRateMask b) { return FragmentShadingRateMask(unsigned(a) | unsigned(b)); } +inline FragmentShadingRateMask operator&(FragmentShadingRateMask a, FragmentShadingRateMask b) { return FragmentShadingRateMask(unsigned(a) & unsigned(b)); } +inline FragmentShadingRateMask operator^(FragmentShadingRateMask a, FragmentShadingRateMask b) { return FragmentShadingRateMask(unsigned(a) ^ unsigned(b)); } +inline FragmentShadingRateMask operator~(FragmentShadingRateMask a) { return FragmentShadingRateMask(~unsigned(a)); } +inline CooperativeMatrixOperandsMask operator|(CooperativeMatrixOperandsMask a, CooperativeMatrixOperandsMask b) { return CooperativeMatrixOperandsMask(unsigned(a) | unsigned(b)); } +inline CooperativeMatrixOperandsMask operator&(CooperativeMatrixOperandsMask a, CooperativeMatrixOperandsMask b) { return CooperativeMatrixOperandsMask(unsigned(a) & unsigned(b)); } +inline CooperativeMatrixOperandsMask operator^(CooperativeMatrixOperandsMask a, CooperativeMatrixOperandsMask b) { return CooperativeMatrixOperandsMask(unsigned(a) ^ unsigned(b)); } +inline CooperativeMatrixOperandsMask operator~(CooperativeMatrixOperandsMask a) { return CooperativeMatrixOperandsMask(~unsigned(a)); } } // end namespace spv #endif // #ifndef spirv_HPP + diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/spvIR.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/spvIR.h deleted file mode 100644 index 0969127..0000000 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/SPIRV/spvIR.h +++ /dev/null @@ -1,520 +0,0 @@ -// -// Copyright (C) 2014 LunarG, Inc. -// Copyright (C) 2015-2018 Google, Inc. -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// -// Neither the name of 3Dlabs Inc. Ltd. nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. - -// SPIRV-IR -// -// Simple in-memory representation (IR) of SPIRV. Just for holding -// Each function's CFG of blocks. Has this hierarchy: -// - Module, which is a list of -// - Function, which is a list of -// - Block, which is a list of -// - Instruction -// - -#pragma once -#ifndef spvIR_H -#define spvIR_H - -#include "spirv.hpp" - -#include -#include -#include -#include -#include -#include -#include - -namespace spv { - -class Block; -class Function; -class Module; - -const Id NoResult = 0; -const Id NoType = 0; - -const Decoration NoPrecision = DecorationMax; - -#ifdef __GNUC__ -# define POTENTIALLY_UNUSED __attribute__((unused)) -#else -# define POTENTIALLY_UNUSED -#endif - -POTENTIALLY_UNUSED -const MemorySemanticsMask MemorySemanticsAllMemory = - (MemorySemanticsMask)(MemorySemanticsUniformMemoryMask | - MemorySemanticsWorkgroupMemoryMask | - MemorySemanticsAtomicCounterMemoryMask | - MemorySemanticsImageMemoryMask); - -struct IdImmediate { - bool isId; // true if word is an Id, false if word is an immediate - unsigned word; - IdImmediate(bool i, unsigned w) : isId(i), word(w) {} -}; - -// -// SPIR-V IR instruction. -// - -class Instruction { -public: - Instruction(Id resultId, Id typeId, Op opCode) : resultId(resultId), typeId(typeId), opCode(opCode), block(nullptr) { } - explicit Instruction(Op opCode) : resultId(NoResult), typeId(NoType), opCode(opCode), block(nullptr) { } - virtual ~Instruction() {} - void addIdOperand(Id id) { - operands.push_back(id); - idOperand.push_back(true); - } - void addImmediateOperand(unsigned int immediate) { - operands.push_back(immediate); - idOperand.push_back(false); - } - void setImmediateOperand(unsigned idx, unsigned int immediate) { - assert(!idOperand[idx]); - operands[idx] = immediate; - } - - void addStringOperand(const char* str) - { - unsigned int word = 0; - unsigned int shiftAmount = 0; - char c; - - do { - c = *(str++); - word |= ((unsigned int)c) << shiftAmount; - shiftAmount += 8; - if (shiftAmount == 32) { - addImmediateOperand(word); - word = 0; - shiftAmount = 0; - } - } while (c != 0); - - // deal with partial last word - if (shiftAmount > 0) { - addImmediateOperand(word); - } - } - bool isIdOperand(int op) const { return idOperand[op]; } - void setBlock(Block* b) { block = b; } - Block* getBlock() const { return block; } - Op getOpCode() const { return opCode; } - int getNumOperands() const - { - assert(operands.size() == idOperand.size()); - return (int)operands.size(); - } - Id getResultId() const { return resultId; } - Id getTypeId() const { return typeId; } - Id getIdOperand(int op) const { - assert(idOperand[op]); - return operands[op]; - } - unsigned int getImmediateOperand(int op) const { - assert(!idOperand[op]); - return operands[op]; - } - - // Write out the binary form. - void dump(std::vector& out) const - { - // Compute the wordCount - unsigned int wordCount = 1; - if (typeId) - ++wordCount; - if (resultId) - ++wordCount; - wordCount += (unsigned int)operands.size(); - - // Write out the beginning of the instruction - out.push_back(((wordCount) << WordCountShift) | opCode); - if (typeId) - out.push_back(typeId); - if (resultId) - out.push_back(resultId); - - // Write out the operands - for (int op = 0; op < (int)operands.size(); ++op) - out.push_back(operands[op]); - } - -protected: - Instruction(const Instruction&); - Id resultId; - Id typeId; - Op opCode; - std::vector operands; // operands, both and immediates (both are unsigned int) - std::vector idOperand; // true for operands that are , false for immediates - Block* block; -}; - -// -// SPIR-V IR block. -// - -class Block { -public: - Block(Id id, Function& parent); - virtual ~Block() - { - } - - Id getId() { return instructions.front()->getResultId(); } - - Function& getParent() const { return parent; } - void addInstruction(std::unique_ptr inst); - void addPredecessor(Block* pred) { predecessors.push_back(pred); pred->successors.push_back(this);} - void addLocalVariable(std::unique_ptr inst) { localVariables.push_back(std::move(inst)); } - const std::vector& getPredecessors() const { return predecessors; } - const std::vector& getSuccessors() const { return successors; } - const std::vector >& getInstructions() const { - return instructions; - } - const std::vector >& getLocalVariables() const { return localVariables; } - void setUnreachable() { unreachable = true; } - bool isUnreachable() const { return unreachable; } - // Returns the block's merge instruction, if one exists (otherwise null). - const Instruction* getMergeInstruction() const { - if (instructions.size() < 2) return nullptr; - const Instruction* nextToLast = (instructions.cend() - 2)->get(); - switch (nextToLast->getOpCode()) { - case OpSelectionMerge: - case OpLoopMerge: - return nextToLast; - default: - return nullptr; - } - return nullptr; - } - - // Change this block into a canonical dead merge block. Delete instructions - // as necessary. A canonical dead merge block has only an OpLabel and an - // OpUnreachable. - void rewriteAsCanonicalUnreachableMerge() { - assert(localVariables.empty()); - // Delete all instructions except for the label. - assert(instructions.size() > 0); - instructions.resize(1); - successors.clear(); - addInstruction(std::unique_ptr(new Instruction(OpUnreachable))); - } - // Change this block into a canonical dead continue target branching to the - // given header ID. Delete instructions as necessary. A canonical dead continue - // target has only an OpLabel and an unconditional branch back to the corresponding - // header. - void rewriteAsCanonicalUnreachableContinue(Block* header) { - assert(localVariables.empty()); - // Delete all instructions except for the label. - assert(instructions.size() > 0); - instructions.resize(1); - successors.clear(); - // Add OpBranch back to the header. - assert(header != nullptr); - Instruction* branch = new Instruction(OpBranch); - branch->addIdOperand(header->getId()); - addInstruction(std::unique_ptr(branch)); - successors.push_back(header); - } - - bool isTerminated() const - { - switch (instructions.back()->getOpCode()) { - case OpBranch: - case OpBranchConditional: - case OpSwitch: - case OpKill: - case OpTerminateInvocation: - case OpReturn: - case OpReturnValue: - case OpUnreachable: - return true; - default: - return false; - } - } - - void dump(std::vector& out) const - { - instructions[0]->dump(out); - for (int i = 0; i < (int)localVariables.size(); ++i) - localVariables[i]->dump(out); - for (int i = 1; i < (int)instructions.size(); ++i) - instructions[i]->dump(out); - } - -protected: - Block(const Block&); - Block& operator=(Block&); - - // To enforce keeping parent and ownership in sync: - friend Function; - - std::vector > instructions; - std::vector predecessors, successors; - std::vector > localVariables; - Function& parent; - - // track whether this block is known to be uncreachable (not necessarily - // true for all unreachable blocks, but should be set at least - // for the extraneous ones introduced by the builder). - bool unreachable; -}; - -// The different reasons for reaching a block in the inReadableOrder traversal. -enum ReachReason { - // Reachable from the entry block via transfers of control, i.e. branches. - ReachViaControlFlow = 0, - // A continue target that is not reachable via control flow. - ReachDeadContinue, - // A merge block that is not reachable via control flow. - ReachDeadMerge -}; - -// Traverses the control-flow graph rooted at root in an order suited for -// readable code generation. Invokes callback at every node in the traversal -// order. The callback arguments are: -// - the block, -// - the reason we reached the block, -// - if the reason was that block is an unreachable continue or unreachable merge block -// then the last parameter is the corresponding header block. -void inReadableOrder(Block* root, std::function callback); - -// -// SPIR-V IR Function. -// - -class Function { -public: - Function(Id id, Id resultType, Id functionType, Id firstParam, Module& parent); - virtual ~Function() - { - for (int i = 0; i < (int)parameterInstructions.size(); ++i) - delete parameterInstructions[i]; - - for (int i = 0; i < (int)blocks.size(); ++i) - delete blocks[i]; - } - Id getId() const { return functionInstruction.getResultId(); } - Id getParamId(int p) const { return parameterInstructions[p]->getResultId(); } - Id getParamType(int p) const { return parameterInstructions[p]->getTypeId(); } - - void addBlock(Block* block) { blocks.push_back(block); } - void removeBlock(Block* block) - { - auto found = find(blocks.begin(), blocks.end(), block); - assert(found != blocks.end()); - blocks.erase(found); - delete block; - } - - Module& getParent() const { return parent; } - Block* getEntryBlock() const { return blocks.front(); } - Block* getLastBlock() const { return blocks.back(); } - const std::vector& getBlocks() const { return blocks; } - void addLocalVariable(std::unique_ptr inst); - Id getReturnType() const { return functionInstruction.getTypeId(); } - Id getFuncId() const { return functionInstruction.getResultId(); } - void setReturnPrecision(Decoration precision) - { - if (precision == DecorationRelaxedPrecision) - reducedPrecisionReturn = true; - } - Decoration getReturnPrecision() const - { return reducedPrecisionReturn ? DecorationRelaxedPrecision : NoPrecision; } - - void setDebugLineInfo(Id fileName, int line, int column) { - lineInstruction = std::unique_ptr{new Instruction(OpLine)}; - lineInstruction->addIdOperand(fileName); - lineInstruction->addImmediateOperand(line); - lineInstruction->addImmediateOperand(column); - } - bool hasDebugLineInfo() const { return lineInstruction != nullptr; } - - void setImplicitThis() { implicitThis = true; } - bool hasImplicitThis() const { return implicitThis; } - - void addParamPrecision(unsigned param, Decoration precision) - { - if (precision == DecorationRelaxedPrecision) - reducedPrecisionParams.insert(param); - } - Decoration getParamPrecision(unsigned param) const - { - return reducedPrecisionParams.find(param) != reducedPrecisionParams.end() ? - DecorationRelaxedPrecision : NoPrecision; - } - - void dump(std::vector& out) const - { - // OpLine - if (lineInstruction != nullptr) { - lineInstruction->dump(out); - } - - // OpFunction - functionInstruction.dump(out); - - // OpFunctionParameter - for (int p = 0; p < (int)parameterInstructions.size(); ++p) - parameterInstructions[p]->dump(out); - - // Blocks - inReadableOrder(blocks[0], [&out](const Block* b, ReachReason, Block*) { b->dump(out); }); - Instruction end(0, 0, OpFunctionEnd); - end.dump(out); - } - -protected: - Function(const Function&); - Function& operator=(Function&); - - Module& parent; - std::unique_ptr lineInstruction; - Instruction functionInstruction; - std::vector parameterInstructions; - std::vector blocks; - bool implicitThis; // true if this is a member function expecting to be passed a 'this' as the first argument - bool reducedPrecisionReturn; - std::set reducedPrecisionParams; // list of parameter indexes that need a relaxed precision arg -}; - -// -// SPIR-V IR Module. -// - -class Module { -public: - Module() {} - virtual ~Module() - { - // TODO delete things - } - - void addFunction(Function *fun) { functions.push_back(fun); } - - void mapInstruction(Instruction *instruction) - { - spv::Id resultId = instruction->getResultId(); - // map the instruction's result id - if (resultId >= idToInstruction.size()) - idToInstruction.resize(resultId + 16); - idToInstruction[resultId] = instruction; - } - - Instruction* getInstruction(Id id) const { return idToInstruction[id]; } - const std::vector& getFunctions() const { return functions; } - spv::Id getTypeId(Id resultId) const { - return idToInstruction[resultId] == nullptr ? NoType : idToInstruction[resultId]->getTypeId(); - } - StorageClass getStorageClass(Id typeId) const - { - assert(idToInstruction[typeId]->getOpCode() == spv::OpTypePointer); - return (StorageClass)idToInstruction[typeId]->getImmediateOperand(0); - } - - void dump(std::vector& out) const - { - for (int f = 0; f < (int)functions.size(); ++f) - functions[f]->dump(out); - } - -protected: - Module(const Module&); - std::vector functions; - - // map from result id to instruction having that result id - std::vector idToInstruction; - - // map from a result id to its type id -}; - -// -// Implementation (it's here due to circular type definitions). -// - -// Add both -// - the OpFunction instruction -// - all the OpFunctionParameter instructions -__inline Function::Function(Id id, Id resultType, Id functionType, Id firstParamId, Module& parent) - : parent(parent), lineInstruction(nullptr), - functionInstruction(id, resultType, OpFunction), implicitThis(false), - reducedPrecisionReturn(false) -{ - // OpFunction - functionInstruction.addImmediateOperand(FunctionControlMaskNone); - functionInstruction.addIdOperand(functionType); - parent.mapInstruction(&functionInstruction); - parent.addFunction(this); - - // OpFunctionParameter - Instruction* typeInst = parent.getInstruction(functionType); - int numParams = typeInst->getNumOperands() - 1; - for (int p = 0; p < numParams; ++p) { - Instruction* param = new Instruction(firstParamId + p, typeInst->getIdOperand(p + 1), OpFunctionParameter); - parent.mapInstruction(param); - parameterInstructions.push_back(param); - } -} - -__inline void Function::addLocalVariable(std::unique_ptr inst) -{ - Instruction* raw_instruction = inst.get(); - blocks[0]->addLocalVariable(std::move(inst)); - parent.mapInstruction(raw_instruction); -} - -__inline Block::Block(Id id, Function& parent) : parent(parent), unreachable(false) -{ - instructions.push_back(std::unique_ptr(new Instruction(id, NoType, OpLabel))); - instructions.back()->setBlock(this); - parent.getParent().mapInstruction(instructions.back().get()); -} - -__inline void Block::addInstruction(std::unique_ptr inst) -{ - Instruction* raw_instruction = inst.get(); - instructions.push_back(std::move(inst)); - raw_instruction->setBlock(this); - if (raw_instruction->getResultId()) - parent.getParent().mapInstruction(raw_instruction); -} - -} // end spv namespace - -#endif // spvIR_H diff --git a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/build_info.h b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/build_info.h index e006f30..ffb33ca 100644 --- a/prebuilt/x86_64-unknown-linux-gnu/include/glslang/build_info.h +++ b/prebuilt/x86_64-unknown-linux-gnu/include/glslang/build_info.h @@ -34,8 +34,8 @@ #ifndef GLSLANG_BUILD_INFO #define GLSLANG_BUILD_INFO -#define GLSLANG_VERSION_MAJOR 12 -#define GLSLANG_VERSION_MINOR 1 +#define GLSLANG_VERSION_MAJOR 14 +#define GLSLANG_VERSION_MINOR 0 #define GLSLANG_VERSION_PATCH 0 #define GLSLANG_VERSION_FLAVOR "" diff --git a/prebuilt/x86_64-unknown-linux-gnu/lib/libGenericCodeGen.a b/prebuilt/x86_64-unknown-linux-gnu/lib/libGenericCodeGen.a index ef3ce18..583348c 100644 Binary files a/prebuilt/x86_64-unknown-linux-gnu/lib/libGenericCodeGen.a and b/prebuilt/x86_64-unknown-linux-gnu/lib/libGenericCodeGen.a differ diff --git a/prebuilt/x86_64-unknown-linux-gnu/lib/libHLSL.a b/prebuilt/x86_64-unknown-linux-gnu/lib/libHLSL.a deleted file mode 100644 index 3e5ca41..0000000 Binary files a/prebuilt/x86_64-unknown-linux-gnu/lib/libHLSL.a and /dev/null differ diff --git a/prebuilt/x86_64-unknown-linux-gnu/lib/libMachineIndependent.a b/prebuilt/x86_64-unknown-linux-gnu/lib/libMachineIndependent.a index 59a738b..d547046 100644 Binary files a/prebuilt/x86_64-unknown-linux-gnu/lib/libMachineIndependent.a and b/prebuilt/x86_64-unknown-linux-gnu/lib/libMachineIndependent.a differ diff --git a/prebuilt/x86_64-unknown-linux-gnu/lib/libOGLCompiler.a b/prebuilt/x86_64-unknown-linux-gnu/lib/libOGLCompiler.a deleted file mode 100644 index 1cb8135..0000000 Binary files a/prebuilt/x86_64-unknown-linux-gnu/lib/libOGLCompiler.a and /dev/null differ diff --git a/prebuilt/x86_64-unknown-linux-gnu/lib/libOSDependent.a b/prebuilt/x86_64-unknown-linux-gnu/lib/libOSDependent.a index 63e0c02..6fa39d3 100644 Binary files a/prebuilt/x86_64-unknown-linux-gnu/lib/libOSDependent.a and b/prebuilt/x86_64-unknown-linux-gnu/lib/libOSDependent.a differ diff --git a/prebuilt/x86_64-unknown-linux-gnu/lib/libSPIRV.a b/prebuilt/x86_64-unknown-linux-gnu/lib/libSPIRV.a index 6266062..eba958b 100644 Binary files a/prebuilt/x86_64-unknown-linux-gnu/lib/libSPIRV.a and b/prebuilt/x86_64-unknown-linux-gnu/lib/libSPIRV.a differ diff --git a/prebuilt/x86_64-unknown-linux-gnu/lib/libglslang-default-resource-limits.a b/prebuilt/x86_64-unknown-linux-gnu/lib/libglslang-default-resource-limits.a index 74bbc82..8173ad6 100644 Binary files a/prebuilt/x86_64-unknown-linux-gnu/lib/libglslang-default-resource-limits.a and b/prebuilt/x86_64-unknown-linux-gnu/lib/libglslang-default-resource-limits.a differ diff --git a/prebuilt/x86_64-unknown-linux-gnu/lib/libglslang.a b/prebuilt/x86_64-unknown-linux-gnu/lib/libglslang.a index 236248b..7e6289d 100644 Binary files a/prebuilt/x86_64-unknown-linux-gnu/lib/libglslang.a and b/prebuilt/x86_64-unknown-linux-gnu/lib/libglslang.a differ