diff options
Diffstat (limited to 'src/shader_recompiler/backend/glasm/emit_context.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/glasm/emit_context.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_context.cpp b/src/shader_recompiler/backend/glasm/emit_context.cpp index 21e14867c..80dad9ff3 100644 --- a/src/shader_recompiler/backend/glasm/emit_context.cpp +++ b/src/shader_recompiler/backend/glasm/emit_context.cpp | |||
| @@ -83,14 +83,13 @@ EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile | |||
| 83 | break; | 83 | break; |
| 84 | } | 84 | } |
| 85 | const std::string_view attr_stage{stage == Stage::Fragment ? "fragment" : "vertex"}; | 85 | const std::string_view attr_stage{stage == Stage::Fragment ? "fragment" : "vertex"}; |
| 86 | for (size_t index = 0; index < info.input_generics.size(); ++index) { | 86 | for (size_t index = 0; index < IR::NUM_GENERICS; ++index) { |
| 87 | const auto& generic{info.input_generics[index]}; | 87 | if (info.loads.Generic(index)) { |
| 88 | if (generic.used) { | ||
| 89 | Add("{}ATTRIB in_attr{}[]={{{}.attrib[{}..{}]}};", | 88 | Add("{}ATTRIB in_attr{}[]={{{}.attrib[{}..{}]}};", |
| 90 | InterpDecorator(generic.interpolation), index, attr_stage, index, index); | 89 | InterpDecorator(info.interpolation[index]), index, attr_stage, index, index); |
| 91 | } | 90 | } |
| 92 | } | 91 | } |
| 93 | if (IsInputArray(stage) && info.loads_position) { | 92 | if (IsInputArray(stage) && info.loads.AnyComponent(IR::Attribute::PositionX)) { |
| 94 | Add("ATTRIB vertex_position=vertex.position;"); | 93 | Add("ATTRIB vertex_position=vertex.position;"); |
| 95 | } | 94 | } |
| 96 | if (info.uses_invocation_id) { | 95 | if (info.uses_invocation_id) { |
| @@ -102,7 +101,7 @@ EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile | |||
| 102 | if (info.stores_tess_level_inner) { | 101 | if (info.stores_tess_level_inner) { |
| 103 | Add("OUTPUT result_patch_tessinner[]={{result.patch.tessinner[0..1]}};"); | 102 | Add("OUTPUT result_patch_tessinner[]={{result.patch.tessinner[0..1]}};"); |
| 104 | } | 103 | } |
| 105 | if (info.stores_clip_distance) { | 104 | if (info.stores.ClipDistances()) { |
| 106 | Add("OUTPUT result_clip[]={{result.clip[0..7]}};"); | 105 | Add("OUTPUT result_clip[]={{result.clip[0..7]}};"); |
| 107 | } | 106 | } |
| 108 | for (size_t index = 0; index < info.uses_patches.size(); ++index) { | 107 | for (size_t index = 0; index < info.uses_patches.size(); ++index) { |
| @@ -124,8 +123,8 @@ EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile | |||
| 124 | Add("OUTPUT frag_color{}=result.color[{}];", index, index); | 123 | Add("OUTPUT frag_color{}=result.color[{}];", index, index); |
| 125 | } | 124 | } |
| 126 | } | 125 | } |
| 127 | for (size_t index = 0; index < info.stores_generics.size(); ++index) { | 126 | for (size_t index = 0; index < IR::NUM_GENERICS; ++index) { |
| 128 | if (info.stores_generics[index]) { | 127 | if (info.stores.Generic(index)) { |
| 129 | Add("OUTPUT out_attr{}[]={{result.attrib[{}..{}]}};", index, index, index); | 128 | Add("OUTPUT out_attr{}[]={{result.attrib[{}..{}]}};", index, index, index); |
| 130 | } | 129 | } |
| 131 | } | 130 | } |