system startup receipts
This commit is contained in:
parent
508c77abfd
commit
04eb118e60
40
src/app.c
40
src/app.c
@ -99,10 +99,11 @@ void app_entry_point(void)
|
|||||||
scratch_end(scratch);
|
scratch_end(scratch);
|
||||||
}
|
}
|
||||||
logf_info("Startup");
|
logf_info("Startup");
|
||||||
console_startup();
|
|
||||||
|
|
||||||
|
/* Startup console */
|
||||||
|
struct console_startup_receipt console_sr = console_startup();
|
||||||
|
|
||||||
/* Startup window & renderer */
|
/* Create window */
|
||||||
struct sys_window window = sys_window_alloc();
|
struct sys_window window = sys_window_alloc();
|
||||||
{
|
{
|
||||||
/* Read window settings from file */
|
/* Read window settings from file */
|
||||||
@ -111,24 +112,25 @@ void app_entry_point(void)
|
|||||||
sys_window_update_settings(&window, &window_settings);
|
sys_window_update_settings(&window, &window_settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer_startup(&window);
|
/* Startup systems */
|
||||||
|
struct renderer_startup_receipt renderer_sr = renderer_startup(&window);
|
||||||
|
struct work_startup_receipt work_sr = work_startup(worker_count);
|
||||||
|
struct resource_startup_receipt resource_sr = resource_startup();
|
||||||
|
struct asset_cache_startup_receipt asset_cache_sr = asset_cache_startup(&work_sr);
|
||||||
|
struct ttf_startup_receipt ttf_sr = ttf_startup();
|
||||||
|
struct font_startup_receipt font_sr = font_startup(&work_sr, &renderer_sr, &asset_cache_sr, &ttf_sr, &resource_sr);
|
||||||
|
struct texture_startup_receipt texture_sr = texture_startup(&work_sr, &renderer_sr, &asset_cache_sr, &resource_sr);
|
||||||
|
struct sheet_startup_receipt sheet_sr = sheet_startup(&work_sr, &asset_cache_sr, &resource_sr);
|
||||||
|
struct mixer_startup_receipt mixer_sr = mixer_startup();
|
||||||
|
struct sound_startup_receipt sound_sr = sound_startup(&work_sr, &asset_cache_sr, &resource_sr);
|
||||||
|
struct draw_startup_receipt draw_sr = draw_startup(&renderer_sr, &font_sr);
|
||||||
|
struct game_startup_receipt game_sr = game_startup(&mixer_sr, &sheet_sr, &sound_sr);
|
||||||
|
struct user_startup_receipt user_sr = user_startup(&work_sr, &renderer_sr, &font_sr, &texture_sr, &draw_sr, &game_sr, &asset_cache_sr, &mixer_sr, &window);
|
||||||
|
struct playback_startup_receipt playback_sr = playback_startup(&mixer_sr);
|
||||||
|
|
||||||
/* Startup subsystems */
|
(UNUSED)console_sr;
|
||||||
resource_startup();
|
(UNUSED)user_sr;
|
||||||
asset_cache_startup();
|
(UNUSED)playback_sr;
|
||||||
ttf_startup();
|
|
||||||
font_startup();
|
|
||||||
texture_startup();
|
|
||||||
sheet_startup();
|
|
||||||
mixer_startup();
|
|
||||||
sound_startup();
|
|
||||||
draw_startup();
|
|
||||||
|
|
||||||
/* Startup threaded systems */
|
|
||||||
work_startup(worker_count);
|
|
||||||
game_startup();
|
|
||||||
user_startup(&window);
|
|
||||||
playback_startup();
|
|
||||||
|
|
||||||
/* Show window */
|
/* Show window */
|
||||||
sys_window_show(&window);
|
sys_window_show(&window);
|
||||||
|
|||||||
@ -35,8 +35,10 @@ GLOBAL struct {
|
|||||||
* Startup
|
* Startup
|
||||||
* ========================== */
|
* ========================== */
|
||||||
|
|
||||||
void asset_cache_startup(void)
|
struct asset_cache_startup_receipt asset_cache_startup(struct work_startup_receipt *work_sr)
|
||||||
{
|
{
|
||||||
|
(UNUSED)work_sr;
|
||||||
|
|
||||||
/* Init lookup */
|
/* Init lookup */
|
||||||
L.lookup_rw_mutex = sys_rw_mutex_alloc();
|
L.lookup_rw_mutex = sys_rw_mutex_alloc();
|
||||||
/* Init store */
|
/* Init store */
|
||||||
@ -46,6 +48,8 @@ void asset_cache_startup(void)
|
|||||||
/* Init debug */
|
/* Init debug */
|
||||||
L.dbg_table_mutex = sys_mutex_alloc();
|
L.dbg_table_mutex = sys_mutex_alloc();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
return (struct asset_cache_startup_receipt) { 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================== *
|
/* ========================== *
|
||||||
|
|||||||
@ -5,6 +5,8 @@
|
|||||||
#include "work.h"
|
#include "work.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
struct work_startup_receipt;
|
||||||
|
|
||||||
enum asset_status {
|
enum asset_status {
|
||||||
ASSET_STATUS_NONE,
|
ASSET_STATUS_NONE,
|
||||||
|
|
||||||
@ -38,7 +40,8 @@ struct asset_cache_store {
|
|||||||
struct sys_rw_mutex *rw_mutex;
|
struct sys_rw_mutex *rw_mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
void asset_cache_startup(void);
|
struct asset_cache_startup_receipt { i32 _; };
|
||||||
|
struct asset_cache_startup_receipt asset_cache_startup(struct work_startup_receipt *work_sr);
|
||||||
|
|
||||||
struct asset *asset_cache_touch(struct string key, u64 hash, b32 *is_first_touch);
|
struct asset *asset_cache_touch(struct string key, u64 hash, b32 *is_first_touch);
|
||||||
|
|
||||||
|
|||||||
@ -15,9 +15,10 @@ INTERNAL void console_log_callback(struct log_event event)
|
|||||||
(UNUSED)event;
|
(UNUSED)event;
|
||||||
}
|
}
|
||||||
|
|
||||||
void console_startup(void)
|
struct console_startup_receipt console_startup(void)
|
||||||
{
|
{
|
||||||
log_register_callback(&console_log_callback);
|
log_register_callback(&console_log_callback);
|
||||||
|
return (struct console_startup_receipt) { 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================== *
|
/* ========================== *
|
||||||
|
|||||||
@ -3,7 +3,8 @@
|
|||||||
|
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
|
|
||||||
void console_startup(void);
|
struct console_startup_receipt { i32 _; };
|
||||||
|
struct console_startup_receipt console_startup(void);
|
||||||
b32 console_process_event(struct sys_event event);
|
b32 console_process_event(struct sys_event event);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
#include "draw.h"
|
#include "draw.h"
|
||||||
#include "renderer.h"
|
#include "renderer.h"
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
#include "texture.h"
|
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
#include "scratch.h"
|
#include "scratch.h"
|
||||||
|
|
||||||
@ -13,8 +12,12 @@ GLOBAL struct {
|
|||||||
* Startup
|
* Startup
|
||||||
* ========================== */
|
* ========================== */
|
||||||
|
|
||||||
void draw_startup(void)
|
struct draw_startup_receipt draw_startup(struct renderer_startup_receipt *renderer_sr,
|
||||||
|
struct font_startup_receipt *font_sr)
|
||||||
{
|
{
|
||||||
|
(UNUSED)renderer_sr;
|
||||||
|
(UNUSED)font_sr;
|
||||||
|
|
||||||
/* Generate solid white texture */
|
/* Generate solid white texture */
|
||||||
{
|
{
|
||||||
struct temp_arena scratch = scratch_begin_no_conflict();
|
struct temp_arena scratch = scratch_begin_no_conflict();
|
||||||
@ -27,6 +30,8 @@ void draw_startup(void)
|
|||||||
L.solid_white = renderer_texture_alloc(image_data);
|
L.solid_white = renderer_texture_alloc(image_data);
|
||||||
scratch_end(scratch);
|
scratch_end(scratch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return (struct draw_startup_receipt) { 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================== *
|
/* ========================== *
|
||||||
|
|||||||
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
struct renderer_canvas;
|
struct renderer_canvas;
|
||||||
struct font;
|
struct font;
|
||||||
|
struct renderer_startup_receipt;
|
||||||
|
struct font_startup_receipt;
|
||||||
|
|
||||||
#define DRAW_TEXTURE_PARAMS(...) ((struct draw_texture_params) { \
|
#define DRAW_TEXTURE_PARAMS(...) ((struct draw_texture_params) { \
|
||||||
.tint = COLOR_WHITE, \
|
.tint = COLOR_WHITE, \
|
||||||
@ -15,7 +17,9 @@ struct draw_texture_params {
|
|||||||
u32 tint;
|
u32 tint;
|
||||||
};
|
};
|
||||||
|
|
||||||
void draw_startup(void);
|
struct draw_startup_receipt { i32 _; };
|
||||||
|
struct draw_startup_receipt draw_startup(struct renderer_startup_receipt *renderer_sr,
|
||||||
|
struct font_startup_receipt *font_sr);
|
||||||
|
|
||||||
void draw_texture_quad(struct renderer_canvas *canvas, struct draw_texture_params params, struct quad quad);
|
void draw_texture_quad(struct renderer_canvas *canvas, struct draw_texture_params params, struct quad quad);
|
||||||
void draw_texture_rect(struct renderer_canvas *canvas, struct draw_texture_params params, struct rect rect);
|
void draw_texture_rect(struct renderer_canvas *canvas, struct draw_texture_params params, struct rect rect);
|
||||||
|
|||||||
15
src/font.c
15
src/font.c
@ -7,6 +7,7 @@
|
|||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
|
#include "renderer.h"
|
||||||
|
|
||||||
#define FONT_CHARS " !\"#$%&\'()-.,*/0123456789:;<=+>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
|
#define FONT_CHARS " !\"#$%&\'()-.,*/0123456789:;<=+>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
|
||||||
#define LOOKUP_TABLE_SIZE (256)
|
#define LOOKUP_TABLE_SIZE (256)
|
||||||
@ -38,10 +39,22 @@ GLOBAL struct {
|
|||||||
* Startup
|
* Startup
|
||||||
* ========================== */
|
* ========================== */
|
||||||
|
|
||||||
void font_startup(void)
|
struct font_startup_receipt font_startup(struct work_startup_receipt *work_sr,
|
||||||
|
struct renderer_startup_receipt *renderer_sr,
|
||||||
|
struct asset_cache_startup_receipt *asset_cache_sr,
|
||||||
|
struct ttf_startup_receipt *ttf_sr,
|
||||||
|
struct resource_startup_receipt *resource_sr)
|
||||||
{
|
{
|
||||||
|
(UNUSED)work_sr;
|
||||||
|
(UNUSED)renderer_sr;
|
||||||
|
(UNUSED)asset_cache_sr;
|
||||||
|
(UNUSED)ttf_sr;
|
||||||
|
(UNUSED)resource_sr;
|
||||||
|
|
||||||
L.params.arena = arena_alloc(GIGABYTE(64));
|
L.params.arena = arena_alloc(GIGABYTE(64));
|
||||||
L.params.mutex = sys_mutex_alloc();
|
L.params.mutex = sys_mutex_alloc();
|
||||||
|
|
||||||
|
return (struct font_startup_receipt) { 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================== *
|
/* ========================== *
|
||||||
|
|||||||
13
src/font.h
13
src/font.h
@ -4,7 +4,13 @@
|
|||||||
#include "texture.h"
|
#include "texture.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
|
||||||
struct asset;
|
struct asset;
|
||||||
|
struct work_startup_receipt;
|
||||||
|
struct renderer_startup_receipt;
|
||||||
|
struct asset_cache_startup_receipt;
|
||||||
|
struct ttf_startup_receipt;
|
||||||
|
struct resource_startup_receipt;
|
||||||
|
|
||||||
struct font_glyph {
|
struct font_glyph {
|
||||||
f32 off_x;
|
f32 off_x;
|
||||||
@ -23,7 +29,12 @@ struct font {
|
|||||||
u16 *lookup;
|
u16 *lookup;
|
||||||
};
|
};
|
||||||
|
|
||||||
void font_startup(void);
|
struct font_startup_receipt { i32 _; };
|
||||||
|
struct font_startup_receipt font_startup(struct work_startup_receipt *work_sr,
|
||||||
|
struct renderer_startup_receipt *renderer_sr,
|
||||||
|
struct asset_cache_startup_receipt *asset_cache_sr,
|
||||||
|
struct ttf_startup_receipt *ttf_sr,
|
||||||
|
struct resource_startup_receipt *resource_sr);
|
||||||
|
|
||||||
struct asset *font_load_asset(struct string path, f32 point_size, b32 help);
|
struct asset *font_load_asset(struct string path, f32 point_size, b32 help);
|
||||||
struct font *font_load_async(struct string path, f32 point_size);
|
struct font *font_load_async(struct string path, f32 point_size);
|
||||||
|
|||||||
11
src/game.c
11
src/game.c
@ -1,5 +1,4 @@
|
|||||||
#include "game.h"
|
#include "game.h"
|
||||||
#include "app.h"
|
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "world.h"
|
#include "world.h"
|
||||||
@ -556,8 +555,14 @@ INTERNAL SYS_THREAD_FUNC_DEF(game_thread_entry_point, arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void game_startup(void)
|
struct game_startup_receipt game_startup(struct mixer_startup_receipt *mixer_sr,
|
||||||
|
struct sheet_startup_receipt *sheet_sr,
|
||||||
|
struct sound_startup_receipt *sound_sr)
|
||||||
{
|
{
|
||||||
|
(UNUSED)mixer_sr;
|
||||||
|
(UNUSED)sheet_sr;
|
||||||
|
(UNUSED)sound_sr;
|
||||||
|
|
||||||
/* Initialize game cmd storage */
|
/* Initialize game cmd storage */
|
||||||
L.game_cmds_mutex = sys_mutex_alloc();
|
L.game_cmds_mutex = sys_mutex_alloc();
|
||||||
L.game_cmds_arena = arena_alloc(GIGABYTE(64));
|
L.game_cmds_arena = arena_alloc(GIGABYTE(64));
|
||||||
@ -572,6 +577,8 @@ void game_startup(void)
|
|||||||
|
|
||||||
L.world.timescale = GAME_TIMESCALE;
|
L.world.timescale = GAME_TIMESCALE;
|
||||||
L.game_thread = sys_thread_init(&game_thread_entry_point, NULL, STR("[P2] Game thread"));
|
L.game_thread = sys_thread_init(&game_thread_entry_point, NULL, STR("[P2] Game thread"));
|
||||||
|
|
||||||
|
return (struct game_startup_receipt) { 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
void game_shutdown(void)
|
void game_shutdown(void)
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
#define GAME_H
|
#define GAME_H
|
||||||
|
|
||||||
struct world;
|
struct world;
|
||||||
|
struct mixer_startup_receipt;
|
||||||
|
struct sheet_startup_receipt;
|
||||||
|
struct sound_startup_receipt;
|
||||||
|
|
||||||
enum game_cmd_kind {
|
enum game_cmd_kind {
|
||||||
GAME_CMD_KIND_NONE,
|
GAME_CMD_KIND_NONE,
|
||||||
@ -27,7 +30,10 @@ struct game_cmd_array {
|
|||||||
u64 count;
|
u64 count;
|
||||||
};
|
};
|
||||||
|
|
||||||
void game_startup(void);
|
struct game_startup_receipt { i32 _; };
|
||||||
|
struct game_startup_receipt game_startup(struct mixer_startup_receipt *mixer_sr,
|
||||||
|
struct sheet_startup_receipt *sheet_sr,
|
||||||
|
struct sound_startup_receipt *sound_sr);
|
||||||
void game_shutdown(void);
|
void game_shutdown(void);
|
||||||
|
|
||||||
void game_get_latest_tick(struct world *dest);
|
void game_get_latest_tick(struct world *dest);
|
||||||
|
|||||||
26
src/log.c
26
src/log.c
@ -1,7 +1,13 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "scratch.h"
|
#include "scratch.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
#include "app.h"
|
#include "atomic.h"
|
||||||
|
|
||||||
|
#if RTC
|
||||||
|
# define ASSERT_INITIALIZED ASSERT(atomic_i32_eval(&L.initialized) == 1)
|
||||||
|
#else
|
||||||
|
# define ASSERT_INITIALIZED
|
||||||
|
#endif
|
||||||
|
|
||||||
struct log_event_callback {
|
struct log_event_callback {
|
||||||
log_event_callback_func *func;
|
log_event_callback_func *func;
|
||||||
@ -14,6 +20,10 @@ struct log_event_callback {
|
|||||||
* ========================== */
|
* ========================== */
|
||||||
|
|
||||||
GLOBAL struct {
|
GLOBAL struct {
|
||||||
|
#if RTC
|
||||||
|
struct atomic_i32 initialized;
|
||||||
|
#endif
|
||||||
|
|
||||||
struct sys_mutex mutex;
|
struct sys_mutex mutex;
|
||||||
struct arena arena;
|
struct arena arena;
|
||||||
log_event_callback_func *callbacks_head;
|
log_event_callback_func *callbacks_head;
|
||||||
@ -52,7 +62,7 @@ GLOBAL READONLY const struct log_level_settings g_log_level_settings[LOG_LEVEL_C
|
|||||||
* Startup
|
* Startup
|
||||||
* ========================== */
|
* ========================== */
|
||||||
|
|
||||||
void log_startup(struct string logfile_path)
|
struct log_startup_receipt log_startup(struct string logfile_path)
|
||||||
{
|
{
|
||||||
L.mutex = sys_mutex_alloc();
|
L.mutex = sys_mutex_alloc();
|
||||||
L.arena = arena_alloc(GIGABYTE(64));
|
L.arena = arena_alloc(GIGABYTE(64));
|
||||||
@ -65,6 +75,12 @@ void log_startup(struct string logfile_path)
|
|||||||
L.file_valid = true;
|
L.file_valid = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if RTC
|
||||||
|
atomic_i32_eval_exchange(&L.initialized, 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return (struct log_startup_receipt) { 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================== *
|
/* ========================== *
|
||||||
@ -73,6 +89,7 @@ void log_startup(struct string logfile_path)
|
|||||||
|
|
||||||
void log_register_callback(log_event_callback_func *func)
|
void log_register_callback(log_event_callback_func *func)
|
||||||
{
|
{
|
||||||
|
ASSERT_INITIALIZED;
|
||||||
sys_mutex_lock(&L.mutex);
|
sys_mutex_lock(&L.mutex);
|
||||||
{
|
{
|
||||||
/* TODO */
|
/* TODO */
|
||||||
@ -88,6 +105,8 @@ void log_register_callback(log_event_callback_func *func)
|
|||||||
INTERNAL void append_to_logfile(struct string msg)
|
INTERNAL void append_to_logfile(struct string msg)
|
||||||
{
|
{
|
||||||
__prof;
|
__prof;
|
||||||
|
ASSERT_INITIALIZED;
|
||||||
|
|
||||||
if (L.file_valid) {
|
if (L.file_valid) {
|
||||||
struct temp_arena scratch = scratch_begin_no_conflict();
|
struct temp_arena scratch = scratch_begin_no_conflict();
|
||||||
struct string msg_line = string_cat(scratch.arena, msg, STR("\n"));
|
struct string msg_line = string_cat(scratch.arena, msg, STR("\n"));
|
||||||
@ -103,6 +122,7 @@ void _log(i32 level, struct string msg)
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
__prof;
|
__prof;
|
||||||
|
ASSERT_INITIALIZED;
|
||||||
|
|
||||||
if (level < 0 || level >= LOG_LEVEL_COUNT) {
|
if (level < 0 || level >= LOG_LEVEL_COUNT) {
|
||||||
sys_panic(STR("Invalid log level"));
|
sys_panic(STR("Invalid log level"));
|
||||||
@ -172,6 +192,7 @@ void _logfv(i32 level, struct string file, u32 line, struct string fmt, va_list
|
|||||||
void _logfv(i32 level, struct string fmt, va_list args)
|
void _logfv(i32 level, struct string fmt, va_list args)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
ASSERT_INITIALIZED;
|
||||||
struct temp_arena scratch = scratch_begin_no_conflict();
|
struct temp_arena scratch = scratch_begin_no_conflict();
|
||||||
struct string msg = string_formatv(scratch.arena, fmt, args);
|
struct string msg = string_formatv(scratch.arena, fmt, args);
|
||||||
#if LOG_INCLUDE_SOURCE_LOCATION
|
#if LOG_INCLUDE_SOURCE_LOCATION
|
||||||
@ -188,6 +209,7 @@ void _logf(i32 level, struct string file, u32 line, struct string fmt, ...)
|
|||||||
void _logf(i32 level, struct string fmt, ...)
|
void _logf(i32 level, struct string fmt, ...)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
ASSERT_INITIALIZED;
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
#if LOG_INCLUDE_SOURCE_LOCATION
|
#if LOG_INCLUDE_SOURCE_LOCATION
|
||||||
|
|||||||
@ -124,7 +124,8 @@ void log_register_callback(log_event_callback_func *func);
|
|||||||
* Function declarations
|
* Function declarations
|
||||||
* ========================== */
|
* ========================== */
|
||||||
|
|
||||||
void log_startup(struct string logfile_path);
|
struct log_startup_receipt { i32 _; };
|
||||||
|
struct log_startup_receipt log_startup(struct string logfile_path);
|
||||||
|
|
||||||
#if LOG_INCLUDE_SOURCE_LOCATION
|
#if LOG_INCLUDE_SOURCE_LOCATION
|
||||||
void _log(i32 level, struct string file, u32 line, struct string msg);
|
void _log(i32 level, struct string file, u32 line, struct string msg);
|
||||||
|
|||||||
@ -3,7 +3,6 @@
|
|||||||
#include "scratch.h"
|
#include "scratch.h"
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
#include "playback.h"
|
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
|
|
||||||
/* TODO: Cap max sounds playing. */
|
/* TODO: Cap max sounds playing. */
|
||||||
@ -71,12 +70,14 @@ GLOBAL struct {
|
|||||||
* Startup
|
* Startup
|
||||||
* ========================== */
|
* ========================== */
|
||||||
|
|
||||||
void mixer_startup(void)
|
struct mixer_startup_receipt mixer_startup(void)
|
||||||
{
|
{
|
||||||
L.track_arena = arena_alloc(GIGABYTE(64));
|
L.track_arena = arena_alloc(GIGABYTE(64));
|
||||||
L.mutex = sys_mutex_alloc();
|
L.mutex = sys_mutex_alloc();
|
||||||
L.listener_pos = V2(0, 0);
|
L.listener_pos = V2(0, 0);
|
||||||
L.listener_dir = V2(0, -1);
|
L.listener_dir = V2(0, -1);
|
||||||
|
|
||||||
|
return (struct mixer_startup_receipt) { 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================== *
|
/* ========================== *
|
||||||
|
|||||||
@ -38,7 +38,8 @@ struct mixed_pcm_f32 {
|
|||||||
f32 *samples;
|
f32 *samples;
|
||||||
};
|
};
|
||||||
|
|
||||||
void mixer_startup(void);
|
struct mixer_startup_receipt { i32 _; };
|
||||||
|
struct mixer_startup_receipt mixer_startup(void);
|
||||||
|
|
||||||
/* Interface */
|
/* Interface */
|
||||||
struct mixer_track_handle mixer_play(struct sound *sound);
|
struct mixer_track_handle mixer_play(struct sound *sound);
|
||||||
|
|||||||
@ -3,7 +3,10 @@
|
|||||||
|
|
||||||
#define PLAYBACK_SAMPLE_RATE 48000
|
#define PLAYBACK_SAMPLE_RATE 48000
|
||||||
|
|
||||||
void playback_startup(void);
|
struct mixer_startup_receipt;
|
||||||
|
|
||||||
|
struct playback_startup_receipt { i32 _; };
|
||||||
|
struct playback_startup_receipt playback_startup(struct mixer_startup_receipt *mixer_sr);
|
||||||
void playback_shutdown(void);
|
void playback_shutdown(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -9,7 +9,6 @@
|
|||||||
#include "scratch.h"
|
#include "scratch.h"
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
#include "mixer.h"
|
#include "mixer.h"
|
||||||
#include "app.h"
|
|
||||||
|
|
||||||
#define COBJMACROS
|
#define COBJMACROS
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
@ -221,10 +220,14 @@ INTERNAL SYS_THREAD_FUNC_DEF(playback_thread_entry_point, arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void playback_startup(void)
|
struct playback_startup_receipt playback_startup(struct mixer_startup_receipt *mixer_sr)
|
||||||
{
|
{
|
||||||
|
(UNUSED)mixer_sr;
|
||||||
|
|
||||||
wasapi_initialize();
|
wasapi_initialize();
|
||||||
L.playback_thread = sys_thread_init(&playback_thread_entry_point, NULL, STR("[P3] Audio thread"));
|
L.playback_thread = sys_thread_init(&playback_thread_entry_point, NULL, STR("[P3] Audio thread"));
|
||||||
|
|
||||||
|
return (struct playback_startup_receipt) { 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
void playback_shutdown(void)
|
void playback_shutdown(void)
|
||||||
|
|||||||
@ -41,7 +41,8 @@ struct texture_shader_vertex {
|
|||||||
* Startup
|
* Startup
|
||||||
* ========================== */
|
* ========================== */
|
||||||
|
|
||||||
void renderer_startup(struct sys_window *window);
|
struct renderer_startup_receipt { i32 _; };
|
||||||
|
struct renderer_startup_receipt renderer_startup(struct sys_window *window);
|
||||||
|
|
||||||
/* ========================== *
|
/* ========================== *
|
||||||
* Canvas
|
* Canvas
|
||||||
|
|||||||
@ -1,10 +1,8 @@
|
|||||||
#include "renderer.h"
|
#include "renderer.h"
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
#include "app.h"
|
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "arena.h"
|
#include "arena.h"
|
||||||
#include "scratch.h"
|
#include "scratch.h"
|
||||||
#include "texture.h"
|
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
#include "inc.h"
|
#include "inc.h"
|
||||||
@ -116,7 +114,6 @@ struct dx11_shader_desc {
|
|||||||
};
|
};
|
||||||
|
|
||||||
GLOBAL struct {
|
GLOBAL struct {
|
||||||
b32 initialized;
|
|
||||||
struct arena arena;
|
struct arena arena;
|
||||||
struct tar_archive shaders_archive; /* Tar archive including shader sources */
|
struct tar_archive shaders_archive; /* Tar archive including shader sources */
|
||||||
|
|
||||||
@ -383,7 +380,7 @@ INTERNAL void shader_init(struct dx11_shader *shader, enum shader_kind kind)
|
|||||||
* Startup
|
* Startup
|
||||||
* ========================== */
|
* ========================== */
|
||||||
|
|
||||||
void renderer_startup(struct sys_window *window)
|
struct renderer_startup_receipt renderer_startup(struct sys_window *window)
|
||||||
{
|
{
|
||||||
__profscope(initializing_d3d11);
|
__profscope(initializing_d3d11);
|
||||||
|
|
||||||
@ -601,8 +598,7 @@ void renderer_startup(struct sys_window *window)
|
|||||||
shader_init(&L.shaders[i], i);
|
shader_init(&L.shaders[i], i);
|
||||||
}
|
}
|
||||||
|
|
||||||
WRITE_BARRIER();
|
return (struct renderer_startup_receipt) { 0 };
|
||||||
L.initialized = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================== *
|
/* ========================== *
|
||||||
|
|||||||
@ -15,7 +15,7 @@ GLOBAL struct {
|
|||||||
} L = { 0 }, DEBUG_LVAR(L_resource);
|
} L = { 0 }, DEBUG_LVAR(L_resource);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void resource_startup(void)
|
struct resource_startup_receipt resource_startup(void)
|
||||||
{
|
{
|
||||||
#if RESOURCES_EMBEDDED
|
#if RESOURCES_EMBEDDED
|
||||||
struct buffer embedded_data = inc_res_tar();
|
struct buffer embedded_data = inc_res_tar();
|
||||||
@ -31,6 +31,8 @@ void resource_startup(void)
|
|||||||
sys_panic(STR("Resource directory \"res\" not found"));
|
sys_panic(STR("Resource directory \"res\" not found"));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
return (struct resource_startup_receipt) { 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
b32 resource_exists(struct string path)
|
b32 resource_exists(struct string path)
|
||||||
|
|||||||
@ -14,8 +14,8 @@ struct resource {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct resource_startup_receipt { i32 _; };
|
||||||
void resource_startup(void);
|
struct resource_startup_receipt resource_startup(void);
|
||||||
b32 resource_exists(struct string path);
|
b32 resource_exists(struct string path);
|
||||||
struct resource resource_open(struct string path);
|
struct resource resource_open(struct string path);
|
||||||
|
|
||||||
|
|||||||
11
src/sheet.c
11
src/sheet.c
@ -7,6 +7,7 @@
|
|||||||
#include "asset_cache.h"
|
#include "asset_cache.h"
|
||||||
#include "ase.h"
|
#include "ase.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include "work.h"
|
||||||
|
|
||||||
struct sheet_task_params {
|
struct sheet_task_params {
|
||||||
struct sheet_task_params *next_free;
|
struct sheet_task_params *next_free;
|
||||||
@ -35,10 +36,18 @@ GLOBAL struct {
|
|||||||
* Startup
|
* Startup
|
||||||
* ========================== */
|
* ========================== */
|
||||||
|
|
||||||
void sheet_startup(void)
|
struct sheet_startup_receipt sheet_startup(struct work_startup_receipt *work_sr,
|
||||||
|
struct asset_cache_startup_receipt *asset_cache_sr,
|
||||||
|
struct resource_startup_receipt *resource_sr)
|
||||||
{
|
{
|
||||||
|
(UNUSED)work_sr;
|
||||||
|
(UNUSED)asset_cache_sr;
|
||||||
|
(UNUSED)resource_sr;
|
||||||
|
|
||||||
L.params.arena = arena_alloc(GIGABYTE(64));
|
L.params.arena = arena_alloc(GIGABYTE(64));
|
||||||
L.params.mutex = sys_mutex_alloc();
|
L.params.mutex = sys_mutex_alloc();
|
||||||
|
|
||||||
|
return (struct sheet_startup_receipt) { 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================== *
|
/* ========================== *
|
||||||
|
|||||||
@ -5,6 +5,9 @@
|
|||||||
|
|
||||||
struct asset;
|
struct asset;
|
||||||
struct sheet_frame;
|
struct sheet_frame;
|
||||||
|
struct work_startup_receipt;
|
||||||
|
struct asset_cache_startup_receipt;
|
||||||
|
struct resource_startup_receipt;
|
||||||
|
|
||||||
struct sheet {
|
struct sheet {
|
||||||
struct v2 image_size;
|
struct v2 image_size;
|
||||||
@ -27,7 +30,10 @@ struct sheet_frame {
|
|||||||
struct clip_rect clip;
|
struct clip_rect clip;
|
||||||
};
|
};
|
||||||
|
|
||||||
void sheet_startup(void);
|
struct sheet_startup_receipt { i32 _; };
|
||||||
|
struct sheet_startup_receipt sheet_startup(struct work_startup_receipt *work_sr,
|
||||||
|
struct asset_cache_startup_receipt *asset_cache_srm,
|
||||||
|
struct resource_startup_receipt *resource_sr);
|
||||||
|
|
||||||
struct asset *sheet_load_asset(struct string path, b32 wait);
|
struct asset *sheet_load_asset(struct string path, b32 wait);
|
||||||
struct sheet *sheet_load_async(struct string path);
|
struct sheet *sheet_load_async(struct string path);
|
||||||
|
|||||||
11
src/sound.c
11
src/sound.c
@ -6,6 +6,7 @@
|
|||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "asset_cache.h"
|
#include "asset_cache.h"
|
||||||
#include "mp3.h"
|
#include "mp3.h"
|
||||||
|
#include "work.h"
|
||||||
|
|
||||||
struct sound_task_params {
|
struct sound_task_params {
|
||||||
struct sound_task_params *next_free;
|
struct sound_task_params *next_free;
|
||||||
@ -34,10 +35,18 @@ GLOBAL struct {
|
|||||||
* Startup
|
* Startup
|
||||||
* ========================== */
|
* ========================== */
|
||||||
|
|
||||||
void sound_startup(void)
|
struct sound_startup_receipt sound_startup(struct work_startup_receipt *work_sr,
|
||||||
|
struct asset_cache_startup_receipt *asset_cache_sr,
|
||||||
|
struct resource_startup_receipt *resource_sr)
|
||||||
{
|
{
|
||||||
|
(UNUSED)work_sr;
|
||||||
|
(UNUSED)asset_cache_sr;
|
||||||
|
(UNUSED)resource_sr;
|
||||||
|
|
||||||
L.params.arena = arena_alloc(GIGABYTE(64));
|
L.params.arena = arena_alloc(GIGABYTE(64));
|
||||||
L.params.mutex = sys_mutex_alloc();
|
L.params.mutex = sys_mutex_alloc();
|
||||||
|
|
||||||
|
return (struct sound_startup_receipt) { 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================== *
|
/* ========================== *
|
||||||
|
|||||||
@ -5,13 +5,19 @@
|
|||||||
#define SOUND_FLAG_STEREO 0x1
|
#define SOUND_FLAG_STEREO 0x1
|
||||||
|
|
||||||
struct asset;
|
struct asset;
|
||||||
|
struct work_startup_receipt;
|
||||||
|
struct asset_cache_startup_receipt;
|
||||||
|
struct resource_startup_receipt;
|
||||||
|
|
||||||
struct sound {
|
struct sound {
|
||||||
u32 flags;
|
u32 flags;
|
||||||
struct pcm pcm;
|
struct pcm pcm;
|
||||||
};
|
};
|
||||||
|
|
||||||
void sound_startup(void);
|
struct sound_startup_receipt { i32 _; };
|
||||||
|
struct sound_startup_receipt sound_startup(struct work_startup_receipt *work_sr,
|
||||||
|
struct asset_cache_startup_receipt *asset_cache_sr,
|
||||||
|
struct resource_startup_receipt *resource_sr);
|
||||||
|
|
||||||
struct asset *sound_load_asset(struct string path, u32 flags, b32 wait);
|
struct asset *sound_load_asset(struct string path, u32 flags, b32 wait);
|
||||||
struct sound *sound_load_async(struct string path, u32 flags);
|
struct sound *sound_load_async(struct string path, u32 flags);
|
||||||
|
|||||||
23
src/tar.c
23
src/tar.c
@ -168,26 +168,3 @@ struct tar_entry *tar_get(const struct tar_archive *archive, struct string name)
|
|||||||
{
|
{
|
||||||
return fixed_dict_get(&archive->lookup, name);
|
return fixed_dict_get(&archive->lookup, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
b32 tar_is_file(const struct tar_archive *archive, struct string name)
|
|
||||||
{
|
|
||||||
struct tar_entry *entry = fixed_dict_get(&archive->file_lookup, name);
|
|
||||||
return entry && !entry->is_dir;
|
|
||||||
}
|
|
||||||
|
|
||||||
b32 tar_is_dir(const struct tar_archive *archive, struct string name)
|
|
||||||
{
|
|
||||||
struct tar_entry *entry = fixed_dict_get(&archive->file_lookup, name);
|
|
||||||
return entry && entry->is_dir;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct buffer *tar_data(const struct tar_archive *archive, struct string name)
|
|
||||||
{
|
|
||||||
struct tar_entry *entry = fixed_dict_get(&archive->file_lookup, name);
|
|
||||||
if (entry) {
|
|
||||||
return entry->data;
|
|
||||||
}
|
|
||||||
return BUFFER(0, 0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
#include "texture.h"
|
#include "texture.h"
|
||||||
#include "arena.h"
|
#include "arena.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "json.h"
|
|
||||||
#include "renderer.h"
|
#include "renderer.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "asset_cache.h"
|
#include "asset_cache.h"
|
||||||
@ -39,10 +38,20 @@ GLOBAL struct {
|
|||||||
* Startup
|
* Startup
|
||||||
* ========================== */
|
* ========================== */
|
||||||
|
|
||||||
void texture_startup(void)
|
struct texture_startup_receipt texture_startup(struct work_startup_receipt *work_sr,
|
||||||
|
struct renderer_startup_receipt *renderer_sr,
|
||||||
|
struct asset_cache_startup_receipt *asset_cache_sr,
|
||||||
|
struct resource_startup_receipt *resource_sr)
|
||||||
{
|
{
|
||||||
|
(UNUSED)work_sr;
|
||||||
|
(UNUSED)renderer_sr;
|
||||||
|
(UNUSED)asset_cache_sr;
|
||||||
|
(UNUSED)resource_sr;
|
||||||
|
|
||||||
L.params.arena = arena_alloc(GIGABYTE(64));
|
L.params.arena = arena_alloc(GIGABYTE(64));
|
||||||
L.params.mutex = sys_mutex_alloc();
|
L.params.mutex = sys_mutex_alloc();
|
||||||
|
|
||||||
|
return (struct texture_startup_receipt) { 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================== *
|
/* ========================== *
|
||||||
|
|||||||
@ -1,11 +1,14 @@
|
|||||||
#ifndef TEXTURE_H
|
#ifndef TEXTURE_H
|
||||||
#define TEXTURE_H
|
#define TEXTURE_H
|
||||||
|
|
||||||
#include "json.h"
|
|
||||||
#include "renderer.h"
|
#include "renderer.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
struct asset;
|
struct asset;
|
||||||
|
struct work_startup_receipt;
|
||||||
|
struct renderer_startup_receipt;
|
||||||
|
struct asset_cache_startup_receipt;
|
||||||
|
struct resource_startup_receipt;
|
||||||
|
|
||||||
struct texture_frame {
|
struct texture_frame {
|
||||||
struct clip_rect clip;
|
struct clip_rect clip;
|
||||||
@ -26,7 +29,11 @@ struct texture {
|
|||||||
struct v2 size;
|
struct v2 size;
|
||||||
};
|
};
|
||||||
|
|
||||||
void texture_startup(void);
|
struct texture_startup_receipt { i32 _; };
|
||||||
|
struct texture_startup_receipt texture_startup(struct work_startup_receipt *work_sr,
|
||||||
|
struct renderer_startup_receipt *renderer_sr,
|
||||||
|
struct asset_cache_startup_receipt *asset_cache_sr,
|
||||||
|
struct resource_startup_receipt *resource_sr);
|
||||||
|
|
||||||
struct asset *texture_load_asset(struct string path, b32 wait);
|
struct asset *texture_load_asset(struct string path, b32 wait);
|
||||||
struct texture *texture_load_async(struct string path);
|
struct texture *texture_load_async(struct string path);
|
||||||
|
|||||||
@ -12,7 +12,8 @@ struct ttf_decode_result {
|
|||||||
struct image_rgba image_data;
|
struct image_rgba image_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
void ttf_startup(void);
|
struct ttf_startup_receipt { i32 _; };
|
||||||
|
struct ttf_startup_receipt ttf_startup(void);
|
||||||
struct ttf_decode_result ttf_decode(struct arena *arena, struct buffer encoded, f32 point_size, struct string cache_chars);
|
struct ttf_decode_result ttf_decode(struct arena *arena, struct buffer encoded, f32 point_size, struct string cache_chars);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -6,7 +6,6 @@
|
|||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
#include "ttf.h"
|
#include "ttf.h"
|
||||||
#include "renderer.h"
|
|
||||||
#include "scratch.h"
|
#include "scratch.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
@ -16,7 +15,6 @@ extern "C"
|
|||||||
#include "arena.h"
|
#include "arena.h"
|
||||||
|
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
#include "texture.h"
|
|
||||||
}
|
}
|
||||||
#pragma warning( pop )
|
#pragma warning( pop )
|
||||||
|
|
||||||
@ -52,7 +50,7 @@ INTERNAL i32 round_up(f32 x)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Call this during font system startup */
|
/* Call this during font system startup */
|
||||||
void ttf_startup(void)
|
struct ttf_startup_receipt ttf_startup(void)
|
||||||
{
|
{
|
||||||
ASSERT(!L.factory);
|
ASSERT(!L.factory);
|
||||||
/* FIXME: I think IDWriteFactory5 only exists on later updates of windows
|
/* FIXME: I think IDWriteFactory5 only exists on later updates of windows
|
||||||
@ -70,6 +68,8 @@ void ttf_startup(void)
|
|||||||
if (error) {
|
if (error) {
|
||||||
sys_panic(STR("Error creating DWrite factory"));
|
sys_panic(STR("Error creating DWrite factory"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return (struct ttf_startup_receipt) { 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ttf_decode_result ttf_decode(struct arena *arena, struct buffer encoded, f32 point_size, struct string cache_chars)
|
struct ttf_decode_result ttf_decode(struct arena *arena, struct buffer encoded, f32 point_size, struct string cache_chars)
|
||||||
|
|||||||
21
src/user.c
21
src/user.c
@ -1041,8 +1041,25 @@ INTERNAL SYS_THREAD_FUNC_DEF(user_thread_entry_point, arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void user_startup(struct sys_window *window)
|
struct user_startup_receipt user_startup(struct work_startup_receipt *work_sr,
|
||||||
|
struct renderer_startup_receipt *renderer_sr,
|
||||||
|
struct font_startup_receipt *font_sr,
|
||||||
|
struct texture_startup_receipt *texture_sr,
|
||||||
|
struct draw_startup_receipt *draw_sr,
|
||||||
|
struct game_startup_receipt *game_sr,
|
||||||
|
struct asset_cache_startup_receipt *asset_cache_sr,
|
||||||
|
struct mixer_startup_receipt *mixer_sr,
|
||||||
|
struct sys_window *window)
|
||||||
{
|
{
|
||||||
|
(UNUSED)work_sr;
|
||||||
|
(UNUSED)renderer_sr;
|
||||||
|
(UNUSED)font_sr;
|
||||||
|
(UNUSED)texture_sr;
|
||||||
|
(UNUSED)draw_sr;
|
||||||
|
(UNUSED)game_sr;
|
||||||
|
(UNUSED)asset_cache_sr;
|
||||||
|
(UNUSED)mixer_sr;
|
||||||
|
|
||||||
L.arena = arena_alloc(GIGABYTE(64));
|
L.arena = arena_alloc(GIGABYTE(64));
|
||||||
|
|
||||||
L.sys_events_mutex = sys_mutex_alloc();
|
L.sys_events_mutex = sys_mutex_alloc();
|
||||||
@ -1060,6 +1077,8 @@ void user_startup(struct sys_window *window)
|
|||||||
sys_window_register_event_callback(L.window, &window_event_callback);
|
sys_window_register_event_callback(L.window, &window_event_callback);
|
||||||
|
|
||||||
L.user_thread = sys_thread_init(&user_thread_entry_point, NULL, STR("[P1] User thread"));
|
L.user_thread = sys_thread_init(&user_thread_entry_point, NULL, STR("[P1] User thread"));
|
||||||
|
|
||||||
|
return (struct user_startup_receipt) { 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
void user_shutdown(void)
|
void user_shutdown(void)
|
||||||
|
|||||||
19
src/user.h
19
src/user.h
@ -2,6 +2,14 @@
|
|||||||
#define USER_H
|
#define USER_H
|
||||||
|
|
||||||
struct sys_window;
|
struct sys_window;
|
||||||
|
struct work_startup_receipt;
|
||||||
|
struct renderer_startup_receipt;
|
||||||
|
struct font_startup_receipt;
|
||||||
|
struct texture_startup_receipt;
|
||||||
|
struct draw_startup_receipt;
|
||||||
|
struct game_startup_receipt;
|
||||||
|
struct asset_cache_startup_receipt;
|
||||||
|
struct mixer_startup_receipt;
|
||||||
|
|
||||||
enum user_bind_kind {
|
enum user_bind_kind {
|
||||||
USER_BIND_KIND_NONE,
|
USER_BIND_KIND_NONE,
|
||||||
@ -24,7 +32,16 @@ enum user_bind_kind {
|
|||||||
USER_BIND_KIND_COUNT
|
USER_BIND_KIND_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
void user_startup(struct sys_window *window);
|
struct user_startup_receipt { i32 _; };
|
||||||
|
struct user_startup_receipt user_startup(struct work_startup_receipt *work_sr,
|
||||||
|
struct renderer_startup_receipt *renderer_sr,
|
||||||
|
struct font_startup_receipt *font_sr,
|
||||||
|
struct texture_startup_receipt *texture_sr,
|
||||||
|
struct draw_startup_receipt *draw_sr,
|
||||||
|
struct game_startup_receipt *game_sr,
|
||||||
|
struct asset_cache_startup_receipt *asset_cache_sr,
|
||||||
|
struct mixer_startup_receipt *mixer_sr,
|
||||||
|
struct sys_window *window);
|
||||||
void user_shutdown(void);
|
void user_shutdown(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -93,7 +93,7 @@ INTERNAL void worker_thread_entry_point(void *thread_data);
|
|||||||
* Startup
|
* Startup
|
||||||
* ========================== */
|
* ========================== */
|
||||||
|
|
||||||
void work_startup(u32 num_worker_threads)
|
struct work_startup_receipt work_startup(u32 num_worker_threads)
|
||||||
{
|
{
|
||||||
struct temp_arena scratch = scratch_begin_no_conflict();
|
struct temp_arena scratch = scratch_begin_no_conflict();
|
||||||
|
|
||||||
@ -131,6 +131,8 @@ void work_startup(u32 num_worker_threads)
|
|||||||
}
|
}
|
||||||
|
|
||||||
scratch_end(scratch);
|
scratch_end(scratch);
|
||||||
|
|
||||||
|
return (struct work_startup_receipt) { 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
void work_shutdown(void)
|
void work_shutdown(void)
|
||||||
|
|||||||
@ -35,7 +35,8 @@ struct worker_context {
|
|||||||
b32 is_worker;
|
b32 is_worker;
|
||||||
};
|
};
|
||||||
|
|
||||||
void work_startup(u32 num_worker_threads);
|
struct work_startup_receipt { i32 _; };
|
||||||
|
struct work_startup_receipt work_startup(u32 num_worker_threads);
|
||||||
void work_shutdown(void);
|
void work_shutdown(void);
|
||||||
|
|
||||||
struct work_slate work_slate_begin(void);
|
struct work_slate work_slate_begin(void);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user