Implement GL_EXT_null_initializer
Adds null initializer syntax (empty braces) Allows null initialization of shared variables
This commit is contained in:
parent
6abdde3ce5
commit
c739e03748
17 changed files with 2694 additions and 2355 deletions
|
|
@ -869,6 +869,30 @@ bool Builder::isSpecConstantOpCode(Op opcode) const
|
|||
}
|
||||
}
|
||||
|
||||
Id Builder::makeNullConstant(Id typeId)
|
||||
{
|
||||
Instruction* constant;
|
||||
|
||||
// See if we already made it.
|
||||
Id existing = NoResult;
|
||||
for (int i = 0; i < (int)nullConstants.size(); ++i) {
|
||||
constant = nullConstants[i];
|
||||
if (constant->getTypeId() == typeId)
|
||||
existing = constant->getResultId();
|
||||
}
|
||||
|
||||
if (existing != NoResult)
|
||||
return existing;
|
||||
|
||||
// Make it
|
||||
Instruction* c = new Instruction(getUniqueId(), typeId, OpConstantNull);
|
||||
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(c));
|
||||
nullConstants.push_back(c);
|
||||
module.mapInstruction(c);
|
||||
|
||||
return c->getResultId();
|
||||
}
|
||||
|
||||
Id Builder::makeBoolConstant(bool b, bool specConstant)
|
||||
{
|
||||
Id typeId = makeBoolType();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue