mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-31 05:00:35 +00:00
Separate render module loading from initialization.
This allows the vid module to load the render module and access render specific functions before the renderer initializes, which happens to need an initialized vid module...
This commit is contained in:
parent
a16ff08240
commit
d62772e9cc
14 changed files with 39 additions and 17 deletions
|
@ -145,6 +145,7 @@ typedef struct vid_render_funcs_s {
|
|||
float time);
|
||||
void (*Fog_ParseWorldspawn) (struct plitem_s *worldspawn);
|
||||
|
||||
void (*R_Init) (void);
|
||||
void (*R_ClearState) (void);
|
||||
void (*R_LoadSkys) (const char *);
|
||||
void (*R_NewMap) (model_t *worldmodel, model_t **models, int num_models);
|
||||
|
|
|
@ -168,6 +168,7 @@ extern struct texture_s *r_notexture_mip;
|
|||
extern entity_t r_worldentity;
|
||||
|
||||
void R_Init (void);
|
||||
void R_LoadModule (void);
|
||||
struct progs_s;
|
||||
void R_Progs_Init (struct progs_s *pr);
|
||||
|
||||
|
|
|
@ -140,6 +140,9 @@ gl_R_LoadSky_f (void)
|
|||
void
|
||||
gl_R_Init (void)
|
||||
{
|
||||
R_Init_Cvars ();
|
||||
gl_R_Particles_Init_Cvars ();
|
||||
|
||||
Cmd_AddCommand ("timerefresh", gl_R_TimeRefresh_f,
|
||||
"Tests the current refresh rate for the current location");
|
||||
Cmd_AddCommand ("envmap", R_Envmap_f, "No Description");
|
||||
|
@ -161,6 +164,7 @@ gl_R_Init (void)
|
|||
gl_R_InitParticles ();
|
||||
gl_R_InitSprites ();
|
||||
gl_Fog_Init ();
|
||||
Skin_Init ();
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -56,6 +56,7 @@ static __attribute__ ((used)) const char rcsid[] = "$Id$";
|
|||
#include "QF/GLSL/qf_lightmap.h"
|
||||
#include "QF/GLSL/qf_textures.h"
|
||||
|
||||
#include "mod_internal.h"
|
||||
#include "r_internal.h"
|
||||
|
||||
mat4_t glsl_projection;
|
||||
|
@ -241,6 +242,8 @@ glsl_R_RenderView (void)
|
|||
void
|
||||
glsl_R_Init (void)
|
||||
{
|
||||
R_Init_Cvars ();
|
||||
glsl_R_Particles_Init_Cvars ();
|
||||
Draw_Init ();
|
||||
SCR_Init ();
|
||||
glsl_R_InitBsp ();
|
||||
|
@ -248,6 +251,7 @@ glsl_R_Init (void)
|
|||
glsl_R_InitSprites ();
|
||||
glsl_R_InitParticles ();
|
||||
glsl_Fog_Init ();
|
||||
Skin_Init ();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -65,7 +65,7 @@ static U void (*const r_progs_init)(struct progs_s *) = R_Progs_Init;
|
|||
#undef U
|
||||
|
||||
VISIBLE void
|
||||
R_Init (void)
|
||||
R_LoadModule (void)
|
||||
{
|
||||
PI_RegisterPlugins (vidrend_plugin_list);
|
||||
vidrend_plugin = Cvar_Get ("vid_render", VID_RENDER_DEFAULT, CVAR_ROM, 0,
|
||||
|
@ -82,3 +82,9 @@ R_Init (void)
|
|||
|
||||
vidrendmodule->functions->general->p_Init ();
|
||||
}
|
||||
|
||||
VISIBLE void
|
||||
R_Init (void)
|
||||
{
|
||||
r_funcs->R_Init ();
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/sys.h"
|
||||
|
||||
#include "compat.h"
|
||||
#include "mod_internal.h"
|
||||
#include "r_internal.h"
|
||||
#include "vid_internal.h"
|
||||
|
||||
|
@ -121,6 +122,9 @@ sw_R_Init (void)
|
|||
// get stack position so we can guess if we are going to overflow
|
||||
r_stack_start = (byte *) & dummy;
|
||||
|
||||
R_Init_Cvars ();
|
||||
R_Particles_Init_Cvars ();
|
||||
|
||||
Draw_Init ();
|
||||
SCR_Init ();
|
||||
R_SetFPCW ();
|
||||
|
@ -155,6 +159,8 @@ sw_R_Init (void)
|
|||
(long) R_EdgeCodeEnd - (long) R_EdgeCodeStart);
|
||||
#endif // USE_INTEL_ASM
|
||||
D_Init ();
|
||||
|
||||
Skin_Init ();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -52,6 +52,7 @@ static __attribute__ ((used)) const char rcsid[] = "$Id$";
|
|||
#include "QF/sys.h"
|
||||
|
||||
#include "compat.h"
|
||||
#include "mod_internal.h"
|
||||
#include "r_internal.h"
|
||||
#include "vid_internal.h"
|
||||
|
||||
|
@ -146,6 +147,9 @@ sw32_R_Init (void)
|
|||
// get stack position so we can guess if we are going to overflow
|
||||
r_stack_start = (byte *) & dummy;
|
||||
|
||||
R_Init_Cvars ();
|
||||
sw32_R_Particles_Init_Cvars ();
|
||||
|
||||
sw32_Draw_Init ();
|
||||
SCR_Init ();
|
||||
sw32_R_InitTurb ();
|
||||
|
@ -170,6 +174,8 @@ sw32_R_Init (void)
|
|||
r_refdef.yOrigin = YCENTERING;
|
||||
|
||||
sw32_D_Init ();
|
||||
|
||||
Skin_Init ();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -97,6 +97,7 @@ vid_render_funcs_t gl_vid_render_funcs = {
|
|||
gl_Fog_Update,
|
||||
gl_Fog_ParseWorldspawn,
|
||||
|
||||
gl_R_Init,
|
||||
gl_R_ClearState,
|
||||
gl_R_LoadSkys,
|
||||
gl_R_NewMap,
|
||||
|
@ -116,10 +117,6 @@ static void
|
|||
gl_vid_render_init (void)
|
||||
{
|
||||
m_funcs = &model_funcs;
|
||||
R_Init_Cvars ();
|
||||
gl_R_Particles_Init_Cvars ();
|
||||
gl_R_Init ();
|
||||
Skin_Init ();
|
||||
vid = *vr_data.vid;
|
||||
}
|
||||
|
||||
|
|
|
@ -97,6 +97,7 @@ vid_render_funcs_t glsl_vid_render_funcs = {
|
|||
glsl_Fog_Update,
|
||||
glsl_Fog_ParseWorldspawn,
|
||||
|
||||
glsl_R_Init,
|
||||
glsl_R_ClearState,
|
||||
glsl_R_LoadSkys,
|
||||
glsl_R_NewMap,
|
||||
|
@ -116,10 +117,6 @@ static void
|
|||
glsl_vid_render_init (void)
|
||||
{
|
||||
m_funcs = &model_funcs;
|
||||
R_Init_Cvars ();
|
||||
glsl_R_Particles_Init_Cvars ();
|
||||
glsl_R_Init ();
|
||||
Skin_Init ();
|
||||
vid = *vr_data.vid;
|
||||
}
|
||||
|
||||
|
|
|
@ -92,6 +92,7 @@ vid_render_funcs_t sw_vid_render_funcs = {
|
|||
0,
|
||||
0,
|
||||
|
||||
sw_R_Init,
|
||||
R_ClearState,
|
||||
R_LoadSkys,
|
||||
R_NewMap,
|
||||
|
@ -111,10 +112,6 @@ static void
|
|||
sw_vid_render_init (void)
|
||||
{
|
||||
m_funcs = &model_funcs;
|
||||
R_Init_Cvars ();
|
||||
R_Particles_Init_Cvars ();
|
||||
sw_R_Init ();
|
||||
Skin_Init ();
|
||||
vid = *vr_data.vid;
|
||||
}
|
||||
|
||||
|
|
|
@ -97,6 +97,7 @@ vid_render_funcs_t sw32_vid_render_funcs = {
|
|||
0,
|
||||
0,
|
||||
|
||||
sw32_R_Init,
|
||||
sw32_R_ClearState,
|
||||
sw32_R_LoadSkys,
|
||||
sw32_R_NewMap,
|
||||
|
@ -116,10 +117,6 @@ static void
|
|||
sw32_vid_render_init (void)
|
||||
{
|
||||
m_funcs = &model_funcs;
|
||||
R_Init_Cvars ();
|
||||
sw32_R_Particles_Init_Cvars ();
|
||||
sw32_R_Init ();
|
||||
Skin_Init ();
|
||||
vid = *vr_data.vid;
|
||||
}
|
||||
|
||||
|
|
|
@ -427,6 +427,8 @@ VID_Init (byte *palette, byte *colormap)
|
|||
return;
|
||||
}
|
||||
|
||||
R_LoadModule ();
|
||||
|
||||
fbname = getenv("FRAMEBUFFER");
|
||||
if (!fbname)
|
||||
fbname = "/dev/fb0";
|
||||
|
|
|
@ -94,6 +94,8 @@ VID_Init (byte *palette, byte *colormap)
|
|||
if (SDL_Init (SDL_INIT_VIDEO) < 0)
|
||||
Sys_Error ("VID: Couldn't load SDL: %s", SDL_GetError ());
|
||||
|
||||
R_LoadModule ();
|
||||
|
||||
// Set up display mode (width and height)
|
||||
VID_GetWindowSize (BASEWIDTH, BASEHEIGHT);
|
||||
|
||||
|
|
|
@ -497,6 +497,8 @@ x11_create_context (void)
|
|||
void
|
||||
VID_Init (byte *palette, byte *colormap)
|
||||
{
|
||||
R_LoadModule ();
|
||||
|
||||
viddef.numpages = 2;
|
||||
viddef.colormap8 = colormap;
|
||||
viddef.fullbright = 256 - viddef.colormap8[256 * VID_GRADES];
|
||||
|
|
Loading…
Reference in a new issue