Transient CB only, validation fixes
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
//! arguments by turning pointer-length pairs into slices and integrates with
|
||||
//! different queues from `Engine` struct.
|
||||
//!
|
||||
//! The wrapper retains information about the queue type and whether its
|
||||
//! transient, such that it can submit to the correct queue preallocated in the
|
||||
//! `Engine` struct when calling `CommandBuffer.submit`.
|
||||
//! The wrapper retains information about the queue type, such that it can
|
||||
//! submit to the correct queue preallocated in the `Engine` struct when calling
|
||||
//! `CommandBuffer.submit`.
|
||||
|
||||
const CommandBuffer = @This();
|
||||
const std = @import("std");
|
||||
@@ -13,17 +13,14 @@ const vk = @import("vulkan");
|
||||
|
||||
const Engine = @import("Engine.zig");
|
||||
const QueueType = @import("QueueType.zig").QueueType;
|
||||
const Transient = @import("Transient.zig").Transient;
|
||||
|
||||
proxy: vk.CommandBufferProxy,
|
||||
allocator: std.mem.Allocator,
|
||||
queue_type: QueueType,
|
||||
transient: Transient,
|
||||
|
||||
pub fn init(engine: *Engine, queue_type: QueueType, transient: Transient) !CommandBuffer {
|
||||
pub fn init(engine: *Engine, queue_type: QueueType) !CommandBuffer {
|
||||
const handle = try engine.allocateCommandBuffer(.{
|
||||
.queue_type = queue_type,
|
||||
.transient = transient,
|
||||
.level = .primary,
|
||||
});
|
||||
const proxy: vk.CommandBufferProxy = .init(handle, engine.device.wrapper);
|
||||
@@ -32,14 +29,12 @@ pub fn init(engine: *Engine, queue_type: QueueType, transient: Transient) !Comma
|
||||
.proxy = proxy,
|
||||
.allocator = allocator,
|
||||
.queue_type = queue_type,
|
||||
.transient = transient,
|
||||
};
|
||||
}
|
||||
|
||||
pub fn deinit(self: *CommandBuffer, engine: *Engine) void {
|
||||
engine.freeCommandBuffer(.{
|
||||
.queue_type = self.queue_type,
|
||||
.transient = self.transient,
|
||||
.command_buffer = self.proxy.handle,
|
||||
});
|
||||
self.* = undefined;
|
||||
@@ -83,10 +78,7 @@ pub const VertexBufferBinding = struct {
|
||||
pub fn beginCommandBuffer(self: CommandBuffer) !void {
|
||||
try self.proxy.beginCommandBuffer(&.{
|
||||
.flags = .{
|
||||
.one_time_submit_bit = switch (self.transient) {
|
||||
.persistent => true,
|
||||
.transient => false,
|
||||
},
|
||||
.one_time_submit_bit = true,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user