Add OpConstantNull

This commit is contained in:
ReinUsesLisp 2018-08-28 04:46:18 -03:00
parent 42c456f24f
commit a582641b99
3 changed files with 8 additions and 1 deletions

View file

@ -141,6 +141,9 @@ public:
Ref ConstantSampler(Ref result_type, spv::SamplerAddressingMode addressing_mode,
bool normalized, spv::SamplerFilterMode filter_mode);
/// Returns a null constant value.
Ref ConstantNull(Ref result_type);
// Function
/// Declares a function.

View file

@ -41,4 +41,8 @@ Ref Module::ConstantSampler(Ref result_type, spv::SamplerAddressingMode addressi
return AddDeclaration(op);
}
Ref Module::ConstantNull(Ref result_type) {
return AddDeclaration(new Op(spv::Op::OpConstantNull, bound, result_type));
}
} // namespace Sirit

View file

@ -40,7 +40,6 @@ public:
ConstantTrue(TypeBool());
ConstantTrue(TypeBool());
ConstantFalse(TypeBool());
Constant(TypeFloat(64), Literal(6342.2));
Constant(TypeFloat(64), Literal(6342.21));
Constant(TypeFloat(32), Literal(6342.21f));
Constant(TypeFloat(16), Literal(30u));
@ -50,6 +49,7 @@ public:
ConstantComposite(TypeVector(TypeFloat(32), 2),
{Constant(TypeFloat(32), Literal(50.0f)),
Constant(TypeFloat(32), Literal(50.0f))});
ConstantNull(TypeVector(TypeInt(64, false), 4));
auto main_type{TypeFunction(TypeVoid())};
auto main_func{Emit(Function(TypeVoid(), spv::FunctionControlMask::MaskNone, main_type))};