summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/backend
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader_recompiler/backend')
-rw-r--r--src/shader_recompiler/backend/glsl/emit_context.cpp1
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_instructions.h20
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_not_implemented.cpp40
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_warp.cpp53
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);
680void EmitImageAtomicExchange32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, 680void 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);
682void EmitLaneId(EmitContext& ctx); 682void EmitLaneId(EmitContext& ctx, IR::Inst& inst);
683void EmitVoteAll(EmitContext& ctx, std::string_view pred); 683void EmitVoteAll(EmitContext& ctx, IR::Inst& inst, std::string_view pred);
684void EmitVoteAny(EmitContext& ctx, std::string_view pred); 684void EmitVoteAny(EmitContext& ctx, IR::Inst& inst, std::string_view pred);
685void EmitVoteEqual(EmitContext& ctx, std::string_view pred); 685void EmitVoteEqual(EmitContext& ctx, IR::Inst& inst, std::string_view pred);
686void EmitSubgroupBallot(EmitContext& ctx, std::string_view pred); 686void EmitSubgroupBallot(EmitContext& ctx, IR::Inst& inst, std::string_view pred);
687void EmitSubgroupEqMask(EmitContext& ctx); 687void EmitSubgroupEqMask(EmitContext& ctx, IR::Inst& inst);
688void EmitSubgroupLtMask(EmitContext& ctx); 688void EmitSubgroupLtMask(EmitContext& ctx, IR::Inst& inst);
689void EmitSubgroupLeMask(EmitContext& ctx); 689void EmitSubgroupLeMask(EmitContext& ctx, IR::Inst& inst);
690void EmitSubgroupGtMask(EmitContext& ctx); 690void EmitSubgroupGtMask(EmitContext& ctx, IR::Inst& inst);
691void EmitSubgroupGeMask(EmitContext& ctx); 691void EmitSubgroupGeMask(EmitContext& ctx, IR::Inst& inst);
692void EmitShuffleIndex(EmitContext& ctx, IR::Inst& inst, std::string_view value, 692void 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
530void EmitLaneId(EmitContext& ctx) {
531 NotImplemented();
532}
533
534void EmitVoteAll(EmitContext& ctx, std::string_view pred) {
535 NotImplemented();
536}
537
538void EmitVoteAny(EmitContext& ctx, std::string_view pred) {
539 NotImplemented();
540}
541
542void EmitVoteEqual(EmitContext& ctx, std::string_view pred) {
543 NotImplemented();
544}
545
546void EmitSubgroupBallot(EmitContext& ctx, std::string_view pred) {
547 NotImplemented();
548}
549
550void EmitSubgroupEqMask(EmitContext& ctx) {
551 NotImplemented();
552}
553
554void EmitSubgroupLtMask(EmitContext& ctx) {
555 NotImplemented();
556}
557
558void EmitSubgroupLeMask(EmitContext& ctx) {
559 NotImplemented();
560}
561
562void EmitSubgroupGtMask(EmitContext& ctx) {
563 NotImplemented();
564}
565
566void 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
11namespace Shader::Backend::GLSL { 12namespace Shader::Backend::GLSL {
12namespace { 13namespace {
@@ -36,6 +37,58 @@ std::string GetMaxThreadId(std::string_view thread_id, std::string_view clamp,
36} 37}
37} // namespace 38} // namespace
38 39
40void EmitLaneId([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst) {
41 throw NotImplementedException("GLSL Instruction");
42}
43
44void 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
51void 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
58void 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
65void 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
72void EmitSubgroupEqMask(EmitContext& ctx, IR::Inst& inst) {
73 ctx.AddU32("{}=uvec2(gl_SubGroupEqMaskARB).x;", inst);
74}
75
76void EmitSubgroupLtMask(EmitContext& ctx, IR::Inst& inst) {
77 ctx.AddU32("{}=uvec2(gl_SubGroupLtMaskARB).x;", inst);
78}
79
80void EmitSubgroupLeMask(EmitContext& ctx, IR::Inst& inst) {
81 ctx.AddU32("{}=uvec2(gl_SubGroupLeMaskARB).x;", inst);
82}
83
84void EmitSubgroupGtMask(EmitContext& ctx, IR::Inst& inst) {
85 ctx.AddU32("{}=uvec2(gl_SubGroupGtMaskARB).x;", inst);
86}
87
88void EmitSubgroupGeMask(EmitContext& ctx, IR::Inst& inst) {
89 ctx.AddU32("{}=uvec2(gl_SubGroupGeMaskARB).x;", inst);
90}
91
39void EmitShuffleIndex(EmitContext& ctx, IR::Inst& inst, std::string_view value, 92void 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) {