fixing doc generation

This commit is contained in:
2025-11-18 15:36:07 +01:00
parent 5bfc0e6254
commit 8ee6c9f63d
4 changed files with 16 additions and 18 deletions

View File

@@ -32,8 +32,8 @@
.lazy = true, .lazy = true,
}, },
.kvf = .{ .kvf = .{
.url = "git+https://github.com/Kbz-8/KVF#492a2f8e08f5aa3f5e9c9869668829af3f483d26", .url = "git+https://github.com/Kbz-8/KVF#e69f907a96b9e636378288a973f23625177356c0",
.hash = "N-V-__8AALuHAgC55XjEl7WQZIw2YjKvEwvE04FMHGtzVOH5", .hash = "N-V-__8AAPaHAgA811W_sWLhxkbbE6uYWqaSQq9l36M_nMdY",
.lazy = true, .lazy = true,
}, },
}, },

View File

@@ -47,15 +47,8 @@ pub fn init(device: *Device, allocator: std.mem.Allocator, info: *const vk.Comma
}; };
} }
inline fn transitionState(self: *Self, target: State, from_allowed: std.EnumSet(State)) error{NotAllowed}!void { inline fn transitionState(self: *Self, target: State, from_allowed: []const State) error{NotAllowed}!void {
if (!from_allowed.contains(self.state)) { if (!std.EnumSet(State).initMany(from_allowed).contains(self.state)) {
return error.NotAllowed;
}
self.state = target;
}
inline fn transitionStateNotAllowed(self: *Self, target: State, from_not_allowed: std.EnumSet(State)) error{NotAllowed}!void {
if (from_not_allowed.contains(self.state)) {
return error.NotAllowed; return error.NotAllowed;
} }
self.state = target; self.state = target;
@@ -67,16 +60,16 @@ pub inline fn destroy(self: *Self, allocator: std.mem.Allocator) void {
pub inline fn begin(self: *Self, info: *const vk.CommandBufferBeginInfo) VkError!void { pub inline fn begin(self: *Self, info: *const vk.CommandBufferBeginInfo) VkError!void {
if (!self.pool.flags.reset_command_buffer_bit) { if (!self.pool.flags.reset_command_buffer_bit) {
self.transitionState(.Recording, .initOne(.Initial)) catch return VkError.ValidationFailed; self.transitionState(.Recording, &.{.Initial}) catch return VkError.ValidationFailed;
} else { } else {
self.transitionStateNotAllowed(.Recording, .initMany(&.{ .Recording, .Pending })) catch return VkError.ValidationFailed; self.transitionState(.Recording, &.{ .Initial, .Executable, .Invalid }) catch return VkError.ValidationFailed;
} }
try self.dispatch_table.begin(self, info); try self.dispatch_table.begin(self, info);
self.begin_info = info.*; self.begin_info = info.*;
} }
pub inline fn end(self: *Self) VkError!void { pub inline fn end(self: *Self) VkError!void {
self.transitionState(.Executable, .initOne(.Recording)) catch return VkError.ValidationFailed; self.transitionState(.Executable, &.{.Recording}) catch return VkError.ValidationFailed;
try self.dispatch_table.end(self); try self.dispatch_table.end(self);
} }
@@ -84,15 +77,15 @@ pub inline fn reset(self: *Self, flags: vk.CommandBufferResetFlags) VkError!void
if (!self.pool.flags.reset_command_buffer_bit) { if (!self.pool.flags.reset_command_buffer_bit) {
return VkError.ValidationFailed; return VkError.ValidationFailed;
} }
self.transitionStateNotAllowed(.Initial, .initOne(.Pending)) catch return VkError.ValidationFailed; self.transitionState(.Initial, &.{ .Initial, .Recording, .Executable, .Invalid }) catch return VkError.ValidationFailed;
try self.dispatch_table.reset(self, flags); try self.dispatch_table.reset(self, flags);
} }
pub inline fn submit(self: *Self) VkError!void { pub inline fn submit(self: *Self) VkError!void {
self.transitionState(.Initial, .initMany(&.{ .Pending, .Executable })) catch return VkError.ValidationFailed;
if (self.begin_info) |begin_info| { if (self.begin_info) |begin_info| {
if (!begin_info.flags.simultaneous_use_bit) { if (!begin_info.flags.simultaneous_use_bit) {
self.transitionStateNotAllowed(.Initial, .initOne(.Pending)) catch return VkError.ValidationFailed; self.transitionState(.Pending, &.{.Executable}) catch return VkError.ValidationFailed;
} }
} }
self.transitionState(.Pending, &.{ .Pending, .Executable }) catch return VkError.ValidationFailed;
} }

View File

@@ -24,6 +24,11 @@ pub const VULKAN_VENDOR_ID = @typeInfo(vk.VendorId).@"enum".fields[@typeInfo(vk.
pub const DRIVER_LOGS_ENV_NAME = "STROLL_LOGS_LEVEL"; pub const DRIVER_LOGS_ENV_NAME = "STROLL_LOGS_LEVEL";
pub const DRIVER_DEBUG_ALLOCATOR_ENV_NAME = "STROLL_DEBUG_ALLOCATOR"; pub const DRIVER_DEBUG_ALLOCATOR_ENV_NAME = "STROLL_DEBUG_ALLOCATOR";
/// Default driver name
pub const DRIVER_NAME = "Unnamed Driver";
/// Default Vulkan version
pub const VULKAN_VERSION = vk.makeApiVersion(0, 1, 0, 0);
pub const std_options: std.Options = .{ pub const std_options: std.Options = .{
.log_level = .debug, .log_level = .debug,
.logFn = logger.log, .logFn = logger.log,

View File

@@ -56,12 +56,12 @@ int main(void)
VkFence fence = kvfCreateFence(device); VkFence fence = kvfCreateFence(device);
VkCommandBuffer cmd = kvfCreateCommandBuffer(device); VkCommandBuffer cmd = kvfCreateCommandBuffer(device);
kvfCheckVk(vkResetCommandBuffer(cmd, 0));
kvfBeginCommandBuffer(cmd, 0); kvfBeginCommandBuffer(cmd, 0);
kvfEndCommandBuffer(cmd); kvfEndCommandBuffer(cmd);
kvfSubmitCommandBuffer(device, cmd, KVF_GRAPHICS_QUEUE, VK_NULL_HANDLE, VK_NULL_HANDLE, fence, NULL); kvfSubmitCommandBuffer(device, cmd, KVF_GRAPHICS_QUEUE, VK_NULL_HANDLE, VK_NULL_HANDLE, fence, NULL);
kvfCheckVk(vkResetCommandBuffer(cmd, 0));
kvfWaitForFence(device, fence); kvfWaitForFence(device, fence);
kvfDestroyFence(device, fence); kvfDestroyFence(device, fence);