mirror of
https://github.com/yuzu-emu/sirit.git
synced 2024-11-22 12:55:40 +01:00
Add OpAccessChain
This commit is contained in:
parent
00fc8daf56
commit
97825750a3
@ -200,6 +200,11 @@ class Module {
|
|||||||
Ref Variable(Ref result_type, spv::StorageClass storage_class,
|
Ref Variable(Ref result_type, spv::StorageClass storage_class,
|
||||||
Ref initializer = nullptr);
|
Ref initializer = nullptr);
|
||||||
|
|
||||||
|
/// Create a pointer into a composite object that can be used with OpLoad
|
||||||
|
/// and OpStore.
|
||||||
|
Ref AccessChain(Ref result_type, Ref base,
|
||||||
|
const std::vector<Ref>& indexes = {});
|
||||||
|
|
||||||
// Annotation
|
// Annotation
|
||||||
|
|
||||||
/// Add a decoration to target.
|
/// Add a decoration to target.
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "insts.h"
|
#include "insts.h"
|
||||||
#include "sirit/sirit.h"
|
#include "sirit/sirit.h"
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
namespace Sirit {
|
namespace Sirit {
|
||||||
|
|
||||||
@ -19,4 +20,13 @@ Ref Module::Variable(Ref result_type, spv::StorageClass storage_class,
|
|||||||
return AddCode(op);
|
return AddCode(op);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ref Module::AccessChain(Ref result_type, Ref base,
|
||||||
|
const std::vector<Ref>& indexes) {
|
||||||
|
assert(indexes.size() > 0);
|
||||||
|
auto op{new Op(spv::Op::OpAccessChain, bound++, result_type)};
|
||||||
|
op->Add(base);
|
||||||
|
op->Add(indexes);
|
||||||
|
return AddCode(op);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Sirit
|
} // namespace Sirit
|
||||||
|
Loading…
Reference in New Issue
Block a user