shader: Implement MEMBAR
This commit is contained in:
parent
ecb30c9072
commit
655f7a570a
9 changed files with 121 additions and 11 deletions
|
@ -82,6 +82,10 @@ void IREmitter::SelectionMerge(Block* merge_block) {
|
|||
Inst(Opcode::SelectionMerge, merge_block);
|
||||
}
|
||||
|
||||
void IREmitter::MemoryBarrier(BarrierInstInfo info) {
|
||||
Inst(Opcode::MemoryBarrier, Flags{info});
|
||||
}
|
||||
|
||||
void IREmitter::Return() {
|
||||
block->SetReturn();
|
||||
Inst(Opcode::Return);
|
||||
|
|
|
@ -136,6 +136,8 @@ public:
|
|||
[[nodiscard]] Value Select(const U1& condition, const Value& true_value,
|
||||
const Value& false_value);
|
||||
|
||||
[[nodiscard]] void MemoryBarrier(BarrierInstInfo info);
|
||||
|
||||
template <typename Dest, typename Source>
|
||||
[[nodiscard]] Dest BitCast(const Source& value);
|
||||
|
||||
|
|
|
@ -25,6 +25,14 @@ enum class FpRounding : u8 {
|
|||
RZ, // Round towards zero
|
||||
};
|
||||
|
||||
enum class MemoryScope : u32 {
|
||||
DontCare,
|
||||
Warp,
|
||||
Workgroup,
|
||||
Device,
|
||||
System
|
||||
};
|
||||
|
||||
struct FpControl {
|
||||
bool no_contraction{false};
|
||||
FpRounding rounding{FpRounding::DontCare};
|
||||
|
@ -32,6 +40,11 @@ struct FpControl {
|
|||
};
|
||||
static_assert(sizeof(FpControl) <= sizeof(u32));
|
||||
|
||||
union BarrierInstInfo {
|
||||
u32 raw;
|
||||
BitField<0, 3, MemoryScope> scope;
|
||||
};
|
||||
|
||||
union TextureInstInfo {
|
||||
u32 raw;
|
||||
BitField<0, 8, TextureType> type;
|
||||
|
|
|
@ -16,6 +16,9 @@ OPCODE(Return, Void,
|
|||
OPCODE(Unreachable, Void, )
|
||||
OPCODE(DemoteToHelperInvocation, Void, Label, )
|
||||
|
||||
// Barriers
|
||||
OPCODE(MemoryBarrier, Void, )
|
||||
|
||||
// Special operations
|
||||
OPCODE(Prologue, Void, )
|
||||
OPCODE(Epilogue, Void, )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue