summaryrefslogtreecommitdiff
path: root/src/window.c
diff options
context:
space:
mode:
authoronelin <oscar@nelin.dk>2025-12-18 22:21:48 +0000
committeronelin <oscar@nelin.dk>2025-12-20 22:53:17 +0000
commit71bca57087f5746aaafba07ccce5b6bbc270b8c1 (patch)
tree039bae97ec38f4101d27b65f5de81c70787fbab6 /src/window.c
parent49fbbcc95e1234e0eb1464fc877b0264c5fcb9d1 (diff)
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.
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c9
1 files changed, 5 insertions, 4 deletions
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); \