mirror of
https://github.com/yuzu-emu/sirit
synced 2024-11-22 14:53:41 +00:00
Add OpConstantComposite
This commit is contained in:
parent
48cbe695f0
commit
765c8833c4
3 changed files with 13 additions and 0 deletions
|
@ -132,6 +132,9 @@ public:
|
||||||
/// Returns a numeric scalar constant.
|
/// Returns a numeric scalar constant.
|
||||||
const Op* Constant(const Op* result_type, Operand* literal);
|
const Op* Constant(const Op* result_type, Operand* literal);
|
||||||
|
|
||||||
|
/// Returns a numeric scalar constant.
|
||||||
|
const Op* ConstantComposite(const Op* result_type, const std::vector<const Op*>& constituents);
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
|
|
||||||
/// Emits a function.
|
/// Emits a function.
|
||||||
|
|
|
@ -24,4 +24,11 @@ const Op* Module::Constant(const Op* result_type, Operand* literal) {
|
||||||
return AddDeclaration(op);
|
return AddDeclaration(op);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Op* Module::ConstantComposite(const Op* result_type,
|
||||||
|
const std::vector<const Op*>& constituents) {
|
||||||
|
Op* op{new Op(spv::Op::OpConstantComposite, bound, result_type)};
|
||||||
|
op->Add(constituents);
|
||||||
|
return AddDeclaration(op);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Sirit
|
} // namespace Sirit
|
||||||
|
|
|
@ -48,6 +48,9 @@ public:
|
||||||
Constant(TypeInt(32, false), Literal(30u));
|
Constant(TypeInt(32, false), Literal(30u));
|
||||||
Constant(TypeInt(16, false), Literal(30u));
|
Constant(TypeInt(16, false), Literal(30u));
|
||||||
Constant(TypeInt(8, false), Literal(30u));
|
Constant(TypeInt(8, false), Literal(30u));
|
||||||
|
ConstantComposite(TypeVector(TypeFloat(32), 2),
|
||||||
|
{Constant(TypeFloat(32), Literal(50.0f)),
|
||||||
|
Constant(TypeFloat(32), Literal(50.0f))});
|
||||||
|
|
||||||
auto main_type{TypeFunction(TypeVoid())};
|
auto main_type{TypeFunction(TypeVoid())};
|
||||||
auto main_func{Emit(Function(TypeVoid(), spv::FunctionControlMask::MaskNone, main_type))};
|
auto main_func{Emit(Function(TypeVoid(), spv::FunctionControlMask::MaskNone, main_type))};
|
||||||
|
|
Loading…
Reference in a new issue