nv2a/vk: Apply the Nvidia geometry shader bug work around with Vulkan too

This is possibly not needed with Vulkan, but apply it anyway just in case.
This commit is contained in:
coldhex
2025-10-24 15:31:28 -04:00
committed by mborgerson
parent 834c4bbfda
commit ba9761fc97
+12 -9
View File
@@ -66,16 +66,19 @@ static const char *geometry_shader_source =
"layout(location = 0) out vec3 fragColor;\n"
"layout(location = 0) in vec3 v_fragColor[];\n"
"\n"
"void emit_vertex(int index) {\n"
" gl_Position = gl_in[index].gl_Position;\n"
" fragColor = v_fragColor[0];\n"
" EmitVertex();\n"
"}\n"
"\n"
"void main() {\n"
" emit_vertex(0);\n"
" emit_vertex(1);\n"
" emit_vertex(2);\n"
" for (int i = 0; i < 3; i++) {\n"
// This should be just:
// gl_Position = gl_in[i].gl_Position;
// fragColor = v_fragColor[0];
// but we apply the same Nvidia bug work around from gl/gpuprops.c
// to be on the safe side even if the compilers involved with
// Vulkan are different.
" gl_Position = gl_in[i].gl_Position + vec4(1.0/16384.0, 1.0/16384.0, 0.0, 0.0);\n"
" precise vec3 color = v_fragColor[0]*(0.999 + gl_in[i].gl_Position.x/16384.0) + v_fragColor[1]*0.00005 + v_fragColor[2]*0.00005;\n"
" fragColor = color;\n"
" EmitVertex();\n"
" }\n"
" EndPrimitive();\n"
"}\n";