commit 04dff379110add7f229f96d56d825a1d44b71771
Author: Fabian Greffrath <fabian@greffrath.com>
AuthorDate: Wed Sep 11 09:18:30 2024 +0200
Commit: GitHub <noreply@github.com>
CommitDate: Wed Sep 11 09:18:30 2024 +0200
Use native texture format (#1810) (#1701)
* Init palette alpha
Co-authored-by: gendlin <108626604+gendlin@users.noreply.github.com>
---
src/i_video.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/src/i_video.c b/src/i_video.c
index 9d9c8ccb..0271dd0e 100644
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -77,8 +77,6 @@ static SDL_Rect blit_rect = {
SCREENHEIGHT
};
-static uint32_t pixel_format;
-
// palette
static SDL_Color palette[256];
@@ -677,7 +675,7 @@ static void CreateUpscaledTexture(boolean force)
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
new_texture = SDL_CreateTexture(renderer,
- pixel_format,
+ SDL_PIXELFORMAT_ARGB8888,
SDL_TEXTUREACCESS_TARGET,
w_upscale*SCREENWIDTH,
h_upscale*SCREENHEIGHT);
@@ -830,6 +828,7 @@ void I_SetPalette (byte *doompalette)
// Zero out the bottom two bits of each channel - the PC VGA
// controller only supports 6 bits of accuracy.
+ palette[i].a = 0xFFU;
palette[i].r = gammatable[usegamma][*doompalette++] & ~3;
palette[i].g = gammatable[usegamma][*doompalette++] & ~3;
palette[i].b = gammatable[usegamma][*doompalette++] & ~3;
@@ -1246,8 +1245,6 @@ static void SetVideoMode(void)
SDL_GetError());
}
- pixel_format = SDL_GetWindowPixelFormat(screen);
-
SDL_SetWindowMinimumSize(screen, SCREENWIDTH, actualheight);
I_InitWindowTitle();
@@ -1358,7 +1355,7 @@ static void SetVideoMode(void)
if (argbbuffer == NULL)
{
- SDL_PixelFormatEnumToMasks(pixel_format, &bpp,
+ SDL_PixelFormatEnumToMasks(SDL_PIXELFORMAT_ARGB8888, &bpp,
&rmask, &gmask, &bmask, &amask);
argbbuffer = SDL_CreateRGBSurface(0,
SCREENWIDTH, SCREENHEIGHT, bpp,
@@ -1382,7 +1379,7 @@ static void SetVideoMode(void)
// is going to change frequently.
texture = SDL_CreateTexture(renderer,
- pixel_format,
+ SDL_PIXELFORMAT_ARGB8888,
SDL_TEXTUREACCESS_STREAMING,
SCREENWIDTH, SCREENHEIGHT);