[Fix] (MG_Util/ShaderTranspiler, MG_State, MG_Impl/GLImpl, MG_Backend/DirectGLES): GL CTS uniform_block - coerce packed/shared block layouts to std140 at source preprocess (glslang rejects them when targeting SPIR-V; std140 is the only UBO layout the pipeline emits), GL-style block reflection (array "[0]" names, per-element struct-array expansion, unused members and declared-but-unread blocks stay active), vec4-padded GL_UNIFORM_BLOCK_DATA_SIZE, std140 array strides for struct-nested arrays (glslang reflects tight strides there), arrayed-block instances share the first instance member set, glDeleteShader-flagged names stay usable while attached, and backend ESSL emits against highp default precision so relaxed block members match across stages (KHR-GL33.shaders.uniform_block on llvmpipe: 659 Fail -> 828/828 Pass)

This commit is contained in:
2026-07-16 12:09:11 -04:00
parent 1cefb9780b
commit 254cf1dc21
11 changed files with 522 additions and 18 deletions
@@ -2732,6 +2732,17 @@ namespace MobileGL::MG_Backend::DirectGLES {
ResolveBackendEsslVersion());
spvc_compiler_options_set_bool(options, SPVC_COMPILER_OPTION_GLSL_ES, SPVC_TRUE);
spvc_compiler_options_set_bool(options, SPVC_COMPILER_OPTION_GLSL_VULKAN_SEMANTICS, SPVC_FALSE);
// Emit against highp default precision in every stage. SPIRV-Cross's fragment
// default is mediump, under which a RelaxedPrecision struct member prints with
// NO qualifier; ForceSupporterOutput later swaps the header to highp, silently
// flipping such members to highp. A uniform-block member that stays explicitly
// "mediump" in the vertex stage then mismatches, and the ES driver refuses to
// link ("definitions of uniform block ... do not match"). With highp defaults
// every relaxed member is printed with an explicit qualifier in both stages.
spvc_compiler_options_set_bool(options, SPVC_COMPILER_OPTION_GLSL_ES_DEFAULT_FLOAT_PRECISION_HIGHP,
SPVC_TRUE);
spvc_compiler_options_set_bool(options, SPVC_COMPILER_OPTION_GLSL_ES_DEFAULT_INT_PRECISION_HIGHP,
SPVC_TRUE);
spvcSession.SetOptions(options);