[Fix, Test] (MG_Backend/DirectGLES, MG_State, MG_Util): publish the real default framebuffer depth/stencil format, forward the clip distance enables, and stop trusting a stale format probe for non-2D depth attachments

This commit is contained in:
2026-08-12 13:34:39 -04:00
parent f2c879528f
commit e7d6bfddac
8 changed files with 981 additions and 36 deletions
@@ -925,6 +925,9 @@ namespace MobileGL::MG_Util::BackendLoader {
if (std::strcmp(extension, "GL_EXT_multi_draw_arrays") == 0) {
hasMultiDrawArraysExtension = true;
}
if (std::strcmp(extension, "GL_EXT_clip_cull_distance") == 0) {
caps.SupportsClipDistance = true;
}
}
}
// The pointer check on top of the extension check makes each flag sufficient on its own
@@ -978,6 +981,7 @@ namespace MobileGL::MG_Util::BackendLoader {
MGLOG_I(" compute shaders (ES 3.1 core): %s", caps.SupportsComputeShader ? "yes" : "no");
MGLOG_I(" base instance (EXT_base_instance; emulated by attribute offsets when absent): %s",
caps.SupportsBaseInstance ? "yes" : "no");
MGLOG_I(" clip distances (EXT_clip_cull_distance): %s", caps.SupportsClipDistance ? "yes" : "no");
MGLOG_I("OpenGL ES capabilities:");
glesFuncs.glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, &caps.UniformBufferOffsetAlignment);
@@ -1163,6 +1163,13 @@ namespace MobileGL {
// Compute shaders are usable: ES 3.1 core (there is no pre-3.1 extension in ES), with
// the dispatch and barrier entry points resolved.
Bool SupportsComputeShader = false;
// GL_EXT_clip_cull_distance is present: the driver accepts gl_ClipDistance in ESSL
// (which is what SPIRV-Cross emits, together with a `#extension ... : require`) AND
// the GL_CLIP_DISTANCE0_EXT..7_EXT enable tokens, whose values are the desktop ones.
// ES core has neither at any version, so without this a gl_ClipDistance shader cannot
// compile and the per-distance enables have nowhere to go - clipping silently never
// happens, which is exactly what KHR-GLxx.clip_distance.functional catches.
Bool SupportsClipDistance = false;
// GL_RENDERER contains "ANGLE".
Bool IsAngleRenderer = false;
// GL_RENDERER contains both "ANGLE" and "llvmpipe".