adding command buffer pool logic
This commit is contained in:
@@ -2,9 +2,12 @@ const std = @import("std");
|
||||
const vk = @import("vulkan");
|
||||
const base = @import("base");
|
||||
|
||||
const NonDispatchable = base.NonDispatchable;
|
||||
const VkError = base.VkError;
|
||||
const Device = base.Device;
|
||||
|
||||
const SoftCommandBuffer = @import("SoftCommandBuffer.zig");
|
||||
|
||||
const Self = @This();
|
||||
pub const Interface = base.CommandPool;
|
||||
|
||||
@@ -28,10 +31,18 @@ pub fn create(device: *base.Device, allocator: std.mem.Allocator, info: *const v
|
||||
return self;
|
||||
}
|
||||
|
||||
pub fn allocateCommandBuffers(interface: *Interface, info: *const vk.CommandBufferAllocateInfo) VkError![]*base.CommandBuffer {
|
||||
_ = interface;
|
||||
_ = info;
|
||||
return VkError.FeatureNotPresent;
|
||||
pub fn allocateCommandBuffers(interface: *Interface, info: *const vk.CommandBufferAllocateInfo) VkError!void {
|
||||
const allocator = interface.host_allocator.allocator();
|
||||
|
||||
while (interface.buffers.capacity < interface.buffers.items.len + info.command_buffer_count) {
|
||||
interface.buffers.ensureUnusedCapacity(allocator, base.CommandPool.BUFFER_POOL_BASE_CAPACITY) catch return VkError.OutOfHostMemory;
|
||||
}
|
||||
|
||||
for (0..info.command_buffer_count) |_| {
|
||||
const cmd = try SoftCommandBuffer.create(interface.owner, allocator, info);
|
||||
const non_dis_cmd = try NonDispatchable(base.CommandBuffer).wrap(allocator, &cmd.interface);
|
||||
interface.buffers.appendAssumeCapacity(non_dis_cmd);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn destroy(interface: *Interface, allocator: std.mem.Allocator) void {
|
||||
|
||||
Reference in New Issue
Block a user