diff options
Diffstat (limited to 'SPIRV/SpvBuilder.cpp')
-rw-r--r-- | SPIRV/SpvBuilder.cpp | 46 |
1 files changed, 11 insertions, 35 deletions
diff --git a/SPIRV/SpvBuilder.cpp b/SPIRV/SpvBuilder.cpp index 764a8860..7c5ea874 100644 --- a/SPIRV/SpvBuilder.cpp +++ b/SPIRV/SpvBuilder.cpp @@ -71,9 +71,9 @@ Builder::Builder(unsigned int spvVersion, unsigned int magicNumber, SpvBuildLogg addressModel(AddressingModelLogical), memoryModel(MemoryModelGLSL450), builderNumber(magicNumber), - buildPoint(nullptr), + buildPoint(0), uniqueId(0), - entryPointFunction(nullptr), + entryPointFunction(0), generatingOpCodeForSpecConst(false), logger(buildLogger) { @@ -650,12 +650,8 @@ Id Builder::makeDebugFunctionType(Id returnType, const std::vector<Id>& paramTyp type->addIdOperand(makeUintConstant(NonSemanticShaderDebugInfo100FlagIsPublic)); type->addIdOperand(debugId[returnType]); for (auto const paramType : paramTypes) { - if (isPointerType(paramType) || isArrayType(paramType)) { - type->addIdOperand(debugId[getContainedTypeId(paramType)]); - } - else { - type->addIdOperand(debugId[paramType]); - } + assert(isPointerType(paramType) || isArrayType(paramType)); + type->addIdOperand(debugId[getContainedTypeId(paramType)]); } constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type)); module.mapInstruction(type); @@ -1180,21 +1176,6 @@ Id Builder::makeRayQueryType() return type->getResultId(); } - -Id Builder::makeHitObjectNVType() -{ - Instruction *type; - if (groupedTypes[OpTypeHitObjectNV].size() == 0) { - type = new Instruction(getUniqueId(), NoType, OpTypeHitObjectNV); - groupedTypes[OpTypeHitObjectNV].push_back(type); - constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type)); - module.mapInstruction(type); - } else { - type = groupedTypes[OpTypeHitObjectNV].back(); - } - - return type->getResultId(); -} #endif Id Builder::getDerefTypeId(Id resultId) const @@ -1694,7 +1675,7 @@ Id Builder::importNonSemanticShaderDebugInfoInstructions() Id Builder::findCompositeConstant(Op typeClass, Id typeId, const std::vector<Id>& comps) { - Instruction* constant = nullptr; + Instruction* constant = 0; bool found = false; for (int i = 0; i < (int)groupedConstants[typeClass].size(); ++i) { constant = groupedConstants[typeClass][i]; @@ -1721,7 +1702,7 @@ Id Builder::findCompositeConstant(Op typeClass, Id typeId, const std::vector<Id> Id Builder::findStructConstant(Id typeId, const std::vector<Id>& comps) { - Instruction* constant = nullptr; + Instruction* constant = 0; bool found = false; for (int i = 0; i < (int)groupedStructConstants[typeId].size(); ++i) { constant = groupedStructConstants[typeId][i]; @@ -2066,16 +2047,11 @@ Function* Builder::makeFunctionEntry(Decoration precision, Id returnType, const assert(paramTypes.size() == paramNames.size()); for(size_t p = 0; p < paramTypes.size(); ++p) { - auto getParamTypeId = [this](Id const& typeId) { - if (isPointerType(typeId) || isArrayType(typeId)) { - return getContainedTypeId(typeId); - } - else { - return typeId; - } - }; + auto const& paramType = paramTypes[p]; + assert(isPointerType(paramType) || isArrayType(paramType)); + assert(debugId[getContainedTypeId(paramType)] != 0); auto const& paramName = paramNames[p]; - auto const debugLocalVariableId = createDebugLocalVariable(debugId[getParamTypeId(paramTypes[p])], paramName, p+1); + auto const debugLocalVariableId = createDebugLocalVariable(debugId[getContainedTypeId(paramType)], paramName, p+1); debugId[firstParamId + p] = debugLocalVariableId; makeDebugDeclare(debugLocalVariableId, firstParamId + p); @@ -3356,7 +3332,7 @@ Builder::If::If(Id cond, unsigned int ctrl, Builder& gb) : builder(gb), condition(cond), control(ctrl), - elseBlock(nullptr) + elseBlock(0) { function = &builder.getBuildPoint()->getParent(); |