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:
20
third_party/glslang-spirv/SpvBuilder.cpp
vendored
20
third_party/glslang-spirv/SpvBuilder.cpp
vendored
@@ -77,7 +77,7 @@ Id Builder::import(const char* name)
|
||||
{
|
||||
Instruction* import = new Instruction(getUniqueId(), NoType, OpExtInstImport);
|
||||
import->addStringOperand(name);
|
||||
|
||||
|
||||
imports.push_back(std::unique_ptr<Instruction>(import));
|
||||
return import->getResultId();
|
||||
}
|
||||
@@ -244,7 +244,7 @@ Id Builder::makeStructResultType(Id type0, Id type1)
|
||||
type = groupedTypes[OpTypeStruct][t];
|
||||
if (type->getNumOperands() != 2)
|
||||
continue;
|
||||
if (type->getIdOperand(0) != type0 ||
|
||||
if (type->getIdOperand(0) != type0 ||
|
||||
type->getIdOperand(1) != type1)
|
||||
continue;
|
||||
return type->getResultId();
|
||||
@@ -626,7 +626,7 @@ Id Builder::findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned v1,
|
||||
bool Builder::isConstantOpCode(Op opcode) const
|
||||
{
|
||||
switch (opcode) {
|
||||
case OpUndef:
|
||||
case OpUndef:
|
||||
case OpConstantTrue:
|
||||
case OpConstantFalse:
|
||||
case OpConstant:
|
||||
@@ -743,7 +743,7 @@ Id Builder::makeDoubleConstant(double d, bool specConstant)
|
||||
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;
|
||||
bool found = false;
|
||||
@@ -772,7 +772,7 @@ Id Builder::findCompositeConstant(Op typeClass, std::vector<Id>& comps) const
|
||||
}
|
||||
|
||||
// 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;
|
||||
assert(typeId);
|
||||
@@ -1022,7 +1022,7 @@ Id Builder::createLoad(Id lValue)
|
||||
}
|
||||
|
||||
// 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.
|
||||
spv::Id typeId = getTypeId(base);
|
||||
@@ -1089,7 +1089,7 @@ Id Builder::createCompositeInsert(Id object, Id composite, Id typeId, unsigned i
|
||||
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);
|
||||
insert->addIdOperand(object);
|
||||
@@ -1210,7 +1210,7 @@ Id Builder::createOp(Op opCode, Id typeId, const std::vector<Id>& operands)
|
||||
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);
|
||||
op->addIdOperand(function->getId());
|
||||
@@ -1647,7 +1647,7 @@ Id Builder::createCompositeCompare(Decoration precision, Id value1, Id value2, b
|
||||
}
|
||||
|
||||
// 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()));
|
||||
|
||||
@@ -1848,7 +1848,7 @@ void Builder::If::makeEndIf()
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
Function& function = buildPoint->getParent();
|
||||
|
||||
Reference in New Issue
Block a user