summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorameerj <52414509+ameerj@users.noreply.github.com>2021-06-10 06:01:56 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:37 +0200
commite7c8f8911f38b29c0725b76db75ce6d6d857c5f9 (patch)
tree434985028b041c36a6e294f834029eb7a1997794 /src
parentglsl: Add gl_PerVertex in for GS (diff)
downloadyuzu-e7c8f8911f38b29c0725b76db75ce6d6d857c5f9.tar
yuzu-e7c8f8911f38b29c0725b76db75ce6d6d857c5f9.tar.gz
yuzu-e7c8f8911f38b29c0725b76db75ce6d6d857c5f9.tar.bz2
yuzu-e7c8f8911f38b29c0725b76db75ce6d6d857c5f9.tar.lz
yuzu-e7c8f8911f38b29c0725b76db75ce6d6d857c5f9.tar.xz
yuzu-e7c8f8911f38b29c0725b76db75ce6d6d857c5f9.tar.zst
yuzu-e7c8f8911f38b29c0725b76db75ce6d6d857c5f9.zip
Diffstat (limited to '')
-rw-r--r--src/shader_recompiler/backend/glsl/emit_context.cpp6
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp30
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_not_implemented.cpp29
3 files changed, 35 insertions, 30 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_context.cpp b/src/shader_recompiler/backend/glsl/emit_context.cpp
index fdbe2986c..484548467 100644
--- a/src/shader_recompiler/backend/glsl/emit_context.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_context.cpp
@@ -256,6 +256,12 @@ EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile
if (runtime_info.force_early_z) {
header += "layout(early_fragment_tests)in;";
}
+ if (info.uses_sample_id) {
+ header += "in int gl_SampleID;";
+ }
+ if (info.stores_sample_mask) {
+ header += "out int gl_SampleMask[];";
+ }
break;
case Stage::Compute:
stage_name = "cs";
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp
index c9a2ceb3d..0546c1c81 100644
--- a/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp
@@ -239,7 +239,6 @@ void EmitGetAttribute(EmitContext& ctx, IR::Inst& inst, IR::Attribute attr,
ctx.AddF32("{}=itof(gl_FrontFacing?-1:0);", inst);
break;
default:
- fmt::print("Get attribute {}", attr);
throw NotImplementedException("Get attribute {}", attr);
}
}
@@ -397,10 +396,39 @@ void EmitSetFragColor(EmitContext& ctx, u32 index, u32 component, std::string_vi
ctx.Add("frag_color{}.{}={};", index, swizzle, value);
}
+void EmitSetSampleMask(EmitContext& ctx, std::string_view value) {
+ ctx.Add("gl_SampleMask[0]=int({})", value);
+}
+
+void EmitSetFragDepth(EmitContext& ctx, std::string_view value) {
+ ctx.Add("gl_FragDepth={};", value);
+}
+
void EmitLocalInvocationId(EmitContext& ctx, IR::Inst& inst) {
ctx.AddU32x3("{}=gl_LocalInvocationID;", inst);
}
+void EmitWorkgroupId(EmitContext& ctx, IR::Inst& inst) {
+ ctx.AddU32x3("{}=gl_WorkGroupID;", inst);
+}
+
+void EmitInvocationId(EmitContext& ctx, IR::Inst& inst) {
+ ctx.AddU32("{}=uint(gl_InvocationID);", inst);
+}
+
+void EmitSampleId(EmitContext& ctx, IR::Inst& inst) {
+ ctx.AddU32("{}=uint(gl_SampleID);", inst);
+}
+
+void EmitIsHelperInvocation(EmitContext& ctx, IR::Inst& inst) {
+ ctx.AddU1("{}=gl_HelperInvocation;", inst);
+}
+
+void EmitYDirection(EmitContext& ctx, IR::Inst& inst) {
+ ctx.uses_y_direction = true;
+ ctx.AddF32("{}=gl_FrontMaterial.ambient.a;", inst);
+}
+
void EmitLoadLocal(EmitContext& ctx, IR::Inst& inst, std::string_view word_offset) {
ctx.AddU32("{}=lmem[{}];", inst, word_offset);
}
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 b292db9d4..f17a07955 100644
--- a/src/shader_recompiler/backend/glsl/emit_glsl_not_implemented.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_glsl_not_implemented.cpp
@@ -124,14 +124,6 @@ void EmitGetIndirectBranchVariable(EmitContext& ctx) {
NotImplemented();
}
-void EmitSetSampleMask(EmitContext& ctx, std::string_view value) {
- NotImplemented();
-}
-
-void EmitSetFragDepth(EmitContext& ctx, std::string_view value) {
- ctx.Add("gl_FragDepth={};", value);
-}
-
void EmitGetZFlag(EmitContext& ctx) {
NotImplemented();
}
@@ -164,27 +156,6 @@ void EmitSetOFlag(EmitContext& ctx) {
NotImplemented();
}
-void EmitWorkgroupId(EmitContext& ctx, IR::Inst& inst) {
- ctx.AddU32x3("{}=gl_WorkGroupID;", inst);
-}
-
-void EmitInvocationId(EmitContext& ctx, IR::Inst& inst) {
- ctx.AddU32("{}=uint(gl_InvocationID);", inst);
-}
-
-void EmitSampleId(EmitContext& ctx, IR::Inst& inst) {
- NotImplemented();
-}
-
-void EmitIsHelperInvocation(EmitContext& ctx, IR::Inst& inst) {
- ctx.AddU1("{}=gl_HelperInvocation;", inst);
-}
-
-void EmitYDirection(EmitContext& ctx, IR::Inst& inst) {
- ctx.uses_y_direction = true;
- ctx.AddF32("{}=gl_FrontMaterial.ambient.a;", inst);
-}
-
void EmitUndefU1(EmitContext& ctx, IR::Inst& inst) {
ctx.AddU1("{}=false;", inst);
}