Send R_GenerateBlendTables number crunch to parallel thread

This commit is contained in:
James R authored and Alug committed 2025-09-17 20:53:52 +02:00
1 parent bfb7d7a405
commit 2cc0deb6f5
3 files changed
+28 -2

No files matched your search

+4
View File
@@ -1999,8 +1999,12 @@ void D_SRB2Main(void)
// setup loading screen
SCR_Startup();
// Do this in background; lots of number crunching
R_InitTranslucencyTables();
// we need the font of the console
CONS_Printf("HU_Init(): Setting up heads up display.\n");
HU_Init();
COM_Init();
+23 -1
View File
@@ -29,6 +29,7 @@
#include "z_zone.h"
#include "console.h" // Until buffering gets finished
#include "k_kart.h" // SRB2kart
#include "i_threads.h"
#ifdef HWRENDER
#include "hardware/hw_main.h"
@@ -111,6 +112,15 @@ static UINT8 **localtranslationtablecache[MAXLOCALSKINS] = {NULL};
CV_PossibleValue_t Color_cons_t[MAXSKINCOLORS+1];
static void R_GenerateBlendTables(void);
static void R_AllocateBlendTables(void);
#ifdef HAVE_THREADS
static void R_GenerateBlendTables_Thread(void *userdata)
{
(void)userdata;
R_GenerateBlendTables();
}
#endif
/** \brief Initializes the translucency tables used by the Software renderer.
*/
@@ -131,7 +141,14 @@ void R_InitTranslucencyTables(void)
W_ReadLump(W_GetNumForName("TRANS80"), transtables+0x70000);
W_ReadLump(W_GetNumForName("TRANS90"), transtables+0x80000);
R_AllocateBlendTables();
#ifdef HAVE_THREADS
I_spawn_thread("blend-tables",
R_GenerateBlendTables_Thread, NULL);
#else
R_GenerateBlendTables();
#endif
}
static colorlookup_t transtab_lut;
@@ -241,13 +258,18 @@ static void BlendTab_GenerateMaps(INT32 tab, INT32 style, void (*genfunc)(UINT8
}
}
static void R_GenerateBlendTables(void)
static void R_AllocateBlendTables(void)
{
INT32 i;
for (i = 0; i < NUMBLENDMAPS; i++)
{
blendtables[i] = static_cast<UINT8*>(Z_Malloc(BlendTab_Count[i] * 0x10000, PU_STATIC, NULL));
}
}
static void R_GenerateBlendTables(void)
{
InitColorLUT(&transtab_lut, pLocalPalette, false);
// Additive
+1 -1
View File
@@ -1033,7 +1033,7 @@ void R_Init(void)
R_InitLightTables();
//I_OutputMsg("\nR_InitTranslucencyTables\n");
R_InitTranslucencyTables();
//R_InitTranslucencyTables();
R_InitDrawNodes();