mirror of
https://git.suyu.dev/suyu/sirit.git
synced 2024-12-22 12:12:05 +00:00
Add OpVectorExtractDynamic and OpVectorInsertDynamic
This commit is contained in:
parent
60a856d266
commit
4a0c6e03e1
2 changed files with 21 additions and 0 deletions
|
@ -285,6 +285,12 @@ public:
|
||||||
return OpAccessChain(result_type, base, {indexes...});
|
return OpAccessChain(result_type, base, {indexes...});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Extract a single, dynamically selected, component of a vector.
|
||||||
|
Id OpVectorExtractDynamic(Id result_type, Id vector, Id index);
|
||||||
|
|
||||||
|
/// Make a copy of a vector, with a single, variably selected, component modified.
|
||||||
|
Id OpVectorInsertDynamic(Id result_type, Id vector, Id component, Id index);
|
||||||
|
|
||||||
/// Make a copy of a composite object, while modifying one part of it.
|
/// Make a copy of a composite object, while modifying one part of it.
|
||||||
Id OpCompositeInsert(Id result_type, Id object, Id composite,
|
Id OpCompositeInsert(Id result_type, Id object, Id composite,
|
||||||
const std::vector<Literal>& indexes = {});
|
const std::vector<Literal>& indexes = {});
|
||||||
|
|
|
@ -46,6 +46,21 @@ Id Module::OpAccessChain(Id result_type, Id base, const std::vector<Id>& indexes
|
||||||
return AddCode(std::move(op));
|
return AddCode(std::move(op));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Id Module::OpVectorExtractDynamic(Id result_type, Id vector, Id index) {
|
||||||
|
auto op{std::make_unique<Op>(spv::Op::OpVectorExtractDynamic, bound++, result_type)};
|
||||||
|
op->Add(vector);
|
||||||
|
op->Add(index);
|
||||||
|
return AddCode(std::move(op));
|
||||||
|
}
|
||||||
|
|
||||||
|
Id Module::OpVectorInsertDynamic(Id result_type, Id vector, Id component, Id index) {
|
||||||
|
auto op{std::make_unique<Op>(spv::Op::OpVectorInsertDynamic, bound++, result_type)};
|
||||||
|
op->Add(vector);
|
||||||
|
op->Add(component);
|
||||||
|
op->Add(index);
|
||||||
|
return AddCode(std::move(op));
|
||||||
|
}
|
||||||
|
|
||||||
Id Module::OpCompositeInsert(Id result_type, Id object, Id composite,
|
Id Module::OpCompositeInsert(Id result_type, Id object, Id composite,
|
||||||
const std::vector<Literal>& indexes) {
|
const std::vector<Literal>& indexes) {
|
||||||
auto op{std::make_unique<Op>(spv::Op::OpCompositeInsert, bound++, result_type)};
|
auto op{std::make_unique<Op>(spv::Op::OpCompositeInsert, bound++, result_type)};
|
||||||
|
|
Loading…
Reference in a new issue