Skip to content

Commit 71ca36b

Browse files
committed
sdl_glimp: disable ARB_texture_barrier on GLSL 1.20 (GL 2.1) devices
1 parent 38f8def commit 71ca36b

File tree

1 file changed

+28
-14
lines changed

1 file changed

+28
-14
lines changed

src/engine/sys/sdl_glimp.cpp

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,10 @@ static Cvar::Cvar<bool> workaround_glExtension_glsl120_disableShaderDrawParamete
179179
"workaround.glExtension.glsl120.disableShaderDrawParameters",
180180
"Disable ARB_shader_draw_parameters on GLSL 1.20",
181181
Cvar::NONE, true );
182+
static Cvar::Cvar<bool> workaround_glExtension_glsl120_disableTextureBarrier(
183+
"workaround.glExtension.glsl120.disableTextureBarrier",
184+
"Disable ARB_texture_barrier on GLSL 1.20",
185+
Cvar::NONE, true );
182186
static Cvar::Cvar<bool> workaround_glExtension_glsl120_disableGpuShader4(
183187
"workaround.glExtension.glsl120.disableGpuShader4",
184188
"Disable EXT_gpu_shader4 on GLSL 1.20",
@@ -2386,24 +2390,33 @@ static void GLimp_InitExtensions()
23862390
// made required in OpenGL 4.5
23872391
glConfig.textureBarrierAvailable = LOAD_EXTENSION_WITH_TEST( ExtFlag_NONE, ARB_texture_barrier, r_arb_texture_barrier.Get() );
23882392

2389-
if ( glConfig.textureBarrierAvailable
2390-
&& glConfig.hardwareVendor == glHardwareVendor_t::MTHREADS
2391-
&& workaround_glHardware_mthreads_disableTextureBarrier.Get() )
2393+
if ( glConfig.textureBarrierAvailable )
23922394
{
2393-
/* Texture barrier doesn't make sense on a tiled GPU architecture,
2394-
so implementing it on Moore Threads hardware would be meaningless,
2395-
see: https://github.com/DaemonEngine/Daemon/pull/1890#issuecomment-3872010479
2395+
if ( glConfig.hardwareVendor == glHardwareVendor_t::MTHREADS
2396+
&& workaround_glHardware_mthreads_disableTextureBarrier.Get() )
2397+
{
2398+
/* Texture barrier doesn't make sense on a tiled GPU architecture,
2399+
so implementing it on Moore Threads hardware would be meaningless,
2400+
see: https://github.com/DaemonEngine/Daemon/pull/1890#issuecomment-3872010479
23962401
2397-
It's still possible for drivers to implement unoptimal emulation just
2398-
to provide compliance.
2402+
It's still possible for drivers to implement unoptimal emulation just
2403+
to provide compliance.
23992404
2400-
It happens that the implementation of the MTT actually produces garbage
2401-
on screen, see: https://github.com/DaemonEngine/Daemon/issues/1891
2405+
It happens that the implementation of the MTT actually produces garbage
2406+
on screen, see: https://github.com/DaemonEngine/Daemon/issues/1891
24022407
2403-
Either being unoptimal, or the implementation being buggy, we better
2404-
disable the feature on such hardware. */
2405-
logger.Warn( "Found Moore Threads hardware with tiled architecture, disabling ARB_texture_barrier.");
2406-
glConfig.textureBarrierAvailable = false;
2408+
Either being unoptimal, or the implementation being buggy, we better
2409+
disable the feature on such hardware. */
2410+
logger.Warn( "Found Moore Threads hardware with tiled architecture, disabling ARB_texture_barrier.");
2411+
glConfig.textureBarrierAvailable = false;
2412+
}
2413+
else if ( glConfig.shadingLanguageVersion <= 120
2414+
&& workaround_glExtension_glsl120_disableTextureBarrier.Get() )
2415+
{
2416+
// Seen as available but broken on ATI RV570 with Mesa 25.2.8 r300 driver.
2417+
logger.Warn( "Found ARB_texture_barrier with likely incompatible GLSL 1.20, disabling ARB_texture_barrier." );
2418+
glConfig.textureBarrierAvailable = false;
2419+
}
24072420
}
24082421

24092422
// made required in OpenGL 4.3
@@ -2705,6 +2718,7 @@ bool GLimp_Init()
27052718
Cvar::Latch( workaround_glDriver_nvidia_v340_disableTextureGather );
27062719
Cvar::Latch( workaround_glExtension_missingArbFbo_useExtFbo );
27072720
Cvar::Latch( workaround_glExtension_glsl120_disableShaderDrawParameters );
2721+
Cvar::Latch( workaround_glExtension_glsl120_disableTextureBarrier );
27082722
Cvar::Latch( workaround_glExtension_glsl120_disableGpuShader4 );
27092723
Cvar::Latch( workaround_glHardware_intel_useFirstProvokinVertex );
27102724
Cvar::Latch( workaround_glHardware_mthreads_disableTextureBarrier );

0 commit comments

Comments
 (0)