summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar ameerj2021-06-15 21:01:44 -0400
committerGravatar ameerj2021-07-22 21:51:38 -0400
commit12ef06ba8bca5b20069e24b36f9216d01d4fe904 (patch)
treee077392408045374a5e18dfa1c1a67e4410a06f6
parentglsl: Address rest of feedback (diff)
downloadyuzu-12ef06ba8bca5b20069e24b36f9216d01d4fe904.tar.gz
yuzu-12ef06ba8bca5b20069e24b36f9216d01d4fe904.tar.xz
yuzu-12ef06ba8bca5b20069e24b36f9216d01d4fe904.zip
glsl: Obey need_declared_frag_colors to declare and initialize all frag_color
Fixes Ori and the blind forest title screen
-rw-r--r--src/shader_recompiler/backend/glsl/emit_context.cpp2
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_special.cpp9
2 files changed, 10 insertions, 1 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_context.cpp b/src/shader_recompiler/backend/glsl/emit_context.cpp
index d224c4d84..54aa88b63 100644
--- a/src/shader_recompiler/backend/glsl/emit_context.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_context.cpp
@@ -340,7 +340,7 @@ EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile
340 header += fmt::format("layout(location={})patch {} vec4 patch{};", index, qualifier, index); 340 header += fmt::format("layout(location={})patch {} vec4 patch{};", index, qualifier, index);
341 } 341 }
342 for (size_t index = 0; index < info.stores_frag_color.size(); ++index) { 342 for (size_t index = 0; index < info.stores_frag_color.size(); ++index) {
343 if (!info.stores_frag_color[index]) { 343 if (!info.stores_frag_color[index] && !profile.need_declared_frag_colors) {
344 continue; 344 continue;
345 } 345 }
346 header += fmt::format("layout(location={})out vec4 frag_color{};", index, index); 346 header += fmt::format("layout(location={})out vec4 frag_color{};", index, index);
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_special.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_special.cpp
index 59ca52f07..f8e8aaa67 100644
--- a/src/shader_recompiler/backend/glsl/emit_glsl_special.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_glsl_special.cpp
@@ -8,6 +8,7 @@
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/program.h" 9#include "shader_recompiler/frontend/ir/program.h"
10#include "shader_recompiler/frontend/ir/value.h" 10#include "shader_recompiler/frontend/ir/value.h"
11#include "shader_recompiler/profile.h"
11 12
12namespace Shader::Backend::GLSL { 13namespace Shader::Backend::GLSL {
13namespace { 14namespace {
@@ -58,6 +59,14 @@ void EmitPrologue(EmitContext& ctx) {
58 if (ctx.StageInitializesVaryings()) { 59 if (ctx.StageInitializesVaryings()) {
59 InitializeVaryings(ctx); 60 InitializeVaryings(ctx);
60 } 61 }
62 if (ctx.stage == Stage::Fragment && ctx.profile.need_declared_frag_colors) {
63 for (size_t index = 0; index < ctx.info.stores_frag_color.size(); ++index) {
64 if (ctx.info.stores_frag_color[index]) {
65 continue;
66 }
67 ctx.Add("frag_color{}=vec4(0,0,0,1);", index);
68 }
69 }
61} 70}
62 71
63void EmitEpilogue(EmitContext&) {} 72void EmitEpilogue(EmitContext&) {}