From 00d8206ad237929ab33fc125efad19fb62479e66 Mon Sep 17 00:00:00 2001 From: Yuval Dolev Date: Sun, 19 Jan 2020 03:05:56 +0200 Subject: [PATCH] Fixed live resizing bug with the layer based view. --- metal/4ed_metal_render.mm | 5 ++++- platform_mac/mac_4ed.mm | 5 ++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/metal/4ed_metal_render.mm b/metal/4ed_metal_render.mm index c19c4df3..fc789cb9 100644 --- a/metal/4ed_metal_render.mm +++ b/metal/4ed_metal_render.mm @@ -465,6 +465,9 @@ metal__make_buffer(u32 size, id device){ // NOTE(yuval): Check for a free texture slot and allocate another slot bucket if no free slot has been found if (!texture_slots.first_free_slot){ + // NOTE(yuval): Assert that the next bucket's index can fit in a u16 + Assert(texture_slots.bucket_count < ((u16)-1)); + Metal_Texture_Slot_Bucket *bucket = (Metal_Texture_Slot_Bucket*)system_memory_allocate(sizeof(Metal_Texture_Slot_Bucket) + (sizeof(Metal_Texture_Slot_Locator_Node) * metal__texture_slots_per_bucket), file_name_line_number_lit_u8); @@ -480,7 +483,7 @@ metal__make_buffer(u32 size, id device){ } sll_queue_push(texture_slots.first_bucket, texture_slots.last_bucket, bucket); - ++texture_slots.bucket_count; + texture_slots.bucket_count += 1; } Assert(texture_slots.first_free_slot); diff --git a/platform_mac/mac_4ed.mm b/platform_mac/mac_4ed.mm index 37897dfd..09dcc170 100644 --- a/platform_mac/mac_4ed.mm +++ b/platform_mac/mac_4ed.mm @@ -583,8 +583,8 @@ mac_toggle_fullscreen(void){ } - (void)windowDidResize:(NSNotification*)notification{ - printf("Resize!\n"); mac_resize(mac_vars.window); + [mac_vars.view display]; } - (void)windowDidMiniaturize:(NSNotification*)notification{ @@ -630,8 +630,7 @@ mac_toggle_fullscreen(void){ mac_resize(mac_vars.window); } -- (BOOL)wantsUpdateLayer -{ +- (BOOL)wantsUpdateLayer{ return YES; }