glslang portability: Resolve OSX errors, some other OS warnings.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31468 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2015-06-10 22:05:48 +00:00
parent 3ef22f2139
commit 79eaa91e6f
7 changed files with 29 additions and 28 deletions

View File

@ -72,7 +72,7 @@ public:
spirvbin_t(int verbose = 0); // construct
// remap an existing binary in memory
void remap(std::vector<std::uint32_t>& spv, std::uint32_t opts = Options::DO_EVERYTHING);
void remap(std::vector<std::uint32_t>& spv, std::uint32_t opts = DO_EVERYTHING);
// Type for error/log handler functions
typedef std::function<void(const std::string&)> errorfn_t;
@ -119,7 +119,7 @@ normal build process.
REMAPPING AND OPTIMIZATION OPTIONS
--------------------------------------------------------------------------------
API:
These are bits defined under spv::spirvbin_t::Options::, and can be
These are bits defined under spv::spirvbin_t::, and can be
bitwise or-ed together as desired.
MAP_TYPES = canonicalize type IDs

View File

@ -573,7 +573,7 @@ bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::T
// so short circuit the access-chain stuff with a swizzle.
std::vector<unsigned> swizzle;
swizzle.push_back(node->getRight()->getAsConstantUnion()->getConstArray()[0].getIConst());
builder.accessChainPushSwizzle(swizzle, node->getLeft()->getVectorSize());
builder.accessChainPushSwizzle(swizzle);
} else {
// normal case for indexing array or structure or block
builder.accessChainPush(builder.makeIntConstant(index), convertGlslangToSpvType(node->getType()));
@ -615,7 +615,7 @@ bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::T
std::vector<unsigned> swizzle;
for (int i = 0; i < (int)swizzleSequence.size(); ++i)
swizzle.push_back(swizzleSequence[i]->getAsConstantUnion()->getConstArray()[0].getIConst());
builder.accessChainPushSwizzle(swizzle, node->getLeft()->getVectorSize());
builder.accessChainPushSwizzle(swizzle);
}
return false;
default:

View File

@ -299,7 +299,7 @@ namespace spv {
void spirvbin_t::stripDebug()
{
if ((options & Options::STRIP) == 0)
if ((options & STRIP) == 0)
return;
// build local Id and name maps
@ -337,7 +337,7 @@ namespace spv {
process(
[&](spv::Op opCode, unsigned start) {
// remember opcodes we want to strip later
if ((options & Options::STRIP) && isStripOp(opCode))
if ((options & STRIP) && isStripOp(opCode))
stripInst(start);
if (opCode == spv::Op::OpName) {

View File

@ -38,6 +38,7 @@
#include <string>
#include <vector>
#include <stdlib.h>
namespace spv {
@ -112,7 +113,7 @@ public:
spirvbin_t(int verbose = 0) : entryPoint(spv::NoResult), largestNewId(0), verbose(verbose) { }
// remap on an existing binary in memory
void remap(std::vector<std::uint32_t>& spv, std::uint32_t opts = Options::DO_EVERYTHING);
void remap(std::vector<std::uint32_t>& spv, std::uint32_t opts = DO_EVERYTHING);
// Type for error/log handler functions
typedef std::function<void(const std::string&)> errorfn_t;
@ -131,7 +132,7 @@ private:
typedef std::unordered_map<spv::Id, spv::Id> idmap_t;
typedef std::unordered_set<spv::Id> idset_t;
void remap(std::uint32_t opts = Options::DO_EVERYTHING);
void remap(std::uint32_t opts = DO_EVERYTHING);
// Map of names to IDs
typedef std::unordered_map<std::string, spv::Id> namemap_t;

View File

@ -301,7 +301,7 @@ Id Builder::makeSampler(Id sampledType, Dim dim, samplerContent content, bool ar
type = groupedTypes[OpTypeSampler][t];
if (type->getIdOperand(0) == sampledType &&
type->getImmediateOperand(1) == (unsigned int)dim &&
type->getImmediateOperand(2) == content &&
type->getImmediateOperand(2) == (unsigned int)content &&
type->getImmediateOperand(3) == (arrayed ? 1u : 0u) &&
type->getImmediateOperand(4) == ( shadow ? 1u : 0u) &&
type->getImmediateOperand(5) == ( ms ? 1u : 0u))
@ -1842,7 +1842,7 @@ void Builder::clearAccessChain()
}
// Comments in header
void Builder::accessChainPushSwizzle(std::vector<unsigned>& swizzle, int width)
void Builder::accessChainPushSwizzle(std::vector<unsigned>& swizzle)
{
// if needed, propagate the swizzle for the current access chain
if (accessChain.swizzle.size()) {

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 : unsigned {
enum samplerContent {
samplerContentTexture,
samplerContentImage,
samplerContentTextureFilter
@ -470,7 +470,7 @@ public:
}
// push new swizzle onto the end of any existing swizzle, merging into a single swizzle
void accessChainPushSwizzle(std::vector<unsigned>& swizzle, int width);
void accessChainPushSwizzle(std::vector<unsigned>& swizzle);
// push a variable component selection onto the access chain; supporting only one, so unsided
void accessChainPushComponent(Id component) { accessChain.component = component; }

View File

@ -181,7 +181,7 @@ namespace {
usage(argv[0]);
verbosity = 0;
options = spv::spirvbin_t::Options::NONE;
options = spv::spirvbin_t::NONE;
// Parse command line.
// boost::program_options would be quite a bit nicer, but we don't want to
@ -228,14 +228,14 @@ namespace {
inputFile.push_back(argv[a]);
} else if (arg == "--do-everything") {
++a;
options = options | spv::spirvbin_t::Options::DO_EVERYTHING;
options = options | spv::spirvbin_t::DO_EVERYTHING;
} else if (arg == "--strip-all" || arg == "-s") {
++a;
options = options | spv::spirvbin_t::Options::STRIP;
options = options | spv::spirvbin_t::STRIP;
} else if (arg == "--strip") {
++a;
if (strncmp(argv[a], "all", 3) == 0) {
options = options | spv::spirvbin_t::Options::STRIP;
options = options | spv::spirvbin_t::STRIP;
++a;
}
} else if (arg == "--dce") {
@ -243,16 +243,16 @@ namespace {
++a;
for (const char* c = argv[a]; *c; ++c) {
if (strncmp(c, "all", 3) == 0) {
options = (options | spv::spirvbin_t::Options::DCE_ALL);
options = (options | spv::spirvbin_t::DCE_ALL);
c += 3;
} else if (strncmp(c, "*", 1) == 0) {
options = (options | spv::spirvbin_t::Options::DCE_ALL);
options = (options | spv::spirvbin_t::DCE_ALL);
c += 1;
} else if (strncmp(c, "funcs", 5) == 0) {
options = (options | spv::spirvbin_t::Options::DCE_FUNCS);
options = (options | spv::spirvbin_t::DCE_FUNCS);
c += 5;
} else if (strncmp(c, "types", 5) == 0) {
options = (options | spv::spirvbin_t::Options::DCE_TYPES);
options = (options | spv::spirvbin_t::DCE_TYPES);
c += 5;
}
}
@ -262,19 +262,19 @@ namespace {
++a;
for (const char* c = argv[a]; *c; ++c) {
if (strncmp(c, "all", 3) == 0) {
options = (options | spv::spirvbin_t::Options::MAP_ALL);
options = (options | spv::spirvbin_t::MAP_ALL);
c += 3;
} else if (strncmp(c, "*", 1) == 0) {
options = (options | spv::spirvbin_t::Options::MAP_ALL);
options = (options | spv::spirvbin_t::MAP_ALL);
c += 1;
} else if (strncmp(c, "types", 5) == 0) {
options = (options | spv::spirvbin_t::Options::MAP_TYPES);
options = (options | spv::spirvbin_t::MAP_TYPES);
c += 5;
} else if (strncmp(c, "names", 5) == 0) {
options = (options | spv::spirvbin_t::Options::MAP_NAMES);
options = (options | spv::spirvbin_t::MAP_NAMES);
c += 5;
} else if (strncmp(c, "funcs", 5) == 0) {
options = (options | spv::spirvbin_t::Options::MAP_FUNCS);
options = (options | spv::spirvbin_t::MAP_FUNCS);
c += 5;
}
}
@ -283,13 +283,13 @@ namespace {
++a;
for (const char* c = argv[a]; *c; ++c) {
if (strncmp(c, "all", 3) == 0) {
options = (options | spv::spirvbin_t::Options::OPT_ALL);
options = (options | spv::spirvbin_t::OPT_ALL);
c += 3;
} else if (strncmp(c, "*", 1) == 0) {
options = (options | spv::spirvbin_t::Options::OPT_ALL);
options = (options | spv::spirvbin_t::OPT_ALL);
c += 1;
} else if (strncmp(c, "loadstore", 9) == 0) {
options = (options | spv::spirvbin_t::Options::OPT_LOADSTORE);
options = (options | spv::spirvbin_t::OPT_LOADSTORE);
c += 9;
}
}