diff options
| author | 2021-04-11 19:16:12 -0300 | |
|---|---|---|
| committer | 2021-07-22 21:51:27 -0400 | |
| commit | 5c61e860e4f83524ffce10ca447398e83de81640 (patch) | |
| tree | ff19c70e70170715c1de763d9674bf35d4aa5c42 /src/shader_recompiler/backend/spirv | |
| parent | shader: Apply sign bit in FCMP (imm) (diff) | |
| download | yuzu-5c61e860e4f83524ffce10ca447398e83de81640.tar.gz yuzu-5c61e860e4f83524ffce10ca447398e83de81640.tar.xz yuzu-5c61e860e4f83524ffce10ca447398e83de81640.zip | |
shader: Implement SR_THREAD_KILL
Diffstat (limited to 'src/shader_recompiler/backend/spirv')
4 files changed, 9 insertions, 0 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_context.cpp b/src/shader_recompiler/backend/spirv/emit_context.cpp index e5d83e9b4..bf2210899 100644 --- a/src/shader_recompiler/backend/spirv/emit_context.cpp +++ b/src/shader_recompiler/backend/spirv/emit_context.cpp | |||
| @@ -790,6 +790,9 @@ void EmitContext::DefineInputs(const Info& info) { | |||
| 790 | if (info.uses_local_invocation_id) { | 790 | if (info.uses_local_invocation_id) { |
| 791 | local_invocation_id = DefineInput(*this, U32[3], spv::BuiltIn::LocalInvocationId); | 791 | local_invocation_id = DefineInput(*this, U32[3], spv::BuiltIn::LocalInvocationId); |
| 792 | } | 792 | } |
| 793 | if (info.uses_is_helper_invocation) { | ||
| 794 | is_helper_invocation = DefineInput(*this, U1, spv::BuiltIn::HelperInvocation); | ||
| 795 | } | ||
| 793 | if (info.uses_subgroup_mask) { | 796 | if (info.uses_subgroup_mask) { |
| 794 | subgroup_mask_eq = DefineInput(*this, U32[4], spv::BuiltIn::SubgroupEqMaskKHR); | 797 | subgroup_mask_eq = DefineInput(*this, U32[4], spv::BuiltIn::SubgroupEqMaskKHR); |
| 795 | subgroup_mask_lt = DefineInput(*this, U32[4], spv::BuiltIn::SubgroupLtMaskKHR); | 798 | subgroup_mask_lt = DefineInput(*this, U32[4], spv::BuiltIn::SubgroupLtMaskKHR); |
diff --git a/src/shader_recompiler/backend/spirv/emit_context.h b/src/shader_recompiler/backend/spirv/emit_context.h index 34f38454f..98a9140bf 100644 --- a/src/shader_recompiler/backend/spirv/emit_context.h +++ b/src/shader_recompiler/backend/spirv/emit_context.h | |||
| @@ -107,6 +107,7 @@ public: | |||
| 107 | 107 | ||
| 108 | Id workgroup_id{}; | 108 | Id workgroup_id{}; |
| 109 | Id local_invocation_id{}; | 109 | Id local_invocation_id{}; |
| 110 | Id is_helper_invocation{}; | ||
| 110 | Id subgroup_local_invocation_id{}; | 111 | Id subgroup_local_invocation_id{}; |
| 111 | Id subgroup_mask_eq{}; | 112 | Id subgroup_mask_eq{}; |
| 112 | Id subgroup_mask_lt{}; | 113 | Id subgroup_mask_lt{}; |
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv.h b/src/shader_recompiler/backend/spirv/emit_spirv.h index a3398a605..04340fa70 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv.h +++ b/src/shader_recompiler/backend/spirv/emit_spirv.h | |||
| @@ -65,6 +65,7 @@ void EmitSetCFlag(EmitContext& ctx); | |||
| 65 | void EmitSetOFlag(EmitContext& ctx); | 65 | 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 EmitIsHelperInvocation(EmitContext& ctx); | ||
| 68 | Id EmitLoadLocal(EmitContext& ctx, Id word_offset); | 69 | Id EmitLoadLocal(EmitContext& ctx, Id word_offset); |
| 69 | void EmitWriteLocal(EmitContext& ctx, Id word_offset, Id value); | 70 | void EmitWriteLocal(EmitContext& ctx, Id word_offset, Id value); |
| 70 | Id EmitUndefU1(EmitContext& ctx); | 71 | Id EmitUndefU1(EmitContext& ctx); |
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 5dc150ce2..d552a1b52 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,6 +274,10 @@ 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 EmitIsHelperInvocation(EmitContext& ctx) { | ||
| 278 | return ctx.OpLoad(ctx.U1, ctx.is_helper_invocation); | ||
| 279 | } | ||
| 280 | |||
| 277 | Id EmitLoadLocal(EmitContext& ctx, Id word_offset) { | 281 | Id EmitLoadLocal(EmitContext& ctx, Id word_offset) { |
| 278 | const Id pointer{ctx.OpAccessChain(ctx.private_u32, ctx.local_memory, word_offset)}; | 282 | const Id pointer{ctx.OpAccessChain(ctx.private_u32, ctx.local_memory, word_offset)}; |
| 279 | return ctx.OpLoad(ctx.U32[1], pointer); | 283 | return ctx.OpLoad(ctx.U32[1], pointer); |