diff options
Diffstat (limited to '')
5 files changed, 11 insertions, 7 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv.h b/src/shader_recompiler/backend/spirv/emit_spirv.h index a39b16f1e..12b7993ae 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv.h +++ b/src/shader_recompiler/backend/spirv/emit_spirv.h | |||
| @@ -66,7 +66,6 @@ void EmitSetOFlag(EmitContext& ctx); | |||
| 66 | Id EmitWorkgroupId(EmitContext& ctx); | 66 | Id EmitWorkgroupId(EmitContext& ctx); |
| 67 | Id EmitLocalInvocationId(EmitContext& ctx); | 67 | Id EmitLocalInvocationId(EmitContext& ctx); |
| 68 | Id EmitLoadLocal(EmitContext& ctx, Id word_offset); | 68 | Id EmitLoadLocal(EmitContext& ctx, Id word_offset); |
| 69 | Id EmitLaneId(EmitContext& ctx); | ||
| 70 | void EmitWriteLocal(EmitContext& ctx, Id word_offset, Id value); | 69 | void EmitWriteLocal(EmitContext& ctx, Id word_offset, Id value); |
| 71 | Id EmitUndefU1(EmitContext& ctx); | 70 | Id EmitUndefU1(EmitContext& ctx); |
| 72 | Id EmitUndefU8(EmitContext& ctx); | 71 | Id EmitUndefU8(EmitContext& ctx); |
| @@ -403,6 +402,7 @@ Id EmitImageGradient(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, I | |||
| 403 | Id derivates, Id offset, Id lod_clamp); | 402 | Id derivates, Id offset, Id lod_clamp); |
| 404 | Id EmitImageRead(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords); | 403 | Id EmitImageRead(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords); |
| 405 | void EmitImageWrite(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords, Id color); | 404 | void EmitImageWrite(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords, Id color); |
| 405 | Id EmitLaneId(EmitContext& ctx); | ||
| 406 | Id EmitVoteAll(EmitContext& ctx, Id pred); | 406 | Id EmitVoteAll(EmitContext& ctx, Id pred); |
| 407 | Id EmitVoteAny(EmitContext& ctx, Id pred); | 407 | Id EmitVoteAny(EmitContext& ctx, Id pred); |
| 408 | Id EmitVoteEqual(EmitContext& ctx, Id pred); | 408 | Id EmitVoteEqual(EmitContext& ctx, Id pred); |
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp index a60eca815..5dc150ce2 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp | |||
| @@ -274,10 +274,6 @@ Id EmitLocalInvocationId(EmitContext& ctx) { | |||
| 274 | return ctx.OpLoad(ctx.U32[3], ctx.local_invocation_id); | 274 | return ctx.OpLoad(ctx.U32[3], ctx.local_invocation_id); |
| 275 | } | 275 | } |
| 276 | 276 | ||
| 277 | Id EmitLaneId(EmitContext& ctx) { | ||
| 278 | return ctx.OpLoad(ctx.U32[1], ctx.subgroup_local_invocation_id); | ||
| 279 | } | ||
| 280 | |||
| 281 | Id EmitLoadLocal(EmitContext& ctx, Id word_offset) { | 277 | Id EmitLoadLocal(EmitContext& ctx, Id word_offset) { |
| 282 | const Id pointer{ctx.OpAccessChain(ctx.private_u32, ctx.local_memory, word_offset)}; | 278 | const Id pointer{ctx.OpAccessChain(ctx.private_u32, ctx.local_memory, word_offset)}; |
| 283 | return ctx.OpLoad(ctx.U32[1], pointer); | 279 | return ctx.OpLoad(ctx.U32[1], pointer); |
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_warp.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_warp.cpp index f6196653a..1c23ccc08 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_warp.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv_warp.cpp | |||
| @@ -49,6 +49,14 @@ Id SelectValue(EmitContext& ctx, Id in_range, Id value, Id src_thread_id) { | |||
| 49 | } | 49 | } |
| 50 | } // Anonymous namespace | 50 | } // Anonymous namespace |
| 51 | 51 | ||
| 52 | Id EmitLaneId(EmitContext& ctx) { | ||
| 53 | const Id id{ctx.OpLoad(ctx.U32[1], ctx.subgroup_local_invocation_id)}; | ||
| 54 | if (!ctx.profile.warp_size_potentially_larger_than_guest) { | ||
| 55 | return id; | ||
| 56 | } | ||
| 57 | return ctx.OpBitwiseAnd(ctx.U32[1], id, ctx.Constant(ctx.U32[1], 31U)); | ||
| 58 | } | ||
| 59 | |||
| 52 | Id EmitVoteAll(EmitContext& ctx, Id pred) { | 60 | Id EmitVoteAll(EmitContext& ctx, Id pred) { |
| 53 | if (!ctx.profile.warp_size_potentially_larger_than_guest) { | 61 | if (!ctx.profile.warp_size_potentially_larger_than_guest) { |
| 54 | return ctx.OpSubgroupAllKHR(ctx.U1, pred); | 62 | return ctx.OpSubgroupAllKHR(ctx.U1, pred); |
diff --git a/src/shader_recompiler/frontend/ir/opcodes.inc b/src/shader_recompiler/frontend/ir/opcodes.inc index 82c5b37ba..86ea02560 100644 --- a/src/shader_recompiler/frontend/ir/opcodes.inc +++ b/src/shader_recompiler/frontend/ir/opcodes.inc | |||
| @@ -58,7 +58,6 @@ OPCODE(SetCFlag, Void, U1, | |||
| 58 | OPCODE(SetOFlag, Void, U1, ) | 58 | OPCODE(SetOFlag, Void, U1, ) |
| 59 | OPCODE(WorkgroupId, U32x3, ) | 59 | OPCODE(WorkgroupId, U32x3, ) |
| 60 | OPCODE(LocalInvocationId, U32x3, ) | 60 | OPCODE(LocalInvocationId, U32x3, ) |
| 61 | OPCODE(LaneId, U32, ) | ||
| 62 | 61 | ||
| 63 | // Undefined | 62 | // Undefined |
| 64 | OPCODE(UndefU1, U1, ) | 63 | OPCODE(UndefU1, U1, ) |
| @@ -419,6 +418,7 @@ OPCODE(ImageRead, U32x4, U32, | |||
| 419 | OPCODE(ImageWrite, Void, U32, Opaque, U32x4, ) | 418 | OPCODE(ImageWrite, Void, U32, Opaque, U32x4, ) |
| 420 | 419 | ||
| 421 | // Warp operations | 420 | // Warp operations |
| 421 | OPCODE(LaneId, U32, ) | ||
| 422 | OPCODE(VoteAll, U1, U1, ) | 422 | OPCODE(VoteAll, U1, U1, ) |
| 423 | OPCODE(VoteAny, U1, U1, ) | 423 | OPCODE(VoteAny, U1, U1, ) |
| 424 | OPCODE(VoteEqual, U1, U1, ) | 424 | OPCODE(VoteEqual, U1, U1, ) |
diff --git a/src/shader_recompiler/ir_opt/collect_shader_info_pass.cpp b/src/shader_recompiler/ir_opt/collect_shader_info_pass.cpp index bc23b0211..8c63c9876 100644 --- a/src/shader_recompiler/ir_opt/collect_shader_info_pass.cpp +++ b/src/shader_recompiler/ir_opt/collect_shader_info_pass.cpp | |||
| @@ -343,11 +343,11 @@ void VisitUsages(Info& info, IR::Inst& inst) { | |||
| 343 | case IR::Opcode::LocalInvocationId: | 343 | case IR::Opcode::LocalInvocationId: |
| 344 | info.uses_local_invocation_id = true; | 344 | info.uses_local_invocation_id = true; |
| 345 | break; | 345 | break; |
| 346 | case IR::Opcode::LaneId: | ||
| 346 | case IR::Opcode::ShuffleIndex: | 347 | case IR::Opcode::ShuffleIndex: |
| 347 | case IR::Opcode::ShuffleUp: | 348 | case IR::Opcode::ShuffleUp: |
| 348 | case IR::Opcode::ShuffleDown: | 349 | case IR::Opcode::ShuffleDown: |
| 349 | case IR::Opcode::ShuffleButterfly: | 350 | case IR::Opcode::ShuffleButterfly: |
| 350 | case IR::Opcode::LaneId: | ||
| 351 | info.uses_subgroup_invocation_id = true; | 351 | info.uses_subgroup_invocation_id = true; |
| 352 | break; | 352 | break; |
| 353 | case IR::Opcode::GetCbufU8: | 353 | case IR::Opcode::GetCbufU8: |