From fc075e4c81b67ad515b19cecf396393798caa328 Mon Sep 17 00:00:00 2001
From: Ronald Kinard <furyhunter600@gmail.com>
Date: Wed, 23 Jul 2014 23:02:21 -0500
Subject: [PATCH] sdl2: use ABGR8888 texture on little endian system

This is a massive performance boost on slow processors, because
before, the intermediary buffer had to be swizzled to ABGR8888
before being uploaded -- for large resolutions this was an
enormous performance penalty.
---
 src/sdl2/i_video.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/sdl2/i_video.c b/src/sdl2/i_video.c
index 669825428..da5632e48 100644
--- a/src/sdl2/i_video.c
+++ b/src/sdl2/i_video.c
@@ -174,6 +174,7 @@ static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen)
 	int gmask;
 	int bmask;
 	int amask;
+	int sw_texture_format = SDL_PIXELFORMAT_ABGR8888;
 
 	realwidth = vid.width;
 	realheight = vid.height;
@@ -229,7 +230,12 @@ static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen)
 		{
 			SDL_DestroyTexture(texture);
 		}
-		texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_STREAMING, width, height);
+#ifdef SDL_BIG_ENDIAN
+		sw_texture_format = SDL_PIXELFORMAT_RGBA8888;
+#else
+		sw_texture_format = SDL_PIXELFORMAT_ABGR8888;
+#endif
+		texture = SDL_CreateTexture(renderer, sw_texture_format, SDL_TEXTUREACCESS_STREAMING, width, height);
 
 		// Set up SW surface
 		if (vidSurface != NULL)
-- 
GitLab