diff options
Diffstat (limited to 'src/shader_recompiler/backend/glsl')
4 files changed, 64 insertions, 50 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_context.cpp b/src/shader_recompiler/backend/glsl/emit_context.cpp index 26969a26d..5456d4e5b 100644 --- a/src/shader_recompiler/backend/glsl/emit_context.cpp +++ b/src/shader_recompiler/backend/glsl/emit_context.cpp | |||
| @@ -148,6 +148,7 @@ void EmitContext::SetupExtensions(std::string&) { | |||
| 148 | if (info.uses_subgroup_invocation_id || info.uses_subgroup_mask || info.uses_subgroup_vote || | 148 | if (info.uses_subgroup_invocation_id || info.uses_subgroup_mask || info.uses_subgroup_vote || |
| 149 | info.uses_subgroup_shuffles || info.uses_fswzadd) { | 149 | info.uses_subgroup_shuffles || info.uses_fswzadd) { |
| 150 | header += "#extension GL_ARB_shader_ballot : enable\n"; | 150 | header += "#extension GL_ARB_shader_ballot : enable\n"; |
| 151 | header += "#extension GL_ARB_shader_group_vote : enable\n"; | ||
| 151 | } | 152 | } |
| 152 | } | 153 | } |
| 153 | 154 | ||
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h b/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h index 72d97c7e1..1e7247358 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h +++ b/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h | |||
| @@ -679,16 +679,16 @@ void EmitImageAtomicXor32(EmitContext& ctx, IR::Inst& inst, const IR::Value& ind | |||
| 679 | std::string_view coords, std::string_view value); | 679 | std::string_view coords, std::string_view value); |
| 680 | void EmitImageAtomicExchange32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, | 680 | void EmitImageAtomicExchange32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, |
| 681 | std::string_view coords, std::string_view value); | 681 | std::string_view coords, std::string_view value); |
| 682 | void EmitLaneId(EmitContext& ctx); | 682 | void EmitLaneId(EmitContext& ctx, IR::Inst& inst); |
| 683 | void EmitVoteAll(EmitContext& ctx, std::string_view pred); | 683 | void EmitVoteAll(EmitContext& ctx, IR::Inst& inst, std::string_view pred); |
| 684 | void EmitVoteAny(EmitContext& ctx, std::string_view pred); | 684 | void EmitVoteAny(EmitContext& ctx, IR::Inst& inst, std::string_view pred); |
| 685 | void EmitVoteEqual(EmitContext& ctx, std::string_view pred); | 685 | void EmitVoteEqual(EmitContext& ctx, IR::Inst& inst, std::string_view pred); |
| 686 | void EmitSubgroupBallot(EmitContext& ctx, std::string_view pred); | 686 | void EmitSubgroupBallot(EmitContext& ctx, IR::Inst& inst, std::string_view pred); |
| 687 | void EmitSubgroupEqMask(EmitContext& ctx); | 687 | void EmitSubgroupEqMask(EmitContext& ctx, IR::Inst& inst); |
| 688 | void EmitSubgroupLtMask(EmitContext& ctx); | 688 | void EmitSubgroupLtMask(EmitContext& ctx, IR::Inst& inst); |
| 689 | void EmitSubgroupLeMask(EmitContext& ctx); | 689 | void EmitSubgroupLeMask(EmitContext& ctx, IR::Inst& inst); |
| 690 | void EmitSubgroupGtMask(EmitContext& ctx); | 690 | void EmitSubgroupGtMask(EmitContext& ctx, IR::Inst& inst); |
| 691 | void EmitSubgroupGeMask(EmitContext& ctx); | 691 | void EmitSubgroupGeMask(EmitContext& ctx, IR::Inst& inst); |
| 692 | void EmitShuffleIndex(EmitContext& ctx, IR::Inst& inst, std::string_view value, | 692 | void EmitShuffleIndex(EmitContext& ctx, IR::Inst& inst, std::string_view value, |
| 693 | std::string_view index, std::string_view clamp, | 693 | std::string_view index, std::string_view clamp, |
| 694 | std::string_view segmentation_mask); | 694 | std::string_view segmentation_mask); |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_not_implemented.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_not_implemented.cpp index b182298b0..088c86f30 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_not_implemented.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_not_implemented.cpp | |||
| @@ -527,44 +527,4 @@ void EmitImageAtomicExchange32(EmitContext& ctx, IR::Inst& inst, const IR::Value | |||
| 527 | NotImplemented(); | 527 | NotImplemented(); |
| 528 | } | 528 | } |
| 529 | 529 | ||
| 530 | void EmitLaneId(EmitContext& ctx) { | ||
| 531 | NotImplemented(); | ||
| 532 | } | ||
| 533 | |||
| 534 | void EmitVoteAll(EmitContext& ctx, std::string_view pred) { | ||
| 535 | NotImplemented(); | ||
| 536 | } | ||
| 537 | |||
| 538 | void EmitVoteAny(EmitContext& ctx, std::string_view pred) { | ||
| 539 | NotImplemented(); | ||
| 540 | } | ||
| 541 | |||
| 542 | void EmitVoteEqual(EmitContext& ctx, std::string_view pred) { | ||
| 543 | NotImplemented(); | ||
| 544 | } | ||
| 545 | |||
| 546 | void EmitSubgroupBallot(EmitContext& ctx, std::string_view pred) { | ||
| 547 | NotImplemented(); | ||
| 548 | } | ||
| 549 | |||
| 550 | void EmitSubgroupEqMask(EmitContext& ctx) { | ||
| 551 | NotImplemented(); | ||
| 552 | } | ||
| 553 | |||
| 554 | void EmitSubgroupLtMask(EmitContext& ctx) { | ||
| 555 | NotImplemented(); | ||
| 556 | } | ||
| 557 | |||
| 558 | void EmitSubgroupLeMask(EmitContext& ctx) { | ||
| 559 | NotImplemented(); | ||
| 560 | } | ||
| 561 | |||
| 562 | void EmitSubgroupGtMask(EmitContext& ctx) { | ||
| 563 | NotImplemented(); | ||
| 564 | } | ||
| 565 | |||
| 566 | void EmitSubgroupGeMask(EmitContext& ctx) { | ||
| 567 | NotImplemented(); | ||
| 568 | } | ||
| 569 | |||
| 570 | } // namespace Shader::Backend::GLSL | 530 | } // namespace Shader::Backend::GLSL |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_warp.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_warp.cpp index 1c212ec05..e462c977c 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_warp.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_warp.cpp | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #include "shader_recompiler/backend/glsl/emit_context.h" | 7 | #include "shader_recompiler/backend/glsl/emit_context.h" |
| 8 | #include "shader_recompiler/backend/glsl/emit_glsl_instructions.h" | 8 | #include "shader_recompiler/backend/glsl/emit_glsl_instructions.h" |
| 9 | #include "shader_recompiler/frontend/ir/value.h" | 9 | #include "shader_recompiler/frontend/ir/value.h" |
| 10 | #include "shader_recompiler/profile.h" | ||
| 10 | 11 | ||
| 11 | namespace Shader::Backend::GLSL { | 12 | namespace Shader::Backend::GLSL { |
| 12 | namespace { | 13 | namespace { |
| @@ -36,6 +37,58 @@ std::string GetMaxThreadId(std::string_view thread_id, std::string_view clamp, | |||
| 36 | } | 37 | } |
| 37 | } // namespace | 38 | } // namespace |
| 38 | 39 | ||
| 40 | void EmitLaneId([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst) { | ||
| 41 | throw NotImplementedException("GLSL Instruction"); | ||
| 42 | } | ||
| 43 | |||
| 44 | void EmitVoteAll(EmitContext& ctx, IR::Inst& inst, std::string_view pred) { | ||
| 45 | ctx.AddU1("{}=allInvocationsEqualARB({});", inst, pred); | ||
| 46 | // TODO: | ||
| 47 | // if (ctx.profile.warp_size_potentially_larger_than_guest) { | ||
| 48 | // } | ||
| 49 | } | ||
| 50 | |||
| 51 | void EmitVoteAny(EmitContext& ctx, IR::Inst& inst, std::string_view pred) { | ||
| 52 | ctx.AddU1("{}=anyInvocationARB({});", inst, pred); | ||
| 53 | // TODO: | ||
| 54 | // if (ctx.profile.warp_size_potentially_larger_than_guest) { | ||
| 55 | // } | ||
| 56 | } | ||
| 57 | |||
| 58 | void EmitVoteEqual(EmitContext& ctx, IR::Inst& inst, std::string_view pred) { | ||
| 59 | ctx.AddU1("{}=allInvocationsEqualARB({});", inst, pred); | ||
| 60 | // TODO: | ||
| 61 | // if (ctx.profile.warp_size_potentially_larger_than_guest) { | ||
| 62 | // } | ||
| 63 | } | ||
| 64 | |||
| 65 | void EmitSubgroupBallot(EmitContext& ctx, IR::Inst& inst, std::string_view pred) { | ||
| 66 | ctx.AddU32("{}=uvec2(ballotARB({})).x;", inst, pred); | ||
| 67 | // TODO: | ||
| 68 | // if (ctx.profile.warp_size_potentially_larger_than_guest) { | ||
| 69 | // } | ||
| 70 | } | ||
| 71 | |||
| 72 | void EmitSubgroupEqMask(EmitContext& ctx, IR::Inst& inst) { | ||
| 73 | ctx.AddU32("{}=uvec2(gl_SubGroupEqMaskARB).x;", inst); | ||
| 74 | } | ||
| 75 | |||
| 76 | void EmitSubgroupLtMask(EmitContext& ctx, IR::Inst& inst) { | ||
| 77 | ctx.AddU32("{}=uvec2(gl_SubGroupLtMaskARB).x;", inst); | ||
| 78 | } | ||
| 79 | |||
| 80 | void EmitSubgroupLeMask(EmitContext& ctx, IR::Inst& inst) { | ||
| 81 | ctx.AddU32("{}=uvec2(gl_SubGroupLeMaskARB).x;", inst); | ||
| 82 | } | ||
| 83 | |||
| 84 | void EmitSubgroupGtMask(EmitContext& ctx, IR::Inst& inst) { | ||
| 85 | ctx.AddU32("{}=uvec2(gl_SubGroupGtMaskARB).x;", inst); | ||
| 86 | } | ||
| 87 | |||
| 88 | void EmitSubgroupGeMask(EmitContext& ctx, IR::Inst& inst) { | ||
| 89 | ctx.AddU32("{}=uvec2(gl_SubGroupGeMaskARB).x;", inst); | ||
| 90 | } | ||
| 91 | |||
| 39 | void EmitShuffleIndex(EmitContext& ctx, IR::Inst& inst, std::string_view value, | 92 | void EmitShuffleIndex(EmitContext& ctx, IR::Inst& inst, std::string_view value, |
| 40 | std::string_view index, std::string_view clamp, | 93 | std::string_view index, std::string_view clamp, |
| 41 | std::string_view segmentation_mask) { | 94 | std::string_view segmentation_mask) { |