From f15cb8900fe022be63e0610dbb6598624cddda80 Mon Sep 17 00:00:00 2001 From: BZLZHH Date: Sat, 8 Aug 2026 13:17:58 -0400 Subject: [PATCH] [Feat] (MG_Backend/DirectGLES): advertise GL_KHR_parallel_shader_compile when async is enabled Gated on the configuration flag on purpose: the string is the one change a retrace can never cover (Iris/Sodium pipeline their submissions differently once they see it), so the kill switch has to withdraw the app-visible behaviour along with the threading. --- .../DirectGLES/BackendObject_DirectGLES.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/MobileGL/MG_Backend/DirectGLES/BackendObject_DirectGLES.cpp b/MobileGL/MG_Backend/DirectGLES/BackendObject_DirectGLES.cpp index b077fb5f..abf2294d 100644 --- a/MobileGL/MG_Backend/DirectGLES/BackendObject_DirectGLES.cpp +++ b/MobileGL/MG_Backend/DirectGLES/BackendObject_DirectGLES.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -891,6 +892,22 @@ namespace MobileGL::MG_Backend::DirectGLES { // extension explicitly permits. It is also the only thing that // exposes glProgramParameteri before GL 4.1. E_GL_ARB_get_program_binary}; + // GL_KHR_parallel_shader_compile is MobileGL's own capability, not the host ES + // driver's: the compiler threads are MobileGL's, and glCompileShader/glLinkProgram + // are serviced entirely inside the frontend. Whether the device driver advertises + // the string is irrelevant here (the POST reports it separately, for the day the + // driver-side link is what gets parallelised). + // + // Gated on the async flag deliberately, and this is the whole reason the gate + // exists. Advertising the string is the one part of asynchronous compilation that a + // recorded trace can never cover: Iris and Sodium change their SUBMISSION SCHEDULE + // the moment they see it - they enqueue whole pipeline batches and poll + // GL_COMPLETION_STATUS_KHR instead of compiling one program at a time - so + // MOBILEGL_ASYNC_SHADER_COMPILE=0 has to withdraw the application-visible behaviour + // change as well as the threading, or the kill switch would only be half a switch. + if (MG_Util::Async::AsyncShaderCompileEnabled()) { + extensions.push_back(E_GL_KHR_parallel_shader_compile); + } // Only advertised when the device driver actually has usable timer queries // (GL_EXT_disjoint_timer_query plus its entry points) and the // MOBILEGL_DISABLE_TIMERQUERY escape hatch is off.