Use native texture format (#1810)

* Init palette alpha
This commit is contained in:
gendlin 2024-08-02 08:51:53 -04:00 committed by GitHub
parent b2ee08b2aa
commit 60d9deae96
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -989,6 +989,7 @@ void I_SetPalette(byte *palette)
colors[i].r = gamma[*palette++]; colors[i].r = gamma[*palette++];
colors[i].g = gamma[*palette++]; colors[i].g = gamma[*palette++];
colors[i].b = gamma[*palette++]; colors[i].b = gamma[*palette++];
colors[i].a = 0xffu;
} }
SDL_SetPaletteColors(screenbuffer->format->palette, colors, 0, 256); SDL_SetPaletteColors(screenbuffer->format->palette, colors, 0, 256);
@ -1372,7 +1373,7 @@ static void CreateUpscaledTexture(boolean force)
// screen. // screen.
texture_upscaled = SDL_CreateTexture( texture_upscaled = SDL_CreateTexture(
renderer, SDL_GetWindowPixelFormat(screen), SDL_TEXTUREACCESS_TARGET, renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_TARGET,
w_upscale * screen_width, h_upscale * screen_height); w_upscale * screen_width, h_upscale * screen_height);
SDL_SetTextureScaleMode(texture_upscaled, SDL_ScaleModeLinear); SDL_SetTextureScaleMode(texture_upscaled, SDL_ScaleModeLinear);
@ -1750,7 +1751,7 @@ static void CreateSurfaces(int w, int h)
uint32_t rmask, gmask, bmask, amask; uint32_t rmask, gmask, bmask, amask;
int bpp; int bpp;
SDL_PixelFormatEnumToMasks(SDL_GetWindowPixelFormat(screen), &bpp, SDL_PixelFormatEnumToMasks(SDL_PIXELFORMAT_ARGB8888, &bpp,
&rmask, &gmask, &bmask, &amask); &rmask, &gmask, &bmask, &amask);
argbbuffer = argbbuffer =
SDL_CreateRGBSurface(0, w, h, bpp, rmask, gmask, bmask, amask); SDL_CreateRGBSurface(0, w, h, bpp, rmask, gmask, bmask, amask);
@ -1766,7 +1767,7 @@ static void CreateSurfaces(int w, int h)
SDL_DestroyTexture(texture); SDL_DestroyTexture(texture);
} }
texture = SDL_CreateTexture(renderer, SDL_GetWindowPixelFormat(screen), texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888,
SDL_TEXTUREACCESS_STREAMING, w, h); SDL_TEXTUREACCESS_STREAMING, w, h);
SDL_SetTextureScaleMode(texture, SDL_ScaleModeNearest); SDL_SetTextureScaleMode(texture, SDL_ScaleModeNearest);