adding bounded arena allocator to renderer
Build / build (push) Successful in 1m6s
Test / build_and_test (push) Failing after 8h9m28s

This commit is contained in:
2026-05-10 12:28:53 +02:00
parent 7f812bcf39
commit e9454ddd9a
9 changed files with 107 additions and 32 deletions
+5 -2
View File
@@ -8,6 +8,7 @@ const spv = @import("spv");
pub const F32x4 = zm.F32x4;
const PipelineState = @import("Device.zig").PipelineState;
const BoundedArenaAllocator = @import("BoundedArenaAllocator.zig");
const SoftBuffer = @import("../SoftBuffer.zig");
const SoftDescriptorSet = @import("../SoftDescriptorSet.zig");
@@ -26,6 +27,8 @@ const VkError = base.VkError;
const Self = @This();
const @"1GiB" = 1_073_741_824;
pub const VertexBuffer = struct {
buffer: *const SoftBuffer,
offset: usize,
@@ -100,7 +103,7 @@ pub fn init(device: *SoftDevice, state: *PipelineState) Self {
pub fn draw(self: *Self, vertex_count: usize, instance_count: usize, first_vertex: usize, first_instance: usize) VkError!void {
const io = self.device.interface.io();
var arena: std.heap.ArenaAllocator = .init(self.device.device_allocator.allocator());
var arena: BoundedArenaAllocator = .init(self.device.device_allocator.allocator(), @"1GiB");
defer arena.deinit();
const allocator = arena.allocator();
@@ -131,7 +134,7 @@ pub fn draw(self: *Self, vertex_count: usize, instance_count: usize, first_verte
pub fn drawIndexed(self: *Self, index_count: usize, instance_count: usize, first_index: usize, first_instance: usize, vertex_offset: i32) VkError!void {
const io = self.device.interface.io();
var arena: std.heap.ArenaAllocator = .init(self.device.device_allocator.allocator());
var arena: BoundedArenaAllocator = .init(self.device.device_allocator.allocator(), @"1GiB");
defer arena.deinit();
const allocator = arena.allocator();