fix annoying bug with pool allocator getting assigned to logger arrays

This commit is contained in:
Tuomas Katajisto 2026-03-25 21:10:39 +02:00
parent 1c8f9bc46e
commit 4d9e175172
7 changed files with 12 additions and 6 deletions

View File

@ -24,4 +24,4 @@ VK_KHR_deferred_host_operations
VK_KHR_acceleration_structure
VK_KHR_ray_query
BLAS Compaction: 1.9MB -> 0.6MB (1.2MB saved, 66.1% smaller)
BLAS Compaction: 2.1MB -> 0.7MB (1.4MB saved, 66.1% smaller)

View File

@ -1,4 +1,4 @@
master_volume 1
music_volume 1
music_volume 0.5
sfx_volume 1
fullscreen 0

View File

@ -49,7 +49,7 @@ g_asset_manager : Asset_Manager;
#load "rdm_loader.jai";
MAX_FILE_SIZE :: 200_000_000;
MAX_FILE_SIZE :: 600_000_000;
RDM_ATLAS_MAX_BYTES :: 4096 * 4096 * 4 * 4 + size_of(RDM_File_Header);
RDM_LOOKUP_MAX_BYTES :: 512 * 512 * 4 * 4 + size_of(RDM_File_Header);

View File

@ -32,7 +32,7 @@ RDM_Chunk_Bake :: struct {
entries: [..]RDM_Atlas_Entry;
}
RDM_ATLAS_SIZE :: 4096;
RDM_ATLAS_SIZE :: 4096 * 2;
RDM_LOOKUP_SIZE :: 512; // 512x512 = 32*32*32*8 = 262144 texels
rdm_chunk_bakes : Table(Chunk_Key, RDM_Chunk_Bake, chunk_key_hash, chunk_key_compare);
@ -377,6 +377,7 @@ rdm_bake_finish :: () {
lookup_bytes :: lookup_texels * 4 * size_of(float);
for chunk_key: bake_chunk_keys {
print("Handling chunk key: %\n", chunk_key);
bake := table_find_pointer(*rdm_chunk_bakes, chunk_key);
if bake == null || bake.entries.count == 0 then continue;
@ -620,6 +621,7 @@ rdm_save_all_chunks_to_disk :: () {
world_name := curworld.world.name;
for *bake, chunk_key: rdm_chunk_bakes {
print("Processing chunk....\n");
if bake.entries.count == 0 then continue;
// Save atlas.

View File

@ -17,7 +17,9 @@ _emit :: (level: Log_Level, message: string) {
else ifx level == .ERROR then "[ERROR] "
else "[INFO] ";
push_allocator(default_context.allocator);
// We need to protect the logger from custom allocators since we don't
// want those meddling with our log row allocation!
push_allocator(default_allocator);
line := copy_string(tprint("%1%2", prefix, message));
print("%\n", line);
console_add_output_line(line);

View File

@ -12,6 +12,7 @@
#load "../main.jai";
default_context: #Context;
default_allocator: Allocator;
temporary_storage: Temporary_Storage;
temporary_storage_data: [TEMPORARY_STORAGE_SIZE] u8 #align 64;
@ -23,6 +24,7 @@ sapp_init :: () {
temporary_storage.size = temporary_storage_data.count;
temporary_storage.original_data = temporary_storage_data.data;
temporary_storage.original_size = temporary_storage_data.count;
default_allocator = default_context.allocator;
push_context default_context {
context.logger = logger;