diff options
| author | 2021-05-30 22:42:52 -0400 | |
|---|---|---|
| committer | 2021-07-22 21:51:37 -0400 | |
| commit | 14bfb4719ad366745b5d16452914c4c78e43b8ae (patch) | |
| tree | 16e61490f8263f80574a73e2bef2a4aebde6b634 /src/shader_recompiler/backend/glsl | |
| parent | glsl: Fix ssbo indexing and name shadowing between shader stages (diff) | |
| download | yuzu-14bfb4719ad366745b5d16452914c4c78e43b8ae.tar.gz yuzu-14bfb4719ad366745b5d16452914c4c78e43b8ae.tar.xz yuzu-14bfb4719ad366745b5d16452914c4c78e43b8ae.zip | |
HACK glsl: Write defaults to unused generic attributes
Diffstat (limited to 'src/shader_recompiler/backend/glsl')
| -rw-r--r-- | src/shader_recompiler/backend/glsl/emit_context.cpp | 7 | ||||
| -rw-r--r-- | src/shader_recompiler/backend/glsl/emit_glsl.cpp | 6 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_context.cpp b/src/shader_recompiler/backend/glsl/emit_context.cpp index 788679f40..8de33b582 100644 --- a/src/shader_recompiler/backend/glsl/emit_context.cpp +++ b/src/shader_recompiler/backend/glsl/emit_context.cpp | |||
| @@ -110,8 +110,11 @@ EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile | |||
| 110 | header += fmt::format("layout(location={})out vec4 frag_color{};", index, index); | 110 | header += fmt::format("layout(location={})out vec4 frag_color{};", index, index); |
| 111 | } | 111 | } |
| 112 | for (size_t index = 0; index < info.stores_generics.size(); ++index) { | 112 | for (size_t index = 0; index < info.stores_generics.size(); ++index) { |
| 113 | if (info.stores_generics[index]) { | 113 | // TODO: Properly resolve attribute issues |
| 114 | header += fmt::format("layout(location={}) out vec4 out_attr{};", index, index); | 114 | const auto declaration{ |
| 115 | fmt::format("layout(location={}) out vec4 out_attr{};", index, index)}; | ||
| 116 | if (info.stores_generics[index] || stage == Stage::VertexA || stage == Stage::VertexB) { | ||
| 117 | header += declaration; | ||
| 115 | } | 118 | } |
| 116 | } | 119 | } |
| 117 | DefineConstantBuffers(bindings); | 120 | DefineConstantBuffers(bindings); |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl.cpp b/src/shader_recompiler/backend/glsl/emit_glsl.cpp index f0257db7f..19cf4e46b 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl.cpp | |||
| @@ -209,6 +209,12 @@ std::string EmitGLSL(const Profile& profile, const RuntimeInfo& runtime_info, IR | |||
| 209 | ctx.header += "void main(){\n"; | 209 | ctx.header += "void main(){\n"; |
| 210 | if (program.stage == Stage::VertexA || program.stage == Stage::VertexB) { | 210 | if (program.stage == Stage::VertexA || program.stage == Stage::VertexB) { |
| 211 | ctx.header += "gl_Position = vec4(0.0f, 0.0f, 0.0f, 1.0f);"; | 211 | ctx.header += "gl_Position = vec4(0.0f, 0.0f, 0.0f, 1.0f);"; |
| 212 | // TODO: Properly resolve attribute issues | ||
| 213 | for (size_t index = 0; index < program.info.stores_generics.size() / 2; ++index) { | ||
| 214 | if (!program.info.stores_generics[index]) { | ||
| 215 | ctx.header += fmt::format("out_attr{}=vec4(0,0,0,1);", index); | ||
| 216 | } | ||
| 217 | } | ||
| 212 | } | 218 | } |
| 213 | DefineVariables(ctx, ctx.header); | 219 | DefineVariables(ctx, ctx.header); |
| 214 | if (ctx.uses_cc_carry) { | 220 | if (ctx.uses_cc_carry) { |