]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Start render module CL_MeshEntities immediately prior to Models
authorbones_was_here <bones_was_here@xa.org.au>
Mon, 28 Feb 2022 18:16:58 +0000 (04:16 +1000)
committerbones_was_here <bones_was_here@xa.org.au>
Mon, 28 Feb 2022 18:42:35 +0000 (04:42 +1000)
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 <bones_was_here@xa.org.au>
cl_main.c
client.h
gl_rmain.c

index 744ef854f7daf62c0deaafa34c37abb91e59e10e..45cb43d6f1f39b176e7f6a137daa1c5289b8cf95 100644 (file)
--- 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();
 
index fdf1a7881f5b1c9316056c65ff514c93feaaeee5..2006e61fa8cbfa4f78daec849660494d12fd3468 100644 (file)
--- 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);
index d164550d78b37c7f6c266d90ddeb29254df53a48..f9bc7499d8a2eca54914a06de4efc1c1a81f213c 100644 (file)
@@ -3447,6 +3447,7 @@ void Render_Init(void)
        R_Particles_Init();
        R_Explosion_Init();
        R_LightningBeams_Init();
+       CL_MeshEntities_Init();
        Mod_RenderInit();
 }