mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-29 23:52:22 +00:00
[util] Make PI_LoadPlugin always call general init function
As the root cause for #16 was something else, this fixes only the basic cvar initialization, but does fix #19 (for now, at least).
This commit is contained in:
parent
a66e6ad262
commit
0be609e0fd
23 changed files with 306 additions and 351 deletions
|
@ -31,6 +31,7 @@
|
|||
#include <QF/qtypes.h>
|
||||
|
||||
typedef struct cd_funcs_s {
|
||||
void (*init) (void);
|
||||
void (*cd_f) (void); //
|
||||
void (*pause) (void);
|
||||
void (*play) (int, qboolean);
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <QF/qtypes.h>
|
||||
|
||||
typedef struct console_funcs_s {
|
||||
void (*init) (void);
|
||||
void (*print) (const char *fmt, va_list args) __attribute__((format(PRINTF, 1, 0)));
|
||||
void (*process_input) (void);
|
||||
void (*key_event) (knum_t key, short unicode, qboolean down);
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
struct sfx_s;
|
||||
|
||||
typedef struct snd_render_funcs_s {
|
||||
void (*init) (void);
|
||||
void (*ambient_off) (void);
|
||||
void (*ambient_on) (void);
|
||||
void (*static_sound) (struct sfx_s *sfx, const vec3_t origin, float vol, float attenuation);
|
||||
|
|
|
@ -112,6 +112,7 @@ typedef struct vid_model_funcs_s {
|
|||
} vid_model_funcs_t;
|
||||
|
||||
typedef struct vid_render_funcs_s {
|
||||
void (*init) (void);
|
||||
void (*Draw_Character) (int x, int y, unsigned ch);
|
||||
void (*Draw_String) (int x, int y, const char *str);
|
||||
void (*Draw_nString) (int x, int y, const char *str, int count);
|
||||
|
|
|
@ -111,7 +111,6 @@ CDAudio_Init (void)
|
|||
Sys_Printf ("Loading of cd module: %s failed!\n", cd_plugin->string);
|
||||
return -1;
|
||||
}
|
||||
cdmodule->functions->general->init ();
|
||||
Cmd_AddCommand (
|
||||
"cd", CD_f, "Control the CD player.\n"
|
||||
"Commands:\n"
|
||||
|
|
|
@ -477,6 +477,7 @@ static general_funcs_t plugin_info_general_funcs = {
|
|||
};
|
||||
|
||||
static cd_funcs_t plugin_info_cd_funcs = {
|
||||
0,
|
||||
I_OGG_f,
|
||||
I_OGGMus_Pause,
|
||||
I_OGGMus_Play,
|
||||
|
|
|
@ -455,6 +455,7 @@ static general_funcs_t plugin_info_general_funcs = {
|
|||
};
|
||||
|
||||
static cd_funcs_t plugin_info_cd_funcs = {
|
||||
0,
|
||||
I_CD_f,
|
||||
I_CDAudio_Pause,
|
||||
I_CDAudio_Play,
|
||||
|
|
|
@ -288,6 +288,7 @@ static general_funcs_t plugin_info_general_funcs = {
|
|||
};
|
||||
|
||||
static cd_funcs_t plugin_info_cd_funcs = {
|
||||
0,
|
||||
I_CD_f,
|
||||
I_CDAudio_Pause,
|
||||
I_CDAudio_Play,
|
||||
|
|
|
@ -364,6 +364,7 @@ static general_funcs_t plugin_info_general_funcs = {
|
|||
};
|
||||
|
||||
static cd_funcs_t plugin_info_cd_funcs = {
|
||||
0,
|
||||
I_SGI_f,
|
||||
I_SGI_Pause,
|
||||
I_SGI_Play,
|
||||
|
|
|
@ -499,6 +499,7 @@ static general_funcs_t plugin_info_general_funcs = {
|
|||
};
|
||||
|
||||
static cd_funcs_t plugin_info_cd_funcs = {
|
||||
0,
|
||||
I_CD_f,
|
||||
I_CDAudio_Pause,
|
||||
I_CDAudio_Play,
|
||||
|
|
|
@ -489,6 +489,7 @@ static general_funcs_t plugin_info_general_funcs = {
|
|||
};
|
||||
|
||||
static cd_funcs_t plugin_info_cd_funcs = {
|
||||
0,
|
||||
I_XMMS_f,
|
||||
I_XMMS_Pause,
|
||||
I_XMMS_Play,
|
||||
|
|
|
@ -310,6 +310,23 @@ s_snd_force_unblock (void)
|
|||
s_unblock_sound ();
|
||||
}
|
||||
|
||||
static void
|
||||
s_init_cvars (void)
|
||||
{
|
||||
nosound = Cvar_Get ("nosound", "0", CVAR_NONE, NULL,
|
||||
"Set to turn sound off");
|
||||
snd_volume = Cvar_Get ("volume", "0.7", CVAR_ARCHIVE, NULL,
|
||||
"Set the volume for sound playback");
|
||||
snd_mixahead = Cvar_Get ("snd_mixahead", "0.1", CVAR_ARCHIVE, NULL,
|
||||
"Delay time for sounds");
|
||||
snd_noextraupdate = Cvar_Get ("snd_noextraupdate", "0", CVAR_NONE, NULL,
|
||||
"Toggles the correct value display in "
|
||||
"host_speeds. Usually messes up sound "
|
||||
"playback when in effect");
|
||||
snd_show = Cvar_Get ("snd_show", "0", CVAR_NONE, NULL,
|
||||
"Toggles display of sounds currently being played");
|
||||
}
|
||||
|
||||
static void
|
||||
s_init (void)
|
||||
{
|
||||
|
@ -325,18 +342,6 @@ s_init (void)
|
|||
Cmd_AddCommand ("snd_force_unblock", s_snd_force_unblock,
|
||||
"fix permanently blocked sound");
|
||||
|
||||
nosound = Cvar_Get ("nosound", "0", CVAR_NONE, NULL,
|
||||
"Set to turn sound off");
|
||||
snd_volume = Cvar_Get ("volume", "0.7", CVAR_ARCHIVE, NULL,
|
||||
"Set the volume for sound playback");
|
||||
snd_mixahead = Cvar_Get ("snd_mixahead", "0.1", CVAR_ARCHIVE, NULL,
|
||||
"Delay time for sounds");
|
||||
snd_noextraupdate = Cvar_Get ("snd_noextraupdate", "0", CVAR_NONE, NULL,
|
||||
"Toggles the correct value display in "
|
||||
"host_speeds. Usually messes up sound "
|
||||
"playback when in effect");
|
||||
snd_show = Cvar_Get ("snd_show", "0", CVAR_NONE, NULL,
|
||||
"Toggles display of sounds currently being played");
|
||||
// FIXME
|
||||
// if (host_parms.memsize < 0x800000) {
|
||||
// Cvar_Set (snd_loadas8bit, "1");
|
||||
|
@ -456,11 +461,12 @@ s_alloc_channel (void)
|
|||
}
|
||||
|
||||
static general_funcs_t plugin_info_general_funcs = {
|
||||
s_init,
|
||||
s_shutdown,
|
||||
.init = s_init_cvars,
|
||||
.shutdown = s_shutdown,
|
||||
};
|
||||
|
||||
static snd_render_funcs_t plugin_info_render_funcs = {
|
||||
.init = s_init,
|
||||
.ambient_off = s_ambient_off,
|
||||
.ambient_on = s_ambient_on,
|
||||
.static_sound = s_static_sound,
|
||||
|
|
|
@ -99,8 +99,7 @@ S_Init (int *viewentity, double *host_frametime)
|
|||
host_frametime;
|
||||
snd_render_module->data->snd_render->output = snd_output_module;
|
||||
|
||||
snd_output_module->functions->general->init ();
|
||||
snd_render_module->functions->general->init ();
|
||||
snd_render_module->functions->snd_render->init ();
|
||||
|
||||
snd_output_module->data->snd_output->soundtime
|
||||
= snd_render_module->data->snd_render->soundtime;
|
||||
|
|
|
@ -939,31 +939,27 @@ C_shutdown (void)
|
|||
}
|
||||
|
||||
static general_funcs_t plugin_info_general_funcs = {
|
||||
C_Init,
|
||||
C_shutdown,
|
||||
.init = C_Init,
|
||||
.shutdown = C_shutdown,
|
||||
};
|
||||
|
||||
static console_funcs_t plugin_info_console_funcs = {
|
||||
C_Print,
|
||||
C_ProcessInput,
|
||||
C_KeyEvent,
|
||||
C_DrawConsole,
|
||||
C_CheckResize,
|
||||
C_NewMap,
|
||||
.print = C_Print,
|
||||
.process_input = C_ProcessInput,
|
||||
.key_event = C_KeyEvent,
|
||||
.draw_console = C_DrawConsole,
|
||||
.check_resize = C_CheckResize,
|
||||
.new_map = C_NewMap,
|
||||
};
|
||||
|
||||
static plugin_funcs_t plugin_info_funcs = {
|
||||
&plugin_info_general_funcs,
|
||||
0,
|
||||
0,
|
||||
&plugin_info_console_funcs,
|
||||
.general = &plugin_info_general_funcs,
|
||||
.console = &plugin_info_console_funcs,
|
||||
};
|
||||
|
||||
static plugin_data_t plugin_info_data = {
|
||||
&plugin_info_general_data,
|
||||
0,
|
||||
0,
|
||||
&con_data,
|
||||
.general = &plugin_info_general_data,
|
||||
.console = &con_data,
|
||||
};
|
||||
|
||||
static plugin_t plugin_info = {
|
||||
|
|
|
@ -102,7 +102,6 @@ Con_Init (const char *plugin_name)
|
|||
|
||||
con_module = PI_LoadPlugin ("console", plugin_name);
|
||||
if (con_module) {
|
||||
con_module->functions->general->init ();
|
||||
Sys_SetStdPrintf (con_module->functions->console->print);
|
||||
} else {
|
||||
setvbuf (stdout, 0, _IOLBF, BUFSIZ);
|
||||
|
|
|
@ -785,32 +785,28 @@ C_NewMap (void)
|
|||
}
|
||||
|
||||
static general_funcs_t plugin_info_general_funcs = {
|
||||
C_Init,
|
||||
C_shutdown,
|
||||
.init = C_Init,
|
||||
.shutdown = C_shutdown,
|
||||
};
|
||||
static general_data_t plugin_info_general_data;
|
||||
|
||||
static console_funcs_t plugin_info_console_funcs = {
|
||||
C_Print,
|
||||
C_ProcessInput,
|
||||
C_KeyEvent,
|
||||
C_DrawConsole,
|
||||
C_CheckResize,
|
||||
C_NewMap,
|
||||
.print = C_Print,
|
||||
.process_input = C_ProcessInput,
|
||||
.key_event = C_KeyEvent,
|
||||
.draw_console = C_DrawConsole,
|
||||
.check_resize = C_CheckResize,
|
||||
.new_map = C_NewMap,
|
||||
};
|
||||
|
||||
static plugin_funcs_t plugin_info_funcs = {
|
||||
&plugin_info_general_funcs,
|
||||
0,
|
||||
0,
|
||||
&plugin_info_console_funcs,
|
||||
.general = &plugin_info_general_funcs,
|
||||
.console = &plugin_info_console_funcs,
|
||||
};
|
||||
|
||||
static plugin_data_t plugin_info_data = {
|
||||
&plugin_info_general_data,
|
||||
0,
|
||||
0,
|
||||
&sv_con_data,
|
||||
.general = &plugin_info_general_data,
|
||||
.console = &sv_con_data,
|
||||
};
|
||||
|
||||
static plugin_t plugin_info = {
|
||||
|
|
|
@ -197,12 +197,9 @@ PI_Plugin_Load_f (void)
|
|||
name = Cmd_Argv(2);
|
||||
|
||||
pi = PI_LoadPlugin (type, name);
|
||||
if (!pi)
|
||||
if (!pi) {
|
||||
Sys_Printf ("Error loading plugin %s %s\n", type, name);
|
||||
|
||||
else if (pi->functions && pi->functions->general &&
|
||||
pi->functions->general->init)
|
||||
pi->functions->general->init ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -379,16 +376,19 @@ PI_LoadPlugin (const char *type, const char *name)
|
|||
|
||||
plugin->full_name = lp->name;
|
||||
plugin->handle = dlhand;
|
||||
|
||||
if (plugin->functions && plugin->functions->general
|
||||
&& plugin->functions->general->init) {
|
||||
plugin->functions->general->init ();
|
||||
}
|
||||
return plugin;
|
||||
}
|
||||
|
||||
VISIBLE qboolean
|
||||
PI_UnloadPlugin (plugin_t *plugin)
|
||||
{
|
||||
if (plugin
|
||||
&& plugin->functions
|
||||
&& plugin->functions->general
|
||||
&& plugin->functions->general->shutdown) {
|
||||
if (plugin && plugin->functions && plugin->functions->general
|
||||
&& plugin->functions->general->shutdown) {
|
||||
plugin->functions->general->shutdown ();
|
||||
} else {
|
||||
Sys_MaskPrintf (SYS_dev,
|
||||
|
|
|
@ -89,7 +89,7 @@ R_LoadModule (vid_internal_t *vid_internal)
|
|||
r_data = vidrendmodule->data->vid_render;
|
||||
r_data->vid->vid_internal = vid_internal;
|
||||
|
||||
vidrendmodule->functions->general->init ();
|
||||
r_funcs->init ();
|
||||
Sys_RegisterShutdown (R_shutdown, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,18 @@
|
|||
|
||||
gl_ctx_t *gl_ctx;
|
||||
|
||||
static void
|
||||
gl_vid_render_choose_visual (void)
|
||||
{
|
||||
gl_ctx->choose_visual (gl_ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
gl_vid_render_create_context (void)
|
||||
{
|
||||
gl_ctx->create_context (gl_ctx);
|
||||
}
|
||||
|
||||
static vid_model_funcs_t model_funcs = {
|
||||
sizeof (gltex_t),
|
||||
gl_Mod_LoadLighting,
|
||||
|
@ -71,7 +83,31 @@ static vid_model_funcs_t model_funcs = {
|
|||
gl_Skin_InitTranslations,
|
||||
};
|
||||
|
||||
static void
|
||||
gl_vid_render_init (void)
|
||||
{
|
||||
if (!vr_data.vid->vid_internal->sw_context) {
|
||||
Sys_Error ("Sorry, OpenGL not supported by this program.");
|
||||
}
|
||||
gl_ctx = vr_data.vid->vid_internal->gl_context ();
|
||||
gl_ctx->init_gl = GL_Init_Common;
|
||||
gl_ctx->load_gl ();
|
||||
|
||||
vr_data.vid->vid_internal->set_palette = GL_SetPalette;
|
||||
vr_data.vid->vid_internal->choose_visual = gl_vid_render_choose_visual;
|
||||
vr_data.vid->vid_internal->create_context = gl_vid_render_create_context;
|
||||
|
||||
vr_funcs = &gl_vid_render_funcs;
|
||||
m_funcs = &model_funcs;
|
||||
}
|
||||
|
||||
static void
|
||||
gl_vid_render_shutdown (void)
|
||||
{
|
||||
}
|
||||
|
||||
vid_render_funcs_t gl_vid_render_funcs = {
|
||||
gl_vid_render_init,
|
||||
gl_Draw_Character,
|
||||
gl_Draw_String,
|
||||
gl_Draw_nString,
|
||||
|
@ -128,66 +164,20 @@ vid_render_funcs_t gl_vid_render_funcs = {
|
|||
&model_funcs
|
||||
};
|
||||
|
||||
static void
|
||||
gl_vid_render_choose_visual (void)
|
||||
{
|
||||
gl_ctx->choose_visual (gl_ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
gl_vid_render_create_context (void)
|
||||
{
|
||||
gl_ctx->create_context (gl_ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
gl_vid_render_init (void)
|
||||
{
|
||||
if (!vr_data.vid->vid_internal->sw_context) {
|
||||
Sys_Error ("Sorry, OpenGL not supported by this program.");
|
||||
}
|
||||
gl_ctx = vr_data.vid->vid_internal->gl_context ();
|
||||
gl_ctx->init_gl = GL_Init_Common;
|
||||
gl_ctx->load_gl ();
|
||||
|
||||
vr_data.vid->vid_internal->set_palette = GL_SetPalette;
|
||||
vr_data.vid->vid_internal->choose_visual = gl_vid_render_choose_visual;
|
||||
vr_data.vid->vid_internal->create_context = gl_vid_render_create_context;
|
||||
|
||||
vr_funcs = &gl_vid_render_funcs;
|
||||
m_funcs = &model_funcs;
|
||||
}
|
||||
|
||||
static void
|
||||
gl_vid_render_shutdown (void)
|
||||
{
|
||||
}
|
||||
|
||||
static general_funcs_t plugin_info_general_funcs = {
|
||||
gl_vid_render_init,
|
||||
gl_vid_render_shutdown,
|
||||
.shutdown = gl_vid_render_shutdown,
|
||||
};
|
||||
|
||||
static general_data_t plugin_info_general_data;
|
||||
|
||||
static plugin_funcs_t plugin_info_funcs = {
|
||||
&plugin_info_general_funcs,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
&gl_vid_render_funcs,
|
||||
.general = &plugin_info_general_funcs,
|
||||
.vid_render = &gl_vid_render_funcs,
|
||||
};
|
||||
|
||||
static plugin_data_t plugin_info_data = {
|
||||
&plugin_info_general_data,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
&vid_render_data,
|
||||
.general = &plugin_info_general_data,
|
||||
.vid_render = &vid_render_data,
|
||||
};
|
||||
|
||||
static plugin_t plugin_info = {
|
||||
|
|
|
@ -45,6 +45,18 @@
|
|||
|
||||
gl_ctx_t *glsl_ctx;
|
||||
|
||||
static void
|
||||
glsl_vid_render_choose_visual (void)
|
||||
{
|
||||
glsl_ctx->choose_visual (glsl_ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
glsl_vid_render_create_context (void)
|
||||
{
|
||||
glsl_ctx->create_context (glsl_ctx);
|
||||
}
|
||||
|
||||
static vid_model_funcs_t model_funcs = {
|
||||
sizeof (glsltex_t),
|
||||
glsl_Mod_LoadLighting,
|
||||
|
@ -71,7 +83,30 @@ static vid_model_funcs_t model_funcs = {
|
|||
glsl_Skin_InitTranslations,
|
||||
};
|
||||
|
||||
static void
|
||||
glsl_vid_render_init (void)
|
||||
{
|
||||
if (!vr_data.vid->vid_internal->sw_context) {
|
||||
Sys_Error ("Sorry, OpenGL (GLSL) not supported by this program.");
|
||||
}
|
||||
glsl_ctx = vr_data.vid->vid_internal->gl_context ();
|
||||
glsl_ctx->init_gl = GLSL_Init_Common;
|
||||
glsl_ctx->load_gl ();
|
||||
|
||||
vr_data.vid->vid_internal->set_palette = GLSL_SetPalette;
|
||||
vr_data.vid->vid_internal->choose_visual = glsl_vid_render_choose_visual;
|
||||
vr_data.vid->vid_internal->create_context = glsl_vid_render_create_context;
|
||||
vr_funcs = &glsl_vid_render_funcs;
|
||||
m_funcs = &model_funcs;
|
||||
}
|
||||
|
||||
static void
|
||||
glsl_vid_render_shutdown (void)
|
||||
{
|
||||
}
|
||||
|
||||
vid_render_funcs_t glsl_vid_render_funcs = {
|
||||
glsl_vid_render_init,
|
||||
glsl_Draw_Character,
|
||||
glsl_Draw_String,
|
||||
glsl_Draw_nString,
|
||||
|
@ -128,65 +163,20 @@ vid_render_funcs_t glsl_vid_render_funcs = {
|
|||
&model_funcs
|
||||
};
|
||||
|
||||
static void
|
||||
glsl_vid_render_choose_visual (void)
|
||||
{
|
||||
glsl_ctx->choose_visual (glsl_ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
glsl_vid_render_create_context (void)
|
||||
{
|
||||
glsl_ctx->create_context (glsl_ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
glsl_vid_render_init (void)
|
||||
{
|
||||
if (!vr_data.vid->vid_internal->sw_context) {
|
||||
Sys_Error ("Sorry, OpenGL (GLSL) not supported by this program.");
|
||||
}
|
||||
glsl_ctx = vr_data.vid->vid_internal->gl_context ();
|
||||
glsl_ctx->init_gl = GLSL_Init_Common;
|
||||
glsl_ctx->load_gl ();
|
||||
|
||||
vr_data.vid->vid_internal->set_palette = GLSL_SetPalette;
|
||||
vr_data.vid->vid_internal->choose_visual = glsl_vid_render_choose_visual;
|
||||
vr_data.vid->vid_internal->create_context = glsl_vid_render_create_context;
|
||||
vr_funcs = &glsl_vid_render_funcs;
|
||||
m_funcs = &model_funcs;
|
||||
}
|
||||
|
||||
static void
|
||||
glsl_vid_render_shutdown (void)
|
||||
{
|
||||
}
|
||||
|
||||
static general_funcs_t plugin_info_general_funcs = {
|
||||
glsl_vid_render_init,
|
||||
glsl_vid_render_shutdown,
|
||||
.shutdown = glsl_vid_render_shutdown,
|
||||
};
|
||||
|
||||
static general_data_t plugin_info_general_data;
|
||||
|
||||
static plugin_funcs_t plugin_info_funcs = {
|
||||
&plugin_info_general_funcs,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
&glsl_vid_render_funcs,
|
||||
.general = &plugin_info_general_funcs,
|
||||
.vid_render = &glsl_vid_render_funcs,
|
||||
};
|
||||
|
||||
static plugin_data_t plugin_info_data = {
|
||||
&plugin_info_general_data,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
&vid_render_data,
|
||||
.general = &plugin_info_general_data,
|
||||
.vid_render = &vid_render_data,
|
||||
};
|
||||
|
||||
static plugin_t plugin_info = {
|
||||
|
|
|
@ -38,6 +38,18 @@
|
|||
|
||||
sw_ctx_t *sw_ctx;
|
||||
|
||||
static void
|
||||
sw_vid_render_choose_visual (void)
|
||||
{
|
||||
sw_ctx->choose_visual (sw_ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
sw_vid_render_create_context (void)
|
||||
{
|
||||
sw_ctx->create_context (sw_ctx);
|
||||
}
|
||||
|
||||
static vid_model_funcs_t model_funcs = {
|
||||
0,
|
||||
sw_Mod_LoadLighting,
|
||||
|
@ -64,7 +76,29 @@ static vid_model_funcs_t model_funcs = {
|
|||
sw_Skin_InitTranslations,
|
||||
};
|
||||
|
||||
static void
|
||||
sw_vid_render_init (void)
|
||||
{
|
||||
if (!vr_data.vid->vid_internal->sw_context) {
|
||||
Sys_Error ("Sorry, software rendering not supported by this program.");
|
||||
}
|
||||
sw_ctx = vr_data.vid->vid_internal->sw_context ();
|
||||
|
||||
vr_data.vid->vid_internal->set_palette = sw_ctx->set_palette;
|
||||
vr_data.vid->vid_internal->choose_visual = sw_vid_render_choose_visual;
|
||||
vr_data.vid->vid_internal->create_context = sw_vid_render_create_context;
|
||||
|
||||
vr_funcs = &sw_vid_render_funcs;
|
||||
m_funcs = &model_funcs;
|
||||
}
|
||||
|
||||
static void
|
||||
sw_vid_render_shutdown (void)
|
||||
{
|
||||
}
|
||||
|
||||
vid_render_funcs_t sw_vid_render_funcs = {
|
||||
sw_vid_render_init,
|
||||
Draw_Character,
|
||||
Draw_String,
|
||||
Draw_nString,
|
||||
|
@ -121,64 +155,20 @@ vid_render_funcs_t sw_vid_render_funcs = {
|
|||
&model_funcs
|
||||
};
|
||||
|
||||
static void
|
||||
sw_vid_render_choose_visual (void)
|
||||
{
|
||||
sw_ctx->choose_visual (sw_ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
sw_vid_render_create_context (void)
|
||||
{
|
||||
sw_ctx->create_context (sw_ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
sw_vid_render_init (void)
|
||||
{
|
||||
if (!vr_data.vid->vid_internal->sw_context) {
|
||||
Sys_Error ("Sorry, software rendering not supported by this program.");
|
||||
}
|
||||
sw_ctx = vr_data.vid->vid_internal->sw_context ();
|
||||
|
||||
vr_data.vid->vid_internal->set_palette = sw_ctx->set_palette;
|
||||
vr_data.vid->vid_internal->choose_visual = sw_vid_render_choose_visual;
|
||||
vr_data.vid->vid_internal->create_context = sw_vid_render_create_context;
|
||||
|
||||
vr_funcs = &sw_vid_render_funcs;
|
||||
m_funcs = &model_funcs;
|
||||
}
|
||||
|
||||
static void
|
||||
sw_vid_render_shutdown (void)
|
||||
{
|
||||
}
|
||||
|
||||
static general_funcs_t plugin_info_general_funcs = {
|
||||
sw_vid_render_init,
|
||||
sw_vid_render_shutdown,
|
||||
.shutdown = sw_vid_render_shutdown,
|
||||
};
|
||||
|
||||
static general_data_t plugin_info_general_data;
|
||||
|
||||
static plugin_funcs_t plugin_info_funcs = {
|
||||
&plugin_info_general_funcs,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
&sw_vid_render_funcs,
|
||||
.general = &plugin_info_general_funcs,
|
||||
.vid_render = &sw_vid_render_funcs,
|
||||
};
|
||||
|
||||
static plugin_data_t plugin_info_data = {
|
||||
&plugin_info_general_data,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
&vid_render_data,
|
||||
.general = &plugin_info_general_data,
|
||||
.vid_render = &vid_render_data,
|
||||
};
|
||||
|
||||
static plugin_t plugin_info = {
|
||||
|
|
|
@ -43,6 +43,18 @@
|
|||
|
||||
sw_ctx_t *sw32_ctx;
|
||||
|
||||
static void
|
||||
sw32_vid_render_choose_visual (void)
|
||||
{
|
||||
sw32_ctx->choose_visual (sw32_ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
sw32_vid_render_create_context (void)
|
||||
{
|
||||
sw32_ctx->create_context (sw32_ctx);
|
||||
}
|
||||
|
||||
static vid_model_funcs_t model_funcs = {
|
||||
0,
|
||||
sw_Mod_LoadLighting,
|
||||
|
@ -69,7 +81,29 @@ static vid_model_funcs_t model_funcs = {
|
|||
sw_Skin_InitTranslations,
|
||||
};
|
||||
|
||||
static void
|
||||
sw32_vid_render_init (void)
|
||||
{
|
||||
if (!vr_data.vid->vid_internal->sw_context) {
|
||||
Sys_Error ("Sorry, software rendering not supported by this program.");
|
||||
}
|
||||
sw32_ctx = vr_data.vid->vid_internal->sw_context ();
|
||||
|
||||
vr_data.vid->vid_internal->set_palette = sw32_ctx->set_palette;
|
||||
vr_data.vid->vid_internal->choose_visual = sw32_vid_render_choose_visual;
|
||||
vr_data.vid->vid_internal->create_context = sw32_vid_render_create_context;
|
||||
|
||||
vr_funcs = &sw32_vid_render_funcs;
|
||||
m_funcs = &model_funcs;
|
||||
}
|
||||
|
||||
static void
|
||||
sw32_vid_render_shutdown (void)
|
||||
{
|
||||
}
|
||||
|
||||
vid_render_funcs_t sw32_vid_render_funcs = {
|
||||
sw32_vid_render_init,
|
||||
sw32_Draw_Character,
|
||||
sw32_Draw_String,
|
||||
sw32_Draw_nString,
|
||||
|
@ -126,64 +160,20 @@ vid_render_funcs_t sw32_vid_render_funcs = {
|
|||
&model_funcs
|
||||
};
|
||||
|
||||
static void
|
||||
sw32_vid_render_choose_visual (void)
|
||||
{
|
||||
sw32_ctx->choose_visual (sw32_ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
sw32_vid_render_create_context (void)
|
||||
{
|
||||
sw32_ctx->create_context (sw32_ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
sw32_vid_render_init (void)
|
||||
{
|
||||
if (!vr_data.vid->vid_internal->sw_context) {
|
||||
Sys_Error ("Sorry, software rendering not supported by this program.");
|
||||
}
|
||||
sw32_ctx = vr_data.vid->vid_internal->sw_context ();
|
||||
|
||||
vr_data.vid->vid_internal->set_palette = sw32_ctx->set_palette;
|
||||
vr_data.vid->vid_internal->choose_visual = sw32_vid_render_choose_visual;
|
||||
vr_data.vid->vid_internal->create_context = sw32_vid_render_create_context;
|
||||
|
||||
vr_funcs = &sw32_vid_render_funcs;
|
||||
m_funcs = &model_funcs;
|
||||
}
|
||||
|
||||
static void
|
||||
sw32_vid_render_shutdown (void)
|
||||
{
|
||||
}
|
||||
|
||||
static general_funcs_t plugin_info_general_funcs = {
|
||||
sw32_vid_render_init,
|
||||
sw32_vid_render_shutdown,
|
||||
.shutdown = sw32_vid_render_shutdown,
|
||||
};
|
||||
|
||||
static general_data_t plugin_info_general_data;
|
||||
|
||||
static plugin_funcs_t plugin_info_funcs = {
|
||||
&plugin_info_general_funcs,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
&sw32_vid_render_funcs,
|
||||
.general = &plugin_info_general_funcs,
|
||||
.vid_render = &sw32_vid_render_funcs,
|
||||
};
|
||||
|
||||
static plugin_data_t plugin_info_data = {
|
||||
&plugin_info_general_data,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
&vid_render_data,
|
||||
.general = &plugin_info_general_data,
|
||||
.vid_render = &vid_render_data,
|
||||
};
|
||||
|
||||
static plugin_t plugin_info = {
|
||||
|
|
|
@ -515,6 +515,42 @@ vulkan_Skin_InitTranslations (void)
|
|||
{
|
||||
}
|
||||
|
||||
static void
|
||||
set_palette (const byte *palette)
|
||||
{
|
||||
//FIXME really don't want this here: need an application domain
|
||||
//so Quake can be separated from QuakeForge (ie, Quake itself becomes
|
||||
//an app using the QuakeForge engine)
|
||||
}
|
||||
|
||||
static void
|
||||
vulkan_vid_render_choose_visual (void)
|
||||
{
|
||||
Vulkan_CreateDevice (vulkan_ctx);
|
||||
vulkan_ctx->choose_visual (vulkan_ctx);
|
||||
vulkan_ctx->cmdpool = QFV_CreateCommandPool (vulkan_ctx->device,
|
||||
vulkan_ctx->device->queue.queueFamily,
|
||||
0, 1);
|
||||
__auto_type cmdset = QFV_AllocCommandBufferSet (1, alloca);
|
||||
QFV_AllocateCommandBuffers (vulkan_ctx->device, vulkan_ctx->cmdpool, 0,
|
||||
cmdset);
|
||||
vulkan_ctx->cmdbuffer = cmdset->a[0];
|
||||
vulkan_ctx->fence = QFV_CreateFence (vulkan_ctx->device, 1);
|
||||
Sys_MaskPrintf (SYS_vulkan, "vk choose visual %p %p %d %#zx\n",
|
||||
vulkan_ctx->device->dev, vulkan_ctx->device->queue.queue,
|
||||
vulkan_ctx->device->queue.queueFamily,
|
||||
(size_t) vulkan_ctx->cmdpool);
|
||||
}
|
||||
|
||||
static void
|
||||
vulkan_vid_render_create_context (void)
|
||||
{
|
||||
vulkan_ctx->create_window (vulkan_ctx);
|
||||
vulkan_ctx->surface = vulkan_ctx->create_surface (vulkan_ctx);
|
||||
Sys_MaskPrintf (SYS_vulkan, "vk create context %#zx\n",
|
||||
(size_t) vulkan_ctx->surface);
|
||||
}
|
||||
|
||||
static vid_model_funcs_t model_funcs = {
|
||||
sizeof (vulktex_t) + 2 * sizeof (qfv_tex_t),
|
||||
vulkan_Mod_LoadLighting,
|
||||
|
@ -541,7 +577,48 @@ static vid_model_funcs_t model_funcs = {
|
|||
vulkan_Skin_InitTranslations,
|
||||
};
|
||||
|
||||
static void
|
||||
vulkan_vid_render_init (void)
|
||||
{
|
||||
if (!vr_data.vid->vid_internal->vulkan_context) {
|
||||
Sys_Error ("Sorry, Vulkan not supported by this program.");
|
||||
}
|
||||
vulkan_ctx = vr_data.vid->vid_internal->vulkan_context ();
|
||||
vulkan_ctx->load_vulkan (vulkan_ctx);
|
||||
|
||||
Vulkan_Init_Common (vulkan_ctx);
|
||||
|
||||
vr_data.vid->vid_internal->set_palette = set_palette;
|
||||
vr_data.vid->vid_internal->choose_visual = vulkan_vid_render_choose_visual;
|
||||
vr_data.vid->vid_internal->create_context = vulkan_vid_render_create_context;
|
||||
|
||||
vr_funcs = &vulkan_vid_render_funcs;
|
||||
m_funcs = &model_funcs;
|
||||
}
|
||||
|
||||
static void
|
||||
vulkan_vid_render_shutdown (void)
|
||||
{
|
||||
qfv_device_t *device = vulkan_ctx->device;
|
||||
qfv_devfuncs_t *df = device->funcs;
|
||||
VkDevice dev = device->dev;
|
||||
QFV_DeviceWaitIdle (device);
|
||||
df->vkDestroyFence (dev, vulkan_ctx->fence, 0);
|
||||
df->vkDestroyCommandPool (dev, vulkan_ctx->cmdpool, 0);
|
||||
Vulkan_Compose_Shutdown (vulkan_ctx);
|
||||
Vulkan_Lighting_Shutdown (vulkan_ctx);
|
||||
Vulkan_Draw_Shutdown (vulkan_ctx);
|
||||
Vulkan_Bsp_Shutdown (vulkan_ctx);
|
||||
Vulkan_Alias_Shutdown (vulkan_ctx);
|
||||
Mod_ClearAll ();
|
||||
Vulkan_Texture_Shutdown (vulkan_ctx);
|
||||
Vulkan_DestroyFramebuffers (vulkan_ctx);
|
||||
Vulkan_DestroyRenderPass (vulkan_ctx);
|
||||
Vulkan_Shutdown_Common (vulkan_ctx);
|
||||
}
|
||||
|
||||
vid_render_funcs_t vulkan_vid_render_funcs = {
|
||||
vulkan_vid_render_init,
|
||||
vulkan_Draw_Character,
|
||||
vulkan_Draw_String,
|
||||
vulkan_Draw_nString,
|
||||
|
@ -598,107 +675,20 @@ vid_render_funcs_t vulkan_vid_render_funcs = {
|
|||
&model_funcs
|
||||
};
|
||||
|
||||
static void
|
||||
set_palette (const byte *palette)
|
||||
{
|
||||
//FIXME really don't want this here: need an application domain
|
||||
//so Quake can be separated from QuakeForge (ie, Quake itself becomes
|
||||
//an app using the QuakeForge engine)
|
||||
}
|
||||
|
||||
static void
|
||||
vulkan_vid_render_choose_visual (void)
|
||||
{
|
||||
Vulkan_CreateDevice (vulkan_ctx);
|
||||
vulkan_ctx->choose_visual (vulkan_ctx);
|
||||
vulkan_ctx->cmdpool = QFV_CreateCommandPool (vulkan_ctx->device,
|
||||
vulkan_ctx->device->queue.queueFamily,
|
||||
0, 1);
|
||||
__auto_type cmdset = QFV_AllocCommandBufferSet (1, alloca);
|
||||
QFV_AllocateCommandBuffers (vulkan_ctx->device, vulkan_ctx->cmdpool, 0,
|
||||
cmdset);
|
||||
vulkan_ctx->cmdbuffer = cmdset->a[0];
|
||||
vulkan_ctx->fence = QFV_CreateFence (vulkan_ctx->device, 1);
|
||||
Sys_MaskPrintf (SYS_vulkan, "vk choose visual %p %p %d %#zx\n",
|
||||
vulkan_ctx->device->dev, vulkan_ctx->device->queue.queue,
|
||||
vulkan_ctx->device->queue.queueFamily,
|
||||
(size_t) vulkan_ctx->cmdpool);
|
||||
}
|
||||
|
||||
static void
|
||||
vulkan_vid_render_create_context (void)
|
||||
{
|
||||
vulkan_ctx->create_window (vulkan_ctx);
|
||||
vulkan_ctx->surface = vulkan_ctx->create_surface (vulkan_ctx);
|
||||
Sys_MaskPrintf (SYS_vulkan, "vk create context %#zx\n",
|
||||
(size_t) vulkan_ctx->surface);
|
||||
}
|
||||
|
||||
static void
|
||||
vulkan_vid_render_init (void)
|
||||
{
|
||||
if (!vr_data.vid->vid_internal->vulkan_context) {
|
||||
Sys_Error ("Sorry, Vulkan not supported by this program.");
|
||||
}
|
||||
vulkan_ctx = vr_data.vid->vid_internal->vulkan_context ();
|
||||
vulkan_ctx->load_vulkan (vulkan_ctx);
|
||||
|
||||
Vulkan_Init_Common (vulkan_ctx);
|
||||
|
||||
vr_data.vid->vid_internal->set_palette = set_palette;
|
||||
vr_data.vid->vid_internal->choose_visual = vulkan_vid_render_choose_visual;
|
||||
vr_data.vid->vid_internal->create_context = vulkan_vid_render_create_context;
|
||||
|
||||
vr_funcs = &vulkan_vid_render_funcs;
|
||||
m_funcs = &model_funcs;
|
||||
}
|
||||
|
||||
static void
|
||||
vulkan_vid_render_shutdown (void)
|
||||
{
|
||||
qfv_device_t *device = vulkan_ctx->device;
|
||||
qfv_devfuncs_t *df = device->funcs;
|
||||
VkDevice dev = device->dev;
|
||||
QFV_DeviceWaitIdle (device);
|
||||
df->vkDestroyFence (dev, vulkan_ctx->fence, 0);
|
||||
df->vkDestroyCommandPool (dev, vulkan_ctx->cmdpool, 0);
|
||||
Vulkan_Compose_Shutdown (vulkan_ctx);
|
||||
Vulkan_Lighting_Shutdown (vulkan_ctx);
|
||||
Vulkan_Draw_Shutdown (vulkan_ctx);
|
||||
Vulkan_Bsp_Shutdown (vulkan_ctx);
|
||||
Vulkan_Alias_Shutdown (vulkan_ctx);
|
||||
Mod_ClearAll ();
|
||||
Vulkan_Texture_Shutdown (vulkan_ctx);
|
||||
Vulkan_DestroyFramebuffers (vulkan_ctx);
|
||||
Vulkan_DestroyRenderPass (vulkan_ctx);
|
||||
Vulkan_Shutdown_Common (vulkan_ctx);
|
||||
}
|
||||
|
||||
static general_funcs_t plugin_info_general_funcs = {
|
||||
vulkan_vid_render_init,
|
||||
vulkan_vid_render_shutdown,
|
||||
.shutdown = vulkan_vid_render_shutdown,
|
||||
};
|
||||
|
||||
static general_data_t plugin_info_general_data;
|
||||
|
||||
static plugin_funcs_t plugin_info_funcs = {
|
||||
&plugin_info_general_funcs,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
&vulkan_vid_render_funcs,
|
||||
.general = &plugin_info_general_funcs,
|
||||
.vid_render = &vulkan_vid_render_funcs,
|
||||
};
|
||||
|
||||
static plugin_data_t plugin_info_data = {
|
||||
&plugin_info_general_data,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
&vid_render_data,
|
||||
.general = &plugin_info_general_data,
|
||||
.vid_render = &vid_render_data,
|
||||
};
|
||||
|
||||
static plugin_t plugin_info = {
|
||||
|
|
Loading…
Reference in a new issue