From f2b9b8d7f630a2503b35efc8027c2e0930b7b476 Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Tue, 1 Mar 2022 04:16:58 +1000 Subject: [PATCH] Start render module CL_MeshEntities immediately prior to Models Fixes https://gitlab.com/xonotic/darkplaces/-/issues/366 Starting CL_MeshEntities any later can cause the bug during r_restart. ca03733fba98709e25d9a02882ac947f4144af6a effectively added dependency of the Models module on the CL_MeshEntities module, at least in certain situations where starting the Models module results in calls to Draw_CachePic() and DrawQ_*() which trigger the bug when they call Mod_Mesh_GetTexture(). Signed-off-by: bones_was_here --- cl_main.c | 5 ++--- client.h | 1 + gl_rmain.c | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cl_main.c b/cl_main.c index 744ef854..45cb43d6 100644 --- a/cl_main.c +++ b/cl_main.c @@ -2549,7 +2549,7 @@ static void CL_MeshEntities_Shutdown(void) } } -static void CL_MeshEntities_Init(void) +void CL_MeshEntities_Init(void) { int i; entity_t *ent; @@ -2585,7 +2585,7 @@ static void CL_MeshEntities_Init(void) CL_UpdateRenderEntity(&ent->render); } cl_meshentities[MESH_UI].render.flags = RENDER_NOSELFSHADOW; - R_RegisterModule("cl_meshentities", CL_MeshEntities_Start, CL_MeshEntities_Shutdown, CL_MeshEntities_Restart, CL_MeshEntities_Restart, CL_MeshEntities_Restart); + R_RegisterModule("CL_MeshEntities", CL_MeshEntities_Start, CL_MeshEntities_Shutdown, CL_MeshEntities_Restart, CL_MeshEntities_Restart, CL_MeshEntities_Restart); } void CL_MeshEntities_Scene_Clear(void) @@ -3129,7 +3129,6 @@ void CL_Init (void) CL_Parse_Init(); CL_Particles_Init(); CL_Screen_Init(); - CL_MeshEntities_Init(); CL_Video_Init(); diff --git a/client.h b/client.h index fdf1a788..2006e61f 100644 --- a/client.h +++ b/client.h @@ -1364,6 +1364,7 @@ extern model_t cl_meshentitymodels[NUM_MESHENTITIES]; extern const char *cl_meshentitynames[NUM_MESHENTITIES]; #define CL_Mesh_Scene() (&cl_meshentitymodels[MESH_SCENE]) #define CL_Mesh_UI() (&cl_meshentitymodels[MESH_UI]) +void CL_MeshEntities_Init(void); void CL_MeshEntities_Scene_Clear(void); void CL_MeshEntities_Scene_AddRenderEntity(void); void CL_MeshEntities_Scene_FinalizeRenderEntity(void); diff --git a/gl_rmain.c b/gl_rmain.c index d164550d..f9bc7499 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -3447,6 +3447,7 @@ void Render_Init(void) R_Particles_Init(); R_Explosion_Init(); R_LightningBeams_Init(); + CL_MeshEntities_Init(); Mod_RenderInit(); } -- 2.39.2