renders: skip unused colormap allocation

This commit is contained in:
Denis Pauk 2024-06-24 16:17:19 +03:00
parent 623b003f6f
commit e07cec2e13
5 changed files with 9 additions and 16 deletions

View File

@ -1416,7 +1416,6 @@ qboolean
RI_Init(void)
{
int j, max_tex_size;
byte *colormap;
extern float r_turbsin[256];
Swap_Init();
@ -1433,9 +1432,8 @@ RI_Init(void)
R_Printf(PRINT_ALL, "ref_gl1::R_Init() - DEBUG mode enabled\n");
#endif
ri.VID_GetPalette(&colormap, d_8to24table);
ri.VID_GetPalette(NULL, d_8to24table);
ri.VID_GetPalette24to8((byte *)d_8to24table, &gl_state.d_16to8table);
free(colormap);
R_Register();

View File

@ -486,8 +486,6 @@ enum { QGL_POINT_SPRITE = 0x8861 };
static qboolean
GL3_Init(void)
{
byte *colormap;
Swap_Init(); // FIXME: for fucks sake, this doesn't have to be done at runtime!
R_Printf(PRINT_ALL, "Refresh: " REF_VERSION "\n");
@ -502,8 +500,7 @@ GL3_Init(void)
return false;
}
ri.VID_GetPalette(&colormap, d_8to24table);
free(colormap);
ri.VID_GetPalette(NULL, d_8to24table);
GL3_Register();

View File

@ -482,8 +482,6 @@ enum { QGL_POINT_SPRITE = 0x8861 };
static qboolean
GL4_Init(void)
{
byte *colormap;
Swap_Init(); // FIXME: for fucks sake, this doesn't have to be done at runtime!
R_Printf(PRINT_ALL, "Refresh: " REF_VERSION "\n");
@ -498,8 +496,7 @@ GL4_Init(void)
return false;
}
ri.VID_GetPalette(&colormap, d_8to24table);
free(colormap);
ri.VID_GetPalette(NULL, d_8to24table);
GL4_Register();

View File

@ -1353,7 +1353,6 @@ void Vk_InitImages (void)
{
int i;
float overbright;
byte *colormap;
numvktextures = 0;
img_loaded = 0;
@ -1378,8 +1377,7 @@ void Vk_InitImages (void)
intensitytable[i] = j;
}
ri.VID_GetPalette(&colormap, d_8to24table);
free(colormap);
ri.VID_GetPalette(NULL, d_8to24table);
overbright = vk_overbrightbits->value;

View File

@ -487,8 +487,11 @@ VID_GetPalette(byte **colormap, unsigned *d_8to24table)
return;
}
*colormap = malloc(256 * 320);
memcpy(*colormap, colormap_cache, 256 * 320);
if (colormap)
{
*colormap = malloc(256 * 320);
memcpy(*colormap, colormap_cache, 256 * 320);
}
memcpy(d_8to24table, d_8to24table_cache, sizeof(d_8to24table_cache));
}