From 17cf746550419ca91d66e9847b8604e01fe9f224 Mon Sep 17 00:00:00 2001
From: Cameron Cawley <[EMAIL REDACTED]>
Date: Wed, 13 May 2026 14:33:16 +0100
Subject: [PATCH] Allow formats with alpha channels for window textures
Because the blend mode is explicitly set to SDL_BLENDMODE_NONE, it doesn't matter if there's a transparency channel in the texture format or not for opaque windows. This ensures that a 32-bit format is used with Metal instead of SDL_PIXELFORMAT_RGB565.
(cherry picked from commit b1f390255a239940050f87cfb52dacb796e76728)
---
src/video/SDL_video.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index 87c6097bf172e..ec839877b6e88 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -422,7 +422,7 @@ static bool SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window *window,
!SDL_ISPIXELFORMAT_10BIT(texture_format) &&
!SDL_ISPIXELFORMAT_FLOAT(texture_format) &&
!SDL_ISPIXELFORMAT_INDEXED(texture_format) &&
- transparent == SDL_ISPIXELFORMAT_ALPHA(texture_format)) {
+ (!transparent || SDL_ISPIXELFORMAT_ALPHA(texture_format))) {
*format = texture_format;
break;
}