[Fix] (Espryt): probe every allocation recipe of the packed16 shape - the Mali layout heuristic inverts between contexts, so one recipe cannot speak for the storage

This commit is contained in:
2026-08-28 00:22:16 -04:00
parent dd98c450ad
commit 971537058e
2 changed files with 152 additions and 110 deletions
+26 -23
View File
@@ -299,34 +299,37 @@ namespace MobileGL::MG_Util::SelfTest {
const ImageCoherencyResidualMeasurement& ImageWriteReadCoherencyResidual(
const MG_External::GLESFunctionsTable& gl);
// Copies one known GL_UNSIGNED_SHORT_5_5_5_1 word out of BOTH mip levels of a GL_RGB5_A1
// 2D array into plain 2D images with glCopyImageSubData and reads the landed texels back.
// Returns true only when a copy from EITHER level delivers the word's 5_5_5_1 <->
// 1_5_5_5_REV field-order mirror while both controls below hold.
// Copies one known GL_UNSIGNED_SHORT_5_5_5_1 word out of both mip levels of a GL_RGB5_A1
// 2D array into plain 2D images with glCopyImageSubData and reads the landed texels back
// - for SEVERAL ALLOCATION RECIPES of the same array. Returns true only when a copy from
// any level of any recipe delivers the word's 5_5_5_1 <-> 1_5_5_5_REV field-order mirror
// while the controls below hold.
//
// The affected Mali stores SOME 16-bit packed allocations (RGB565 / RGB5_A1 / RGBA4) with
// their fields packed from the other end of the word, and the mirrored layout is an
// ALLOCATION property, not a mip-level one: on the failing device this probe's 30x30x12
// three-level array delivers the mirror from level 0 and level 1 alike, which is what
// vetoed the first deployment's "level 0 is the clean control" design. Which allocations
// mirror depends on shape AND context history (a raw standalone context mirrors one- and
// two-level 30x30x12 arrays but not a fresh three-level one; MobileGL's live context
// mirrors the three-level one too), so the probe measures IN SITU - this context is the
// one the application's copies run in - on the CTS's own failing shape (three-level
// chains both endpoints: 30/15/7 x12 array, 7/3/1 plain, FUNCTIONAL_TEST_N_LEVELS = 3).
// Uploads and readbacks decode each image's own layout consistently, so nothing but a raw
// texel-block move can see the divergence - which is exactly what glCopyImageSubData is
// defined to be, and why the whole KHR-GL4x.copy_image rgb5/rgb5_a1/rgba4 x *2d_array*
// matrix fails there while every other suite touching these formats passes.
// their fields packed from the other end of the word. The mirrored layout is an
// ALLOCATION property, not a mip-level one - the failing device delivers the mirror from
// level 0 and level 1 alike, which is what vetoed the first deployment's "level 0 is the
// clean control" design - and WHICH allocations get it is a heuristic keying on texture
// state during the uploads and on context history, measured to INVERT between a raw
// standalone context and MobileGL's live one. No single allocation recipe is therefore
// entitled to speak for the layout: the probe builds the CTS's failing shape (three-level
// chains both endpoints: 30/15/7 x12 array, 7/3/1 plain, FUNCTIONAL_TEST_N_LEVELS = 3)
// with three recipes - uploads-first (the minted-backend-texture order), params-first,
// and the CTS copy-test shape (MAX_LEVEL bounded, MIN_FILTER left mipmapped-default) -
// in situ, in the very context the application's copies run in. Uploads and readbacks
// decode each image's own layout consistently, so nothing but a raw texel-block move can
// see the divergence - which is exactly what glCopyImageSubData is defined to be, and why
// the whole KHR-GL4x.copy_image rgb5/rgb5_a1/rgba4 x *2d_array* matrix fails there while
// every other suite touching these formats passes.
//
// TWO CONTROLS. The machinery: an identical copy between two SAME-shape plain-2D images,
// CONTROLS. The machinery: an identical copy between two SAME-shape plain-2D images,
// which share a layout whatever it is, so it must deliver the word on any driver that can
// run copy_image on these formats - a driver that cannot reaches no verdict instead of
// being reported as this. And the array's own round trip: a direct FBO readback of its
// level 1 must answer the word, or the UPLOAD is what corrupts - a different defect. The
// subjects must also match the mirror PREDICTION, not merely differ from the word - a
// copy that delivered anything else is a different defect and reaches no verdict either.
// Restores every piece of GL state it touches.
// being reported as this. And per recipe, the array's own round trip: a direct FBO
// readback of its level 1 must answer the word, or the UPLOAD is what corrupts - a
// different defect. The subjects must also match the mirror PREDICTION, not merely differ
// from the word - a copy that delivered anything else is a different defect and reaches
// no verdict either. Restores every piece of GL state it touches.
Bool ProbeCopyImageMirrorsPacked16FieldOrder(const MG_External::GLESFunctionsTable& gl);
// ProbeCopyImageMirrorsPacked16FieldOrder(), evaluated at most once per process. The