gl1: Scale 8bit images with retexturing=2

This commit is contained in:
Denis Pauk 2021-09-19 13:07:17 +03:00
parent 58af4c84ff
commit 0bbd65ebac

View file

@ -761,7 +761,7 @@ R_Upload32(unsigned *data, int width, int height, qboolean mipmap)
qboolean qboolean
R_Upload8(byte *data, int width, int height, qboolean mipmap, qboolean is_sky) R_Upload8(byte *data, int width, int height, qboolean mipmap, qboolean is_sky)
{ {
unsigned trans[512 * 256]; unsigned trans[1024 * 1024];
int i, s; int i, s;
int p; int p;
@ -769,7 +769,7 @@ R_Upload8(byte *data, int width, int height, qboolean mipmap, qboolean is_sky)
if (s > sizeof(trans) / 4) if (s > sizeof(trans) / 4)
{ {
ri.Sys_Error(ERR_DROP, "R_Upload8: too large"); ri.Sys_Error(ERR_DROP, "%s: too large", __func__);
} }
if (gl_config.palettedtexture && is_sky) if (gl_config.palettedtexture && is_sky)
@ -926,9 +926,22 @@ R_LoadPic(char *name, byte *pic, int width, int realwidth,
if (bits == 8) if (bits == 8)
{ {
image->has_alpha = R_Upload8(pic, width, height, // resize 8bit images only when we forced such logic
(image->type != it_pic && image->type != it_sky), if (gl_retexturing->value >= 2)
image->type == it_sky); {
byte *image_converted = malloc(width * height * 4);
scale2x(pic, image_converted, width, height);
image->has_alpha = R_Upload8(image_converted, width * 2, height * 2,
(image->type != it_pic && image->type != it_sky),
image->type == it_sky);
free(image_converted);
}
else
{
image->has_alpha = R_Upload8(pic, width, height,
(image->type != it_pic && image->type != it_sky),
image->type == it_sky);
}
} }
else else
{ {