Skip to content

Commit 1672200

Browse files
committed
sdl_glimp: disable ARB_texture_barrier on Moore Threads hardware
1 parent c71516d commit 1672200

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/engine/sys/sdl_glimp.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,10 @@ static Cvar::Cvar<bool> workaround_glHardware_intel_useFirstProvokinVertex(
185185
"workaround.glHardware.intel.useFirstProvokinVertex",
186186
"Use first provoking vertex on Intel hardware supporting ARB_provoking_vertex",
187187
Cvar::NONE, true );
188+
static Cvar::Cvar<bool> workaround_glHardware_mthreads_disableTextureBarrier(
189+
"workaround.glHardware.mthreads.disableTextureBarrier",
190+
"Disable ARB_texture_barrier on Moore Threads hardware",
191+
Cvar::NONE, true );
188192

189193
SDL_Window *window = nullptr;
190194
static SDL_PropertiesID windowProperties;
@@ -2376,6 +2380,26 @@ static void GLimp_InitExtensions()
23762380
// made required in OpenGL 4.5
23772381
glConfig.textureBarrierAvailable = LOAD_EXTENSION_WITH_TEST( ExtFlag_NONE, ARB_texture_barrier, r_arb_texture_barrier.Get() );
23782382

2383+
if ( glConfig.textureBarrierAvailable
2384+
&& glConfig.hardwareVendor == glHardwareVendor_t::MTHREADS
2385+
&& workaround_glHardware_mthreads_disableTextureBarrier.Get() )
2386+
{
2387+
/* Texture barrier doesn't make sense on a tiled GPU architecture,
2388+
so implementing it on Moore Threads hardware would be meaningless,
2389+
see: https://github.com/DaemonEngine/Daemon/pull/1890#issuecomment-3872010479
2390+
2391+
It's still possible for drivers to implement unoptimal emulation just
2392+
to provide compliance.
2393+
2394+
It happens that the implementation of the MTT actually produces garbage
2395+
on screen, see: https://github.com/DaemonEngine/Daemon/issues/1891
2396+
2397+
Either being unoptimal, or the implementation being buggy, we better
2398+
disable the feature on such hardware. */
2399+
logger.Warn( "Found Moore Threads hardware with tiled architecture, disabling ARB_texture_barrier.");
2400+
glConfig.textureBarrierAvailable = false;
2401+
}
2402+
23792403
// made required in OpenGL 4.3
23802404
glConfig.computeShaderAvailable = LOAD_EXTENSION_WITH_TEST( ExtFlag_NONE, ARB_compute_shader, r_arb_compute_shader.Get() );
23812405

@@ -2679,6 +2703,7 @@ bool GLimp_Init()
26792703
Cvar::Latch( workaround_glExtension_glsl120_disableShaderDrawParameters );
26802704
Cvar::Latch( workaround_glExtension_glsl120_disableGpuShader4 );
26812705
Cvar::Latch( workaround_glHardware_intel_useFirstProvokinVertex );
2706+
Cvar::Latch( workaround_glHardware_mthreads_disableTextureBarrier );
26822707

26832708
/* Enable S3TC on Mesa even if libtxc-dxtn is not available
26842709
The environment variables is currently always set,

0 commit comments

Comments
 (0)