diff options
| author | 2021-06-16 04:59:30 -0300 | |
|---|---|---|
| committer | 2021-07-22 21:51:38 -0400 | |
| commit | 374eeda1a35f6a1dc81cf22122c701be68e89c0f (patch) | |
| tree | 1155e56fffab693fe2c66ca38e6a435562c21b6d /src/shader_recompiler/backend/glsl/emit_glsl_special.cpp | |
| parent | glsl: Only declare fragment outputs on fragment shaders (diff) | |
| download | yuzu-374eeda1a35f6a1dc81cf22122c701be68e89c0f.tar.gz yuzu-374eeda1a35f6a1dc81cf22122c701be68e89c0f.tar.xz yuzu-374eeda1a35f6a1dc81cf22122c701be68e89c0f.zip | |
shader: Properly manage attributes not written from previous stages
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_glsl_special.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/glsl/emit_glsl_special.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_special.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_special.cpp index f8e8aaa67..1a2d3dcea 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_special.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_special.cpp | |||
| @@ -12,11 +12,12 @@ | |||
| 12 | 12 | ||
| 13 | namespace Shader::Backend::GLSL { | 13 | namespace Shader::Backend::GLSL { |
| 14 | namespace { | 14 | namespace { |
| 15 | void InitializeVaryings(EmitContext& ctx) { | 15 | void InitializeOutputVaryings(EmitContext& ctx) { |
| 16 | ctx.Add("gl_Position=vec4(0,0,0,1);"); | 16 | if (ctx.stage == Stage::VertexB || ctx.stage == Stage::Geometry) { |
| 17 | // TODO: Properly resolve attribute issues | 17 | ctx.Add("gl_Position=vec4(0,0,0,1);"); |
| 18 | for (size_t index = 0; index < ctx.info.stores_generics.size() / 2; ++index) { | 18 | } |
| 19 | if (!ctx.info.stores_generics[index]) { | 19 | for (size_t index = 0; index < 16; ++index) { |
| 20 | if (ctx.info.stores_generics[index]) { | ||
| 20 | ctx.Add("out_attr{}=vec4(0,0,0,1);", index); | 21 | ctx.Add("out_attr{}=vec4(0,0,0,1);", index); |
| 21 | } | 22 | } |
| 22 | } | 23 | } |
| @@ -56,9 +57,8 @@ void EmitPhiMove(EmitContext& ctx, const IR::Value& phi_value, const IR::Value& | |||
| 56 | } | 57 | } |
| 57 | 58 | ||
| 58 | void EmitPrologue(EmitContext& ctx) { | 59 | void EmitPrologue(EmitContext& ctx) { |
| 59 | if (ctx.StageInitializesVaryings()) { | 60 | InitializeOutputVaryings(ctx); |
| 60 | InitializeVaryings(ctx); | 61 | |
| 61 | } | ||
| 62 | if (ctx.stage == Stage::Fragment && ctx.profile.need_declared_frag_colors) { | 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) { | 63 | for (size_t index = 0; index < ctx.info.stores_frag_color.size(); ++index) { |
| 64 | if (ctx.info.stores_frag_color[index]) { | 64 | if (ctx.info.stores_frag_color[index]) { |
| @@ -73,7 +73,7 @@ void EmitEpilogue(EmitContext&) {} | |||
| 73 | 73 | ||
| 74 | void EmitEmitVertex(EmitContext& ctx, const IR::Value& stream) { | 74 | void EmitEmitVertex(EmitContext& ctx, const IR::Value& stream) { |
| 75 | ctx.Add("EmitStreamVertex(int({}));", ctx.var_alloc.Consume(stream)); | 75 | ctx.Add("EmitStreamVertex(int({}));", ctx.var_alloc.Consume(stream)); |
| 76 | InitializeVaryings(ctx); | 76 | InitializeOutputVaryings(ctx); |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | void EmitEndPrimitive(EmitContext& ctx, const IR::Value& stream) { | 79 | void EmitEndPrimitive(EmitContext& ctx, const IR::Value& stream) { |