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

Method makePointer

SPIRV/SpvBuilder.cpp:148–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146}
147
148Id Builder::makePointer(StorageClass storageClass, Id pointee)
149{
150 // try to find it
151 Instruction* type;
152 for (int t = 0; t < (int)groupedTypes[enumCast(Op::OpTypePointer)].size(); ++t) {
153 type = groupedTypes[enumCast(Op::OpTypePointer)][t];
154 if (type->getImmediateOperand(0) == (unsigned)storageClass &&
155 type->getIdOperand(1) == pointee)
156 return type->getResultId();
157 }
158
159 // not found, make it
160 type = new Instruction(getUniqueId(), NoType, Op::OpTypePointer);
161 type->reserveOperands(2);
162 type->addImmediateOperand(storageClass);
163 type->addIdOperand(pointee);
164 groupedTypes[enumCast(Op::OpTypePointer)].push_back(type);
165 constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
166 module.mapInstruction(type);
167
168 if (emitNonSemanticShaderDebugInfo) {
169 const Id debugResultId = makePointerDebugType(storageClass, pointee);
170 debugTypeIdLookup[type->getResultId()] = debugResultId;
171 }
172
173 return type->getResultId();
174}
175
176Id Builder::makeForwardPointer(StorageClass storageClass)
177{

Callers 2

makeFunctionsMethod · 0.80

Calls 10

enumCastFunction · 0.85
getImmediateOperandMethod · 0.80
getResultIdMethod · 0.80
reserveOperandsMethod · 0.80
addImmediateOperandMethod · 0.80
addIdOperandMethod · 0.80
mapInstructionMethod · 0.80
sizeMethod · 0.45
getIdOperandMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected