mirror of
https://github.com/libretro/parallel-n64.git
synced 2026-11-08 17:27:47 -10:00
glsm skips a GL call whose value it has cached, and puts the core's state back after the frontend draws between slices; both went wrong. The bind only re-enabled the core's capabilities, so one the frontend left on - blending, by RetroArch's statistics overlay among others - stayed on, and the cache, saying off, swallowed the core's glDisable: Glide64, Rice and glN64 blended each frame into the one before it. The cull face was never restored, nor the blend equation, colour or line width; the clear colour was cached in integers and only while the default framebuffer was bound; glBlendFunc's cache never saw glBlendFuncSeparate; a texture deleted on another unit, a deleted buffer or framebuffer stayed cached as bound, so the name GL gave again was not bound; a vertex array's element buffer was cached across vertex arrays and written into the next one at the bind; glDrawBuffers was taken once per framebuffer and ignored after; and the unbind left a stencil write mask of 1. The cache now starts from GL's defaults, the bind puts all of it in GL and the unbind GL's defaults, and every deletion and vertex array bind keeps it to what GL holds. Fog and alpha test are not passed to core and ES contexts, where they are no capabilities. The framebuffer records were a 128000-entry table (1 MB, scanned in full for every deleted texture) and the uniform cache a static 64 MB; they are a small list and per-program tables allocated on first use, dropped when a program links or is deleted and with the context. glBlitFramebuffer is no longer turned into glCopyImageSubData from attachments glsm could not know for the frontend's framebuffers. Dead debug logging, no-op VBO calls and the unused extension helper are gone, and the files build clean as C89 bar one cast in the public API. test_glsm_state, for desktop GL and GLES 2, has the core set its state, the frontend change all of it between slices, and holds GL to the core's state after the bind and to GL's defaults after the unbind, then runs each cache case above; master fails it. It and test_glsm_frame_boundary, which builds again (it needed gl_capabilities.c and screen_width since the draw target), run in the GitLab GL job and the GitHub GL renderers workflow, with and without the sanitizers.