mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 21:58:31 +09:00
- MGP_NOTE_AGGREGATE(Aggregate) next to MGP_NOTE_MUTATION in MG_Pipe/PipeMutation.h, ((void)0) in the pull build for the same reason and with the same shape. It answers a DIFFERENT question from MGP_NOTE_MUTATION - "did any object of this class move since the tracker last looked", not "did a backend move a frontend value inside its own verb" - which is why it is a second macro rather than an overload. - The counters are members of the owning MG_State container (VertexArrayState, FramebufferState, TextureState x2, BufferState) and are reached through a push-only GLContext facade, because the bump points sit on OBJECTS and an object has no back-pointer to the state that owns it. That is the free-function form P2 brief D4 allows, and it costs a global load on a path that has just written object state. - A SIXTH aggregate, VertexAttribDefault on GLContext, which D4 does not list. Its bit (NEW_VERTEX_ATTRIB_DEFAULTS) is specified there with a ContentHash over all 32 CurrentVertexAttributeValues, and hashing 768 bytes on every draw does not fit inside the T1 ceiling the same brief pins. The hash still decides whether to EMIT (D11's set-hash suppressor); the generation decides whether to hash at all. - 30 bump points: 3 VertexArrayObject config-version sites, 3 FramebufferObject object-version sites (one of them inside MOBILEGL_DEFINE_FRAMEBUFFER_DEFAULT_SETTER, so the statement carries its own line continuation), 5 texture content-version sites, 12 texture params-version sites, SamplerObject::BumpVersion as the sampler choke point, 7 BufferObject change-serial sites and the 3 glVertexAttrib* defaults. - Every counter is deliberately COARSER than the state it guards: over-firing costs one extra push, under-firing renders stale, and under-firing is the direction ARCHITECTURE.md 13.2 names as the dangerous one and the P1 verify comparator cannot see for object-class state. - TrackerTest: each bump point moves ITS aggregate and no other, plus a null-context note. - G1: the pull build is 0 added / 0 removed / 0 renamed and the four resized symbols are the contract commit's own, unchanged by this commit.
47 lines
2.0 KiB
C++
47 lines
2.0 KiB
C++
// MobileGL - MobileGL/MG_State/GLState/FramebufferState/FramebufferState.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 <Includes.h>
|
|
#include <MG_Util/Miscellany/IndexGenerator.h>
|
|
#include "FramebufferObject.h"
|
|
|
|
namespace MobileGL::MG_State::GLState {
|
|
class FramebufferState {
|
|
public:
|
|
FramebufferState();
|
|
|
|
// FBO 0 should be created by MG_Backend when initializing the context
|
|
const SharedPtr<FramebufferObject>& GetFramebufferObject(Uint index);
|
|
void GenerateNames(Uint number, Vector<Uint>& framebuffers);
|
|
const SharedPtr<FramebufferObject>& CreateFramebufferObject(Uint index);
|
|
BindingSlot<FramebufferObject>& GetBindingSlot(FramebufferTarget target);
|
|
void MarkFramebufferObjectForDeletion(Uint index);
|
|
Bool ValidateName(Uint index) const;
|
|
Bool ValidateFramebufferObject(Uint index) const;
|
|
|
|
#if MOBILEGL_PIPE_PUSH
|
|
// P2 brief D4: "did the attachment set or the default geometry of ANY framebuffer
|
|
// move". It does NOT cover a BIND - a bind writes a BindingSlot, not the object - so
|
|
// MGPipeTracker pairs this counter with the bound draw framebuffer identity, which
|
|
// is one extra load and keeps the bump points on the object where they belong.
|
|
void NoteAttachmentChanged() { ++m_anyAttachmentGeneration; }
|
|
Uint64 GetAnyAttachmentGeneration() const { return m_anyAttachmentGeneration; }
|
|
#endif
|
|
|
|
private:
|
|
#if MOBILEGL_PIPE_PUSH
|
|
Uint64 m_anyAttachmentGeneration = 0;
|
|
#endif
|
|
UnorderedMap<Uint, SharedPtr<FramebufferObject>> m_framebufferObjects;
|
|
IndexGenerator<Uint> m_indexGenerator;
|
|
Array<BindingSlot<FramebufferObject>, static_cast<SizeT>(FramebufferTarget::FramebufferTargetCount)>
|
|
m_bindingSlots;
|
|
};
|
|
} // namespace MobileGL::MG_State::GLState
|