diff options
| author | 2021-06-24 17:40:24 -0300 | |
|---|---|---|
| committer | 2021-07-22 21:51:39 -0400 | |
| commit | 8a3427a4c857aa08e365d1776d1f0d9f32639c9c (patch) | |
| tree | 6436b8973fe9f97c131aea892885b61215b67e01 /src/shader_recompiler/backend/glasm/emit_glasm.cpp | |
| parent | shader: Rework varyings and implement passthrough geometry shaders (diff) | |
| download | yuzu-8a3427a4c857aa08e365d1776d1f0d9f32639c9c.tar.gz yuzu-8a3427a4c857aa08e365d1776d1f0d9f32639c9c.tar.xz yuzu-8a3427a4c857aa08e365d1776d1f0d9f32639c9c.zip | |
glasm: Add passthrough geometry shader support
Diffstat (limited to 'src/shader_recompiler/backend/glasm/emit_glasm.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/glasm/emit_glasm.cpp | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm.cpp b/src/shader_recompiler/backend/glasm/emit_glasm.cpp index 2b96977b3..64787b353 100644 --- a/src/shader_recompiler/backend/glasm/emit_glasm.cpp +++ b/src/shader_recompiler/backend/glasm/emit_glasm.cpp | |||
| @@ -304,6 +304,9 @@ void SetupOptions(const IR::Program& program, const Profile& profile, | |||
| 304 | header += "OPTION NV_viewport_array2;"; | 304 | header += "OPTION NV_viewport_array2;"; |
| 305 | } | 305 | } |
| 306 | } | 306 | } |
| 307 | if (program.is_geometry_passthrough && profile.support_geometry_shader_passthrough) { | ||
| 308 | header += "OPTION NV_geometry_shader_passthrough;"; | ||
| 309 | } | ||
| 307 | if (info.uses_typeless_image_reads && profile.support_typeless_image_loads) { | 310 | if (info.uses_typeless_image_reads && profile.support_typeless_image_loads) { |
| 308 | header += "OPTION EXT_shader_image_load_formatted;"; | 311 | header += "OPTION EXT_shader_image_load_formatted;"; |
| 309 | } | 312 | } |
| @@ -410,11 +413,26 @@ std::string EmitGLASM(const Profile& profile, const RuntimeInfo& runtime_info, I | |||
| 410 | runtime_info.tess_clockwise ? "CW" : "CCW"); | 413 | runtime_info.tess_clockwise ? "CW" : "CCW"); |
| 411 | break; | 414 | break; |
| 412 | case Stage::Geometry: | 415 | case Stage::Geometry: |
| 413 | header += fmt::format("PRIMITIVE_IN {};" | 416 | header += fmt::format("PRIMITIVE_IN {};", InputPrimitive(runtime_info.input_topology)); |
| 414 | "PRIMITIVE_OUT {};" | 417 | if (program.is_geometry_passthrough) { |
| 415 | "VERTICES_OUT {};", | 418 | if (profile.support_geometry_shader_passthrough) { |
| 416 | InputPrimitive(runtime_info.input_topology), | 419 | for (size_t index = 0; index < IR::NUM_GENERICS; ++index) { |
| 417 | OutputPrimitive(program.output_topology), program.output_vertices); | 420 | if (program.info.passthrough.Generic(index)) { |
| 421 | header += fmt::format("PASSTHROUGH result.attrib[{}];", index); | ||
| 422 | } | ||
| 423 | } | ||
| 424 | if (program.info.passthrough.AnyComponent(IR::Attribute::PositionX)) { | ||
| 425 | header += "PASSTHROUGH result.position;"; | ||
| 426 | } | ||
| 427 | } else { | ||
| 428 | LOG_WARNING(Shader_GLASM, "Passthrough geometry program used but not supported"); | ||
| 429 | } | ||
| 430 | } else { | ||
| 431 | header += | ||
| 432 | fmt::format("VERTICES_OUT {};" | ||
| 433 | "PRIMITIVE_OUT {};", | ||
| 434 | program.output_vertices, OutputPrimitive(program.output_topology)); | ||
| 435 | } | ||
| 418 | break; | 436 | break; |
| 419 | case Stage::Compute: | 437 | case Stage::Compute: |
| 420 | header += fmt::format("GROUP_SIZE {} {} {};", program.workgroup_size[0], | 438 | header += fmt::format("GROUP_SIZE {} {} {};", program.workgroup_size[0], |