From 0f54cc550c75b11dbc2df0d164a0789e1024ac60 Mon Sep 17 00:00:00 2001 From: baldurk Date: Sun, 12 Jul 2015 12:08:00 +0200 Subject: [PATCH] Update glslang to latest code. * From renderdoc branch on https://github.com/baldurk/glslang --- .../3rdparty/glslang/SPIRV/GlslangToSpv.cpp | 10 +++++----- .../3rdparty/glslang/SPIRV/SpvBuilder.cpp | 14 +++++-------- .../3rdparty/glslang/glslang/Include/Common.h | 2 -- .../glslang/glslang/Include/intermediate.h | 20 ++++++++++--------- .../glslang/MachineIndependent/Constant.cpp | 2 +- .../glslang/MachineIndependent/Initialize.cpp | 2 +- .../MachineIndependent/ParseHelper.cpp | 10 +++++----- .../glslang/MachineIndependent/Scan.cpp | 2 +- .../glslang/glslang/MachineIndependent/Scan.h | 4 ++-- .../glslang/MachineIndependent/Versions.cpp | 2 ++ .../preprocessor/PpAtom.cpp | 2 +- .../preprocessor/PpContext.h | 2 +- .../preprocessor/PpScanner.cpp | 2 +- .../preprocessor/PpSymbols.cpp | 2 +- 14 files changed, 37 insertions(+), 39 deletions(-) diff --git a/renderdoc/3rdparty/glslang/SPIRV/GlslangToSpv.cpp b/renderdoc/3rdparty/glslang/SPIRV/GlslangToSpv.cpp index 0c01d9e71..aec9fd2c7 100644 --- a/renderdoc/3rdparty/glslang/SPIRV/GlslangToSpv.cpp +++ b/renderdoc/3rdparty/glslang/SPIRV/GlslangToSpv.cpp @@ -1101,9 +1101,9 @@ bool TGlslangToSpvTraverser::visitSwitch(glslang::TVisit /* visit */, glslang::T for (glslang::TIntermSequence::iterator c = sequence.begin(); c != sequence.end(); ++c) { TIntermNode* child = *c; if (child->getAsBranchNode() && child->getAsBranchNode()->getFlowOp() == glslang::EOpDefault) - defaultSegment = codeSegments.size(); + defaultSegment = (int)codeSegments.size(); else if (child->getAsBranchNode() && child->getAsBranchNode()->getFlowOp() == glslang::EOpCase) { - valueIndexToSegment[caseValues.size()] = codeSegments.size(); + valueIndexToSegment[caseValues.size()] = (int)codeSegments.size(); caseValues.push_back(child->getAsBranchNode()->getExpression()->getAsConstantUnion()->getConstArray()[0].getIConst()); } else codeSegments.push_back(child); @@ -1117,7 +1117,7 @@ bool TGlslangToSpvTraverser::visitSwitch(glslang::TVisit /* visit */, glslang::T // make the switch statement std::vector segmentBlocks; // returned, as the blocks allocated in the call - builder.makeSwitch(selector, codeSegments.size(), caseValues, valueIndexToSegment, defaultSegment, segmentBlocks); + builder.makeSwitch(selector, (int)codeSegments.size(), caseValues, valueIndexToSegment, defaultSegment, segmentBlocks); // emit all the code in the segments breakForLoop.push(false); @@ -1347,7 +1347,7 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty // built-in variable decorations int builtIn = TranslateBuiltInDecoration(glslangType.getQualifier().builtIn); - if (builtIn != spv::BadValue) + if ((unsigned int)builtIn != spv::BadValue) builder.addMemberDecoration(spvType, member, spv::DecorationBuiltIn, builtIn); } } @@ -2434,7 +2434,7 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol // built-in variable decorations int builtIn = TranslateBuiltInDecoration(symbol->getQualifier().builtIn); - if (builtIn != spv::BadValue) + if ((unsigned int)builtIn != spv::BadValue) builder.addDecoration(id, spv::DecorationBuiltIn, builtIn); if (linkageOnly) diff --git a/renderdoc/3rdparty/glslang/SPIRV/SpvBuilder.cpp b/renderdoc/3rdparty/glslang/SPIRV/SpvBuilder.cpp index 0f12b94fd..51da1b64a 100644 --- a/renderdoc/3rdparty/glslang/SPIRV/SpvBuilder.cpp +++ b/renderdoc/3rdparty/glslang/SPIRV/SpvBuilder.cpp @@ -51,10 +51,6 @@ #include #endif -#ifdef _MSC_VER - #pragma warning(disable : 4267) // conversion, possible loss of data -#endif - namespace spv { const int SpvBuilderMagic = 0xBB; @@ -708,7 +704,7 @@ void Builder::closeMain() Function* Builder::makeFunctionEntry(Id returnType, const char* name, std::vector& paramTypes, Block **entry) { Id typeId = makeFunctionType(returnType, paramTypes); - Id firstParamId = paramTypes.size() == 0 ? 0 : getUniqueIds(paramTypes.size()); + Id firstParamId = paramTypes.size() == 0 ? 0 : getUniqueIds((int)paramTypes.size()); Function* function = new Function(getUniqueId(), returnType, typeId, firstParamId, module); if (entry) { @@ -1035,7 +1031,7 @@ Id Builder::createRvalueSwizzle(Id typeId, Id source, std::vector& cha // Comments in header Id Builder::createLvalueSwizzle(Id typeId, Id target, Id source, std::vector& channels) { - assert(getNumComponents(source) == channels.size()); + assert(getNumComponents(source) == (int)channels.size()); if (channels.size() == 1 && getNumComponents(source) == 1) return createCompositeInsert(source, target, typeId, channels.front()); @@ -1179,7 +1175,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool proj, co Id Builder::createTextureQueryCall(Op opCode, const TextureParameters& parameters) { // Figure out the result type - Id resultType; + Id resultType = NoType; switch (opCode) { case OpTextureQuerySize: case OpTextureQuerySizeLod: @@ -1474,7 +1470,7 @@ Id Builder::createCompare(Decoration precision, Id value1, Id value2, bool equal // OpCompositeConstruct Id Builder::createCompositeConstruct(Id typeId, std::vector& constituents) { - assert(isAggregateType(typeId) || getNumTypeComponents(typeId) > 1 && getNumTypeComponents(typeId) == constituents.size()); + assert((isAggregateType(typeId) || getNumTypeComponents(typeId) > 1) && getNumTypeComponents(typeId) == (int)constituents.size()); Instruction* op = new Instruction(getUniqueId(), typeId, OpCompositeConstruct); for (int c = 0; c < (int)constituents.size(); ++c) @@ -1947,7 +1943,7 @@ Id Builder::accessChainLoad(Decoration /*precision*/) // static swizzle Id resultType = componentType; if (accessChain.swizzle.size() > 1) - resultType = makeVectorType(componentType, accessChain.swizzle.size()); + resultType = makeVectorType(componentType, (int)accessChain.swizzle.size()); id = createRvalueSwizzle(resultType, id, accessChain.swizzle); } diff --git a/renderdoc/3rdparty/glslang/glslang/Include/Common.h b/renderdoc/3rdparty/glslang/glslang/Include/Common.h index 94e42378b..0940f30a3 100644 --- a/renderdoc/3rdparty/glslang/glslang/Include/Common.h +++ b/renderdoc/3rdparty/glslang/glslang/Include/Common.h @@ -56,8 +56,6 @@ #pragma warning(disable : 4786) // Don't warn about too long identifiers #pragma warning(disable : 4514) // unused inline method #pragma warning(disable : 4201) // nameless union - - #pragma warning(disable : 4267) // conversion, possible loss of data #endif #include diff --git a/renderdoc/3rdparty/glslang/glslang/Include/intermediate.h b/renderdoc/3rdparty/glslang/glslang/Include/intermediate.h index cf24e014a..2232c01e6 100644 --- a/renderdoc/3rdparty/glslang/glslang/Include/intermediate.h +++ b/renderdoc/3rdparty/glslang/glslang/Include/intermediate.h @@ -353,6 +353,7 @@ enum TOperator { // Texture operations // + ETextureGuardBegin, ETextureQuerySize, ETextureQueryLod, ETextureQueryLevels, @@ -374,6 +375,7 @@ enum TOperator { ETextureGather, ETextureGatherOffset, ETextureGatherOffsets, + ETextureGuardEnd, }; class TIntermTraverser; @@ -484,10 +486,10 @@ public: terminal(aTerminal), first(testFirst) { } virtual void traverse(TIntermTraverser*); - TIntermNode* getBody() { return body; } - TIntermTyped* getTest() { return test; } - TIntermTyped* getTerminal() { return terminal; } - bool testFirst() { return first; } + TIntermNode* getBody() const { return body; } + TIntermTyped* getTest() const { return test; } + TIntermTyped* getTerminal() const { return terminal; } + bool testFirst() const { return first; } protected: TIntermNode* body; // code to loop over TIntermTyped* test; // exit condition associated with loop, could be 0 for 'for' loops @@ -506,8 +508,8 @@ public: virtual TIntermBranch* getAsBranchNode() { return this; } virtual const TIntermBranch* getAsBranchNode() const { return this; } virtual void traverse(TIntermTraverser*); - TOperator getFlowOp() { return flowOp; } - TIntermTyped* getExpression() { return expression; } + TOperator getFlowOp() const { return flowOp; } + TIntermTyped* getExpression() const { return expression; } protected: TOperator flowOp; TIntermTyped* expression; @@ -578,7 +580,7 @@ class TIntermOperator : public TIntermTyped { public: virtual TIntermOperator* getAsOperator() { return this; } virtual const TIntermOperator* getAsOperator() const { return this; } - TOperator getOp() { return op; } + TOperator getOp() const { return op; } bool modifiesState() const; bool isConstructor() const; virtual bool promote() { return true; } @@ -650,8 +652,8 @@ public: virtual const TQualifierList& getQualifierList() const { return qualifier; } void setOptimize(bool o) { optimize = o; } void setDebug(bool d) { debug = d; } - bool getOptimize() { return optimize; } - bool getDebug() { return debug; } + bool getOptimize() const { return optimize; } + bool getDebug() const { return debug; } void addToPragmaTable(const TPragmaTable& pTable); const TPragmaTable& getPragmaTable() const { return *pragmaTable; } protected: diff --git a/renderdoc/3rdparty/glslang/glslang/MachineIndependent/Constant.cpp b/renderdoc/3rdparty/glslang/glslang/MachineIndependent/Constant.cpp index 26572734a..cd68a9d6a 100644 --- a/renderdoc/3rdparty/glslang/glslang/MachineIndependent/Constant.cpp +++ b/renderdoc/3rdparty/glslang/glslang/MachineIndependent/Constant.cpp @@ -172,7 +172,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* const case EbtInt: if (rightUnionArray[i] == 0) newConstArray[i].setIConst(0x7FFFFFFF); - else if (rightUnionArray[i].getIConst() == -1 && unionArray[i].getIConst() == 0x80000000) + else if (rightUnionArray[i].getIConst() == -1 && (unsigned int)unionArray[i].getIConst() == 0x80000000) newConstArray[i].setIConst(0x80000000); else newConstArray[i].setIConst(unionArray[i].getIConst() / rightUnionArray[i].getIConst()); diff --git a/renderdoc/3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp b/renderdoc/3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp index 396a9f67b..52e19893f 100644 --- a/renderdoc/3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp +++ b/renderdoc/3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp @@ -1054,7 +1054,7 @@ void TBuiltIns::initialize(int version, EProfile profile) // //============================================================================ bool esBarrier = (profile == EEsProfile && version >= 310); - if (profile != EEsProfile && version >= 150 || esBarrier) + if ((profile != EEsProfile && version >= 150) || esBarrier) stageBuiltins[EShLangTessControl].append( "void barrier();" ); diff --git a/renderdoc/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp b/renderdoc/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp index dbf201872..427ee67e6 100644 --- a/renderdoc/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp +++ b/renderdoc/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp @@ -3461,13 +3461,13 @@ void TParseContext::setLayoutQualifier(TSourceLoc loc, TPublicType& publicType, // the implementation-dependent constant gl_MaxTransformFeedbackBuffers." if (value >= resources.maxTransformFeedbackBuffers) error(loc, "buffer is too large:", id.c_str(), "gl_MaxTransformFeedbackBuffers is %d", resources.maxTransformFeedbackBuffers); - if (value >= TQualifier::layoutXfbBufferEnd) + if (value >= (int)TQualifier::layoutXfbBufferEnd) error(loc, "buffer is too large:", id.c_str(), "internal max is %d", TQualifier::layoutXfbBufferEnd-1); else publicType.qualifier.layoutXfbBuffer = value; return; } else if (id == "xfb_offset") { - if (value >= TQualifier::layoutXfbOffsetEnd) + if (value >= (int)TQualifier::layoutXfbOffsetEnd) error(loc, "offset is too large:", id.c_str(), "internal max is %d", TQualifier::layoutXfbOffsetEnd-1); else publicType.qualifier.layoutXfbOffset = value; @@ -3477,9 +3477,9 @@ void TParseContext::setLayoutQualifier(TSourceLoc loc, TPublicType& publicType, // implementation-dependent constant gl_MaxTransformFeedbackInterleavedComponents." if (value > 4 * resources.maxTransformFeedbackInterleavedComponents) error(loc, "1/4 stride is too large:", id.c_str(), "gl_MaxTransformFeedbackInterleavedComponents is %d", resources.maxTransformFeedbackInterleavedComponents); - else if (value >= TQualifier::layoutXfbStrideEnd) + else if (value >= (int)TQualifier::layoutXfbStrideEnd) error(loc, "stride is too large:", id.c_str(), "internal max is %d", TQualifier::layoutXfbStrideEnd-1); - if (value < TQualifier::layoutXfbStrideEnd) + if (value < (int)TQualifier::layoutXfbStrideEnd) publicType.qualifier.layoutXfbStride = value; return; } @@ -4827,7 +4827,7 @@ void TParseContext::fixBlockLocations(TSourceLoc loc, TQualifier& qualifier, TTy TQualifier& memberQualifier = typeList[member].type->getQualifier(); TSourceLoc memberLoc = typeList[member].loc; if (! memberQualifier.hasLocation()) { - if (nextLocation >= TQualifier::layoutLocationEnd) + if (nextLocation >= (int)TQualifier::layoutLocationEnd) error(memberLoc, "location is too large", "location", ""); memberQualifier.layoutLocation = nextLocation; memberQualifier.layoutComponent = 0; diff --git a/renderdoc/3rdparty/glslang/glslang/MachineIndependent/Scan.cpp b/renderdoc/3rdparty/glslang/glslang/MachineIndependent/Scan.cpp index bccd8adee..32afd713f 100644 --- a/renderdoc/3rdparty/glslang/glslang/MachineIndependent/Scan.cpp +++ b/renderdoc/3rdparty/glslang/glslang/MachineIndependent/Scan.cpp @@ -685,7 +685,7 @@ int TScanContext::tokenizeIdentifier() return keyword; case ATOMIC_UINT: - if (parseContext.profile == EEsProfile && parseContext.version >= 310 || + if ((parseContext.profile == EEsProfile && parseContext.version >= 310) || parseContext.extensionsTurnedOn(1, &E_GL_ARB_shader_atomic_counters)) return keyword; return es30ReservedFromGLSL(420); diff --git a/renderdoc/3rdparty/glslang/glslang/MachineIndependent/Scan.h b/renderdoc/3rdparty/glslang/glslang/MachineIndependent/Scan.h index 91aa604b8..37b50e11b 100644 --- a/renderdoc/3rdparty/glslang/glslang/MachineIndependent/Scan.h +++ b/renderdoc/3rdparty/glslang/glslang/MachineIndependent/Scan.h @@ -106,7 +106,7 @@ public: } --ch; } - loc[currentSource].column = currentChar - ch; + loc[currentSource].column = (int)(currentChar - ch); } } else { do { @@ -139,7 +139,7 @@ protected: void advance() { ++currentChar; - if (currentChar >= static_cast(lengths[currentSource])) { + if (currentChar >= static_cast(lengths[currentSource])) { ++currentSource; if (currentSource < numSources) { loc[currentSource].string = loc[currentSource - 1].string + 1; diff --git a/renderdoc/3rdparty/glslang/glslang/MachineIndependent/Versions.cpp b/renderdoc/3rdparty/glslang/glslang/MachineIndependent/Versions.cpp index 19ec57517..24184f602 100644 --- a/renderdoc/3rdparty/glslang/glslang/MachineIndependent/Versions.cpp +++ b/renderdoc/3rdparty/glslang/glslang/MachineIndependent/Versions.cpp @@ -457,6 +457,8 @@ bool TParseContext::extensionsTurnedOn(int numExtensions, const char* const exte case EBhRequire: case EBhWarn: return true; + default: + break; } } diff --git a/renderdoc/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpAtom.cpp b/renderdoc/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpAtom.cpp index b6609da16..c43f8a268 100644 --- a/renderdoc/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpAtom.cpp +++ b/renderdoc/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpAtom.cpp @@ -186,7 +186,7 @@ void TPpContext::InitAtomTable() } // Add multiple character scanner tokens : - for (int ii = 0; ii < sizeof(tokens)/sizeof(tokens[0]); ii++) + for (size_t ii = 0; ii < sizeof(tokens)/sizeof(tokens[0]); ii++) AddAtomFixed(tokens[ii].str, tokens[ii].val); nextAtom = CPP_FIRST_USER_TOKEN_SY; diff --git a/renderdoc/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpContext.h b/renderdoc/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpContext.h index 2fc5369d8..b0086ff34 100644 --- a/renderdoc/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpContext.h +++ b/renderdoc/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpContext.h @@ -86,7 +86,7 @@ namespace glslang { class TPpToken { public: - TPpToken() : token(0), ival(0), space(false), dval(0.0), atom(0) + TPpToken() : token(0), space(false), ival(0), dval(0.0), atom(0) { loc.init(); name[0] = 0; diff --git a/renderdoc/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp b/renderdoc/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp index 0bf245c66..42560bf10 100644 --- a/renderdoc/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp +++ b/renderdoc/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp @@ -446,7 +446,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) const unsigned remainderMaxInt = 0xFFFFFFFFu - 10 * oneTenthMaxInt; for (int i = 0; i < numericLen; i++) { ch = ppToken->name[i] - '0'; - if ((ival > oneTenthMaxInt) || (ival == oneTenthMaxInt && ch > remainderMaxInt)) { + if ((ival > oneTenthMaxInt) || (ival == oneTenthMaxInt && (unsigned)ch > remainderMaxInt)) { pp->parseContext.error(ppToken->loc, "numeric literal too big", "", ""); ival = 0xFFFFFFFFu; break; diff --git a/renderdoc/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpSymbols.cpp b/renderdoc/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpSymbols.cpp index d83f77f8b..c2ab7c0a1 100644 --- a/renderdoc/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpSymbols.cpp +++ b/renderdoc/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpSymbols.cpp @@ -100,7 +100,7 @@ TPpContext::Symbol* TPpContext::NewSymbol(int atom) { Symbol* lSymb; char* pch; - int ii; + size_t ii; lSymb = (Symbol *) mem_Alloc(pool, sizeof(Symbol)); lSymb->atom = atom;