From 71bca57087f5746aaafba07ccce5b6bbc270b8c1 Mon Sep 17 00:00:00 2001 From: onelin Date: Thu, 18 Dec 2025 23:21:48 +0100 Subject: Move pipeline reset to rendering/window Also set the damn memory to zero Who could've guessed that you should zero your initialized memory when you're making assumptions later that uninitizalied members are zero. --- src/window.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/window.c') diff --git a/src/window.c b/src/window.c index 79e9a42..6e5fe71 100644 --- a/src/window.c +++ b/src/window.c @@ -152,7 +152,7 @@ void window_init_renderstack(Window *restrict w, ASSERT(buffer_params != NULL); RenderTargets *t = NULL; - void* allocation = malloc( + usize allocation_sz = sizeof(RenderTargets) + sizeof(*t->framebuffer) * num_fbuf + sizeof(*t->framebuffer_parameters) * num_fbuf + @@ -160,9 +160,10 @@ void window_init_renderstack(Window *restrict w, sizeof(*t->framebuffer_size_callback) * num_fbuf + sizeof(*t->camera_reset_callback) * num_fbuf + sizeof(*t->buffer) * num_buf + - sizeof(*t->buffer_parameters) * num_buf - // TODO: callbacks - ); + sizeof(*t->buffer_parameters) * num_buf; + + void* allocation = malloc(allocation_sz); + memset(allocation, 0, allocation_sz); #define ADVANCE_PTR(target, count)\ t->target = (void*)((u64)allocation + acc); \ -- cgit v1.3