SDL: Add SDL_PIXELFORMAT_XRGB8888 and SDL_PIXELFORMAT_XBGR8888 to SDL_render_metal.m

From 7547d80c05b387902b60c644a88a9be723ea204d Mon Sep 17 00:00:00 2001
From: kanjitalk755 <[EMAIL REDACTED]>
Date: Thu, 6 Jun 2024 14:37:19 +0900
Subject: [PATCH] Add SDL_PIXELFORMAT_XRGB8888 and SDL_PIXELFORMAT_XBGR8888 to
 SDL_render_metal.m

---
 src/render/metal/SDL_render_metal.m | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/render/metal/SDL_render_metal.m b/src/render/metal/SDL_render_metal.m
index cd3d6551b2c78..37dd66b71cde8 100644
--- a/src/render/metal/SDL_render_metal.m
+++ b/src/render/metal/SDL_render_metal.m
@@ -644,6 +644,7 @@ static int METAL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
 
         switch (texture->format) {
         case SDL_PIXELFORMAT_ABGR8888:
+        case SDL_PIXELFORMAT_XBGR8888:
             if (renderer->output_colorspace == SDL_COLORSPACE_SRGB_LINEAR) {
                 pixfmt = MTLPixelFormatRGBA8Unorm_sRGB;
             } else {
@@ -651,6 +652,7 @@ static int METAL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
             }
             break;
         case SDL_PIXELFORMAT_ARGB8888:
+        case SDL_PIXELFORMAT_XRGB8888:
             if (renderer->output_colorspace == SDL_COLORSPACE_SRGB_LINEAR) {
                 pixfmt = MTLPixelFormatBGRA8Unorm_sRGB;
             } else {
@@ -2150,6 +2152,8 @@ in case we want to use it later (recreating the renderer)
         renderer->name = METAL_RenderDriver.name;
         SDL_AddSupportedTextureFormat(renderer, SDL_PIXELFORMAT_ARGB8888);
         SDL_AddSupportedTextureFormat(renderer, SDL_PIXELFORMAT_ABGR8888);
+        SDL_AddSupportedTextureFormat(renderer, SDL_PIXELFORMAT_XRGB8888);
+        SDL_AddSupportedTextureFormat(renderer, SDL_PIXELFORMAT_XBGR8888);
         SDL_AddSupportedTextureFormat(renderer, SDL_PIXELFORMAT_XBGR2101010);
         SDL_AddSupportedTextureFormat(renderer, SDL_PIXELFORMAT_RGBA64_FLOAT);
         SDL_AddSupportedTextureFormat(renderer, SDL_PIXELFORMAT_RGBA128_FLOAT);