Merge pull request #175 from rdb/master

Fix compilation issues with MSVC 2010
This commit is contained in:
John Kessenich 2016-02-27 21:29:14 -07:00
commit 52d08596ec
8 changed files with 28 additions and 28 deletions

View File

@ -690,8 +690,8 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(const glslang::TIntermediate* gls
void TGlslangToSpvTraverser::dumpSpv(std::vector<unsigned int>& out) void TGlslangToSpvTraverser::dumpSpv(std::vector<unsigned int>& out)
{ {
// finish off the entry-point SPV instruction by adding the Input/Output <id> // finish off the entry-point SPV instruction by adding the Input/Output <id>
for (auto it : iOSet) for (auto it = iOSet.cbegin(); it != iOSet.cend(); ++it)
entryPoint->addIdOperand(it); entryPoint->addIdOperand(*it);
builder.dump(out); builder.dump(out);
} }

View File

@ -91,8 +91,9 @@ public:
delayed_[continueBlock] = true; delayed_[continueBlock] = true;
} }
} }
for (const auto succ : block->getSuccessors()) const auto successors = block->getSuccessors();
visit(succ); for (auto it = successors.cbegin(); it != successors.cend(); ++it)
visit(*it);
if (continueBlock) { if (continueBlock) {
delayed_[continueBlock] = false; delayed_[continueBlock] = false;
visit(continueBlock); visit(continueBlock);

View File

@ -1145,8 +1145,8 @@ void Builder::createNoResultOp(Op opCode, Id operand)
void Builder::createNoResultOp(Op opCode, const std::vector<Id>& operands) void Builder::createNoResultOp(Op opCode, const std::vector<Id>& operands)
{ {
Instruction* op = new Instruction(opCode); Instruction* op = new Instruction(opCode);
for (auto operand : operands) for (auto it = operands.cbegin(); it != operands.cend(); ++it)
op->addIdOperand(operand); op->addIdOperand(*it);
buildPoint->addInstruction(std::unique_ptr<Instruction>(op)); buildPoint->addInstruction(std::unique_ptr<Instruction>(op));
} }
@ -1201,8 +1201,8 @@ Id Builder::createTriOp(Op opCode, Id typeId, Id op1, Id op2, Id op3)
Id Builder::createOp(Op opCode, Id typeId, const std::vector<Id>& operands) Id Builder::createOp(Op opCode, Id typeId, const std::vector<Id>& operands)
{ {
Instruction* op = new Instruction(getUniqueId(), typeId, opCode); Instruction* op = new Instruction(getUniqueId(), typeId, opCode);
for (auto operand : operands) for (auto it = operands.cbegin(); it != operands.cend(); ++it)
op->addIdOperand(operand); op->addIdOperand(*it);
buildPoint->addInstruction(std::unique_ptr<Instruction>(op)); buildPoint->addInstruction(std::unique_ptr<Instruction>(op));
return op->getResultId(); return op->getResultId();
@ -2110,9 +2110,9 @@ Id Builder::accessChainGetInferredType()
type = getContainedTypeId(type); type = getContainedTypeId(type);
// dereference each index // dereference each index
for (auto deref : accessChain.indexChain) { for (auto it = accessChain.indexChain.cbegin(); it != accessChain.indexChain.cend(); ++it) {
if (isStructType(type)) if (isStructType(type))
type = getContainedTypeId(type, getConstantScalar(deref)); type = getContainedTypeId(type, getConstantScalar(*it));
else else
type = getContainedTypeId(type); type = getContainedTypeId(type);
} }
@ -2140,9 +2140,9 @@ void Builder::dump(std::vector<unsigned int>& out) const
out.push_back(0); out.push_back(0);
// Capabilities // Capabilities
for (auto cap : capabilities) { for (auto it = capabilities.cbegin(); it != capabilities.cend(); ++it) {
Instruction capInst(0, 0, OpCapability); Instruction capInst(0, 0, OpCapability);
capInst.addImmediateOperand(cap); capInst.addImmediateOperand(*it);
capInst.dump(out); capInst.dump(out);
} }

View File

@ -689,7 +689,8 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
// //
glslang::TProgram& program = *new glslang::TProgram; glslang::TProgram& program = *new glslang::TProgram;
for (auto compUnit : compUnits) { for (auto it = compUnits.cbegin(); it != compUnits.cend(); ++it) {
const auto &compUnit = *it;
glslang::TShader* shader = new glslang::TShader(compUnit.stage); glslang::TShader* shader = new glslang::TShader(compUnit.stage);
shader->setStrings(compUnit.text, 1); shader->setStrings(compUnit.text, 1);
shaders.push_back(shader); shaders.push_back(shader);
@ -821,8 +822,8 @@ void CompileAndLinkShaderFiles()
glslang::OS_DumpMemoryCounters(); glslang::OS_DumpMemoryCounters();
} }
for (auto c : compUnits) for (auto it = compUnits.begin(); it != compUnits.end(); ++it)
FreeFileData(c.text); FreeFileData(it->text);
} }
int C_DECL main(int argc, char* argv[]) int C_DECL main(int argc, char* argv[])

View File

@ -120,7 +120,8 @@ namespace {
if (fp.fail()) if (fp.fail())
errHandler(std::string("error opening file for write: ") + outFile); errHandler(std::string("error opening file for write: ") + outFile);
for (auto word : spv) { for (auto it = spv.cbegin(); it != spv.cend(); ++it) {
SpvWord word = *it;
fp.write((char *)&word, sizeof(word)); fp.write((char *)&word, sizeof(word));
if (fp.fail()) if (fp.fail())
errHandler(std::string("error writing file: ") + outFile); errHandler(std::string("error writing file: ") + outFile);
@ -157,7 +158,8 @@ namespace {
void execute(const std::vector<std::string>& inputFile, const std::string& outputDir, void execute(const std::vector<std::string>& inputFile, const std::string& outputDir,
int opts, int verbosity) int opts, int verbosity)
{ {
for (const auto& filename : inputFile) { for (auto it = inputFile.cbegin(); it != inputFile.cend(); ++it) {
const std::string &filename = *it;
std::vector<SpvWord> spv; std::vector<SpvWord> spv;
read(spv, filename, verbosity); read(spv, filename, verbosity);
spv::spirvbin_t(verbosity).remap(spv, opts); spv::spirvbin_t(verbosity).remap(spv, opts);

View File

@ -206,7 +206,7 @@ struct TSourceLoc {
{ {
if (name != nullptr) if (name != nullptr)
return quoteStringName ? ("\"" + std::string(name) + "\"") : name; return quoteStringName ? ("\"" + std::string(name) + "\"") : name;
return std::to_string(string); return std::to_string((long long)string);
} }
const char* name; // descriptive name for this string const char* name; // descriptive name for this string
int string; int string;

View File

@ -757,13 +757,9 @@ void TIntermediate::output(TInfoSink& infoSink, bool tree)
case EShLangCompute: case EShLangCompute:
infoSink.debug << "local_size = (" << localSize[0] << ", " << localSize[1] << ", " << localSize[2] << ")\n"; infoSink.debug << "local_size = (" << localSize[0] << ", " << localSize[1] << ", " << localSize[2] << ")\n";
{ {
bool dumpSpecIds = false; if (localSizeSpecId[0] != TQualifier::layoutNotSet ||
for (auto c : localSizeSpecId) { localSizeSpecId[1] != TQualifier::layoutNotSet ||
if (c != TQualifier::layoutNotSet) localSizeSpecId[2] != TQualifier::layoutNotSet) {
dumpSpecIds = true;
}
if (dumpSpecIds) {
infoSink.debug << "local_size ids = (" << infoSink.debug << "local_size ids = (" <<
localSizeSpecId[0] << ", " << localSizeSpecId[0] << ", " <<
localSizeSpecId[1] << ", " << localSizeSpecId[1] << ", " <<

View File

@ -611,9 +611,9 @@ int TPpContext::CPPinclude(TPpToken* ppToken)
if (token != '\n' && token != EndOfInput) { if (token != '\n' && token != EndOfInput) {
parseContext.ppError(ppToken->loc, "extra content after file designation", "#include", ""); parseContext.ppError(ppToken->loc, "extra content after file designation", "#include", "");
} else { } else {
std::string sourceName; auto include = includer.include(filename.c_str());
std::string replacement; std::string sourceName = include.first;
std::tie(sourceName, replacement) = includer.include(filename.c_str()); std::string replacement = include.second;
if (!sourceName.empty()) { if (!sourceName.empty()) {
if (!replacement.empty()) { if (!replacement.empty()) {
const bool forNextLine = parseContext.lineDirectiveShouldSetNextLine(); const bool forNextLine = parseContext.lineDirectiveShouldSetNextLine();