summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/backend/glasm
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader_recompiler/backend/glasm')
-rw-r--r--src/shader_recompiler/backend/glasm/emit_context.cpp15
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm.cpp6
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp6
3 files changed, 14 insertions, 13 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
break;
}
const std::string_view attr_stage{stage == Stage::Fragment ? "fragment" : "vertex"};
- for (size_t index = 0; index < info.input_generics.size(); ++index) {
- const auto& generic{info.input_generics[index]};
- if (generic.used) {
+ for (size_t index = 0; index < IR::NUM_GENERICS; ++index) {
+ if (info.loads.Generic(index)) {
Add("{}ATTRIB in_attr{}[]={{{}.attrib[{}..{}]}};",
- InterpDecorator(generic.interpolation), index, attr_stage, index, index);
+ InterpDecorator(info.interpolation[index]), index, attr_stage, index, index);
}
}
- if (IsInputArray(stage) && info.loads_position) {
+ if (IsInputArray(stage) && info.loads.AnyComponent(IR::Attribute::PositionX)) {
Add("ATTRIB vertex_position=vertex.position;");
}
if (info.uses_invocation_id) {
@@ -102,7 +101,7 @@ EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile
if (info.stores_tess_level_inner) {
Add("OUTPUT result_patch_tessinner[]={{result.patch.tessinner[0..1]}};");
}
- if (info.stores_clip_distance) {
+ if (info.stores.ClipDistances()) {
Add("OUTPUT result_clip[]={{result.clip[0..7]}};");
}
for (size_t index = 0; index < info.uses_patches.size(); ++index) {
@@ -124,8 +123,8 @@ EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile
Add("OUTPUT frag_color{}=result.color[{}];", index, index);
}
}
- for (size_t index = 0; index < info.stores_generics.size(); ++index) {
- if (info.stores_generics[index]) {
+ for (size_t index = 0; index < IR::NUM_GENERICS; ++index) {
+ if (info.stores.Generic(index)) {
Add("OUTPUT out_attr{}[]={{result.attrib[{}..{}]}};", index, index, index);
}
}
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm.cpp b/src/shader_recompiler/backend/glasm/emit_glasm.cpp
index 79314f130..2b96977b3 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_glasm.cpp
@@ -296,8 +296,10 @@ void SetupOptions(const IR::Program& program, const Profile& profile,
if (info.uses_sparse_residency) {
header += "OPTION EXT_sparse_texture2;";
}
- if (((info.stores_viewport_index || info.stores_layer) && stage != Stage::Geometry) ||
- info.stores_viewport_mask) {
+ const bool stores_viewport_layer{info.stores[IR::Attribute::ViewportIndex] ||
+ info.stores[IR::Attribute::Layer]};
+ if ((stage != Stage::Geometry && stores_viewport_layer) ||
+ info.stores[IR::Attribute::ViewportMask]) {
if (profile.support_viewport_index_layer_non_geometry) {
header += "OPTION NV_viewport_array2;";
}
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp
index bc195d248..02c9dc6d7 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp
@@ -261,7 +261,7 @@ void EmitGetAttributeIndexed(EmitContext& ctx, IR::Inst& inst, ScalarS32 offset,
fmt::format("{}.z", value), fmt::format("{}.w", value)};
read(compare_index, values);
}};
- if (ctx.info.loads_position) {
+ if (ctx.info.loads.AnyComponent(IR::Attribute::PositionX)) {
const u32 index{static_cast<u32>(IR::Attribute::PositionX)};
if (IsInputArray(ctx.stage)) {
read_swizzled(index, fmt::format("vertex_position{}", VertexIndex(ctx, vertex)));
@@ -269,8 +269,8 @@ void EmitGetAttributeIndexed(EmitContext& ctx, IR::Inst& inst, ScalarS32 offset,
read_swizzled(index, fmt::format("{}.position", ctx.attrib_name));
}
}
- for (u32 index = 0; index < ctx.info.input_generics.size(); ++index) {
- if (!ctx.info.input_generics[index].used) {
+ for (u32 index = 0; index < static_cast<u32>(IR::NUM_GENERICS); ++index) {
+ if (!ctx.info.loads.Generic(index)) {
continue;
}
read_swizzled(index, fmt::format("in_attr{}{}[0]", index, VertexIndex(ctx, vertex)));