summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/backend/glasm/emit_glasm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader_recompiler/backend/glasm/emit_glasm.cpp')
-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) {
347 } 347 }
348 throw InvalidArgument("Invalid output topology {}", topology); 348 throw InvalidArgument("Invalid output topology {}", topology);
349} 349}
350
351std::string_view GetTessMode(TessPrimitive primitive) {
352 switch (primitive) {
353 case TessPrimitive::Triangles:
354 return "TRIANGLES";
355 case TessPrimitive::Quads:
356 return "QUADS";
357 case TessPrimitive::Isolines:
358 return "ISOLINES";
359 }
360 throw InvalidArgument("Invalid tessellation primitive {}", primitive);
361}
362
363std::string_view GetTessSpacing(TessSpacing spacing) {
364 switch (spacing) {
365 case TessSpacing::Equal:
366 return "EQUAL";
367 case TessSpacing::FractionalOdd:
368 return "FRACTIONAL_ODD";
369 case TessSpacing::FractionalEven:
370 return "FRACTIONAL_EVEN";
371 }
372 throw InvalidArgument("Invalid tessellation spacing {}", spacing);
373}
350} // Anonymous namespace 374} // Anonymous namespace
351 375
352std::string EmitGLASM(const Profile& profile, IR::Program& program, Bindings& bindings) { 376std::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
356 std::string header{StageHeader(program.stage)}; 380 std::string header{StageHeader(program.stage)};
357 SetupOptions(program, profile, header); 381 SetupOptions(program, profile, header);
358 switch (program.stage) { 382 switch (program.stage) {
383 case Stage::TessellationControl:
384 header += fmt::format("VERTICES_OUT {};", program.invocations);
385 break;
386 case Stage::TessellationEval:
387 header +=
388 fmt::format("TESS_MODE {};"
389 "TESS_SPACING {};"
390 "TESS_VERTEX_ORDER {};",
391 GetTessMode(profile.tess_primitive), GetTessSpacing(profile.tess_spacing),
392 profile.tess_clockwise ? "CW" : "CCW");
393 break;
359 case Stage::Geometry: 394 case Stage::Geometry:
360 header += fmt::format("PRIMITIVE_IN {};" 395 header += fmt::format("PRIMITIVE_IN {};"
361 "PRIMITIVE_OUT {};" 396 "PRIMITIVE_OUT {};"