[Fix] (Espryt): probe empty image units and keep invalid units empty on drivers that read them as zero

This commit is contained in:
2026-10-13 08:02:34 -04:00
parent d6b0eba8fe
commit 8ecab66567
7 changed files with 166 additions and 2 deletions
@@ -2125,6 +2125,23 @@ namespace MobileGL::MG_Util::BackendLoader {
? "true (the subgroup emulation reads its scratch through atomic loads)"
: "false");
switch (MG_Config::Features.EsprytInvalidImagePlaceholder) {
case MG_Config::QuirkOverride::ForceOn:
caps.EmptyImageUnitsReadNonzero = true;
break;
case MG_Config::QuirkOverride::ForceOff:
caps.EmptyImageUnitsReadNonzero = false;
break;
case MG_Config::QuirkOverride::Auto:
default:
caps.EmptyImageUnitsReadNonzero = SelfTest::EmptyImageUnitsReadNonzero(glesFuncs);
break;
}
MGLOG_I(" Empty image units read nonzero: %s",
caps.EmptyImageUnitsReadNonzero
? "true (an invalid image unit is bound to a zeroed placeholder)"
: "false");
caps.IsAngleRenderer = caps.GLESRendererString.find("ANGLE") != String::npos;
caps.IsAngleLlvmpipeRenderer =
caps.IsAngleRenderer && caps.GLESRendererString.find("llvmpipe") != String::npos;
@@ -1329,6 +1329,11 @@ namespace MobileGL {
// Adreno). The subgroup emulation then reads its scratch through atomic loads.
// Defaults FALSE: never assumed broken on an unmeasured driver.
Bool SharedMemoryLoadsGoStale = false;
// True when a load through an EMPTY image unit returns a nonzero texel
// (SelfTest::EmptyImageUnitsReadNonzero - measured on Adreno: alpha 1). DirectGLES
// then binds an invalid unit to a zeroed placeholder instead of leaving it empty.
// Defaults FALSE: never assumed broken on an unmeasured driver.
Bool EmptyImageUnitsReadNonzero = false;
Int UniformBufferOffsetAlignment = 256;
// Its storage-buffer counterpart, queried separately because it is a separate limit:
// Adreno 830 answers 32 for GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT and 64 for