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

Method makeNullConstant

SPIRV/SpvBuilder.cpp:1877–1899  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1875}
1876
1877Id Builder::makeNullConstant(Id typeId)
1878{
1879 Instruction* constant;
1880
1881 // See if we already made it.
1882 Id existing = NoResult;
1883 for (int i = 0; i < (int)nullConstants.size(); ++i) {
1884 constant = nullConstants[i];
1885 if (constant->getTypeId() == typeId)
1886 existing = constant->getResultId();
1887 }
1888
1889 if (existing != NoResult)
1890 return existing;
1891
1892 // Make it
1893 Instruction* c = new Instruction(getUniqueId(), typeId, Op::OpConstantNull);
1894 constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(c));
1895 nullConstants.push_back(c);
1896 module.mapInstruction(c);
1897
1898 return c->getResultId();
1899}
1900
1901Id Builder::makeBoolConstant(bool b, bool specConstant)
1902{

Callers 1

createSpvVariableMethod · 0.80

Calls 5

getResultIdMethod · 0.80
mapInstructionMethod · 0.80
sizeMethod · 0.45
getTypeIdMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected