From 658f01865f967eee2c12aa0d0b397a1910299c82 Mon Sep 17 00:00:00 2001 From: Erik Abair Date: Thu, 18 Dec 2025 15:11:23 -0800 Subject: [PATCH] nv2a/gl: Check GL_LINK_STATUS when loading cached shaders The GL docs indicate that GL_LINK_STATUS will be set to false in cases where the cached binary cannot be loaded successfully. This seems to be separate from the listed glGetError failure modes, indicating that both likely need to be tested. --- hw/xbox/nv2a/pgraph/gl/shaders.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hw/xbox/nv2a/pgraph/gl/shaders.c b/hw/xbox/nv2a/pgraph/gl/shaders.c index 4400133434..0c36d0f20c 100644 --- a/hw/xbox/nv2a/pgraph/gl/shaders.c +++ b/hw/xbox/nv2a/pgraph/gl/shaders.c @@ -324,6 +324,15 @@ bool pgraph_gl_shader_load_from_memory(ShaderBinding *binding) return false; } + GLint link_status = GL_FALSE; + glGetProgramiv(gl_program, GL_LINK_STATUS, &link_status); + if (!link_status) { + NV2A_DPRINTF( + "failed to load shader binary from disk: link status is FALSE\n"); + glDeleteProgram(gl_program); + return false; + } + glUseProgram(gl_program); g_free(binding->program);