Merge remote-tracking branch 'origin/glass-lamp-latency'
This commit is contained in:
@@ -1293,6 +1293,47 @@ void BTCockpitMouseUp(void)
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// (glass lamp responsiveness, 2026-08) Sweep the cockpit lamp STATE every frame.
|
||||
//
|
||||
// The lamp sweep -- LampManager::Update -> AssertNewLampValue -> RIO/PadRIO::SetLamp,
|
||||
// which is what lights the cockpit buttons -- authentically rides the gauge
|
||||
// renderer's FOREGROUND turn (GaugeRenderer::ExecuteForeground, gaugrend.cpp), and
|
||||
// that turn fires only ONCE PER FULL GAUGE CYCLE (foreground -> background -> copy).
|
||||
// The cycle only advances to the next foreground turn after the THROTTLED background
|
||||
// gauge sweep drains the whole active-instrument list -- and that background task
|
||||
// starves under load (issue #45: "every cockpit instrument freezes at its last paint
|
||||
// while the underlying values AND fps stay perfectly healthy"). So on a busy MP
|
||||
// mission the lamp sweep ran ~1x/second: the lit buttons froze / flashes stalled while
|
||||
// the 3D view (a separate per-frame foreground render) stayed smooth -- exactly the
|
||||
// "lighting slow or nonexistent" playtest reports (all on glass desktops).
|
||||
//
|
||||
// The lamp sweep is CHEAP -- deduped state pushes over ~72 lamps, no raster -- so on
|
||||
// the dev/glass composite path we run it EVERY frame here, decoupled from the gauge
|
||||
// cycle, and the buttons track the sim regardless of background-sweep slack. The pod
|
||||
// NEVER enters BTDrawGaugeInset (it drives real gauge hardware), so its authentic
|
||||
// bandwidth-paced serial lamp cadence is untouched. BT_GLASS_LAMP_SWEEP=0 restores the
|
||||
// authentic once-per-cycle behaviour.
|
||||
//
|
||||
static void
|
||||
BTGlassSweepLamps()
|
||||
{
|
||||
static int s_on = -1;
|
||||
if (s_on < 0)
|
||||
{
|
||||
const char *e = getenv("BT_GLASS_LAMP_SWEEP");
|
||||
s_on = (e != NULL && e[0] == '0') ? 0 : 1;
|
||||
}
|
||||
if (!s_on) return;
|
||||
|
||||
GaugeRenderer *gr = BTResolveGaugeRenderer();
|
||||
if (gr == NULL || application == NULL) return;
|
||||
LampManager *lm = gr->GetLampManager();
|
||||
ModeManager *mm = application->GetModeManager();
|
||||
if (lm != NULL && mm != NULL)
|
||||
lm->Update(mm->GetModeMask());
|
||||
}
|
||||
|
||||
//
|
||||
// Free entry point the MAIN renderer calls (L4VIDEO DPLRenderer::ExecuteImplementation,
|
||||
// just before EndScene). No-op unless BT_DEV_GAUGES is set. Docks the 6-surface panel
|
||||
@@ -1301,7 +1342,9 @@ void BTCockpitMouseUp(void)
|
||||
//
|
||||
void BTDrawGaugeInset(LPDIRECT3DDEVICE9 device)
|
||||
{
|
||||
if (!DevGaugeComposite() || !DevGaugeDocked() || device == NULL) return;
|
||||
if (!DevGaugeComposite()) return;
|
||||
BTGlassSweepLamps(); // keep the cockpit lamps tracking the sim EVERY frame (see above)
|
||||
if (!DevGaugeDocked() || device == NULL) return;
|
||||
if (GlassPanelsOwnSurfaces()) return; // the per-display glass windows draw the surfaces
|
||||
if (gBTGaugeCockpit)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user