glslang: Fix over 100 warnings from MSVC warning level 4.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31202 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich
2015-05-15 17:30:55 +00:00
parent 2aa7f3a671
commit 93dfbe1309
35 changed files with 178 additions and 168 deletions

View File

@@ -99,7 +99,7 @@ protected:
spv::Id createUnaryOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, spv::Id operand, bool isFloat);
spv::Id createConversion(glslang::TOperator op, spv::Decoration precision, spv::Id destTypeId, spv::Id operand);
spv::Id makeSmearedConstant(spv::Id constant, int vectorSize);
spv::Id createMiscOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, std::vector<spv::Id>& operands, bool isUnsigned);
spv::Id createMiscOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, std::vector<spv::Id>& operands);
spv::Id createNoArgOperation(glslang::TOperator op);
spv::Id getSymbolId(const glslang::TIntermSymbol* node);
void addDecoration(spv::Id id, spv::Decoration dec);
@@ -1029,11 +1029,8 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
result = createUnaryOperation(node->getOp(), precision, convertGlslangToSpvType(node->getType()), operands.front(), node->getType().getBasicType() == glslang::EbtFloat || node->getType().getBasicType() == glslang::EbtDouble);
break;
default:
{
const glslang::TType& type = glslangOperands.front()->getAsTyped()->getType();
result = createMiscOperation(node->getOp(), precision, convertGlslangToSpvType(node->getType()), operands, type.getBasicType() == glslang::EbtUint);
break;
}
result = createMiscOperation(node->getOp(), precision, convertGlslangToSpvType(node->getType()), operands);
break;
}
if (noReturnValue)
@@ -1271,7 +1268,7 @@ spv::Id TGlslangToSpvTraverser::getSampledType(const glslang::TSampler& sampler)
// Do full recursive conversion of an arbitrary glslang type to a SPIR-V Id.
spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& type)
{
spv::Id spvType;
spv::Id spvType = 0;
switch (type.getBasicType()) {
case glslang::EbtVoid:
@@ -2142,8 +2139,8 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv:
spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Decoration precision, spv::Id destType, spv::Id operand)
{
spv::Op convOp = spv::OpNop;
spv::Id zero;
spv::Id one;
spv::Id zero = 0;
spv::Id one = 0;
int vectorSize = builder.isVectorType(destType) ? builder.getNumTypeComponents(destType) : 0;
@@ -2246,7 +2243,7 @@ spv::Id TGlslangToSpvTraverser::makeSmearedConstant(spv::Id constant, int vector
return builder.makeCompositeConstant(vectorTypeId, components);
}
spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, std::vector<spv::Id>& operands, bool isUnsigned)
spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, std::vector<spv::Id>& operands)
{
spv::Op opCode = spv::OpNop;
int libCall = -1;
@@ -2502,7 +2499,7 @@ spv::Id TGlslangToSpvTraverser::createSpvConstant(const glslang::TType& glslangT
} else {
// we have a non-aggregate (scalar) constant
bool zero = nextConst >= consts.size();
spv::Id scalar;
spv::Id scalar = 0;
switch (glslangType.getBasicType()) {
case glslang::EbtInt:
scalar = builder.makeIntConstant(zero ? 0 : consts[nextConst].getIConst());

View File

@@ -79,9 +79,9 @@ namespace spv {
class spirvbin_t : public spirvbin_base_t
{
public:
spirvbin_t(int verbose = 0) { }
spirvbin_t(int /*verbose = 0*/) { }
void remap(std::vector<unsigned int>& spv, unsigned int opts = 0)
void remap(std::vector<unsigned int>& /*spv*/, unsigned int /*opts = 0*/)
{
printf("Tool not compiled for C++11, which is required for SPIR-V remapping.\n");
}

View File

@@ -117,7 +117,7 @@ Id Builder::makePointer(StorageClass storageClass, Id pointee)
Instruction* type;
for (int t = 0; t < (int)groupedTypes[OpTypePointer].size(); ++t) {
type = groupedTypes[OpTypePointer][t];
if (type->getImmediateOperand(0) == storageClass &&
if (type->getImmediateOperand(0) == (unsigned)storageClass &&
type->getIdOperand(1) == pointee)
return type->getResultId();
}
@@ -139,8 +139,8 @@ Id Builder::makeIntegerType(int width, bool hasSign)
Instruction* type;
for (int t = 0; t < (int)groupedTypes[OpTypeInt].size(); ++t) {
type = groupedTypes[OpTypeInt][t];
if (type->getImmediateOperand(0) == width &&
type->getImmediateOperand(1) == (hasSign ? 1 : 0))
if (type->getImmediateOperand(0) == (unsigned)width &&
type->getImmediateOperand(1) == (hasSign ? 1u : 0u))
return type->getResultId();
}
@@ -161,7 +161,7 @@ Id Builder::makeFloatType(int width)
Instruction* type;
for (int t = 0; t < (int)groupedTypes[OpTypeFloat].size(); ++t) {
type = groupedTypes[OpTypeFloat][t];
if (type->getImmediateOperand(0) == width)
if (type->getImmediateOperand(0) == (unsigned)width)
return type->getResultId();
}
@@ -196,7 +196,7 @@ Id Builder::makeVectorType(Id component, int size)
for (int t = 0; t < (int)groupedTypes[OpTypeVector].size(); ++t) {
type = groupedTypes[OpTypeVector][t];
if (type->getIdOperand(0) == component &&
type->getImmediateOperand(1) == size)
type->getImmediateOperand(1) == (unsigned)size)
return type->getResultId();
}
@@ -222,7 +222,7 @@ Id Builder::makeMatrixType(Id component, int cols, int rows)
for (int t = 0; t < (int)groupedTypes[OpTypeMatrix].size(); ++t) {
type = groupedTypes[OpTypeMatrix][t];
if (type->getIdOperand(0) == column &&
type->getImmediateOperand(1) == cols)
type->getImmediateOperand(1) == (unsigned)cols)
return type->getResultId();
}
@@ -268,7 +268,7 @@ Id Builder::makeFunctionType(Id returnType, std::vector<Id>& paramTypes)
Instruction* type;
for (int t = 0; t < (int)groupedTypes[OpTypeFunction].size(); ++t) {
type = groupedTypes[OpTypeFunction][t];
if (type->getIdOperand(0) != returnType || paramTypes.size() != type->getNumOperands() - 1)
if (type->getIdOperand(0) != returnType || (int)paramTypes.size() != type->getNumOperands() - 1)
continue;
bool mismatch = false;
for (int p = 0; p < (int)paramTypes.size(); ++p) {
@@ -547,13 +547,13 @@ Id Builder::makeDoubleConstant(double d)
Id Builder::findCompositeConstant(Op typeClass, std::vector<Id>& comps) const
{
Instruction* constant;
Instruction* constant = 0;
bool found = false;
for (int i = 0; i < (int)groupedConstants[typeClass].size(); ++i) {
constant = groupedConstants[typeClass][i];
// same shape?
if (constant->getNumOperands() != comps.size())
if (constant->getNumOperands() != (int)comps.size())
continue;
// same contents?
@@ -1049,7 +1049,7 @@ void Builder::promoteScalar(Decoration precision, Id& left, Id& right)
}
// Comments in header
Id Builder::smearScalar(Decoration precision, Id scalar, Id vectorType)
Id Builder::smearScalar(Decoration /*precision*/, Id scalar, Id vectorType)
{
assert(getNumComponents(scalar) == 1);
@@ -1066,7 +1066,7 @@ Id Builder::smearScalar(Decoration precision, Id scalar, Id vectorType)
}
// Comments in header
Id Builder::createBuiltinCall(Decoration precision, Id resultType, Id builtins, int entryPoint, std::vector<Id>& args)
Id Builder::createBuiltinCall(Decoration /*precision*/, Id resultType, Id builtins, int entryPoint, std::vector<Id>& args)
{
Instruction* inst = new Instruction(getUniqueId(), resultType, OpExtInst);
inst->addIdOperand(builtins);
@@ -1259,8 +1259,6 @@ Id Builder::createTextureQueryCall(Op opCode, const TextureParameters& parameter
// Comments in header
Id Builder::createCompare(Decoration precision, Id value1, Id value2, bool equal)
{
Instruction* compare = 0;
spv::Op binOp = spv::OpNop;
Id boolType = makeBoolType();
Id valueType = getTypeId(value1);
@@ -1461,7 +1459,7 @@ Id Builder::createCompositeConstruct(Id typeId, std::vector<Id>& constituents)
// Vector or scalar constructor
Id Builder::createConstructor(Decoration precision, const std::vector<Id>& sources, Id resultTypeId)
{
Id result;
Id result = 0;
unsigned int numTargetComponents = getNumTypeComponents(resultTypeId);
unsigned int targetComponent = 0;
@@ -1701,7 +1699,7 @@ void Builder::nextSwitchSegment(std::vector<Block*>& segmentBlock, int nextSegme
}
// Comments in header
void Builder::endSwitch(std::vector<Block*>& segmentBlock)
void Builder::endSwitch(std::vector<Block*>& /*segmentBlock*/)
{
// Close out previous segment by jumping, if necessary, to next segment
if (! buildPoint->isTerminated())
@@ -1840,7 +1838,7 @@ void Builder::accessChainStore(Id rvalue)
}
// Comments in header
Id Builder::accessChainLoad(Decoration precision)
Id Builder::accessChainLoad(Decoration /*precision*/)
{
Id id;
@@ -1991,7 +1989,7 @@ void Builder::simplifyAccessChainSwizzle()
// Utility method for creating a new block and setting the insert point to
// be in it. This is useful for flow-control operations that need a "dummy"
// block proceeding them (e.g. instructions after a discard, etc).
void Builder::createAndSetNoPredecessorBlock(const char* name)
void Builder::createAndSetNoPredecessorBlock(const char* /*name*/)
{
Block* block = new Block(getUniqueId(), buildPoint->getParent());
block->setUnreachable();

View File

@@ -101,7 +101,7 @@ public:
Id makeMatrixType(Id component, int cols, int rows);
Id makeArrayType(Id element, unsigned size);
Id makeFunctionType(Id returnType, std::vector<Id>& paramTypes);
enum samplerContent {
enum samplerContent : unsigned {
samplerContentTexture,
samplerContentImage,
samplerContentTextureFilter
@@ -250,7 +250,7 @@ public:
// If the value passed in is an instruction and the precision is not EMpNone,
// it gets tagged with the requested precision.
void setPrecision(Id value, Decoration precision)
void setPrecision(Id /* value */, Decoration /* precision */)
{
// TODO
}
@@ -318,6 +318,9 @@ public:
void makeEndIf();
private:
If(const If&);
If& operator=(If&);
Builder& builder;
Id condition;
Function* function;

View File

@@ -70,6 +70,9 @@ public:
void processInstructions();
protected:
SpirvStream(SpirvStream&);
SpirvStream& operator=(SpirvStream&);
Op getOpCode(int id) const { return idInstruction[id] ? (Op)(stream[idInstruction[id]] & OpCodeMask) : OpNop; }
// Output methods
@@ -278,7 +281,7 @@ void SpirvStream::disassembleString()
out << "\"";
}
void SpirvStream::disassembleInstruction(Id resultId, Id typeId, Op opCode, int numOperands)
void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode, int numOperands)
{
// Process the opcode

View File

@@ -210,6 +210,7 @@ public:
protected:
Block(const Block&);
Block& operator=(Block&);
// To enforce keeping parent and ownership in sync:
friend Function;
@@ -244,7 +245,7 @@ public:
Id getParamId(int p) { return parameterInstructions[p]->getResultId(); }
void addBlock(Block* block) { blocks.push_back(block); }
void popBlock(Block* block) { assert(blocks.back() == block); blocks.pop_back(); }
void popBlock(Block*) { blocks.pop_back(); }
Module& getParent() const { return parent; }
Block* getEntryBlock() const { return blocks.front(); }
@@ -269,6 +270,8 @@ public:
protected:
Function(const Function&);
Function& operator=(Function&);
Module& parent;
Instruction functionInstruction;
std::vector<Instruction*> parameterInstructions;