mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-28 06:21:27 +00:00
Pass vid_internal to R_LoadModule
This fixes the segfault and pushes things very much in the desired direction of proper system independence for rendering and presentation separation (though things were headed in the right direction before).
This commit is contained in:
parent
6ee2df8445
commit
cb10175824
4 changed files with 10 additions and 9 deletions
|
@ -172,8 +172,8 @@ extern struct texture_s *r_notexture_mip;
|
||||||
extern entity_t r_worldentity;
|
extern entity_t r_worldentity;
|
||||||
|
|
||||||
void R_Init (void);
|
void R_Init (void);
|
||||||
void R_LoadModule (void (*load_gl)(void),
|
struct vid_internal_s;
|
||||||
void (*set_palette) (const byte *palette));
|
void R_LoadModule (struct vid_internal_s *vid_internal);
|
||||||
struct progs_s;
|
struct progs_s;
|
||||||
void R_Progs_Init (struct progs_s *pr);
|
void R_Progs_Init (struct progs_s *pr);
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ static U void (*const r_progs_init)(struct progs_s *) = R_Progs_Init;
|
||||||
#undef U
|
#undef U
|
||||||
|
|
||||||
VISIBLE void
|
VISIBLE void
|
||||||
R_LoadModule (void (*load_gl)(void), void (*set_palette) (const byte *palette))
|
R_LoadModule (vid_internal_t *vid_internal)
|
||||||
{
|
{
|
||||||
PI_RegisterPlugins (vidrend_plugin_list);
|
PI_RegisterPlugins (vidrend_plugin_list);
|
||||||
vidrend_plugin = Cvar_Get ("vid_render", VID_RENDER_DEFAULT, CVAR_ROM, 0,
|
vidrend_plugin = Cvar_Get ("vid_render", VID_RENDER_DEFAULT, CVAR_ROM, 0,
|
||||||
|
@ -77,8 +77,7 @@ R_LoadModule (void (*load_gl)(void), void (*set_palette) (const byte *palette))
|
||||||
r_funcs = vidrendmodule->functions->vid_render;
|
r_funcs = vidrendmodule->functions->vid_render;
|
||||||
mod_funcs = r_funcs->model_funcs;
|
mod_funcs = r_funcs->model_funcs;
|
||||||
r_data = vidrendmodule->data->vid_render;
|
r_data = vidrendmodule->data->vid_render;
|
||||||
r_data->vid->vid_internal->load_gl = load_gl;
|
r_data->vid->vid_internal = vid_internal;
|
||||||
r_data->vid->vid_internal->set_palette = set_palette;
|
|
||||||
|
|
||||||
vidrendmodule->functions->general->p_Init ();
|
vidrendmodule->functions->general->p_Init ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -237,7 +237,8 @@ VID_Init (byte *palette, byte *colormap)
|
||||||
{
|
{
|
||||||
Uint32 flags;
|
Uint32 flags;
|
||||||
|
|
||||||
viddef.vid_internal = &vid_internal;
|
vid_internal.set_palette = VID_SetPalette;
|
||||||
|
vid_internal.load_gl = sdl_load_gl;
|
||||||
|
|
||||||
set_vid_mode = sdl_set_vid_mode;
|
set_vid_mode = sdl_set_vid_mode;
|
||||||
|
|
||||||
|
@ -245,7 +246,7 @@ VID_Init (byte *palette, byte *colormap)
|
||||||
if (SDL_Init (SDL_INIT_VIDEO) < 0)
|
if (SDL_Init (SDL_INIT_VIDEO) < 0)
|
||||||
Sys_Error ("VID: Couldn't load SDL: %s", SDL_GetError ());
|
Sys_Error ("VID: Couldn't load SDL: %s", SDL_GetError ());
|
||||||
|
|
||||||
R_LoadModule (sdl_load_gl, VID_SetPalette);
|
R_LoadModule (&vid_internal);
|
||||||
|
|
||||||
viddef.numpages = 1;
|
viddef.numpages = 1;
|
||||||
viddef.colormap8 = colormap;
|
viddef.colormap8 = colormap;
|
||||||
|
|
|
@ -667,12 +667,13 @@ VID_SetPalette (const byte *palette)
|
||||||
void
|
void
|
||||||
VID_Init (byte *palette, byte *colormap)
|
VID_Init (byte *palette, byte *colormap)
|
||||||
{
|
{
|
||||||
viddef.vid_internal = &vid_internal;
|
vid_internal.load_gl = glx_load_gl;
|
||||||
|
vid_internal.set_palette = VID_SetPalette;
|
||||||
|
|
||||||
choose_visual = x11_choose_visual;
|
choose_visual = x11_choose_visual;
|
||||||
create_context = x11_create_context;
|
create_context = x11_create_context;
|
||||||
|
|
||||||
R_LoadModule (glx_load_gl, VID_SetPalette);
|
R_LoadModule (&vid_internal);
|
||||||
|
|
||||||
viddef.numpages = 2;
|
viddef.numpages = 2;
|
||||||
viddef.colormap8 = colormap;
|
viddef.colormap8 = colormap;
|
||||||
|
|
Loading…
Reference in a new issue