glass dirty-skip: fold palette generation into the repaint token

Latent flaw in the c9e25e5 dirty-skip (now in master): the token hashes plane
PIXELS + lamp state only, but the ColorMapper gauge family (armor rosette
tints, the adpal/adpal2 damage flash) animates by writing CLUT entries with
ZERO pixel churn -- so a glass window whose plane is pixel-static held stale
colors while the D3D surround (which re-expands every frame) tracked live.

New SVGA16::paletteGeneration, bumped by the palette writers:
  - BuildSecondaryColor: only on a REAL entry change (the flash alternates
    palettes every Execute writing identical RGB at zero damage -- an
    unconditional bump would repaint every palette-expanding window every
    pump for nothing);
  - BuildSecondaryPalette / BuildAuxiliaryPalette / BlankPalette (full
    rebuilds): unconditionally.
GlassWindowToken folds it in for palette-expanding windows (monoTint < 0, or
all windows under BT_GLASS_MFD_PAL); mono-tint windows don't read the palette
and keep their pixel-only token.

KB: glass-cockpit.md gains the repaint-pump section (records f3d27f5 +
c9e25e5 + this).  Companion branch sec-phantom-fix carries the idx-254
translation-table fix -- disjoint hunks, merges in either order.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-08-10 10:56:49 -05:00
co-authored by Claude Opus 4.8
parent 773595b347
commit f65b191181
4 changed files with 75 additions and 0 deletions
+12
View File
@@ -2104,7 +2104,19 @@ static unsigned long
if (svga == NULL) svga = static_cast<SVGA16*>(p->graphicsDisplay);
}
if (svga != NULL && combined != 0)
{
token ^= svga->PlaneChecksum(combined);
// PALETTE-ANIMATED content (2026-08-10): a palette-expanding window
// (the radar; MFDs under BT_GLASS_MFD_PAL) changes colour with ZERO
// pixel writes -- the ColorMapper family (armor rosette tints, the
// adpal/adpal2 damage flash) writes CLUT entries. Fold the palette
// write generation in so those changes repaint; mono-tint windows
// don't read the palette and keep their pixel-only token.
static int sPalTok = -1;
if (sPalTok < 0) sPalTok = getenv("BT_GLASS_MFD_PAL") ? 1 : 0;
if (w->monoTint < 0 || sPalTok)
token = (token ^ svga->PaletteGeneration()) * 16777619UL;
}
}
// Lamps: each button's RENDERED brightness + held/latched, so a flash toggle or a