From dd98c450ada3f46916adcd778918e472f1d696a5 Mon Sep 17 00:00:00 2001 From: Swung0x48 Date: Thu, 27 Aug 2026 23:13:45 -0400 Subject: [PATCH] [Test] (SelfTest): model the params-before-upload escape so a params-first probe regression reads as a red test --- .../MG_Test/SelfTest/DriverBugProbesTest.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/MobileGL/MG_Test/SelfTest/DriverBugProbesTest.cpp b/MobileGL/MG_Test/SelfTest/DriverBugProbesTest.cpp index f8b65d93..330953bf 100644 --- a/MobileGL/MG_Test/SelfTest/DriverBugProbesTest.cpp +++ b/MobileGL/MG_Test/SelfTest/DriverBugProbesTest.cpp @@ -174,6 +174,13 @@ namespace { GLsizei height = 0; GLsizei layers = 0; unsigned levelMask = 0; + // The device rule the probe reproduces: the mirrored layout is only picked when + // the levels were uploaded onto a texture still at the driver defaults - any + // glTexParameteri BEFORE the first upload steers the driver to the plain layout. + // Modelling it makes a params-first probe (the round-one regression: it measured + // "clean" in the very context whose params-after textures mirrored) stop + // detecting, which turns that mistake into a red test instead of a silent miss. + bool paramsTouchedBeforeUpload = false; }; std::map packedArrayAllocations; // framebuffer id -> the plain 2D texture glFramebufferTexture2D attached. @@ -488,6 +495,12 @@ namespace { g_fake.multisampleAlphaSwizzle[g_fake.boundMultisampleTexture] = static_cast(param); } + // A parameter write on a 2D array that has no uploaded level yet steers the + // driver's layout choice to the plain order (see FakeArrayAllocation). + if (target == GL_TEXTURE_2D_ARRAY && + g_fake.packedArrayAllocations.count(g_fake.boundArrayTexture) == 0) { + g_fake.packedArrayAllocations[g_fake.boundArrayTexture].paramsTouchedBeforeUpload = true; + } }; // The packed16 probe's endpoints. A plain 2D image stores its 5551 words in the // canonical (non-REV) order on every knob setting - the defect is confined to array @@ -532,7 +545,8 @@ namespace { const bool measuredShape = allocation != g_fake.packedArrayAllocations.end() && allocation->second.width == 30 && allocation->second.height == 30 && allocation->second.layers == 12 && - allocation->second.levelMask == 0b111u; + allocation->second.levelMask == 0b111u && + !allocation->second.paramsTouchedBeforeUpload; if (measuredShape && g_fake.packed16ArrayAllocationMirrored) { word = MirrorPacked5551(word); }