fixing synchronization issues, implementing missing entrypoints
Test / build_and_test (push) Successful in 2m13s
Build / build (push) Successful in 2m30s

This commit is contained in:
2026-06-30 14:36:20 +02:00
parent b83ddd52a4
commit 7933bea68a
15 changed files with 547 additions and 130 deletions
+103
View File
@@ -113,7 +113,10 @@ pub fn create(device: *base.Device, allocator: std.mem.Allocator, info: *const v
.resolveImage = resolveImage,
.setEvent = setEvent,
.setBlendConstants = setBlendConstants,
.setDepthBias = setDepthBias,
.setDepthBounds = setDepthBounds,
.setDeviceMask = setDeviceMask,
.setLineWidth = setLineWidth,
.setScissor = setScissor,
.setStencilCompareMask = setStencilCompareMask,
.setStencilReference = setStencilReference,
@@ -121,6 +124,7 @@ pub fn create(device: *base.Device, allocator: std.mem.Allocator, info: *const v
.setViewport = setViewport,
.updateBuffer = updateBuffer,
.waitEvent = waitEvent,
.writeTimestamp = writeTimestamp,
};
self.* = .{
@@ -283,6 +287,36 @@ pub fn resetQueryPool(interface: *Interface, pool: *base.QueryPool, first: u32,
self.commands.append(allocator, .{ .ptr = cmd, .vtable = &.{ .execute = CommandImpl.execute } }) catch return VkError.OutOfHostMemory;
}
pub fn writeTimestamp(interface: *Interface, stage: vk.PipelineStageFlags, pool: *base.QueryPool, query: u32) VkError!void {
const self: *Self = @alignCast(@fieldParentPtr("interface", interface));
const allocator = self.command_allocator.allocator();
const CommandImpl = struct {
const Impl = @This();
stage: vk.PipelineStageFlags,
pool: *base.QueryPool,
query: u32,
pub fn execute(context: *anyopaque, device: *ExecutionDevice) VkError!void {
const impl: *Impl = @ptrCast(@alignCast(context));
_ = impl.stage;
const io = device.renderer.device.interface.io();
const now = std.Io.Timestamp.now(io, .real).toNanoseconds();
try impl.pool.writeTimestamp(impl.query, if (now > 0) @intCast(now) else 0);
}
};
const cmd = allocator.create(CommandImpl) catch return VkError.OutOfHostMemory;
errdefer allocator.destroy(cmd);
cmd.* = .{
.stage = stage,
.pool = pool,
.query = query,
};
self.commands.append(allocator, .{ .ptr = cmd, .vtable = &.{ .execute = CommandImpl.execute } }) catch return VkError.OutOfHostMemory;
}
pub fn beginRenderPass(interface: *Interface, render_pass: *base.RenderPass, framebuffer: *base.Framebuffer, render_area: vk.Rect2D, clear_values: ?[]const vk.ClearValue) VkError!void {
const self: *Self = @alignCast(@fieldParentPtr("interface", interface));
const allocator = self.command_allocator.allocator();
@@ -1330,6 +1364,75 @@ pub fn setBlendConstants(interface: *Interface, constants: [4]f32) VkError!void
self.commands.append(allocator, .{ .ptr = cmd, .vtable = &.{ .execute = CommandImpl.execute } }) catch return VkError.OutOfHostMemory;
}
pub fn setDepthBias(interface: *Interface, constant_factor: f32, clamp: f32, slope_factor: f32) VkError!void {
const self: *Self = @alignCast(@fieldParentPtr("interface", interface));
const allocator = self.command_allocator.allocator();
const CommandImpl = struct {
const Impl = @This();
depth_bias: @import("device/Renderer.zig").DepthBias,
pub fn execute(context: *anyopaque, device: *ExecutionDevice) VkError!void {
const impl: *Impl = @ptrCast(@alignCast(context));
device.renderer.dynamic_state.depth_bias = impl.depth_bias;
}
};
const cmd = allocator.create(CommandImpl) catch return VkError.OutOfHostMemory;
errdefer allocator.destroy(cmd);
cmd.* = .{
.depth_bias = .{
.constant_factor = constant_factor,
.clamp = clamp,
.slope_factor = slope_factor,
},
};
self.commands.append(allocator, .{ .ptr = cmd, .vtable = &.{ .execute = CommandImpl.execute } }) catch return VkError.OutOfHostMemory;
}
pub fn setDepthBounds(interface: *Interface, min: f32, max: f32) VkError!void {
const self: *Self = @alignCast(@fieldParentPtr("interface", interface));
const allocator = self.command_allocator.allocator();
const CommandImpl = struct {
const Impl = @This();
depth_bounds: @import("device/Renderer.zig").DepthBounds,
pub fn execute(context: *anyopaque, device: *ExecutionDevice) VkError!void {
const impl: *Impl = @ptrCast(@alignCast(context));
device.renderer.dynamic_state.depth_bounds = impl.depth_bounds;
}
};
const cmd = allocator.create(CommandImpl) catch return VkError.OutOfHostMemory;
errdefer allocator.destroy(cmd);
cmd.* = .{ .depth_bounds = .{ .min = min, .max = max } };
self.commands.append(allocator, .{ .ptr = cmd, .vtable = &.{ .execute = CommandImpl.execute } }) catch return VkError.OutOfHostMemory;
}
pub fn setLineWidth(interface: *Interface, width: f32) VkError!void {
const self: *Self = @alignCast(@fieldParentPtr("interface", interface));
const allocator = self.command_allocator.allocator();
const CommandImpl = struct {
const Impl = @This();
width: f32,
pub fn execute(context: *anyopaque, device: *ExecutionDevice) VkError!void {
const impl: *Impl = @ptrCast(@alignCast(context));
device.renderer.dynamic_state.line_width = impl.width;
}
};
const cmd = allocator.create(CommandImpl) catch return VkError.OutOfHostMemory;
errdefer allocator.destroy(cmd);
cmd.* = .{ .width = width };
self.commands.append(allocator, .{ .ptr = cmd, .vtable = &.{ .execute = CommandImpl.execute } }) catch return VkError.OutOfHostMemory;
}
pub fn setStencilCompareMask(interface: *Interface, face_mask: vk.StencilFaceFlags, compare_mask: u32) VkError!void {
try setStencilDynamicState(interface, face_mask, compare_mask, .compare_mask);
}