1
0
Fork 0
mirror of https://git.suyu.dev/suyu/sirit.git synced 2024-12-22 12:12:05 +00:00

memory: Add OpImageTexelPointer

This commit is contained in:
ReinUsesLisp 2020-06-02 02:13:37 -03:00
parent a62c5bbc10
commit eefca56afd
2 changed files with 11 additions and 0 deletions

View file

@ -284,6 +284,9 @@ public:
/// Allocate an object in memory, resulting in a copy to it. /// Allocate an object in memory, resulting in a copy to it.
Id OpVariable(Id result_type, spv::StorageClass storage_class, Id initializer = nullptr); Id OpVariable(Id result_type, spv::StorageClass storage_class, Id initializer = nullptr);
/// Form a pointer to a texel of an image. Use of such a pointer is limited to atomic operations.
Id OpImageTexelPointer(Id result_type, Id image, Id coordinate, Id sample);
/// Load through a pointer. /// Load through a pointer.
Id OpLoad(Id result_type, Id pointer, std::optional<spv::MemoryAccessMask> memory_access = {}); Id OpLoad(Id result_type, Id pointer, std::optional<spv::MemoryAccessMask> memory_access = {});

View file

@ -19,6 +19,14 @@ Id Module::OpVariable(Id result_type, spv::StorageClass storage_class, Id initia
return code_store.emplace_back(std::move(op)).get(); return code_store.emplace_back(std::move(op)).get();
} }
Id Module::OpImageTexelPointer(Id result_type, Id image, Id coordinate, Id sample) {
auto op{std::make_unique<Op>(spv::Op::OpImageTexelPointer, bound++, result_type)};
op->Add(image);
op->Add(coordinate);
op->Add(sample);
return AddCode(std::move(op));
}
Id Module::OpLoad(Id result_type, Id pointer, std::optional<spv::MemoryAccessMask> memory_access) { Id Module::OpLoad(Id result_type, Id pointer, std::optional<spv::MemoryAccessMask> memory_access) {
auto op{std::make_unique<Op>(spv::Op::OpLoad, bound++, result_type)}; auto op{std::make_unique<Op>(spv::Op::OpLoad, bound++, result_type)};
op->Add(pointer); op->Add(pointer);