diff --git a/build.zig b/build.zig index 009ad7f..e1fb996 100644 --- a/build.zig +++ b/build.zig @@ -94,18 +94,25 @@ pub fn build(b: *std.Build) !void { }); const c_test_exe_install = b.addInstallArtifact(c_test_exe, .{}); + c_test_exe_install.step.dependOn(&lib_install.step); try targets.append(b.allocator, lib); try targets.append(b.allocator, c_test_exe); _ = zcc.createStep(b, "cdb", try targets.toOwnedSlice(b.allocator)); - const run_c_test = b.addRunArtifact(c_test_exe); - run_c_test.step.dependOn(&lib_install.step); - run_c_test.step.dependOn(&c_test_exe_install.step); + const run_c_test_exe = b.addRunArtifact(c_test_exe); + run_c_test_exe.step.dependOn(&c_test_exe_install.step); - const test_c_step = b.step(b.fmt("test-c-{s}", .{impl.name}), b.fmt("Run lib{s} C test", .{impl.name})); - test_c_step.dependOn(&run_c_test.step); + const run_c_test_step = b.step(b.fmt("test-c-{s}", .{impl.name}), b.fmt("Run lib{s} C test", .{impl.name})); + run_c_test_step.dependOn(&run_c_test_exe.step); + + const run_c_test_gdb_exe = b.addRunArtifact(c_test_exe); + try run_c_test_gdb_exe.argv.insert(b.allocator, 0, .{ .bytes = b.fmt("gdb", .{}) }); // Hacky + run_c_test_gdb_exe.step.dependOn(&c_test_exe_install.step); + + const run_c_test_gdb_step = b.step(b.fmt("test-c-{s}-gdb", .{impl.name}), b.fmt("Run lib{s} C test within gdb", .{impl.name})); + run_c_test_gdb_step.dependOn(&run_c_test_gdb_exe.step); } const autodoc_test = b.addObject(.{ diff --git a/src/vulkan/CommandBuffer.zig b/src/vulkan/CommandBuffer.zig index 55d5ab7..15123c8 100644 --- a/src/vulkan/CommandBuffer.zig +++ b/src/vulkan/CommandBuffer.zig @@ -25,6 +25,5 @@ pub fn init(device: *Device, allocator: std.mem.Allocator, info: *const vk.Comma } pub inline fn destroy(self: *Self, allocator: std.mem.Allocator) void { - std.debug.print("{any}\n", .{self}); self.vtable.destroy(self, allocator); } diff --git a/src/vulkan/CommandPool.zig b/src/vulkan/CommandPool.zig index 93afd5a..a25bc3e 100644 --- a/src/vulkan/CommandPool.zig +++ b/src/vulkan/CommandPool.zig @@ -51,7 +51,7 @@ pub fn init(device: *Device, allocator: std.mem.Allocator, info: *const vk.Comma pub fn allocateCommandBuffers(self: *Self, info: *const vk.CommandBufferAllocateInfo) VkError![]*NonDispatchable(CommandBuffer) { const allocator = self.host_allocator.allocator(); - if (self.buffers.items.len < info.command_buffer_count or self.first_free_buffer_index + info.command_buffer_count > self.buffers.items.len) { + if (self.buffers.items.len < self.first_free_buffer_index + info.command_buffer_count) { while (self.buffers.capacity < self.buffers.items.len + info.command_buffer_count) { self.buffers.ensureUnusedCapacity(allocator, BUFFER_POOL_BASE_CAPACITY) catch return VkError.OutOfHostMemory; }