diff options
author | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-06-16 03:01:44 +0200 |
---|---|---|
committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-23 03:51:38 +0200 |
commit | 12ef06ba8bca5b20069e24b36f9216d01d4fe904 (patch) | |
tree | e077392408045374a5e18dfa1c1a67e4410a06f6 /src | |
parent | glsl: Address rest of feedback (diff) | |
download | yuzu-12ef06ba8bca5b20069e24b36f9216d01d4fe904.tar yuzu-12ef06ba8bca5b20069e24b36f9216d01d4fe904.tar.gz yuzu-12ef06ba8bca5b20069e24b36f9216d01d4fe904.tar.bz2 yuzu-12ef06ba8bca5b20069e24b36f9216d01d4fe904.tar.lz yuzu-12ef06ba8bca5b20069e24b36f9216d01d4fe904.tar.xz yuzu-12ef06ba8bca5b20069e24b36f9216d01d4fe904.tar.zst yuzu-12ef06ba8bca5b20069e24b36f9216d01d4fe904.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/shader_recompiler/backend/glsl/emit_context.cpp | 2 | ||||
-rw-r--r-- | src/shader_recompiler/backend/glsl/emit_glsl_special.cpp | 9 |
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 header += fmt::format("layout(location={})patch {} vec4 patch{};", index, qualifier, index); } for (size_t index = 0; index < info.stores_frag_color.size(); ++index) { - if (!info.stores_frag_color[index]) { + if (!info.stores_frag_color[index] && !profile.need_declared_frag_colors) { continue; } 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 @@ #include "shader_recompiler/backend/glsl/emit_glsl_instructions.h" #include "shader_recompiler/frontend/ir/program.h" #include "shader_recompiler/frontend/ir/value.h" +#include "shader_recompiler/profile.h" namespace Shader::Backend::GLSL { namespace { @@ -58,6 +59,14 @@ void EmitPrologue(EmitContext& ctx) { if (ctx.StageInitializesVaryings()) { InitializeVaryings(ctx); } + if (ctx.stage == Stage::Fragment && ctx.profile.need_declared_frag_colors) { + for (size_t index = 0; index < ctx.info.stores_frag_color.size(); ++index) { + if (ctx.info.stores_frag_color[index]) { + continue; + } + ctx.Add("frag_color{}=vec4(0,0,0,1);", index); + } + } } void EmitEpilogue(EmitContext&) {} |