More performance work

This commit is contained in:
Scott Duensing 2026-07-06 18:00:16 -05:00
parent 4fdb757671
commit a22f35078a

18
agi.c
View file

@ -149,7 +149,7 @@ static void updateEgoFromInput(void);
static AgiGameT gGame; static AgiGameT gGame;
static AgiPicT gPic; static AgiPicT gPic;
static jlSurfaceT *gBackdrop; static jlSurfaceT *gBackdrop;
static jlSurfaceT *gStage; static jlSurfaceT *gAgiStage;
static AgiVmT gVm; static AgiVmT gVm;
static LogicCacheSlotT gLogicCache[AGI_MAX_RESOURCES]; static LogicCacheSlotT gLogicCache[AGI_MAX_RESOURCES];
// View cache: 256 slots of ~5 KB each (~1.3 MB). Far too large for the // View cache: 256 slots of ~5 KB each (~1.3 MB). Far too large for the
@ -546,7 +546,7 @@ static void cbOverlayPic(void *ctx, uint8_t picId) {
static void cbShowPic(void *ctx) { static void cbShowPic(void *ctx) {
(void)ctx; (void)ctx;
jlLogF("cbShowPic v11=%u", (unsigned)gVm.vars[11]); jlLogF("cbShowPic v11=%u", (unsigned)gVm.vars[11]);
if (gStage == NULL) { if (gAgiStage == NULL) {
return; return;
} }
// Clear the WHOLE stage first so the rows above/below the AGI // Clear the WHOLE stage first so the rows above/below the AGI
@ -556,10 +556,10 @@ static void cbShowPic(void *ctx) {
// copy below and gets restored over every subsequent frame -- // copy below and gets restored over every subsequent frame --
// so clear.lines never visually erases anything that sat in // so clear.lines never visually erases anything that sat in
// the border bands. // the border bands.
jlSurfaceClear(gStage, COLOR_MISSING); jlSurfaceClear(gAgiStage, COLOR_MISSING);
agiPicBlit(&gPic, gStage, PIC_DEST_Y); agiPicBlit(&gPic, gAgiStage, PIC_DEST_Y);
if (gBackdrop != NULL) { if (gBackdrop != NULL) {
jlSurfaceCopy(gBackdrop, gStage); jlSurfaceCopy(gBackdrop, gAgiStage);
} }
gPicReady = true; gPicReady = true;
// The stage just got repainted; any prior save-under refers to // The stage just got repainted; any prior save-under refers to
@ -1716,8 +1716,8 @@ int main(int argc, char **argv) {
jlLogReset(); jlLogReset();
jlLogF("AGI TRACE build=%s %s", __DATE__, __TIME__); jlLogF("AGI TRACE build=%s %s", __DATE__, __TIME__);
jlLogFlush(); jlLogFlush();
gStage = jlStageGet(); gAgiStage = jlStageGet();
jlPaletteSet(gStage, 0u, kAgiPalette); jlPaletteSet(gAgiStage, 0u, kAgiPalette);
jlRandomSeed(0xA61DA61Du); jlRandomSeed(0xA61DA61Du);
// Bring up the SB DMA + mixer. AGI music feeds the SFX stream // Bring up the SB DMA + mixer. AGI music feeds the SFX stream
@ -1786,7 +1786,7 @@ int main(int argc, char **argv) {
} }
} }
jlSurfaceClear(gStage, COLOR_MISSING); jlSurfaceClear(gAgiStage, COLOR_MISSING);
if (gBackdrop != NULL) { if (gBackdrop != NULL) {
jlSurfaceClear(gBackdrop, COLOR_MISSING); jlSurfaceClear(gBackdrop, COLOR_MISSING);
} }
@ -1852,7 +1852,7 @@ int main(int argc, char **argv) {
{ {
uint32_t nowMs2 = jlMillisElapsed(); uint32_t nowMs2 = jlMillisElapsed();
if (nowMs2 - lastRenderMs >= AGI_RENDER_PERIOD_MS) { if (nowMs2 - lastRenderMs >= AGI_RENDER_PERIOD_MS) {
renderFrame(gStage); renderFrame(gAgiStage);
lastRenderMs = nowMs2; lastRenderMs = nowMs2;
} else { } else {
jlStagePresent(); jlStagePresent();