[Refactor] (P13 W5 S3): the record arm's definitions and its depth-resolve probe source follow the record-arm guard.

This commit is contained in:
2026-10-06 11:58:18 -04:00
parent 1956d6cd6f
commit cb81610b2b
15 changed files with 66 additions and 30 deletions
+18 -12
View File
@@ -553,6 +553,17 @@ if (MOBILEGL_BUILD_DISAGGREGATED AND
set(MOBILEGL_BUILD_DISAGGREGATED_INPROC OFF)
endif()
# P13 W5 (notes/p13/W5-DESIGN.md): THE RECORD ARM'S OWN GUARD. A plain variable, not an option and
# not a cache entry, so no build tree can keep a stale value (W3a's lesson): it equals
# MOBILEGL_BUILD_DISAGGREGATED while the record arm's guards are reclassified one by one - every
# such commit leaves both library shapes byte-identical - and one later commit sets it on for every
# build (the library without MG_Remote then runs the record arm). Always defined, to 0 or 1.
if (MOBILEGL_BUILD_DISAGGREGATED)
set(MOBILEGL_BUILD_RECORD_ARM ON)
else()
set(MOBILEGL_BUILD_RECORD_ARM OFF)
endif()
message(STATUS "MobileGL: PipeInputs push ON, appending the MGPipe fill sources")
list(APPEND SOURCE_FILES
MobileGL/MG_Backend/MGPipe/PipeInputs.cpp
@@ -673,10 +684,15 @@ if (MOBILEGL_BUILD_DISAGGREGATED)
MobileGL/MG_Remote/Server/ServerDisplay.cpp
# Package-neutral C ABI for an APK that owns the server and its ANativeWindow.
MobileGL/MG_Remote/Server/EmbeddedServer.cpp
)
endif()
# P13 W5: the record arm's own sources, compiled wherever the record arm is (MG_Remote or not).
if (MOBILEGL_BUILD_RECORD_ARM)
list(APPEND SOURCE_FILES
# P7 gate 5 (g5-msprobe): the Magma wire arm's two multisample depth/stencil resolve
# arms and the probe that measures the first against the second, shared by the
# renderer's bring-up and the Vulkan POST. Wire-only - the monolith records neither arm -
# so it stays out of the pull build (gate G1).
# renderer's bring-up and the Vulkan POST.
MobileGL/MG_Backend/DirectVulkan/Renderer/WireDepthResolveProbe.cpp
)
endif()
@@ -743,16 +759,6 @@ if (MOBILEGL_BUILD_DISAGGREGATED)
list(APPEND MOBILEGL_COMPILE_DEF -DMOBILEGL_BUILD_DISAGGREGATED=1)
endif()
# P13 W5 (notes/p13/W5-DESIGN.md): THE RECORD ARM'S OWN GUARD. A plain variable, not an option and
# not a cache entry, so no build tree can keep a stale value (W3a's lesson): it equals
# MOBILEGL_BUILD_DISAGGREGATED while the record arm's guards are reclassified one by one - every
# such commit leaves both library shapes byte-identical - and one later commit sets it on for every
# build (the library without MG_Remote then runs the record arm). Always defined, to 0 or 1.
if (MOBILEGL_BUILD_DISAGGREGATED)
set(MOBILEGL_BUILD_RECORD_ARM ON)
else()
set(MOBILEGL_BUILD_RECORD_ARM OFF)
endif()
if (MOBILEGL_BUILD_RECORD_ARM)
list(APPEND MOBILEGL_COMPILE_DEF -DMOBILEGL_BUILD_RECORD_ARM=1)
else()
+1 -1
View File
@@ -3512,7 +3512,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
return twin ? twin->get() : nullptr;
}
#if MOBILEGL_BUILD_DISAGGREGATED
#if MOBILEGL_BUILD_RECORD_ARM
void RequireStagedCoverage(GLESBufferResource& resource, const Uint8* hostBase, SizeT start,
SizeT end, const char* site) {
ServerStaged().RequireCoverage(&resource, hostBase, start, end, site);
+1 -1
View File
@@ -46,7 +46,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
}
#endif
#if MOBILEGL_BUILD_DISAGGREGATED
#if MOBILEGL_BUILD_RECORD_ARM
const FormatCapabilityCache* ActiveBackendFormatCaps() {
// Under a live split session the SERVER's private backend is what owns the context on the
// apply thread (and these reads all run there), so its cache is the authoritative one.
@@ -602,7 +602,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
Bool BackendObject_DirectVulkan::ExportNativeFence(int* fence) {
*fence = -1;
#if MOBILEGL_BUILD_RECORD_ARM
#if MOBILEGL_BUILD_DISAGGREGATED
const std::lock_guard<std::recursive_mutex> lock(m_eglStateMutex);
return pVulkanRenderer ? pVulkanRenderer->ExportNativeFence(fence) : true;
#else
@@ -68,7 +68,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
SessionLocal<RendererGeneration> g_rendererGeneration;
} // namespace
#if MOBILEGL_BUILD_DISAGGREGATED
#if MOBILEGL_BUILD_RECORD_ARM
namespace {
// P7 wave 2 package C, CONTRACT-P7 §5.5: MAGMA'S MIRROR OF g_glesStateObjectDeathOps
// (DirectGLES/Managers.cpp:335), and the one arm of that table Magma has any work in.
@@ -126,7 +126,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
Bool StateObjectDeathOpsInstalled() {
return MG_State::GLState::GetStateObjectDeathOps() == &g_magmaStateObjectDeathOps;
}
#endif // MOBILEGL_BUILD_DISAGGREGATED && MOBILEGL_PIPE_PUSH
#endif // MOBILEGL_BUILD_RECORD_ARM && MOBILEGL_PIPE_PUSH
Uint64 GetRendererGeneration() {
return g_rendererGeneration->value.load(std::memory_order_acquire);
@@ -2627,7 +2627,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
return true;
}
#if MOBILEGL_BUILD_DISAGGREGATED
#if MOBILEGL_BUILD_RECORD_ARM
Bool UniformManager::ResolveWireUniformBufferPayload(const MagmaProgramSource& program,
Uint32 blockIndex, Uint32 bindingPoint, UboBindResult& out) const {
if (bindingPoint >= MG_Pipe::kMGPipeMaxBufferBindingPoints)
@@ -240,7 +240,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
#endif
} // namespace
#if MOBILEGL_BUILD_DISAGGREGATED
#if MOBILEGL_BUILD_RECORD_ARM
void VkBufferManager::RegisterWireResourceOps() {
if (MG_Config::DataArmIsRecord()) {
MG_Pipe::MGPipeSetResourceOps(&g_vulkanWireResourceOps);
@@ -13,7 +13,7 @@
#endif
namespace MobileGL::MG_Backend::DirectVulkan {
#if MOBILEGL_BUILD_DISAGGREGATED
#if MOBILEGL_BUILD_RECORD_ARM
void VkBufferObject::MoveExternalFrom(VkBufferObject& other) {
m_device = other.m_device;
m_externalMemory = other.m_externalMemory;
@@ -1868,7 +1868,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
return prunedCount;
}
#if MOBILEGL_BUILD_DISAGGREGATED
#if MOBILEGL_BUILD_RECORD_ARM
// ---------------------------------------------------------------------------------
// P5f (fm): THE HANDLE-KEYED TEXTURE ARM
// ---------------------------------------------------------------------------------
@@ -3265,7 +3265,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
std::construct_at(&resource, Move(grown));
return true;
}
#endif // MOBILEGL_BUILD_DISAGGREGATED
#endif // MOBILEGL_BUILD_RECORD_ARM
Bool VkTextureManager::SyncTexture(MG_State::GLState::ITextureObject &texture,
TextureResource &outResource) {
@@ -14155,7 +14155,7 @@ void main() {
return m_deviceLost;
}
#if MOBILEGL_BUILD_DISAGGREGATED
#if MOBILEGL_BUILD_RECORD_ARM
Bool VulkanRenderer::LatchWireDeviceLoss(const char* site) {
if (!IsDeviceLost()) return false;
if (!m_deviceLossLatched) {
@@ -1,5 +1,5 @@
// Server-owned draw/dispatch setup. The legacy setup remains the monolith implementation.
#if MOBILEGL_BUILD_DISAGGREGATED
#if MOBILEGL_BUILD_RECORD_ARM
static MagmaProgramSource WireProgramSource(MG_Pipe::MGPipeHandle handle) {
auto& state = MG_Pipe::MGPipeApplier();
const Bool composite = handle.Slot >= MG_Pipe::kMGPipeShaderCsoCompositeSlotBase;
+2 -2
View File
@@ -47,7 +47,7 @@ namespace MobileGL::MG_Pipe {
return std::nullopt;
}
#if MOBILEGL_BUILD_DISAGGREGATED
#if MOBILEGL_BUILD_RECORD_ARM
// ================================================================================
// P5: the server's verb stamp, the residual-pull counter, and the four-way read verdict
// ================================================================================
@@ -594,7 +594,7 @@ namespace MobileGL::MG_Pipe {
if (ownership == MGPipeFieldOwnership::kBarrierPulled)
CountBarrierPull(field, gPipeInputs.CurrentVerb());
}
#endif // MOBILEGL_BUILD_DISAGGREGATED
#endif // MOBILEGL_BUILD_RECORD_ARM
#if MOBILEGL_PIPE_VERIFY
namespace {
@@ -440,7 +440,7 @@ namespace MobileGL::MG_State::GLState {
NotifySubData(m_mappedRange.start, m_mappedRange.end - m_mappedRange.start);
}
#if MOBILEGL_BUILD_DISAGGREGATED
#if MOBILEGL_BUILD_RECORD_ARM
void BufferObject::PushMappedSpanBlock(SizeT offset, SizeT size) {
// NotifySubData and not MGPipeEmitResourceSubData directly: the serial bump, the
// defined-content promotion and the legacy-ops fallback are what the monolith span
@@ -0,0 +1,21 @@
# P13 W5 S3, round 2: the definitions the record arm links against (from the trial flip's undefined symbols).
open | MobileGL/MG_Backend/DirectGLES/Managers.cpp | Bool ResourceContentIsDeclared(
open | MobileGL/MG_Backend/DirectGLES/Utils.cpp | ActiveBackendFormatCaps()
open | MobileGL/MG_Backend/DirectVulkan/Renderer/VkBufferObject.cpp | ::MoveExternalFrom(
open | MobileGL/MG_Backend/DirectVulkan/Renderer/VulkanRenderer.cpp | ::LatchIfGpuHung(
open | MobileGL/MG_Backend/DirectVulkan/Renderer/VulkanRenderer.cpp | ::LatchWireDeviceLoss(
open | MobileGL/MG_Backend/DirectVulkan/Renderer/VkBufferManager.cpp | ::AcquireWireSlice(
open | MobileGL/MG_Backend/DirectVulkan/Renderer/VkBufferManager.cpp | ::RegisterWireResourceOps(
open | MobileGL/MG_Backend/DirectVulkan/Renderer/VkBufferManager.cpp | ::MarkWireBufferGpuWritten(
open | MobileGL/MG_Backend/DirectVulkan/Renderer/VkBufferManager.cpp | ::SweepDeferredWireReleases(
open | MobileGL/MG_Backend/DirectVulkan/Renderer/VkBufferManager.cpp | ::DestroyAllDeferredWireReleases(
open | MobileGL/MG_Backend/DirectVulkan/Renderer/VkTextureManager.cpp | ::ReadUnbackedWireLevel(
open | MobileGL/MG_Backend/DirectVulkan/Renderer/VkTextureManager.cpp | ::GrowWireTextureMipChain(
open | MobileGL/MG_Backend/DirectVulkan/Renderer/VkTextureManager.cpp | ::MarkWireTextureGpuWritten(
open | MobileGL/MG_Backend/DirectVulkan/Renderer/VkTextureManager.cpp | ::ResolveWireTextureStorage(
open | MobileGL/MG_Backend/DirectVulkan/Renderer/VkTextureManager.cpp | ::SyncTextureResourceByHandle(
open | MobileGL/MG_Backend/DirectVulkan/DirectVulkan.cpp | void InstallStateObjectDeathOps()
open | MobileGL/MG_Backend/MGPipe/PipeInputs.cpp | MGPipeStickyForwardPull(
open | MobileGL/MG_State/GLState/BufferState/BufferObject.cpp | ::NotePersistentMapStateChanged(
open | MobileGL/MG_State/GLState/BufferState/BufferObject.cpp | ::HasLiveHostWritesForWire(
open | MobileGL/MG_Backend/DirectVulkan/Renderer/UniformManager.cpp | ::ResolveWireUniformBufferPayload(
@@ -81,12 +81,24 @@ def main():
ops = [l for l in pathlib.Path(sys.argv[1]).read_text(encoding='utf-8').splitlines()
if l.strip() and not l.lstrip().startswith('#')]
files = {}
failed = 0
for op in ops:
parts = [p.strip() for p in op.split(' | ')]
kind, path = parts[0], parts[1]
if path not in files:
files[path] = load(path)
crlf, lines = files[path]
try:
apply_one(kind, lines, parts)
except SystemExit as failure:
print('FAILED:', op, '->', failure)
failed += 1
for path, (crlf, lines) in files.items():
save(path, crlf, lines)
print('applied', len(ops) - failed, 'of', len(ops), 'op(s) to', len(files), 'file(s)')
def apply_one(kind, lines, parts):
if kind == 'open':
op_open(lines, parts[2])
elif kind == 'nest':
@@ -99,9 +111,6 @@ def main():
lines[a] = parts[3]
else:
raise SystemExit('unknown op ' + kind)
for path, (crlf, lines) in files.items():
save(path, crlf, lines)
print('applied', len(ops), 'op(s) to', len(files), 'file(s)')
if __name__ == '__main__':