mirror of
https://github.com/yuzu-emu/sirit.git
synced 2024-11-25 18:45:38 +01:00
Add OpStore
This commit is contained in:
parent
93c17d11f9
commit
80b0757ab6
@ -204,11 +204,19 @@ class Module {
|
|||||||
Ref Load(Ref result_type, Ref pointer,
|
Ref Load(Ref result_type, Ref pointer,
|
||||||
std::optional<spv::MemoryAccessMask> memory_access = {});
|
std::optional<spv::MemoryAccessMask> memory_access = {});
|
||||||
|
|
||||||
|
/// Store through a pointer.
|
||||||
|
Ref Store(Ref pointer, Ref object,
|
||||||
|
std::optional<spv::MemoryAccessMask> memory_access = {});
|
||||||
|
|
||||||
/// Create a pointer into a composite object that can be used with OpLoad
|
/// Create a pointer into a composite object that can be used with OpLoad
|
||||||
/// and OpStore.
|
/// and OpStore.
|
||||||
Ref AccessChain(Ref result_type, Ref base,
|
Ref AccessChain(Ref result_type, Ref base,
|
||||||
const std::vector<Ref>& indexes = {});
|
const std::vector<Ref>& indexes = {});
|
||||||
|
|
||||||
|
/// Make a copy of a composite object, while modifying one part of it.
|
||||||
|
Ref CompositeInsert(Ref result_type, Ref object, Ref composite,
|
||||||
|
const std::vector<Literal>& indexes = {});
|
||||||
|
|
||||||
// Annotation
|
// Annotation
|
||||||
|
|
||||||
/// Add a decoration to target.
|
/// Add a decoration to target.
|
||||||
|
@ -30,6 +30,17 @@ Ref Module::Load(Ref result_type, Ref pointer,
|
|||||||
return AddCode(op);
|
return AddCode(op);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ref Module::Store(Ref pointer, Ref object,
|
||||||
|
std::optional<spv::MemoryAccessMask> memory_access) {
|
||||||
|
auto op{new Op(spv::Op::OpStore)};
|
||||||
|
op->Add(pointer);
|
||||||
|
op->Add(object);
|
||||||
|
if (memory_access) {
|
||||||
|
AddEnum(op, *memory_access);
|
||||||
|
}
|
||||||
|
return AddCode(op);
|
||||||
|
}
|
||||||
|
|
||||||
Ref Module::AccessChain(Ref result_type, Ref base,
|
Ref Module::AccessChain(Ref result_type, Ref base,
|
||||||
const std::vector<Ref>& indexes) {
|
const std::vector<Ref>& indexes) {
|
||||||
assert(indexes.size() > 0);
|
assert(indexes.size() > 0);
|
||||||
@ -39,4 +50,13 @@ Ref Module::AccessChain(Ref result_type, Ref base,
|
|||||||
return AddCode(op);
|
return AddCode(op);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ref Module::CompositeInsert(Ref result_type, Ref object, Ref composite,
|
||||||
|
const std::vector<Literal>& indexes) {
|
||||||
|
auto op{new Op(spv::Op::OpCompositeInsert, bound++, result_type)};
|
||||||
|
op->Add(object);
|
||||||
|
op->Add(composite);
|
||||||
|
op->Add(indexes);
|
||||||
|
return AddCode(op);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Sirit
|
} // namespace Sirit
|
||||||
|
Loading…
Reference in New Issue
Block a user