From 538106cbba3cc1ed2785ad552d56a2706fbd2664 Mon Sep 17 00:00:00 2001 From: Kbz-8 Date: Wed, 6 May 2026 15:22:02 +0200 Subject: [PATCH] investigating memory issues --- src/soft/SoftPhysicalDevice.zig | 6 +++--- src/soft/lib.zig | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/soft/SoftPhysicalDevice.zig b/src/soft/SoftPhysicalDevice.zig index 5a6445b..3df5eb4 100644 --- a/src/soft/SoftPhysicalDevice.zig +++ b/src/soft/SoftPhysicalDevice.zig @@ -68,7 +68,7 @@ pub fn create(allocator: std.mem.Allocator, instance: *base.Instance) VkError!*S .max_uniform_buffer_range = 16384, .max_storage_buffer_range = 134217728, .max_push_constants_size = 128, - .max_memory_allocation_count = std.math.maxInt(u32), + .max_memory_allocation_count = lib.MAX_ALLOCATION_COUNT, .max_sampler_allocation_count = 4096, .buffer_image_granularity = 131072, .sparse_address_space_size = 0, @@ -179,8 +179,8 @@ pub fn create(allocator: std.mem.Allocator, instance: *base.Instance) VkError!*S }; interface.mem_props.memory_heap_count = 1; interface.mem_props.memory_heaps[0] = .{ - .size = std.process.totalSystemMemory() catch 0, - .flags = .{}, // Host memory + .size = lib.PHYSICAL_DEVICE_HEAP_SIZE, + .flags = .{ .device_local_bit = true }, }; interface.features = .{ diff --git a/src/soft/lib.zig b/src/soft/lib.zig index 428e01e..b512cfb 100644 --- a/src/soft/lib.zig +++ b/src/soft/lib.zig @@ -66,6 +66,9 @@ pub const MAX_IMAGE_LEVELS_3D = 12; pub const MAX_IMAGE_LEVELS_CUBE = 15; pub const MAX_IMAGE_ARRAY_LAYERS = 2048; +pub const PHYSICAL_DEVICE_HEAP_SIZE = 0x80000000; // 2 GiB +pub const MAX_ALLOCATION_COUNT = 4096; + pub const std_options = base.std_options; comptime {