diff options
Diffstat (limited to 'src/shader_recompiler/backend/glasm/emit_glasm.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/glasm/emit_glasm.cpp | 35 |
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 3910d00ee..b6b8d504e 100644 --- a/src/shader_recompiler/backend/glasm/emit_glasm.cpp +++ b/src/shader_recompiler/backend/glasm/emit_glasm.cpp | |||
| @@ -319,6 +319,34 @@ std::string_view StageHeader(Stage stage) { | |||
| 319 | } | 319 | } |
| 320 | throw InvalidArgument("Invalid stage {}", stage); | 320 | throw InvalidArgument("Invalid stage {}", stage); |
| 321 | } | 321 | } |
| 322 | |||
| 323 | std::string_view InputPrimitive(InputTopology topology) { | ||
| 324 | switch (topology) { | ||
| 325 | case InputTopology::Points: | ||
| 326 | return "POINTS"; | ||
| 327 | case InputTopology::Lines: | ||
| 328 | return "LINES"; | ||
| 329 | case InputTopology::LinesAdjacency: | ||
| 330 | return "LINESS_ADJACENCY"; | ||
| 331 | case InputTopology::Triangles: | ||
| 332 | return "TRIANGLES"; | ||
| 333 | case InputTopology::TrianglesAdjacency: | ||
| 334 | return "TRIANGLES_ADJACENCY"; | ||
| 335 | } | ||
| 336 | throw InvalidArgument("Invalid input topology {}", topology); | ||
| 337 | } | ||
| 338 | |||
| 339 | std::string_view OutputPrimitive(OutputTopology topology) { | ||
| 340 | switch (topology) { | ||
| 341 | case OutputTopology::PointList: | ||
| 342 | return "POINTS"; | ||
| 343 | case OutputTopology::LineStrip: | ||
| 344 | return "LINE_STRIP"; | ||
| 345 | case OutputTopology::TriangleStrip: | ||
| 346 | return "TRIANGLE_STRIP"; | ||
| 347 | } | ||
| 348 | throw InvalidArgument("Invalid output topology {}", topology); | ||
| 349 | } | ||
| 322 | } // Anonymous namespace | 350 | } // Anonymous namespace |
| 323 | 351 | ||
| 324 | std::string EmitGLASM(const Profile& profile, IR::Program& program, Bindings& bindings) { | 352 | std::string EmitGLASM(const Profile& profile, IR::Program& program, Bindings& bindings) { |
| @@ -328,6 +356,13 @@ std::string EmitGLASM(const Profile& profile, IR::Program& program, Bindings& bi | |||
| 328 | std::string header{StageHeader(program.stage)}; | 356 | std::string header{StageHeader(program.stage)}; |
| 329 | SetupOptions(program, profile, header); | 357 | SetupOptions(program, profile, header); |
| 330 | switch (program.stage) { | 358 | switch (program.stage) { |
| 359 | case Stage::Geometry: | ||
| 360 | header += fmt::format("PRIMITIVE_IN {};" | ||
| 361 | "PRIMITIVE_OUT {};" | ||
| 362 | "VERTICES_OUT {};", | ||
| 363 | InputPrimitive(profile.input_topology), | ||
| 364 | OutputPrimitive(program.output_topology), program.output_vertices); | ||
| 365 | break; | ||
| 331 | case Stage::Compute: | 366 | case Stage::Compute: |
| 332 | header += fmt::format("GROUP_SIZE {} {} {};", program.workgroup_size[0], | 367 | header += fmt::format("GROUP_SIZE {} {} {};", program.workgroup_size[0], |
| 333 | program.workgroup_size[1], program.workgroup_size[2]); | 368 | program.workgroup_size[1], program.workgroup_size[2]); |