summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2021-05-21 02:18:39 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:32 +0200
commit9ec2303ad6a399cea9e66fa522f65671046f1879 (patch)
treeb4623138a2c3f921cc4b9d229d1d168dd445eb7e
parentglasm: Implement TessellationEvaluationPoint (diff)
downloadyuzu-9ec2303ad6a399cea9e66fa522f65671046f1879.tar
yuzu-9ec2303ad6a399cea9e66fa522f65671046f1879.tar.gz
yuzu-9ec2303ad6a399cea9e66fa522f65671046f1879.tar.bz2
yuzu-9ec2303ad6a399cea9e66fa522f65671046f1879.tar.lz
yuzu-9ec2303ad6a399cea9e66fa522f65671046f1879.tar.xz
yuzu-9ec2303ad6a399cea9e66fa522f65671046f1879.tar.zst
yuzu-9ec2303ad6a399cea9e66fa522f65671046f1879.zip
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm.cpp b/src/shader_recompiler/backend/glasm/emit_glasm.cpp
index b6b8d504e..476cdda54 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_glasm.cpp
@@ -347,6 +347,30 @@ std::string_view OutputPrimitive(OutputTopology topology) {
}
throw InvalidArgument("Invalid output topology {}", topology);
}
+
+std::string_view GetTessMode(TessPrimitive primitive) {
+ switch (primitive) {
+ case TessPrimitive::Triangles:
+ return "TRIANGLES";
+ case TessPrimitive::Quads:
+ return "QUADS";
+ case TessPrimitive::Isolines:
+ return "ISOLINES";
+ }
+ throw InvalidArgument("Invalid tessellation primitive {}", primitive);
+}
+
+std::string_view GetTessSpacing(TessSpacing spacing) {
+ switch (spacing) {
+ case TessSpacing::Equal:
+ return "EQUAL";
+ case TessSpacing::FractionalOdd:
+ return "FRACTIONAL_ODD";
+ case TessSpacing::FractionalEven:
+ return "FRACTIONAL_EVEN";
+ }
+ throw InvalidArgument("Invalid tessellation spacing {}", spacing);
+}
} // Anonymous namespace
std::string EmitGLASM(const Profile& profile, IR::Program& program, Bindings& bindings) {
@@ -356,6 +380,17 @@ std::string EmitGLASM(const Profile& profile, IR::Program& program, Bindings& bi
std::string header{StageHeader(program.stage)};
SetupOptions(program, profile, header);
switch (program.stage) {
+ case Stage::TessellationControl:
+ header += fmt::format("VERTICES_OUT {};", program.invocations);
+ break;
+ case Stage::TessellationEval:
+ header +=
+ fmt::format("TESS_MODE {};"
+ "TESS_SPACING {};"
+ "TESS_VERTEX_ORDER {};",
+ GetTessMode(profile.tess_primitive), GetTessSpacing(profile.tess_spacing),
+ profile.tess_clockwise ? "CW" : "CCW");
+ break;
case Stage::Geometry:
header += fmt::format("PRIMITIVE_IN {};"
"PRIMITIVE_OUT {};"