diff options
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_glsl_warp.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/glsl/emit_glsl_warp.cpp | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_warp.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_warp.cpp index e462c977c..8a018acb5 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_warp.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_warp.cpp | |||
| @@ -42,31 +42,42 @@ void EmitLaneId([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& in | |||
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | void EmitVoteAll(EmitContext& ctx, IR::Inst& inst, std::string_view pred) { | 44 | void EmitVoteAll(EmitContext& ctx, IR::Inst& inst, std::string_view pred) { |
| 45 | ctx.AddU1("{}=allInvocationsEqualARB({});", inst, pred); | 45 | if (!ctx.profile.warp_size_potentially_larger_than_guest) { |
| 46 | // TODO: | 46 | ctx.AddU1("{}=allInvocationsEqualARB({});", inst, pred); |
| 47 | // if (ctx.profile.warp_size_potentially_larger_than_guest) { | 47 | } else { |
| 48 | // } | 48 | const auto active_mask{fmt::format("uvec2(ballotARB(true))[gl_SubgroupInvocationID]")}; |
| 49 | const auto ballot{fmt::format("uvec2(ballotARB({}))[gl_SubgroupInvocationID]", pred)}; | ||
| 50 | ctx.AddU1("{}=({}&{})=={};", inst, ballot, active_mask, active_mask); | ||
| 51 | } | ||
| 49 | } | 52 | } |
| 50 | 53 | ||
| 51 | void EmitVoteAny(EmitContext& ctx, IR::Inst& inst, std::string_view pred) { | 54 | void EmitVoteAny(EmitContext& ctx, IR::Inst& inst, std::string_view pred) { |
| 52 | ctx.AddU1("{}=anyInvocationARB({});", inst, pred); | 55 | if (!ctx.profile.warp_size_potentially_larger_than_guest) { |
| 53 | // TODO: | 56 | ctx.AddU1("{}=anyInvocationARB({});", inst, pred); |
| 54 | // if (ctx.profile.warp_size_potentially_larger_than_guest) { | 57 | } else { |
| 55 | // } | 58 | const auto active_mask{fmt::format("uvec2(ballotARB(true))[gl_SubgroupInvocationID]")}; |
| 59 | const auto ballot{fmt::format("uvec2(ballotARB({}))[gl_SubgroupInvocationID]", pred)}; | ||
| 60 | ctx.AddU1("{}=({}&{})!=0u;", inst, ballot, active_mask, active_mask); | ||
| 61 | } | ||
| 56 | } | 62 | } |
| 57 | 63 | ||
| 58 | void EmitVoteEqual(EmitContext& ctx, IR::Inst& inst, std::string_view pred) { | 64 | void EmitVoteEqual(EmitContext& ctx, IR::Inst& inst, std::string_view pred) { |
| 59 | ctx.AddU1("{}=allInvocationsEqualARB({});", inst, pred); | 65 | if (!ctx.profile.warp_size_potentially_larger_than_guest) { |
| 60 | // TODO: | 66 | ctx.AddU1("{}=allInvocationsEqualARB({});", inst, pred); |
| 61 | // if (ctx.profile.warp_size_potentially_larger_than_guest) { | 67 | } else { |
| 62 | // } | 68 | const auto active_mask{fmt::format("uvec2(ballotARB(true))[gl_SubgroupInvocationID]")}; |
| 69 | const auto ballot{fmt::format("uvec2(ballotARB({}))[gl_SubgroupInvocationID]", pred)}; | ||
| 70 | const auto value{fmt::format("({}^{})", ballot, active_mask)}; | ||
| 71 | ctx.AddU1("{}=({}==0)||({}=={});", inst, value, value, active_mask); | ||
| 72 | } | ||
| 63 | } | 73 | } |
| 64 | 74 | ||
| 65 | void EmitSubgroupBallot(EmitContext& ctx, IR::Inst& inst, std::string_view pred) { | 75 | void EmitSubgroupBallot(EmitContext& ctx, IR::Inst& inst, std::string_view pred) { |
| 66 | ctx.AddU32("{}=uvec2(ballotARB({})).x;", inst, pred); | 76 | if (!ctx.profile.warp_size_potentially_larger_than_guest) { |
| 67 | // TODO: | 77 | ctx.AddU32("{}=uvec2(ballotARB({})).x;", inst, pred); |
| 68 | // if (ctx.profile.warp_size_potentially_larger_than_guest) { | 78 | } else { |
| 69 | // } | 79 | ctx.AddU32("{}=uvec2(ballotARB({}))[gl_SubgroupInvocationID];", inst, pred); |
| 80 | } | ||
| 70 | } | 81 | } |
| 71 | 82 | ||
| 72 | void EmitSubgroupEqMask(EmitContext& ctx, IR::Inst& inst) { | 83 | void EmitSubgroupEqMask(EmitContext& ctx, IR::Inst& inst) { |