diff options
author | Billy Laws <blaws05@gmail.com> | 2023-02-18 19:26:47 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2023-06-03 09:05:31 +0200 |
commit | b4a12b889ee0182bbe05423933b122fd9e78b132 (patch) | |
tree | 4b5ea3367401213d28b3c48994fce7140a339044 /src/shader_recompiler/backend/spirv | |
parent | Implement scaled vertex buffer format emulation (diff) | |
download | yuzu-b4a12b889ee0182bbe05423933b122fd9e78b132.tar yuzu-b4a12b889ee0182bbe05423933b122fd9e78b132.tar.gz yuzu-b4a12b889ee0182bbe05423933b122fd9e78b132.tar.bz2 yuzu-b4a12b889ee0182bbe05423933b122fd9e78b132.tar.lz yuzu-b4a12b889ee0182bbe05423933b122fd9e78b132.tar.xz yuzu-b4a12b889ee0182bbe05423933b122fd9e78b132.tar.zst yuzu-b4a12b889ee0182bbe05423933b122fd9e78b132.zip |
Diffstat (limited to 'src/shader_recompiler/backend/spirv')
-rw-r--r-- | src/shader_recompiler/backend/spirv/emit_spirv_warp.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_warp.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_warp.cpp index c5db19d09..77ff8c573 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_warp.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv_warp.cpp @@ -17,7 +17,22 @@ Id GetThreadId(EmitContext& ctx) { Id WarpExtract(EmitContext& ctx, Id value) { const Id thread_id{GetThreadId(ctx)}; const Id local_index{ctx.OpShiftRightArithmetic(ctx.U32[1], thread_id, ctx.Const(5U))}; - return ctx.OpVectorExtractDynamic(ctx.U32[1], value, local_index); + if (ctx.profile.has_broken_spirv_subgroup_mask_vector_extract_dynamic) { + const Id c0_sel{ctx.OpSelect(ctx.U32[1], ctx.OpIEqual(ctx.U1, local_index, ctx.Const(0U)), + ctx.OpCompositeExtract(ctx.U32[1], value, 0U), ctx.Const(0U))}; + const Id c1_sel{ctx.OpSelect(ctx.U32[1], ctx.OpIEqual(ctx.U1, local_index, ctx.Const(1U)), + ctx.OpCompositeExtract(ctx.U32[1], value, 1U), ctx.Const(0U))}; + const Id c2_sel{ctx.OpSelect(ctx.U32[1], ctx.OpIEqual(ctx.U1, local_index, ctx.Const(2U)), + ctx.OpCompositeExtract(ctx.U32[1], value, 2U), ctx.Const(0U))}; + const Id c3_sel{ctx.OpSelect(ctx.U32[1], ctx.OpIEqual(ctx.U1, local_index, ctx.Const(3U)), + ctx.OpCompositeExtract(ctx.U32[1], value, 3U), ctx.Const(0U))}; + const Id c0_or_c1{ctx.OpBitwiseOr(ctx.U32[1], c0_sel, c1_sel)}; + const Id c2_or_c3{ctx.OpBitwiseOr(ctx.U32[1], c2_sel, c3_sel)}; + const Id c0_or_c1_or_c2_or_c3{ctx.OpBitwiseOr(ctx.U32[1], c0_or_c1, c2_or_c3)}; + return c0_or_c1_or_c2_or_c3; + } else { + return ctx.OpVectorExtractDynamic(ctx.U32[1], value, local_index); + } } Id LoadMask(EmitContext& ctx, Id mask) { |