summaryrefslogtreecommitdiff
path: root/src/shader_recompiler
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader_recompiler')
-rw-r--r--src/shader_recompiler/backend/glasm/emit_context.cpp5
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm.cpp28
2 files changed, 26 insertions, 7 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_context.cpp b/src/shader_recompiler/backend/glasm/emit_context.cpp
index 80dad9ff3..069c019ad 100644
--- a/src/shader_recompiler/backend/glasm/emit_context.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_context.cpp
@@ -83,13 +83,14 @@ EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile
83 break; 83 break;
84 } 84 }
85 const std::string_view attr_stage{stage == Stage::Fragment ? "fragment" : "vertex"}; 85 const std::string_view attr_stage{stage == Stage::Fragment ? "fragment" : "vertex"};
86 const VaryingState loads{info.loads.mask | info.passthrough.mask};
86 for (size_t index = 0; index < IR::NUM_GENERICS; ++index) { 87 for (size_t index = 0; index < IR::NUM_GENERICS; ++index) {
87 if (info.loads.Generic(index)) { 88 if (loads.Generic(index)) {
88 Add("{}ATTRIB in_attr{}[]={{{}.attrib[{}..{}]}};", 89 Add("{}ATTRIB in_attr{}[]={{{}.attrib[{}..{}]}};",
89 InterpDecorator(info.interpolation[index]), index, attr_stage, index, index); 90 InterpDecorator(info.interpolation[index]), index, attr_stage, index, index);
90 } 91 }
91 } 92 }
92 if (IsInputArray(stage) && info.loads.AnyComponent(IR::Attribute::PositionX)) { 93 if (IsInputArray(stage) && loads.AnyComponent(IR::Attribute::PositionX)) {
93 Add("ATTRIB vertex_position=vertex.position;"); 94 Add("ATTRIB vertex_position=vertex.position;");
94 } 95 }
95 if (info.uses_invocation_id) { 96 if (info.uses_invocation_id) {
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],