diff --git a/MobileGL/MG_State/GLState/BufferState/BufferObject.cpp b/MobileGL/MG_State/GLState/BufferState/BufferObject.cpp index 06f717de..56c9cbbd 100644 --- a/MobileGL/MG_State/GLState/BufferState/BufferObject.cpp +++ b/MobileGL/MG_State/GLState/BufferState/BufferObject.cpp @@ -210,7 +210,7 @@ namespace MobileGL::MG_State::GLState { } m_size = size; m_resource.ResizeShadow(size); -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM // The store this buffer's membership was about no longer exists, and ResizeShadow is // reserve+resize - a grow past the reserve reallocates - so a pushed block's source // base has moved too. Both are the same event to the tracker: re-read the predicate. @@ -359,7 +359,7 @@ namespace MobileGL::MG_State::GLState { m_mappedRange = {0, 0}; m_stagingBias = 0; m_ownsStagingData = false; -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM // AFTER the reset, so the predicate reads the post-unmap state, and after the landing // above, so the last bytes of a write map are already on the wire when the record // that says "no live writer" goes out behind them. @@ -536,7 +536,7 @@ namespace MobileGL::MG_State::GLState { Memcpy(m_resource.Bytes() + atOffset, data.data, data.size); ++m_changeSerial; MGP_NOTE_AGGREGATE(BufferChange); -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM // THE THIRD STATE'S ONLY EXIT. In a split build SyncGpuWrites does NOT clear the // flag before emitting, because between the emission and the answer the shadow is // stale and the object has no way to say so; the answer landing here is what makes it @@ -819,7 +819,7 @@ namespace MobileGL::MG_State::GLState { m_mappingAccess = (read ? BufferMappingAccessBit::Read : BufferMappingAccessBit::Null) | (write ? BufferMappingAccessBit::Write : BufferMappingAccessBit::Null); m_mappedRange = {0, m_size}; -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM // glMapBuffer never takes the Persistent bit, so this buffer can never join the // push set - but a WRITE map still mutates the shadow with no call, which is the // half of the live-host-writes bit that is not about the push at all. @@ -904,7 +904,7 @@ namespace MobileGL::MG_State::GLState { m_isMapped = true; m_mappingAccess = access; m_mappedRange = range; -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM // BEFORE the adoption attempt below, deliberately. Under R-6 the acquisition always // declines, so the predicate this publishes is already final; if a later phase ever // mints one, the adoption path notes the change itself (it does now - the call is @@ -933,7 +933,7 @@ namespace MobileGL::MG_State::GLState { MG_Remote::Client::PersistentMapTracker::Instance().Forget(*this); #endif m_resource.AdoptPersistentMap(pushedBase); -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM // An adoption takes the buffer OUT of the push set and out of the // live-host-writes state: the application now writes coherent GPU memory // and there is nothing to ship. Under R-6 this is unreachable; it is here diff --git a/MobileGL/MG_State/GLState/BufferState/BufferObject.h b/MobileGL/MG_State/GLState/BufferState/BufferObject.h index 815663bc..47d89726 100644 --- a/MobileGL/MG_State/GLState/BufferState/BufferObject.h +++ b/MobileGL/MG_State/GLState/BufferState/BufferObject.h @@ -187,7 +187,7 @@ namespace MobileGL { // from every path that reads the shadow on the app's behalf. void SyncGpuWrites(); -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM // ---- P5 b1: the two things a split build has to do that a monolith does not --- // // Everything here is behind the build option AND behind @@ -321,7 +321,7 @@ namespace MobileGL { // and, in a split build, cleared by WritebackFromBackend instead, because there // the answer arrives later than the request. See SyncGpuWrites' definition. Bool m_gpuWritePending = false; -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM // The last value of MGPResourceDesc::HasLiveHostWrites this object published. // Behind the option so the pull build's layout - and therefore every inlined // constructor and accessor in it - does not move (G1). diff --git a/MobileGL/MG_State/GLState/BufferState/PipeResource.h b/MobileGL/MG_State/GLState/BufferState/PipeResource.h index 8fb16d6c..ea811138 100644 --- a/MobileGL/MG_State/GLState/BufferState/PipeResource.h +++ b/MobileGL/MG_State/GLState/BufferState/PipeResource.h @@ -53,7 +53,7 @@ namespace MobileGL::MG_State::GLState { // never exceed what was allocated. The pull build keeps the exact count and does not // see this function at all: it has no tracker to spend the rounding on, and G1 holds // its symbol set and .text byte-identical only if allocate()'s own text does not move. -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM inline constexpr SizeT ShadowAllocationBytesFor(SizeT count) { return (count + SHADOW_ALLOCATION_ALIGNMENT - 1) & ~(SHADOW_ALLOCATION_ALIGNMENT - 1); } @@ -73,7 +73,7 @@ namespace MobileGL::MG_State::GLState { T* allocate(SizeT count) { if (count == 0) return nullptr; -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM return static_cast(::operator new(ShadowAllocationBytesFor(count * sizeof(T)), std::align_val_t{SHADOW_ALLOCATION_ALIGNMENT})); #else @@ -141,7 +141,7 @@ namespace MobileGL::MG_State::GLState { const SizeT reserved = std::bit_ceil(size == 0 ? SizeT{1} : size); m_shadow->reserve(reserved); m_shadow->resize(size); -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM // RECORDED HERE, NOT INFERRED FROM capacity(). `reserved` is the count this // call asked the allocator for, so ShadowAllocationBytesFor(reserved) is the // block the allocator handed back whenever this reserve reallocated - and when @@ -162,7 +162,7 @@ namespace MobileGL::MG_State::GLState { MapAlignedData& Shadow() { return *m_shadow; } const MapAlignedData& Shadow() const { return *m_shadow; } -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM // The extent of the shadow's heap allocation in bytes, as ResizeShadow asked for // it: every byte of [Bytes(), Bytes() + this) belongs to this shadow and to // nothing else, and the extent is a whole number of SHADOW_ALLOCATION_ALIGNMENT @@ -182,7 +182,7 @@ namespace MobileGL::MG_State::GLState { m_gpuMapped = mappedBase; m_shadow->clear(); m_shadow->shrink_to_fit(); -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM // The block is gone with the shrink; the next ResizeShadow records the next one. m_shadowExtent = 0; #endif @@ -209,7 +209,7 @@ namespace MobileGL::MG_State::GLState { SharedPtr m_shadow = MakeShared(); void* m_gpuMapped = nullptr; SharedPtr m_backend; -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM // See ShadowAllocationBytes. Split-only so the pull build's layout does not move (G1). SizeT m_shadowExtent = 0; #endif diff --git a/MobileGL/MG_State/GLState/FramebufferState/FramebufferState.cpp b/MobileGL/MG_State/GLState/FramebufferState/FramebufferState.cpp index a8b01cb2..75b84ac2 100644 --- a/MobileGL/MG_State/GLState/FramebufferState/FramebufferState.cpp +++ b/MobileGL/MG_State/GLState/FramebufferState/FramebufferState.cpp @@ -87,7 +87,7 @@ namespace MobileGL::MG_State::GLState { return m_framebufferObjects.find(index) != m_framebufferObjects.end(); } -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM SharedPtr FramebufferState::FindFramebufferObjectByLifetimeId(Uint64 lifetimeId) const { for (const auto& [index, framebufferObject] : m_framebufferObjects) { if (framebufferObject && framebufferObject->GetLifetimeId() == lifetimeId) { diff --git a/MobileGL/MG_State/GLState/FramebufferState/FramebufferState.h b/MobileGL/MG_State/GLState/FramebufferState/FramebufferState.h index 98e044e8..6cf5ef92 100644 --- a/MobileGL/MG_State/GLState/FramebufferState/FramebufferState.h +++ b/MobileGL/MG_State/GLState/FramebufferState/FramebufferState.h @@ -28,7 +28,7 @@ namespace MobileGL::MG_State::GLState { Bool ValidateName(Uint index) const; Bool ValidateFramebufferObject(Uint index) const; -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM // P5c (G6, CONTRACT-P5C §3.3/§5.4): the reverse of HandleFor() for a server that holds // only the handle - the named-blit consumer on a backend with no FBO twin registry // (Magma) resolves the verb's ReadFbo/DrawFbo to the frontend object by the lifetime diff --git a/MobileGL/MG_State/GLState/ProgramState/ProgramArtifacts.h b/MobileGL/MG_State/GLState/ProgramState/ProgramArtifacts.h index 4126f3ff..b192442f 100644 --- a/MobileGL/MG_State/GLState/ProgramState/ProgramArtifacts.h +++ b/MobileGL/MG_State/GLState/ProgramState/ProgramArtifacts.h @@ -90,7 +90,7 @@ namespace MobileGL::MG_State::GLState { using PipeInputReflection = ResourceReflection; using PipeOutputReflection = ResourceReflection; -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM // P7 wave 2 package C, OQ-8 (CONTRACT-P7 §5.3): THE SHADER STORAGE BLOCKS AS DIRECTVULKAN // INDEXES THEM, published once at link time instead of re-derived per draw. // @@ -208,7 +208,7 @@ namespace MobileGL::MG_State::GLState { // The owned reflection snapshot. Indexed by TProgram index; see the structs above. Vector uniformReflection; Vector blockReflection; -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM // P7 OQ-8: DirectVulkan's storage-block index space, filled beside blockReflection in // SnapshotGlslangReflection. See StorageBlockReflection above for what the order is // and why it is not blockReflection's. @@ -526,7 +526,7 @@ namespace MobileGL::MG_State::GLState { v("blockMemberElement", a.blockMemberElement); } // 11 fields -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM // P7 OQ-8. Three plain fields, so the generic codec arms carry it with no new arm of their // own - which is the whole reason it is a table rather than hand-written bytes. template @@ -547,7 +547,7 @@ namespace MobileGL::MG_State::GLState { void VisitFields(Self& a, V&& v) { v("uniformReflection", a.uniformReflection); v("blockReflection", a.blockReflection); -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM // Beside blockReflection because that is where it is FILLED, and a visitor that walks // the table in declaration order then reads the two together. v("storageBlocks", a.storageBlocks); @@ -634,7 +634,7 @@ namespace MobileGL::MG_State::GLState { #if defined(__GLIBCXX__) && !defined(_GLIBCXX_DEBUG) && (SIZE_MAX == UINT64_MAX) #define MGL_RESOURCEREFLECTION_SIZE 128 #define MGL_XFBVARYING_SIZE 128 -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM // P7 OQ-8 added storageBlocks, one more Vector, in the disaggregated build ONLY. The pull // number below is the one G1 measures and it has not moved. #define MGL_LINKARTIFACTS_SIZE 1080 diff --git a/MobileGL/MG_State/GLState/ProgramState/ProgramArtifactsCodec.cpp b/MobileGL/MG_State/GLState/ProgramState/ProgramArtifactsCodec.cpp index f1bef80d..e61d59c6 100644 --- a/MobileGL/MG_State/GLState/ProgramState/ProgramArtifactsCodec.cpp +++ b/MobileGL/MG_State/GLState/ProgramState/ProgramArtifactsCodec.cpp @@ -85,7 +85,7 @@ namespace MobileGL::MG_State::GLState { visit("floatValues", value.floatValues); } -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM void SchemaWord(Uint64& hash, Uint64 word) { for (unsigned i = 0; i < 8; ++i) { hash ^= (word >> (i * 8)) & 255u; @@ -200,7 +200,7 @@ namespace MobileGL::MG_State::GLState { } else if constexpr (ArchiveVector) { WriteSequence(out, value); } else if constexpr (ArchiveUniformInitializer) { -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM VisitUniformInitializer(value, [&out](const char*, const auto& member) { WriteValue(out, member); }); @@ -366,7 +366,7 @@ namespace MobileGL::MG_State::GLState { if (!in.Ok) return; } } else if constexpr (ArchiveUniformInitializer) { -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM VisitUniformInitializer(value, [&in](const char*, auto& member) { if (in.Ok) ReadValue(in, member); }); @@ -389,7 +389,7 @@ namespace MobileGL::MG_State::GLState { // v1 is retained for local monolith verification. Its native size echo is not a // wire compatibility fact: libstdc++ writes 1056 while unpinned libc++ writes zero. -#if !MOBILEGL_BUILD_DISAGGREGATED +#if !MOBILEGL_BUILD_RECORD_ARM #ifdef MGL_LINKARTIFACTS_SIZE inline constexpr Uint64 kLinkArtifactsSizeEcho = MGL_LINKARTIFACTS_SIZE; #else @@ -398,7 +398,7 @@ namespace MobileGL::MG_State::GLState { #endif } // namespace -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM Uint64 ProgramArtifactsSchemaFingerprint() { static const Uint64 fingerprint = [] { Uint64 hash = 1469598103934665603ull; @@ -417,7 +417,7 @@ namespace MobileGL::MG_State::GLState { void EncodeProgramArtifacts(const LinkArtifacts& link, const SpirvArtifacts& spirv, Vector& out) { PutRaw(out, kProgramArtifactsCodecVersion); -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM PutRaw(out, ProgramArtifactsSchemaFingerprint()); #else PutRaw(out, kLinkArtifactsSizeEcho); @@ -446,7 +446,7 @@ namespace MobileGL::MG_State::GLState { // Refuse the declared wire shape before reading any field. In v2 the second word // follows serialization types/order; C++ container object sizes are irrelevant. if (version != kProgramArtifactsCodecVersion) return false; -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM if (schema != ProgramArtifactsSchemaFingerprint()) return false; #else if (schema != kLinkArtifactsSizeEcho) return false; diff --git a/MobileGL/MG_State/GLState/ProgramState/ProgramArtifactsCodec.h b/MobileGL/MG_State/GLState/ProgramState/ProgramArtifactsCodec.h index 5fd7fe95..8bcf94ad 100644 --- a/MobileGL/MG_State/GLState/ProgramState/ProgramArtifactsCodec.h +++ b/MobileGL/MG_State/GLState/ProgramState/ProgramArtifactsCodec.h @@ -60,7 +60,7 @@ namespace MobileGL::MG_State::GLState { // Bumped whenever the byte format changes in a way a previous reader would misread. A // reader that sees a different word REFUSES; it never tries to guess a layout. -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM // 3 since P7 wave 2 package C (OQ-8): LinkArtifacts gained `storageBlocks`, so a v2 reader // would run out of bytes in the middle of the stream rather than notice. The schema // fingerprint beside the version would catch it on its own - it is derived from the diff --git a/MobileGL/MG_State/GLState/ProgramState/ProgramLinkTask.cpp b/MobileGL/MG_State/GLState/ProgramState/ProgramLinkTask.cpp index 52ef9155..c501f5a6 100644 --- a/MobileGL/MG_State/GLState/ProgramState/ProgramLinkTask.cpp +++ b/MobileGL/MG_State/GLState/ProgramState/ProgramLinkTask.cpp @@ -106,7 +106,7 @@ namespace { return bracket == MobileGL::String::npos ? name : name.substr(0, bracket); } -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM // P7 OQ-8. ShaderStage -> EShLanguage, so a reflection record's `stages` mask (which is an // EShLanguageMask) can be tested against the stage of a snapshotted shader. Written here // rather than lifted into a shared header because this is the only caller and @@ -1758,7 +1758,7 @@ namespace MobileGL::MG_State::GLState { } SnapshotGlslangReflection(); -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM // P7 OQ-8. Guarded at the CALL as well as at the definition, which is not belt and // braces: LinkArtifacts::storageBlocks does not exist in a pull build, so neither can // the function that fills it, and G1 requires this translation unit to be statement @@ -1768,7 +1768,7 @@ namespace MobileGL::MG_State::GLState { return true; } -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM // P7 wave 2 package C, OQ-8 (CONTRACT-P7 §5.3): DIRECTVULKAN'S STORAGE-BLOCK INDEX SPACE, // BUILT ONCE HERE INSTEAD OF PER DRAW. // diff --git a/MobileGL/MG_State/GLState/ProgramState/ProgramLinkTask.h b/MobileGL/MG_State/GLState/ProgramState/ProgramLinkTask.h index 07dc26e3..40aa09ea 100644 --- a/MobileGL/MG_State/GLState/ProgramState/ProgramLinkTask.h +++ b/MobileGL/MG_State/GLState/ProgramState/ProgramLinkTask.h @@ -207,7 +207,7 @@ namespace MobileGL::MG_State::GLState { // one and overwritten the qualifier. See the definition for why the invented binding is // deliberately left in place for the backends' own use. void SeedDefaultStorageBlockBindings(); -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM // P7 wave 2 package C, OQ-8: builds LinkArtifacts::storageBlocks - DirectVulkan's own // storage-block index space - out of the reflection snapshot the call above produced, // so the backends stop re-deriving it with SPIRV-Reflect on every draw. Runs after diff --git a/MobileGL/MG_State/GLState/ProgramState/ProgramObject.h b/MobileGL/MG_State/GLState/ProgramState/ProgramObject.h index 1f9eb119..181f7e64 100644 --- a/MobileGL/MG_State/GLState/ProgramState/ProgramObject.h +++ b/MobileGL/MG_State/GLState/ProgramState/ProgramObject.h @@ -48,7 +48,7 @@ namespace MobileGL::MG_State::GLState { using BlockReflection = ResourceReflection; using PipeInputReflection = ResourceReflection; using PipeOutputReflection = ResourceReflection; -#if MOBILEGL_BUILD_DISAGGREGATED +#if MOBILEGL_BUILD_RECORD_ARM // P7 OQ-8: DirectVulkan's storage-block index space, carried in LinkArtifacts. using StorageBlockReflection = MobileGL::MG_State::GLState::StorageBlockReflection; #endif