shader: Implement SampleMask

This commit is contained in:
ReinUsesLisp 2021-04-16 18:47:26 -03:00 committed by ameerj
parent 95815a3883
commit 80940b1706
11 changed files with 22 additions and 2 deletions

View file

@ -343,6 +343,10 @@ void IREmitter::SetFragColor(u32 index, u32 component, const F32& value) {
Inst(Opcode::SetFragColor, Imm32(index), Imm32(component), value);
}
void IREmitter::SetSampleMask(const U32& value) {
Inst(Opcode::SetSampleMask, value);
}
void IREmitter::SetFragDepth(const F32& value) {
Inst(Opcode::SetFragDepth, value);
}

View file

@ -88,6 +88,7 @@ public:
void SetPatch(Patch patch, const F32& value);
void SetFragColor(u32 index, u32 component, const F32& value);
void SetSampleMask(const U32& value);
void SetFragDepth(const F32& value);
[[nodiscard]] U32 WorkgroupIdX();

View file

@ -75,6 +75,7 @@ bool Inst::MayHaveSideEffects() const noexcept {
case Opcode::SetAttributeIndexed:
case Opcode::SetPatch:
case Opcode::SetFragColor:
case Opcode::SetSampleMask:
case Opcode::SetFragDepth:
case Opcode::WriteGlobalU8:
case Opcode::WriteGlobalS8:

View file

@ -51,6 +51,7 @@ OPCODE(SetAttributeIndexed, Void, U32,
OPCODE(GetPatch, F32, Patch, )
OPCODE(SetPatch, Void, Patch, F32, )
OPCODE(SetFragColor, Void, U32, U32, F32, )
OPCODE(SetSampleMask, Void, U32, )
OPCODE(SetFragDepth, Void, F32, )
OPCODE(GetZFlag, U1, Void, )
OPCODE(GetSFlag, U1, Void, )

View file

@ -22,7 +22,7 @@ void ExitFragment(TranslatorVisitor& v) {
}
}
if (sph.ps.omap.sample_mask != 0) {
throw NotImplementedException("Sample mask");
v.ir.SetSampleMask(v.X(src_reg));
}
if (sph.ps.omap.depth != 0) {
v.ir.SetFragDepth(v.F(src_reg + 1));