spv::Id createUnaryOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, spv::Id operand, bool isFloat);\r
spv::Id createConversion(glslang::TOperator op, spv::Decoration precision, spv::Id destTypeId, spv::Id operand);\r
spv::Id makeSmearedConstant(spv::Id constant, int vectorSize);\r
- spv::Id createMiscOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, std::vector<spv::Id>& operands, bool isUnsigned);\r
+ spv::Id createMiscOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, std::vector<spv::Id>& operands);\r
spv::Id createNoArgOperation(glslang::TOperator op);\r
spv::Id getSymbolId(const glslang::TIntermSymbol* node);\r
void addDecoration(spv::Id id, spv::Decoration dec);\r
result = createUnaryOperation(node->getOp(), precision, convertGlslangToSpvType(node->getType()), operands.front(), node->getType().getBasicType() == glslang::EbtFloat || node->getType().getBasicType() == glslang::EbtDouble);\r
break;\r
default:\r
- {\r
- const glslang::TType& type = glslangOperands.front()->getAsTyped()->getType();\r
- result = createMiscOperation(node->getOp(), precision, convertGlslangToSpvType(node->getType()), operands, type.getBasicType() == glslang::EbtUint);\r
- break;\r
- }\r
+ result = createMiscOperation(node->getOp(), precision, convertGlslangToSpvType(node->getType()), operands);\r
+ break;\r
}\r
\r
if (noReturnValue)\r
// Do full recursive conversion of an arbitrary glslang type to a SPIR-V Id.\r
spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& type)\r
{\r
- spv::Id spvType;\r
+ spv::Id spvType = 0;\r
\r
switch (type.getBasicType()) {\r
case glslang::EbtVoid:\r
spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Decoration precision, spv::Id destType, spv::Id operand)\r
{\r
spv::Op convOp = spv::OpNop;\r
- spv::Id zero;\r
- spv::Id one;\r
+ spv::Id zero = 0;\r
+ spv::Id one = 0;\r
\r
int vectorSize = builder.isVectorType(destType) ? builder.getNumTypeComponents(destType) : 0;\r
\r
return builder.makeCompositeConstant(vectorTypeId, components);\r
}\r
\r
-spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, std::vector<spv::Id>& operands, bool isUnsigned)\r
+spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, std::vector<spv::Id>& operands)\r
{\r
spv::Op opCode = spv::OpNop;\r
int libCall = -1;\r
} else {\r
// we have a non-aggregate (scalar) constant\r
bool zero = nextConst >= consts.size();\r
- spv::Id scalar;\r
+ spv::Id scalar = 0;\r
switch (glslangType.getBasicType()) {\r
case glslang::EbtInt:\r
scalar = builder.makeIntConstant(zero ? 0 : consts[nextConst].getIConst());\r
class spirvbin_t : public spirvbin_base_t\r
{\r
public:\r
- spirvbin_t(int verbose = 0) { }\r
+ spirvbin_t(int /*verbose = 0*/) { }\r
\r
- void remap(std::vector<unsigned int>& spv, unsigned int opts = 0)\r
+ void remap(std::vector<unsigned int>& /*spv*/, unsigned int /*opts = 0*/)\r
{\r
printf("Tool not compiled for C++11, which is required for SPIR-V remapping.\n");\r
}\r
Instruction* type;\r
for (int t = 0; t < (int)groupedTypes[OpTypePointer].size(); ++t) {\r
type = groupedTypes[OpTypePointer][t];\r
- if (type->getImmediateOperand(0) == storageClass &&\r
+ if (type->getImmediateOperand(0) == (unsigned)storageClass &&\r
type->getIdOperand(1) == pointee)\r
return type->getResultId();\r
}\r
Instruction* type;\r
for (int t = 0; t < (int)groupedTypes[OpTypeInt].size(); ++t) {\r
type = groupedTypes[OpTypeInt][t];\r
- if (type->getImmediateOperand(0) == width &&\r
- type->getImmediateOperand(1) == (hasSign ? 1 : 0))\r
+ if (type->getImmediateOperand(0) == (unsigned)width &&\r
+ type->getImmediateOperand(1) == (hasSign ? 1u : 0u))\r
return type->getResultId();\r
}\r
\r
Instruction* type;\r
for (int t = 0; t < (int)groupedTypes[OpTypeFloat].size(); ++t) {\r
type = groupedTypes[OpTypeFloat][t];\r
- if (type->getImmediateOperand(0) == width)\r
+ if (type->getImmediateOperand(0) == (unsigned)width)\r
return type->getResultId();\r
}\r
\r
for (int t = 0; t < (int)groupedTypes[OpTypeVector].size(); ++t) {\r
type = groupedTypes[OpTypeVector][t];\r
if (type->getIdOperand(0) == component &&\r
- type->getImmediateOperand(1) == size)\r
+ type->getImmediateOperand(1) == (unsigned)size)\r
return type->getResultId();\r
}\r
\r
for (int t = 0; t < (int)groupedTypes[OpTypeMatrix].size(); ++t) {\r
type = groupedTypes[OpTypeMatrix][t];\r
if (type->getIdOperand(0) == column &&\r
- type->getImmediateOperand(1) == cols)\r
+ type->getImmediateOperand(1) == (unsigned)cols)\r
return type->getResultId();\r
}\r
\r
Instruction* type;\r
for (int t = 0; t < (int)groupedTypes[OpTypeFunction].size(); ++t) {\r
type = groupedTypes[OpTypeFunction][t];\r
- if (type->getIdOperand(0) != returnType || paramTypes.size() != type->getNumOperands() - 1)\r
+ if (type->getIdOperand(0) != returnType || (int)paramTypes.size() != type->getNumOperands() - 1)\r
continue;\r
bool mismatch = false;\r
for (int p = 0; p < (int)paramTypes.size(); ++p) {\r
\r
Id Builder::findCompositeConstant(Op typeClass, std::vector<Id>& comps) const\r
{\r
- Instruction* constant;\r
+ Instruction* constant = 0;\r
bool found = false;\r
for (int i = 0; i < (int)groupedConstants[typeClass].size(); ++i) {\r
constant = groupedConstants[typeClass][i];\r
\r
// same shape?\r
- if (constant->getNumOperands() != comps.size())\r
+ if (constant->getNumOperands() != (int)comps.size())\r
continue;\r
\r
// same contents?\r
}\r
\r
// Comments in header\r
-Id Builder::smearScalar(Decoration precision, Id scalar, Id vectorType)\r
+Id Builder::smearScalar(Decoration /*precision*/, Id scalar, Id vectorType)\r
{\r
assert(getNumComponents(scalar) == 1);\r
\r
}\r
\r
// Comments in header\r
-Id Builder::createBuiltinCall(Decoration precision, Id resultType, Id builtins, int entryPoint, std::vector<Id>& args)\r
+Id Builder::createBuiltinCall(Decoration /*precision*/, Id resultType, Id builtins, int entryPoint, std::vector<Id>& args)\r
{\r
Instruction* inst = new Instruction(getUniqueId(), resultType, OpExtInst);\r
inst->addIdOperand(builtins);\r
// Comments in header\r
Id Builder::createCompare(Decoration precision, Id value1, Id value2, bool equal)\r
{\r
- Instruction* compare = 0;\r
- spv::Op binOp = spv::OpNop;\r
Id boolType = makeBoolType();\r
Id valueType = getTypeId(value1);\r
\r
// Vector or scalar constructor\r
Id Builder::createConstructor(Decoration precision, const std::vector<Id>& sources, Id resultTypeId)\r
{\r
- Id result;\r
+ Id result = 0;\r
unsigned int numTargetComponents = getNumTypeComponents(resultTypeId);\r
unsigned int targetComponent = 0;\r
\r
}\r
\r
// Comments in header\r
-void Builder::endSwitch(std::vector<Block*>& segmentBlock)\r
+void Builder::endSwitch(std::vector<Block*>& /*segmentBlock*/)\r
{\r
// Close out previous segment by jumping, if necessary, to next segment\r
if (! buildPoint->isTerminated())\r
}\r
\r
// Comments in header\r
-Id Builder::accessChainLoad(Decoration precision)\r
+Id Builder::accessChainLoad(Decoration /*precision*/)\r
{\r
Id id;\r
\r
// Utility method for creating a new block and setting the insert point to\r
// be in it. This is useful for flow-control operations that need a "dummy"\r
// block proceeding them (e.g. instructions after a discard, etc).\r
-void Builder::createAndSetNoPredecessorBlock(const char* name)\r
+void Builder::createAndSetNoPredecessorBlock(const char* /*name*/)\r
{\r
Block* block = new Block(getUniqueId(), buildPoint->getParent());\r
block->setUnreachable();\r
Id makeMatrixType(Id component, int cols, int rows);\r
Id makeArrayType(Id element, unsigned size);\r
Id makeFunctionType(Id returnType, std::vector<Id>& paramTypes);\r
- enum samplerContent {\r
+ enum samplerContent : unsigned {\r
samplerContentTexture,\r
samplerContentImage,\r
samplerContentTextureFilter\r
\r
// If the value passed in is an instruction and the precision is not EMpNone,\r
// it gets tagged with the requested precision.\r
- void setPrecision(Id value, Decoration precision)\r
+ void setPrecision(Id /* value */, Decoration /* precision */)\r
{\r
// TODO\r
}\r
void makeEndIf();\r
\r
private:\r
+ If(const If&);\r
+ If& operator=(If&);\r
+\r
Builder& builder;\r
Id condition;\r
Function* function;\r
void processInstructions();\r
\r
protected:\r
+ SpirvStream(SpirvStream&);\r
+ SpirvStream& operator=(SpirvStream&);\r
+\r
Op getOpCode(int id) const { return idInstruction[id] ? (Op)(stream[idInstruction[id]] & OpCodeMask) : OpNop; }\r
\r
// Output methods\r
out << "\"";\r
}\r
\r
-void SpirvStream::disassembleInstruction(Id resultId, Id typeId, Op opCode, int numOperands)\r
+void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode, int numOperands)\r
{\r
// Process the opcode\r
\r
\r
protected:\r
Block(const Block&);\r
+ Block& operator=(Block&);\r
\r
// To enforce keeping parent and ownership in sync:\r
friend Function;\r
Id getParamId(int p) { return parameterInstructions[p]->getResultId(); }\r
\r
void addBlock(Block* block) { blocks.push_back(block); }\r
- void popBlock(Block* block) { assert(blocks.back() == block); blocks.pop_back(); }\r
+ void popBlock(Block*) { blocks.pop_back(); }\r
\r
Module& getParent() const { return parent; }\r
Block* getEntryBlock() const { return blocks.front(); }\r
\r
protected:\r
Function(const Function&);\r
+ Function& operator=(Function&);\r
+\r
Module& parent;\r
Instruction functionInstruction;\r
std::vector<Instruction*> parameterInstructions;\r
printf("Error allocating memory\n");
return 0;
}
- if (fread(fdata,1,count, in)!=count) {
+ if ((int)fread(fdata,1,count, in) != count) {
printf("Error reading input file: %s\n", fileName);
return 0;
}
//
// Generate code from the given parse tree
//
-bool TGenericCompiler::compile(TIntermNode *root, int version, EProfile profile)
+bool TGenericCompiler::compile(TIntermNode* /*root*/, int /*version*/, EProfile /*profile*/)
{
haveValidObjectCode = true;
public:
TGenericLinker(EShExecutable e, int dOptions) : TLinker(e, infoSink), debugOptions(dOptions) { }
bool link(TCompilerList&, TUniformMap*) { return true; }
- void getAttributeBindings(ShBindingTable const **t) const { }
+ void getAttributeBindings(ShBindingTable const **) const { }
TInfoSink infoSink;
int debugOptions;
};
class TUniformLinkedMap : public TUniformMap {
public:
TUniformLinkedMap() { }
- virtual int getLocation(const char* name) { return 0; }
+ virtual int getLocation(const char*) { return 0; }
};
TShHandleBase* ConstructLinker(EShExecutable executable, int debugOptions)
assert(false && "Default missing");
return false;
}
-
- return false;
}
bool operator<(const TConstUnion& constant) const
assert(false && "Default missing");
return false;
}
-
- return false;
}
TConstUnion operator+(const TConstUnion& constant) const
typedef std::vector<tAllocState> tAllocStack;
// Track allocations if and only if we're using guard blocks
+#ifndef GUARD_BLOCKS
+ void* initializeAllocation(tHeader*, unsigned char* memory, size_t) {
+#else
void* initializeAllocation(tHeader* block, unsigned char* memory, size_t numBytes) {
-# ifdef GUARD_BLOCKS
new(memory) TAllocation(numBytes, memory, block->lastAllocation);
block->lastAllocation = reinterpret_cast<TAllocation*>(memory);
-# endif
+#endif
// This is optimized entirely away if GUARD_BLOCKS is not defined.
return TAllocation::offsetAllocation(memory);
TPoolAllocator& getAllocator() const { return allocator; }
protected:
- pool_allocator& operator=(const pool_allocator& rhs) { return *this; }
+ pool_allocator& operator=(const pool_allocator&) { return *this; }
TPoolAllocator& allocator;
};
TInfoSink& infoSink;
protected:
+ TCompiler& operator=(TCompiler&);
+
EShLanguage language;
bool haveValidObjectCode;
};
virtual TInfoSink& getInfoSink() { return infoSink; }
TInfoSink& infoSink;
protected:
+ TLinker& operator=(TLinker&);
EShExecutable executable;
bool haveReturnableObjectCode; // true when objectCode is acceptable to send to driver
maxDepth(0) { }
virtual ~TIntermTraverser() { }
- virtual void visitSymbol(TIntermSymbol*) { }
- virtual void visitConstantUnion(TIntermConstantUnion*) { }
- virtual bool visitBinary(TVisit visit, TIntermBinary*) { return true; }
- virtual bool visitUnary(TVisit visit, TIntermUnary*) { return true; }
- virtual bool visitSelection(TVisit visit, TIntermSelection*) { return true; }
- virtual bool visitAggregate(TVisit visit, TIntermAggregate*) { return true; }
- virtual bool visitLoop(TVisit visit, TIntermLoop*) { return true; }
- virtual bool visitBranch(TVisit visit, TIntermBranch*) { return true; }
- virtual bool visitSwitch(TVisit, TIntermSwitch* node) { return true; }
+ virtual void visitSymbol(TIntermSymbol*) { }
+ virtual void visitConstantUnion(TIntermConstantUnion*) { }
+ virtual bool visitBinary(TVisit, TIntermBinary*) { return true; }
+ virtual bool visitUnary(TVisit, TIntermUnary*) { return true; }
+ virtual bool visitSelection(TVisit, TIntermSelection*) { return true; }
+ virtual bool visitAggregate(TVisit, TIntermAggregate*) { return true; }
+ virtual bool visitLoop(TVisit, TIntermLoop*) { return true; }
+ virtual bool visitBranch(TVisit, TIntermBranch*) { return true; }
+ virtual bool visitSwitch(TVisit, TIntermSwitch*) { return true; }
int getMaxDepth() const { return maxDepth; }
const bool rightToLeft;
protected:
+ TIntermTraverser& operator=(TIntermTraverser&);
+
int depth;
int maxDepth;
// some arguments are scalars instead of matching vectors; simulate a smear
int arg0comp = std::min(comp, children[0]->getAsTyped()->getType().getVectorSize() - 1);
- int arg1comp;
+ int arg1comp = 0;
if (children.size() > 1)
arg1comp = std::min(comp, children[1]->getAsTyped()->getType().getVectorSize() - 1);
- int arg2comp;
+ int arg2comp = 0;
if (children.size() > 2)
arg2comp = std::min(comp, children[2]->getAsTyped()->getType().getVectorSize() - 1);
//
// Add all the texture lookup functions for the given type.
//
-void TBuiltIns::addSamplingFunctions(TSampler sampler, TString& typeName, int version, EProfile profile)
+void TBuiltIns::addSamplingFunctions(TSampler sampler, TString& typeName, int /*version*/, EProfile /*profile*/)
{
//
// texturing
//
// Traversal functions for terminals are straighforward....
//
-void TIntermMethod::traverse(TIntermTraverser* it)
+void TIntermMethod::traverse(TIntermTraverser*)
{
// Tree should always resolve all methods as a non-method.
}
// This is to be executed after the final root is put on top by the parsing
// process.
//
-bool TIntermediate::postProcess(TIntermNode* root, EShLanguage language)
+bool TIntermediate::postProcess(TIntermNode* root, EShLanguage /*language*/)
{
if (root == 0)
return true;
// Add a caller->callee relationship to the call graph.
// Assumes the strings are unique per signature.
//
-void TIntermediate::addToCallGraph(TInfoSink& infoSink, const TString& caller, const TString& callee)
+void TIntermediate::addToCallGraph(TInfoSink& /*infoSink*/, const TString& caller, const TString& callee)
{
// Duplicates are okay, but faster to not keep them, and they come grouped by caller,
// as long as new ones are push on the same end we check on for duplicates
}
// for ES 2.0 (version 100) limitations for almost all index operations except vertex-shader uniforms
-void TParseContext::handleIndexLimits(TSourceLoc loc, TIntermTyped* base, TIntermTyped* index)
+void TParseContext::handleIndexLimits(TSourceLoc /*loc*/, TIntermTyped* base, TIntermTyped* index)
{
if ((! limits.generalSamplerIndexing && base->getBasicType() == EbtSampler) ||
(! limits.generalUniformIndexing && base->getQualifier().isUniformOrBuffer() && language != EShLangVertex) ||
// Handle a dereference of a geometry shader input array or tessellation control output array.
// See ioArraySymbolResizeList comment in ParseHelper.h.
//
-void TParseContext::handleIoResizeArrayAccess(TSourceLoc loc, TIntermTyped* base)
+void TParseContext::handleIoResizeArrayAccess(TSourceLoc /*loc*/, TIntermTyped* base)
{
TIntermSymbol* symbolNode = base->getAsSymbolNode();
assert(symbolNode);
feature = TQualifier::getGeometryString(intermediate.getInputPrimitive());
else if (language == EShLangTessControl)
feature = "vertices";
+ else
+ feature = "unknown";
if (tailOnly) {
checkIoArrayConsistency(loc, requiredSize, feature, ioArraySymbolResizeList.back()->getWritableType(), ioArraySymbolResizeList.back()->getName());
if (type.isStruct())
return EOpConstructStruct;
- TOperator op;
+ TOperator op = EOpNull;
switch (type.getBasicType()) {
case EbtFloat:
if (type.isMatrix()) {
}
break;
default:
- op = EOpNull;
break;
}
return true;
}
- if (op == EOpConstructStruct && ! type.isArray() && type.getStruct()->size() != function.getParamCount()) {
+ if (op == EOpConstructStruct && ! type.isArray() && (int)type.getStruct()->size() != function.getParamCount()) {
error(loc, "Number of constructor parameters does not match the number of structure fields", "constructor", "");
return true;
}
dst.precision = src.precision;
// Layout qualifiers
- mergeObjectLayoutQualifiers(loc, dst, src, false);
+ mergeObjectLayoutQualifiers(dst, src, false);
// individual qualifiers
bool repeated = false;
}
}
-void TParseContext::structArrayCheck(TSourceLoc loc, TType* type)
+void TParseContext::structArrayCheck(TSourceLoc /*loc*/, TType* type)
{
const TTypeList& structure = *type->getStruct();
for (int m = 0; m < (int)structure.size(); ++m) {
// as that type will be shared through shallow copies for future references.
TSymbol* symbol = 0;
int blockIndex = -1;
- const TString* lookupName;
+ const TString* lookupName = 0;
if (node->getAsSymbolNode())
lookupName = &node->getAsSymbolNode()->getName();
else if (node->getAsBinaryNode()) {
// look for match
bool found = false;
TTypeList::const_iterator newMember;
- TSourceLoc memberLoc;
+ TSourceLoc memberLoc = {};
for (newMember = newTypeList.begin(); newMember != newTypeList.end(); ++newMember) {
if (member->type->getFieldName() == newMember->type->getFieldName()) {
found = true;
error(loc, "can't use with samplers or structs containing samplers", op, "");
}
-void TParseContext::structTypeCheck(TSourceLoc loc, TPublicType& publicType)
+void TParseContext::structTypeCheck(TSourceLoc /*loc*/, TPublicType& publicType)
{
const TTypeList& typeList = *publicType.userDef->getStruct();
bool badInit = false;
if (! init || ! init->getAsAggregate() || init->getAsAggregate()->getSequence().size() != 1)
badInit = true;
- TIntermBinary* binaryInit;
+ TIntermBinary* binaryInit = 0;
if (! badInit) {
// get the declaration assignment
binaryInit = init->getAsAggregate()->getSequence()[0]->getAsBinaryNode();
// overrides the other (e.g., row_major vs. column_major); only the last
// occurrence has any effect."
//
-void TParseContext::mergeObjectLayoutQualifiers(TSourceLoc loc, TQualifier& dst, const TQualifier& src, bool inheritOnly)
+void TParseContext::mergeObjectLayoutQualifiers(TQualifier& dst, const TQualifier& src, bool inheritOnly)
{
if (src.hasMatrix())
dst.layoutMatrix = src.layoutMatrix;
// Function finding algorithm for ES and desktop 110.
const TFunction* TParseContext::findFunctionExact(TSourceLoc loc, const TFunction& call, bool& builtIn)
{
- const TFunction* function = 0;
-
TSymbol* symbol = symbolTable.find(call.getMangledName(), &builtIn);
if (symbol == 0) {
error(loc, "no matching overloaded function found", call.getName().c_str(), "");
TVector<TFunction*> candidateList;
symbolTable.findFunctionNameList(call.getMangledName(), candidateList, builtIn);
- int numPossibleMatches = 0;
for (TVector<TFunction*>::const_iterator it = candidateList.begin(); it != candidateList.end(); ++it) {
const TFunction& function = *(*it);
error(loc, "initializer requires a variable, not a member", identifier.c_str(), "");
return 0;
}
- initNode = executeInitializer(loc, identifier, initializer, variable);
+ initNode = executeInitializer(loc, initializer, variable);
}
// look for errors in layout qualifier use
TVariable* TParseContext::makeInternalVariable(const char* name, const TType& type) const
{
TString* nameString = new TString(name);
- TSourceLoc loc = {0, 0};
TVariable* variable = new TVariable(nameString, type);
symbolTable.makeInternalVariable(*variable);
// Returning 0 just means there is no code to execute to handle the
// initializer, which will, for example, be the case for constant initializers.
//
-TIntermNode* TParseContext::executeInitializer(TSourceLoc loc, TString& identifier,
- TIntermTyped* initializer, TVariable* variable)
+TIntermNode* TParseContext::executeInitializer(TSourceLoc loc, TIntermTyped* initializer, TVariable* variable)
{
//
// Identifier must be of type constant, a global, or a temporary, and
return 0;
}
} else if (type.isMatrix()) {
- if (type.getMatrixCols() != initList->getSequence().size()) {
+ if (type.getMatrixCols() != (int)initList->getSequence().size()) {
error(loc, "wrong number of matrix columns:", "initializer list", type.getCompleteString().c_str());
return 0;
}
return 0;
}
} else if (type.isVector()) {
- if (type.getVectorSize() != initList->getSequence().size()) {
+ if (type.getVectorSize() != (int)initList->getSequence().size()) {
error(loc, "wrong vector size (or rows in a matrix column):", "initializer list", type.getCompleteString().c_str());
return 0;
}
// fix and check for member layout qualifiers
- mergeObjectLayoutQualifiers(loc, defaultQualification, currentBlockQualifier, true);
+ mergeObjectLayoutQualifiers(defaultQualification, currentBlockQualifier, true);
// "The offset qualifier can only be used on block members of blocks declared with std140 or std430 layouts."
// "The align qualifier can only be used on blocks or block members, and only for blocks declared with std140 or std430 layouts."
// Process the members
fixBlockLocations(loc, currentBlockQualifier, typeList, memberWithLocation, memberWithoutLocation);
- fixBlockXfbOffsets(loc, currentBlockQualifier, typeList);
- fixBlockUniformOffsets(loc, currentBlockQualifier, typeList);
+ fixBlockXfbOffsets(currentBlockQualifier, typeList);
+ fixBlockUniformOffsets(currentBlockQualifier, typeList);
for (unsigned int member = 0; member < typeList.size(); ++member)
layoutTypeCheck(typeList[member].loc, *typeList[member].type);
// reverse merge, so that currentBlockQualifier now has all layout information
// (can't use defaultQualification directly, it's missing other non-layout-default-class qualifiers)
- mergeObjectLayoutQualifiers(loc, currentBlockQualifier, defaultQualification, true);
+ mergeObjectLayoutQualifiers(currentBlockQualifier, defaultQualification, true);
//
// Build and add the interface block as a new type named 'blockName'
else {
if (memberWithLocation) {
// remove any block-level location and make it per *every* member
- int nextLocation; // by the rule above, initial value is not relevant
+ int nextLocation = 0; // by the rule above, initial value is not relevant
if (qualifier.hasAnyLocation()) {
nextLocation = qualifier.layoutLocation;
qualifier.layoutLocation = TQualifier::layoutLocationEnd;
}
}
-void TParseContext::fixBlockXfbOffsets(TSourceLoc loc, TQualifier& qualifier, TTypeList& typeList)
+void TParseContext::fixBlockXfbOffsets(TQualifier& qualifier, TTypeList& typeList)
{
// "If a block is qualified with xfb_offset, all its
// members are assigned transform feedback buffer offsets. If a block is not qualified with xfb_offset, any
// Also, compute and save the total size of the block. For the block's size, arrayness
// is not taken into account, as each element is backed by a separate buffer.
//
-void TParseContext::fixBlockUniformOffsets(TSourceLoc loc, TQualifier& qualifier, TTypeList& typeList)
+void TParseContext::fixBlockUniformOffsets(TQualifier& qualifier, TTypeList& typeList)
{
if (! qualifier.isUniformOrBuffer())
return;
if (! intermediate.setLocalSize(i, publicType.shaderQualifiers.localSize[i]))
error(loc, "cannot change previously set size", "local_size", "");
else {
- int max;
+ int max = 0;
switch (i) {
case 0: max = resources.maxComputeWorkGroupSizeX; break;
case 1: max = resources.maxComputeWorkGroupSizeY; break;
void setLayoutQualifier(TSourceLoc, TPublicType&, TString&);
void setLayoutQualifier(TSourceLoc, TPublicType&, TString&, const TIntermTyped*);
- void mergeObjectLayoutQualifiers(TSourceLoc, TQualifier& dest, const TQualifier& src, bool inheritOnly);
+ void mergeObjectLayoutQualifiers(TQualifier& dest, const TQualifier& src, bool inheritOnly);
void layoutObjectCheck(TSourceLoc, const TSymbol&);
void layoutTypeCheck(TSourceLoc, const TType&);
void layoutQualifierCheck(TSourceLoc, const TQualifier&);
TIntermTyped* constructBuiltIn(const TType&, TOperator, TIntermTyped*, TSourceLoc, bool subset);
void declareBlock(TSourceLoc, TTypeList& typeList, const TString* instanceName = 0, TArraySizes* arraySizes = 0);
void fixBlockLocations(TSourceLoc, TQualifier&, TTypeList&, bool memberWithLocation, bool memberWithoutLocation);
- void fixBlockXfbOffsets(TSourceLoc, TQualifier&, TTypeList&);
- void fixBlockUniformOffsets(TSourceLoc, TQualifier&, TTypeList&);
+ void fixBlockXfbOffsets(TQualifier&, TTypeList&);
+ void fixBlockUniformOffsets(TQualifier&, TTypeList&);
void addQualifierToExisting(TSourceLoc, TQualifier, const TString& identifier);
void addQualifierToExisting(TSourceLoc, TQualifier, TIdentifierList&);
void invariantCheck(TSourceLoc, const TQualifier&);
TVariable* makeInternalVariable(const char* name, const TType&) const;
TVariable* declareNonArray(TSourceLoc, TString& identifier, TType&, bool& newDeclaration);
void declareArray(TSourceLoc, TString& identifier, const TType&, TSymbol*&, bool& newDeclaration);
- TIntermNode* executeInitializer(TSourceLoc, TString& identifier, TIntermTyped* initializer, TVariable* variable);
+ TIntermNode* executeInitializer(TSourceLoc, TIntermTyped* initializer, TVariable* variable);
TIntermTyped* convertInitializerList(TSourceLoc, const TType&, TIntermTyped* initializer);
TOperator mapTypeToConstructorOp(const TType&) const;
void finalErrorCheck();
TLimits& limits;
protected:
+ TParseContext(TParseContext&);
+ TParseContext& operator=(TParseContext&);
+
TScanContext* scanContext;
TPpContext* ppContext;
TInputScanner* currentScanner;
//
// Check a single guard block for damage
//
+#ifdef GUARD_BLOCKS
void TAllocation::checkGuardBlock(unsigned char* blockMem, unsigned char val, const char* locText) const
+#else
+void TAllocation::checkGuardBlock(unsigned char*, unsigned char, const char*) const
+#endif
{
#ifdef GUARD_BLOCKS
for (int x = 0; x < guardBlockSize; x++) {
for (profileLength = 0; profileLength < maxProfileLength; ++profileLength) {
if (c < 0 || c == ' ' || c == '\t' || c == '\n' || c == '\r')
break;
- profileString[profileLength] = c;
+ profileString[profileLength] = (char)c;
c = get();
}
if (c > 0 && c != ' ' && c != '\t' && c != '\n' && c != '\r') {
explicit TParserToken(YYSTYPE& b) : sType(b) { }
YYSTYPE& sType;
+protected:
+ TParserToken(TParserToken&);
+ TParserToken& operator=(TParserToken&);
};
} // end namespace glslang
default:
char buf[2];
- buf[0] = ppToken.token;
+ buf[0] = (char)ppToken.token;
buf[1] = 0;
parseContext.error(loc, "unexpected token", buf, "");
break;
int tokenize(TPpContext*, TParserToken&);
protected:
+ TScanContext(TScanContext&);
+ TScanContext& operator=(TScanContext&);
+
int tokenizeIdentifier();
int identifierOrType();
int reservedWord();
const int* inputLengths,
const EShOptimizationLevel optLevel,
const TBuiltInResource* resources,
- int debugOptions, // currently unused
+ int /*debugOptions*/,
int defaultVersion, // use 100 for ES environment, 110 for desktop
bool forwardCompatible, // give errors for use of deprecated features
EShMessages messages // warnings/errors/AST; things to print out
// Return: The return value of is really boolean, indicating
// success or failure.
//
-int ShLink(
- const ShHandle linkHandle,
- const ShHandle compHandles[],
- const int numHandles,
- ShHandle uniformMapHandle,
- short int** uniformsAccessed,
- int* numUniformsAccessed)
-
-{
- if (!InitThread())
- return 0;
-
- TShHandleBase* base = reinterpret_cast<TShHandleBase*>(linkHandle);
- TLinker* linker = static_cast<TLinker*>(base->getAsLinker());
- if (linker == 0)
- return 0;
-
- int returnValue;
- GetThreadPoolAllocator().push();
- returnValue = ShLinkExt(linkHandle, compHandles, numHandles);
- GetThreadPoolAllocator().pop();
-
- if (returnValue)
- return 1;
-
- return 0;
-}
-//
-// This link method will be eventually used once the ICD supports the new linker interface
-//
int ShLinkExt(
const ShHandle linkHandle,
const ShHandle compHandles[],
infoSink = &(base->getAsCompiler()->getInfoSink());
else if (base->getAsLinker())
infoSink = &(base->getAsLinker()->getInfoSink());
+ else
+ return 0;
infoSink->info << infoSink->debug.c_str();
return infoSink->info.c_str();
class TDeferredCompiler : public TCompiler {
public:
TDeferredCompiler(EShLanguage s, TInfoSink& i) : TCompiler(s, i) { }
- virtual bool compile(TIntermNode* root, int version = 0, EProfile profile = ENoProfile) { return true; }
+ virtual bool compile(TIntermNode*, int = 0, EProfile = ENoProfile) { return true; }
};
TShader::TShader(EShLanguage s)
| layout_qualifier_id_list COMMA layout_qualifier_id {\r
$$ = $1;\r
$$.shaderQualifiers.merge($3.shaderQualifiers);\r
- parseContext.mergeObjectLayoutQualifiers($2.loc, $$.qualifier, $3.qualifier, false);\r
+ parseContext.mergeObjectLayoutQualifiers($$.qualifier, $3.qualifier, false);\r
}\r
\r
layout_qualifier_id\r
virtual bool visitSwitch(TVisit, TIntermSwitch* node);
TInfoSink& infoSink;
+protected:
+ TOutputTraverser(TOutputTraverser&);
+ TOutputTraverser& operator=(TOutputTraverser&);
};
//
TSymbolTable& symbolTable;\r
bool bad;\r
TSourceLoc badLoc;\r
+\r
+protected:\r
+ TInductiveTraverser(TInductiveTraverser&);\r
+ TInductiveTraverser& operator=(TInductiveTraverser&);\r
};\r
\r
// check binary operations for those modifying the loop index\r
const TIdSetType& inductiveLoopIds;\r
bool bad;\r
TSourceLoc badLoc;\r
+\r
+protected:\r
+ TIndexTraverser(TIndexTraverser&);\r
+ TIndexTraverser& operator=(TIndexTraverser&);\r
};\r
\r
// make sure symbols are inductive-loop indexes\r
int addUsedOffsets(int binding, int offset, int numOffsets);
int computeTypeLocationSize(const TType&) const;
- bool setXfbBufferStride(int buffer, int stride)
+ bool setXfbBufferStride(int buffer, unsigned stride)
{
if (xfbBuffers[buffer].stride != TQualifier::layoutXfbStrideEnd)
return xfbBuffers[buffer].stride == stride;
bool isMatrix;
int matrixCols;
int matrixRows;
+
+protected:
+ TConstTraverser(TConstTraverser&);
+ TConstTraverser& operator=(TConstTraverser&);
};
bool TConstTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node)
return token;
}
- Symbol* s;
- res = (s = LookUpSymbol(ppToken->atom)) ? !s->mac.undef : 0;
+ Symbol* s = LookUpSymbol(ppToken->atom);
+ res = s ? ! s->mac.undef : 0;
token = scanToken(ppToken);
if (needclose) {
if (token != ')') {
int TPpContext::CPPpragma(TPpToken* ppToken)
{
char SrcStrName[2];
- int tokenCount = 0;
- int maxTokenCount = 10;
const char* SrcStr;
TVector<TString> tokens;
tokens.push_back(SrcStr);
break;
default:
- SrcStrName[0] = token;
+ SrcStrName[0] = (char)token;
SrcStrName[1] = '\0';
tokens.push_back(SrcStrName);
}
n = new TokenStream;
pushInput(new tMarkerInput(this));
- pushTokenStreamInput(a, 0);
+ pushTokenStreamInput(a);
while ((token = scanToken(ppToken)) != tMarkerInput::marker) {
if (token == CPP_IDENTIFIER && MacroExpand(ppToken->atom, ppToken, false, newLineOkay) != 0)
continue;
if (mac->args[i] == ppToken->atom)
break;
if (i >= 0) {
- pp->pushTokenStreamInput(args[i], ppToken->atom);
+ pp->pushTokenStreamInput(args[i]);
return pp->scanToken(ppToken);
}
preamble(0), strings(0), parseContext(pc), inComment(false)
{
InitAtomTable();
- InitScanner(this);
+ InitScanner();
ifdepth = 0;
for (elsetracker = 0; elsetracker < maxIfNesting; elsetracker++)
TSymbolMap symbols; // this has light use... just defined macros
protected:
+ TPpContext(TPpContext&);
+ TPpContext& operator=(TPpContext&);
+
char* preamble; // string to parse, all before line 1 of string 0, it is 0 if no preamble
int preambleLength;
char** strings; // official strings of shader, starting a string 0 line 1
void RecordToken(TokenStream* pTok, int token, TPpToken* ppToken);
void RewindTokenStream(TokenStream *pTok);
int ReadToken(TokenStream* pTok, TPpToken* ppToken);
- void pushTokenStreamInput(TokenStream *ts, int name);
+ void pushTokenStreamInput(TokenStream *ts);
void UngetToken(int token, TPpToken* ppToken);
class tTokenInput : public tInput {
TInputScanner* input;
};
- int InitScanner(TPpContext* cpp);
+ int InitScanner();
int ScanFromString(char* s);
void missingEndifCheck();
int lFloatConst(int len, int ch, TPpToken* ppToken);
TPpContext::MemoryPool* TPpContext::mem_CreatePool(size_t chunksize, unsigned int align)
{
- MemoryPool *pool;
-
if (align == 0)
align = ALIGN;
if (chunksize == 0)
return 0;
if (chunksize & (align - 1))
return 0;
- if (!(pool = (MemoryPool*)malloc(chunksize)))
+
+ MemoryPool *pool = (MemoryPool*)malloc(chunksize);
+ if (! pool)
return 0;
pool->next = 0;
namespace glslang {
-int TPpContext::InitScanner(TPpContext *cpp)
+int TPpContext::InitScanner()
{
// Add various atoms needed by the CPP line scanner:
if (!InitCPP())
char* str = ppToken->name;
if (ch == '.') {
HasDecimalOrExponent = true;
- str[len++]=ch;
+ str[len++] = (char)ch;
ch = getChar();
while (ch >= '0' && ch <= '9') {
if (len < TPpToken::maxTokenLength) {
declen++;
if (len > 0 || ch != '0') {
- str[len] = ch;
+ str[len] = (char)ch;
len++;
str_len++;
}
len = 1,str_len=1;
} else {
ExpSign = 1;
- str[len++]=ch;
+ str[len++] = (char)ch;
ch = getChar();
if (ch == '+') {
- str[len++]=ch;
+ str[len++] = (char)ch;
ch = getChar();
} else if (ch == '-') {
ExpSign = -1;
- str[len++]=ch;
+ str[len++] = (char)ch;
ch = getChar();
}
if (ch >= '0' && ch <= '9') {
while (ch >= '0' && ch <= '9') {
if (len < TPpToken::maxTokenLength) {
exp = exp*10 + ch - '0';
- str[len++]=ch;
+ str[len++] = (char)ch;
ch = getChar();
} else {
parseContext.error(ppToken->loc, "float literal too long", "", "");
ungetChar();
} else {
if (len < TPpToken::maxTokenLength) {
- str[len++] = ch;
- str[len++] = ch2;
+ str[len++] = (char)ch;
+ str[len++] = (char)ch2;
isDouble = 1;
} else {
parseContext.error(ppToken->loc, "float literal too long", "", "");
if (! HasDecimalOrExponent)
parseContext.error(ppToken->loc, "float literal needs a decimal point or exponent", "", "");
if (len < TPpToken::maxTokenLength)
- str[len++] = ch;
+ str[len++] = (char)ch;
else {
parseContext.error(ppToken->loc, "float literal too long", "", "");
len = 1,str_len=1;
{
char tokenText[TPpToken::maxTokenLength + 1];
int AlreadyComplained = 0;
- int len, ch, ii;
+ int len = 0;
+ int ch = 0;
+ int ii = 0;
unsigned ival = 0;
ppToken->ival = 0;
case 'z':
do {
if (len < TPpToken::maxTokenLength) {
- tokenText[len++] = ch;
+ tokenText[len++] = (char)ch;
ch = pp->getChar();
} else {
if (! AlreadyComplained) {
return CPP_IDENTIFIER;
case '0':
- ppToken->name[len++] = ch;
+ ppToken->name[len++] = (char)ch;
ch = pp->getChar();
if (ch == 'x' || ch == 'X') {
// must be hexidecimal
bool isUnsigned = false;
- ppToken->name[len++] = ch;
+ ppToken->name[len++] = (char)ch;
ch = pp->getChar();
if ((ch >= '0' && ch <= '9') ||
(ch >= 'A' && ch <= 'F') ||
ival = 0;
do {
if (ival <= 0x0fffffff) {
- ppToken->name[len++] = ch;
+ ppToken->name[len++] = (char)ch;
if (ch >= '0' && ch <= '9') {
ii = ch - '0';
} else if (ch >= 'A' && ch <= 'F') {
}
if (ch == 'u' || ch == 'U') {
if (len < TPpToken::maxTokenLength)
- ppToken->name[len++] = ch;
+ ppToken->name[len++] = (char)ch;
isUnsigned = true;
} else
pp->ungetChar();
// see how much octal-like stuff we can read
while (ch >= '0' && ch <= '7') {
if (len < TPpToken::maxTokenLength)
- ppToken->name[len++] = ch;
+ ppToken->name[len++] = (char)ch;
else if (! AlreadyComplained) {
pp->parseContext.error(ppToken->loc, "numeric literal too long", "", "");
AlreadyComplained = 1;
nonOctal = true;
do {
if (len < TPpToken::maxTokenLength)
- ppToken->name[len++] = ch;
+ ppToken->name[len++] = (char)ch;
else if (! AlreadyComplained) {
pp->parseContext.error(ppToken->loc, "numeric literal too long", "", "");
AlreadyComplained = 1;
if (ch == 'u' || ch == 'U') {
if (len < TPpToken::maxTokenLength)
- ppToken->name[len++] = ch;
+ ppToken->name[len++] = (char)ch;
isUnsigned = true;
} else
pp->ungetChar();
do {
if (len < TPpToken::maxTokenLength)
- ppToken->name[len++] = ch;
+ ppToken->name[len++] = (char)ch;
else if (! AlreadyComplained) {
pp->parseContext.error(ppToken->loc, "numeric literal too long", "", "");
AlreadyComplained = 1;
int uint = 0;
if (ch == 'u' || ch == 'U') {
if (len < TPpToken::maxTokenLength)
- ppToken->name[len++] = ch;
+ ppToken->name[len++] = (char)ch;
uint = 1;
} else
pp->ungetChar();
ival = 0;
for (ii = 0; ii < numericLen; ii++) {
ch = ppToken->name[ii] - '0';
- if ((ival > 429496729) || (ival == 429496729 && ch >= 6)) {
+ if ((ival > 0x19999999u) || (ival == 0x19999999u && ch >= 6)) {
pp->parseContext.error(ppToken->loc, "numeric literal too big", "", "");
- ival = -1;
+ ival = 0xFFFFFFFFu;
break;
} else
ival = ival * 10 + ch;
ch = pp->getChar();
while (ch != '"' && ch != '\n' && ch != EOF) {
if (len < TPpToken::maxTokenLength) {
- tokenText[len] = ch;
+ tokenText[len] = (char)ch;
len++;
ch = pp->getChar();
} else
ch = lReadByte(pTok);
while (ch != 0) {
if (len < TPpToken::maxTokenLength) {
- tokenText[len] = ch;
+ tokenText[len] = (char)ch;
len++;
ch = lReadByte(pTok);
} else {
return pp->ReadToken(tokens, ppToken);
}
-void TPpContext::pushTokenStreamInput(TokenStream* ts, int name)
+void TPpContext::pushTokenStreamInput(TokenStream* ts)
{
pushInput(new tTokenInput(this, ts));
RewindTokenStream(ts);
const TIntermediate& intermediate;\r
TReflection& reflection;\r
std::set<const TIntermNode*> processedDerefs;\r
+\r
+protected:\r
+ TLiveTraverser(TLiveTraverser&);\r
+ TLiveTraverser& operator=(TLiveTraverser&);\r
};\r
\r
//\r