diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2021-05-20 22:27:39 +0200 |
---|---|---|
committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-23 03:51:32 +0200 |
commit | fad139a3e6f8273acb5b14296ba8fcbd0946fe76 (patch) | |
tree | 085b53f1e55f28fe37c927859abe502947f3b4eb /src/shader_recompiler/backend/glasm/emit_glasm.cpp | |
parent | renderer_opengl: State track compute assembly programs (diff) | |
download | yuzu-fad139a3e6f8273acb5b14296ba8fcbd0946fe76.tar yuzu-fad139a3e6f8273acb5b14296ba8fcbd0946fe76.tar.gz yuzu-fad139a3e6f8273acb5b14296ba8fcbd0946fe76.tar.bz2 yuzu-fad139a3e6f8273acb5b14296ba8fcbd0946fe76.tar.lz yuzu-fad139a3e6f8273acb5b14296ba8fcbd0946fe76.tar.xz yuzu-fad139a3e6f8273acb5b14296ba8fcbd0946fe76.tar.zst yuzu-fad139a3e6f8273acb5b14296ba8fcbd0946fe76.zip |
Diffstat (limited to '')
-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) { } throw InvalidArgument("Invalid stage {}", stage); } + +std::string_view InputPrimitive(InputTopology topology) { + switch (topology) { + case InputTopology::Points: + return "POINTS"; + case InputTopology::Lines: + return "LINES"; + case InputTopology::LinesAdjacency: + return "LINESS_ADJACENCY"; + case InputTopology::Triangles: + return "TRIANGLES"; + case InputTopology::TrianglesAdjacency: + return "TRIANGLES_ADJACENCY"; + } + throw InvalidArgument("Invalid input topology {}", topology); +} + +std::string_view OutputPrimitive(OutputTopology topology) { + switch (topology) { + case OutputTopology::PointList: + return "POINTS"; + case OutputTopology::LineStrip: + return "LINE_STRIP"; + case OutputTopology::TriangleStrip: + return "TRIANGLE_STRIP"; + } + throw InvalidArgument("Invalid output topology {}", topology); +} } // Anonymous namespace 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 std::string header{StageHeader(program.stage)}; SetupOptions(program, profile, header); switch (program.stage) { + case Stage::Geometry: + header += fmt::format("PRIMITIVE_IN {};" + "PRIMITIVE_OUT {};" + "VERTICES_OUT {};", + InputPrimitive(profile.input_topology), + OutputPrimitive(program.output_topology), program.output_vertices); + break; case Stage::Compute: header += fmt::format("GROUP_SIZE {} {} {};", program.workgroup_size[0], program.workgroup_size[1], program.workgroup_size[2]); |