From 991fa74c5bcdfe34bcc316baa62e99ab1d5b74dd Mon Sep 17 00:00:00 2001 From: Kbz-8 Date: Mon, 9 Mar 2026 22:59:39 +0100 Subject: [PATCH] fixing compilation issue --- src/soft/SoftCommandBuffer.zig | 5 +++-- src/soft/SoftImage.zig | 4 ++-- src/soft/SoftQueue.zig | 7 ++++++- src/vulkan/CommandBuffer.zig | 2 ++ 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/soft/SoftCommandBuffer.zig b/src/soft/SoftCommandBuffer.zig index 595d95e..b62e006 100644 --- a/src/soft/SoftCommandBuffer.zig +++ b/src/soft/SoftCommandBuffer.zig @@ -73,10 +73,11 @@ pub fn destroy(interface: *Interface, allocator: std.mem.Allocator) void { pub fn execute(self: *Self, device: *ExecutionDevice) VkError!void { self.interface.submit() catch return; + defer self.interface.finish() catch {}; + for (self.commands.items) |command| { try command.vtable.execute(command.ptr, device); } - try self.interface.finish(); } pub fn begin(interface: *Interface, _: *const vk.CommandBufferBeginInfo) VkError!void { @@ -282,7 +283,7 @@ pub fn copyImageToBuffer(interface: *Interface, src: *base.Image, src_layout: vk pub fn execute(impl: *const Impl, _: *ExecutionDevice) VkError!void { for (impl.regions[0..]) |region| { - try impl.dst.copyToBuffer(impl.dst, region); + try impl.src.copyToBuffer(impl.dst, region); } } }; diff --git a/src/soft/SoftImage.zig b/src/soft/SoftImage.zig index c11929a..c370282 100644 --- a/src/soft/SoftImage.zig +++ b/src/soft/SoftImage.zig @@ -83,7 +83,7 @@ pub fn copyToBuffer(self: *const Self, dst: *SoftBuffer, region: vk.BufferImageC ); } -pub fn copyFromBuffer(self: *const Self, src: *SoftBuffer, region: vk.BufferImageCopy) VkError!void { +pub fn copyFromBuffer(self: *const Self, src: *const SoftBuffer, region: vk.BufferImageCopy) VkError!void { const src_size = src.interface.size - region.buffer_offset; const src_memory = if (src.interface.memory) |memory| memory else return VkError.InvalidDeviceMemoryDrv; const src_map: []u8 = @as([*]u8, @ptrCast(try src_memory.map(region.buffer_offset, src_size)))[0..src_size]; @@ -99,7 +99,7 @@ pub fn copyFromBuffer(self: *const Self, src: *SoftBuffer, region: vk.BufferImag } pub fn copy( - self: *Self, + self: *const Self, src_memory: ?[]const u8, dst_memory: ?[]u8, row_len: usize, diff --git a/src/soft/SoftQueue.zig b/src/soft/SoftQueue.zig index 2ade439..07910dd 100644 --- a/src/soft/SoftQueue.zig +++ b/src/soft/SoftQueue.zig @@ -104,7 +104,12 @@ fn taskRunner(self: *Self, info: Interface.SubmitInfo, p_fence: ?*base.Fence, ru for (info.command_buffers.items) |command_buffer| { const soft_command_buffer: *SoftCommandBuffer = @alignCast(@fieldParentPtr("interface", command_buffer)); - soft_command_buffer.execute(&execution_device) catch |err| base.errors.errorLoggerContext(err, "the software execution device"); + soft_command_buffer.execute(&execution_device) catch |err| { + base.errors.errorLoggerContext(err, "the software execution device"); + if (@errorReturnTrace()) |trace| { + std.debug.dumpStackTrace(trace.*); + } + }; } if (p_fence) |fence| { diff --git a/src/vulkan/CommandBuffer.zig b/src/vulkan/CommandBuffer.zig index e4926fb..9fb34c0 100644 --- a/src/vulkan/CommandBuffer.zig +++ b/src/vulkan/CommandBuffer.zig @@ -114,6 +114,7 @@ pub inline fn submit(self: *Self) VkError!void { if (self.begin_info) |begin_info| { if (!begin_info.flags.simultaneous_use_bit) { self.transitionState(.Pending, &.{.Executable}) catch return VkError.ValidationFailed; + return; } } self.transitionState(.Pending, &.{ .Pending, .Executable }) catch return VkError.ValidationFailed; @@ -123,6 +124,7 @@ pub inline fn finish(self: *Self) VkError!void { if (self.begin_info) |begin_info| { if (!begin_info.flags.one_time_submit_bit) { self.transitionState(.Invalid, &.{.Pending}) catch return VkError.ValidationFailed; + return; } } self.transitionState(.Executable, &.{.Pending}) catch return VkError.ValidationFailed;