Update to zig 0.16.0, update deps, Vulkan validation fixes

This commit is contained in:
2026-05-13 00:43:49 +02:00
parent 39712e359d
commit 79c62141df
16 changed files with 204 additions and 137 deletions

View File

@@ -131,8 +131,8 @@ const vk_version: vk.Version = vk.makeApiVersion(
c.app_version.patch,
);
pub fn init(allocator: std.mem.Allocator, maybe_window: ?*glfw.Window) !Engine {
const vk_allocator = try VkAllocator.init(allocator);
pub fn init(allocator: std.mem.Allocator, io: std.Io, maybe_window: ?*glfw.Window) !Engine {
const vk_allocator = try VkAllocator.init(allocator, io);
errdefer vk_allocator.deinit();
// --- LOAD BASE DISPATCH --------------------------------------------------
@@ -381,8 +381,8 @@ pub fn init(allocator: std.mem.Allocator, maybe_window: ?*glfw.Window) !Engine {
const prng_ptr = try allocator.create(std.Random.Pcg);
errdefer allocator.destroy(prng_ptr);
const timestamp: u128 = @bitCast(std.time.nanoTimestamp());
prng_ptr.* = .init(@truncate(timestamp));
const timestamp: u64 = @bitCast(@as(i64, @truncate(std.Io.Timestamp.now(io, .awake).nanoseconds)));
prng_ptr.* = .init(timestamp);
const random = prng_ptr.random();
// -------------------------------------------------------------------------
@@ -562,7 +562,7 @@ pub fn queueSubmit(
},
};
try self.device.queueSubmit(queue, submits.len, &submits, submit_info.fence);
try self.device.queueSubmit(queue, &submits, submit_info.fence);
}
pub const PresentInfo = struct {
@@ -1152,7 +1152,7 @@ pub fn createGraphicsPipeline(self: *Engine, create_info: GraphicsPipelineCreate
};
var pipelines: [1]vk.Pipeline = undefined;
_ = try self.device.createGraphicsPipelines(.null_handle, graphics_pipeline_create_infos.len, &graphics_pipeline_create_infos, &self.vk_allocator.interface, &pipelines);
_ = try self.device.createGraphicsPipelines(.null_handle, &graphics_pipeline_create_infos, &self.vk_allocator.interface, &pipelines);
return pipelines[0];
}
@@ -1357,12 +1357,12 @@ pub fn deviceWaitIdle(self: *Engine) !void {
pub fn freeCommandBuffer(self: *Engine, free_info: CommandBufferFreeInfo) void {
const command_pool = self.resolveCommandPool(free_info.queue_type);
const command_buffers = [_]vk.CommandBuffer{free_info.command_buffer};
self.device.freeCommandBuffers(command_pool, command_buffers.len, &command_buffers);
self.device.freeCommandBuffers(command_pool, &command_buffers);
}
pub fn freeDescriptorSet(self: *Engine, descriptor_pool: vk.DescriptorPool, descriptor_set: vk.DescriptorSet) void {
const descriptor_sets = [_]vk.DescriptorSet{descriptor_set};
self.device.freeDescriptorSets(descriptor_pool, descriptor_sets.len, &descriptor_sets) catch unreachable;
self.device.freeDescriptorSets(descriptor_pool, &descriptor_sets) catch unreachable;
}
pub fn freeMemory(self: *Engine, device_memory: vk.DeviceMemory) void {
@@ -1398,7 +1398,8 @@ pub fn mapMemory(self: *Engine, memory: vk.DeviceMemory, offset: vk.DeviceSize,
}
pub fn resetFence(self: *Engine, fence: vk.Fence) !void {
try self.device.resetFences(1, @ptrCast(&fence));
const fences = [_]vk.Fence{fence};
try self.device.resetFences(&fences);
}
pub fn unmapMemory(self: *Engine, memory: vk.DeviceMemory) void {
@@ -1446,14 +1447,10 @@ pub fn updateDescriptorSets(self: *Engine, update_info: DescriptorSetsUpdateInfo
};
}
self.device.updateDescriptorSets(
@intCast(descriptor_writes.len),
descriptor_writes.ptr,
@intCast(update_info.copies.len),
update_info.copies.ptr,
);
self.device.updateDescriptorSets(descriptor_writes, update_info.copies);
}
pub fn waitForFence(self: *Engine, fence: vk.Fence) !void {
_ = try self.device.waitForFences(1, @ptrCast(&fence), .true, 1 * std.time.ns_per_s);
const fences = [_]vk.Fence{fence};
_ = try self.device.waitForFences(&fences, .true, 1 * std.time.ns_per_s);
}