summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/backend/glasm/emit_context.cpp
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2021-05-21 07:56:59 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:33 +0200
commitb382f57b286f72f89cff4e710ba6e6b34d22035d (patch)
tree78fea5da1865ba99ac1bd4c0ce7afbb8a1faae05 /src/shader_recompiler/backend/glasm/emit_context.cpp
parentgl_shader_cache: Pass shader runtime information (diff)
downloadyuzu-b382f57b286f72f89cff4e710ba6e6b34d22035d.tar
yuzu-b382f57b286f72f89cff4e710ba6e6b34d22035d.tar.gz
yuzu-b382f57b286f72f89cff4e710ba6e6b34d22035d.tar.bz2
yuzu-b382f57b286f72f89cff4e710ba6e6b34d22035d.tar.lz
yuzu-b382f57b286f72f89cff4e710ba6e6b34d22035d.tar.xz
yuzu-b382f57b286f72f89cff4e710ba6e6b34d22035d.tar.zst
yuzu-b382f57b286f72f89cff4e710ba6e6b34d22035d.zip
Diffstat (limited to 'src/shader_recompiler/backend/glasm/emit_context.cpp')
-rw-r--r--src/shader_recompiler/backend/glasm/emit_context.cpp12
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) {
}
throw InvalidArgument("Invalid interpolation {}", interp);
}
+
+bool IsInputArray(Stage stage) {
+ return stage == Stage::Geometry || stage == Stage::TessellationControl ||
+ stage == Stage::TessellationEval;
+}
} // Anonymous namespace
EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile& profile_,
@@ -76,7 +81,7 @@ EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile
InterpDecorator(generic.interpolation), index, attr_stage, index, index);
}
}
- if (stage == Stage::Geometry && info.loads_position) {
+ if (IsInputArray(stage) && info.loads_position) {
Add("ATTRIB vertex_position=vertex.position;");
}
if (info.uses_invocation_id) {
@@ -96,8 +101,9 @@ EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile
continue;
}
if (stage == Stage::TessellationControl) {
- Add("OUTPUT result_patch_attrib{}[]={{result.patch.attrib[{}..{}]}};", index, index,
- index);
+ Add("OUTPUT result_patch_attrib{}[]={{result.patch.attrib[{}..{}]}};"
+ "ATTRIB primitive_out_patch_attrib{}[]={{primitive.out.patch.attrib[{}..{}]}};",
+ index, index, index, index, index, index);
} else {
Add("ATTRIB primitive_patch_attrib{}[]={{primitive.patch.attrib[{}..{}]}};", index,
index, index);