[Feat, Test] (MG_Impl, MG_State, MG_Util): opt-in MOBILEGL_ASYNC_OPTIMISTIC_SHADER_STATUS - shader compile status/log answer without joining, latched per compile

This commit is contained in:
2026-08-10 02:06:17 -04:00
parent d8d7530011
commit 6ea948779e
11 changed files with 898 additions and 2 deletions
@@ -126,6 +126,15 @@ namespace MobileGL::MG_Util::Async {
return AsyncShaderCompileEnabled() && !IsAsyncShaderCompileSuspended();
}
Bool OptimisticShaderStatusActive() {
switch (MG_Config::Features.AsyncOptimisticShaderStatus) {
case MG_Config::QuirkOverride::ForceOn: return AsyncShaderCompileActive();
case MG_Config::QuirkOverride::ForceOff: return false;
case MG_Config::QuirkOverride::Auto: break;
}
return kOptimisticShaderStatusDefault && AsyncShaderCompileActive();
}
Uint DetectShaderCompileThreadCount() {
if (const Uint32 configured = MG_Config::Features.AsyncShaderCompileThreads; configured > 0) {
// An explicit request is honoured as given - it is the escape hatch for measuring
@@ -59,6 +59,21 @@ namespace MobileGL::MG_Util::Async {
// GL_COMPLETION_STATUS_KHR read immediately GL_TRUE.
Bool AsyncShaderCompileActive();
// MOBILEGL_ASYNC_OPTIMISTIC_SHADER_STATUS (see Config.h): opt-in, off by default, and a
// spec violation by design - GL_COMPILE_STATUS and the shader info log answer
// optimistically while the compile job is in flight instead of joining it. Do not flip
// this default without an enumerated CTS delta: the compile-error-reporting cases WILL
// regress under it, deliberately.
inline constexpr Bool kOptimisticShaderStatusDefault = false;
// The one question the three optimistic getter sites ask. ANDed with
// AsyncShaderCompileActive() so that async-off (env kill switch) and
// glMaxShaderCompilerThreadsKHR(0) both switch the quirk off structurally: in those
// modes every compile settles before its enqueue returns, so a non-terminal node - the
// only state the quirk changes - cannot exist, and keeping the AND means there is no
// new mode interaction to reason about.
Bool OptimisticShaderStatusActive();
// min(4, big cores), where a big core is one whose cpufreq ceiling is within 15% of the
// machine maximum; the whole CPU count where that sysfs tree is absent. Clamped to [1, 4]
// because peak RSS scales as workers x largest glslang arena, and four