Update glslang to latest code.

* From renderdoc branch on https://github.com/baldurk/glslang
This commit is contained in:
baldurk
2015-07-12 12:08:00 +02:00
parent 5f08324d71
commit 0f54cc550c
14 changed files with 37 additions and 39 deletions
+5 -5
View File
@@ -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<spv::Block*> 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)
+5 -9
View File
@@ -51,10 +51,6 @@
#include <cstdio>
#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<Id>& 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<unsigned>& cha
// Comments in header
Id Builder::createLvalueSwizzle(Id typeId, Id target, Id source, std::vector<unsigned>& 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<Id>& 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);
}
-2
View File
@@ -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 <set>
+11 -9
View File
@@ -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:
@@ -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());
@@ -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();"
);
@@ -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;
@@ -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);
@@ -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<int>(lengths[currentSource])) {
if (currentChar >= static_cast<size_t>(lengths[currentSource])) {
++currentSource;
if (currentSource < numSources) {
loc[currentSource].string = loc[currentSource - 1].string + 1;
@@ -457,6 +457,8 @@ bool TParseContext::extensionsTurnedOn(int numExtensions, const char* const exte
case EBhRequire:
case EBhWarn:
return true;
default:
break;
}
}
@@ -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;
@@ -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;
@@ -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;
@@ -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;