mem: rename Allocator primitives to alloc_bytes/dealloc_bytes (Phase 4 naming pulled forward, Agra-approved)
This commit is contained in:
@@ -211,7 +211,7 @@ GlyphCache :: struct {
|
||||
self.font_data_size = file_size;
|
||||
|
||||
// Init stbtt_fontinfo
|
||||
self.font_info = self.parent_allocator.alloc(FONTINFO_SIZE);
|
||||
self.font_info = self.parent_allocator.alloc_bytes(FONTINFO_SIZE);
|
||||
memset(self.font_info, 0, FONTINFO_SIZE);
|
||||
stbtt_InitFont(self.font_info, font_data, 0);
|
||||
|
||||
@@ -242,7 +242,7 @@ GlyphCache :: struct {
|
||||
self.atlas_width = GLYPH_ATLAS_W;
|
||||
self.atlas_height = GLYPH_ATLAS_H;
|
||||
bitmap_size : s64 = xx self.atlas_width * xx self.atlas_height;
|
||||
self.bitmap = xx self.parent_allocator.alloc(bitmap_size);
|
||||
self.bitmap = xx self.parent_allocator.alloc_bytes(bitmap_size);
|
||||
memset(self.bitmap, 0, bitmap_size);
|
||||
|
||||
// Shelf packer init
|
||||
@@ -258,10 +258,10 @@ GlyphCache :: struct {
|
||||
// Init hash table (256 slots)
|
||||
self.hash_cap = 256;
|
||||
hash_bytes : s64 = self.hash_cap * 4; // u32 per slot
|
||||
self.hash_keys = xx self.parent_allocator.alloc(hash_bytes);
|
||||
self.hash_keys = xx self.parent_allocator.alloc_bytes(hash_bytes);
|
||||
memset(self.hash_keys, 0, hash_bytes);
|
||||
val_bytes : s64 = self.hash_cap * 8; // s64 per slot (s32 would suffice but alignment)
|
||||
self.hash_vals = xx self.parent_allocator.alloc(val_bytes);
|
||||
self.hash_vals = xx self.parent_allocator.alloc_bytes(val_bytes);
|
||||
|
||||
// Create the atlas texture. In GPU-protocol mode we create empty and
|
||||
// let the first `flush()` push the (zero-initialized) bitmap via
|
||||
@@ -406,10 +406,10 @@ GlyphCache :: struct {
|
||||
|
||||
self.hash_cap = old_cap * 2;
|
||||
hash_bytes : s64 = self.hash_cap * 4;
|
||||
self.hash_keys = xx self.parent_allocator.alloc(hash_bytes);
|
||||
self.hash_keys = xx self.parent_allocator.alloc_bytes(hash_bytes);
|
||||
memset(self.hash_keys, 0, hash_bytes);
|
||||
val_bytes : s64 = self.hash_cap * 8;
|
||||
self.hash_vals = xx self.parent_allocator.alloc(val_bytes);
|
||||
self.hash_vals = xx self.parent_allocator.alloc_bytes(val_bytes);
|
||||
|
||||
// Rehash
|
||||
mask := self.hash_cap - 1;
|
||||
@@ -427,8 +427,8 @@ GlyphCache :: struct {
|
||||
i += 1;
|
||||
}
|
||||
|
||||
self.parent_allocator.dealloc(old_keys);
|
||||
self.parent_allocator.dealloc(old_vals);
|
||||
self.parent_allocator.dealloc_bytes(old_keys);
|
||||
self.parent_allocator.dealloc_bytes(old_vals);
|
||||
}
|
||||
|
||||
// Upload dirty atlas to GPU. On the Metal path, defer the upload to
|
||||
@@ -489,7 +489,7 @@ GlyphCache :: struct {
|
||||
new_w := self.atlas_width * 2;
|
||||
new_h := self.atlas_height * 2;
|
||||
new_size : s64 = xx new_w * xx new_h;
|
||||
new_bitmap : [*]u8 = xx self.parent_allocator.alloc(new_size);
|
||||
new_bitmap : [*]u8 = xx self.parent_allocator.alloc_bytes(new_size);
|
||||
memset(new_bitmap, 0, new_size);
|
||||
|
||||
// Copy old rows into new bitmap
|
||||
@@ -501,7 +501,7 @@ GlyphCache :: struct {
|
||||
y += 1;
|
||||
}
|
||||
|
||||
self.parent_allocator.dealloc(self.bitmap);
|
||||
self.parent_allocator.dealloc_bytes(self.bitmap);
|
||||
self.bitmap = new_bitmap;
|
||||
self.atlas_width = new_w;
|
||||
self.atlas_height = new_h;
|
||||
|
||||
@@ -50,7 +50,7 @@ UIRenderer :: struct {
|
||||
init :: (self: *UIRenderer) {
|
||||
// Allocate vertex scratch (CPU side) — same for both backends.
|
||||
buf_size := MAX_UI_VERTICES * UI_VERTEX_BYTES;
|
||||
self.vertices = xx context.allocator.alloc(buf_size);
|
||||
self.vertices = xx context.allocator.alloc_bytes(buf_size);
|
||||
memset(self.vertices, 0, buf_size);
|
||||
self.vertex_count = 0;
|
||||
self.dpi_scale = 1.0;
|
||||
|
||||
@@ -45,7 +45,7 @@ StateStore :: struct {
|
||||
}
|
||||
|
||||
// Create new entry
|
||||
data : [*]u8 = xx self.parent_allocator.alloc(size_of(T));
|
||||
data : [*]u8 = xx self.parent_allocator.alloc_bytes(size_of(T));
|
||||
memcpy(data, @default, size_of(T));
|
||||
self.entries.append(.{
|
||||
id = id,
|
||||
|
||||
Reference in New Issue
Block a user