mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-24 12:42:32 +00:00
Clean up about 12000 allocations
Some of them were actual leaks, but tracking memory should be a lot easier now. However, there's a lot of room for optimization of allocations (eg, recylcling of hierarchies. There is now 1 active allocation (according to tracy) when nq exits: Qgetline's string buffer (I think an api change is in order).
This commit is contained in:
parent
929b1f0662
commit
860f48d541
108 changed files with 673 additions and 91 deletions
|
@ -70,6 +70,7 @@ typedef struct gib_method_s {
|
|||
struct gib_method_s *parent;
|
||||
struct gib_class_s *class;
|
||||
void *data;
|
||||
bool own;
|
||||
} gib_method_t;
|
||||
|
||||
typedef int (*gib_message_handler) (gib_object_t *obj, gib_method_t *method,
|
||||
|
|
|
@ -106,7 +106,6 @@ void Mod_LoadAliasModel (model_t *mod, void *buffer,
|
|||
void Mod_LoadSpriteModel (model_t *mod, void *buffer);
|
||||
|
||||
void Skin_Init (void);
|
||||
void Skin_Shutdown (void);
|
||||
void Skin_Free (skin_t *skin);
|
||||
skin_t *Skin_SetColormap (skin_t *skin, int cmap);
|
||||
skin_t *Skin_SetSkin (skin_t *skin, int cmap, const char *skinname);
|
||||
|
|
|
@ -60,10 +60,8 @@ static inline void __qftVkZoneEnd (___tracy_vkctx_scope ***zone)
|
|||
|
||||
#define VA_CTX_COUNT 64
|
||||
|
||||
typedef struct qfv_renderpassset_s
|
||||
DARRAY_TYPE (struct qfv_orenderpass_s *) qfv_renderpassset_t;
|
||||
|
||||
typedef struct vulkan_ctx_s {
|
||||
void (*delete) (struct vulkan_ctx_s *ctx);
|
||||
void (*load_vulkan) (struct vulkan_ctx_s *ctx);
|
||||
void (*unload_vulkan) (struct vulkan_ctx_s *ctx);
|
||||
|
||||
|
@ -108,8 +106,6 @@ typedef struct vulkan_ctx_s {
|
|||
VkCommandPool cmdpool;
|
||||
struct qfv_stagebuf_s *staging;
|
||||
uint32_t curFrame;
|
||||
qfv_renderpassset_t renderPasses;
|
||||
|
||||
|
||||
struct qfv_tex_s *default_black;
|
||||
struct qfv_tex_s *default_white;
|
||||
|
|
|
@ -101,6 +101,7 @@ CD_f (void)
|
|||
VISIBLE int
|
||||
CDAudio_Init (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
Sys_RegisterShutdown (CDAudio_shutdown, 0);
|
||||
|
||||
PI_RegisterPlugins (cd_plugin_list);
|
||||
|
|
|
@ -245,6 +245,7 @@ CL_ModelEffects (entity_t ent, int glow_color, double time)
|
|||
void
|
||||
CL_EntityEffects (entity_t ent, entity_state_t *state, double time)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
transform_t transform = Entity_Transform (ent);
|
||||
vec4f_t position = Transform_GetWorldPosition (transform);
|
||||
if (state->effects & EF_BRIGHTFIELD)
|
||||
|
@ -258,6 +259,7 @@ CL_EntityEffects (entity_t ent, entity_state_t *state, double time)
|
|||
void
|
||||
CL_Effects_Init (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
if (r_funcs->TrailSystem) {
|
||||
cl_tsystem = r_funcs->TrailSystem ();
|
||||
}
|
||||
|
|
|
@ -490,6 +490,7 @@ cl_unbind_f (void)
|
|||
static void
|
||||
CL_Legacy_Init (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
OK_Init ();
|
||||
Cmd_AddCommand ("bind", cl_bind_f, "compatibility wrapper for in_bind");
|
||||
Cmd_AddCommand ("unbind", cl_unbind_f, "compatibility wrapper for in_bind");
|
||||
|
@ -605,6 +606,7 @@ cl_event_handler (const IE_event_t *ie_event, void *unused)
|
|||
void
|
||||
CL_Input_Init (cbuf_t *cbuf)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
cl_event_id = IE_Add_Handler (cl_event_handler, 0);
|
||||
|
||||
for (int i = 0; cl_in_axes[i]; i++) {
|
||||
|
|
|
@ -277,6 +277,7 @@ parse_light (light_t *light, int *style, const plitem_t *entity,
|
|||
void
|
||||
CL_LoadLights (plitem_t *entities, scene_t *scene)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
lightingdata_t *ldata = scene->lights;
|
||||
model_t *model = scene->worldmodel;
|
||||
|
||||
|
|
|
@ -1287,6 +1287,7 @@ particles_style_f (void *data, const cvar_t *cvar)
|
|||
void
|
||||
CL_Particles_Init (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
mtwist_seed (&mt, 0xdeadbeef);
|
||||
cl_psystem = r_funcs->ParticleSystem ();
|
||||
Cvar_Register (&easter_eggs_cvar, easter_eggs_f, 0);
|
||||
|
|
|
@ -278,9 +278,20 @@ cl_create_views (void)
|
|||
clscr_set_canvas_func (centerprint_view, cl_draw_centerprint);
|
||||
}
|
||||
|
||||
static void
|
||||
CL_Shutdown_Screen (void *data)
|
||||
{
|
||||
ECS_DelRegistry (cl_canvas_sys.reg);
|
||||
cl_canvas_sys.reg = 0;
|
||||
}
|
||||
|
||||
void
|
||||
CL_Init_Screen (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
Sys_RegisterShutdown (CL_Shutdown_Screen, 0);
|
||||
Con_Load ("client");
|
||||
|
||||
__auto_type reg = ECS_NewRegistry ("cl screen");
|
||||
Canvas_InitSys (&cl_canvas_sys, reg);
|
||||
if (con_module) {
|
||||
|
|
|
@ -110,6 +110,9 @@ static model_t *cl_spike;
|
|||
|
||||
static vec4f_t beam_rolls[360];
|
||||
|
||||
typedef struct tempent_s DARRAY_TYPE (entity_t) tempent_t;
|
||||
static tempent_t light_entities = DARRAY_STATIC_INIT (32);
|
||||
|
||||
void
|
||||
CL_TEnts_Precache (void)
|
||||
{
|
||||
|
@ -146,9 +149,17 @@ cl_tents_precache (int phase, void *data)
|
|||
CL_TEnts_Precache ();
|
||||
}
|
||||
|
||||
static void
|
||||
cl_tents_shutdown (void *data)
|
||||
{
|
||||
free (light_entities.a);
|
||||
}
|
||||
|
||||
void
|
||||
CL_TEnts_Init (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
Sys_RegisterShutdown (cl_tents_shutdown, 0);
|
||||
QFS_GamedirCallback (cl_tents_precache, 0);
|
||||
for (int i = 0; i < 360; i++) {
|
||||
float ang = i * M_PI / 360;
|
||||
|
@ -159,6 +170,7 @@ CL_TEnts_Init (void)
|
|||
void
|
||||
CL_Init_Entity (entity_t ent)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
renderer_t *renderer = Ent_GetComponent (ent.id, ent.base + scene_renderer, ent.reg);
|
||||
animation_t *animation = Ent_GetComponent (ent.id, ent.base + scene_animation, ent.reg);
|
||||
byte *active = Ent_GetComponent (ent.id, ent.base + scene_active, ent.reg);
|
||||
|
@ -328,9 +340,6 @@ CL_ParseBeam (qmsg_t *net_message, model_t *m, double time, TEntContext_t *ctx)
|
|||
}
|
||||
}
|
||||
|
||||
typedef struct tempent_s DARRAY_TYPE (entity_t) tempent_t;
|
||||
static tempent_t light_entities = DARRAY_STATIC_INIT (32);
|
||||
|
||||
static void
|
||||
free_stale_entities (void)
|
||||
{
|
||||
|
@ -779,6 +788,7 @@ void
|
|||
CL_MuzzleFlash (entity_t ent, vec4f_t position, vec4f_t fv, float zoffset,
|
||||
double time)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
// spawn a new entity so the light doesn't mess with the owner
|
||||
uint32_t light = nullent;
|
||||
if (has_muzzleflash (ent)) {
|
||||
|
|
|
@ -967,6 +967,7 @@ V_NewScene (viewstate_t *viewstate, scene_t *scene)
|
|||
void
|
||||
V_Init (viewstate_t *viewstate)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
Cmd_AddDataCommand ("bf", V_BonusFlash_f, viewstate,
|
||||
"Background flash, used when you pick up an item");
|
||||
Cmd_AddDataCommand ("centerview", V_StartPitchDrift_f, viewstate,
|
||||
|
|
|
@ -58,9 +58,28 @@ worldscene_t cl_world = {
|
|||
.models = DARRAY_STATIC_INIT (32),
|
||||
};
|
||||
|
||||
static void
|
||||
CL_World_Shutdown (void *data)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
if (cl_world.edicts) {
|
||||
PL_Release (cl_world.edicts);
|
||||
}
|
||||
if (cl_world.scene) {
|
||||
if (cl_world.scene->lights) {
|
||||
Light_DestroyLightingData (cl_world.scene->lights);
|
||||
}
|
||||
Scene_DeleteScene (cl_world.scene);
|
||||
}
|
||||
free (cl_world.models.a);
|
||||
free (cl_static_entities.a);
|
||||
}
|
||||
|
||||
void
|
||||
CL_World_Init (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
Sys_RegisterShutdown (CL_World_Shutdown, 0);
|
||||
scene_system_t extra_systems[] = {
|
||||
{ .system = &effect_system,
|
||||
.components = effect_components,
|
||||
|
@ -136,6 +155,7 @@ CL_ParseStatic (qmsg_t *msg, int version)
|
|||
static void
|
||||
map_cfg (const char *mapname, int all)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
char *name = malloc (strlen (mapname) + 4 + 1);
|
||||
cbuf_t *cbuf = Cbuf_New (&id_interp);
|
||||
QFile *f;
|
||||
|
@ -216,6 +236,7 @@ CL_LoadSky (const char *name)
|
|||
void
|
||||
CL_World_NewMap (const char *mapname, const char *skyname)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
model_t *worldmodel = cl_world.models.a[1];
|
||||
cl_world.scene->worldmodel = worldmodel;
|
||||
|
||||
|
|
|
@ -261,6 +261,8 @@ static draw_charbuffer_t *pl_buff;
|
|||
|
||||
static draw_charbuffer_t *spec_buff[4];//0,1 no track, 2 lost track, 3 tracking
|
||||
|
||||
static draw_charbuffer_t *miniammo[4];
|
||||
|
||||
static draw_charbuffer_t *solo_monsters;
|
||||
static draw_charbuffer_t *solo_secrets;
|
||||
static draw_charbuffer_t *solo_time;
|
||||
|
@ -271,6 +273,7 @@ static ecs_system_t sbar_viewsys;
|
|||
static view_t
|
||||
sbar_view (int x, int y, int w, int h, grav_t gravity, view_t parent)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
view_t view = View_New (sbar_viewsys, parent);
|
||||
View_SetPos (view, x, y);
|
||||
View_SetLen (view, w, h);
|
||||
|
@ -2137,6 +2140,7 @@ hud_swap_f (void *data, const cvar_t *cvar)
|
|||
static void
|
||||
set_hud_sbar (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
view_t v;
|
||||
|
||||
if (hud_sbar) {
|
||||
|
@ -2349,6 +2353,7 @@ create_views (view_def_t *view_defs, view_t parent)
|
|||
static void
|
||||
init_sbar_views (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
create_views (sbar_defs, nullview);
|
||||
view_pos_t slen = View_GetLen (hud_canvas_view);
|
||||
view_pos_t hlen = View_GetLen (hud_view);
|
||||
|
@ -2357,9 +2362,9 @@ init_sbar_views (void)
|
|||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
view_t v = View_GetChild (sbar_miniammo, i);
|
||||
draw_charbuffer_t *buffer = Draw_CreateBuffer (3, 1);
|
||||
Draw_ClearBuffer (buffer);
|
||||
sbar_setcomponent (v, canvas_charbuff, &buffer);
|
||||
miniammo[i] = Draw_CreateBuffer (3, 1);
|
||||
Draw_ClearBuffer (miniammo[i]);
|
||||
sbar_setcomponent (v, canvas_charbuff, &miniammo[i]);
|
||||
}
|
||||
|
||||
if (r_data->vid->width > 320) {
|
||||
|
@ -2397,6 +2402,7 @@ init_sbar_views (void)
|
|||
static void
|
||||
init_views (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
hud_stuff_view = sbar_view (0, 48, 152, 16, grav_southwest, hud_canvas_view);
|
||||
hud_time_view = sbar_view (8, 0, 64, 8, grav_northwest, hud_stuff_view);
|
||||
hud_fps_view = sbar_view (80, 0, 80, 8, grav_northwest, hud_stuff_view);
|
||||
|
@ -2449,6 +2455,7 @@ Sbar_GIB_Print_Center_f (void)
|
|||
static void
|
||||
load_pics (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
for (int i = 0; i < 10; i++) {
|
||||
sb_nums[0][i] = r_funcs->Draw_PicFromWad (va (0, "num_%i", i));
|
||||
sb_nums[1][i] = r_funcs->Draw_PicFromWad (va (0, "anum_%i", i));
|
||||
|
@ -2702,9 +2709,48 @@ HUD_CreateCanvas (canvas_system_t canvas_sys)
|
|||
View_SetVisible (hud_canvas_view, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
sbar_shutdown (void *data)
|
||||
{
|
||||
Draw_DestroyBuffer (time_buff);
|
||||
Draw_DestroyBuffer (fps_buff);
|
||||
Draw_DestroyBuffer (ping_buff);
|
||||
Draw_DestroyBuffer (pl_buff);
|
||||
|
||||
for (int i = 0; i < MAX_PLAYERS; i++) {
|
||||
Draw_DestroyBuffer (sb_fph[i]);
|
||||
Draw_DestroyBuffer (sb_time[i]);
|
||||
Draw_DestroyBuffer (sb_frags[i]);
|
||||
Draw_DestroyBuffer (sb_ping[i]);
|
||||
Draw_DestroyBuffer (sb_pl[i]);
|
||||
Draw_DestroyBuffer (sb_uid[i]);
|
||||
Draw_DestroyBuffer (sb_name[i]);
|
||||
|
||||
Draw_DestroyBuffer (sb_team[i]);
|
||||
Draw_DestroyBuffer (sb_team_stats[i]);
|
||||
Draw_DestroyBuffer (sb_team_frags[i]);
|
||||
Draw_DestroyBuffer (sb_team_players[i]);
|
||||
}
|
||||
Draw_DestroyBuffer (sb_spectator);
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
Draw_DestroyBuffer (spec_buff[i]);
|
||||
Draw_DestroyBuffer (miniammo[i]);
|
||||
}
|
||||
|
||||
Draw_DestroyBuffer (solo_monsters);
|
||||
Draw_DestroyBuffer (solo_secrets);
|
||||
Draw_DestroyBuffer (solo_time);
|
||||
Draw_DestroyBuffer (solo_name);
|
||||
|
||||
free (center_string.str);
|
||||
}
|
||||
|
||||
void
|
||||
Sbar_Init (int *stats, float *item_gettime)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
Sys_RegisterShutdown (sbar_shutdown, 0);
|
||||
sbar_stats = stats;
|
||||
sbar_item_gettime = item_gettime;
|
||||
|
||||
|
|
|
@ -176,13 +176,18 @@ ok_get_key (const void *_ok, void *unused)
|
|||
return ok->old_name;
|
||||
}
|
||||
|
||||
static void
|
||||
ok_shutdown (void *data)
|
||||
{
|
||||
Hash_DelTable (old_key_table);
|
||||
}
|
||||
|
||||
void
|
||||
OK_Init (void)
|
||||
{
|
||||
old_keyname_t *ok;
|
||||
|
||||
Sys_RegisterShutdown (ok_shutdown, 0);
|
||||
old_key_table = Hash_NewTable (1021, ok_get_key, 0, 0, 0);
|
||||
for (ok = old_keynames; ok->old_name; ok++)
|
||||
for (old_keyname_t *ok = old_keynames; ok->old_name; ok++)
|
||||
Hash_Add (old_key_table, ok);
|
||||
}
|
||||
|
||||
|
|
|
@ -280,6 +280,7 @@ static imui_style_t current_style;
|
|||
void
|
||||
Con_Debug_Init (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
for (int i = 0; deb_in_axes[i]; i++) {
|
||||
IN_RegisterAxis (deb_in_axes[i]);
|
||||
}
|
||||
|
@ -300,9 +301,11 @@ Con_Debug_Init (void)
|
|||
void
|
||||
Con_Debug_Shutdown (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
IE_Remove_Handler (debug_event_id);
|
||||
|
||||
Scene_DeleteScene (debug_scene);
|
||||
IMUI_DestroyContext (debug_imui);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -698,6 +701,7 @@ system_info (void)
|
|||
void
|
||||
Con_Debug_Draw (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
if (debug_enable_time && Sys_LongTime () - debug_enable_time > 1000) {
|
||||
debug_saved_focus = IE_Get_Focus ();
|
||||
IE_Set_Focus (debug_event_id);
|
||||
|
|
|
@ -109,6 +109,7 @@ Con_shutdown (void *data)
|
|||
VISIBLE void
|
||||
Con_Load (const char *plugin_name)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
Sys_RegisterShutdown (Con_shutdown, 0);
|
||||
|
||||
con_module = PI_LoadPlugin ("console", plugin_name);
|
||||
|
@ -120,6 +121,7 @@ Con_Load (const char *plugin_name)
|
|||
VISIBLE void
|
||||
Con_Init (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
if (con_module) {
|
||||
__auto_type funcs = con_module->functions->console;
|
||||
funcs->init ();
|
||||
|
|
|
@ -118,12 +118,14 @@ static menu_func_t menu_functions[] = {
|
|||
static void
|
||||
run_menu_pre (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
PR_ExecuteProgram (&menu_pr_state, menu_pre);
|
||||
}
|
||||
|
||||
static void
|
||||
run_menu_post (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
PR_ExecuteProgram (&menu_pr_state, menu_post);
|
||||
}
|
||||
|
||||
|
@ -225,6 +227,7 @@ menu_pic (int x, int y, const char *name,
|
|||
static void
|
||||
bi_Menu_Begin (progs_t *pr, void *data)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
int x = P_INT (pr, 0);
|
||||
int y = P_INT (pr, 1);
|
||||
const char *text = P_GSTRING (pr, 2);
|
||||
|
@ -243,30 +246,35 @@ bi_Menu_Begin (progs_t *pr, void *data)
|
|||
static void
|
||||
bi_Menu_FadeScreen (progs_t *pr, void *data)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
menu->fadescreen = P_INT (pr, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
bi_Menu_Draw (progs_t *pr, void *data)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
menu->draw = P_FUNCTION (pr, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
bi_Menu_EnterHook (progs_t *pr, void *data)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
menu->enter_hook = P_FUNCTION (pr, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
bi_Menu_LeaveHook (progs_t *pr, void *data)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
menu->leave_hook = P_FUNCTION (pr, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
bi_Menu_Pic (progs_t *pr, void *data)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
int x = P_INT (pr, 0);
|
||||
int y = P_INT (pr, 1);
|
||||
const char *name = P_GSTRING (pr, 2);
|
||||
|
@ -277,6 +285,7 @@ bi_Menu_Pic (progs_t *pr, void *data)
|
|||
static void
|
||||
bi_Menu_SubPic (progs_t *pr, void *data)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
int x = P_INT (pr, 0);
|
||||
int y = P_INT (pr, 1);
|
||||
const char *name = P_GSTRING (pr, 2);
|
||||
|
@ -291,6 +300,7 @@ bi_Menu_SubPic (progs_t *pr, void *data)
|
|||
static void
|
||||
bi_Menu_CenterPic (progs_t *pr, void *data)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
int x = P_INT (pr, 0);
|
||||
int y = P_INT (pr, 1);
|
||||
const char *name = P_GSTRING (pr, 2);
|
||||
|
@ -305,6 +315,7 @@ bi_Menu_CenterPic (progs_t *pr, void *data)
|
|||
static void
|
||||
bi_Menu_CenterSubPic (progs_t *pr, void *data)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
int x = P_INT (pr, 0);
|
||||
int y = P_INT (pr, 1);
|
||||
const char *name = P_GSTRING (pr, 2);
|
||||
|
@ -323,6 +334,7 @@ bi_Menu_CenterSubPic (progs_t *pr, void *data)
|
|||
static void
|
||||
bi_Menu_Item (progs_t *pr, void *data)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
int x = P_INT (pr, 0);
|
||||
int y = P_INT (pr, 1);
|
||||
const char *text = P_GSTRING (pr, 2);
|
||||
|
@ -342,6 +354,7 @@ bi_Menu_Item (progs_t *pr, void *data)
|
|||
static void
|
||||
bi_Menu_Cursor (progs_t *pr, void *data)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
pr_func_t func = P_FUNCTION (pr, 0);
|
||||
|
||||
menu->cursor = func;
|
||||
|
@ -350,6 +363,7 @@ bi_Menu_Cursor (progs_t *pr, void *data)
|
|||
static void
|
||||
bi_Menu_KeyEvent (progs_t *pr, void *data)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
pr_func_t func = P_FUNCTION (pr, 0);
|
||||
|
||||
menu->keyevent = func;
|
||||
|
@ -358,12 +372,14 @@ bi_Menu_KeyEvent (progs_t *pr, void *data)
|
|||
static void
|
||||
bi_Menu_End (progs_t *pr, void *data)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
menu = menu->parent;
|
||||
}
|
||||
|
||||
static void
|
||||
bi_Menu_TopMenu (progs_t *pr, void *data)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
const char *name = P_GSTRING (pr, 0);
|
||||
|
||||
if (top_menu)
|
||||
|
@ -374,6 +390,7 @@ bi_Menu_TopMenu (progs_t *pr, void *data)
|
|||
static void
|
||||
bi_Menu_SelectMenu (progs_t *pr, void *data)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
const char *name = P_GSTRING (pr, 0);
|
||||
|
||||
menu = 0;
|
||||
|
@ -396,6 +413,7 @@ bi_Menu_SelectMenu (progs_t *pr, void *data)
|
|||
static void
|
||||
bi_Menu_SetQuit (progs_t *pr, void *data)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
pr_func_t func = P_FUNCTION (pr, 0);
|
||||
|
||||
menu_quit = func;
|
||||
|
@ -404,6 +422,7 @@ bi_Menu_SetQuit (progs_t *pr, void *data)
|
|||
static void
|
||||
bi_Menu_Quit (progs_t *pr, void *data)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
if (con_data.quit)
|
||||
con_data.quit ();
|
||||
Sys_Quit ();
|
||||
|
@ -412,6 +431,7 @@ bi_Menu_Quit (progs_t *pr, void *data)
|
|||
static void
|
||||
bi_Menu_GetIndex (progs_t *pr, void *data)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
if (menu) {
|
||||
R_INT (pr) = menu->cur_item;
|
||||
} else {
|
||||
|
@ -422,6 +442,7 @@ bi_Menu_GetIndex (progs_t *pr, void *data)
|
|||
static void
|
||||
bi_Menu_Next (progs_t *pr, void *data)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
menu->cur_item++;
|
||||
menu->cur_item %= menu->num_items;
|
||||
}
|
||||
|
@ -429,6 +450,7 @@ bi_Menu_Next (progs_t *pr, void *data)
|
|||
static void
|
||||
bi_Menu_Prev (progs_t *pr, void *data)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
menu->cur_item += menu->num_items - 1;
|
||||
menu->cur_item %= menu->num_items;
|
||||
}
|
||||
|
@ -436,6 +458,7 @@ bi_Menu_Prev (progs_t *pr, void *data)
|
|||
static void
|
||||
bi_Menu_Enter (progs_t *pr, void *data)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
menu_item_t *item;
|
||||
|
||||
if (!menu)
|
||||
|
@ -466,6 +489,7 @@ bi_Menu_Enter (progs_t *pr, void *data)
|
|||
static void
|
||||
bi_Menu_Leave (progs_t *pr, void *data)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
if (menu) {
|
||||
if (menu->leave_hook) {
|
||||
run_menu_pre ();
|
||||
|
@ -644,6 +668,7 @@ Menu_Init (void)
|
|||
void
|
||||
Menu_Load (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
int size;
|
||||
QFile *file;
|
||||
|
||||
|
|
|
@ -2932,6 +2932,7 @@ exit_program:;
|
|||
VISIBLE void
|
||||
PR_ExecuteProgram (progs_t *pr, pr_func_t fnum)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
Sys_PushSignalHook (signal_hook, pr);
|
||||
Sys_PushErrorHandler (error_handler, pr);
|
||||
|
||||
|
|
|
@ -147,6 +147,7 @@ align_size (int size, int align)
|
|||
VISIBLE void
|
||||
PR_LoadProgsFile (progs_t *pr, QFile *file, int size)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
size_t i;
|
||||
int mem_size;
|
||||
int offset_tweak;
|
||||
|
@ -466,6 +467,7 @@ run_load_funcs (progs_t *pr, int (**load_funcs)(progs_t *))
|
|||
VISIBLE int
|
||||
PR_RunLoadFuncs (progs_t *pr)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
int i;
|
||||
|
||||
memset (&pr->globals, 0, sizeof (pr->globals));
|
||||
|
|
|
@ -1048,6 +1048,7 @@ gib_builtin_shutdown (void *data)
|
|||
void
|
||||
GIB_Builtin_Init (bool sandbox)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
|
||||
if (sandbox)
|
||||
GIB_File_Transform_Path = GIB_File_Transform_Path_Secure;
|
||||
|
|
|
@ -707,6 +707,7 @@ GIB_Classes_Build_Scripted (const char *name, const char *parentname,
|
|||
void
|
||||
GIB_Classes_Init (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
GIB_Class_Create (&Object_class);
|
||||
GIB_Class_Create (&Thread_class);
|
||||
GIB_Class_Create (&ObjectHash_class);
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include "QF/cbuf.h"
|
||||
#include "QF/gib.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "gib_handle.h"
|
||||
|
||||
|
@ -83,9 +84,17 @@ GIB_Handle_Get (unsigned long int num)
|
|||
return gib_handles[num]->data;
|
||||
}
|
||||
|
||||
static void
|
||||
gib_handle_shutdown (void *data)
|
||||
{
|
||||
free (gib_handles);
|
||||
}
|
||||
|
||||
void
|
||||
GIB_Handle_Init (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
Sys_RegisterShutdown (gib_handle_shutdown, 0);
|
||||
gib_handles_size = 256;
|
||||
gib_handles = calloc (gib_handles_size, sizeof (gib_handle_t *));
|
||||
gib_next_handle = 1;
|
||||
|
|
|
@ -102,6 +102,7 @@ GIB_Exec_Override_f (void)
|
|||
VISIBLE void
|
||||
GIB_Init (bool sandbox)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
// Override the exec command with a GIB-aware one
|
||||
if (Cmd_Exists ("exec")) {
|
||||
Cmd_RemoveCommand ("exec");
|
||||
|
|
|
@ -76,5 +76,6 @@ Key_GIB_Bind_Get_f (void)
|
|||
void
|
||||
GIB_Key_Init (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
GIB_Builtin_Add ("bind::get", Key_GIB_Bind_Get_f);
|
||||
}
|
||||
|
|
|
@ -60,12 +60,18 @@ GIB_Class_Get_Key (const void *ele, void *ptr)
|
|||
return ((gib_class_t *) ele)->name;
|
||||
}
|
||||
|
||||
static void GIB_Object_Finish_Destroy (int argc, const char **argv, void *data);
|
||||
static void
|
||||
GIB_Class_Free (void *ele, void *ptr)
|
||||
{
|
||||
gib_class_t *b;
|
||||
qfZoneScoped (true);
|
||||
gib_class_t *b = ele;
|
||||
|
||||
b = (gib_class_t *) ele;
|
||||
const char *dispose = "dispose";
|
||||
GIB_Object_Finish_Destroy (1, &dispose, b->classobj);
|
||||
Hash_DelTable (b->class_methods);
|
||||
Hash_DelTable (b->methods);
|
||||
llist_delete (b->children);
|
||||
free ((void *)b->name);
|
||||
free (b);
|
||||
}
|
||||
|
@ -79,7 +85,11 @@ GIB_Method_Get_Key (const void *ele, void *ptr)
|
|||
static void
|
||||
GIB_Method_Free (void *ele, void *ptr)
|
||||
{
|
||||
// FIXME: Do something here
|
||||
gib_method_t *m = ele;
|
||||
if (m->own) {
|
||||
free ((void *) m->name);
|
||||
}
|
||||
free (m);
|
||||
}
|
||||
|
||||
static const char *
|
||||
|
@ -125,6 +135,7 @@ static hashtab_t *
|
|||
GIB_Method_Build_Hash (gib_class_t *class, hashtab_t *inherited,
|
||||
gib_methodtab_t *methods)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
gib_methodtab_t *m;
|
||||
gib_method_t *method;
|
||||
hashtab_t *new = Hash_NewTable (1024, GIB_Method_Get_Key,
|
||||
|
@ -137,6 +148,7 @@ GIB_Method_Build_Hash (gib_class_t *class, hashtab_t *inherited,
|
|||
method->func = m->func;
|
||||
method->data = m->data;
|
||||
method->class = class;
|
||||
method->own = true;
|
||||
Hash_Add (new, method);
|
||||
}
|
||||
|
||||
|
@ -144,8 +156,12 @@ GIB_Method_Build_Hash (gib_class_t *class, hashtab_t *inherited,
|
|||
void **list, **l;
|
||||
|
||||
for (l = list = Hash_GetList (inherited); *l; l++)
|
||||
if (!Hash_Find (new, GIB_Method_Get_Key (*l, NULL)))
|
||||
Hash_Add (new, *l);
|
||||
if (!Hash_Find (new, GIB_Method_Get_Key (*l, NULL))) {
|
||||
method = malloc (sizeof (gib_method_t));
|
||||
*method = *(gib_method_t *) *l;
|
||||
method->own = false;
|
||||
Hash_Add (new, method);
|
||||
}
|
||||
free (list);
|
||||
}
|
||||
|
||||
|
@ -155,6 +171,7 @@ GIB_Method_Build_Hash (gib_class_t *class, hashtab_t *inherited,
|
|||
void
|
||||
GIB_Class_Create (gib_classdesc_t *desc)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
static const char *init = "init";
|
||||
gib_class_t *parent = NULL, *class = calloc (1, sizeof (gib_class_t));
|
||||
|
||||
|
@ -195,6 +212,7 @@ GIB_Class_Create (gib_classdesc_t *desc)
|
|||
gib_object_t *
|
||||
GIB_Object_Create (const char *classname, bool classobj)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
gib_class_t *temp, *class = Hash_Find (gib_classes, classname);
|
||||
gib_object_t *obj;
|
||||
int i;
|
||||
|
@ -204,7 +222,7 @@ GIB_Object_Create (const char *classname, bool classobj)
|
|||
|
||||
obj = calloc (1, sizeof (gib_object_t));
|
||||
obj->class = class;
|
||||
obj->data = malloc (sizeof (void *) * (class->depth+1));
|
||||
obj->data = calloc (sizeof (void *), (class->depth+1));
|
||||
obj->methods = classobj ? class->class_methods : class->methods;
|
||||
obj->handle = classobj ? 0 : GIB_Handle_New (obj);
|
||||
obj->handstr = strdup (va (0, "%lu", obj->handle));
|
||||
|
@ -234,7 +252,7 @@ GIB_Object_Finish_Destroy (int argc, const char **argv, void *data)
|
|||
gib_class_t *temp;
|
||||
|
||||
for (temp = obj->class, i = obj->class->depth; temp; temp = temp->parent, i--)
|
||||
if (temp->destruct)
|
||||
if (temp->destruct && obj->data[i])
|
||||
temp->destruct (obj->data[i]);
|
||||
free (obj->data);
|
||||
GIB_Handle_Free (obj->handle);
|
||||
|
@ -392,9 +410,20 @@ GIB_Object_Signal_Emit (gib_object_t *sender, int argc, const char **argv)
|
|||
*argv = old;
|
||||
}
|
||||
|
||||
static void
|
||||
gib_object_shutdown (void *data)
|
||||
{
|
||||
if (gib_classes) {
|
||||
Hash_DelTable (gib_classes);
|
||||
gib_classes = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
GIB_Object_Init (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
Sys_RegisterShutdown (gib_object_shutdown, 0);
|
||||
gib_classes = Hash_NewTable (1024, GIB_Class_Get_Key,
|
||||
GIB_Class_Free, 0, 0);
|
||||
|
||||
|
|
|
@ -37,11 +37,13 @@
|
|||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "regex.h"
|
||||
#include "QF/dstring.h"
|
||||
#include "QF/hash.h"
|
||||
#include "gib_regex.h"
|
||||
#include "QF/qtypes.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "regex.h"
|
||||
#include "gib_regex.h"
|
||||
|
||||
hashtab_t *gib_regexs;
|
||||
static char errstr[1024];
|
||||
|
@ -60,9 +62,17 @@ GIB_Regex_Free (void *ele, void *ptr)
|
|||
free (ele);
|
||||
}
|
||||
|
||||
static void
|
||||
gib_regex_shutdown (void *data)
|
||||
{
|
||||
Hash_DelTable (gib_regexs);
|
||||
}
|
||||
|
||||
void
|
||||
GIB_Regex_Init (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
Sys_RegisterShutdown (gib_regex_shutdown, 0);
|
||||
gib_regexs = Hash_NewTable (512, GIB_Regex_Get_Key, GIB_Regex_Free, 0, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -98,9 +98,17 @@ GIB_Thread_Execute (void)
|
|||
llist_iterate (gib_threads, LLIST_ICAST (te_iterator));
|
||||
}
|
||||
|
||||
static void
|
||||
gib_thread_shutdown (void *data)
|
||||
{
|
||||
llist_delete (gib_threads);
|
||||
}
|
||||
|
||||
void
|
||||
GIB_Thread_Init (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
Sys_RegisterShutdown (gib_thread_shutdown, 0);
|
||||
gib_threads = llist_new (GIB_Thread_Free, NULL, NULL);
|
||||
}
|
||||
|
||||
|
@ -168,8 +176,16 @@ GIB_Event_Callback (gib_event_t * event, unsigned int argc, ...)
|
|||
Cbuf_ArgsDelete (args);
|
||||
}
|
||||
|
||||
static void
|
||||
gib_event_shutdown (void *data)
|
||||
{
|
||||
Hash_DelTable (gib_events);
|
||||
}
|
||||
|
||||
void
|
||||
GIB_Event_Init (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
Sys_RegisterShutdown (gib_event_shutdown, 0);
|
||||
gib_events = Hash_NewTable (1024, GIB_Event_Get_Key, GIB_Event_Free, 0, 0);
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "QF/va.h"
|
||||
#include "QF/hash.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "gib_parse.h"
|
||||
#include "gib_vars.h"
|
||||
|
@ -310,9 +311,18 @@ GIB_Var_Hash_New (void)
|
|||
return Hash_NewTable (1024, GIB_Var_Get_Key, GIB_Var_Free, 0, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
gib_var_shutdown (void *data)
|
||||
{
|
||||
Hash_DelTable (gib_domains);
|
||||
Hash_DelTable (gib_globals);
|
||||
}
|
||||
|
||||
void
|
||||
GIB_Var_Init (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
Sys_RegisterShutdown (gib_var_shutdown, 0);
|
||||
gib_globals = Hash_NewTable (1024, GIB_Var_Get_Key, GIB_Var_Free, 0, 0);
|
||||
gib_domains = Hash_NewTable (1024, GIB_Domain_Get_Key,
|
||||
GIB_Domain_Free, 0, 0);
|
||||
|
|
|
@ -60,6 +60,7 @@ axis_free (void *a, void *data)
|
|||
VISIBLE int
|
||||
IN_RegisterAxis (in_axis_t *axis)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
const char *name = axis->name;
|
||||
if (Hash_Find (axis_tab, name)) {
|
||||
return 0;
|
||||
|
|
|
@ -177,6 +177,7 @@ button_release_cmd (void *_b)
|
|||
VISIBLE int
|
||||
IN_RegisterButton (in_button_t *button)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
const char *name = button->name;
|
||||
if (Hash_Find (button_tab, name)) {
|
||||
return 0;
|
||||
|
|
|
@ -518,6 +518,7 @@ IN_SaveConfig (plitem_t *config)
|
|||
void
|
||||
IN_LoadConfig (plitem_t *config)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
plitem_t *input_config = PL_ObjectForKey (config, "input");
|
||||
|
||||
if (input_config) {
|
||||
|
@ -545,6 +546,7 @@ IN_shutdown (void *data)
|
|||
void
|
||||
IN_Init (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
Sys_RegisterShutdown (IN_shutdown, 0);
|
||||
IN_Event_Init ();
|
||||
IN_ButtonInit ();
|
||||
|
|
|
@ -80,6 +80,7 @@ IE_Send_Event (const IE_event_t *event)
|
|||
int
|
||||
IE_Add_Handler (ie_handler_t *event_handler, void *data)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
size_t handle;
|
||||
ie_reghandler_t reg = { event_handler, data };
|
||||
|
||||
|
|
|
@ -233,6 +233,7 @@ IMT_GetButtonBlock (int num_buttons)
|
|||
int
|
||||
IMT_CreateContext (const char *name)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
in_context_t *ctx = DARRAY_OPEN_AT (&in_contexts, in_contexts.size, 1);
|
||||
memset (ctx, 0, sizeof (*ctx));
|
||||
ctx->imt_tail = &ctx->imts;
|
||||
|
|
|
@ -103,6 +103,7 @@ static void Mod_CallbackLoad (void *object, cache_allocator_t allocator);
|
|||
static void
|
||||
mod_shutdown (void *data)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
Mod_ClearAll ();
|
||||
for (size_t i = 0; i < mod_blocks.size; i++) {
|
||||
free (mod_blocks.a[i]);
|
||||
|
@ -114,6 +115,7 @@ mod_shutdown (void *data)
|
|||
VISIBLE void
|
||||
Mod_Init (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
byte *dest;
|
||||
int m, x, y;
|
||||
int mip0size = 16*16, mip1size = 8*8, mip2size = 4*4, mip3size = 2*2;
|
||||
|
@ -146,6 +148,7 @@ Mod_Init (void)
|
|||
VISIBLE void
|
||||
Mod_Init_Cvars (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
Cvar_Register (&gl_subdivide_size_cvar, 0, 0);
|
||||
Cvar_Register (&gl_mesh_cache_cvar, 0, 0);
|
||||
Cvar_Register (&gl_alias_render_tri_cvar, 0, 0);
|
||||
|
@ -155,6 +158,7 @@ Mod_Init_Cvars (void)
|
|||
static void
|
||||
mod_unload_model (size_t ind)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
model_t *mod = mod_known.a[ind];
|
||||
|
||||
//FIXME this seems to be correct but need to double check the behavior
|
||||
|
@ -186,6 +190,7 @@ Mod_ClearAll (void)
|
|||
model_t *
|
||||
Mod_FindName (const char *name)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
size_t i;
|
||||
model_t **mod;
|
||||
|
||||
|
@ -219,6 +224,7 @@ Mod_FindName (const char *name)
|
|||
static model_t *
|
||||
Mod_RealLoadModel (model_t *mod, bool crash, cache_allocator_t allocator)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
uint32_t *buf;
|
||||
|
||||
// load the file
|
||||
|
@ -296,6 +302,7 @@ Mod_RealLoadModel (model_t *mod, bool crash, cache_allocator_t allocator)
|
|||
static model_t *
|
||||
Mod_LoadModel (model_t *mod, bool crash)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
if (!mod->needload) {
|
||||
if (mod->type == mod_alias && !mod->aliashdr) {
|
||||
if (Cache_Check (&mod->cache))
|
||||
|
@ -314,6 +321,7 @@ Mod_LoadModel (model_t *mod, bool crash)
|
|||
static void
|
||||
Mod_CallbackLoad (void *object, cache_allocator_t allocator)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
if (((model_t *)object)->type != mod_alias)
|
||||
Sys_Error ("Mod_CallbackLoad for non-alias model? FIXME!");
|
||||
// FIXME: do we want crash set to true?
|
||||
|
@ -328,6 +336,7 @@ Mod_CallbackLoad (void *object, cache_allocator_t allocator)
|
|||
VISIBLE model_t *
|
||||
Mod_ForName (const char *name, bool crash)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
model_t *mod;
|
||||
|
||||
mod = Mod_FindName (name);
|
||||
|
@ -353,6 +362,7 @@ Mod_TouchModel (const char *name)
|
|||
VISIBLE void
|
||||
Mod_UnloadModel (model_t *model)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
for (size_t i = 0; i < mod_numknown; i++) {
|
||||
if (mod_known.a[i] == model) {
|
||||
mod_unload_model (i);
|
||||
|
@ -363,6 +373,7 @@ Mod_UnloadModel (model_t *model)
|
|||
VISIBLE void
|
||||
Mod_Print (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
size_t i;
|
||||
model_t **mod;
|
||||
|
||||
|
@ -375,6 +386,7 @@ Mod_Print (void)
|
|||
float
|
||||
RadiusFromBounds (const vec3_t mins, const vec3_t maxs)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
int i;
|
||||
vec3_t corner;
|
||||
|
||||
|
|
|
@ -248,17 +248,19 @@ skin_free (void *_sb, void *unused)
|
|||
free (sb);
|
||||
}
|
||||
|
||||
void
|
||||
Skin_Init (void)
|
||||
static void
|
||||
skin_shutdown (void *data)
|
||||
{
|
||||
skin_cache = Hash_NewTable (127, skin_getkey, skin_free, 0, 0);
|
||||
m_funcs->Skin_InitTranslations ();
|
||||
Hash_DelTable (skin_cache);
|
||||
}
|
||||
|
||||
void
|
||||
Skin_Shutdown (void)
|
||||
Skin_Init (void)
|
||||
{
|
||||
Hash_DelTable (skin_cache);
|
||||
qfZoneScoped (true);
|
||||
Sys_RegisterShutdown (skin_shutdown, 0);
|
||||
skin_cache = Hash_NewTable (127, skin_getkey, skin_free, 0, 0);
|
||||
m_funcs->Skin_InitTranslations ();
|
||||
}
|
||||
|
||||
VISIBLE int
|
||||
|
|
|
@ -817,6 +817,7 @@ NET_shutdown (void *data)
|
|||
void
|
||||
NET_Init (cbuf_t *cbuf)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
int i;
|
||||
int controlSocket;
|
||||
qsocket_t *s;
|
||||
|
|
|
@ -521,6 +521,7 @@ NET_Stats_f (void)
|
|||
int
|
||||
Datagram_Init (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
int i;
|
||||
int csock;
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ qsocket_t *loop_server = NULL;
|
|||
__attribute__((pure)) int
|
||||
Loop_Init (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
if (net_is_dedicated)
|
||||
return -1;
|
||||
return 0;
|
||||
|
|
|
@ -160,6 +160,7 @@ NetadrToSockadr (netadr_t *a, AF_address_t *s)
|
|||
static void
|
||||
SockadrToNetadr (AF_address_t *s, netadr_t *a)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
memcpy (&a->ip, &s->s4.sin_addr, ADDR_SIZE);
|
||||
a->port = s->s4.sin_port;
|
||||
a->family = s->s4.sin_family;
|
||||
|
@ -181,6 +182,7 @@ uint32_t *last_iface;
|
|||
static int
|
||||
get_iface_list (int sock)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
#ifdef HAVE_GETIFADDRS
|
||||
struct ifaddrs *ifa_head;
|
||||
struct ifaddrs *ifa;
|
||||
|
@ -227,6 +229,7 @@ no_ifaddrs:
|
|||
int
|
||||
UDP_Init (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
struct hostent *local = 0;
|
||||
char buff[MAXHOSTNAMELEN];
|
||||
netadr_t addr;
|
||||
|
@ -286,9 +289,11 @@ UDP_Init (void)
|
|||
void
|
||||
UDP_Shutdown (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
UDP_Listen (false);
|
||||
|
||||
UDP_CloseSocket (net_controlsocket);
|
||||
free (ifaces);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -312,6 +317,7 @@ UDP_Listen (bool state)
|
|||
int
|
||||
UDP_OpenSocket (int port)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
int newsocket;
|
||||
struct sockaddr_in address;
|
||||
#ifdef _WIN32
|
||||
|
@ -606,20 +612,16 @@ UDP_Write (int socket, byte *buf, int len, netadr_t *to)
|
|||
const char *
|
||||
UDP_AddrToString (netadr_t *addr)
|
||||
{
|
||||
static dstring_t *buffer;
|
||||
|
||||
if (!buffer)
|
||||
buffer = dstring_new ();
|
||||
|
||||
dsprintf (buffer, "%d.%d.%d.%d:%d", addr->ip[0],
|
||||
//FIXME this is used very badly (strcpy)
|
||||
return va (0, "%d.%d.%d.%d:%d", addr->ip[0],
|
||||
addr->ip[1], addr->ip[2], addr->ip[3],
|
||||
ntohs (addr->port));
|
||||
return buffer->str;
|
||||
}
|
||||
|
||||
int
|
||||
UDP_GetSocketAddr (int socket, netadr_t *na)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
unsigned int a;
|
||||
socklen_t addrlen = sizeof (AF_address_t);
|
||||
AF_address_t addr;
|
||||
|
|
|
@ -51,6 +51,7 @@ static struct {
|
|||
int
|
||||
VCR_Init (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
net_drivers[0].Init = VCR_Init;
|
||||
|
||||
net_drivers[0].SearchForHosts = VCR_SearchForHosts;
|
||||
|
|
|
@ -188,6 +188,7 @@ WINS_GetLocalAddress (void)
|
|||
int
|
||||
WINS_Init (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
int i;
|
||||
char buff[MAXHOSTNAMELEN];
|
||||
char *p;
|
||||
|
|
|
@ -37,6 +37,12 @@ Light_CreateLightingData (scene_t *scene)
|
|||
void
|
||||
Light_DestroyLightingData (lightingdata_t *ldata)
|
||||
{
|
||||
if (ldata->sun_pvs) {
|
||||
set_delete (ldata->sun_pvs);
|
||||
}
|
||||
if (ldata->pvs) {
|
||||
set_delete (ldata->pvs);
|
||||
}
|
||||
free (ldata);
|
||||
}
|
||||
|
||||
|
|
|
@ -70,6 +70,7 @@ Font_shutdown (void *data)
|
|||
VISIBLE void
|
||||
Font_Init (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
if (FT_Init_FreeType (&ft)) {
|
||||
Sys_Error ("Could not init FreeType library");
|
||||
}
|
||||
|
|
|
@ -252,6 +252,7 @@ imui_state_getkey (const void *obj, void *data)
|
|||
imui_ctx_t *
|
||||
IMUI_NewContext (canvas_system_t canvas_sys, const char *font, float fontsize)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
imui_ctx_t *ctx = malloc (sizeof (imui_ctx_t));
|
||||
uint32_t canvas = Canvas_New (canvas_sys);
|
||||
*ctx = (imui_ctx_t) {
|
||||
|
|
|
@ -99,6 +99,7 @@ add_entity (uint32_t hent, uint32_t parent, ecs_registry_t *reg)
|
|||
(hierref_t) { nullent, nullindex },
|
||||
reg);
|
||||
h->ent[ref.index] = ECS_NewEntity (reg);
|
||||
h->own[ref.index] = true;
|
||||
Ent_SetComponent (h->ent[ref.index], h->href_comp, reg, &ref);
|
||||
}
|
||||
|
||||
|
|
|
@ -92,6 +92,7 @@ Cbuf_ArgsAdd (cbuf_args_t *args, const char *arg)
|
|||
VISIBLE cbuf_t *
|
||||
Cbuf_New (cbuf_interpreter_t *interp)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
cbuf_t *cbuf = calloc (1, sizeof (cbuf_t));
|
||||
|
||||
cbuf->args = Cbuf_ArgsNew ();
|
||||
|
@ -115,6 +116,7 @@ Cbuf_Delete (cbuf_t *cbuf)
|
|||
VISIBLE void
|
||||
Cbuf_DeleteStack (cbuf_t *stack)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
cbuf_t *next;
|
||||
|
||||
for (; stack; stack = next) {
|
||||
|
@ -175,6 +177,7 @@ Cbuf_AddText (cbuf_t *cbuf, const char *text)
|
|||
VISIBLE void
|
||||
Cbuf_InsertText (cbuf_t *cbuf, const char *text)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
if (cbuf->state == CBUF_STATE_JUNK)
|
||||
cbuf->state = CBUF_STATE_NORMAL;
|
||||
cbuf->interpreter->insert (cbuf, text);
|
||||
|
|
|
@ -161,10 +161,12 @@ cexpr_init_symtab (exprtab_t *symtab, exprctx_t *ctx)
|
|||
{
|
||||
exprsym_t *sym;
|
||||
|
||||
if (!symtab->tab) {
|
||||
symtab->tab = Hash_NewTable (61, expr_getkey, 0, 0, ctx->hashctx);
|
||||
for (sym = symtab->symbols; sym->name; sym++) {
|
||||
Hash_Add (symtab->tab, sym);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VISIBLE exprval_t *
|
||||
|
|
|
@ -516,6 +516,7 @@ Cmd_Help_f (void)
|
|||
static void
|
||||
Cmd_Exec_f (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
char *f;
|
||||
size_t mark;
|
||||
|
||||
|
@ -574,6 +575,7 @@ Cmd_Sleep_f (void)
|
|||
VISIBLE void
|
||||
Cmd_StuffCmds (cbuf_t *cbuf)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
int i, j;
|
||||
dstring_t *build;
|
||||
|
||||
|
|
|
@ -71,7 +71,9 @@ llist_flush (llist_t *list)
|
|||
|
||||
for (node = list->start; node; node = next) {
|
||||
next = node->next;
|
||||
if (list->freedata) {
|
||||
list->freedata (node->data, list->userdata);
|
||||
}
|
||||
free (node);
|
||||
}
|
||||
list->start = list->end = 0;
|
||||
|
|
|
@ -259,6 +259,7 @@ PI_Shutdown (void *data)
|
|||
VISIBLE void
|
||||
PI_Init (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
Sys_RegisterShutdown (PI_Shutdown, 0);
|
||||
|
||||
PI_InitCvars ();
|
||||
|
@ -420,6 +421,7 @@ PI_UnloadPlugin (plugin_t *plugin)
|
|||
VISIBLE void
|
||||
PI_RegisterPlugins (plugin_list_t *plugins)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
while (plugins->name)
|
||||
Hash_Add (registered_plugins, plugins++);
|
||||
}
|
||||
|
|
|
@ -171,6 +171,7 @@ COM_AddParm (const char *parm)
|
|||
void
|
||||
COM_ParseConfig (cbuf_t *cbuf)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
// execute +set as early as possible
|
||||
Cmd_StuffCmds (cbuf);
|
||||
Cbuf_Execute_Sets (cbuf);
|
||||
|
|
|
@ -577,6 +577,7 @@ Qeof (QFile *file)
|
|||
Qgetline
|
||||
|
||||
Dynamic length version of Qgets. Do NOT free the buffer.
|
||||
FIXME memory leak (on shutdown)
|
||||
*/
|
||||
VISIBLE const char *
|
||||
Qgetline (QFile *file)
|
||||
|
|
|
@ -625,6 +625,7 @@ Sys_Error (const char *error, ...)
|
|||
VISIBLE void
|
||||
Sys_RegisterShutdown (void (*func) (void *), void *data)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
shutdown_list_t *p;
|
||||
if (!func)
|
||||
return;
|
||||
|
@ -1125,6 +1126,7 @@ hook_signals (void)
|
|||
VISIBLE void
|
||||
Sys_Init (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
hook_signals ();
|
||||
|
||||
Cvar_Init_Hash ();
|
||||
|
|
|
@ -68,6 +68,13 @@ va_create_context (int buffers)
|
|||
VISIBLE void
|
||||
va_destroy_context (va_ctx_t *ctx)
|
||||
{
|
||||
if (!ctx) {
|
||||
ctx = default_va_ctx;
|
||||
default_va_ctx = 0;
|
||||
if (!ctx) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < ctx->num_strings; i++) {
|
||||
dstring_delete (ctx->strings[i]);
|
||||
}
|
||||
|
|
|
@ -195,8 +195,6 @@ glsl_R_Init (void)
|
|||
void
|
||||
glsl_R_Shutdown (void)
|
||||
{
|
||||
Skin_Shutdown();
|
||||
|
||||
glsl_R_ShutdownParticles ();
|
||||
glsl_Lightmap_Shutdown ();
|
||||
glsl_R_ShutdownBsp ();
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
VISIBLE draw_charbuffer_t *
|
||||
Draw_CreateBuffer (int width, int height)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
size_t size = width * height;
|
||||
draw_charbuffer_t *buffer = malloc (sizeof (draw_charbuffer_t) + size);
|
||||
buffer->width = width;
|
||||
|
|
|
@ -83,6 +83,7 @@ R_shutdown (void *data)
|
|||
VISIBLE void
|
||||
R_LoadModule (vid_internal_t *vid_internal)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
PI_RegisterPlugins (vidrend_plugin_list);
|
||||
Cvar_Register (&vidrend_plugin_cvar, 0, 0);
|
||||
vidrendmodule = PI_LoadPlugin ("vid_render", vidrend_plugin);
|
||||
|
@ -102,6 +103,7 @@ R_LoadModule (vid_internal_t *vid_internal)
|
|||
VISIBLE void
|
||||
R_Init (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
r_funcs->R_Init ();
|
||||
R_ClearEfrags (); //FIXME force link of r_efrag.o for qwaq
|
||||
Fog_Init ();
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
float
|
||||
R_IQMGetLerpedFrames (animation_t *animation, iqm_t *iqm)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
int frame = animation->frame;
|
||||
float time, fullinterval;
|
||||
iqmanim *anim;
|
||||
|
@ -73,6 +74,7 @@ iqmframe_t *
|
|||
R_IQMBlendFrames (const iqm_t *iqm, int frame1, int frame2, float blend,
|
||||
int extra)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
iqmframe_t *frame;
|
||||
int i;
|
||||
|
||||
|
|
|
@ -161,7 +161,6 @@ vulkan_R_LoadSkys (const char *skyname)
|
|||
static void
|
||||
vulkan_R_NewScene (scene_t *scene)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
Vulkan_NewScene (scene, vulkan_ctx);
|
||||
}
|
||||
|
||||
|
@ -478,6 +477,7 @@ set_palette (void *data, const byte *palette)
|
|||
static void
|
||||
vulkan_vid_render_choose_visual (void *data)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
Vulkan_CreateDevice (vulkan_ctx);
|
||||
if (!vulkan_ctx->device) {
|
||||
Sys_Error ("Unable to create Vulkan device.%s",
|
||||
|
@ -497,6 +497,7 @@ vulkan_vid_render_choose_visual (void *data)
|
|||
static void
|
||||
vulkan_vid_render_create_context (void *data)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
vulkan_ctx->create_window (vulkan_ctx);
|
||||
vulkan_ctx->surface = vulkan_ctx->create_surface (vulkan_ctx);
|
||||
Sys_MaskPrintf (SYS_vulkan, "vk create context: surface:%#zx\n",
|
||||
|
@ -534,6 +535,7 @@ static vid_model_funcs_t model_funcs = {
|
|||
static void
|
||||
vulkan_vid_render_init (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
if (!vr_data.vid->vid_internal->vulkan_context) {
|
||||
Sys_Error ("Sorry, Vulkan not supported by this program.");
|
||||
}
|
||||
|
@ -591,6 +593,9 @@ vulkan_vid_render_shutdown (void)
|
|||
df->vkDestroyCommandPool (dev, vulkan_ctx->cmdpool, 0);
|
||||
|
||||
Vulkan_Shutdown_Common (vulkan_ctx);
|
||||
|
||||
vulkan_ctx->delete (vulkan_ctx);
|
||||
vulkan_ctx = 0;
|
||||
}
|
||||
|
||||
vid_render_funcs_t vulkan_vid_render_funcs = {
|
||||
|
|
|
@ -233,6 +233,7 @@ static exprsym_t capture_task_syms[] = {
|
|||
void
|
||||
QFV_Capture_Init (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
QFV_Render_AddTasks (ctx, capture_task_syms);
|
||||
|
||||
qfvPushDebug (ctx, "capture init");
|
||||
|
|
|
@ -54,6 +54,7 @@ static int
|
|||
find_queue_family (qfv_instance_t *instance, VkPhysicalDevice dev,
|
||||
uint32_t flags)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
qfv_instfuncs_t *funcs = instance->funcs;
|
||||
uint32_t numFamilies;
|
||||
VkQueueFamilyProperties *queueFamilies;
|
||||
|
@ -115,6 +116,7 @@ device_extension_enabled (qfv_device_t *device, const char *ext)
|
|||
qfv_device_t *
|
||||
QFV_CreateDevice (vulkan_ctx_t *ctx, const char **extensions)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
uint32_t nlay = 1; // ensure alloca doesn't see 0 and terminated
|
||||
uint32_t next = count_strings (extensions) + 1; // ensure terminated
|
||||
const char **lay = alloca (nlay * sizeof (const char *));
|
||||
|
@ -204,6 +206,7 @@ QFV_CreateDevice (vulkan_ctx_t *ctx, const char **extensions)
|
|||
void
|
||||
QFV_DestroyDevice (qfv_device_t *device)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
device->funcs->vkDestroyDevice (device->dev, 0);
|
||||
del_strset (device->enabled_extensions);
|
||||
free (device);
|
||||
|
|
|
@ -60,6 +60,7 @@ static const char * const debugExtensions[] = {
|
|||
static void
|
||||
get_instance_layers_and_extensions (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
uint32_t i;
|
||||
VkLayerProperties *layers;
|
||||
VkExtensionProperties *extensions;
|
||||
|
@ -158,6 +159,7 @@ debug_callback (VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
|
|||
static void
|
||||
setup_debug_callback (qfv_instance_t *instance)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
VkDebugUtilsMessengerEXT debug_handle;
|
||||
VkDebugUtilsMessengerCreateInfoEXT createInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT,
|
||||
|
@ -204,6 +206,7 @@ QFV_CreateInstance (vulkan_ctx_t *ctx,
|
|||
const char *appName, uint32_t appVersion,
|
||||
const char **layers, const char **extensions)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
VkApplicationInfo appInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO,
|
||||
.pApplicationName = appName,
|
||||
|
@ -324,6 +327,11 @@ QFV_DestroyInstance (qfv_instance_t *instance)
|
|||
del_strset (instance->enabled_extensions);
|
||||
free (instance->devices);
|
||||
free (instance);
|
||||
|
||||
free (instanceLayerProperties);
|
||||
free (instanceLayers);
|
||||
free (instanceExtensionProperties);
|
||||
free (instanceExtensions);
|
||||
}
|
||||
|
||||
VkSampleCountFlagBits
|
||||
|
|
|
@ -157,6 +157,7 @@ static exprsym_t mousepick_task_syms[] = {
|
|||
void
|
||||
QFV_MousePick_Init (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
QFV_Render_AddTasks (ctx, mousepick_task_syms);
|
||||
|
||||
qfvPushDebug (ctx, "mouse pick init");
|
||||
|
|
|
@ -560,6 +560,7 @@ static exprsym_t render_task_syms[] = {
|
|||
void
|
||||
QFV_Render_Init (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
qfv_renderctx_t *rctx = calloc (1, sizeof (*rctx));
|
||||
ctx->render_context = rctx;
|
||||
rctx->size_time = -1000*1000*1000;
|
||||
|
@ -600,6 +601,21 @@ QFV_Render_Init (vulkan_ctx_t *ctx)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
tf_free_syms (void *_sym, void *data)
|
||||
{
|
||||
exprsym_t *sym = _sym;
|
||||
for (exprfunc_t *f = sym->value; f->func; f++) {
|
||||
for (int i = 0; i < f->num_params; i++) {
|
||||
exprenum_t *e = f->param_types[i]->data;
|
||||
if (e && e->symtab->tab) {
|
||||
Hash_DelTable (e->symtab->tab);
|
||||
e->symtab->tab = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
QFV_Render_Shutdown (vulkan_ctx_t *ctx)
|
||||
{
|
||||
|
@ -662,6 +678,7 @@ QFV_Render_Shutdown (vulkan_ctx_t *ctx)
|
|||
delete_memsuper (jinfo->memsuper);
|
||||
}
|
||||
if (rctx->task_functions.tab) {
|
||||
Hash_ForEach (rctx->task_functions.tab, tf_free_syms, 0);
|
||||
Hash_DelTable (rctx->task_functions.tab);
|
||||
}
|
||||
DARRAY_CLEAR (&rctx->external_attachments);
|
||||
|
@ -683,6 +700,7 @@ QFV_Render_Shutdown (vulkan_ctx_t *ctx)
|
|||
void
|
||||
QFV_Render_AddTasks (vulkan_ctx_t *ctx, exprsym_t *task_syms)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
__auto_type rctx = ctx->render_context;
|
||||
exprctx_t ectx = { .hashctx = &rctx->hashctx };
|
||||
for (exprsym_t *sym = task_syms; sym->name; sym++) {
|
||||
|
@ -760,6 +778,7 @@ QFV_GetStep (const exprval_t *param, qfv_job_t *job)
|
|||
qfv_dsmanager_t *
|
||||
QFV_Render_DSManager (vulkan_ctx_t *ctx, const char *setName)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
auto job = ctx->render_context->job;
|
||||
for (uint32_t i = 0; i < job->num_dsmanagers; i++) {
|
||||
auto ds = job->dsmanager[i];
|
||||
|
@ -802,6 +821,7 @@ create_sampler (vulkan_ctx_t *ctx, qfv_samplercreateinfo_t *sampler)
|
|||
VkSampler
|
||||
QFV_Render_Sampler (vulkan_ctx_t *ctx, const char *name)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
auto si = ctx->render_context->samplerinfo;
|
||||
if (!si) {
|
||||
return 0;
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
static qfv_output_t
|
||||
get_output (vulkan_ctx_t *ctx, plitem_t *item)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
qfv_output_t output = {};
|
||||
Vulkan_ConfigOutput (ctx, &output);
|
||||
|
||||
|
@ -74,6 +75,7 @@ get_output (vulkan_ctx_t *ctx, plitem_t *item)
|
|||
void
|
||||
QFV_LoadRenderInfo (vulkan_ctx_t *ctx, const char *name)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
auto rctx = ctx->render_context;
|
||||
auto item = Vulkan_GetConfig (ctx, name);
|
||||
auto output = get_output (ctx, item);
|
||||
|
@ -87,6 +89,7 @@ QFV_LoadRenderInfo (vulkan_ctx_t *ctx, const char *name)
|
|||
void
|
||||
QFV_LoadSamplerInfo (vulkan_ctx_t *ctx, const char *name)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
auto rctx = ctx->render_context;
|
||||
auto item = Vulkan_GetConfig (ctx, name);
|
||||
rctx->samplerinfo = QFV_ParseSamplerInfo (ctx, item, rctx);
|
||||
|
@ -1118,9 +1121,18 @@ create_step_process_objects (uint32_t index, const qfv_stepinfo_t *step,
|
|||
// nothing to create at this stage
|
||||
}
|
||||
|
||||
static void
|
||||
del_objstate (void *_state)
|
||||
{
|
||||
objstate_t *state = _state;
|
||||
Hash_DelTable (state->symtab->tab);
|
||||
free (state->symtab);
|
||||
}
|
||||
|
||||
static void
|
||||
create_objects (vulkan_ctx_t *ctx, objcount_t *counts)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
__auto_type rctx = ctx->render_context;
|
||||
__auto_type jinfo = rctx->jobinfo;
|
||||
|
||||
|
@ -1146,7 +1158,7 @@ create_objects (vulkan_ctx_t *ctx, objcount_t *counts)
|
|||
uint32_t pl_counts[counts->num_renderpasses];
|
||||
|
||||
exprctx_t ectx = { .hashctx = &ctx->script_context->hashctx };
|
||||
objstate_t s = {
|
||||
__attribute__((cleanup (del_objstate))) objstate_t s = {
|
||||
.ptr = {
|
||||
.rpCreate = rpCreate,
|
||||
.attach = attach,
|
||||
|
@ -1229,6 +1241,7 @@ create_objects (vulkan_ctx_t *ctx, objcount_t *counts)
|
|||
void
|
||||
QFV_BuildRender (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
__auto_type rctx = ctx->render_context;
|
||||
|
||||
objcount_t counts = {};
|
||||
|
|
|
@ -64,6 +64,7 @@ scrap_t *
|
|||
QFV_CreateScrap (qfv_device_t *device, const char *name, int size,
|
||||
QFFormat format, qfv_stagebuf_t *stage)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
qfv_devfuncs_t *dfunc = device->funcs;
|
||||
int bpp = 0;
|
||||
VkFormat fmt = VK_FORMAT_UNDEFINED;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
-(void) writeForward;
|
||||
-(void) writeTable;
|
||||
-(void) writeSymtabInit;
|
||||
-(void) writeSymtabShutdown;
|
||||
-(void) writeSymtabEntry;
|
||||
@end
|
||||
|
||||
|
|
|
@ -191,10 +191,18 @@ skip_value(string name)
|
|||
|
||||
-(void) writeSymtabInit
|
||||
{
|
||||
fprintf (output_file, "\tqfMessageL (\"%s_symtab\");\n", [self name]);
|
||||
fprintf (output_file, "\tcexpr_init_symtab (&%s_symtab, context);\n",
|
||||
[self name]);
|
||||
}
|
||||
|
||||
-(void) writeSymtabShutdown
|
||||
{
|
||||
fprintf (output_file, "\tHash_DelTable (%s_symtab.tab);\n",
|
||||
[self name]);
|
||||
fprintf (output_file, "\t%s_symtab.tab = 0;\n", [self name]);
|
||||
}
|
||||
|
||||
-(void) writeSymtabEntry
|
||||
{
|
||||
fprintf (output_file, "\tHash_Add (enum_symtab, &%s_enum);\n",
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
-(void) writeForward;
|
||||
-(void) writeTable;
|
||||
-(void) writeSymtabInit;
|
||||
-(void) writeSymtabShutdown;
|
||||
-(void) writeSymtabEntry;
|
||||
@end
|
||||
|
||||
|
|
|
@ -72,6 +72,10 @@
|
|||
{
|
||||
}
|
||||
|
||||
-(void) writeSymtabShutdown
|
||||
{
|
||||
}
|
||||
|
||||
-(void) writeSymtabEntry
|
||||
{
|
||||
}
|
||||
|
|
|
@ -254,6 +254,7 @@ main(int argc, string *argv)
|
|||
fprintf (output_file, "static void\n");
|
||||
fprintf (output_file, "vkgen_init_symtabs (exprctx_t *context)\n");
|
||||
fprintf (output_file, "{\n");
|
||||
fprintf (output_file, "\tqfZoneScoped (true);\n");
|
||||
for (int i = [output_types count]; i-- > 0; ) {
|
||||
id obj = [output_types objectAtIndex:i];
|
||||
if ([obj name] == "VkStructureType") {
|
||||
|
@ -265,6 +266,22 @@ main(int argc, string *argv)
|
|||
arp_end ();
|
||||
}
|
||||
fprintf (output_file, "}\n");
|
||||
|
||||
fprintf (output_file, "static void\n");
|
||||
fprintf (output_file, "vkgen_shutdown_symtabs (exprctx_t *context)\n");
|
||||
fprintf (output_file, "{\n");
|
||||
fprintf (output_file, "\tqfZoneScoped (true);\n");
|
||||
for (int i = [output_types count]; i-- > 0; ) {
|
||||
id obj = [output_types objectAtIndex:i];
|
||||
if ([obj name] == "VkStructureType") {
|
||||
continue;
|
||||
}
|
||||
arp_start ();
|
||||
[obj writeSymtabShutdown];
|
||||
arp_end ();
|
||||
}
|
||||
fprintf (output_file, "}\n");
|
||||
|
||||
Qclose (output_file);
|
||||
Qclose (header_file);
|
||||
Hash_DelTable (available_types);
|
||||
|
|
|
@ -517,10 +517,24 @@ write_table (Struct *self, PLItem *field_dict, Array *field_defs,
|
|||
return;
|
||||
}
|
||||
|
||||
fprintf (output_file, "\tqfMessageL (\"%s_symtab\");\n", [self outname]);
|
||||
fprintf (output_file, "\tcexpr_init_symtab (&%s_symtab, context);\n",
|
||||
[self outname]);
|
||||
}
|
||||
|
||||
-(void) writeSymtabShutdown
|
||||
{
|
||||
PLItem *field_dict = [parse getObjectForKey:[self outname]];
|
||||
|
||||
if ([parse string] == "skip") {
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf (output_file, "\tHash_DelTable (%s_symtab.tab);\n",
|
||||
[self outname]);
|
||||
fprintf (output_file, "\t%s_symtab.tab = 0;\n", [self outname]);
|
||||
}
|
||||
|
||||
-(void) writeSymtabEntry
|
||||
{
|
||||
if (!write_symtab || [parse string] == "skip") {
|
||||
|
|
|
@ -1172,6 +1172,7 @@ vulkan_frame_count_f (void *data, const cvar_t *cvar)
|
|||
void
|
||||
Vulkan_Init_Cvars (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
int num_syms = 0;
|
||||
for (exprsym_t *sym = VkDebugUtilsMessageSeverityFlagBitsEXT_symbols;
|
||||
sym->name; sym++, num_syms++) {
|
||||
|
@ -1216,6 +1217,7 @@ static exprtab_t builtin_configs = { .symbols = builtin_plist_syms };
|
|||
static void
|
||||
build_configs (scriptctx_t *sctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
int num_plists = 0;
|
||||
for (exprsym_t *sym = builtin_plist_syms; sym->name; sym++) {
|
||||
num_plists++;
|
||||
|
@ -1246,11 +1248,13 @@ delete_configs (void)
|
|||
num_plists++;
|
||||
}
|
||||
free (builtin_plists);
|
||||
Hash_DelTable (builtin_configs.tab);
|
||||
}
|
||||
|
||||
plitem_t *
|
||||
Vulkan_GetConfig (vulkan_ctx_t *ctx, const char *name)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
scriptctx_t *sctx = ctx->script_context;
|
||||
if (!builtin_configs.tab) {
|
||||
build_configs (sctx);
|
||||
|
@ -1283,6 +1287,7 @@ Vulkan_GetConfig (vulkan_ctx_t *ctx, const char *name)
|
|||
|
||||
void Vulkan_Script_Init (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
scriptctx_t *sctx = calloc (1, sizeof (scriptctx_t));
|
||||
sctx->vctx = ctx;
|
||||
ctx->script_context = sctx;
|
||||
|
@ -1295,7 +1300,6 @@ void Vulkan_Script_Init (vulkan_ctx_t *ctx)
|
|||
//create a symtabs shutdown (for thread safety), but this works for now.
|
||||
ectx.hashctx = 0;//&sctx->hashctx;
|
||||
vkgen_init_symtabs (&ectx);
|
||||
cexpr_init_symtab (&qfv_output_t_symtab, &ectx);
|
||||
cexpr_init_symtab (&qfv_renderframeset_t_symtab, &ectx);
|
||||
cexpr_init_symtab (&data_array_symtab, &ectx);
|
||||
|
||||
|
@ -1328,9 +1332,23 @@ void Vulkan_Script_Shutdown (vulkan_ctx_t *ctx)
|
|||
clear_table (&sctx->shaderModules);
|
||||
clear_table (&sctx->descriptorPools);
|
||||
clear_table (&sctx->samplers);
|
||||
clear_table (&sctx->images);
|
||||
clear_table (&sctx->imageViews);
|
||||
clear_table (&sctx->renderpasses);
|
||||
|
||||
delete_configs ();
|
||||
|
||||
exprctx_t ectx = {};
|
||||
vkgen_shutdown_symtabs (&ectx);
|
||||
|
||||
Hash_DelTable (qfv_renderframeset_t_symtab.tab);
|
||||
Hash_DelTable (data_array_symtab.tab);
|
||||
|
||||
free (validation_symtab.symbols);
|
||||
|
||||
Hash_DelTable (enum_symtab);
|
||||
Hash_DelTable (parser_table);
|
||||
|
||||
Hash_DelContext (sctx->hashctx);
|
||||
|
||||
free (sctx);
|
||||
|
@ -1347,6 +1365,7 @@ QFV_CreateSymtab (plitem_t *dict, const char *properties,
|
|||
const char **extra_items, exprsym_t *extra_syms,
|
||||
exprctx_t *ectx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
plitem_t *props = PL_ObjectForKey (dict, properties);
|
||||
int num_keys = PL_D_NumKeys (props);
|
||||
int num_extra = 0;
|
||||
|
@ -1412,6 +1431,7 @@ QFV_DestroySymtab (exprtab_t *tab)
|
|||
struct qfv_jobinfo_s *
|
||||
QFV_ParseJobInfo (vulkan_ctx_t *ctx, plitem_t *item, qfv_renderctx_t *rctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
memsuper_t *memsuper = new_memsuper ();
|
||||
qfv_jobinfo_t *ji = cmemalloc (memsuper, sizeof (qfv_jobinfo_t));
|
||||
*ji = (qfv_jobinfo_t) { .memsuper = memsuper };
|
||||
|
|
|
@ -333,6 +333,7 @@ static exprsym_t alias_task_syms[] = {
|
|||
void
|
||||
Vulkan_Alias_Init (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
qfvPushDebug (ctx, "alias init");
|
||||
QFV_Render_AddTasks (ctx, alias_task_syms);
|
||||
|
||||
|
@ -345,6 +346,7 @@ Vulkan_Alias_Init (vulkan_ctx_t *ctx)
|
|||
void
|
||||
Vulkan_Alias_Setup (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
auto actx = ctx->alias_context;
|
||||
actx->sampler = QFV_Render_Sampler (ctx, "alias_sampler");
|
||||
}
|
||||
|
|
|
@ -85,6 +85,7 @@ typedef struct bsp_push_constants_s {
|
|||
static void
|
||||
add_texture (texture_t *tx, vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
bspctx_t *bctx = ctx->bsp_context;
|
||||
|
||||
vulktex_t *tex = tx->render;
|
||||
|
@ -99,6 +100,7 @@ add_texture (texture_t *tx, vulkan_ctx_t *ctx)
|
|||
static inline void
|
||||
chain_surface (const bsp_face_t *face, bsp_pass_t *pass, const bspctx_t *bctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
int ent_frame = pass->ent_frame;
|
||||
// if the texture has no alt animations, anim_alt holds the sama data
|
||||
// as anim_main
|
||||
|
@ -113,6 +115,7 @@ chain_surface (const bsp_face_t *face, bsp_pass_t *pass, const bspctx_t *bctx)
|
|||
static void
|
||||
register_textures (mod_brush_t *brush, vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
texture_t *tex;
|
||||
|
||||
for (unsigned i = 0; i < brush->numtextures; i++) {
|
||||
|
@ -126,6 +129,7 @@ register_textures (mod_brush_t *brush, vulkan_ctx_t *ctx)
|
|||
static void
|
||||
init_visstate (bspctx_t *bctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
mod_brush_t *brush = &r_refdef.worldmodel->brush;
|
||||
int count = brush->numnodes + brush->modleafs
|
||||
+ brush->numsurfaces;
|
||||
|
@ -166,6 +170,7 @@ clear_pass_face_queues (bsp_pass_t *pass, const bspctx_t *bctx)
|
|||
static void
|
||||
shutdown_pass_draw_queues (bsp_pass_t *pass)
|
||||
{
|
||||
EntQueue_Delete (pass->entqueue);
|
||||
for (int i = 0; i < pass->num_queues; i++) {
|
||||
DARRAY_CLEAR (&pass->draw_queues[i]);
|
||||
}
|
||||
|
@ -203,6 +208,7 @@ setup_pass_draw_queues (bsp_pass_t *pass)
|
|||
static void
|
||||
setup_pass_face_queues (bsp_pass_t *pass, int num_tex, bspctx_t *bctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
pass->face_queue = malloc (sizeof (bsp_instfaceset_t[num_tex]));
|
||||
for (int i = 0; i < num_tex; i++) {
|
||||
pass->face_queue[i] = (bsp_instfaceset_t) DARRAY_STATIC_INIT (128);
|
||||
|
@ -212,6 +218,7 @@ setup_pass_face_queues (bsp_pass_t *pass, int num_tex, bspctx_t *bctx)
|
|||
static void
|
||||
clear_textures (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
bspctx_t *bctx = ctx->bsp_context;
|
||||
|
||||
clear_pass_face_queues (&bctx->main_pass, bctx);
|
||||
|
@ -224,6 +231,7 @@ clear_textures (vulkan_ctx_t *ctx)
|
|||
void
|
||||
Vulkan_RegisterTextures (model_t **models, int num_models, vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
clear_textures (ctx);
|
||||
add_texture (r_notexture_mip, ctx);
|
||||
{
|
||||
|
@ -424,6 +432,7 @@ build_surf_displist (const faceref_t *faceref, buildctx_t *build)
|
|||
void
|
||||
Vulkan_BuildDisplayLists (model_t **models, int num_models, vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
qfv_device_t *device = ctx->device;
|
||||
qfv_devfuncs_t *dfunc = device->funcs;
|
||||
bspctx_t *bctx = ctx->bsp_context;
|
||||
|
@ -649,6 +658,7 @@ Vulkan_BuildDisplayLists (model_t **models, int num_models, vulkan_ctx_t *ctx)
|
|||
static int
|
||||
R_DrawBrushModel (entity_t ent, bsp_pass_t *pass, vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
renderer_t *renderer = Ent_GetComponent (ent.id, ent.base + scene_renderer, ent.reg);
|
||||
model_t *model = renderer->model;
|
||||
bspctx_t *bctx = ctx->bsp_context;
|
||||
|
@ -678,6 +688,7 @@ R_DrawBrushModel (entity_t ent, bsp_pass_t *pass, vulkan_ctx_t *ctx)
|
|||
static inline void
|
||||
visit_leaf (bsp_pass_t *pass, mleaf_t *leaf)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
// since this leaf will be rendered, any entities in the leaf also need
|
||||
// to be rendered (the bsp tree doubles as an entity cull structure)
|
||||
for (auto efrag = leaf->efrags; efrag; efrag = efrag->leafnext) {
|
||||
|
@ -698,6 +709,7 @@ get_side (const bsp_pass_t *pass, const mnode_t *node)
|
|||
static inline void
|
||||
visit_node_bfcull (bsp_pass_t *pass, const mnode_t *node, int side)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
bspctx_t *bctx = pass->bsp_context;
|
||||
int c;
|
||||
|
||||
|
@ -728,6 +740,7 @@ visit_node_bfcull (bsp_pass_t *pass, const mnode_t *node, int side)
|
|||
static inline void
|
||||
visit_node_no_bfcull (bsp_pass_t *pass, const mnode_t *node, int side)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
bspctx_t *bctx = pass->bsp_context;
|
||||
int c;
|
||||
|
||||
|
@ -760,6 +773,7 @@ static void
|
|||
R_VisitWorldNodes (bsp_pass_t *pass, vulkan_ctx_t *ctx,
|
||||
void (*visit_node) (bsp_pass_t *, const mnode_t *, int))
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
const mod_brush_t *brush = pass->brush;
|
||||
typedef struct {
|
||||
int node_id;
|
||||
|
@ -873,6 +887,7 @@ push_shadowconst (uint32_t matrix_base, VkPipelineLayout layout,
|
|||
static void
|
||||
clear_queues (bspctx_t *bctx, bsp_pass_t *pass)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
for (size_t i = 0; i < bctx->registered_textures.size; i++) {
|
||||
DARRAY_RESIZE (&pass->face_queue[i], 0);
|
||||
}
|
||||
|
@ -889,6 +904,7 @@ clear_queues (bspctx_t *bctx, bsp_pass_t *pass)
|
|||
static void
|
||||
queue_faces (bsp_pass_t *pass, const bspctx_t *bctx, bspframe_t *bframe)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
uint32_t base = bframe->index_count;
|
||||
pass->indices = bframe->index_data + bframe->index_count;
|
||||
for (size_t i = 0; i < bctx->registered_textures.size; i++) {
|
||||
|
@ -971,6 +987,7 @@ draw_queue (bsp_pass_t *pass, QFV_BspQueue queue, VkPipelineLayout layout,
|
|||
static void
|
||||
bsp_flush (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
qfv_device_t *device = ctx->device;
|
||||
qfv_devfuncs_t *dfunc = device->funcs;
|
||||
bspctx_t *bctx = ctx->bsp_context;
|
||||
|
@ -1004,6 +1021,7 @@ bsp_flush (vulkan_ctx_t *ctx)
|
|||
static void
|
||||
create_default_skys (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
qfv_device_t *device = ctx->device;
|
||||
qfv_devfuncs_t *dfunc = device->funcs;
|
||||
bspctx_t *bctx = ctx->bsp_context;
|
||||
|
@ -1111,6 +1129,7 @@ create_default_skys (vulkan_ctx_t *ctx)
|
|||
static void
|
||||
create_notexture (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
const char *missing = "Missing";
|
||||
byte data[2][64 * 64 * 4]; // 2 * 64x64 rgba (8x8 chars)
|
||||
tex_t tex[2] = {
|
||||
|
@ -1176,7 +1195,7 @@ create_notexture (vulkan_ctx_t *ctx)
|
|||
static void
|
||||
bsp_reset_queues (const exprval_t **params, exprval_t *result, exprctx_t *ectx)
|
||||
{
|
||||
qfZoneNamed (zone, true);
|
||||
qfZoneScoped (true);
|
||||
auto taskctx = (qfv_taskctx_t *) ectx;
|
||||
auto ctx = taskctx->ctx;
|
||||
auto bctx = ctx->bsp_context;
|
||||
|
@ -1191,7 +1210,7 @@ bsp_reset_queues (const exprval_t **params, exprval_t *result, exprctx_t *ectx)
|
|||
static void
|
||||
bsp_draw_queue (const exprval_t **params, exprval_t *result, exprctx_t *ectx)
|
||||
{
|
||||
qfZoneNamed (zone, true);
|
||||
qfZoneScoped (true);
|
||||
auto taskctx = (qfv_taskctx_t *) ectx;
|
||||
auto ctx = taskctx->ctx;
|
||||
auto device = ctx->device;
|
||||
|
@ -1260,7 +1279,7 @@ bsp_draw_queue (const exprval_t **params, exprval_t *result, exprctx_t *ectx)
|
|||
static void
|
||||
bsp_visit_world (const exprval_t **params, exprval_t *result, exprctx_t *ectx)
|
||||
{
|
||||
qfZoneNamed (zone, true);
|
||||
qfZoneScoped (true);
|
||||
auto taskctx = (qfv_taskctx_t *) ectx;
|
||||
auto ctx = taskctx->ctx;
|
||||
auto bctx = ctx->bsp_context;
|
||||
|
@ -1409,6 +1428,7 @@ static exprsym_t bsp_task_syms[] = {
|
|||
void
|
||||
Vulkan_Bsp_Init (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
QFV_Render_AddTasks (ctx, bsp_task_syms);
|
||||
|
||||
bspctx_t *bctx = calloc (1, sizeof (bspctx_t));
|
||||
|
@ -1424,6 +1444,7 @@ Vulkan_Bsp_Init (vulkan_ctx_t *ctx)
|
|||
void
|
||||
Vulkan_Bsp_Setup (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
qfvPushDebug (ctx, "bsp init");
|
||||
|
||||
auto device = ctx->device;
|
||||
|
@ -1504,20 +1525,23 @@ Vulkan_Bsp_Shutdown (struct vulkan_ctx_s *ctx)
|
|||
qfv_devfuncs_t *dfunc = device->funcs;
|
||||
bspctx_t *bctx = ctx->bsp_context;
|
||||
|
||||
bctx->main_pass.entqueue = 0; // owned by r_ent_queue
|
||||
shutdown_pass_draw_queues (&bctx->main_pass);
|
||||
shutdown_pass_draw_queues (&bctx->shadow_pass);
|
||||
shutdown_pass_draw_queues (&bctx->debug_pass);
|
||||
|
||||
clear_textures (ctx);
|
||||
DARRAY_CLEAR (&bctx->registered_textures);
|
||||
|
||||
free (bctx->faces);
|
||||
free (bctx->poly_indices);
|
||||
free (bctx->models);
|
||||
|
||||
shutdown_pass_instances (&bctx->main_pass, bctx);
|
||||
shutdown_pass_instances (&bctx->shadow_pass, bctx);
|
||||
shutdown_pass_instances (&bctx->debug_pass, bctx);
|
||||
|
||||
DARRAY_CLEAR (&bctx->frames);
|
||||
free (bctx->frames.a);
|
||||
|
||||
QFV_DestroyStagingBuffer (bctx->light_stage);
|
||||
QFV_DestroyScrap (bctx->light_scrap);
|
||||
|
@ -1546,6 +1570,7 @@ Vulkan_Bsp_Shutdown (struct vulkan_ctx_s *ctx)
|
|||
dfunc->vkDestroyImage (device->dev, bctx->default_skybox->image, 0);
|
||||
dfunc->vkFreeMemory (device->dev, bctx->default_skybox->memory, 0);
|
||||
free (bctx->default_skybox);
|
||||
free (bctx);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -110,6 +110,7 @@ static exprsym_t compose_task_syms[] = {
|
|||
void
|
||||
Vulkan_Compose_Init (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
QFV_Render_AddTasks (ctx, compose_task_syms);
|
||||
|
||||
composectx_t *cctx = calloc (1, sizeof (composectx_t));
|
||||
|
@ -119,6 +120,7 @@ Vulkan_Compose_Init (vulkan_ctx_t *ctx)
|
|||
void
|
||||
Vulkan_Compose_Setup (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
qfvPushDebug (ctx, "compose init");
|
||||
|
||||
auto device = ctx->device;
|
||||
|
|
|
@ -473,6 +473,7 @@ pic_free (drawctx_t *dctx, qpic_t *pic)
|
|||
static cachepic_t *
|
||||
new_cachepic (drawctx_t *dctx, const char *name, qpic_t *pic)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
cachepic_t *cp;
|
||||
size_t size = strlen (name) + 1;
|
||||
|
||||
|
@ -685,6 +686,7 @@ Vulkan_Draw_PicFromWad (const char *name, vulkan_ctx_t *ctx)
|
|||
static qpic_t *
|
||||
load_lmp (const char *path, vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
qpic_t *p;
|
||||
if (strlen (path) < 4 || strcmp (path + strlen (path) - 4, ".lmp")
|
||||
|| !(p = (qpic_t *) QFS_LoadFile (QFS_FOpenFile (path), 0))) {
|
||||
|
@ -797,6 +799,7 @@ load_lmp (const char *path, vulkan_ctx_t *ctx)
|
|||
qpic_t *
|
||||
Vulkan_Draw_CachePic (const char *path, bool alpha, vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
cachepic_t *cpic;
|
||||
drawctx_t *dctx = ctx->draw_context;
|
||||
|
||||
|
@ -824,23 +827,36 @@ Vulkan_Draw_Shutdown (vulkan_ctx_t *ctx)
|
|||
|
||||
QFV_DestroyResource (device, &dctx->draw_resource[0]);
|
||||
QFV_DestroyResource (device, &dctx->draw_resource[1]);
|
||||
free (dctx->draw_resource);
|
||||
for (size_t i = 0; i < dctx->fonts.size; i++) {
|
||||
if (dctx->fonts.a[i].resource) {
|
||||
QFV_DestroyResource (device, &dctx->fonts.a[i].resource->resource);
|
||||
free (dctx->fonts.a[i].resource);
|
||||
}
|
||||
}
|
||||
DARRAY_CLEAR (&dctx->fonts);
|
||||
|
||||
for (size_t i = 0; i < dctx->frames.size; i++) {
|
||||
auto dframe = &dctx->frames.a[i];
|
||||
DARRAY_CLEAR (&dframe->quad_batch);
|
||||
DARRAY_CLEAR (&dframe->clip_range);
|
||||
}
|
||||
free (dctx->frames.a);
|
||||
|
||||
Hash_DelTable (dctx->pic_cache);
|
||||
delete_memsuper (dctx->pic_memsuper);
|
||||
delete_memsuper (dctx->string_memsuper);
|
||||
QFV_DestroyScrap (dctx->scrap);
|
||||
QFV_DestroyStagingBuffer (dctx->stage);
|
||||
free (dctx->conchar_inds);
|
||||
free (dctx->crosshair_inds);
|
||||
free (dctx);
|
||||
}
|
||||
|
||||
static void
|
||||
load_conchars (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
drawctx_t *dctx = ctx->draw_context;
|
||||
|
||||
draw_chars = W_GetLumpName ("conchars");
|
||||
|
@ -869,6 +885,7 @@ load_conchars (vulkan_ctx_t *ctx)
|
|||
static void
|
||||
load_crosshairs (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
drawctx_t *dctx = ctx->draw_context;
|
||||
qpic_t *hairpic = Draw_CrosshairPic ();
|
||||
dctx->crosshair = pic_data ("crosshair", hairpic->width,
|
||||
|
@ -890,6 +907,7 @@ load_crosshairs (vulkan_ctx_t *ctx)
|
|||
static void
|
||||
load_white_pic (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
drawctx_t *dctx = ctx->draw_context;
|
||||
byte white_block = 0xfe;
|
||||
|
||||
|
@ -1109,6 +1127,7 @@ static exprsym_t draw_task_syms[] = {
|
|||
void
|
||||
Vulkan_Draw_Init (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
QFV_Render_AddTasks (ctx, draw_task_syms);
|
||||
|
||||
drawctx_t *dctx = calloc (1, sizeof (drawctx_t));
|
||||
|
@ -1118,6 +1137,7 @@ Vulkan_Draw_Init (vulkan_ctx_t *ctx)
|
|||
void
|
||||
Vulkan_Draw_Setup (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
qfvPushDebug (ctx, "draw init");
|
||||
|
||||
auto device = ctx->device;
|
||||
|
|
|
@ -308,6 +308,7 @@ static exprsym_t iqm_task_syms[] = {
|
|||
void
|
||||
Vulkan_IQM_Init (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
qfvPushDebug (ctx, "iqm init");
|
||||
QFV_Render_AddTasks (ctx, iqm_task_syms);
|
||||
|
||||
|
@ -326,6 +327,7 @@ Vulkan_IQM_Init (vulkan_ctx_t *ctx)
|
|||
void
|
||||
Vulkan_IQM_Setup (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
auto ictx = ctx->iqm_context;
|
||||
ictx->sampler = QFV_Render_Sampler (ctx, "alias_sampler");
|
||||
}
|
||||
|
|
|
@ -1464,6 +1464,7 @@ dynlight_size_listener (void *data, const cvar_t *cvar)
|
|||
void
|
||||
Vulkan_Lighting_Init (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
lightingctx_t *lctx = calloc (1, sizeof (lightingctx_t));
|
||||
ctx->lighting_context = lctx;
|
||||
|
||||
|
@ -1491,6 +1492,7 @@ Vulkan_Lighting_Init (vulkan_ctx_t *ctx)
|
|||
static void
|
||||
make_default_map (int size, VkImage default_map, vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
auto device = ctx->device;
|
||||
auto dfunc = device->funcs;
|
||||
|
||||
|
@ -1586,6 +1588,7 @@ write_inds (qfv_packet_t *packet)
|
|||
void
|
||||
Vulkan_Lighting_Setup (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
qfvPushDebug (ctx, "lighting init");
|
||||
|
||||
auto device = ctx->device;
|
||||
|
@ -2001,6 +2004,8 @@ Vulkan_Lighting_Shutdown (vulkan_ctx_t *ctx)
|
|||
qftCVkContextDestroy (lframe->qftVkCtx);
|
||||
}
|
||||
free (lctx->frames.a[0].stage_targets);
|
||||
free (lctx->frames.a[0].id_radius);
|
||||
free (lctx->frames.a[0].positions);
|
||||
DARRAY_CLEAR (&lctx->light_mats);
|
||||
DARRAY_CLEAR (&lctx->light_control);
|
||||
free (lctx->map_images);
|
||||
|
|
|
@ -182,6 +182,7 @@ static exprsym_t matrix_task_syms[] = {
|
|||
void
|
||||
Vulkan_Matrix_Init (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
QFV_Render_AddTasks (ctx, matrix_task_syms);
|
||||
|
||||
matrixctx_t *mctx = calloc (1, sizeof (matrixctx_t));
|
||||
|
@ -191,6 +192,7 @@ Vulkan_Matrix_Init (vulkan_ctx_t *ctx)
|
|||
void
|
||||
Vulkan_Matrix_Setup (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
qfvPushDebug (ctx, "matrix init");
|
||||
qfv_device_t *device = ctx->device;
|
||||
qfv_devfuncs_t *dfunc = device->funcs;
|
||||
|
@ -268,12 +270,16 @@ Vulkan_Matrix_Setup (vulkan_ctx_t *ctx)
|
|||
void
|
||||
Vulkan_Matrix_Shutdown (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
qfvPushDebug (ctx, "matrix shutdown");
|
||||
auto device = ctx->device;
|
||||
auto mctx = ctx->matrix_context;
|
||||
|
||||
QFV_DestroyStagingBuffer (mctx->stage);
|
||||
QFV_DestroyResource (device, mctx->resource);
|
||||
free (mctx->resource);
|
||||
free (mctx->frames.a);
|
||||
free (mctx);
|
||||
|
||||
qfvPopDebug (ctx);
|
||||
}
|
||||
|
|
|
@ -320,6 +320,7 @@ static exprsym_t output_task_syms[] = {
|
|||
void
|
||||
Vulkan_Output_Init (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
outputctx_t *octx = calloc (1, sizeof (outputctx_t));
|
||||
ctx->output_context = octx;
|
||||
|
||||
|
@ -345,6 +346,7 @@ Vulkan_Output_Init (vulkan_ctx_t *ctx)
|
|||
void
|
||||
Vulkan_Output_Setup (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
qfvPushDebug (ctx, "output init");
|
||||
|
||||
auto octx = ctx->output_context;
|
||||
|
|
|
@ -65,6 +65,7 @@ Vulkan_Palette_Update (vulkan_ctx_t *ctx, const byte *palette)
|
|||
void
|
||||
Vulkan_Palette_Init (vulkan_ctx_t *ctx, const byte *palette)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
qfvPushDebug (ctx, "palette init");
|
||||
|
||||
palettectx_t *pctx = calloc (1, sizeof (palettectx_t));
|
||||
|
|
|
@ -427,6 +427,7 @@ static exprsym_t particles_task_syms[] = {
|
|||
void
|
||||
Vulkan_Particles_Init (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
QFV_Render_AddTasks (ctx, particles_task_syms);
|
||||
|
||||
particlectx_t *pctx = calloc (1, sizeof (particlectx_t));
|
||||
|
@ -437,6 +438,7 @@ Vulkan_Particles_Init (vulkan_ctx_t *ctx)
|
|||
void
|
||||
Vulkan_Particles_Setup (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
qfvPushDebug (ctx, "particles init");
|
||||
|
||||
auto device = ctx->device;
|
||||
|
|
|
@ -143,6 +143,7 @@ static exprsym_t debug_planes_task_syms[] = {
|
|||
void
|
||||
Vulkan_Planes_Init (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
qfvPushDebug (ctx, "debug planes init");
|
||||
QFV_Render_AddTasks (ctx, debug_planes_task_syms);
|
||||
|
||||
|
@ -155,6 +156,7 @@ Vulkan_Planes_Init (vulkan_ctx_t *ctx)
|
|||
void
|
||||
Vulkan_Planes_Setup (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
auto device = ctx->device;
|
||||
auto dfunc = device->funcs;
|
||||
auto pctx = ctx->planes_context;
|
||||
|
@ -247,6 +249,7 @@ Vulkan_Planes_Shutdown (vulkan_ctx_t *ctx)
|
|||
auto pctx = ctx->planes_context;
|
||||
|
||||
QFV_DestroyResource (device, pctx->resources);
|
||||
free (pctx->resources);
|
||||
|
||||
free (pctx->frames.a);
|
||||
free (pctx);
|
||||
|
|
|
@ -174,6 +174,7 @@ static exprsym_t scene_task_syms[] = {
|
|||
void
|
||||
Vulkan_Scene_Init (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
QFV_Render_AddTasks (ctx, scene_task_syms);
|
||||
|
||||
scenectx_t *sctx = calloc (1, sizeof (scenectx_t)
|
||||
|
@ -186,6 +187,7 @@ Vulkan_Scene_Init (vulkan_ctx_t *ctx)
|
|||
void
|
||||
Vulkan_Scene_Setup (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
qfvPushDebug (ctx, "scene init");
|
||||
|
||||
auto device = ctx->device;
|
||||
|
@ -263,7 +265,6 @@ Vulkan_Scene_Shutdown (vulkan_ctx_t *ctx)
|
|||
|
||||
dfunc->vkUnmapMemory (device->dev, sctx->entities->memory);
|
||||
QFV_DestroyResource (device, sctx->entities);
|
||||
|
||||
free (sctx->frames.a);
|
||||
free (sctx);
|
||||
qfvPopDebug (ctx);
|
||||
|
@ -272,6 +273,7 @@ Vulkan_Scene_Shutdown (vulkan_ctx_t *ctx)
|
|||
void
|
||||
Vulkan_NewScene (scene_t *scene, vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
auto sctx = ctx->scene_context;
|
||||
sctx->scene = scene;
|
||||
|
||||
|
|
|
@ -214,6 +214,7 @@ static exprsym_t sprite_task_syms[] = {
|
|||
void
|
||||
Vulkan_Sprite_Init (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
qfvPushDebug (ctx, "sprite init");
|
||||
QFV_Render_AddTasks (ctx, sprite_task_syms);
|
||||
|
||||
|
@ -226,6 +227,7 @@ Vulkan_Sprite_Init (vulkan_ctx_t *ctx)
|
|||
void
|
||||
Vulkan_Sprite_Setup (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
auto sctx = ctx->sprite_context;
|
||||
sctx->sampler = QFV_Render_Sampler (ctx, "sprite_sampler");
|
||||
}
|
||||
|
|
|
@ -509,6 +509,7 @@ static tex_t default_magenta_tex = {
|
|||
void
|
||||
Vulkan_Texture_Init (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
texturectx_t *tctx = calloc (1, sizeof (texturectx_t));
|
||||
ctx->texture_context = tctx;
|
||||
}
|
||||
|
@ -516,6 +517,7 @@ Vulkan_Texture_Init (vulkan_ctx_t *ctx)
|
|||
void
|
||||
Vulkan_Texture_Setup (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
qfvPushDebug (ctx, "texture init");
|
||||
|
||||
auto tctx = ctx->texture_context;
|
||||
|
@ -548,6 +550,7 @@ Vulkan_Texture_Shutdown (vulkan_ctx_t *ctx)
|
|||
Vulkan_UnloadTex (ctx, ctx->default_white);
|
||||
Vulkan_UnloadTex (ctx, ctx->default_magenta);
|
||||
Vulkan_UnloadTex (ctx, ctx->default_magenta_array);
|
||||
free (ctx->texture_context);
|
||||
}
|
||||
|
||||
static VkDescriptorImageInfo base_image_info = {
|
||||
|
|
|
@ -206,6 +206,7 @@ static exprsym_t translucent_task_syms[] = {
|
|||
void
|
||||
Vulkan_Translucent_Init (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
QFV_Render_AddTasks (ctx, translucent_task_syms);
|
||||
|
||||
translucentctx_t *tctx = calloc (1, sizeof (translucentctx_t));
|
||||
|
@ -309,6 +310,7 @@ trans_create_resources (vulkan_ctx_t *ctx)
|
|||
void
|
||||
Vulkan_Translucent_Setup (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
qfvPushDebug (ctx, "translucent init");
|
||||
|
||||
auto tctx = ctx->translucent_context;
|
||||
|
|
|
@ -106,6 +106,7 @@ static const char *device_extensions[] = {
|
|||
void
|
||||
Vulkan_Init_Common (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
Sys_MaskPrintf (SYS_vulkan, "Vulkan_Init_Common\n");
|
||||
|
||||
Cvar_Register (&vulkan_frame_width_cvar, 0, 0);
|
||||
|
@ -116,7 +117,6 @@ Vulkan_Init_Common (vulkan_ctx_t *ctx)
|
|||
Vulkan_Script_Init (ctx);
|
||||
ctx->instance = QFV_CreateInstance (ctx, PACKAGE_STRING, 0x000702ff, 0,
|
||||
instance_extensions);//FIXME version
|
||||
DARRAY_INIT (&ctx->renderPasses, 4);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -141,6 +141,7 @@ Vulkan_Shutdown_Common (vulkan_ctx_t *ctx)
|
|||
void
|
||||
Vulkan_CreateDevice (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
ctx->device = QFV_CreateDevice (ctx, device_extensions);
|
||||
|
||||
//FIXME msaa and deferred rendering...
|
||||
|
@ -156,6 +157,7 @@ Vulkan_CreateDevice (vulkan_ctx_t *ctx)
|
|||
void
|
||||
Vulkan_CreateStagingBuffers (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
// FIXME configurable?
|
||||
ctx->staging = QFV_CreateStagingBuffer (ctx->device, "vulkan_ctx",
|
||||
32*1024*1024, ctx->cmdpool);
|
||||
|
@ -164,6 +166,7 @@ Vulkan_CreateStagingBuffers (vulkan_ctx_t *ctx)
|
|||
void
|
||||
Vulkan_CreateSwapchain (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
VkSwapchainKHR old_swapchain = 0;
|
||||
if (ctx->swapchain) {
|
||||
//FIXME this shouldn't be here
|
||||
|
@ -184,6 +187,7 @@ Vulkan_CreateSwapchain (vulkan_ctx_t *ctx)
|
|||
void
|
||||
Vulkan_BeginEntityLabel (vulkan_ctx_t *ctx, VkCommandBuffer cmd, entity_t ent)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
qfv_device_t *device = ctx->device;
|
||||
uint32_t entgen = Ent_Generation (ent.id);
|
||||
uint32_t entind = Ent_Index (ent.id);
|
||||
|
|
|
@ -65,7 +65,7 @@ libs_video_targets_libQFwin_la_DEPENDENCIES= $(win_libs)
|
|||
# X11 software rendering
|
||||
#
|
||||
x11_libs=libs/video/targets/libvid_common.la libs/video/targets/libvid_x11.la
|
||||
libs_video_targets_libQFx11_la_CFLAGS= @PREFER_NON_PIC@ $(X_CFLAGS)
|
||||
libs_video_targets_libQFx11_la_CFLAGS= $(AM_CFLAGS) @PREFER_NON_PIC@ $(X_CFLAGS)
|
||||
libs_video_targets_libQFx11_la_SOURCES= libs/video/targets/vid_x11.c
|
||||
libs_video_targets_libQFx11_la_LDFLAGS= @STATIC@
|
||||
libs_video_targets_libQFx11_la_LIBADD= $(x11_libs)
|
||||
|
|
|
@ -272,6 +272,7 @@ X11_RestoreScreenSaver (void)
|
|||
void
|
||||
X11_OpenDisplay (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
if (!x_disp) {
|
||||
x_disp = XOpenDisplay (NULL);
|
||||
if (!x_disp) {
|
||||
|
@ -322,6 +323,7 @@ X11_CloseDisplay (void)
|
|||
void
|
||||
X11_CreateNullCursor (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
Pixmap cursormask;
|
||||
XGCValues xgc = { };
|
||||
GC gc;
|
||||
|
@ -372,6 +374,7 @@ X11_GetGamma (void)
|
|||
void
|
||||
X11_SetVidMode (int width, int height)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
const char *str = getenv ("MESA_GLX_FX");
|
||||
|
||||
if (vidmode_active)
|
||||
|
@ -504,6 +507,7 @@ X11_Init_Cvars (void)
|
|||
void
|
||||
X11_CreateWindow (int width, int height)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
char *resname;
|
||||
unsigned long mask;
|
||||
XSetWindowAttributes attr;
|
||||
|
|
|
@ -106,6 +106,7 @@ static cvar_t vid_fullscreen_cvar = {
|
|||
void
|
||||
VID_GetWindowSize (int def_w, int def_h)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
int pnum;
|
||||
|
||||
vid_width_cvar.default_value = nva ("%d", def_w);
|
||||
|
@ -363,6 +364,7 @@ VID_shutdown (void *data)
|
|||
VISIBLE void
|
||||
VID_Init (byte *palette, byte *colormap)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
Sys_RegisterShutdown (VID_shutdown, 0);
|
||||
vid_system.init (palette, colormap);
|
||||
}
|
||||
|
|
|
@ -173,19 +173,27 @@ win_vulkan_create_surface (vulkan_ctx_t *ctx)
|
|||
return surface;
|
||||
}
|
||||
|
||||
static void
|
||||
delete_vulkan_context (vulkan_ctx_t *ctx)
|
||||
{
|
||||
va_destroy_context (ctx->va_ctx);
|
||||
}
|
||||
|
||||
vulkan_ctx_t *
|
||||
Win_Vulkan_Context (vid_internal_t *vi)
|
||||
{
|
||||
vulkan_ctx_t *ctx = calloc (1, sizeof (vulkan_ctx_t));
|
||||
ctx->load_vulkan = load_vulkan_library;
|
||||
ctx->unload_vulkan = unload_vulkan_library;
|
||||
ctx->get_presentation_support = win_vulkan_get_presentation_support;
|
||||
ctx->choose_visual = win_vulkan_choose_visual;
|
||||
ctx->create_window = win_vulkan_create_window;
|
||||
ctx->create_surface = win_vulkan_create_surface;
|
||||
ctx->required_extensions = required_extensions;
|
||||
ctx->va_ctx = va_create_context (VA_CTX_COUNT);
|
||||
ctx->twod_scale = 1;
|
||||
*ctx = (vulkan_ctx_t) {
|
||||
.load_vulkan = load_vulkan_library,
|
||||
.unload_vulkan = unload_vulkan_library,
|
||||
.get_presentation_support = win_vulkan_get_presentation_support,
|
||||
.choose_visual = win_vulkan_choose_visual,
|
||||
.create_window = win_vulkan_create_window,
|
||||
.create_surface = win_vulkan_create_surface,
|
||||
.required_extensions = required_extensions,
|
||||
.va_ctx = va_create_context (VA_CTX_COUNT),
|
||||
.twod_scale = 1,
|
||||
};
|
||||
|
||||
vi->ctx = ctx;
|
||||
return ctx;
|
||||
|
|
|
@ -82,6 +82,7 @@ X11_VID_Shutdown (void)
|
|||
static void
|
||||
X11_VID_SetPalette (byte *palette, byte *colormap)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
viddef.colormap8 = colormap;
|
||||
viddef.fullbright = 256 - viddef.colormap8[256 * VID_GRADES];
|
||||
if (vid_internal.set_colormap) {
|
||||
|
@ -106,6 +107,7 @@ X11_VID_SetCursor (bool visible)
|
|||
static void
|
||||
X11_VID_Init (byte *palette, byte *colormap)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
vid_internal.gl_context = X11_GL_Context;
|
||||
vid_internal.sw_context = X11_SW_Context;
|
||||
#ifdef HAVE_VULKAN
|
||||
|
|
|
@ -168,6 +168,7 @@ QFGL_ProcAddress (const char *name, bool crit)
|
|||
static void
|
||||
glx_choose_visual (gl_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
int attrib[] = {
|
||||
GLX_X_RENDERABLE, True,
|
||||
GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
|
||||
|
|
|
@ -466,6 +466,7 @@ x11_sw32_update (sw_ctx_t *ctx, vrect_t *rects)
|
|||
static void
|
||||
x11_choose_visual (sw_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
int pnum, i;
|
||||
XVisualInfo template;
|
||||
int num_visuals;
|
||||
|
|
|
@ -124,6 +124,7 @@ unload_vulkan_library (vulkan_ctx_t *ctx)
|
|||
static void
|
||||
x11_vulkan_init_presentation (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
ctx->presentation = calloc (1, sizeof (vulkan_presentation_t));
|
||||
vulkan_presentation_t *pres = ctx->presentation;
|
||||
qfv_instance_t *instance = ctx->instance;
|
||||
|
@ -153,6 +154,7 @@ x11_vulkan_get_presentation_support (vulkan_ctx_t *ctx,
|
|||
VkPhysicalDevice physicalDevice,
|
||||
uint32_t queueFamilyIndex)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
if (!ctx->presentation) {
|
||||
x11_vulkan_init_presentation (ctx);
|
||||
}
|
||||
|
@ -173,6 +175,7 @@ x11_vulkan_get_presentation_support (vulkan_ctx_t *ctx,
|
|||
static void
|
||||
x11_vulkan_choose_visual (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
vulkan_presentation_t *pres = ctx->presentation;
|
||||
set_iter_t *first = set_first (pres->usable_visuals);
|
||||
if (first) {
|
||||
|
@ -185,6 +188,7 @@ x11_vulkan_choose_visual (vulkan_ctx_t *ctx)
|
|||
static void
|
||||
x11_vulkan_create_window (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
vulkan_presentation_t *pres = ctx->presentation;
|
||||
pres->window = x_win;
|
||||
}
|
||||
|
@ -192,6 +196,7 @@ x11_vulkan_create_window (vulkan_ctx_t *ctx)
|
|||
static VkSurfaceKHR
|
||||
x11_vulkan_create_surface (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
vulkan_presentation_t *pres = ctx->presentation;
|
||||
VkInstance inst = ctx->instance->instance;
|
||||
VkSurfaceKHR surface;
|
||||
|
@ -212,19 +217,33 @@ x11_vulkan_create_surface (vulkan_ctx_t *ctx)
|
|||
return surface;
|
||||
}
|
||||
|
||||
static void
|
||||
delete_vulkan_context (vulkan_ctx_t *ctx)
|
||||
{
|
||||
if (ctx->presentation) {
|
||||
set_delete (ctx->presentation->usable_visuals);
|
||||
free (ctx->presentation);
|
||||
}
|
||||
va_destroy_context (ctx->va_ctx);
|
||||
free (ctx);
|
||||
}
|
||||
|
||||
vulkan_ctx_t *
|
||||
X11_Vulkan_Context (vid_internal_t *vi)
|
||||
{
|
||||
vulkan_ctx_t *ctx = calloc (1, sizeof (vulkan_ctx_t));
|
||||
ctx->load_vulkan = load_vulkan_library;
|
||||
ctx->unload_vulkan = unload_vulkan_library;
|
||||
ctx->get_presentation_support = x11_vulkan_get_presentation_support;
|
||||
ctx->choose_visual = x11_vulkan_choose_visual;
|
||||
ctx->create_window = x11_vulkan_create_window;
|
||||
ctx->create_surface = x11_vulkan_create_surface;
|
||||
ctx->required_extensions = required_extensions;
|
||||
ctx->va_ctx = va_create_context (VA_CTX_COUNT);
|
||||
ctx->twod_scale = 1;
|
||||
vulkan_ctx_t *ctx = malloc (sizeof (vulkan_ctx_t));
|
||||
*ctx = (vulkan_ctx_t) {
|
||||
.delete = delete_vulkan_context,
|
||||
.load_vulkan = load_vulkan_library,
|
||||
.unload_vulkan = unload_vulkan_library,
|
||||
.get_presentation_support = x11_vulkan_get_presentation_support,
|
||||
.choose_visual = x11_vulkan_choose_visual,
|
||||
.create_window = x11_vulkan_create_window,
|
||||
.create_surface = x11_vulkan_create_surface,
|
||||
.required_extensions = required_extensions,
|
||||
.va_ctx = va_create_context (VA_CTX_COUNT),
|
||||
.twod_scale = 1,
|
||||
};
|
||||
|
||||
vi->ctx = ctx;
|
||||
return ctx;
|
||||
|
|
|
@ -104,6 +104,7 @@ typedef struct {
|
|||
} client_static_t;
|
||||
|
||||
extern client_static_t cls;
|
||||
extern struct dstring_s *cl_stuffbuff;
|
||||
|
||||
#define FPD_NO_MACROS 0x0001 // Many clients ignore this, and it isn't used, but let's honor it
|
||||
#define FPD_NO_TIMERS 0x0002 // We never allow timers anyway
|
||||
|
|
|
@ -699,9 +699,17 @@ CL_TimeDemo_f (void)
|
|||
timedemo_data = calloc (timedemo_runs, sizeof (td_stats_t));
|
||||
}
|
||||
|
||||
static void
|
||||
CL_Demo_Shutdown (void *data)
|
||||
{
|
||||
dstring_delete (demoname);
|
||||
}
|
||||
|
||||
void
|
||||
CL_Demo_Init (void)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
Sys_RegisterShutdown (CL_Demo_Shutdown, 0);
|
||||
demoname = dstring_newstr ();
|
||||
demo_timeframes_isactive = 0;
|
||||
demo_timeframes_index = 0;
|
||||
|
|
|
@ -140,6 +140,7 @@ CL_SendMove (usercmd_t *cmd)
|
|||
void
|
||||
CL_Init_Input (cbuf_t *cbuf)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
CL_Input_Init (cbuf);
|
||||
Cmd_AddDataCommand ("impulse", IN_Impulse, 0,
|
||||
"Call a game function or QuakeC function.");
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue