From 31b8d0aff84c89b3da6d9a1b07204bab14a13b75 Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Tue, 10 Dec 2024 20:43:06 +0100 Subject: [PATCH] #364 add hack for Intel HD 4000 driver Build 10.18.10.4252 bug - disable multipass shader --- inc/opengl_utils.h | 1 + src/opengl_utils.c | 2 ++ src/render_ogl.c | 20 ++++++++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/inc/opengl_utils.h b/inc/opengl_utils.h index 4449951..d84dd20 100644 --- a/inc/opengl_utils.h +++ b/inc/opengl_utils.h @@ -115,5 +115,6 @@ extern HMODULE g_oglu_hmodule; extern BOOL g_oglu_got_version2; extern BOOL g_oglu_got_version3; extern char g_oglu_version[]; +extern char g_oglu_version_long[]; #endif diff --git a/src/opengl_utils.c b/src/opengl_utils.c index 8062fdd..e315b15 100644 --- a/src/opengl_utils.c +++ b/src/opengl_utils.c @@ -95,6 +95,7 @@ HMODULE g_oglu_hmodule; BOOL g_oglu_got_version2; BOOL g_oglu_got_version3; char g_oglu_version[128]; +char g_oglu_version_long[128]; BOOL oglu_load_dll() { @@ -201,6 +202,7 @@ void oglu_init() if (glversion) { strncpy(g_oglu_version, glversion, sizeof(g_oglu_version) - 1); + strncpy(g_oglu_version_long, glversion, sizeof(g_oglu_version_long) - 1); g_oglu_version[sizeof(g_oglu_version) - 1] = '\0'; /* strncpy fix */ strtok(g_oglu_version, " "); } diff --git a/src/render_ogl.c b/src/render_ogl.c index efde47f..1630fc5 100644 --- a/src/render_ogl.c +++ b/src/render_ogl.c @@ -248,6 +248,26 @@ static void ogl_build_programs() _snprintf(shader_path, sizeof(shader_path) - 1, "%s%s", g_config.dll_path, g_config.shader); } + + /* Hack for Intel HD 4000 driver bug - disable multipass shader */ + + if (_stricmp(g_oglu_version_long, "4.0.0 - Build 10.18.10.4252") == 0) + { + char shader_path_tmp[MAX_PATH] = { 0 }; + strncpy(shader_path_tmp, shader_path, sizeof(shader_path_tmp)); + + if (strlen(shader_path_tmp) <= sizeof(shader_path_tmp) - 8) + { + strcat(shader_path_tmp, ".pass1"); + + if (FILE_EXISTS(shader_path_tmp)) + { + shader_path[0] = 0; + g_config.shader[0] = 0; + } + } + } + /* detect common upscaling shaders and disable them if no upscaling is required */ BOOL is_upscaler =