Skip to content

VERY experimental Nintendo Switch 2 emulator

C++

[opengl] fix GL_NV_geometry_shader_passthrough compiler complaints (#3357)

lizziecb40b310f567
diff --git a/src/shader_recompiler/backend/glsl/glsl_emit_context.cpp b/src/shader_recompiler/backend/glsl/glsl_emit_context.cpp
index 2bf7f4de13..a2df6159fb 100644
--- a/src/shader_recompiler/backend/glsl/glsl_emit_context.cpp
+++ b/src/shader_recompiler/backend/glsl/glsl_emit_context.cpp
@@ -1,4 +1,4 @@
-// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
+// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
@@ -298,10 +298,12 @@ EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile
stage_name = "gs";
header += fmt::format("layout({})in;", InputPrimitive(runtime_info.input_topology));
if (uses_geometry_passthrough) {
- header += "layout(passthrough)in gl_PerVertex{vec4 gl_Position;};";
+ // Passthru REQUIRES the layout to be defined with a corresponding name, for our sanity
+ // we will just use `gl_in[]`, if you don't the driver will complain with:
+ // 0(56) : error C7593: Builtin block member gl_Position not found in redeclaration of in gl_PerVertex
+ header += "layout(passthrough)in gl_PerVertex{vec4 gl_Position;}gl_in[];";
break;
- } else if (program.is_geometry_passthrough &&
- !profile.support_geometry_shader_passthrough) {
+ } else if (program.is_geometry_passthrough && !profile.support_geometry_shader_passthrough) {
LOG_WARNING(Shader_GLSL, "Passthrough geometry program used but not supported");
}
header += fmt::format(