[Feat] (P13 W4b/W4c): Espryt monolith takes the record arm for textures, readbacks, framebuffers, units, images, programs and XFB

This commit is contained in:
2026-10-06 08:14:54 -04:00
parent a7409e1e9a
commit 2af4728e70
22 changed files with 520 additions and 187 deletions
+2 -24
View File
@@ -20,33 +20,11 @@
#include <MG_Impl/GLImpl/Buffer/GL_Buffer.h>
#include <MG_Impl/GetProcAddress.h>
#include <MG_Impl/GLImpl/Getter/GL_Getter.h>
#include <MG_Test/ScopedMonolithFrontendArm.h>
using namespace MobileGL;
namespace {
// P13 W4a: THE MONOLITH FRONTEND ARM, PINNED. The cases that use this assert how the frontend
// object pushes a map's bytes when the backend reads the object itself - the arm W4 retires
// family by family and W6 deletes. On the record arm (every wire, and monolith's from W4a) the
// client's persistent-map tracker owns that push instead, which the split lanes cover. When
// W6 deletes the frontend arm, these cases go with it.
class ScopedMonolithFrontendArm {
public:
ScopedMonolithFrontendArm() {
#if MOBILEGL_BUILD_DISAGGREGATED
m_saved = MG_Config::MonolithTakesRecordArm;
MG_Config::MonolithTakesRecordArm = false;
#endif
}
~ScopedMonolithFrontendArm() {
#if MOBILEGL_BUILD_DISAGGREGATED
MG_Config::MonolithTakesRecordArm = m_saved;
#endif
}
private:
Bool m_saved = false;
};
} // namespace
using MobileGL::MG_Test::ScopedMonolithFrontendArm;
class BufferTest : public ::testing::Test {
protected:
@@ -0,0 +1,49 @@
// MobileGL - MobileGL/MG_Test/ScopedMonolithFrontendArm.h
// Copyright (c) 2025-2026 MobileGL-Dev
// Licensed under the GNU Lesser General Public License v3.0:
// https://www.gnu.org/licenses/gpl-3.0.txt
// https://www.gnu.org/licenses/lgpl-3.0.txt
// SPDX-License-Identifier: LGPL-3.0-only
// End of Source File Header
#pragma once
#include <Config.h>
#include <MG_Backend/BackendObjects.h>
namespace MobileGL::MG_Test {
// P13 W4: THE MONOLITH FRONTEND ARM, PINNED FOR ONE CASE. A case that uses this asserts how
// the frontend answers when the backend reads the frontend's objects itself - pushing a map's
// bytes through the object, reading a texture back from the frontend's own level shadow - which
// is the arm W4 retires family by family and W6 deletes. On the record arm (every wire, and
// monolith's from W4) the client tracker and the backend's record readers own those answers,
// and the split and integration lanes cover them. When W6 deletes the frontend arm, the cases
// that use this go with it.
//
// Both halves of the arm: the predicate, and the backend table (the verb port's slots go back
// to the backend's own entry points for the scope).
class ScopedMonolithFrontendArm {
public:
ScopedMonolithFrontendArm() : m_savedTable(MG_Backend::gBackendFunctionsTable) {
#if MOBILEGL_BUILD_DISAGGREGATED
m_saved = MG_Config::MonolithTakesRecordArm;
MG_Config::MonolithTakesRecordArm = false;
if (MG_Config::Transport == MG_Config::TransportMode::Monolith && MG_Backend::pActiveBackendObject) {
MG_Backend::gBackendFunctionsTable = MG_Backend::pActiveBackendObject->GetBackendFunctions();
}
#endif
}
~ScopedMonolithFrontendArm() {
#if MOBILEGL_BUILD_DISAGGREGATED
MG_Config::MonolithTakesRecordArm = m_saved;
#endif
MG_Backend::gBackendFunctionsTable = m_savedTable;
}
ScopedMonolithFrontendArm(const ScopedMonolithFrontendArm&) = delete;
ScopedMonolithFrontendArm& operator=(const ScopedMonolithFrontendArm&) = delete;
private:
MG_Backend::GlobalBackendFunctionsTable m_savedTable;
Bool m_saved = false;
};
} // namespace MobileGL::MG_Test
+4
View File
@@ -13,6 +13,7 @@
#include "Includes.h"
#include "Init.h"
#include <MG_Test/ScopedMonolithFrontendArm.h>
#include <Config.h>
#include <MG_Backend/BackendObjects.h>
#include <MG_Backend/DirectGLES/Managers.h>
@@ -1065,6 +1066,7 @@ TEST_F(TextureTest, EverySamplerScalarPnameConvertsToTheQueriedType) {
// caller's buffer: on glGetTexImage, which has no bufSize argument, that is a heap overflow of
// (shadowTexelSize - clientTexelSize) * texelCount bytes. It must refuse instead.
TEST_F(TextureTest, ShadowReadbackRefusesALayoutItCannotProduceInsteadOfOverrunningTheBuffer) {
const MobileGL::MG_Test::ScopedMonolithFrontendArm frontendArm;
GLuint texture = 0;
MG_Impl::GLImpl::GenTextures(1, &texture);
ASSERT_NE(texture, 0u);
@@ -1106,6 +1108,7 @@ TEST_F(TextureTest, ShadowReadbackRefusesALayoutItCannotProduceInsteadOfOverrunn
// readback path DOES write it. Refusing keeps the two paths from answering the same call with two
// different destination layouts.
TEST_F(TextureTest, ShadowReadbackRefusesAPackStateItCannotHonour) {
const MobileGL::MG_Test::ScopedMonolithFrontendArm frontendArm;
GLuint texture = 0;
MG_Impl::GLImpl::GenTextures(1, &texture);
ASSERT_NE(texture, 0u);
@@ -2144,6 +2147,7 @@ TEST_F(TextureTest, GetTextureSubImageSelectsTheCubeFaceZOffsetNames) {
// precisely. glGetTexImage passes no bufSize, which skips the destination-size branch but NOT the
// PBO one, so this is the only spelling where the six-face sizing was reachable at all.
TEST_F(TextureTest, GetTexImageOfOneCubeFacePacksIntoAOneFacePixelPackBuffer) {
const MobileGL::MG_Test::ScopedMonolithFrontendArm frontendArm;
constexpr GLsizei kEdge = 2;
constexpr SizeT kFaceBytes = static_cast<SizeT>(kEdge) * kEdge * 4;
@@ -23,6 +23,7 @@
#include "Includes.h"
#include "Init.h"
#include <MG_Test/ScopedMonolithFrontendArm.h>
#include <MG_Backend/BackendObjects.h>
#include <MG_Impl/GLImpl/Getter/GL_Getter.h>
#include <MG_Impl/GLImpl/Framebuffer/GL_Framebuffer.h>
@@ -521,6 +522,7 @@ namespace {
// resolves the face into a Vulkan baseArrayLayer and was always right, which is what made this
// a disagreement between the two backends rather than a uniform wrong answer.)
TEST_F(TextureViewTest, CubeMapViewOfAnArrayReadsTheFaceEachTokenNames) {
const MobileGL::MG_Test::ScopedMonolithFrontendArm frontendArm;
constexpr GLint kLayers = 8;
constexpr GLint kViewMinLayer = 2;