diff --git a/third_party/glslang-spirv/SpvBuilder.cpp b/third_party/glslang-spirv/SpvBuilder.cpp index 13a6c946a..36bededc5 100644 --- a/third_party/glslang-spirv/SpvBuilder.cpp +++ b/third_party/glslang-spirv/SpvBuilder.cpp @@ -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(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& comps) const +Id Builder::findCompositeConstant(Op typeClass, const std::vector& comps) const { Instruction* constant = 0; bool found = false; @@ -772,7 +772,7 @@ Id Builder::findCompositeConstant(Op typeClass, std::vector& comps) const } // Comments in header -Id Builder::makeCompositeConstant(Id typeId, std::vector& members, bool specConstant) +Id Builder::makeCompositeConstant(Id typeId, const std::vector& 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& offsets) +Id Builder::createAccessChain(StorageClass storageClass, Id base, const std::vector& 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& indexes) +Id Builder::createCompositeInsert(Id object, Id composite, Id typeId, const std::vector& 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& operands) return op->getResultId(); } -Id Builder::createFunctionCall(spv::Function* function, std::vector& args) +Id Builder::createFunctionCall(spv::Function* function, const std::vector& 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& constituents) +Id Builder::createCompositeConstruct(Id typeId, const std::vector& 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& caseValues, std::vector& valueIndexToSegment, int defaultSegment, +void Builder::makeSwitch(Id selector, int numSegments, const std::vector& caseValues, const std::vector& valueIndexToSegment, int defaultSegment, std::vector& segmentBlocks) { Function& function = buildPoint->getParent(); diff --git a/third_party/glslang-spirv/SpvBuilder.h b/third_party/glslang-spirv/SpvBuilder.h index 7eae4fe91..28f846578 100644 --- a/third_party/glslang-spirv/SpvBuilder.h +++ b/third_party/glslang-spirv/SpvBuilder.h @@ -192,7 +192,7 @@ public: Id makeDoubleConstant(double d, bool specConstant = false); // Turn the array of constants into a proper spv constant of the requested type. - Id makeCompositeConstant(Id type, std::vector& comps, bool specConst = false); + Id makeCompositeConstant(Id type, const std::vector& comps, bool specConst = false); // Methods for adding information outside the CFG. Instruction* addEntryPoint(ExecutionModel, Function*, const char* name); @@ -240,7 +240,7 @@ public: Id createLoad(Id lValue); // Create an OpAccessChain instruction - Id createAccessChain(StorageClass, Id base, std::vector& offsets); + Id createAccessChain(StorageClass, Id base, const std::vector& offsets); // Create an OpArrayLength instruction 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, std::vector& indexes); Id createCompositeInsert(Id object, Id composite, Id typeId, unsigned index); - Id createCompositeInsert(Id object, Id composite, Id typeId, std::vector& indexes); + Id createCompositeInsert(Id object, Id composite, Id typeId, const std::vector& indexes); Id createVectorExtractDynamic(Id vector, Id typeId, 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 createTriOp(Op, Id typeId, Id operand1, Id operand2, Id operand3); Id createOp(Op, Id typeId, const std::vector& operands); - Id createFunctionCall(spv::Function*, std::vector&); + Id createFunctionCall(spv::Function*, const std::vector&); // Take an rvalue (source) and a set of channels to extract from it to // 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'. // 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. 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 */); // OpCompositeConstruct - Id createCompositeConstruct(Id typeId, std::vector& constituents); + Id createCompositeConstruct(Id typeId, const std::vector& constituents); // vector or scalar constructor Id createConstructor(Decoration precision, const std::vector& 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 // recursion stack can hold the memory for it. // - void makeSwitch(Id condition, int numSegments, std::vector& caseValues, std::vector& valueToSegment, int defaultSegment, + void makeSwitch(Id condition, int numSegments, const std::vector& caseValues, const std::vector& valueToSegment, int defaultSegment, std::vector& segmentBB); // return argument // Add a branch to the innermost switch's merge block. @@ -525,7 +525,7 @@ public: 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 v1, unsigned v2) const; - Id findCompositeConstant(Op typeClass, std::vector& comps) const; + Id findCompositeConstant(Op typeClass, const std::vector& comps) const; Id collapseAccessChain(); void transferAccessChainSwizzle(bool dynamic); void simplifyAccessChainSwizzle();