[Refactor, Test] (MG_Impl/Pipe, MG_Test/Pipe): rename ResetForTest to ForgetSession where the session end calls it

This commit is contained in:
2026-10-18 10:02:08 -04:00
parent 12a96be87c
commit 21925f99d4
8 changed files with 34 additions and 31 deletions
+3 -1
View File
@@ -400,7 +400,9 @@ namespace MobileGL::MG_Pipe {
void ResetCounters() { m_emissions = m_refusals = 0; }
void ResetForTest() {
// A session that replaced an ended one (MGPipeForgetEndedSession), and a unit fixture:
// the latches and the counters, and the build memo and last states beside them.
void ForgetSession() {
Reset();
ResetCounters();
for (auto& memo : m_buildMemo)
+3 -3
View File
@@ -3415,13 +3415,13 @@ namespace MobileGL::MG_Pipe {
MGPipeTrackerInstance().Reset();
// The texture emitter's records and its owed uploads belong to the ended server; its
// sampler references go back to the cache before the cache is emptied.
MGPipeTextureEmitterInstance().ResetForTest();
MGPipeTextureEmitterInstance().ForgetSession();
MGPipeSamplerEmitterInstance().Reset();
MGPipeSamplerCsoCacheInstance().ResetForTest();
MGPipeSamplerCsoCacheInstance().ForgetSession();
MGPipeCsoCacheInstance().Reset();
MGPipeSetHashSuppressorInstance().InvalidateAll();
MGPipeVertexInputEmitterInstance().Reset();
MGPipeFramebufferEmitterInstance().ResetForTest();
MGPipeFramebufferEmitterInstance().ForgetSession();
MGPipeImageEmitterInstance().Reset();
MGPipeProgramEmitterInstance().Reset();
MGPipeShaderBufferEmitterInstance().Reset();
+10 -9
View File
@@ -151,7 +151,7 @@ namespace MobileGL::MG_Pipe {
// never shrinks back.
Uint64 OverCapacityMints = 0;
// A RELEASE THIS CACHE COULD NOT ACCOUNT FOR. UnknownReleases: the handle names no
// entry here (a stale handle from before a ResetForTest, a handle of another kind
// entry here (a stale handle from before a ForgetSession, a handle of another kind
// passed by mistake, a handle whose entry was already evicted). UnderflowedReleases:
// the entry was found with a count already 0. Both are contract violations by a
// HOLDER and are counted rather than absorbed, because the pin they steal is
@@ -189,11 +189,12 @@ namespace MobileGL::MG_Pipe {
// named for it proves something else. It hashes nothing and simply uses the hash it is
// given; production code has no reason to call it.
//
// THE THREE MEMBERS A CONSUMER MUST NOT CALL are this one, ResetForTest() (which frees
// every slot the cache holds and drops their publication latches) and ResetCounters().
// Package B's seam is Acquire / Release / RefCountOf / RecordIsPublished / Size /
// GetCounters and nothing else - the class is public because it is header-only, not
// because all nine members are for callers.
// The members a consumer must not call are this one and ResetCounters(); ForgetSession()
// (which frees every slot the cache holds and drops their publication latches) belongs to
// the end of a session (MGPipeForgetEndedSession) and to unit fixtures. Package B's seam
// is Acquire / Release / RefCountOf / RecordIsPublished / Size / GetCounters and nothing
// else - the class is public because it is header-only, not because all nine members are
// for callers.
MGPipeHandle AcquireWithForcedHashForTest(const SamplerParameters& params, Uint64 forcedHash,
Uint64& payloadBytes) {
SamplerParameters canon;
@@ -255,8 +256,8 @@ namespace MobileGL::MG_Pipe {
return false;
}
// A unit test's fixture, and a session that replaced an ended one (MGPipeForgetEndedSession:
// the fresh server holds none of these records). NOT called from the validate point's
// A session that replaced an ended one (MGPipeForgetEndedSession: the fresh server holds
// none of these records), and a unit test's fixture. NOT called from the validate point's
// FreshlyPrimed arm: MGPipeApplierReset is a make-current and does NOT drop object
// records, so a sampler CSO the applier holds outlives a context switch. Dropping the
// cache there would leak the applier's record and re-mint a value it already has.
@@ -265,7 +266,7 @@ namespace MobileGL::MG_Pipe {
// delete_sampler_state behind them, so a latch left standing would make a future death
// helper - on the recycled slot at the same generation - emit a delete for a record
// that never existed, which is the refusal the applier counts.
void ResetForTest() {
void ForgetSession() {
for (const Entry& entry : m_entries) {
MGPipeNoteHandleUnpublished(MGPipeKind::SamplerCso, entry.Cso);
MGPipeSlots().Free(MGPipeKind::SamplerCso, entry.Cso);
+7 -7
View File
@@ -1154,16 +1154,16 @@ namespace MobileGL::MG_Pipe {
m_deadResolves = 0;
}
// A unit fixture's per-case reset, and the reset of a session that replaced an ended one
// (MGPipeForgetEndedSession: the fresh server holds none of these records). See
// MGPipeResourceTracker::ResetForTest for the rule this restates: a texture handle and
// the applier record it names are SHARE-GROUP OBJECT STATE, so nothing here is
// per-context and no re-publication path exists or may exist.
// Moves whenever the handle table below is dropped (ResetForTest), so a memo that skipped
// ForgetSession is the reset of a session that replaced an ended one
// (MGPipeForgetEndedSession: the fresh server holds none of these records), and a unit
// fixture's per-case reset. See MGPipeResourceTracker::ResetForTest for the rule this
// restates: a texture handle and the applier record it names are SHARE-GROUP OBJECT
// STATE, so nothing here is per-context and no re-publication path exists or may exist.
// Moves whenever the handle table below is dropped (ForgetSession), so a memo that skipped
// NoteTextureBoundAs / AcquireTexture for handles it already noted knows to note again.
Uint64 TableEpoch() const { return m_tableEpoch; }
void ResetForTest() {
void ForgetSession() {
++m_tableEpoch;
// EVERY REFERENCE THIS EMITTER OWES IS GIVEN BACK FIRST. A case that dropped the
// table without releasing would pin cache entries for the rest of the process and