Skip to content

Conversation

@nchapman
Copy link
Collaborator

Replace fragmented rendering API (PLAT_blitRenderer, PLAT_clearBlit, PLAT_flip) with unified PLAT_present(GFX_Renderer* renderer) across all platforms.

  • Game mode: renderer != NULL, scales and presents game content
  • UI mode: renderer == NULL, presents screen surface
  • Eliminates state tracking (vid.renderer, vid.in_game, ctx->blit)
  • Simplifies frame pacing by removing "display_page" logic
  • Reduces platform code complexity (-532/+282 lines)

All 12 platforms now follow consistent presentation pattern. SDL2 platforms use shared SDL2_present() backend, SDL1 platforms (miyoomini, trimuismart, rg35xx) implement directly.

Replace fragmented rendering API (PLAT_blitRenderer, PLAT_clearBlit,
PLAT_flip) with unified PLAT_present(GFX_Renderer* renderer) across
all platforms.

- Game mode: renderer != NULL, scales and presents game content
- UI mode: renderer == NULL, presents screen surface
- Eliminates state tracking (vid.renderer, vid.in_game, ctx->blit)
- Simplifies frame pacing by removing "display_page" logic
- Reduces platform code complexity (-532/+282 lines)

All 12 platforms now follow consistent presentation pattern. SDL2
platforms use shared SDL2_present() backend, SDL1 platforms
(miyoomini, trimuismart, rg35xx) implement directly.
Copilot AI review requested due to automatic review settings December 20, 2025 02:48
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR successfully unifies the fragmented rendering API across all 12 platforms by replacing three separate functions (PLAT_blitRenderer, PLAT_clearBlit, PLAT_flip) with a single PLAT_present() function. The renderer parameter distinguishes between game mode (non-NULL) and UI mode (NULL), eliminating the need for state tracking variables.

Key changes:

  • Unified presentation API: PLAT_present(renderer) handles both game and UI modes
  • Removed state tracking: eliminated vid.renderer, vid.in_game, and ctx->blit variables
  • Simplified frame pacing: SDL1 platforms now re-render on repeated frames instead of using complex display_page logic
  • Consistent pattern: SDL2 platforms share SDL2_present() backend, SDL1 platforms implement directly

Reviewed changes

Copilot reviewed 35 out of 35 changed files in this pull request and generated no comments.

Show a summary per file
File Description
workspace/all/common/api.h Updated API documentation, replaced GFX_flip with GFX_present and added GFX_vsync
workspace/all/common/api.c Implemented GFX_present and GFX_vsync, removed old GFX_flip
workspace/all/common/render_sdl2.h Updated SDL2 backend API documentation for unified presentation
workspace/all/common/render_sdl2.c Replaced SDL2_blitRenderer/clearBlit/flip with unified SDL2_present
workspace/all/player/player.c Removed GFX_blitRenderer call from video callback, updated callers to use GFX_present
workspace/all/player/player_loop_vsync.inc Updated main loop to use GFX_present, removed GFX_clearBlit calls
workspace/all/player/player_loop_audioclock.inc Updated main loop to use GFX_present, removed GFX_clearBlit calls
workspace/all/player/player_menu.c Updated menu rendering to use GFX_present with appropriate parameters
workspace/all/utils/shui/*.c Updated UI components to use GFX_present(NULL) for UI mode
workspace/all/launcher/launcher.c Updated launcher to use GFX_present(NULL)
workspace/all/paks/Tools//src/.c Updated tool applications to use GFX_present(NULL)
workspace/desktop/platform/platform.c Removed state tracking, implemented unified PLAT_present with game/UI mode handling
workspace/*/platform/platform.c (SDL2) Replaced three functions with single PLAT_present calling SDL2_present
workspace/miyoomini/platform/platform.c Removed state tracking, implemented PLAT_present with double-buffer management
workspace/rg35xx/platform/platform.c Removed state tracking and display_page logic, simplified to always re-render
workspace/trimuismart/platform/platform.c Removed state tracking and display_page logic, simplified to always re-render
tests/support/*.c Updated test infrastructure to match new API signatures
docs/*.md Updated documentation examples to use new API

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nchapman nchapman merged commit 763ee2d into develop Dec 20, 2025
10 checks passed
@nchapman nchapman deleted the feature/sdl1-render-refactor branch December 20, 2025 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants