Bound OpenGL CPU readbacks to pending GPU writes - #326
Merged
mstan merged 4 commits intoSep 7, 2026
Merged
Conversation
Alexbeav
pushed a commit
to Alexbeav/psxrecomp
that referenced
this pull request
Sep 10, 2026
…e retail BIOS boot Matched Ape Escape retail SCPH1001 LLE builds identify 0661ce7 as the visible boot regression: parent 155e269 reaches game code, while 0661ce7 stalls near BIOS frame 375. Revert its four dependent follow-ups too; retain PR RetroPortingToolKit#326 readback bounds and PR RetroPortingToolKit#328 Vulkan aspect changes. The row-by-row raster dispatcher amplifies an existing malformed DMA list into massive GL work. Keep the broader CPU/DMA arbitration experiment separate for compatibility testing. Document attribution, validation, and the temporarily restored interlace limitation. Validation: full Ape target reaches title/menu and frame 11669 on retail LLE; OpenBIOS control reaches frame 3701. Eight focused tests pass; retained GL readback fixture passes 71 checks at both 1x and 4x after linking local SDL with iconv. Beads: beads-iisy; DMA follow-up: beads-eio.3.122.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A tiny GPU write followed by a CPU read currently copies all 524,288 native words. Keep a separate conservative rectangle for GPU writes that have not reached the CPU array, then read that region with an explicit full-image row stride. Uploads, queued draws and packing still complete in order. Texture packing must not erase CPU readback debt. Raster values, clocks, precision and GPU ownership remain unchanged.
Fork review: Alexbeav#23. Cubic completed the exact-head check 101476046529 with zero new issues. All earlier findings are resolved in source or explicitly reconciled in the review replies; prior review jobs are terminal. The public branch is identical to this reviewed head.
Base
155e269ba5d50fe36523846f908cf124dc1561a0; tested/reviewed heade57d9b9f4fd220be6f65825282329215f8109a6f; four focused commits; 6 changed files:docs/GPU_GL_READBACK_REGIONS.mdruntime/CMakeLists.txtruntime/src/gpu_gl_renderer.cruntime/tests/run_gl_readback_region.pyruntime/tests/test_gl_readback_region.cruntime/tests/test_gl_readback_runner.pyThe renderer change owns coherence; the C fixture verifies native pixels and transfer size; the Python wrapper runs the real hidden GL context; CMake registers the optional hardware test; documentation states the invariant and limitations. No title configuration, private route tooling or retail payload is included.
Validation on this review head, Windows x64 / WinLibs GCC 16.1 / RTX 4070 Ti, NVIDIA 610.88:
-DBUILD_TESTING=ON -DPSX_GL_READBACK_SDL_ROOT=<SDL3-deps>on MinGW, thenctest --test-dir <runtime-build> -R gl_readback_region_test --output-on-failure. Six parser unit tests reject malformed summaries, wrong exits and unexpected negative failures. The dependency root containssdl3-src/includeandsdl3-build/libSDL3.a.PSX_GL_READBACK_COMPILER_BINcan select GCC for a Clang/MinGW project; configure checks both compiler executables before hardware registration. Missing/restored compiler cases were verified. Both configure and runner reject missing SDL headers/static library before building; a bad dependency root is not counted as a hardware pass. The wrapper also accepts--compiler-bin,--sdl-root,--output; it has no fixed CPU affinity or priority and retains a fresh receipt directory on repeated runs. Other platforms are not qualified by this hardware runner.dirty_text_continuation_guardsstale source fragment,release_zipWindows LF expectation,aot_overlay_discoveryhardcoded MSYS gcc subprocess. Python tests use PYTHONUTF8=1.96928d118bdcce574947052b4053153717eb28accontains the interlace correction plus this exact GL runtime change. Its fresh native OpenGL game-frontend route starts a player game, launches the ball, demonstrates flipper/ball play and closes normally at frame 6925. It is not this standalone review head. The final interlace contribution is Preserve interlaced fields when drawing GPU primitives #327 at a later reviewed head; this earlier combined route is not qualification of that final union. Current runs establish route correctness only under host GPU load, not a new speed result.The game is a private local port. Owned generated game/SCPH5552 code is reused unchanged; no emitter-regeneration claim. Current public recomp-ui/master 773155ae lacks lobby/spectator fields used by upstream runtime, so these GPU retail tests use supported
PSX_RECOMP_UI=OFFdirect launch. No launcher compatibility, broad save/load, netplay, full depth24 playback, Vulkan, full-game or audio-wide acceptance is implied. Consumer runtime pin update is required; this correction does not require code regeneration. The two corrections can merge independently. Timeshock frontend startup requires the interlace correction.Developed with AI assistance; validated as described (test evidence in PR body). AI writes the code and the PR, but I always test before I send something up. Happy to iterate on this process with your feedback.