diff options
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_glsl_special.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/glsl/emit_glsl_special.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_special.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_special.cpp index cfef58d79..59ca52f07 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_special.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_special.cpp | |||
| @@ -10,6 +10,17 @@ | |||
| 10 | #include "shader_recompiler/frontend/ir/value.h" | 10 | #include "shader_recompiler/frontend/ir/value.h" |
| 11 | 11 | ||
| 12 | namespace Shader::Backend::GLSL { | 12 | namespace Shader::Backend::GLSL { |
| 13 | namespace { | ||
| 14 | void InitializeVaryings(EmitContext& ctx) { | ||
| 15 | ctx.Add("gl_Position=vec4(0,0,0,1);"); | ||
| 16 | // TODO: Properly resolve attribute issues | ||
| 17 | for (size_t index = 0; index < ctx.info.stores_generics.size() / 2; ++index) { | ||
| 18 | if (!ctx.info.stores_generics[index]) { | ||
| 19 | ctx.Add("out_attr{}=vec4(0,0,0,1);", index); | ||
| 20 | } | ||
| 21 | } | ||
| 22 | } | ||
| 23 | } // Anonymous namespace | ||
| 13 | 24 | ||
| 14 | void EmitPhi(EmitContext& ctx, IR::Inst& phi) { | 25 | void EmitPhi(EmitContext& ctx, IR::Inst& phi) { |
| 15 | const size_t num_args{phi.NumArgs()}; | 26 | const size_t num_args{phi.NumArgs()}; |
| @@ -44,14 +55,8 @@ void EmitPhiMove(EmitContext& ctx, const IR::Value& phi_value, const IR::Value& | |||
| 44 | } | 55 | } |
| 45 | 56 | ||
| 46 | void EmitPrologue(EmitContext& ctx) { | 57 | void EmitPrologue(EmitContext& ctx) { |
| 47 | if (ctx.stage == Stage::VertexA || ctx.stage == Stage::VertexB) { | 58 | if (ctx.StageInitializesVaryings()) { |
| 48 | ctx.Add("gl_Position=vec4(0.0f, 0.0f, 0.0f, 1.0f);"); | 59 | InitializeVaryings(ctx); |
| 49 | // TODO: Properly resolve attribute issues | ||
| 50 | for (size_t index = 0; index < ctx.info.stores_generics.size() / 2; ++index) { | ||
| 51 | if (!ctx.info.stores_generics[index]) { | ||
| 52 | ctx.Add("out_attr{}=vec4(0,0,0,1);", index); | ||
| 53 | } | ||
| 54 | } | ||
| 55 | } | 60 | } |
| 56 | } | 61 | } |
| 57 | 62 | ||
| @@ -59,6 +64,7 @@ void EmitEpilogue(EmitContext&) {} | |||
| 59 | 64 | ||
| 60 | void EmitEmitVertex(EmitContext& ctx, const IR::Value& stream) { | 65 | void EmitEmitVertex(EmitContext& ctx, const IR::Value& stream) { |
| 61 | ctx.Add("EmitStreamVertex(int({}));", ctx.var_alloc.Consume(stream)); | 66 | ctx.Add("EmitStreamVertex(int({}));", ctx.var_alloc.Consume(stream)); |
| 67 | InitializeVaryings(ctx); | ||
| 62 | } | 68 | } |
| 63 | 69 | ||
| 64 | void EmitEndPrimitive(EmitContext& ctx, const IR::Value& stream) { | 70 | void EmitEndPrimitive(EmitContext& ctx, const IR::Value& stream) { |