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
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 p;
@ -769,7 +769,7 @@ R_Upload8(byte *data, int width, int height, qboolean mipmap, qboolean is_sky)
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)
@ -925,11 +925,24 @@ R_LoadPic(char *name, byte *pic, int width, int realwidth,
R_Bind(image->texnum);
if (bits == 8)
{
// resize 8bit images only when we forced such logic
if (gl_retexturing->value >= 2)
{
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
{
image->has_alpha = R_Upload32((unsigned *)pic, width, height,