shader: Implement SR_THREAD_KILL
This commit is contained in:
parent
c9337a4ae4
commit
5c61e860e4
10 changed files with 22 additions and 0 deletions
|
@ -347,6 +347,10 @@ U32 IREmitter::LocalInvocationIdZ() {
|
|||
return U32{CompositeExtract(Inst(Opcode::LocalInvocationId), 2)};
|
||||
}
|
||||
|
||||
U1 IREmitter::IsHelperInvocation() {
|
||||
return Inst<U1>(Opcode::IsHelperInvocation);
|
||||
}
|
||||
|
||||
U32 IREmitter::LaneId() {
|
||||
return Inst<U32>(Opcode::LaneId);
|
||||
}
|
||||
|
|
|
@ -90,6 +90,8 @@ public:
|
|||
[[nodiscard]] U32 LocalInvocationIdY();
|
||||
[[nodiscard]] U32 LocalInvocationIdZ();
|
||||
|
||||
[[nodiscard]] U1 IsHelperInvocation();
|
||||
|
||||
[[nodiscard]] U32 LaneId();
|
||||
|
||||
[[nodiscard]] U32 LoadGlobalU8(const U64& address);
|
||||
|
|
|
@ -58,6 +58,7 @@ OPCODE(SetCFlag, Void, U1,
|
|||
OPCODE(SetOFlag, Void, U1, )
|
||||
OPCODE(WorkgroupId, U32x3, )
|
||||
OPCODE(LocalInvocationId, U32x3, )
|
||||
OPCODE(IsHelperInvocation, U1, )
|
||||
|
||||
// Undefined
|
||||
OPCODE(UndefU1, U1, )
|
||||
|
|
|
@ -113,6 +113,8 @@ enum class SpecialRegister : u64 {
|
|||
|
||||
[[nodiscard]] IR::U32 Read(IR::IREmitter& ir, SpecialRegister special_register) {
|
||||
switch (special_register) {
|
||||
case SpecialRegister::SR_THREAD_KILL:
|
||||
return IR::U32{ir.Select(ir.IsHelperInvocation(), ir.Imm32(-1), ir.Imm32(0))};
|
||||
case SpecialRegister::SR_TID_X:
|
||||
return ir.LocalInvocationIdX();
|
||||
case SpecialRegister::SR_TID_Y:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue