[Refactor] (P13 W5 S7): the record verbs' verb-state stamps, the record-reading draw and sampler passes and the image-bindable re-mint follow the record-arm guard.

This commit is contained in:
2026-10-06 13:51:25 -04:00
parent aa5c12b08c
commit 557975bf2d
4 changed files with 17 additions and 17 deletions
@@ -1069,7 +1069,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
}
}
#if MOBILEGL_BUILD_DISAGGREGATED
#if MOBILEGL_BUILD_RECORD_ARM
// P5e (vi), CONTRACT-P5E §5.1: THE SAME MEMO, THE SAME THREE-VALUE KEY, AND A WALK THAT
// READS NO FRONTEND AT ALL. The arm above keeps the frontend attribute walk because the
// push-monolith build has to keep its bytes (§5.8); this one is what a server with no
@@ -1218,7 +1218,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
const Uint64 bufferEpoch = CurrentBufferMutationEpoch();
auto* memo = vaoTwin ? &vaoTwin->GetResolvedDrawBuffersMemo() : nullptr;
const Uint32 configVersion = vaoConfigVersion;
#if MOBILEGL_BUILD_DISAGGREGATED
#if MOBILEGL_BUILD_RECORD_ARM
if (VertexInputReadsRecords()) {
SyncVaoAttributeBuffersByRecord(memo, bufferEpoch);
} else
@@ -1290,7 +1290,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
// the config version). A stale identity hit is impossible in effect: the
// clean probe re-validates the resource against the LIVE bound object.
if (includeIBO) {
#if MOBILEGL_BUILD_DISAGGREGATED
#if MOBILEGL_BUILD_RECORD_ARM
// P5e (vi), CONTRACT-P5E §5.1: the index buffer is st.IndexBuffer.Res and the
// "has it moved" question is st.IndexBufferSerial. The identity compare stays -
// it always did, because the index slot is outside the configuration version
@@ -7613,7 +7613,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
handleArm ? PrgramImpl::ProgramBlockBindingFromRecord(*programRecord, i)
:
currentProgram->GetUniformBlockBinding(i);
#if MOBILEGL_BUILD_DISAGGREGATED
#if MOBILEGL_BUILD_RECORD_ARM
// P5e (sb, §5.6): THE POINT HALF, by record. `binding` above is the
// PROGRAM's block binding and stays exactly where it is (it is package
// pg's row); what moves is the point it indexes. The index space is the
@@ -7790,7 +7790,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
samplerBinding.lastAssignedUnit = unit;
}
#if MOBILEGL_BUILD_DISAGGREGATED
#if MOBILEGL_BUILD_RECORD_ARM
// P5e (tx2), CONTRACT-P5E §5.3. THE SAMPLER PASS, FROM RECORDS.
//
// Four frontend reads used to live in this loop body and every one of
+2 -2
View File
@@ -4041,7 +4041,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
resource->persistentMapped = false;
resource->persistentPtr = nullptr;
resource->immutableStorage = false;
#if MOBILEGL_BUILD_DISAGGREGATED
#if MOBILEGL_BUILD_RECORD_ARM
// m-5 / codex 5: OnBackendContextDestroyed ran MGL_SERVER_STAGED_DROP_ALL(), which
// frees every server shadow but does NOT null the hostBytes that name them - so a
// twin that SURVIVES a context loss still carries a base into the freed allocation.
@@ -6553,7 +6553,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
if (m_imageBindableStorageRequired) {
return;
}
#if MOBILEGL_BUILD_DISAGGREGATED
#if MOBILEGL_BUILD_RECORD_ARM
// P13 W4b (defect h): monolith's record arm takes the body too; its old arm only
// cleared m_isInitialized and replayed the frontend shadow at the next sync.
if (MG_Config::DataArmIsRecord()) {
@@ -1846,7 +1846,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
EraseTrackedTexture(identity);
}
prunedCount += orphanIdentities.size();
#if MOBILEGL_BUILD_DISAGGREGATED
#if MOBILEGL_BUILD_RECORD_ARM
const auto pruneWire = [&](auto& resources, const auto& records) {
for (auto it = resources.begin(); it != resources.end();) {
const Uint32 slot = static_cast<Uint32>(it->first >> 32) & 0x7fffffffu;
@@ -130,7 +130,7 @@ namespace MobileGL::MG_Record {
const MG_Backend::GlobalBackendFunctionsTable* table = Table("blit");
if (table == nullptr) return false;
if (table->GL.BlitFramebuffer == nullptr) return false;
#if MOBILEGL_BUILD_DISAGGREGATED
#if MOBILEGL_BUILD_RECORD_ARM
// P5c (hd, CONTRACT-P5C §3.3): the record's handles cross to the backend as the verb's
// own state. The bound form carries two nulls and nothing changes; the named form's
// pair is what the backend's named-blit arm resolves - the sink no longer relies on
@@ -148,7 +148,7 @@ namespace MobileGL::MG_Record {
blit.DstY0, blit.DstX1, blit.DstY1,
static_cast<GLbitfield>(blit.Mask),
static_cast<GLenum>(blit.Filter));
#if MOBILEGL_BUILD_DISAGGREGATED
#if MOBILEGL_BUILD_RECORD_ARM
if (named && !applierState.VerbBlitNamedConsumed) {
MGLOG_E_ONCE("MGPipe: a named blit (read {%u, %u}, draw {%u, %u}) reached a backend "
"with no named-blit arm; the verb is DECLINED rather than applied to "
@@ -303,7 +303,7 @@ namespace MobileGL::MG_Record {
}
Bool RecordVerbSink::ReadTextureImageTight(const MG_Pipe::MGPReadbackInfo& image, Vector<Uint8>& bytes) {
#if MOBILEGL_BUILD_DISAGGREGATED
#if MOBILEGL_BUILD_RECORD_ARM
if (m_backend && m_backend->GetBackendType() == BackendType::DirectGLES)
return MG_Backend::DirectGLES::ReadTextureImageWire(image, bytes);
if (m_backend && m_backend->GetBackendType() == BackendType::DirectVulkan &&
@@ -619,7 +619,7 @@ namespace MobileGL::MG_Record {
}
++m_drawRecords;
#if MOBILEGL_BUILD_DISAGGREGATED
#if MOBILEGL_BUILD_RECORD_ARM
// Ruling 19 / ID-95: the window promise, checked at every draw, before the backend is
// asked to resolve anything out of the windows.
if (!CheckUnitWindows(MG_Pipe::MGPipeApplier(), "draw_vbo")) return false;
@@ -645,7 +645,7 @@ namespace MobileGL::MG_Record {
if (indirect != nullptr) {
// The layout already refused a record that sets both flags or declares ranges
// beside the block, so NumDraws is 0 and there is no span here.
#if MOBILEGL_BUILD_DISAGGREGATED
#if MOBILEGL_BUILD_RECORD_ARM
// P5c (hd, CONTRACT-P5C §3.5): the command/parameter buffer handles cross as the
// verb's own state; the backend's indirect arm resolves the buffer twins from
// them instead of reading the client's GL_DRAW_INDIRECT_BUFFER binding slot.
@@ -843,7 +843,7 @@ namespace MobileGL::MG_Record {
// identical - and it is also the honest statement of the debt, which `rsp` counts.
Bool RecordVerbSink::OnLaunchGrid(const MG_Pipe::MGPGridInfo& grid) {
#if MOBILEGL_BUILD_DISAGGREGATED
#if MOBILEGL_BUILD_RECORD_ARM
// Ruling 19 / ID-95: a dispatch samples through the same unit windows a draw does.
if (!CheckUnitWindows(MG_Pipe::MGPipeApplier(), "launch_grid")) return false;
#endif
@@ -868,7 +868,7 @@ namespace MobileGL::MG_Record {
// IndirectBuffer travels for P7's sake; the BINDING is server state, put there by
// the set_buffer_bindings record that preceded this one, exactly as OnClear's Fbo
// is not re-resolved here. glDispatchComputeIndirect takes only the offset.
#if MOBILEGL_BUILD_DISAGGREGATED
#if MOBILEGL_BUILD_RECORD_ARM
// P5c (hd, CONTRACT-P5C §3.5): the buffer handle itself is now also the verb's own
// state, so the backend's dispatch-indirect arm resolves the twin from the record
// rather than from the client's GL_DISPATCH_INDIRECT_BUFFER binding slot.
@@ -1116,7 +1116,7 @@ namespace MobileGL::MG_Record {
Bool RecordVerbSink::OnGenerateMipmap(const MG_Pipe::MGPMipPlan& plan) {
const auto* table = Table("GenerateMipmap");
if (table == nullptr || table->GL.GenerateMipmap == nullptr) return false;
#if MOBILEGL_BUILD_DISAGGREGATED
#if MOBILEGL_BUILD_RECORD_ARM
// P5c (hd, CONTRACT-P5C §3.2): the texture the client resolved at Target on the active
// unit crosses as the verb's own state; the backend's mip-descriptor check resolves
// the record from it instead of probing the client allocator for the bound object's
@@ -1134,7 +1134,7 @@ namespace MobileGL::MG_Record {
Bool RecordVerbSink::OnCopyFramebufferToTexture(const MG_Pipe::MGPCopyFromFramebuffer& copy) {
const auto* table = Table(copy.SubImage ? "CopyTexSubImage2D" : "CopyTexImage2D");
if (table == nullptr) return false;
#if MOBILEGL_BUILD_DISAGGREGATED
#if MOBILEGL_BUILD_RECORD_ARM
// P5c (hd, CONTRACT-P5C §3.4): the destination texture the client resolved at the
// active unit crosses as the verb's own state; the backend resolves its twin from the
// handle instead of reading the client's texture-unit binding slot (T4).