diff options
author | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-06-15 23:23:57 +0200 |
---|---|---|
committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-23 03:51:38 +0200 |
commit | d36f667bc0adaa9f50d53efb4c908aadc38921a6 (patch) | |
tree | 13a6a6106ca576214db66d50a618b404cc5c7cac /src/shader_recompiler/backend/glsl/emit_glsl_special.cpp | |
parent | glsl: Move gl_Position/generic attribute initialization to EmitProlgue (diff) | |
download | yuzu-d36f667bc0adaa9f50d53efb4c908aadc38921a6.tar yuzu-d36f667bc0adaa9f50d53efb4c908aadc38921a6.tar.gz yuzu-d36f667bc0adaa9f50d53efb4c908aadc38921a6.tar.bz2 yuzu-d36f667bc0adaa9f50d53efb4c908aadc38921a6.tar.lz yuzu-d36f667bc0adaa9f50d53efb4c908aadc38921a6.tar.xz yuzu-d36f667bc0adaa9f50d53efb4c908aadc38921a6.tar.zst yuzu-d36f667bc0adaa9f50d53efb4c908aadc38921a6.zip |
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 @@ #include "shader_recompiler/frontend/ir/value.h" namespace Shader::Backend::GLSL { +namespace { +void InitializeVaryings(EmitContext& ctx) { + ctx.Add("gl_Position=vec4(0,0,0,1);"); + // TODO: Properly resolve attribute issues + for (size_t index = 0; index < ctx.info.stores_generics.size() / 2; ++index) { + if (!ctx.info.stores_generics[index]) { + ctx.Add("out_attr{}=vec4(0,0,0,1);", index); + } + } +} +} // Anonymous namespace void EmitPhi(EmitContext& ctx, IR::Inst& phi) { const size_t num_args{phi.NumArgs()}; @@ -44,14 +55,8 @@ void EmitPhiMove(EmitContext& ctx, const IR::Value& phi_value, const IR::Value& } void EmitPrologue(EmitContext& ctx) { - if (ctx.stage == Stage::VertexA || ctx.stage == Stage::VertexB) { - ctx.Add("gl_Position=vec4(0.0f, 0.0f, 0.0f, 1.0f);"); - // TODO: Properly resolve attribute issues - for (size_t index = 0; index < ctx.info.stores_generics.size() / 2; ++index) { - if (!ctx.info.stores_generics[index]) { - ctx.Add("out_attr{}=vec4(0,0,0,1);", index); - } - } + if (ctx.StageInitializesVaryings()) { + InitializeVaryings(ctx); } } @@ -59,6 +64,7 @@ void EmitEpilogue(EmitContext&) {} void EmitEmitVertex(EmitContext& ctx, const IR::Value& stream) { ctx.Add("EmitStreamVertex(int({}));", ctx.var_alloc.Consume(stream)); + InitializeVaryings(ctx); } void EmitEndPrimitive(EmitContext& ctx, const IR::Value& stream) { |