Skip to content

fixed sdl2compat bug when sdl3 is used on macOS builds - #5

Open
rathse wants to merge 1 commit into
jochenjagers:mainfrom
rathse:fix-sdl2compat
Open

fixed sdl2compat bug when sdl3 is used on macOS builds#5
rathse wants to merge 1 commit into
jochenjagers:mainfrom
rathse:fix-sdl2compat

Conversation

@rathse

@rathse rathse commented Aug 3, 2026

Copy link
Copy Markdown

Changes:
The game's streaming screen texture is now created explicitly as SDL_PIXELFORMAT_ARGB8888 | SDL_TEXTUREACCESS_STREAMING in src/gfx/gfx.c::gfxInitSDL() instead of being derived from the 8-bit palettized surface via SDL_CreateTextureFromSurface(). The per-frame update path in gfxUpdateSDL() — which already converts the surface to ARGB8888 and uploads it with SDL_UpdateTexture — remains unchanged.

Why it is necessary for compilation on macOS (tested with macOS 26.5 Tahoe / aarch64):
The actual formula for sdl2 in the package manager Homebrew uses a SDL2 compatibility API on top of SDL3.
Unlike real SDL2, which silently promotes a palettized surface to an ARGB8888 texture, this compatibility layer keeps it as INDEX8. This means that the per-frame upload of the ARGB8888 texture does not longer match the texture's pixel format. SDL accepts the call without raising an error, but the upload is dropped and the window remains blank white. Classic SDL2 (Linux/Windows) is not affected because it already used ARGB8888 internally for this texture, so the explicit request does no affect these builds.

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.

1 participant