diff options
| author | 2026-03-14 14:53:50 +0100 | |
|---|---|---|
| committer | 2026-03-14 09:53:50 -0400 | |
| commit | 307cb26a4b15b3e659128503b1665e532e921098 (patch) | |
| tree | 9553c3ef7c64334a85fb6dea85d66afa7c014ad9 /src/osd | |
| parent | 0dcf95949e6c2c3d3ebe536dc901950486b200af (diff) | |
sdl3: Fix black screen when launching with -video soft on MacOS (#15100)
Diffstat (limited to 'src/osd')
| -rw-r--r-- | src/osd/modules/render/drawsdl3soft.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/osd/modules/render/drawsdl3soft.cpp b/src/osd/modules/render/drawsdl3soft.cpp index 8601f8315ef..9fbee8584ca 100644 --- a/src/osd/modules/render/drawsdl3soft.cpp +++ b/src/osd/modules/render/drawsdl3soft.cpp @@ -144,6 +144,19 @@ void renderer_sdl1::setup_texture(const osd_dim &size) fmt = (m_scale_mode.pixel_format ? m_scale_mode.pixel_format : mode->format); + // The software renderer does not write the alpha channel, leaving it as zero. + // On macOS this causes all color channels to be multiplied to zero, producing a black screen. + // Map alpha formats to their opaque equivalents so SDL treats the alpha byte as + // padding and fills it with 0xFF when blitting to the window surface. + switch (SDL_PixelFormat(fmt)) + { + case SDL_PIXELFORMAT_ARGB8888: fmt = SDL_PIXELFORMAT_XRGB8888; break; + case SDL_PIXELFORMAT_ABGR8888: fmt = SDL_PIXELFORMAT_XBGR8888; break; + case SDL_PIXELFORMAT_RGBA8888: fmt = SDL_PIXELFORMAT_RGBX8888; break; + case SDL_PIXELFORMAT_BGRA8888: fmt = SDL_PIXELFORMAT_BGRX8888; break; + default: break; + } + if (m_scale_mode.is_scale) { int m_hw_scale_width = 0; |
