| 3129 | } |
| 3130 | |
| 3131 | Instruction* Builder::createDescHeapLoadStoreBaseRemap(Id baseId, Op op) |
| 3132 | { |
| 3133 | // could only be untypedAccessChain or BufferPointerEXT op. |
| 3134 | spv::Op instOp = module.getInstruction(baseId)->getOpCode(); |
| 3135 | spv::Id baseVal = baseId; |
| 3136 | // base type (from run time array) |
| 3137 | spv::Id resultTy = getIdOperand(baseId, 0); |
| 3138 | // Descriptor heap using run time array. |
| 3139 | if (accessChain.descHeapInfo.descHeapStorageClass != StorageClass::Max) |
| 3140 | resultTy = getIdOperand(resultTy, 0); |
| 3141 | if (instOp == Op::OpBufferPointerEXT) { |
| 3142 | // get base structure type from run time array of buffer structure type. |
| 3143 | // create an extra untyped access chain for buffer pointer. |
| 3144 | resultTy = accessChain.descHeapInfo.descHeapBaseTy; |
| 3145 | Instruction* chain = new Instruction(getUniqueId(), getTypeId(baseId), Op::OpUntypedAccessChainKHR); |
| 3146 | // base type. |
| 3147 | chain->addIdOperand(resultTy); |
| 3148 | // base |
| 3149 | chain->addIdOperand(baseId); |
| 3150 | // index |
| 3151 | for (int i = 0; i < (int)accessChain.indexChain.size(); ++i) { |
| 3152 | chain->addIdOperand(accessChain.indexChain[i]); |
| 3153 | } |
| 3154 | addInstruction(std::unique_ptr<Instruction>(chain)); |
| 3155 | baseVal = chain->getResultId(); |
| 3156 | clearAccessChain(); |
| 3157 | } else if (instOp != Op::OpUntypedAccessChainKHR) { |
| 3158 | assert(false && "Not a untyped load type"); |
| 3159 | } |
| 3160 | |
| 3161 | Instruction* inst = nullptr; |
| 3162 | if (op == Op::OpStore) |
| 3163 | inst = new Instruction(Op::OpStore); |
| 3164 | else { |
| 3165 | inst = new Instruction(getUniqueId(), resultTy, Op::OpLoad); |
| 3166 | accessChain.descHeapInfo.descHeapInstId.push_back(inst); |
| 3167 | } |
| 3168 | inst->addIdOperand(baseVal); |
| 3169 | return inst; |
| 3170 | } |
| 3171 | |
| 3172 | uint32_t Builder::isStructureHeapMember(Id id, std::vector<Id> indexChain, |
| 3173 | unsigned int idx, spv::BuiltIn* bt, uint32_t* firstArrIndex) |
nothing calls this directly
no test coverage detected