Skip to content

Commit 75c8028

Browse files
committed
renderer: disable EXT_gpu_shader4 on Intel cards with GLSL 1.20 (Intel GMA)
1 parent bf13a80 commit 75c8028

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/engine/sys/sdl_glimp.cpp

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ static Cvar::Cvar<bool> workaround_glDriver_mesa_forceS3tc(
155155
"workaround.glDriver.mesa.forceS3tc",
156156
"Enable S3TC on Mesa even when libtxc-dxtn is not available",
157157
Cvar::NONE, true );
158+
static Cvar::Cvar<bool> workaround_glDriver_mesa_intel_glsl120_disableGpuShader4(
159+
"workaround.glDriver.mesa.intel.glsl120.disableGpuShader4",
160+
"Disable EXT_gpu_shader4 on Mesa Intel driver with GLSL 1.20",
161+
Cvar::NONE, true );
158162
static Cvar::Cvar<bool> workaround_glDriver_mesa_intel_gma3_forceFragmentShader(
159163
"workaround.glDriver.mesa.intel.gma3.forceFragmentShader",
160164
"Force fragment shader on Intel GMA Gen 3 hardware",
@@ -2171,8 +2175,23 @@ static void GLimp_InitExtensions()
21712175
}
21722176
}
21732177

2178+
/* Mesa implements incomplete GL_EXT_gpu_shader4 for the Intel GMA Gen 4.
2179+
See: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12803 */
2180+
bool gpuShader4Enabled = r_ext_gpu_shader4.Get();
2181+
2182+
if ( gpuShader4Enabled
2183+
&& GL_EXT_gpu_shader4
2184+
&& glConfig2.shadingLanguageVersion <= 120
2185+
&& glConfig2.driverVendor == glDriverVendor_t::MESA
2186+
&& glConfig2.hardwareVendor == glHardwareVendor_t::INTEL
2187+
&& workaround_glDriver_mesa_intel_glsl120_disableGpuShader4.Get() )
2188+
{
2189+
logger.Warn( "Found buggy Mesa EXT_gpu_shader4 implementation with GLSL 1.20 Intel card, disabling EXT_gpu_shader4." );
2190+
gpuShader4Enabled = false;
2191+
}
2192+
21742193
// made required in OpenGL 3.0
2175-
glConfig2.gpuShader4Available = LOAD_EXTENSION_WITH_TEST( ExtFlag_CORE, EXT_gpu_shader4, r_ext_gpu_shader4.Get() );
2194+
glConfig2.gpuShader4Available = LOAD_EXTENSION_WITH_TEST( ExtFlag_CORE, EXT_gpu_shader4, gpuShader4Enabled );
21762195

21772196
// made required in OpenGL 4.0
21782197
glConfig2.gpuShader5Available = LOAD_EXTENSION_WITH_TEST( ExtFlag_NONE, ARB_gpu_shader5, r_arb_gpu_shader5.Get() );

0 commit comments

Comments
 (0)