Add const qualifiers to SpvBuilder.h in glslang lib
This was needed because the temporary vectors passed as non-const were throwing a compiler error in linux. The updated library appears to have fixed this, but there were other changes that could break compatability so these qualifiers were added manually
This commit is contained in:
parent
3074066463
commit
71294a79b8
|
@ -77,7 +77,7 @@ Id Builder::import(const char* name)
|
||||||
{
|
{
|
||||||
Instruction* import = new Instruction(getUniqueId(), NoType, OpExtInstImport);
|
Instruction* import = new Instruction(getUniqueId(), NoType, OpExtInstImport);
|
||||||
import->addStringOperand(name);
|
import->addStringOperand(name);
|
||||||
|
|
||||||
imports.push_back(std::unique_ptr<Instruction>(import));
|
imports.push_back(std::unique_ptr<Instruction>(import));
|
||||||
return import->getResultId();
|
return import->getResultId();
|
||||||
}
|
}
|
||||||
|
@ -244,7 +244,7 @@ Id Builder::makeStructResultType(Id type0, Id type1)
|
||||||
type = groupedTypes[OpTypeStruct][t];
|
type = groupedTypes[OpTypeStruct][t];
|
||||||
if (type->getNumOperands() != 2)
|
if (type->getNumOperands() != 2)
|
||||||
continue;
|
continue;
|
||||||
if (type->getIdOperand(0) != type0 ||
|
if (type->getIdOperand(0) != type0 ||
|
||||||
type->getIdOperand(1) != type1)
|
type->getIdOperand(1) != type1)
|
||||||
continue;
|
continue;
|
||||||
return type->getResultId();
|
return type->getResultId();
|
||||||
|
@ -626,7 +626,7 @@ Id Builder::findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned v1,
|
||||||
bool Builder::isConstantOpCode(Op opcode) const
|
bool Builder::isConstantOpCode(Op opcode) const
|
||||||
{
|
{
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
case OpUndef:
|
case OpUndef:
|
||||||
case OpConstantTrue:
|
case OpConstantTrue:
|
||||||
case OpConstantFalse:
|
case OpConstantFalse:
|
||||||
case OpConstant:
|
case OpConstant:
|
||||||
|
@ -743,7 +743,7 @@ Id Builder::makeDoubleConstant(double d, bool specConstant)
|
||||||
return c->getResultId();
|
return c->getResultId();
|
||||||
}
|
}
|
||||||
|
|
||||||
Id Builder::findCompositeConstant(Op typeClass, std::vector<Id>& comps) const
|
Id Builder::findCompositeConstant(Op typeClass, const std::vector<Id>& comps) const
|
||||||
{
|
{
|
||||||
Instruction* constant = 0;
|
Instruction* constant = 0;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
@ -772,7 +772,7 @@ Id Builder::findCompositeConstant(Op typeClass, std::vector<Id>& comps) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// Comments in header
|
// Comments in header
|
||||||
Id Builder::makeCompositeConstant(Id typeId, std::vector<Id>& members, bool specConstant)
|
Id Builder::makeCompositeConstant(Id typeId, const std::vector<Id>& members, bool specConstant)
|
||||||
{
|
{
|
||||||
Op opcode = specConstant ? OpSpecConstantComposite : OpConstantComposite;
|
Op opcode = specConstant ? OpSpecConstantComposite : OpConstantComposite;
|
||||||
assert(typeId);
|
assert(typeId);
|
||||||
|
@ -1022,7 +1022,7 @@ Id Builder::createLoad(Id lValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Comments in header
|
// Comments in header
|
||||||
Id Builder::createAccessChain(StorageClass storageClass, Id base, std::vector<Id>& offsets)
|
Id Builder::createAccessChain(StorageClass storageClass, Id base, const std::vector<Id>& offsets)
|
||||||
{
|
{
|
||||||
// Figure out the final resulting type.
|
// Figure out the final resulting type.
|
||||||
spv::Id typeId = getTypeId(base);
|
spv::Id typeId = getTypeId(base);
|
||||||
|
@ -1089,7 +1089,7 @@ Id Builder::createCompositeInsert(Id object, Id composite, Id typeId, unsigned i
|
||||||
return insert->getResultId();
|
return insert->getResultId();
|
||||||
}
|
}
|
||||||
|
|
||||||
Id Builder::createCompositeInsert(Id object, Id composite, Id typeId, std::vector<unsigned>& indexes)
|
Id Builder::createCompositeInsert(Id object, Id composite, Id typeId, const std::vector<unsigned>& indexes)
|
||||||
{
|
{
|
||||||
Instruction* insert = new Instruction(getUniqueId(), typeId, OpCompositeInsert);
|
Instruction* insert = new Instruction(getUniqueId(), typeId, OpCompositeInsert);
|
||||||
insert->addIdOperand(object);
|
insert->addIdOperand(object);
|
||||||
|
@ -1210,7 +1210,7 @@ Id Builder::createOp(Op opCode, Id typeId, const std::vector<Id>& operands)
|
||||||
return op->getResultId();
|
return op->getResultId();
|
||||||
}
|
}
|
||||||
|
|
||||||
Id Builder::createFunctionCall(spv::Function* function, std::vector<spv::Id>& args)
|
Id Builder::createFunctionCall(spv::Function* function, const std::vector<spv::Id>& args)
|
||||||
{
|
{
|
||||||
Instruction* op = new Instruction(getUniqueId(), function->getReturnType(), OpFunctionCall);
|
Instruction* op = new Instruction(getUniqueId(), function->getReturnType(), OpFunctionCall);
|
||||||
op->addIdOperand(function->getId());
|
op->addIdOperand(function->getId());
|
||||||
|
@ -1647,7 +1647,7 @@ Id Builder::createCompositeCompare(Decoration precision, Id value1, Id value2, b
|
||||||
}
|
}
|
||||||
|
|
||||||
// OpCompositeConstruct
|
// OpCompositeConstruct
|
||||||
Id Builder::createCompositeConstruct(Id typeId, std::vector<Id>& constituents)
|
Id Builder::createCompositeConstruct(Id typeId, const std::vector<Id>& constituents)
|
||||||
{
|
{
|
||||||
assert(isAggregateType(typeId) || (getNumTypeConstituents(typeId) > 1 && getNumTypeConstituents(typeId) == (int)constituents.size()));
|
assert(isAggregateType(typeId) || (getNumTypeConstituents(typeId) > 1 && getNumTypeConstituents(typeId) == (int)constituents.size()));
|
||||||
|
|
||||||
|
@ -1848,7 +1848,7 @@ void Builder::If::makeEndIf()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Comments in header
|
// Comments in header
|
||||||
void Builder::makeSwitch(Id selector, int numSegments, std::vector<int>& caseValues, std::vector<int>& valueIndexToSegment, int defaultSegment,
|
void Builder::makeSwitch(Id selector, int numSegments, const std::vector<int>& caseValues, const std::vector<int>& valueIndexToSegment, int defaultSegment,
|
||||||
std::vector<Block*>& segmentBlocks)
|
std::vector<Block*>& segmentBlocks)
|
||||||
{
|
{
|
||||||
Function& function = buildPoint->getParent();
|
Function& function = buildPoint->getParent();
|
||||||
|
|
|
@ -192,7 +192,7 @@ public:
|
||||||
Id makeDoubleConstant(double d, bool specConstant = false);
|
Id makeDoubleConstant(double d, bool specConstant = false);
|
||||||
|
|
||||||
// Turn the array of constants into a proper spv constant of the requested type.
|
// Turn the array of constants into a proper spv constant of the requested type.
|
||||||
Id makeCompositeConstant(Id type, std::vector<Id>& comps, bool specConst = false);
|
Id makeCompositeConstant(Id type, const std::vector<Id>& comps, bool specConst = false);
|
||||||
|
|
||||||
// Methods for adding information outside the CFG.
|
// Methods for adding information outside the CFG.
|
||||||
Instruction* addEntryPoint(ExecutionModel, Function*, const char* name);
|
Instruction* addEntryPoint(ExecutionModel, Function*, const char* name);
|
||||||
|
@ -240,7 +240,7 @@ public:
|
||||||
Id createLoad(Id lValue);
|
Id createLoad(Id lValue);
|
||||||
|
|
||||||
// Create an OpAccessChain instruction
|
// Create an OpAccessChain instruction
|
||||||
Id createAccessChain(StorageClass, Id base, std::vector<Id>& offsets);
|
Id createAccessChain(StorageClass, Id base, const std::vector<Id>& offsets);
|
||||||
|
|
||||||
// Create an OpArrayLength instruction
|
// Create an OpArrayLength instruction
|
||||||
Id createArrayLength(Id base, unsigned int member);
|
Id createArrayLength(Id base, unsigned int member);
|
||||||
|
@ -249,7 +249,7 @@ public:
|
||||||
Id createCompositeExtract(Id composite, Id typeId, unsigned index);
|
Id createCompositeExtract(Id composite, Id typeId, unsigned index);
|
||||||
Id createCompositeExtract(Id composite, Id typeId, std::vector<unsigned>& indexes);
|
Id createCompositeExtract(Id composite, Id typeId, std::vector<unsigned>& indexes);
|
||||||
Id createCompositeInsert(Id object, Id composite, Id typeId, unsigned index);
|
Id createCompositeInsert(Id object, Id composite, Id typeId, unsigned index);
|
||||||
Id createCompositeInsert(Id object, Id composite, Id typeId, std::vector<unsigned>& indexes);
|
Id createCompositeInsert(Id object, Id composite, Id typeId, const std::vector<unsigned>& indexes);
|
||||||
|
|
||||||
Id createVectorExtractDynamic(Id vector, Id typeId, Id componentIndex);
|
Id createVectorExtractDynamic(Id vector, Id typeId, Id componentIndex);
|
||||||
Id createVectorInsertDynamic(Id vector, Id typeId, Id component, Id componentIndex);
|
Id createVectorInsertDynamic(Id vector, Id typeId, Id component, Id componentIndex);
|
||||||
|
@ -263,7 +263,7 @@ public:
|
||||||
Id createBinOp(Op, Id typeId, Id operand1, Id operand2);
|
Id createBinOp(Op, Id typeId, Id operand1, Id operand2);
|
||||||
Id createTriOp(Op, Id typeId, Id operand1, Id operand2, Id operand3);
|
Id createTriOp(Op, Id typeId, Id operand1, Id operand2, Id operand3);
|
||||||
Id createOp(Op, Id typeId, const std::vector<Id>& operands);
|
Id createOp(Op, Id typeId, const std::vector<Id>& operands);
|
||||||
Id createFunctionCall(spv::Function*, std::vector<spv::Id>&);
|
Id createFunctionCall(spv::Function*, const std::vector<spv::Id>&);
|
||||||
|
|
||||||
// Take an rvalue (source) and a set of channels to extract from it to
|
// Take an rvalue (source) and a set of channels to extract from it to
|
||||||
// make a new rvalue, which is returned.
|
// make a new rvalue, which is returned.
|
||||||
|
@ -296,7 +296,7 @@ public:
|
||||||
// Generally, the type of 'scalar' does not need to be the same type as the components in 'vector'.
|
// Generally, the type of 'scalar' does not need to be the same type as the components in 'vector'.
|
||||||
// The type of the created vector is a vector of components of the same type as the scalar.
|
// The type of the created vector is a vector of components of the same type as the scalar.
|
||||||
//
|
//
|
||||||
// Note: One of the arguments will change, with the result coming back that way rather than
|
// Note: One of the arguments will change, with the result coming back that way rather than
|
||||||
// through the return value.
|
// through the return value.
|
||||||
void promoteScalar(Decoration precision, Id& left, Id& right);
|
void promoteScalar(Decoration precision, Id& left, Id& right);
|
||||||
|
|
||||||
|
@ -341,7 +341,7 @@ public:
|
||||||
Id createCompositeCompare(Decoration precision, Id, Id, bool /* true if for equal, false if for not-equal */);
|
Id createCompositeCompare(Decoration precision, Id, Id, bool /* true if for equal, false if for not-equal */);
|
||||||
|
|
||||||
// OpCompositeConstruct
|
// OpCompositeConstruct
|
||||||
Id createCompositeConstruct(Id typeId, std::vector<Id>& constituents);
|
Id createCompositeConstruct(Id typeId, const std::vector<Id>& constituents);
|
||||||
|
|
||||||
// vector or scalar constructor
|
// vector or scalar constructor
|
||||||
Id createConstructor(Decoration precision, const std::vector<Id>& sources, Id resultTypeId);
|
Id createConstructor(Decoration precision, const std::vector<Id>& sources, Id resultTypeId);
|
||||||
|
@ -383,7 +383,7 @@ public:
|
||||||
// Returns the right set of basic blocks to start each code segment with, so that the caller's
|
// Returns the right set of basic blocks to start each code segment with, so that the caller's
|
||||||
// recursion stack can hold the memory for it.
|
// recursion stack can hold the memory for it.
|
||||||
//
|
//
|
||||||
void makeSwitch(Id condition, int numSegments, std::vector<int>& caseValues, std::vector<int>& valueToSegment, int defaultSegment,
|
void makeSwitch(Id condition, int numSegments, const std::vector<int>& caseValues, const std::vector<int>& valueToSegment, int defaultSegment,
|
||||||
std::vector<Block*>& segmentBB); // return argument
|
std::vector<Block*>& segmentBB); // return argument
|
||||||
|
|
||||||
// Add a branch to the innermost switch's merge block.
|
// Add a branch to the innermost switch's merge block.
|
||||||
|
@ -525,7 +525,7 @@ public:
|
||||||
Id makeIntConstant(Id typeId, unsigned value, bool specConstant);
|
Id makeIntConstant(Id typeId, unsigned value, bool specConstant);
|
||||||
Id findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned value) const;
|
Id findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned value) const;
|
||||||
Id findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned v1, unsigned v2) const;
|
Id findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned v1, unsigned v2) const;
|
||||||
Id findCompositeConstant(Op typeClass, std::vector<Id>& comps) const;
|
Id findCompositeConstant(Op typeClass, const std::vector<Id>& comps) const;
|
||||||
Id collapseAccessChain();
|
Id collapseAccessChain();
|
||||||
void transferAccessChainSwizzle(bool dynamic);
|
void transferAccessChainSwizzle(bool dynamic);
|
||||||
void simplifyAccessChainSwizzle();
|
void simplifyAccessChainSwizzle();
|
||||||
|
|
Loading…
Reference in New Issue