MCPcopy Create free account
hub / github.com/KhronosGroup/glslang / findStructConstant

Method findStructConstant

SPIRV/SpvBuilder.cpp:2266–2288  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2264}
2265
2266Id Builder::findStructConstant(Id typeId, const std::vector<Id>& comps)
2267{
2268 Instruction* constant = nullptr;
2269 bool found = false;
2270 for (int i = 0; i < (int)groupedStructConstants[typeId].size(); ++i) {
2271 constant = groupedStructConstants[typeId][i];
2272
2273 // same contents?
2274 bool mismatch = false;
2275 for (int op = 0; op < constant->getNumOperands(); ++op) {
2276 if (constant->getIdOperand(op) != comps[op]) {
2277 mismatch = true;
2278 break;
2279 }
2280 }
2281 if (! mismatch) {
2282 found = true;
2283 break;
2284 }
2285 }
2286
2287 return found ? constant->getResultId() : NoResult;
2288}
2289
2290// Comments in header
2291Id Builder::makeCompositeConstant(Id typeId, const std::vector<Id>& members, bool specConstant)

Callers

nothing calls this directly

Calls 4

getNumOperandsMethod · 0.80
getResultIdMethod · 0.80
sizeMethod · 0.45
getIdOperandMethod · 0.45

Tested by

no test coverage detected