diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2023-10-23 16:33:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-23 16:33:24 +0200 |
commit | da5c49f22d5c8308aa751e7702e1b64e18b833da (patch) | |
tree | 80a920d7f29d5885744852670c607e50eabf9631 | |
parent | Merge pull request #11854 from german77/vibration-ui (diff) | |
parent | emit_glsl_warp: Fix shfl_in_bounds conditional (diff) | |
download | yuzu-da5c49f22d5c8308aa751e7702e1b64e18b833da.tar yuzu-da5c49f22d5c8308aa751e7702e1b64e18b833da.tar.gz yuzu-da5c49f22d5c8308aa751e7702e1b64e18b833da.tar.bz2 yuzu-da5c49f22d5c8308aa751e7702e1b64e18b833da.tar.lz yuzu-da5c49f22d5c8308aa751e7702e1b64e18b833da.tar.xz yuzu-da5c49f22d5c8308aa751e7702e1b64e18b833da.tar.zst yuzu-da5c49f22d5c8308aa751e7702e1b64e18b833da.zip |
-rw-r--r-- | src/shader_recompiler/backend/glsl/emit_glsl.cpp | 1 | ||||
-rw-r--r-- | src/shader_recompiler/backend/glsl/emit_glsl_warp.cpp | 12 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl.cpp b/src/shader_recompiler/backend/glsl/emit_glsl.cpp index d91e04446..66ecfc9f7 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl.cpp @@ -242,6 +242,7 @@ std::string EmitGLSL(const Profile& profile, const RuntimeInfo& runtime_info, IR } if (program.info.uses_subgroup_shuffles) { ctx.header += "bool shfl_in_bounds;"; + ctx.header += "uint shfl_result;"; } ctx.code.insert(0, ctx.header); ctx.code += '}'; diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_warp.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_warp.cpp index 1245c9429..f9be5de1c 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_warp.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_warp.cpp @@ -141,7 +141,8 @@ void EmitShuffleIndex(EmitContext& ctx, IR::Inst& inst, std::string_view value, const auto src_thread_id{fmt::format("({})|({})", lhs, min_thread_id)}; ctx.Add("shfl_in_bounds=int({})<=int({});", src_thread_id, max_thread_id); SetInBoundsFlag(ctx, inst); - ctx.AddU32("{}=shfl_in_bounds?readInvocationARB({},{}):{};", inst, value, src_thread_id, value); + ctx.Add("shfl_result=readInvocationARB({},{});", value, src_thread_id); + ctx.AddU32("{}=shfl_in_bounds?shfl_result:{};", inst, value); } void EmitShuffleUp(EmitContext& ctx, IR::Inst& inst, std::string_view value, std::string_view index, @@ -158,7 +159,8 @@ void EmitShuffleUp(EmitContext& ctx, IR::Inst& inst, std::string_view value, std const auto src_thread_id{fmt::format("({}-{})", THREAD_ID, index)}; ctx.Add("shfl_in_bounds=int({})>=int({});", src_thread_id, max_thread_id); SetInBoundsFlag(ctx, inst); - ctx.AddU32("{}=shfl_in_bounds?readInvocationARB({},{}):{};", inst, value, src_thread_id, value); + ctx.Add("shfl_result=readInvocationARB({},{});", value, src_thread_id); + ctx.AddU32("{}=shfl_in_bounds?shfl_result:{};", inst, value); } void EmitShuffleDown(EmitContext& ctx, IR::Inst& inst, std::string_view value, @@ -175,7 +177,8 @@ void EmitShuffleDown(EmitContext& ctx, IR::Inst& inst, std::string_view value, const auto src_thread_id{fmt::format("({}+{})", THREAD_ID, index)}; ctx.Add("shfl_in_bounds=int({})<=int({});", src_thread_id, max_thread_id); SetInBoundsFlag(ctx, inst); - ctx.AddU32("{}=shfl_in_bounds?readInvocationARB({},{}):{};", inst, value, src_thread_id, value); + ctx.Add("shfl_result=readInvocationARB({},{});", value, src_thread_id); + ctx.AddU32("{}=shfl_in_bounds?shfl_result:{};", inst, value); } void EmitShuffleButterfly(EmitContext& ctx, IR::Inst& inst, std::string_view value, @@ -193,7 +196,8 @@ void EmitShuffleButterfly(EmitContext& ctx, IR::Inst& inst, std::string_view val const auto src_thread_id{fmt::format("({}^{})", THREAD_ID, index)}; ctx.Add("shfl_in_bounds=int({})<=int({});", src_thread_id, max_thread_id); SetInBoundsFlag(ctx, inst); - ctx.AddU32("{}=shfl_in_bounds?readInvocationARB({},{}):{};", inst, value, src_thread_id, value); + ctx.Add("shfl_result=readInvocationARB({},{});", value, src_thread_id); + ctx.AddU32("{}=shfl_in_bounds?shfl_result:{};", inst, value); } void EmitFSwizzleAdd(EmitContext& ctx, IR::Inst& inst, std::string_view op_a, std::string_view op_b, |