diff options
Diffstat (limited to 'src/shader_recompiler/backend/glasm/emit_context.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/glasm/emit_context.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_context.cpp b/src/shader_recompiler/backend/glasm/emit_context.cpp index 659ff6d17..0f7d79843 100644 --- a/src/shader_recompiler/backend/glasm/emit_context.cpp +++ b/src/shader_recompiler/backend/glasm/emit_context.cpp | |||
| @@ -21,6 +21,11 @@ std::string_view InterpDecorator(Interpolation interp) { | |||
| 21 | } | 21 | } |
| 22 | throw InvalidArgument("Invalid interpolation {}", interp); | 22 | throw InvalidArgument("Invalid interpolation {}", interp); |
| 23 | } | 23 | } |
| 24 | |||
| 25 | bool IsInputArray(Stage stage) { | ||
| 26 | return stage == Stage::Geometry || stage == Stage::TessellationControl || | ||
| 27 | stage == Stage::TessellationEval; | ||
| 28 | } | ||
| 24 | } // Anonymous namespace | 29 | } // Anonymous namespace |
| 25 | 30 | ||
| 26 | EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile& profile_, | 31 | EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile& profile_, |
| @@ -76,7 +81,7 @@ EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile | |||
| 76 | InterpDecorator(generic.interpolation), index, attr_stage, index, index); | 81 | InterpDecorator(generic.interpolation), index, attr_stage, index, index); |
| 77 | } | 82 | } |
| 78 | } | 83 | } |
| 79 | if (stage == Stage::Geometry && info.loads_position) { | 84 | if (IsInputArray(stage) && info.loads_position) { |
| 80 | Add("ATTRIB vertex_position=vertex.position;"); | 85 | Add("ATTRIB vertex_position=vertex.position;"); |
| 81 | } | 86 | } |
| 82 | if (info.uses_invocation_id) { | 87 | if (info.uses_invocation_id) { |
| @@ -96,8 +101,9 @@ EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile | |||
| 96 | continue; | 101 | continue; |
| 97 | } | 102 | } |
| 98 | if (stage == Stage::TessellationControl) { | 103 | if (stage == Stage::TessellationControl) { |
| 99 | Add("OUTPUT result_patch_attrib{}[]={{result.patch.attrib[{}..{}]}};", index, index, | 104 | Add("OUTPUT result_patch_attrib{}[]={{result.patch.attrib[{}..{}]}};" |
| 100 | index); | 105 | "ATTRIB primitive_out_patch_attrib{}[]={{primitive.out.patch.attrib[{}..{}]}};", |
| 106 | index, index, index, index, index, index); | ||
| 101 | } else { | 107 | } else { |
| 102 | Add("ATTRIB primitive_patch_attrib{}[]={{primitive.patch.attrib[{}..{}]}};", index, | 108 | Add("ATTRIB primitive_patch_attrib{}[]={{primitive.patch.attrib[{}..{}]}};", index, |
| 103 | index, index); | 109 | index, index); |