Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/engine/renderer/DetectGLVendors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ std::string GetGLHardwareVendorName( glHardwareVendor_t hardwareVendor )
"Broadcom",
"Intel",
"Nvidia",
"Moore Threads",
"OutOfRange",
};

Expand All @@ -71,6 +72,7 @@ std::string GetGLDriverVendorName( glDriverVendor_t driverVendor )
"Intel",
"Mesa",
"Nvidia",
"Moore Threads",
"OutOfRange",
};

Expand Down Expand Up @@ -117,10 +119,12 @@ void DetectGLVendors(
// Mesa Panfrost, newer Panfrost uses "Mesa" instead.
{ "Panfrost", { glDriverVendor_t::MESA, glHardwareVendor_t::ARM } },
// Mesa Nvidia for supported OpenGL 2+ hardware.
// Mesa Amber also provides "Nouveau", but this is for unsupported pre-OpenGL 2 Nvidia.
{ "nouveau", { glDriverVendor_t::MESA, glHardwareVendor_t::NVIDIA } },
// Proprietary Nvidia drivers on all systems like Linux, Windows, and macOS.
{ "NVIDIA Corporation", { glDriverVendor_t::NVIDIA, glHardwareVendor_t::NVIDIA } },
// Mesa Amber also provides "Nouveau", but this is for unsupported pre-OpenGL 2 Nvidia.
// Moore Threads drivers on Linux and Windows.
{ "Moore Threads", { glDriverVendor_t::MTHREADS, glHardwareVendor_t::MTHREADS } },
};

auto it = vendorDriverHardware.find( vendorString );
Expand Down
2 changes: 2 additions & 0 deletions src/engine/renderer/DetectGLVendors.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ enum class glHardwareVendor_t
BROADCOM,
INTEL,
NVIDIA,
MTHREADS,
NUM_HARDWARE_VENDORS,
};

Expand All @@ -67,6 +68,7 @@ enum class glDriverVendor_t
INTEL,
MESA,
NVIDIA,
MTHREADS,
NUM_DRIVER_VENDORS,
};

Expand Down
25 changes: 25 additions & 0 deletions src/engine/sys/sdl_glimp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ static Cvar::Cvar<bool> workaround_glHardware_intel_useFirstProvokinVertex(
"workaround.glHardware.intel.useFirstProvokinVertex",
"Use first provoking vertex on Intel hardware supporting ARB_provoking_vertex",
Cvar::NONE, true );
static Cvar::Cvar<bool> workaround_glHardware_mthreads_disableTextureBarrier(
"workaround.glHardware.mthreads.disableTextureBarrier",
"Disable ARB_texture_barrier on Moore Threads hardware",
Cvar::NONE, true );

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

if ( glConfig.textureBarrierAvailable
&& glConfig.hardwareVendor == glHardwareVendor_t::MTHREADS
&& workaround_glHardware_mthreads_disableTextureBarrier.Get() )
{
/* Texture barrier doesn't make sense on a tiled GPU architecture,
so implementing it on Moore Threads hardware would be meaningless,
see: https://github.com/DaemonEngine/Daemon/pull/1890#issuecomment-3872010479

It's still possible for drivers to implement unoptimal emulation just
to provide compliance.

It happens that the implementation of the MTT actually produces garbage
on screen, see: https://github.com/DaemonEngine/Daemon/issues/1891

Either being unoptimal, or the implementation being buggy, we better
disable the feature on such hardware. */
logger.Warn( "Found Moore Threads hardware with tiled architecture, disabling ARB_texture_barrier.");
glConfig.textureBarrierAvailable = false;
}

// made required in OpenGL 4.3
glConfig.computeShaderAvailable = LOAD_EXTENSION_WITH_TEST( ExtFlag_NONE, ARB_compute_shader, r_arb_compute_shader.Get() );

Expand Down Expand Up @@ -2679,6 +2703,7 @@ bool GLimp_Init()
Cvar::Latch( workaround_glExtension_glsl120_disableShaderDrawParameters );
Cvar::Latch( workaround_glExtension_glsl120_disableGpuShader4 );
Cvar::Latch( workaround_glHardware_intel_useFirstProvokinVertex );
Cvar::Latch( workaround_glHardware_mthreads_disableTextureBarrier );

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