fixing soft queues, improving blitter
Build / build (push) Successful in 1m2s
Test / build_and_test (push) Successful in 47m49s

This commit is contained in:
2026-04-21 21:45:40 +02:00
parent 602ade81d4
commit aaeca6f854
6 changed files with 257 additions and 106 deletions
+4 -15
View File
@@ -17,7 +17,7 @@ const Self = @This();
pub const Interface = base.Queue;
interface: Interface,
lock: std.Io.RwLock,
group: std.Io.Group,
pub fn create(allocator: std.mem.Allocator, device: *base.Device, index: u32, family_index: u32, flags: vk.DeviceQueueCreateFlags) VkError!*Interface {
const self = allocator.create(Self) catch return VkError.OutOfHostMemory;
@@ -33,7 +33,7 @@ pub fn create(allocator: std.mem.Allocator, device: *base.Device, index: u32, fa
self.* = .{
.interface = interface,
.lock = .init,
.group = .init,
};
return &self.interface;
}
@@ -58,10 +58,6 @@ pub fn submit(interface: *Interface, infos: []Interface.SubmitInfo, p_fence: ?*b
const allocator = soft_device.device_allocator.allocator();
const io = soft_device.interface.io();
// Lock here to avoid acquiring it in `waitIdle` before runners start
self.lock.lockShared(io) catch return VkError.DeviceLost;
defer self.lock.unlockShared(io);
for (infos) |info| {
// Cloning info to keep them alive until command execution ends
const cloned_info: Interface.SubmitInfo = .{
@@ -69,24 +65,17 @@ pub fn submit(interface: *Interface, infos: []Interface.SubmitInfo, p_fence: ?*b
};
const runners_counter = allocator.create(RefCounter) catch return VkError.OutOfDeviceMemory;
runners_counter.* = .init;
_ = soft_device.interface.io().async(Self.taskRunner, .{ self, cloned_info, p_fence, runners_counter });
self.group.async(io, Self.taskRunner, .{ self, cloned_info, p_fence, runners_counter });
}
}
pub fn waitIdle(interface: *Interface) VkError!void {
const self: *Self = @alignCast(@fieldParentPtr("interface", interface));
const io = interface.owner.io();
self.lock.lock(io) catch return VkError.DeviceLost;
defer self.lock.unlock(io);
self.group.await(io) catch return VkError.DeviceLost;
}
fn taskRunner(self: *Self, info: Interface.SubmitInfo, p_fence: ?*base.Fence, runners_counter: *RefCounter) void {
const io = self.interface.owner.io();
self.lock.lockShared(io) catch return;
defer self.lock.unlockShared(io);
runners_counter.ref();
defer {
runners_counter.unref();