formatting

This commit is contained in:
jacob 2025-07-03 20:14:58 -05:00
parent 514c2a6496
commit aca087104a
2 changed files with 30 additions and 29 deletions

View File

@ -123,7 +123,7 @@ struct gp_memory_info gp_query_memory_info(void);
* Present
* ========================== */
/* 1. Clears the backbuffer and ensures its at size `backbuffer_resolution`
/* 1. Clears the backbuffer and ensures it's at size `backbuffer_resolution`
* 2. Blits `texture` to the backbuffer using `texture_xf` (applied to centered unit square)
* 3. Presents the backbuffer */
void gp_present(struct sys_window *window, struct v2i32 backbuffer_resolution, struct gp_resource *texture, struct xform texture_xf, i32 vsync);

View File

@ -114,7 +114,9 @@ struct win32_window {
#define FIBER_NAME_PREFIX_CSTR "[F] Fiber "
#define FIBER_NAME_PREFIX_CSTR "Fiber #"
#define FIBER_NAME_MAX_SIZE 64
enum yield_kind {
@ -127,33 +129,31 @@ enum yield_kind {
};
struct alignas(64) fiber {
/* =================================================== */
char *name_cstr; /* 8 bytes */
/* ========================================================================= */
/* =================================================== */
i32 id; /* 4 bytes */
i32 parent_id; /* 4 bytes */
/* ========================================================================= */
/* =================================================== */
void *addr; /* 8 bytes */
/* ========================================================================= */
/* =================================================== */
sys_job_func *job_func; /* 8 bytes */
/* ========================================================================= */
/* =================================================== */
void *job_sig; /* 8 bytes */
/* ========================================================================= */
/* =================================================== */
i32 job_id; /* 4 bytes */
u8 pad0[4]; /* 4 bytes (padding) */
/* ========================================================================= */
enum yield_kind yield_kind; /* 4 bytes */
u8 pad1[4]; /* 4 bytes (padding) */
/* ========================================================================= */
u8 pad_end[8]; /* 8 bytes (padding) */
/* =================================================== */
u8 _pad[16]; /* 8 bytes (padding) */
};
STATIC_ASSERT(sizeof(struct fiber) == 64); /* Assume fiber fits in one cache line (increase if necessary) */
STATIC_ASSERT(alignof(struct fiber) == 64); /* Avoid false sharing */
struct alignas(64) fiber_ctx {
/* ========================================================================= */
/* ==================================================== */
struct sys_scratch_ctx scratch_ctx; /* 16 bytes */
/* ========================================================================= */
u8 pad[40]; /* 40 bytes (padding) */
/* ==================================================== */
u8 _pad[40]; /* 40 bytes (padding) */
};
STATIC_ASSERT(sizeof(struct fiber_ctx) == 64); /* Assume ctx fits in one cache line (increase if necessary) */
STATIC_ASSERT(alignof(struct fiber_ctx) == 64); /* Avoid false sharing */
@ -465,8 +465,9 @@ INTERNAL void job_fiber_entry(void *id_ptr)
i32 parent_id = fiber->parent_id;
struct fiber *parent_fiber = fiber_from_id(parent_id);
void *parent_fiber_addr = parent_fiber->addr;
{
/* Run job */
{
__profscope(Run job);
fiber->yield_kind = YIELD_KIND_NONE;
struct sys_job_data data = ZI;
data.id = fiber->job_id;
@ -485,6 +486,7 @@ INTERNAL void job_fiber_entry(void *id_ptr)
INTERNAL SYS_THREAD_DEF(runner_entry, runner_ctx_arg)
{
__profscope(Runner);
struct runner_ctx *ctx = runner_ctx_arg;
(UNUSED)ctx;
@ -584,8 +586,7 @@ INTERNAL SYS_THREAD_DEF(test_entry, _)
struct runner_ctx *ctx = &G.runner_contexts[i];
ctx->id = i;
ctx->sleep_timer = CreateWaitableTimerExW(NULL, NULL, CREATE_WAITABLE_TIMER_HIGH_RESOLUTION, TIMER_ALL_ACCESS);
struct string id_str = string_from_int(scratch.arena, i, 10, 2);
struct string name = string_format(scratch.arena, LIT("Runner %F"), FMT_STR(id_str));
struct string name = string_format(scratch.arena, LIT("Runner #%F"), FMT_SINT(i));
G.runner_threads[i] = sys_thread_alloc(runner_entry, ctx, name, PROF_THREAD_GROUP_RUNNERS + i);
}